isort API Reference
Full documentation for isort (5.13.2)
isort.Config
Python Library Documentation: class Config in module isort.settings
class Config(_Config)
| Config(settings_file: str = '', settings_path: str = '', config: Optional[isort.settings._Config] = None, **config_overrides: Any)
|
| Method resolution order:
| Config
| _Config
| builtins.object
|
| Methods defined here:
|
| __init__(self, settings_file: str = '', settings_path: str = '', config: Optional[isort.settings._Config] = None, **config_overrides: Any)
| Initialize self. See help(type(self)) for accurate signature.
|
| is_skipped(self, file_path: pathlib.Path) -> bool
| Returns True if the file and/or folder should be skipped based on current settings.
|
| is_supported_filetype(self, file_name: str) -> bool
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| known_patterns
|
| section_comments
|
| section_comments_end
|
| skip_globs
|
| skips
|
| sorting_function
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from _Config:
|
| __delattr__(self, name)
| Implement delattr(self, name).
|
| __eq__(self, other)
| Return self==value.
|
| __hash__(self) -> int
| Return hash(self).
|
| __post_init__(self) -> None
|
| __repr__(self)
| Return repr(self).
|
| __setattr__(self, name, value)
| Implement setattr(self, name, value).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _Config:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from _Config:
|
| __dataclass_fields__ = {'add_imports': Field(name='add_imports',type=t...
|
| __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,or...
|
| __match_args__ = ('py_version', 'force_to_top', 'skip', 'extend_skip',...
|
| add_imports = frozenset()
|
| append_only = False
|
| atomic = False
|
| auto_identify_namespace_packages = True
|
| balanced_wrapping = False
|
| blocked_extensions = frozenset({'pex'})
|
| case_sensitive = False
|
| classes = frozenset()
|
| color_output = False
|
| combine_as_imports = False
|
| combine_star = False
|
| combine_straight_imports = False
|
| comment_prefix = ' #'
|
| conda_env = ''
|
| constants = frozenset()
|
| dedup_headings = False
|
| default_section = 'THIRDPARTY'
|
| directory = ''
|
| ensure_newline_before_comments = False
|
| extend_skip = frozenset()
|
| extend_skip_glob = frozenset()
|
| extra_standard_library = frozenset()
|
| filter_files = False
|
| float_to_top = False
|
| follow_links = True
|
| force_adds = False
|
| force_alphabetical_sort = False
|
| force_alphabetical_sort_within_sections = False
|
| force_grid_wrap = 0
|
| force_single_line = False
|
| force_sort_within_sections = False
|
| force_to_top = frozenset()
|
| forced_separate = ()
|
| format_error = '{error}: {message}'
|
| format_success = '{success}: {message}'
|
| formatter = ''
|
| formatting_function = None
|
| from_first = False
|
| group_by_package = False
|
| honor_case_in_force_sorted_sections = False
|
| honor_noqa = False
|
| ignore_comments = False
|
| ignore_whitespace = False
|
| import_dependencies = typing.Dict[str, str]
|
| include_trailing_comma = False
|
| indent = ' '
|
| indented_import_headings = True
|
| known_first_party = frozenset()
|
| known_future_library = frozenset({'__future__'})
|
| known_local_folder = frozenset()
|
| known_standard_library = frozenset()
|
| known_third_party = frozenset()
|
| length_sort = False
|
| length_sort_sections = frozenset()
|
| length_sort_straight = False
|
| lexicographical = False
|
| line_ending = ''
|
| line_length = 79
|
| lines_after_imports = -1
|
| lines_before_imports = -1
|
| lines_between_sections = 1
|
| lines_between_types = 0
|
| multi_line_output = <WrapModes.GRID: 0>
|
| namespace_packages = frozenset()
|
| no_inline_sort = False
|
| no_lines_before = frozenset()
|
| no_sections = False
|
| old_finders = False
|
| only_modified = False
|
| only_sections = False
|
| order_by_type = True
|
| overwrite_in_place = False
|
| profile = ''
|
| py_version = '3'
|
| quiet = False
|
| remove_imports = frozenset()
|
| remove_redundant_aliases = False
|
| reverse_relative = False
|
| reverse_sort = False
|
| sections = ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLD...
|
| single_line_exclusions = ()
|
| skip = frozenset({'.bzr', '.direnv', '.eggs', '.git', '.hg', '.mypy_ca...
|
| skip_gitignore = False
|
| skip_glob = frozenset()
|
| sort_order = 'natural'
|
| sort_reexports = False
|
| sort_relative_in_force_sorted_sections = False
|
| sources = ()
|
| split_on_trailing_comma = False
|
| src_paths = ()
|
| star_first = False
|
| supported_extensions = frozenset({'pxd', 'py', 'pyi', 'pyx'})
|
| treat_all_comments_as_code = False
|
| treat_comments_as_code = frozenset()
|
| use_parentheses = False
|
| variables = frozenset()
|
| verbose = False
|
| virtual_env = ''
|
| wrap_length = 0
isort.ImportKey
Python Library Documentation: class ImportKey in module isort.api class ImportKey(enum.Enum) | ImportKey(*values) | | Defines how to key an individual import, generally for deduping. | | Import keys are defined from less to more specific: | | from x.y import z as a | ______| | | | | | | | | | PACKAGE | | | | ________| | | | | | | | MODULE | | | _________________| | | | | | ATTRIBUTE | | ______________________| | | | ALIAS | | Method resolution order: | ImportKey | enum.Enum | builtins.object | | Data and other attributes defined here: | | ALIAS = <ImportKey.ALIAS: 4> | | ATTRIBUTE = <ImportKey.ATTRIBUTE: 3> | | MODULE = <ImportKey.MODULE: 2> | | PACKAGE = <ImportKey.PACKAGE: 1> | | ---------------------------------------------------------------------- | Data descriptors inherited from enum.Enum: | | name | The name of the Enum member. | | value | The value of the Enum member. | | ---------------------------------------------------------------------- | Static methods inherited from enum.EnumType: | | __contains__(value) | Return True if `value` is in `cls`. | | `value` is in `cls` if: | 1) `value` is a member of `cls`, or | 2) `value` is the value of one of the `cls`'s members. | | __getitem__(name) | Return the member matching `name`. | | __iter__() | Return members in definition order. | | __len__() | Return the number of members (no aliases) | | ---------------------------------------------------------------------- | Readonly properties inherited from enum.EnumType: | | __members__ | Returns a mapping of member name->value. | | This mapping lists all enum members, including aliases. Note that this | is a read-only view of the internal mapping.
isort.api
Python Library Documentation: module isort.api in isort
NAME
isort.api
CLASSES
enum.Enum(builtins.object)
ImportKey
class ImportKey(enum.Enum)
| ImportKey(*values)
|
| Defines how to key an individual import, generally for deduping.
|
| Import keys are defined from less to more specific:
|
| from x.y import z as a
| ______| | | |
| | | | |
| PACKAGE | | |
| ________| | |
| | | |
| MODULE | |
| _________________| |
| | |
| ATTRIBUTE |
| ______________________|
| |
| ALIAS
|
| Method resolution order:
| ImportKey
| enum.Enum
| builtins.object
|
| Data and other attributes defined here:
|
| ALIAS = <ImportKey.ALIAS: 4>
|
| ATTRIBUTE = <ImportKey.ATTRIBUTE: 3>
|
| MODULE = <ImportKey.MODULE: 2>
|
| PACKAGE = <ImportKey.PACKAGE: 1>
|
| ----------------------------------------------------------------------
| Data descriptors inherited from enum.Enum:
|
| name
| The name of the Enum member.
|
| value
| The value of the Enum member.
|
| ----------------------------------------------------------------------
| Static methods inherited from enum.EnumType:
|
| __contains__(value)
| Return True if `value` is in `cls`.
|
| `value` is in `cls` if:
| 1) `value` is a member of `cls`, or
| 2) `value` is the value of one of the `cls`'s members.
|
| __getitem__(name)
| Return the member matching `name`.
|
| __iter__()
| Return members in definition order.
|
| __len__()
| Return the number of members (no aliases)
|
| ----------------------------------------------------------------------
| Readonly properties inherited from enum.EnumType:
|
| __members__
| Returns a mapping of member name->value.
|
| This mapping lists all enum members, including aliases. Note that this
| is a read-only view of the internal mapping.
FUNCTIONS
check_code_string(code: str, show_diff: Union[bool, TextIO] = False, extension: Optional[str] = None, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False), file_path: Optional[pathlib.Path] = None, disregard_skip: bool = False, **config_kwargs: Any) -> bool
Checks the order, format, and categorization of imports within the provided code string.
Returns `True` if everything is correct, otherwise `False`.
- **code**: The string of code with imports that need to be sorted.
- **show_diff**: If `True` the changes that need to be done will be printed to stdout, if a
TextIO stream is provided results will be written to it, otherwise no diff will be computed.
- **extension**: The file extension that contains imports. Defaults to filename extension or py.
- **config**: The config object to use when sorting imports.
- **file_path**: The disk location where the code string was pulled from.
- **disregard_skip**: set to `True` if you want to ignore a skip set in config for this file.
- ****config_kwargs**: Any config modifications.
check_file(filename: Union[str, pathlib.Path], show_diff: Union[bool, TextIO] = False, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False), file_path: Optional[pathlib.Path] = None, disregard_skip: bool = True, extension: Optional[str] = None, **config_kwargs: Any) -> bool
Checks any imports within the provided file, returning `False` if any unsorted or
incorrectly imports are found or `True` if no problems are identified.
- **filename**: The name or Path of the file to check.
- **show_diff**: If `True` the changes that need to be done will be printed to stdout, if a
TextIO stream is provided results will be written to it, otherwise no diff will be computed.
- **config**: The config object to use when sorting imports.
- **file_path**: The disk location where the code string was pulled from.
- **disregard_skip**: set to `True` if you want to ignore a skip set in config for this file.
- **extension**: The file extension that contains imports. Defaults to filename extension or py.
- ****config_kwargs**: Any config modifications.
check_stream(input_stream: <class 'TextIO'>, show_diff: Union[bool, TextIO] = False, extension: Optional[str] = None, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False), file_path: Optional[pathlib.Path] = None, disregard_skip: bool = False, **config_kwargs: Any) -> bool
Checks any imports within the provided code stream, returning `False` if any unsorted or
incorrectly imports are found or `True` if no problems are identified.
- **input_stream**: The stream of code with imports that need to be sorted.
- **show_diff**: If `True` the changes that need to be done will be printed to stdout, if a
TextIO stream is provided results will be written to it, otherwise no diff will be computed.
- **extension**: The file extension that contains imports. Defaults to filename extension or py.
- **config**: The config object to use when sorting imports.
- **file_path**: The disk location where the code string was pulled from.
- **disregard_skip**: set to `True` if you want to ignore a skip set in config for this file.
- ****config_kwargs**: Any config modifications.
find_imports_in_code(code: str, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False), file_path: Optional[pathlib.Path] = None, unique: Union[bool, isort.api.ImportKey] = False, top_only: bool = False, **config_kwargs: Any) -> Iterator[isort.identify.Import]
Finds and returns all imports within the provided code string.
- **code**: The string of code with imports that need to be sorted.
- **config**: The config object to use when sorting imports.
- **file_path**: The disk location where the code string was pulled from.
- **unique**: If True, only the first instance of an import is returned.
- **top_only**: If True, only return imports that occur before the first function or class.
- ****config_kwargs**: Any config modifications.
find_imports_in_file(filename: Union[str, pathlib.Path], config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False), file_path: Optional[pathlib.Path] = None, unique: Union[bool, isort.api.ImportKey] = False, top_only: bool = False, **config_kwargs: Any) -> Iterator[isort.identify.Import]
Finds and returns all imports within the provided source file.
- **filename**: The name or Path of the file to look for imports in.
- **extension**: The file extension that contains imports. Defaults to filename extension or py.
- **config**: The config object to use when sorting imports.
- **file_path**: The disk location where the code string was pulled from.
- **unique**: If True, only the first instance of an import is returned.
- **top_only**: If True, only return imports that occur before the first function or class.
- ****config_kwargs**: Any config modifications.
find_imports_in_paths(paths: Iterator[Union[str, pathlib.Path]], config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False), file_path: Optional[pathlib.Path] = None, unique: Union[bool, isort.api.ImportKey] = False, top_only: bool = False, **config_kwargs: Any) -> Iterator[isort.identify.Import]
Finds and returns all imports within the provided source paths.
- **paths**: A collection of paths to recursively look for imports within.
- **extension**: The file extension that contains imports. Defaults to filename extension or py.
- **config**: The config object to use when sorting imports.
- **file_path**: The disk location where the code string was pulled from.
- **unique**: If True, only the first instance of an import is returned.
- **top_only**: If True, only return imports that occur before the first function or class.
- ****config_kwargs**: Any config modifications.
find_imports_in_stream(input_stream: <class 'TextIO'>, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False), file_path: Optional[pathlib.Path] = None, unique: Union[bool, isort.api.ImportKey] = False, top_only: bool = False, _seen: Optional[Set[str]] = None, **config_kwargs: Any) -> Iterator[isort.identify.Import]
Finds and returns all imports within the provided code stream.
- **input_stream**: The stream of code with imports that need to be sorted.
- **config**: The config object to use when sorting imports.
- **file_path**: The disk location where the code string was pulled from.
- **unique**: If True, only the first instance of an import is returned.
- **top_only**: If True, only return imports that occur before the first function or class.
- **_seen**: An optional set of imports already seen. Generally meant only for internal use.
- ****config_kwargs**: Any config modifications.
place_module = module(name: str, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False)) -> str
Returns the section placement for the given module name.
place_module_with_reason = module_with_reason(name: str, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False)) -> Tuple[str, str]
Returns the section placement for the given module name alongside the reasoning.
sort_code_string(code: str, extension: Optional[str] = None, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False), file_path: Optional[pathlib.Path] = None, disregard_skip: bool = False, show_diff: Union[bool, TextIO] = False, **config_kwargs: Any) -> str
Sorts any imports within the provided code string, returning a new string with them sorted.
- **code**: The string of code with imports that need to be sorted.
- **extension**: The file extension that contains imports. Defaults to filename extension or py.
- **config**: The config object to use when sorting imports.
- **file_path**: The disk location where the code string was pulled from.
- **disregard_skip**: set to `True` if you want to ignore a skip set in config for this file.
- **show_diff**: If `True` the changes that need to be done will be printed to stdout, if a
TextIO stream is provided results will be written to it, otherwise no diff will be computed.
- ****config_kwargs**: Any config modifications.
sort_file(filename: Union[str, pathlib.Path], extension: Optional[str] = None, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False), file_path: Optional[pathlib.Path] = None, disregard_skip: bool = True, ask_to_apply: bool = False, show_diff: Union[bool, TextIO] = False, write_to_stdout: bool = False, output: Optional[TextIO] = None, **config_kwargs: Any) -> bool
Sorts and formats any groups of imports imports within the provided file or Path.
Returns `True` if the file has been changed, otherwise `False`.
- **filename**: The name or Path of the file to format.
- **extension**: The file extension that contains imports. Defaults to filename extension or py.
- **config**: The config object to use when sorting imports.
- **file_path**: The disk location where the code string was pulled from.
- **disregard_skip**: set to `True` if you want to ignore a skip set in config for this file.
- **ask_to_apply**: If `True`, prompt before applying any changes.
- **show_diff**: If `True` the changes that need to be done will be printed to stdout, if a
TextIO stream is provided results will be written to it, otherwise no diff will be computed.
- **write_to_stdout**: If `True`, write to stdout instead of the input file.
- **output**: If a TextIO is provided, results will be written there rather than replacing
the original file content.
- ****config_kwargs**: Any config modifications.
sort_stream(input_stream: <class 'TextIO'>, output_stream: <class 'TextIO'>, extension: Optional[str] = None, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False), file_path: Optional[pathlib.Path] = None, disregard_skip: bool = False, show_diff: Union[bool, TextIO] = False, raise_on_skip: bool = True, **config_kwargs: Any) -> bool
Sorts any imports within the provided code stream, outputs to the provided output stream.
Returns `True` if anything is modified from the original input stream, otherwise `False`.
- **input_stream**: The stream of code with imports that need to be sorted.
- **output_stream**: The stream where sorted imports should be written to.
- **extension**: The file extension that contains imports. Defaults to filename extension or py.
- **config**: The config object to use when sorting imports.
- **file_path**: The disk location where the code string was pulled from.
- **disregard_skip**: set to `True` if you want to ignore a skip set in config for this file.
- **show_diff**: If `True` the changes that need to be done will be printed to stdout, if a
TextIO stream is provided results will be written to it, otherwise no diff will be computed.
- ****config_kwargs**: Any config modifications.
DATA
__all__ = ('ImportKey', 'check_code_string', 'check_file', 'check_stre...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\isort\api.py
isort.check_code
Python Library Documentation: function check_code_string in module isort.api
check_code_string(code: str, show_diff: Union[bool, TextIO] = False, extension: Optional[str] = None, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False), file_path: Optional[pathlib.Path] = None, disregard_skip: bool = False, **config_kwargs: Any) -> bool
Checks the order, format, and categorization of imports within the provided code string.
Returns `True` if everything is correct, otherwise `False`.
- **code**: The string of code with imports that need to be sorted.
- **show_diff**: If `True` the changes that need to be done will be printed to stdout, if a
TextIO stream is provided results will be written to it, otherwise no diff will be computed.
- **extension**: The file extension that contains imports. Defaults to filename extension or py.
- **config**: The config object to use when sorting imports.
- **file_path**: The disk location where the code string was pulled from.
- **disregard_skip**: set to `True` if you want to ignore a skip set in config for this file.
- ****config_kwargs**: Any config modifications.
isort.check_file
Python Library Documentation: function check_file in module isort.api
check_file(filename: Union[str, pathlib.Path], show_diff: Union[bool, TextIO] = False, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False), file_path: Optional[pathlib.Path] = None, disregard_skip: bool = True, extension: Optional[str] = None, **config_kwargs: Any) -> bool
Checks any imports within the provided file, returning `False` if any unsorted or
incorrectly imports are found or `True` if no problems are identified.
- **filename**: The name or Path of the file to check.
- **show_diff**: If `True` the changes that need to be done will be printed to stdout, if a
TextIO stream is provided results will be written to it, otherwise no diff will be computed.
- **config**: The config object to use when sorting imports.
- **file_path**: The disk location where the code string was pulled from.
- **disregard_skip**: set to `True` if you want to ignore a skip set in config for this file.
- **extension**: The file extension that contains imports. Defaults to filename extension or py.
- ****config_kwargs**: Any config modifications.
isort.check_stream
Python Library Documentation: function check_stream in module isort.api
check_stream(input_stream: <class 'TextIO'>, show_diff: Union[bool, TextIO] = False, extension: Optional[str] = None, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False), file_path: Optional[pathlib.Path] = None, disregard_skip: bool = False, **config_kwargs: Any) -> bool
Checks any imports within the provided code stream, returning `False` if any unsorted or
incorrectly imports are found or `True` if no problems are identified.
- **input_stream**: The stream of code with imports that need to be sorted.
- **show_diff**: If `True` the changes that need to be done will be printed to stdout, if a
TextIO stream is provided results will be written to it, otherwise no diff will be computed.
- **extension**: The file extension that contains imports. Defaults to filename extension or py.
- **config**: The config object to use when sorting imports.
- **file_path**: The disk location where the code string was pulled from.
- **disregard_skip**: set to `True` if you want to ignore a skip set in config for this file.
- ****config_kwargs**: Any config modifications.
isort.code
Python Library Documentation: function sort_code_string in module isort.api
sort_code_string(code: str, extension: Optional[str] = None, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False), file_path: Optional[pathlib.Path] = None, disregard_skip: bool = False, show_diff: Union[bool, TextIO] = False, **config_kwargs: Any) -> str
Sorts any imports within the provided code string, returning a new string with them sorted.
- **code**: The string of code with imports that need to be sorted.
- **extension**: The file extension that contains imports. Defaults to filename extension or py.
- **config**: The config object to use when sorting imports.
- **file_path**: The disk location where the code string was pulled from.
- **disregard_skip**: set to `True` if you want to ignore a skip set in config for this file.
- **show_diff**: If `True` the changes that need to be done will be printed to stdout, if a
TextIO stream is provided results will be written to it, otherwise no diff will be computed.
- ****config_kwargs**: Any config modifications.
isort.comments
Python Library Documentation: module isort.comments in isort
NAME
isort.comments
FUNCTIONS
add_to_line(comments: Optional[List[str]], original_string: str = '', removed: bool = False, comment_prefix: str = '') -> str
Returns a string with comments added if removed is not set.
parse(line: str) -> Tuple[str, str]
Parses import lines for comments and returns back the
import statement and the associated comment.
DATA
List = typing.List
A generic version of list.
Optional = typing.Optional
Optional[X] is equivalent to Union[X, None].
Tuple = typing.Tuple
Deprecated alias to builtins.tuple.
Tuple[X, Y] is the cross-product type of X and Y.
Example: Tuple[T1, T2] is a tuple of two elements corresponding
to type variables T1 and T2. Tuple[int, float, str] is a tuple
of an int, a float and a string.
To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\isort\comments.py
isort.core
Python Library Documentation: module isort.core in isort
NAME
isort.core
FUNCTIONS
process(input_stream: <class 'TextIO'>, output_stream: <class 'TextIO'>, extension: str = 'py', raise_on_skip: bool = True, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False)) -> bool
Parses stream identifying sections of contiguous imports and sorting them
Code with unsorted imports is read from the provided `input_stream`, sorted and then
outputted to the specified `output_stream`.
- `input_stream`: Text stream with unsorted import sections.
- `output_stream`: Text stream to output sorted inputs into.
- `config`: Config settings to use when sorting imports. Defaults settings.
- *Default*: `isort.settings.DEFAULT_CONFIG`.
- `extension`: The file extension or file extension rules that should be used.
- *Default*: `"py"`.
- *Choices*: `["py", "pyi", "pyx"]`.
Returns `True` if there were changes that needed to be made (errors present) from what
was provided in the input_stream, otherwise `False`.
DATA
CIMPORT_IDENTIFIERS = ('cimport ', 'cimport*', 'from.cimport')
CODE_SORT_COMMENTS = ('# isort: list', '# isort: dict', '# isort: set'...
COMMENT_INDICATORS = ('"""', "'''", "'", '"', '#')
DEFAULT_CONFIG = Config(py_version='py3', force_to_top=frozenset(...t_...
DOCSTRING_INDICATORS = ('"""', "'''")
FILE_SKIP_COMMENTS = ('isort:skip_file', 'isort: skip_file')
IMPORT_START_IDENTIFIERS = ('from ', 'from.import', 'import ', 'import...
LITERAL_TYPE_MAPPING = {'(': 'tuple', '[': 'list', '{': 'set'}
List = typing.List
A generic version of list.
Union = typing.Union
Union type; Union[X, Y] means either X or Y.
On Python 3.10 and higher, the | operator
can also be used to denote unions;
X | Y means the same thing to the type checker as Union[X, Y].
To define a union, use e.g. Union[int, str]. Details:
- The arguments must be types and there must be at least one.
- None as an argument is a special case and is replaced by
type(None).
- Unions of unions are flattened, e.g.::
assert Union[Union[int, str], float] == Union[int, str, float]
- Unions of a single argument vanish, e.g.::
assert Union[int] == int # The constructor actually returns int
- Redundant arguments are skipped, e.g.::
assert Union[int, str, int] == Union[int, str]
- When comparing unions, the argument order is ignored, e.g.::
assert Union[int, str] == Union[str, int]
- You cannot subclass or instantiate a union.
- You can use Optional[X] as a shorthand for Union[X, None].
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\isort\core.py
isort.exceptions
Python Library Documentation: module isort.exceptions in isort
NAME
isort.exceptions - All isort specific exception classes should be defined here
CLASSES
builtins.Exception(builtins.BaseException)
ISortError
AssignmentsFormatMismatch
ExistingSyntaxErrors
FileSkipped
FileSkipComment
FileSkipSetting
FormattingPluginDoesNotExist
IntroducedSyntaxErrors
InvalidSettingsPath
LiteralParsingFailure
LiteralSortTypeMismatch
MissingSection
ProfileDoesNotExist
SortingFunctionDoesNotExist
UnsupportedEncoding
UnsupportedSettings
class AssignmentsFormatMismatch(ISortError)
| AssignmentsFormatMismatch(code: str)
|
| Raised when isort is told to sort assignments but the format of the assignment section
| doesn't match isort's expectation.
|
| Method resolution order:
| AssignmentsFormatMismatch
| ISortError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, code: str)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from ISortError:
|
| __reduce__(self)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from ISortError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class ExistingSyntaxErrors(ISortError)
| ExistingSyntaxErrors(file_path: str)
|
| Raised when isort is told to sort imports within code that has existing syntax errors
|
| Method resolution order:
| ExistingSyntaxErrors
| ISortError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, file_path: str)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from ISortError:
|
| __reduce__(self)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from ISortError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class FileSkipComment(FileSkipped)
| FileSkipComment(file_path: str, **kwargs: str)
|
| Raised when an entire file is skipped due to a isort skip file comment
|
| Method resolution order:
| FileSkipComment
| FileSkipped
| ISortError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, file_path: str, **kwargs: str)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from ISortError:
|
| __reduce__(self)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from ISortError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class FileSkipSetting(FileSkipped)
| FileSkipSetting(file_path: str, **kwargs: str)
|
| Raised when an entire file is skipped due to provided isort settings
|
| Method resolution order:
| FileSkipSetting
| FileSkipped
| ISortError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, file_path: str, **kwargs: str)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from ISortError:
|
| __reduce__(self)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from ISortError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class FileSkipped(ISortError)
| FileSkipped(message: str, file_path: str)
|
| Should be raised when a file is skipped for any reason
|
| Method resolution order:
| FileSkipped
| ISortError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, message: str, file_path: str)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from ISortError:
|
| __reduce__(self)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from ISortError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class FormattingPluginDoesNotExist(ISortError)
| FormattingPluginDoesNotExist(formatter: str)
|
| Raised when a formatting plugin is set by the user that doesn't exist
|
| Method resolution order:
| FormattingPluginDoesNotExist
| ISortError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, formatter: str)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from ISortError:
|
| __reduce__(self)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from ISortError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class ISortError(builtins.Exception)
| Base isort exception object from which all isort sourced exceptions should inherit
|
| Method resolution order:
| ISortError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __reduce__(self)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class IntroducedSyntaxErrors(ISortError)
| IntroducedSyntaxErrors(file_path: str)
|
| Raised when isort has introduced a syntax error in the process of sorting imports
|
| Method resolution order:
| IntroducedSyntaxErrors
| ISortError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, file_path: str)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from ISortError:
|
| __reduce__(self)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from ISortError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class InvalidSettingsPath(ISortError)
| InvalidSettingsPath(settings_path: str)
|
| Raised when a settings path is provided that is neither a valid file or directory
|
| Method resolution order:
| InvalidSettingsPath
| ISortError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, settings_path: str)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from ISortError:
|
| __reduce__(self)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from ISortError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class LiteralParsingFailure(ISortError)
| LiteralParsingFailure(code: str, original_error: Union[Exception, Type[Exception]])
|
| Raised when one of isorts literal sorting comments is used but isort can't parse the
| the given data structure.
|
| Method resolution order:
| LiteralParsingFailure
| ISortError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, code: str, original_error: Union[Exception, Type[Exception]])
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from ISortError:
|
| __reduce__(self)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from ISortError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class LiteralSortTypeMismatch(ISortError)
| LiteralSortTypeMismatch(kind: type, expected_kind: type)
|
| Raised when an isort literal sorting comment is used, with a type that doesn't match the
| supplied data structure's type.
|
| Method resolution order:
| LiteralSortTypeMismatch
| ISortError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, kind: type, expected_kind: type)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from ISortError:
|
| __reduce__(self)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from ISortError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class MissingSection(ISortError)
| MissingSection(import_module: str, section: str)
|
| Raised when isort encounters an import that matches a section that is not defined
|
| Method resolution order:
| MissingSection
| ISortError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, import_module: str, section: str)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from ISortError:
|
| __reduce__(self)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from ISortError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class ProfileDoesNotExist(ISortError)
| ProfileDoesNotExist(profile: str)
|
| Raised when a profile is set by the user that doesn't exist
|
| Method resolution order:
| ProfileDoesNotExist
| ISortError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, profile: str)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from ISortError:
|
| __reduce__(self)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from ISortError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class SortingFunctionDoesNotExist(ISortError)
| SortingFunctionDoesNotExist(sort_order: str, available_sort_orders: List[str])
|
| Raised when the specified sorting function isn't available
|
| Method resolution order:
| SortingFunctionDoesNotExist
| ISortError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, sort_order: str, available_sort_orders: List[str])
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from ISortError:
|
| __reduce__(self)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from ISortError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class UnsupportedEncoding(ISortError)
| UnsupportedEncoding(filename: Union[str, pathlib.Path])
|
| Raised when isort encounters an encoding error while trying to read a file
|
| Method resolution order:
| UnsupportedEncoding
| ISortError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, filename: Union[str, pathlib.Path])
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from ISortError:
|
| __reduce__(self)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from ISortError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
class UnsupportedSettings(ISortError)
| UnsupportedSettings(unsupported_settings: Dict[str, Dict[str, str]])
|
| Raised when settings are passed into isort (either from config, CLI, or runtime)
| that it doesn't support.
|
| Method resolution order:
| UnsupportedSettings
| ISortError
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, unsupported_settings: Dict[str, Dict[str, str]])
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from ISortError:
|
| __reduce__(self)
| Helper for pickle.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from ISortError:
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) class method of builtins.Exception
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __repr__(self, /)
| Return repr(self).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| add_note(...)
| Exception.add_note(note) --
| add a note to the exception
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args
DATA
Dict = typing.Dict
A generic version of dict.
List = typing.List
A generic version of list.
Type = typing.Type
Deprecated alias to builtins.type.
builtins.type or typing.Type can be used to annotate class objects.
For example, suppose we have the following classes::
class User: ... # Abstract base for User classes
class BasicUser(User): ...
class ProUser(User): ...
class TeamUser(User): ...
And a function that takes a class argument that's a subclass of
User and returns an instance of the corresponding class::
def new_user[U](user_class: Type[U]) -> U:
user = user_class()
# (Here we could write the user object to a database)
return user
joe = new_user(BasicUser)
At this point the type checker knows that joe has type BasicUser.
Union = typing.Union
Union type; Union[X, Y] means either X or Y.
On Python 3.10 and higher, the | operator
can also be used to denote unions;
X | Y means the same thing to the type checker as Union[X, Y].
To define a union, use e.g. Union[int, str]. Details:
- The arguments must be types and there must be at least one.
- None as an argument is a special case and is replaced by
type(None).
- Unions of unions are flattened, e.g.::
assert Union[Union[int, str], float] == Union[int, str, float]
- Unions of a single argument vanish, e.g.::
assert Union[int] == int # The constructor actually returns int
- Redundant arguments are skipped, e.g.::
assert Union[int, str, int] == Union[int, str]
- When comparing unions, the argument order is ignored, e.g.::
assert Union[int, str] == Union[str, int]
- You cannot subclass or instantiate a union.
- You can use Optional[X] as a shorthand for Union[X, None].
profiles = {'appnexus': {'case_sensitive': False, 'ensure_newline_befo...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\isort\exceptions.py
isort.file
Python Library Documentation: function sort_file in module isort.api
sort_file(filename: Union[str, pathlib.Path], extension: Optional[str] = None, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False), file_path: Optional[pathlib.Path] = None, disregard_skip: bool = True, ask_to_apply: bool = False, show_diff: Union[bool, TextIO] = False, write_to_stdout: bool = False, output: Optional[TextIO] = None, **config_kwargs: Any) -> bool
Sorts and formats any groups of imports imports within the provided file or Path.
Returns `True` if the file has been changed, otherwise `False`.
- **filename**: The name or Path of the file to format.
- **extension**: The file extension that contains imports. Defaults to filename extension or py.
- **config**: The config object to use when sorting imports.
- **file_path**: The disk location where the code string was pulled from.
- **disregard_skip**: set to `True` if you want to ignore a skip set in config for this file.
- **ask_to_apply**: If `True`, prompt before applying any changes.
- **show_diff**: If `True` the changes that need to be done will be printed to stdout, if a
TextIO stream is provided results will be written to it, otherwise no diff will be computed.
- **write_to_stdout**: If `True`, write to stdout instead of the input file.
- **output**: If a TextIO is provided, results will be written there rather than replacing
the original file content.
- ****config_kwargs**: Any config modifications.
isort.files
Python Library Documentation: module isort.files in isort
NAME
isort.files
FUNCTIONS
find(paths: Iterable[str], config: isort.settings.Config, skipped: List[str], broken: List[str]) -> Iterator[str]
Fines and provides an iterator for all Python source files defined in paths.
DATA
Iterable = typing.Iterable
A generic version of collections.abc.Iterable.
Iterator = typing.Iterator
A generic version of collections.abc.Iterator.
List = typing.List
A generic version of list.
Set = typing.Set
A generic version of set.
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\isort\files.py
isort.find_imports_in_code
Python Library Documentation: function find_imports_in_code in module isort.api
find_imports_in_code(code: str, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False), file_path: Optional[pathlib.Path] = None, unique: Union[bool, isort.api.ImportKey] = False, top_only: bool = False, **config_kwargs: Any) -> Iterator[isort.identify.Import]
Finds and returns all imports within the provided code string.
- **code**: The string of code with imports that need to be sorted.
- **config**: The config object to use when sorting imports.
- **file_path**: The disk location where the code string was pulled from.
- **unique**: If True, only the first instance of an import is returned.
- **top_only**: If True, only return imports that occur before the first function or class.
- ****config_kwargs**: Any config modifications.
isort.find_imports_in_file
Python Library Documentation: function find_imports_in_file in module isort.api
find_imports_in_file(filename: Union[str, pathlib.Path], config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False), file_path: Optional[pathlib.Path] = None, unique: Union[bool, isort.api.ImportKey] = False, top_only: bool = False, **config_kwargs: Any) -> Iterator[isort.identify.Import]
Finds and returns all imports within the provided source file.
- **filename**: The name or Path of the file to look for imports in.
- **extension**: The file extension that contains imports. Defaults to filename extension or py.
- **config**: The config object to use when sorting imports.
- **file_path**: The disk location where the code string was pulled from.
- **unique**: If True, only the first instance of an import is returned.
- **top_only**: If True, only return imports that occur before the first function or class.
- ****config_kwargs**: Any config modifications.
isort.find_imports_in_paths
Python Library Documentation: function find_imports_in_paths in module isort.api
find_imports_in_paths(paths: Iterator[Union[str, pathlib.Path]], config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False), file_path: Optional[pathlib.Path] = None, unique: Union[bool, isort.api.ImportKey] = False, top_only: bool = False, **config_kwargs: Any) -> Iterator[isort.identify.Import]
Finds and returns all imports within the provided source paths.
- **paths**: A collection of paths to recursively look for imports within.
- **extension**: The file extension that contains imports. Defaults to filename extension or py.
- **config**: The config object to use when sorting imports.
- **file_path**: The disk location where the code string was pulled from.
- **unique**: If True, only the first instance of an import is returned.
- **top_only**: If True, only return imports that occur before the first function or class.
- ****config_kwargs**: Any config modifications.
isort.find_imports_in_stream
Python Library Documentation: function find_imports_in_stream in module isort.api
find_imports_in_stream(input_stream: <class 'TextIO'>, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False), file_path: Optional[pathlib.Path] = None, unique: Union[bool, isort.api.ImportKey] = False, top_only: bool = False, _seen: Optional[Set[str]] = None, **config_kwargs: Any) -> Iterator[isort.identify.Import]
Finds and returns all imports within the provided code stream.
- **input_stream**: The stream of code with imports that need to be sorted.
- **config**: The config object to use when sorting imports.
- **file_path**: The disk location where the code string was pulled from.
- **unique**: If True, only the first instance of an import is returned.
- **top_only**: If True, only return imports that occur before the first function or class.
- **_seen**: An optional set of imports already seen. Generally meant only for internal use.
- ****config_kwargs**: Any config modifications.
isort.format
Python Library Documentation: module isort.format in isort
NAME
isort.format
CLASSES
builtins.object
BasicPrinter
ColoramaPrinter
class BasicPrinter(builtins.object)
| BasicPrinter(error: str, success: str, output: Optional[TextIO] = None)
|
| Methods defined here:
|
| __init__(self, error: str, success: str, output: Optional[TextIO] = None)
| Initialize self. See help(type(self)) for accurate signature.
|
| diff_line(self, line: str) -> None
|
| error(self, message: str) -> None
|
| success(self, message: str) -> None
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| ERROR = 'ERROR'
|
| SUCCESS = 'SUCCESS'
class ColoramaPrinter(BasicPrinter)
| ColoramaPrinter(error: str, success: str, output: Optional[TextIO])
|
| Method resolution order:
| ColoramaPrinter
| BasicPrinter
| builtins.object
|
| Methods defined here:
|
| __init__(self, error: str, success: str, output: Optional[TextIO])
| Initialize self. See help(type(self)) for accurate signature.
|
| diff_line(self, line: str) -> None
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| style_text(text: str, style: Optional[str] = None) -> str
|
| ----------------------------------------------------------------------
| Methods inherited from BasicPrinter:
|
| error(self, message: str) -> None
|
| success(self, message: str) -> None
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BasicPrinter:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BasicPrinter:
|
| ERROR = 'ERROR'
|
| SUCCESS = 'SUCCESS'
FUNCTIONS
ask_whether_to_apply_changes_to_file(file_path: str) -> bool
create_terminal_printer(color: bool, output: Optional[TextIO] = None, error: str = '', success: str = '') -> isort.format.BasicPrinter
format_natural(import_line: str) -> str
format_simplified(import_line: str) -> str
remove_whitespace(content: str, line_separator: str = '\n') -> str
show_unified_diff(*, file_input: str, file_output: str, file_path: Optional[pathlib.Path], output: Optional[TextIO] = None, color_output: bool = False) -> None
Shows a unified_diff for the provided input and output against the provided file path.
- **file_input**: A string that represents the contents of a file before changes.
- **file_output**: A string that represents the contents of a file after changes.
- **file_path**: A Path object that represents the file path of the file being changed.
- **output**: A stream to output the diff to. If non is provided uses sys.stdout.
- **color_output**: Use color in output if True.
DATA
ADDED_LINE_PATTERN = re.compile('\\+[^+]')
Optional = typing.Optional
Optional[X] is equivalent to Union[X, None].
REMOVED_LINE_PATTERN = re.compile('-[^-]')
colorama_unavailable = False
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\isort\format.py
isort.identify
Python Library Documentation: module isort.identify in isort
NAME
isort.identify
DESCRIPTION
Fast stream based import identification.
Eventually this will likely replace parse.py
CLASSES
builtins.tuple(builtins.object)
Import
class Import(builtins.tuple)
| Import(line_number: int, indented: bool, module: str, attribute: Optional[str] = None, alias: Optional[str] = None, cimport: bool = False, file_path: Optional[pathlib.Path] = None)
|
| Import(line_number, indented, module, attribute, alias, cimport, file_path)
|
| Method resolution order:
| Import
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __getnewargs__(self) from collections.Import
| Return self as a plain tuple. Used by copy and pickle.
|
| __repr__(self) from collections.Import
| Return a nicely formatted representation string
|
| __str__(self) -> str
| Return str(self).
|
| _asdict(self) from collections.Import
| Return a new dict which maps field names to their values.
|
| _replace(self, /, **kwds) from collections.Import
| Return a new Import object replacing specified fields with new values
|
| statement(self) -> str
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| _make(iterable) from collections.Import
| Make a new Import object from a sequence or iterable
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(_cls, line_number: int, indented: bool, module: str, attribute: Optional[str] = None, alias: Optional[str] = None, cimport: bool = False, file_path: Optional[pathlib.Path] = None) from namedtuple_Import.Import
| Create new instance of Import(line_number, indented, module, attribute, alias, cimport, file_path)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| line_number
| Alias for field number 0
|
| indented
| Alias for field number 1
|
| module
| Alias for field number 2
|
| attribute
| Alias for field number 3
|
| alias
| Alias for field number 4
|
| cimport
| Alias for field number 5
|
| file_path
| Alias for field number 6
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'alias': typing.Optional[str], 'attribute': typing....
|
| __match_args__ = ('line_number', 'indented', 'module', 'attribute', 'a...
|
| __orig_bases__ = (<function NamedTuple>,)
|
| _field_defaults = {'alias': None, 'attribute': None, 'cimport': False,...
|
| _fields = ('line_number', 'indented', 'module', 'attribute', 'alias', ...
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(key in self).
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __rmul__(self, value, /)
| Return value*self.
|
| count(self, value, /)
| Return number of occurrences of value.
|
| index(self, value, start=0, stop=9223372036854775807, /)
| Return first index of value.
|
| Raises ValueError if the value is not present.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
FUNCTIONS
imports(input_stream: <class 'TextIO'>, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False), file_path: Optional[pathlib.Path] = None, top_only: bool = False) -> Iterator[isort.identify.Import]
Parses a python file taking out and categorizing imports.
DATA
DEFAULT_CONFIG = Config(py_version='py3', force_to_top=frozenset(...t_...
Iterator = typing.Iterator
A generic version of collections.abc.Iterator.
Optional = typing.Optional
Optional[X] is equivalent to Union[X, None].
STATEMENT_DECLARATIONS = ('def ', 'cdef ', 'cpdef ', 'class ', '@', 'a...
Tuple = typing.Tuple
Deprecated alias to builtins.tuple.
Tuple[X, Y] is the cross-product type of X and Y.
Example: Tuple[T1, T2] is a tuple of two elements corresponding
to type variables T1 and T2. Tuple[int, float, str] is a tuple
of an int, a float and a string.
To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].
__annotations__ = {'STATEMENT_DECLARATIONS': typing.Tuple[str, ...]}
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\isort\identify.py
isort.io
Python Library Documentation: module isort.io in isort
NAME
isort.io - Defines any IO utilities used by isort
CLASSES
builtins.object
File
class File(builtins.object)
| File(stream: <class 'TextIO'>, path: pathlib.Path, encoding: str) -> None
|
| File(stream: <class 'TextIO'>, path: pathlib.Path, encoding: str)
|
| Methods defined here:
|
| __delattr__(self, name)
| Implement delattr(self, name).
|
| __eq__(self, other)
| Return self==value.
|
| __hash__(self)
| Return hash(self).
|
| __init__(self, stream: <class 'TextIO'>, path: pathlib.Path, encoding: str) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| __repr__(self)
| Return repr(self).
|
| __setattr__(self, name, value)
| Implement setattr(self, name, value).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| detect_encoding(filename: Union[str, pathlib.Path], readline: Callable[[], bytes]) -> str
|
| from_contents(contents: str, filename: str) -> 'File'
|
| read(filename: Union[str, pathlib.Path]) -> Iterator[ForwardRef('File')]
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| extension
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'encoding': <class 'str'>, 'path': <class 'pathlib....
|
| __dataclass_fields__ = {'encoding': Field(name='encoding',type=<class ...
|
| __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,or...
|
| __match_args__ = ('stream', 'path', 'encoding')
DATA
Callable = typing.Callable
Deprecated alias to collections.abc.Callable.
Callable[[int], str] signifies a function that takes a single
parameter of type int and returns a str.
The subscription syntax must always be used with exactly two
values: the argument list and the return type.
The argument list must be a list of types, a ParamSpec,
Concatenate or ellipsis. The return type must be a single type.
There is no syntax to indicate optional or keyword arguments;
such function types are rarely used as callback types.
Empty = <isort.io._EmptyIO object>
Iterator = typing.Iterator
A generic version of collections.abc.Iterator.
Union = typing.Union
Union type; Union[X, Y] means either X or Y.
On Python 3.10 and higher, the | operator
can also be used to denote unions;
X | Y means the same thing to the type checker as Union[X, Y].
To define a union, use e.g. Union[int, str]. Details:
- The arguments must be types and there must be at least one.
- None as an argument is a special case and is replaced by
type(None).
- Unions of unions are flattened, e.g.::
assert Union[Union[int, str], float] == Union[int, str, float]
- Unions of a single argument vanish, e.g.::
assert Union[int] == int # The constructor actually returns int
- Redundant arguments are skipped, e.g.::
assert Union[int, str, int] == Union[int, str]
- When comparing unions, the argument order is ignored, e.g.::
assert Union[int, str] == Union[str, int]
- You cannot subclass or instantiate a union.
- You can use Optional[X] as a shorthand for Union[X, None].
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\isort\io.py
isort.literal
Python Library Documentation: module isort.literal in isort
NAME
isort.literal
CLASSES
pprint.PrettyPrinter(builtins.object)
ISortPrettyPrinter
class ISortPrettyPrinter(pprint.PrettyPrinter)
| ISortPrettyPrinter(config: isort.settings.Config)
|
| an isort customized pretty printer for sorted literals
|
| Method resolution order:
| ISortPrettyPrinter
| pprint.PrettyPrinter
| builtins.object
|
| Methods defined here:
|
| __init__(self, config: isort.settings.Config)
| Handle pretty printing operations onto a stream using a set of
| configured parameters.
|
| indent
| Number of spaces to indent for each level of nesting.
|
| width
| Attempted maximum number of columns in the output.
|
| depth
| The maximum depth to print out nested structures.
|
| stream
| The desired output stream. If omitted (or false), the standard
| output stream available at construction will be used.
|
| compact
| If true, several items will be combined in one line.
|
| sort_dicts
| If true, dict keys are sorted.
|
| underscore_numbers
| If true, digit groups are separated with underscores.
|
| ----------------------------------------------------------------------
| Methods inherited from pprint.PrettyPrinter:
|
| format(self, object, context, maxlevels, level)
| Format object for a specific context, returning a string
| and flags indicating whether the representation is 'readable'
| and whether the object represents a recursive construct.
|
| isreadable(self, object)
|
| isrecursive(self, object)
|
| pformat(self, object)
|
| pprint(self, object)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from pprint.PrettyPrinter:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
FUNCTIONS
assignment(code: str, sort_type: str, extension: str, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False)) -> str
Sorts the literal present within the provided code against the provided sort type,
returning the sorted representation of the source code.
assignments(code: str) -> str
register_type(name: str, kind: type) -> Callable[[Callable[[Any, isort.literal.ISortPrettyPrinter], str]], Callable[[Any, isort.literal.ISortPrettyPrinter], str]]
Registers a new literal sort type.
DATA
Callable = typing.Callable
Deprecated alias to collections.abc.Callable.
Callable[[int], str] signifies a function that takes a single
parameter of type int and returns a str.
The subscription syntax must always be used with exactly two
values: the argument list and the return type.
The argument list must be a list of types, a ParamSpec,
Concatenate or ellipsis. The return type must be a single type.
There is no syntax to indicate optional or keyword arguments;
such function types are rarely used as callback types.
DEFAULT_CONFIG = Config(py_version='py3', force_to_top=frozenset(...t_...
Dict = typing.Dict
A generic version of dict.
List = typing.List
A generic version of list.
Set = typing.Set
A generic version of set.
Tuple = typing.Tuple
Deprecated alias to builtins.tuple.
Tuple[X, Y] is the cross-product type of X and Y.
Example: Tuple[T1, T2] is a tuple of two elements corresponding
to type variables T1 and T2. Tuple[int, float, str] is a tuple
of an int, a float and a string.
To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].
__annotations__ = {'type_mapping': typing.Dict[str, typing.Tuple[type,...
type_mapping = {'dict': (<class 'dict'>, <function _dict>), 'list': (<...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\isort\literal.py
isort.output
Python Library Documentation: module isort.output in isort
NAME
isort.output
FUNCTIONS
sorted_imports(parsed: isort.parse.ParsedContent, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False), extension: str = 'py', import_type: str = 'import') -> str
Adds the imports back to the file.
(at the index of the first import) sorted alphabetically and split between groups
DATA
DEFAULT_CONFIG = Config(py_version='py3', force_to_top=frozenset(...t_...
Iterable = typing.Iterable
A generic version of collections.abc.Iterable.
List = typing.List
A generic version of list.
Optional = typing.Optional
Optional[X] is equivalent to Union[X, None].
STATEMENT_DECLARATIONS = ('def ', 'cdef ', 'cpdef ', 'class ', '@', 'a...
Set = typing.Set
A generic version of set.
Tuple = typing.Tuple
Deprecated alias to builtins.tuple.
Tuple[X, Y] is the cross-product type of X and Y.
Example: Tuple[T1, T2] is a tuple of two elements corresponding
to type variables T1 and T2. Tuple[int, float, str] is a tuple
of an int, a float and a string.
To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].
Type = typing.Type
Deprecated alias to builtins.type.
builtins.type or typing.Type can be used to annotate class objects.
For example, suppose we have the following classes::
class User: ... # Abstract base for User classes
class BasicUser(User): ...
class ProUser(User): ...
class TeamUser(User): ...
And a function that takes a class argument that's a subclass of
User and returns an instance of the corresponding class::
def new_user[U](user_class: Type[U]) -> U:
user = user_class()
# (Here we could write the user object to a database)
return user
joe = new_user(BasicUser)
At this point the type checker knows that joe has type BasicUser.
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\isort\output.py
isort.parse
Python Library Documentation: module isort.parse in isort
NAME
isort.parse - Defines parsing functions used by isort for parsing import definitions
CLASSES
builtins.tuple(builtins.object)
ParsedContent
class ParsedContent(builtins.tuple)
| ParsedContent(in_lines: List[str], lines_without_imports: List[str], import_index: int, place_imports: Dict[str, List[str]], import_placements: Dict[str, str], as_map: Dict[str, Dict[str, List[str]]], imports: Dict[str, Dict[str, Any]], categorized_comments: ForwardRef('CommentsDict'), change_count: int, original_line_count: int, line_separator: str, sections: Any, verbose_output: List[str], trailing_commas: Set[str])
|
| ParsedContent(in_lines, lines_without_imports, import_index, place_imports, import_placements, as_map, imports, categorized_comments, change_count, original_line_count, line_separator, sections, verbose_output, trailing_commas)
|
| Method resolution order:
| ParsedContent
| builtins.tuple
| builtins.object
|
| Methods defined here:
|
| __getnewargs__(self) from collections.ParsedContent
| Return self as a plain tuple. Used by copy and pickle.
|
| __repr__(self) from collections.ParsedContent
| Return a nicely formatted representation string
|
| _asdict(self) from collections.ParsedContent
| Return a new dict which maps field names to their values.
|
| _replace(self, /, **kwds) from collections.ParsedContent
| Return a new ParsedContent object replacing specified fields with new values
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| _make(iterable) from collections.ParsedContent
| Make a new ParsedContent object from a sequence or iterable
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(_cls, in_lines: List[str], lines_without_imports: List[str], import_index: int, place_imports: Dict[str, List[str]], import_placements: Dict[str, str], as_map: Dict[str, Dict[str, List[str]]], imports: Dict[str, Dict[str, Any]], categorized_comments: ForwardRef('CommentsDict'), change_count: int, original_line_count: int, line_separator: str, sections: Any, verbose_output: List[str], trailing_commas: Set[str]) from namedtuple_ParsedContent.ParsedContent
| Create new instance of ParsedContent(in_lines, lines_without_imports, import_index, place_imports, import_placements, as_map, imports, categorized_comments, change_count, original_line_count, line_separator, sections, verbose_output, trailing_commas)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| in_lines
| Alias for field number 0
|
| lines_without_imports
| Alias for field number 1
|
| import_index
| Alias for field number 2
|
| place_imports
| Alias for field number 3
|
| import_placements
| Alias for field number 4
|
| as_map
| Alias for field number 5
|
| imports
| Alias for field number 6
|
| categorized_comments
| Alias for field number 7
|
| change_count
| Alias for field number 8
|
| original_line_count
| Alias for field number 9
|
| line_separator
| Alias for field number 10
|
| sections
| Alias for field number 11
|
| verbose_output
| Alias for field number 12
|
| trailing_commas
| Alias for field number 13
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {'as_map': typing.Dict[str, typing.Dict[str, typing....
|
| __match_args__ = ('in_lines', 'lines_without_imports', 'import_index',...
|
| __orig_bases__ = (<function NamedTuple>,)
|
| _field_defaults = {}
|
| _fields = ('in_lines', 'lines_without_imports', 'import_index', 'place...
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.tuple:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return bool(key in self).
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __rmul__(self, value, /)
| Return value*self.
|
| count(self, value, /)
| Return number of occurrences of value.
|
| index(self, value, start=0, stop=9223372036854775807, /)
| Return first index of value.
|
| Raises ValueError if the value is not present.
|
| ----------------------------------------------------------------------
| Class methods inherited from builtins.tuple:
|
| __class_getitem__(...)
| See PEP 585
FUNCTIONS
file_contents(contents: str, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False)) -> isort.parse.ParsedContent
Parses a python file taking out and categorizing imports.
import_type(line: str, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False)) -> Optional[str]
If the current line is an import line it will return its type (from or straight)
normalize_line(raw_line: str) -> Tuple[str, str]
Normalizes import related statements in the provided line.
Returns (normalized_line: str, raw_line: str)
skip_line(line: str, in_quote: str, index: int, section_comments: Tuple[str, ...], needs_import: bool = True) -> Tuple[bool, str]
Determine if a given line should be skipped.
Returns back a tuple containing:
(skip_line: bool,
in_quote: str,)
strip_syntax(import_string: str) -> str
warn(...)
Issue a warning, or maybe ignore it or raise an exception.
message
Text of the warning message.
category
The Warning category subclass. Defaults to UserWarning.
stacklevel
How far up the call stack to make this warning appear. A value of 2 for
example attributes the warning to the caller of the code calling warn().
source
If supplied, the destroyed object which emitted a ResourceWarning
skip_file_prefixes
An optional tuple of module filename prefixes indicating frames to skip
during stacklevel computations for stack frame attribution.
DATA
DEFAULT_CONFIG = Config(py_version='py3', force_to_top=frozenset(...t_...
Dict = typing.Dict
A generic version of dict.
List = typing.List
A generic version of list.
Optional = typing.Optional
Optional[X] is equivalent to Union[X, None].
Set = typing.Set
A generic version of set.
TYPE_CHECKING = False
Tuple = typing.Tuple
Deprecated alias to builtins.tuple.
Tuple[X, Y] is the cross-product type of X and Y.
Example: Tuple[T1, T2] is a tuple of two elements corresponding
to type variables T1 and T2. Tuple[int, float, str] is a tuple
of an int, a float and a string.
To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\isort\parse.py
isort.place
Python Library Documentation: module isort.place in isort
NAME
isort.place - Contains all logic related to placing an import within a certain section.
FUNCTIONS
module(name: str, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False)) -> str
Returns the section placement for the given module name.
module_with_reason(name: str, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False)) -> Tuple[str, str]
Returns the section placement for the given module name alongside the reasoning.
DATA
DEFAULT_CONFIG = Config(py_version='py3', force_to_top=frozenset(...t_...
FrozenSet = typing.FrozenSet
A generic version of frozenset.
Iterable = typing.Iterable
A generic version of collections.abc.Iterable.
LOCAL = 'LOCALFOLDER'
Optional = typing.Optional
Optional[X] is equivalent to Union[X, None].
Tuple = typing.Tuple
Deprecated alias to builtins.tuple.
Tuple[X, Y] is the cross-product type of X and Y.
Example: Tuple[T1, T2] is a tuple of two elements corresponding
to type variables T1 and T2. Tuple[int, float, str] is a tuple
of an int, a float and a string.
To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\isort\place.py
isort.place_module
Python Library Documentation: function module in module isort.place
module(name: str, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False)) -> str
Returns the section placement for the given module name.
isort.place_module_with_reason
Python Library Documentation: _lru_cache_wrapper in module isort.place
module_with_reason(name: str, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False)) -> Tuple[str, str]
Returns the section placement for the given module name alongside the reasoning.
isort.profiles
Python Library Documentation: module isort.profiles in isort
NAME
isort.profiles - Common profiles are defined here to be easily used within a project using --profile {name}
DATA
Dict = typing.Dict
A generic version of dict.
__annotations__ = {'profiles': typing.Dict[str, typing.Dict[str, typin...
appnexus = {'case_sensitive': False, 'ensure_newline_before_comments':...
attrs = {'atomic': True, 'force_grid_wrap': 0, 'include_trailing_comma...
black = {'ensure_newline_before_comments': True, 'force_grid_wrap': 0,...
django = {'combine_as_imports': True, 'include_trailing_comma': True, ...
google = {'force_single_line': True, 'force_sort_within_sections': Tru...
hug = {'force_grid_wrap': 0, 'include_trailing_comma': True, 'line_len...
open_stack = {'force_single_line': True, 'force_sort_within_sections':...
plone = {'ensure_newline_before_comments': True, 'force_alphabetical_s...
profiles = {'appnexus': {'case_sensitive': False, 'ensure_newline_befo...
pycharm = {'force_grid_wrap': 2, 'lines_after_imports': 2, 'multi_line...
wemake = {'include_trailing_comma': True, 'line_length': 79, 'multi_li...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\isort\profiles.py
isort.sections
Python Library Documentation: module isort.sections in isort
NAME
isort.sections - Defines all sections isort uses by default
DATA
DEFAULT = ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDE...
FIRSTPARTY = 'FIRSTPARTY'
FUTURE = 'FUTURE'
LOCALFOLDER = 'LOCALFOLDER'
STDLIB = 'STDLIB'
THIRDPARTY = 'THIRDPARTY'
Tuple = typing.Tuple
Deprecated alias to builtins.tuple.
Tuple[X, Y] is the cross-product type of X and Y.
Example: Tuple[T1, T2] is a tuple of two elements corresponding
to type variables T1 and T2. Tuple[int, float, str] is a tuple
of an int, a float and a string.
To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].
__annotations__ = {'DEFAULT': typing.Tuple[str, ...], 'FIRSTPARTY': <c...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\isort\sections.py
isort.settings
Python Library Documentation: module isort.settings in isort
NAME
isort.settings - isort/settings.py.
DESCRIPTION
Defines how the default settings for isort should be loaded
CLASSES
_Config(builtins.object)
Config
class Config(_Config)
| Config(settings_file: str = '', settings_path: str = '', config: Optional[isort.settings._Config] = None, **config_overrides: Any)
|
| Method resolution order:
| Config
| _Config
| builtins.object
|
| Methods defined here:
|
| __init__(self, settings_file: str = '', settings_path: str = '', config: Optional[isort.settings._Config] = None, **config_overrides: Any)
| Initialize self. See help(type(self)) for accurate signature.
|
| is_skipped(self, file_path: pathlib.Path) -> bool
| Returns True if the file and/or folder should be skipped based on current settings.
|
| is_supported_filetype(self, file_name: str) -> bool
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| known_patterns
|
| section_comments
|
| section_comments_end
|
| skip_globs
|
| skips
|
| sorting_function
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __annotations__ = {}
|
| ----------------------------------------------------------------------
| Methods inherited from _Config:
|
| __delattr__(self, name)
| Implement delattr(self, name).
|
| __eq__(self, other)
| Return self==value.
|
| __hash__(self) -> int
| Return hash(self).
|
| __post_init__(self) -> None
|
| __repr__(self)
| Return repr(self).
|
| __setattr__(self, name, value)
| Implement setattr(self, name, value).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _Config:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from _Config:
|
| __dataclass_fields__ = {'add_imports': Field(name='add_imports',type=t...
|
| __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,or...
|
| __match_args__ = ('py_version', 'force_to_top', 'skip', 'extend_skip',...
|
| add_imports = frozenset()
|
| append_only = False
|
| atomic = False
|
| auto_identify_namespace_packages = True
|
| balanced_wrapping = False
|
| blocked_extensions = frozenset({'pex'})
|
| case_sensitive = False
|
| classes = frozenset()
|
| color_output = False
|
| combine_as_imports = False
|
| combine_star = False
|
| combine_straight_imports = False
|
| comment_prefix = ' #'
|
| conda_env = ''
|
| constants = frozenset()
|
| dedup_headings = False
|
| default_section = 'THIRDPARTY'
|
| directory = ''
|
| ensure_newline_before_comments = False
|
| extend_skip = frozenset()
|
| extend_skip_glob = frozenset()
|
| extra_standard_library = frozenset()
|
| filter_files = False
|
| float_to_top = False
|
| follow_links = True
|
| force_adds = False
|
| force_alphabetical_sort = False
|
| force_alphabetical_sort_within_sections = False
|
| force_grid_wrap = 0
|
| force_single_line = False
|
| force_sort_within_sections = False
|
| force_to_top = frozenset()
|
| forced_separate = ()
|
| format_error = '{error}: {message}'
|
| format_success = '{success}: {message}'
|
| formatter = ''
|
| formatting_function = None
|
| from_first = False
|
| group_by_package = False
|
| honor_case_in_force_sorted_sections = False
|
| honor_noqa = False
|
| ignore_comments = False
|
| ignore_whitespace = False
|
| import_dependencies = typing.Dict[str, str]
|
| include_trailing_comma = False
|
| indent = ' '
|
| indented_import_headings = True
|
| known_first_party = frozenset()
|
| known_future_library = frozenset({'__future__'})
|
| known_local_folder = frozenset()
|
| known_standard_library = frozenset()
|
| known_third_party = frozenset()
|
| length_sort = False
|
| length_sort_sections = frozenset()
|
| length_sort_straight = False
|
| lexicographical = False
|
| line_ending = ''
|
| line_length = 79
|
| lines_after_imports = -1
|
| lines_before_imports = -1
|
| lines_between_sections = 1
|
| lines_between_types = 0
|
| multi_line_output = <WrapModes.GRID: 0>
|
| namespace_packages = frozenset()
|
| no_inline_sort = False
|
| no_lines_before = frozenset()
|
| no_sections = False
|
| old_finders = False
|
| only_modified = False
|
| only_sections = False
|
| order_by_type = True
|
| overwrite_in_place = False
|
| profile = ''
|
| py_version = '3'
|
| quiet = False
|
| remove_imports = frozenset()
|
| remove_redundant_aliases = False
|
| reverse_relative = False
|
| reverse_sort = False
|
| sections = ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLD...
|
| single_line_exclusions = ()
|
| skip = frozenset({'.bzr', '.direnv', '.eggs', '.git', '.hg', '.mypy_ca...
|
| skip_gitignore = False
|
| skip_glob = frozenset()
|
| sort_order = 'natural'
|
| sort_reexports = False
|
| sort_relative_in_force_sorted_sections = False
|
| sources = ()
|
| split_on_trailing_comma = False
|
| src_paths = ()
|
| star_first = False
|
| supported_extensions = frozenset({'pxd', 'py', 'pyi', 'pyx'})
|
| treat_all_comments_as_code = False
|
| treat_comments_as_code = frozenset()
|
| use_parentheses = False
|
| variables = frozenset()
|
| verbose = False
|
| virtual_env = ''
|
| wrap_length = 0
FUNCTIONS
find_all_configs(path: str) -> isort.utils.Trie
Looks for config files in the path provided and in all of its sub-directories.
Parses and stores any config file encountered in a trie and returns the root of
the trie
warn(...)
Issue a warning, or maybe ignore it or raise an exception.
message
Text of the warning message.
category
The Warning category subclass. Defaults to UserWarning.
stacklevel
How far up the call stack to make this warning appear. A value of 2 for
example attributes the warning to the caller of the code calling warn().
source
If supplied, the destroyed object which emitted a ResourceWarning
skip_file_prefixes
An optional tuple of module filename prefixes indicating frames to skip
during stacklevel computations for stack frame attribution.
DATA
BLOCKED_EXTENSIONS = frozenset({'pex'})
CONFIG_SECTIONS = {'.editorconfig': ('*', '*.py', '**.py', '*.{py}'), ...
CONFIG_SOURCES = ('.isort.cfg', 'pyproject.toml', 'setup.cfg', 'tox.in...
CYTHON_EXTENSIONS = frozenset({'pxd', 'pyx'})
Callable = typing.Callable
Deprecated alias to collections.abc.Callable.
Callable[[int], str] signifies a function that takes a single
parameter of type int and returns a str.
The subscription syntax must always be used with exactly two
values: the argument list and the return type.
The argument list must be a list of types, a ParamSpec,
Concatenate or ellipsis. The return type must be a single type.
There is no syntax to indicate optional or keyword arguments;
such function types are rarely used as callback types.
DEFAULT_CONFIG = Config(py_version='py3', force_to_top=frozenset(...t_...
DEFAULT_SKIP = frozenset({'.bzr', '.direnv', '.eggs', '.git', '.hg', '...
DEPRECATED_SETTINGS = ('not_skip', 'keep_direct_and_as_imports')
Dict = typing.Dict
A generic version of dict.
FALLBACK_CONFIG_SECTIONS = ('isort', 'tool:isort', 'tool.isort')
FILE_SKIP_COMMENTS = ('isort:skip_file', 'isort: skip_file')
FIRSTPARTY = 'FIRSTPARTY'
FUTURE = 'FUTURE'
FrozenSet = typing.FrozenSet
A generic version of frozenset.
IMPORT_FOOTER_PREFIX = 'import_footer_'
IMPORT_HEADING_PREFIX = 'import_heading_'
Iterable = typing.Iterable
A generic version of collections.abc.Iterable.
KNOWN_PREFIX = 'known_'
KNOWN_SECTION_MAPPING = {'FIRSTPARTY': 'FIRST_PARTY', 'FUTURE': 'FUTUR...
LOCALFOLDER = 'LOCALFOLDER'
List = typing.List
A generic version of list.
MAX_CONFIG_SEARCH_DEPTH = 25
Optional = typing.Optional
Optional[X] is equivalent to Union[X, None].
Pattern = typing.Pattern
A generic version of re.Pattern.
RUNTIME_SOURCE = 'runtime'
SECTION_DEFAULTS = ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'L...
STDLIB = 'STDLIB'
STOP_CONFIG_SEARCH_ON_DIRS = ('.git', '.hg')
SUPPORTED_EXTENSIONS = frozenset({'pxd', 'py', 'pyi', 'pyx'})
Set = typing.Set
A generic version of set.
THIRDPARTY = 'THIRDPARTY'
TYPE_CHECKING = False
Tuple = typing.Tuple
Deprecated alias to builtins.tuple.
Tuple[X, Y] is the cross-product type of X and Y.
Example: Tuple[T1, T2] is a tuple of two elements corresponding
to type variables T1 and T2. Tuple[int, float, str] is a tuple
of an int, a float and a string.
To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].
Type = typing.Type
Deprecated alias to builtins.type.
builtins.type or typing.Type can be used to annotate class objects.
For example, suppose we have the following classes::
class User: ... # Abstract base for User classes
class BasicUser(User): ...
class ProUser(User): ...
class TeamUser(User): ...
And a function that takes a class argument that's a subclass of
User and returns an instance of the corresponding class::
def new_user[U](user_class: Type[U]) -> U:
user = user_class()
# (Here we could write the user object to a database)
return user
joe = new_user(BasicUser)
At this point the type checker knows that joe has type BasicUser.
Union = typing.Union
Union type; Union[X, Y] means either X or Y.
On Python 3.10 and higher, the | operator
can also be used to denote unions;
X | Y means the same thing to the type checker as Union[X, Y].
To define a union, use e.g. Union[int, str]. Details:
- The arguments must be types and there must be at least one.
- None as an argument is a special case and is replaced by
type(None).
- Unions of unions are flattened, e.g.::
assert Union[Union[int, str], float] == Union[int, str, float]
- Unions of a single argument vanish, e.g.::
assert Union[int] == int # The constructor actually returns int
- Redundant arguments are skipped, e.g.::
assert Union[int, str, int] == Union[int, str]
- When comparing unions, the argument order is ignored, e.g.::
assert Union[int, str] == Union[str, int]
- You cannot subclass or instantiate a union.
- You can use Optional[X] as a shorthand for Union[X, None].
VALID_PY_TARGETS = ('all', '2', '27', '3', '310', '311', '312', '36', ...
__annotations__ = {'CONFIG_SECTIONS': typing.Dict[str, typing.Tuple[st...
profiles = {'appnexus': {'case_sensitive': False, 'ensure_newline_befo...
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\isort\settings.py
isort.sorting
Python Library Documentation: module isort.sorting in isort
NAME
isort.sorting
FUNCTIONS
module_key(module_name: str, config: Any, sub_imports: bool = False, ignore_case: bool = False, section_name: Optional[Any] = None, straight_import: Optional[bool] = False) -> str
naturally(to_sort: Iterable[str], key: Optional[Callable[[str], Any]] = None, reverse: bool = False) -> List[str]
Returns a naturally sorted list
section_key(line: str, config: Any) -> str
sort(config: Any, to_sort: Iterable[str], key: Optional[Callable[[str], Any]] = None, reverse: bool = False) -> List[str]
DATA
Callable = typing.Callable
Deprecated alias to collections.abc.Callable.
Callable[[int], str] signifies a function that takes a single
parameter of type int and returns a str.
The subscription syntax must always be used with exactly two
values: the argument list and the return type.
The argument list must be a list of types, a ParamSpec,
Concatenate or ellipsis. The return type must be a single type.
There is no syntax to indicate optional or keyword arguments;
such function types are rarely used as callback types.
Iterable = typing.Iterable
A generic version of collections.abc.Iterable.
List = typing.List
A generic version of list.
Optional = typing.Optional
Optional[X] is equivalent to Union[X, None].
TYPE_CHECKING = False
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\isort\sorting.py
isort.stdlibs
Python Library Documentation: package isort.stdlibs in isort
NAME
isort.stdlibs
PACKAGE CONTENTS
all
py2
py27
py3
py310
py311
py312
py36
py37
py38
py39
SUBMODULES
_all
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\isort\stdlibs\__init__.py
isort.stream
Python Library Documentation: function sort_stream in module isort.api
sort_stream(input_stream: <class 'TextIO'>, output_stream: <class 'TextIO'>, extension: Optional[str] = None, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False), file_path: Optional[pathlib.Path] = None, disregard_skip: bool = False, show_diff: Union[bool, TextIO] = False, raise_on_skip: bool = True, **config_kwargs: Any) -> bool
Sorts any imports within the provided code stream, outputs to the provided output stream.
Returns `True` if anything is modified from the original input stream, otherwise `False`.
- **input_stream**: The stream of code with imports that need to be sorted.
- **output_stream**: The stream where sorted imports should be written to.
- **extension**: The file extension that contains imports. Defaults to filename extension or py.
- **config**: The config object to use when sorting imports.
- **file_path**: The disk location where the code string was pulled from.
- **disregard_skip**: set to `True` if you want to ignore a skip set in config for this file.
- **show_diff**: If `True` the changes that need to be done will be printed to stdout, if a
TextIO stream is provided results will be written to it, otherwise no diff will be computed.
- ****config_kwargs**: Any config modifications.
isort.utils
Python Library Documentation: module isort.utils in isort
NAME
isort.utils
CLASSES
builtins.object
Trie
TrieNode
class Trie(builtins.object)
| Trie(config_file: str = '', config_data: Optional[Dict[str, Any]] = None) -> None
|
| A prefix tree to store the paths of all config files and to search the nearest config
| associated with each file
|
| Methods defined here:
|
| __init__(self, config_file: str = '', config_data: Optional[Dict[str, Any]] = None) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| insert(self, config_file: str, config_data: Dict[str, Any]) -> None
|
| search(self, filename: str) -> Tuple[str, Dict[str, Any]]
| Returns the closest config relative to filename by doing a depth
| first search on the prefix tree.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
class TrieNode(builtins.object)
| TrieNode(config_file: str = '', config_data: Optional[Dict[str, Any]] = None) -> None
|
| Methods defined here:
|
| __init__(self, config_file: str = '', config_data: Optional[Dict[str, Any]] = None) -> None
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables
|
| __weakref__
| list of weak references to the object
FUNCTIONS
exists_case_sensitive(path: str) -> bool
Returns if the given path exists and also matches the case on Windows.
When finding files that can be imported, it is important for the cases to match because while
file os.path.exists("module.py") and os.path.exists("MODULE.py") both return True on Windows,
Python can only import using the case of the real file.
DATA
Dict = typing.Dict
A generic version of dict.
Optional = typing.Optional
Optional[X] is equivalent to Union[X, None].
Tuple = typing.Tuple
Deprecated alias to builtins.tuple.
Tuple[X, Y] is the cross-product type of X and Y.
Example: Tuple[T1, T2] is a tuple of two elements corresponding
to type variables T1 and T2. Tuple[int, float, str] is a tuple
of an int, a float and a string.
To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\isort\utils.py
isort.wrap
Python Library Documentation: module isort.wrap in isort
NAME
isort.wrap
FUNCTIONS
import_statement(import_start: str, from_imports: List[str], comments: Sequence[str] = (), line_separator: str = '\n', config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False), multi_line_output: Optional[isort.wrap_modes.WrapModes] = None, explode: bool = False) -> str
Returns a multi-line wrapped form of the provided from import statement.
line(content: str, line_separator: str, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), extend_skip=frozenset(), skip_glob=frozenset(), extend_skip_glob=frozenset(), skip_gitignore=False, line_length=79, wrap_length=0, line_ending='', sections=('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), no_sections=False, known_future_library=frozenset({'__future__'}), known_third_party=frozenset(), known_first_party=frozenset(), known_local_folder=frozenset(), known_standard_library=frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), extra_standard_library=frozenset(), known_other={}, multi_line_output=<WrapModes.GRID: 0>, forced_separate=(), indent=' ', comment_prefix=' #', length_sort=False, length_sort_straight=False, length_sort_sections=frozenset(), add_imports=frozenset(), remove_imports=frozenset(), append_only=False, reverse_relative=False, force_single_line=False, single_line_exclusions=(), default_section='THIRDPARTY', import_headings={}, import_footers={}, balanced_wrapping=False, use_parentheses=False, order_by_type=True, atomic=False, lines_before_imports=-1, lines_after_imports=-1, lines_between_sections=1, lines_between_types=0, combine_as_imports=False, combine_star=False, include_trailing_comma=False, from_first=False, verbose=False, quiet=False, force_adds=False, force_alphabetical_sort_within_sections=False, force_alphabetical_sort=False, force_grid_wrap=0, force_sort_within_sections=False, lexicographical=False, group_by_package=False, ignore_whitespace=False, no_lines_before=frozenset(), no_inline_sort=False, ignore_comments=False, case_sensitive=False, sources=({'py_version': 'py3', 'force_to_top': frozenset(), 'skip': frozenset({'.git', '.nox', '.pytype', '.mypy_cache', '.pants.d', 'venv', '__pypackages__', 'node_modules', 'dist', '.hg', '.svn', 'build', '.eggs', '_build', '.direnv', '.tox', 'buck-out', '.venv', '.bzr'}), 'extend_skip': frozenset(), 'skip_glob': frozenset(), 'extend_skip_glob': frozenset(), 'skip_gitignore': False, 'line_length': 79, 'wrap_length': 0, 'line_ending': '', 'sections': ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'), 'no_sections': False, 'known_future_library': frozenset({'__future__'}), 'known_third_party': frozenset(), 'known_first_party': frozenset(), 'known_local_folder': frozenset(), 'known_standard_library': frozenset({'winreg', 'mimetypes', 'winsound', 'sre_constants', '_dummy_thread', 'curses', 'bisect', 'argparse', 'wave', 'ensurepip', 'zoneinfo', 'runpy', 'platform', 'statistics', 'getopt', 'json', 'site', 'socket', 'shelve', 'bdb', 'imp', 'concurrent', 'timeit', 'ftplib', 'ast', 'parser', 'smtpd', 'reprlib', 'netrc', 'copyreg', 'marshal', 'numbers', 'sndhdr', 'fractions', 'string', 'traceback', 'pty', 'gzip', 'ipaddress', 'errno', 'compileall', 'typing', 'pickletools', 'struct', 'tarfile', '_tkinter', 'aifc', 'crypt', 'xml', 'smtplib', 'doctest', 'unicodedata', 'pyclbr', 'zipapp', 'html', 'zipimport', 'asynchat', 'quopri', 'usercustomize', 'tkinter', '_thread', '_ast', 'ctypes', 'cgi', 'codecs', 'pathlib', 'itertools', 'contextvars', 'tomllib', 'zlib', 'readline', 'datetime', 'termios', 'time', 'sysconfig', 'pstats', 'dataclasses', 'random', 'uuid', 'optparse', 'tokenize', 'pickle', 'sre_parse', 'rlcompleter', 'difflib', 'keyword', 'asyncio', 'mailcap', 'profile', 'socketserver', 'cmd', 'inspect', 'secrets', 'bz2', 'modulefinder', 'sched', 'abc', 'mmap', 'operator', 'cProfile', 'xdrlib', 'builtins', 'stringprep', 'msvcrt', 'venv', 'calendar', 'tracemalloc', 'ntpath', 'cmath', 'gc', 'msilib', 'ossaudiodev', 'audioop', 'glob', 'atexit', 'formatter', 'grp', 'weakref', 'zipfile', 'code', 'pprint', 'selectors', 'ssl', 'queue', 'fnmatch', 'tempfile', 'math', 'binascii', 'lib2to3', 'pydoc', 'asyncore', 'stat', 'resource', 'sitecustomize', 'dummy_threading', 'sre_compile', 'cgitb', 'signal', 'plistlib', 'fpectl', 'os', 'binhex', 'turtle', 'filecmp', 'http', 'encodings', 'mailbox', 'sunau', 'threading', 'subprocess', 'linecache', 'decimal', 'shlex', 'collections', 'test', 'array', 'warnings', 'unittest', 'symbol', 'xmlrpc', 'nis', 'tty', 'io', 'hmac', 'token', 'tabnanny', 'configparser', 'csv', 'turtledemo', 'faulthandler', 'nntplib', 'sre', 'symtable', 'macpath', 'types', 'py_compile', 'fcntl', 'wsgiref', 'codeop', 'sys', 'syslog', 'hashlib', 'heapq', 'graphlib', 'shutil', 'copy', 'pkgutil', 'fileinput', 'importlib', 'pwd', 'multiprocessing', 'gettext', 'locale', 'dis', 'logging', 'lzma', 'functools', 'telnetlib', 'webbrowser', 'select', 'colorsys', 'textwrap', 'trace', 'posixpath', 'imghdr', 'getpass', 'sqlite3', 'dbm', 'base64', 'pipes', 're', 'email', 'idlelib', 'imaplib', 'spwd', 'chunk', 'urllib', 'poplib', 'pdb', 'posix', 'uu', 'distutils', 'enum', 'contextlib'}), 'extra_standard_library': frozenset(), 'known_other': {}, 'multi_line_output': <WrapModes.GRID: 0>, 'forced_separate': (), 'indent': ' ', 'comment_prefix': ' #', 'length_sort': False, 'length_sort_straight': False, 'length_sort_sections': frozenset(), 'add_imports': frozenset(), 'remove_imports': frozenset(), 'append_only': False, 'reverse_relative': False, 'force_single_line': False, 'single_line_exclusions': (), 'default_section': 'THIRDPARTY', 'import_headings': {}, 'import_footers': {}, 'balanced_wrapping': False, 'use_parentheses': False, 'order_by_type': True, 'atomic': False, 'lines_before_imports': -1, 'lines_after_imports': -1, 'lines_between_sections': 1, 'lines_between_types': 0, 'combine_as_imports': False, 'combine_star': False, 'include_trailing_comma': False, 'from_first': False, 'verbose': False, 'quiet': False, 'force_adds': False, 'force_alphabetical_sort_within_sections': False, 'force_alphabetical_sort': False, 'force_grid_wrap': 0, 'force_sort_within_sections': False, 'lexicographical': False, 'group_by_package': False, 'ignore_whitespace': False, 'no_lines_before': frozenset(), 'no_inline_sort': False, 'ignore_comments': False, 'case_sensitive': False, 'sources': (), 'virtual_env': '', 'conda_env': '', 'ensure_newline_before_comments': False, 'directory': '', 'profile': '', 'honor_noqa': False, 'src_paths': (), 'old_finders': False, 'remove_redundant_aliases': False, 'float_to_top': False, 'filter_files': False, 'formatter': '', 'formatting_function': None, 'color_output': False, 'treat_comments_as_code': frozenset(), 'treat_all_comments_as_code': False, 'supported_extensions': frozenset({'py', 'pyi', 'pyx', 'pxd'}), 'blocked_extensions': frozenset({'pex'}), 'constants': frozenset(), 'classes': frozenset(), 'variables': frozenset(), 'dedup_headings': False, 'only_sections': False, 'only_modified': False, 'combine_straight_imports': False, 'auto_identify_namespace_packages': True, 'namespace_packages': frozenset(), 'follow_links': True, 'indented_import_headings': True, 'honor_case_in_force_sorted_sections': False, 'sort_relative_in_force_sorted_sections': False, 'overwrite_in_place': False, 'reverse_sort': False, 'star_first': False, 'git_ls_files': {}, 'format_error': '{error}: {message}', 'format_success': '{success}: {message}', 'sort_order': 'natural', 'sort_reexports': False, 'split_on_trailing_comma': False, 'source': 'defaults'},), virtual_env='', conda_env='', ensure_newline_before_comments=False, directory='F:\\JoeyCodes\\PyDocs', profile='', honor_noqa=False, src_paths=(WindowsPath('F:/JoeyCodes/PyDocs/src'), WindowsPath('F:/JoeyCodes/PyDocs')), old_finders=False, remove_redundant_aliases=False, float_to_top=False, filter_files=False, formatter='', formatting_function=None, color_output=False, treat_comments_as_code=frozenset(), treat_all_comments_as_code=False, supported_extensions=frozenset({'py', 'pyi', 'pyx', 'pxd'}), blocked_extensions=frozenset({'pex'}), constants=frozenset(), classes=frozenset(), variables=frozenset(), dedup_headings=False, only_sections=False, only_modified=False, combine_straight_imports=False, auto_identify_namespace_packages=True, namespace_packages=frozenset(), follow_links=True, indented_import_headings=True, honor_case_in_force_sorted_sections=False, sort_relative_in_force_sorted_sections=False, overwrite_in_place=False, reverse_sort=False, star_first=False, git_ls_files={}, format_error='{error}: {message}', format_success='{success}: {message}', sort_order='natural', sort_reexports=False, split_on_trailing_comma=False)) -> str
Returns a line wrapped to the specified line-length, if possible.
DATA
DEFAULT_CONFIG = Config(py_version='py3', force_to_top=frozenset(...t_...
List = typing.List
A generic version of list.
Optional = typing.Optional
Optional[X] is equivalent to Union[X, None].
Sequence = typing.Sequence
A generic version of collections.abc.Sequence.
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\isort\wrap.py
isort.wrap_modes
Python Library Documentation: module isort.wrap_modes in isort
NAME
isort.wrap_modes - Defines all wrap modes that can be used when outputting formatted imports
CLASSES
enum.Enum(builtins.object)
WrapModes
class WrapModes(enum.Enum)
| WrapModes(*values)
|
| Method resolution order:
| WrapModes
| enum.Enum
| builtins.object
|
| Data and other attributes defined here:
|
| BACKSLASH_GRID = <WrapModes.BACKSLASH_GRID: 11>
|
| GRID = <WrapModes.GRID: 0>
|
| HANGING_INDENT = <WrapModes.HANGING_INDENT: 2>
|
| HANGING_INDENT_WITH_PARENTHESES = <WrapModes.HANGING_INDENT_WITH_PAREN...
|
| NOQA = <WrapModes.NOQA: 7>
|
| VERTICAL = <WrapModes.VERTICAL: 1>
|
| VERTICAL_GRID = <WrapModes.VERTICAL_GRID: 4>
|
| VERTICAL_GRID_GROUPED = <WrapModes.VERTICAL_GRID_GROUPED: 5>
|
| VERTICAL_GRID_GROUPED_NO_COMMA = <WrapModes.VERTICAL_GRID_GROUPED_NO_C...
|
| VERTICAL_HANGING_INDENT = <WrapModes.VERTICAL_HANGING_INDENT: 3>
|
| VERTICAL_HANGING_INDENT_BRACKET = <WrapModes.VERTICAL_HANGING_INDENT_B...
|
| VERTICAL_PREFIX_FROM_MODULE_IMPORT = <WrapModes.VERTICAL_PREFIX_FROM_M...
|
| ----------------------------------------------------------------------
| Data descriptors inherited from enum.Enum:
|
| name
| The name of the Enum member.
|
| value
| The value of the Enum member.
|
| ----------------------------------------------------------------------
| Static methods inherited from enum.EnumType:
|
| __contains__(value)
| Return True if `value` is in `cls`.
|
| `value` is in `cls` if:
| 1) `value` is a member of `cls`, or
| 2) `value` is the value of one of the `cls`'s members.
|
| __getitem__(name)
| Return the member matching `name`.
|
| __iter__()
| Return members in definition order.
|
| __len__()
| Return the number of members (no aliases)
|
| ----------------------------------------------------------------------
| Readonly properties inherited from enum.EnumType:
|
| __members__
| Returns a mapping of member name->value.
|
| This mapping lists all enum members, including aliases. Note that this
| is a read-only view of the internal mapping.
FUNCTIONS
backslash_grid(statement: str, imports: List[str], white_space: str, indent: str, line_length: int, comments: List[str], line_separator: str, comment_prefix: str, include_trailing_comma: bool, remove_comments: bool) -> str
formatter_from_string(name: str) -> Callable[..., str]
from_string(value: str) -> 'WrapModes'
grid(statement: str, imports: List[str], white_space: str, indent: str, line_length: int, comments: List[str], line_separator: str, comment_prefix: str, include_trailing_comma: bool, remove_comments: bool) -> str
hanging_indent(statement: str, imports: List[str], white_space: str, indent: str, line_length: int, comments: List[str], line_separator: str, comment_prefix: str, include_trailing_comma: bool, remove_comments: bool) -> str
hanging_indent_with_parentheses(statement: str, imports: List[str], white_space: str, indent: str, line_length: int, comments: List[str], line_separator: str, comment_prefix: str, include_trailing_comma: bool, remove_comments: bool) -> str
noqa(statement: str, imports: List[str], white_space: str, indent: str, line_length: int, comments: List[str], line_separator: str, comment_prefix: str, include_trailing_comma: bool, remove_comments: bool) -> str
vertical(statement: str, imports: List[str], white_space: str, indent: str, line_length: int, comments: List[str], line_separator: str, comment_prefix: str, include_trailing_comma: bool, remove_comments: bool) -> str
vertical_grid(statement: str, imports: List[str], white_space: str, indent: str, line_length: int, comments: List[str], line_separator: str, comment_prefix: str, include_trailing_comma: bool, remove_comments: bool) -> str
vertical_grid_grouped(statement: str, imports: List[str], white_space: str, indent: str, line_length: int, comments: List[str], line_separator: str, comment_prefix: str, include_trailing_comma: bool, remove_comments: bool) -> str
vertical_grid_grouped_no_comma(statement: str, imports: List[str], white_space: str, indent: str, line_length: int, comments: List[str], line_separator: str, comment_prefix: str, include_trailing_comma: bool, remove_comments: bool) -> str
vertical_hanging_indent(statement: str, imports: List[str], white_space: str, indent: str, line_length: int, comments: List[str], line_separator: str, comment_prefix: str, include_trailing_comma: bool, remove_comments: bool) -> str
vertical_hanging_indent_bracket(statement: str, imports: List[str], white_space: str, indent: str, line_length: int, comments: List[str], line_separator: str, comment_prefix: str, include_trailing_comma: bool, remove_comments: bool) -> str
vertical_prefix_from_module_import(statement: str, imports: List[str], white_space: str, indent: str, line_length: int, comments: List[str], line_separator: str, comment_prefix: str, include_trailing_comma: bool, remove_comments: bool) -> str
DATA
Callable = typing.Callable
Deprecated alias to collections.abc.Callable.
Callable[[int], str] signifies a function that takes a single
parameter of type int and returns a str.
The subscription syntax must always be used with exactly two
values: the argument list and the return type.
The argument list must be a list of types, a ParamSpec,
Concatenate or ellipsis. The return type must be a single type.
There is no syntax to indicate optional or keyword arguments;
such function types are rarely used as callback types.
Dict = typing.Dict
A generic version of dict.
List = typing.List
A generic version of list.
__annotations__ = {'_wrap_modes': typing.Dict[str, typing.Callable[......
FILE
c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\isort\wrap_modes.py