X7ROOT File Manager
Current Path:
/opt/cloudlinux/venv/lib/python3.11/site-packages/isort
opt
/
cloudlinux
/
venv
/
lib
/
python3.11
/
site-packages
/
isort
/
ðŸ“
..
📄
__init__.py
(871 B)
📄
__main__.py
(36 B)
ðŸ“
__pycache__
ðŸ“
_vendored
📄
_version.py
(72 B)
📄
api.py
(25.51 KB)
📄
comments.py
(933 B)
📄
core.py
(22 KB)
ðŸ“
deprecated
📄
exceptions.py
(6.89 KB)
📄
files.py
(1.55 KB)
📄
format.py
(5.35 KB)
📄
hooks.py
(3.26 KB)
📄
identify.py
(8.18 KB)
📄
io.py
(2.16 KB)
📄
literal.py
(3.63 KB)
📄
logo.py
(388 B)
📄
main.py
(45.73 KB)
📄
output.py
(27.15 KB)
📄
parse.py
(24.74 KB)
📄
place.py
(5.05 KB)
📄
profiles.py
(2.09 KB)
📄
py.typed
(0 B)
📄
pylama_isort.py
(1.28 KB)
📄
sections.py
(297 B)
📄
settings.py
(34.75 KB)
📄
setuptools_commands.py
(2.24 KB)
📄
sorting.py
(4.41 KB)
ðŸ“
stdlibs
📄
utils.py
(2.36 KB)
📄
wrap.py
(6.17 KB)
📄
wrap_modes.py
(13.25 KB)
Editing: setuptools_commands.py
import glob import os import sys from typing import Any, Dict, Iterator, List from warnings import warn import setuptools # type: ignore from . import api from .settings import DEFAULT_CONFIG class ISortCommand(setuptools.Command): # type: ignore """The :class:`ISortCommand` class is used by setuptools to perform imports checks on registered modules. """ description = "Run isort on modules registered in setuptools" user_options: List[Any] = [] def initialize_options(self) -> None: default_settings = vars(DEFAULT_CONFIG).copy() for key, value in default_settings.items(): setattr(self, key, value) def finalize_options(self) -> None: """Get options from config files.""" self.arguments: Dict[str, Any] = {} # skipcq: PYL-W0201 self.arguments["settings_path"] = os.getcwd() def distribution_files(self) -> Iterator[str]: """Find distribution packages.""" # This is verbatim from flake8 if self.distribution.packages: # pragma: no cover package_dirs = self.distribution.package_dir or {} for package in self.distribution.packages: pkg_dir = package if package in package_dirs: pkg_dir = package_dirs[package] elif "" in package_dirs: # pragma: no cover pkg_dir = package_dirs[""] + os.path.sep + pkg_dir yield pkg_dir.replace(".", os.path.sep) if self.distribution.py_modules: for filename in self.distribution.py_modules: yield f"{filename}.py" # Don't miss the setup.py file itself yield "setup.py" def run(self) -> None: arguments = self.arguments wrong_sorted_files = False for path in self.distribution_files(): for python_file in glob.iglob(os.path.join(path, "*.py")): try: if not api.check_file(python_file, **arguments): wrong_sorted_files = True # pragma: no cover except OSError as error: # pragma: no cover warn(f"Unable to parse file {python_file} due to {error}") if wrong_sorted_files: sys.exit(1) # pragma: no cover
Upload File
Create Folder