????

Your IP : 18.217.65.73


Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/isort/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/isort/__pycache__/main.cpython-311.pyc

�

�܋f����dZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZddlm
Z
mZmZmZmZmZddlmZdd	lmZmZmZmZdd
lmZmZmZddlmZddl m!Z!dd
l"m"Z"ddl#m$Z$m%Z%m&Z&ddl'm(Z(ddl)m*Z*hd�Z+de!�d�Z,Gd�d��Z-			d+de.de%de/de/de/de
dee-fd�Z0	d,de%dee.d ee.ddfd!�Z1dej2fd"�Z3d-d#eee.dee.e
ffd$�Z4d%e
dee.ee
ffd&�Z5	d,d#eee.d'ee	ddfd(�Z6d,d#eee.d'ee	ddfd)�Z7e8d*kre7��dSdS).zSTool for sorting imports alphabetically, and automatically separated into sections.�N)�gettext)�
TextIOWrapper)�Path)�Any�Dict�List�Optional�Sequence�Union)�warn�)�__version__�api�files�sections)�FileSkipped�
ISortError�UnsupportedEncoding)�create_terminal_printer)�	ASCII_ART)�profiles)�VALID_PY_TARGETS�Config�find_all_configs)�Trie)�	WrapModes>�-ac�-af�-ca�-cs�-df�-ds�-dt�-ff�-le�-ls�-ot�-rr�-sd�-sg�-sl�-sp�-tc�-wl�-ws�-fas�-fgw�-fss�-lai�-lbt�-nis�-nlb�-fass�
a

Nothing to do: no files or paths have have been passed in!

Try one of the following:

    `isort .` - sort all Python files, starting from the current directory, recursively.
    `isort . --interactive` - Do the same, but ask before making any changes.
    `isort . --check --diff` - Check to see if imports are correctly sorted within this project.
    `isort --help` - In-depth information about isort's available command-line options.

Visit https://pycqa.github.io/isort/ for complete information about how to use isort.
c�&�eZdZdedededdfd�ZdS)�SortAttempt�incorrectly_sorted�skipped�supported_encoding�returnNc�0�||_||_||_dS�N)r;r<r=)�selfr;r<r=s    �[/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/isort/main.py�__init__zSortAttempt.__init__Ds��"4������"4�����)�__name__�
__module__�__qualname__�boolrC�rDrBr:r:CsF������5�4�5�$�5�TX�5�]a�5�5�5�5�5�5rDr:F�	file_name�config�check�ask_to_apply�write_to_stdout�kwargsr>c��d}d}	|r:	tj|fd|i|��}n#t$rd}YnwxYwt||d��S	tj|f|||d�|��}n#t$rd}YnwxYwt||d��S#t
tf$r }td|�d|����Yd}~dSd}~wt$r-|j	rtd|����t||d��cYSt$r=}t|t|�����tjd	��Yd}~dSd}~wt$rt||�
���wxYw)NFrKT)rKrMrNzUnable to parse file z due to zEncoding not supported for )�messager
)�offending_file)r�
check_filerr:�	sort_file�OSError�
ValueErrorrr�verboser�_print_hard_fail�str�sys�exit�	Exception)	rJrKrLrMrNrOr;r<�errors	         rB�sort_importsr^Js�� %���G���	B�
�),��	�)[�)[�&�)[�TZ�)[�)[�%[�"�"���
�
�
�����
�����1�7�D�A�A�A�		�%(�]��&��)� /�	&�&�
�&�&�"�����	�	�	��G�G�G�	�����-�w��=�=�=���Z� �����
?�Y�
?�
?��
?�
?�@�@�@��t�t�t�t�t������?�?�?��>�	<��:�y�:�:�;�;�;��-�w��>�>�>�>�>��������U���4�4�4�4�����������������������	�:�:�:�:�
����sh�A>��A>�.�A>�.�A>�A�A>�A*�'A>�)A*�*A>�>E�B*�*7E�#	E�,2D$�$ ErRrQc��|pd|pd�d�}t|j|j|j���}|�|��dS)z4Fail on unrecoverable exception with custom message.z,Unrecoverable exception thrown when parsing �zk! This should NEVER happen.
If encountered, please open an issue: https://github.com/PyCQA/isort/issues/new��colorr]�successN)r�color_output�format_error�format_successr])rKrRrQ�printers    rBrXrXvsp����	Z�~�7K��	Z�	Z�	Z��
&��!��)<�f�F[����G��M�M�'�����rDc��tjdd���}|�d��}|�d��}|�d��}|���}|�d��}|�d��}|�d	d
dtjt
d���
��|�ddddd���|�dddtd���|�ddddd���|�ddddd �!��|�d"d#dd$�!��|�d%d&dd'd(���|�d)d*d+d,d�-��|�d.d/d0d�-��|�d1d2dd3�!��|�d4d5dd6�!��|�d7d8d9dd:�!��|�d;d<d=dd>d?���|�d@dAddBdC���|�dDdEdFdGdHdI�J��|�dKdLdMdN�J��|�dOdPddQ�!��|�dRdStdTdU�	tj�����dV��W��|�dXdYdZdd[�!��|�d\d]d^d_td`da�b��|�dcdddeddf�!��|�dgdhddi�!��|�djdkdl�J��|�dmdndo�J��|�dpdqdrdds�!��|�dtdudv�w��|�dxdyddz�!��|�d{d|d}d~d�-��|�d�d�d�d�-��|�d�d�d�d�d�-��|�d�d�d�d�-��|�d�d�dd�d����|�d�d�d�d�dd��!��|�d�d�dd��!��|�d�d�dd��!��|�d�d�d��J��|�d�ddd��
��|�d�d�d�dd��!��|�d�d�d�dd��!��|�d�d�d�dd��!��|�d�d�d�dd��!��|�d�d�dd��!��|�d�d�dd��!��|�d�d�d�dd��!��|�d�d�d�dd��!��|�d�d�d�dd��!��|�d�d�d�ddì!��|�d�d�d`d�td�dȬɦ�|�d�d�d�d�t�Φ�|�d�d�d�t�Ҧ�|�d�d�d�t�Ҧ�|�d�d�d�t�Ҧ�|�d�d�d�dܬJ��|�d�d�d�d�d�-��|�d�d�d�d�d�-��|�d�d�d�ttj�����d�tj���D��ztd���|�d�d�d�dd�!��|�d�d�d�dd�!��|�d�d�d�dd��!��|�d�d�d�dd��!��|�d�d�d�dd��!��|�d��dd�d�!��|��d�d�d�J��|��d�d�dd�d�!��|��d	�d
�d�dd�-��|��d
�d�dd�d�!��|��d�d�dd�d�!��|��d�d�d�d�d�dt��|��d�d�dt�d�W��|��d�d d�d!�!��|��d"�d#d�d$�!��|��d%�d&d�d'�!��|��d(�d)d�d*�!��|��d+�d,d�d-�!��|��d.�d/t�d0�W��|��d1�d2d�d3�!��|��d4�d5�d6�J��|��d7�d8�d9d�-��|��d:�d;�d<d�-��|��d=�d>�d?�d@tt"j��z�J��|��dA�dB�dCd�dD�!��|��dE�dF�dG�dHd�-��|��dI�dJd�dK�dL���|��dM�dNd�dO�dP���|��dQ�dRd�dS�dT���|��dU�dVd�dW�dX���|��dY�dZd�d[�d\���|��d]�d^�d_�d`d�-��|��da�db�dcd�dd�!��|��de�df�dg�dhd�-��|��di�dj�dkd�dl�!��|��dm�dn�dod�dp�!��|��dq�drd�ds�!��|��dt�du�dvd�dw�!��|��dx�dy�dzd�d{�!��|��d|�d}�d~d�d�!��|��d��d�d�d��!��|��d��d��d��J��|��d��d��d��J��|��d��d��d��d�t't(���d�z�d�t*jj�t*jj��d�������|��d��d��d��d�tj�����|��d��d��d��d�tj�����|��d��d��d��d�tj�����|��d��d��d��d�tj�����|��d��d��d��d�tj�����|��d��d��d��d��d�tj�����|S(�Na�Sort Python import definitions alphabetically within logical sections. Run with no arguments to see a quick start guide, otherwise, one or more files/directories/stdin must be provided. Use `-` as the first argument to represent stdin. Use --interactive to use the pre 5.0.0 interactive behavior. If you've used isort 4 but are new to isort 5, see the upgrading guide: https://pycqa.github.io/isort/docs/upgrade_guides/5.0.0.htmlF)�description�add_helpzgeneral options�target optionszgeneral output optionszsection output optionszdeprecated optionsz-hz--help�helpzshow this help message and exit��action�defaultrlz-Vz	--version�
store_true�show_versionz2Displays the currently installed version of isort.)rn�destrlz--vnz--version-number�versionz8Returns just the current version number without the logo)rnrsrlz-vz	--verboserWzSShows verbose output, such as when files are skipped or when a check is successful.z--only-modifiedz--om�
only_modifiedz1Suppresses verbose output for non-modified files.)rrrnrlz--dedup-headings�dedup_headingsz�Tells isort to only show an identical custom import heading comment once, even if there are multiple sections with the comment set.z-qz--quiet�quietz4Shows extra quiet output, only errors are outputted.z-dz--stdoutz6Force resulting output to stdout, instead of in-place.rN)rlrrrnz--overwrite-in-placez�Tells isort to overwrite in place using the same file handle. Comes at a performance and memory usage penalty over its standard approach but ensures all file flags and modes stay unchanged.�overwrite_in_placez
--show-config�show_configzDSee isort's determined config, as well as sources of config options.z--show-files�
show_fileszHSee the files isort will be run against with the current config options.z--dfz--diff�	show_diffz\Prints a diff of all the changes isort would make to a file, instead of changing it in placez-cz--check-onlyz--checkrLz�Checks the file for unsorted / unformatted imports and prints them to the command line without modifying the file. Returns 0 when nothing would change and returns 1 when the file would be reformatted.z--wsz--ignore-whitespace�ignore_whitespacezMTells isort to ignore whitespace differences when --check-only is being used.z--spz--settings-pathz--settings-filez
--settings�
settings_pathz\Explicitly set the settings path or file instead of auto determining based on file location.)rrrlz--crz
--config-root�config_rootz�Explicitly set the config root for resolving all configs. When used with the --resolve-all-configs flag, isort will look at all sub-folders in this config root to resolve config files and sort files based on the closest available config(if any)z--resolve-all-configs�resolve_all_configszoTells isort to resolve the configs for all sub-directories and sort files in terms of its closest config files.z	--profile�profilez>Base profile type to use for configuration. Profiles include: �, z!. As well as any shared profiles.)rr�typerlz
--old-findersz--magic-placement�old_finderszSUse the old deprecated finder logic that relies on environment introspection magic.z-jz--jobszPNumber of files to process in parallel. Negative value means use number of CPUs.�jobs�?���)rlrrr��nargs�constz--acz--atomic�atomiczMEnsures the output doesn't save if the resulting file contains syntax errors.z
--interactiverMz+Tells isort to apply changes interactively.z--format-errorrez)Override the format used to print errors.z--format-successrfz*Override the format used to print success.z--srxz--sort-reexports�sort_reexportszDAutomatically sort all re-exports (module level __all__ collections)r�*�?One or more Python source files that need their imports sorted.�r�rlz--filter-files�filter_filesz_Tells isort to filter files even when they are explicitly passed in as part of the CLI command.z-sz--skipz�Files that isort should skip over. If you want to skip multiple files you should specify twice: --skip file1 --skip file2. Values can be file names, directory names or file paths. To skip all files in a nested path use --skip-glob.�skip�appendz
--extend-skipaExtends --skip to add additional files that isort should skip over. If you want to skip multiple files you should specify twice: --skip file1 --skip file2. Values can be file names, directory names or file paths. To skip all files in a nested path use --skip-glob.�extend_skipz--sgz--skip-globz"Files that isort should skip over.�	skip_globz--extend-skip-globzEAdditional files that isort should skip over (extending --skip-glob).�extend_skip_globz--gitignorez--skip-gitignore�skip_gitignorez�Treat project as a git repository and ignore files listed in .gitignore.
NOTE: This requires git to be installed and accessible from the same shell as isort.z--extz--extensionz--supported-extension�supported_extensionsz3Specifies what extensions isort can be run against.z--blocked-extension�blocked_extensionsz9Specifies what extensions isort can never be run against.z--dont-follow-links�dont_follow_linkszQTells isort not to follow symlinks that are encountered when running recursively.z
--filename�filenamez.Provide the filename associated with a stream.z--allow-rootzQTells isort not to treat / specially, allowing it to be run against the root dir.z-az--add-import�add_importszYAdds the specified import line to all files, automatically determining correct placement.z--appendz
--append-only�append_onlyzVOnly adds the imports specified in --add-import if the file contains existing imports.z--afz--force-adds�
force_addsz6Forces import adds even if the original file is empty.z--rmz--remove-import�remove_importsz,Removes the specified import from all files.z--float-to-top�float_to_topa�Causes all non-indented imports to float to the top of the file having its imports sorted (immediately below the top of file comment).
This can be an excellent shortcut for collecting imports every once in a while when you place them in the middle of a file to avoid context switching.

*NOTE*: It currently doesn't work with cimports and introduces some extra over-head and a performance penalty.z--dont-float-to-top�dont_float_to_topzKForces --float-to-top setting off. See --float-to-top for more information.z--caz--combine-as�combine_as_importsz%Combines as imports on the same line.z--csz--combine-star�combine_starzWEnsures that if a star import is present, nothing else is imported from that namespace.z-ez
--balanced�balanced_wrappingzEBalances wrapping to produce the most consistent line length possiblez--ffz--from-first�
from_firstzXSwitches the typical ordering preference, showing from imports first then straight ones.z--fgwz--force-grid-wrap��force_grid_wrapz�Force number of from imports (defaults to 2 when passed as CLI flag without value) to be grid wrapped regardless of line length. If 0 is passed in (the global default) only line length is considered.)r�r�r�rrrlz-iz--indentz:String to place for indents defaults to "    " (4 spaces).�indent)rlrrr�z--lbiz--lines-before-imports�lines_before_imports)rrr�z--laiz--lines-after-imports�lines_after_importsz--lbtz--lines-between-types�lines_between_typesz--lez
--line-ending�line_endingzXForces line endings to the specified value. If not set, values will be guessed per-file.z--lsz
--length-sortz$Sort imports by their string length.�length_sortz--lssz--length-sort-straightz�Sort straight imports by their string length. Similar to `length_sort` but applies only to straight imports and doesn't affect from imports.�length_sort_straightz-mz--multi-line�multi_line_outputc�6�g|]}t|j����SrI)rY�value)�.0�modes  rB�
<listcomp>z%_build_arg_parser.<locals>.<listcomp>#s ��
F�
F�
F�t�3�t�z�?�?�
F�
F�
FrDz�Multi line output (0-grid, 1-vertical, 2-hanging, 3-vert-hanging, 4-vert-grid, 5-vert-grid-grouped, 6-deprecated-alias-for-5, 7-noqa, 8-vertical-hanging-indent-bracket, 9-vertical-prefix-from-module-import, 10-hanging-indent-with-parentheses).)rr�choicesr�rlz-nz --ensure-newline-before-comments�ensure_newline_before_commentsz:Inserts a blank line before a comment following an import.z--nisz--no-inline-sort�no_inline_sortzULeaves `from` imports with multiple imports 'as-is' (e.g. `from foo import a, c ,b`).z--otz--order-by-type�
order_by_typea
Order imports by type, which is determined by case, in addition to alphabetically.

**NOTE**: type here refers to the implied type from the import name capitalization.
 isort does not do type introspection for the imports. These "types" are simply: CONSTANT_VARIABLE, CamelCaseClass, variable_or_function. If your project follows PEP8 or a related coding standard and has many imports this is a good default, otherwise you likely will want to turn it off. From the CLI the `--dont-order-by-type` option will turn this off.z--dtz--dont-order-by-type�dont_order_by_typea�Don't order imports by type, which is determined by case, in addition to alphabetically.

**NOTE**: type here refers to the implied type from the import name capitalization.
 isort does not do type introspection for the imports. These "types" are simply: CONSTANT_VARIABLE, CamelCaseClass, variable_or_function. If your project follows PEP8 or a related coding standard and has many imports this is a good default. You can turn this on from the CLI using `--order-by-type`.z--rrz--reverse-relative�reverse_relativez"Reverse order of relative imports.z--reverse-sort�reverse_sortz!Reverses the ordering of imports.z--sort-order�
sort_orderz�Specify sorting function. Can be built in (natural[default] = force numbers to be sequential, native = Python's built-in sorted function) or an installable plugin.z--slz--force-single-line-imports�force_single_linez3Forces all from imports to appear on their own linez--nslz--single-line-exclusionsz9One or more modules to exclude from the single line rule.�single_line_exclusionsz--tcz--trailing-comma�include_trailing_commazIIncludes a trailing comma on multi line imports that include parentheses.z--upz--use-parentheses�use_parenthesesz�Use parentheses for line continuation on length limit instead of slashes. **NOTE**: This is separate from wrap modes, and only affects how individual lines that  are too long get continued, not sections of multiple imports.z-lz-wz
--line-lengthz--line-widthzBThe max length of an import line (used for wrapping long imports).�line_lengthz--wlz
--wrap-length�wrap_lengthz�Specifies how long lines that are wrapped should be, if not set line_length is used.
NOTE: wrap_length must be LOWER than or equal to line_length.z--case-sensitive�case_sensitivez7Tells isort to include casing when sorting module namesz--remove-redundant-aliases�remove_redundant_aliasesz�Tells isort to remove redundant aliases from imports, such as `import os as os`. This defaults to `False` simply because some projects use these seemingly useless  aliases to signify intent and change behaviour.z--honor-noqa�
honor_noqazFTells isort to honor noqa comments to enforce skipping those comments.z--treat-comment-as-code�treat_comments_as_codezNTells isort to treat the specified single line comment(s) as if they are code.z--treat-all-comment-as-code�treat_all_comments_as_codezBTells isort to treat all single line comments as if they are code.z--formatter�	formatterzGSpecifies the name of a formatting plugin to use when producing output.z--colorrdz,Tells isort to use color in terminal output.z--ext-format�
ext_formatzRTells isort to format the given files according to an extensions formatting rules.z--star-firstzQForces star imports above others to avoid overriding directly imported variables.�
star_firstz--split-on-trailing-commazQSplit imports list followed by a trailing comma into VERTICAL_HANGING_INDENT mode�split_on_trailing_commaz--sdz--section-default�default_sectionz-Sets the default section for import options: z--only-sectionsz--os�
only_sectionsz�Causes imports to be sorted based on their sections like STDLIB, THIRDPARTY, etc. Within sections, the imports are ordered by their import style and the imports with the same style maintain their relative positions.z--dsz
--no-sectionsz,Put all imports into the same section bucket�no_sectionsz--fasz--force-alphabetical-sort�force_alphabetical_sortz2Force all imports to be sorted as a single sectionz--fssz--force-sort-within-sections�force_sort_within_sectionsz�Don't sort straight-style imports (like import sys) before from-style imports (like from itertools import groupby). Instead, sort the imports by module, independent of import style.z--hcssz%--honor-case-in-force-sorted-sections�#honor_case_in_force_sorted_sectionsz�Honor `--case-sensitive` when `--force-sort-within-sections` is being used. Without this option set, `--order-by-type` decides module name ordering too.z--srssz(--sort-relative-in-force-sorted-sections�&sort_relative_in_force_sorted_sectionsz}When using `--force-sort-within-sections`, sort relative imports the same way as they are sorted when not using that setting.z--fassz)--force-alphabetical-sort-within-sections�'force_alphabetical_sort_within_sectionsz>Force all imports to be sorted alphabetically within a sectionz-tz--topz?Force specific imports to the top of their appropriate section.�force_to_topz--combine-straight-importsz--csi�combine_straight_importsz}Combines all the bare straight imports of the same section in a single line. Won't work with sections which have 'as' importsz--nlbz--no-lines-beforez?Sections which should not be split with previous by empty lines�no_lines_beforez--srcz
--src-path�	src_pathsz�Add an explicitly defined source path (modules within src paths have their imports automatically categorized as first_party). Glob expansion (`*` and `**`) is supported for this option.z-bz	--builtin�known_standard_libraryzGForce isort to recognize a module as part of Python's standard library.z--extra-builtin�extra_standard_libraryzNExtra modules to be included in the list of ones in Python's standard library.z-fz--future�known_future_librarya�Force isort to recognize a module as part of Python's internal future compatibility libraries. WARNING: this overrides the behavior of __future__ handling and therefore can result in code that can't execute. If you're looking to add dependencies such as six, a better option is to create another section below --future using custom sections. See: https://github.com/PyCQA/isort#custom-sections-and-ordering and the discussion here: https://github.com/PyCQA/isort/issues/1463.z-oz--thirdparty�known_third_partyzIForce isort to recognize a module as being part of a third party library.z-pz	--project�known_first_partyzNForce isort to recognize a module as being part of the current python project.z--known-local-folder�known_local_folderz�Force isort to recognize a module as being a local folder. Generally, this is reserved for relative imports (from . import module).z
--virtual-env�virtual_envzKVirtual environment to use for determining whether a package is third-partyz--conda-env�	conda_envzIConda environment to use for determining whether a package is third-partyz--pyz--python-version�store�
py_version)�autoaTells isort to set the known standard library based on the specified Python version. Default is to assume any Python 3 version could be the target, and use a union of all stdlib modules across versions. If auto is specified, the version of the interpreter used to run isort (currently: z) will be used.)rnrrr�rlz--recursive�deprecated_flags�append_const)rrrnr�rlz-rcz--dont-skipz-nsz--applyz-kz--keep-direct-and-as)�argparse�ArgumentParser�add_argument_group�add_mutually_exclusive_group�add_argument�SUPPRESS�_rrY�joinr�keys�int�listr�__members__�valuesr�DEFAULT�tuplerrZ�version_info�major�minor)�parser�
general_group�target_group�output_group�inline_args_group�
section_group�deprecated_groups       rB�_build_arg_parserr��sb��
�
$�G��
�
�
�F��-�-�.?�@�@�M��,�,�-=�>�>�L��,�,�-E�F�F�L�$�A�A�C�C���-�-�.F�G�G�M��0�0�1E�F�F���������!�
�0�
1�
1�����������
�
A������������
G�����������
�
b����������
��
@���������
��=�	����������
�
C����������
E�
����������H�"��
��������
��
S�	��������
��
W�	���������
��������������
�8�
�	�	�	�������
 �
\������������
�"�
���������
�+�	��������
"��?�	��������
�
�[�!�Y�Y�x�}���7�7�[�[�[�	���������
��
b����������
_�
�
������������
��
\���������
��
:�	��������
�
8�����
����
�
9�����
�����
��
S���������s�!b���������
��#�	�������������	�	�	������
���	�	�	������
1�
����������
T�
��	����������
�a�����������
#��
B�
��������
!��
H�	��������
 ��
`�	��������
�
=�����
������
`�	���������
��7����������
��&����������
��
E����������
��
;���������
��%�	�
�
�
�����
 ��
Z�	���������
!��
4����������
��8����������
 ��
T����������
��9������������
�
�Y��
�
�
������
I�
�
���������)�0F�S���������(�/D�3���������(�/D�3����������
�7�	���������
3�
���������� �P�
#��
���������
 ��Y�*�/�/�1�1�2�2�
F�
F�y�'<�'C�'C�'E�'E�
F�
F�
F�G�
�/���������*�
-��
I������"�"���
��,�#���������
������������
!��8����������
��
1���������
��
0�	��������
�b������"�"��%�
 ��
B�#��������"�
H�
%�����������
%��
X����������
��I������������
Q�
�
����������
�
�J���������
��
F�	�������$�
'��
?��	�	�	�����
��
U�	�������!�
%��
]�	�������%�
)��
Q�	��������
�
�
V�	��������
��
;�	��������
�
a�����
����
`�
��	�������#�
`�
&��	���������
�
<�s�8�CS�?T�?T�
T�	���������
��<����������
;�
����������#��
&�
A���������&��
)�'���������/��
2�W���������2��
5�>���������3��
6�
M����������
N�
���������$��
'��;����������
N�
�����������
��G����������
%��
V���������
%��
]�	���������
#��G����������
 ��
X����������
 ��
]���������
!��S�	��������
�
Z�����
����
�
X�����
������
��&�'�'�)�3�W��'�-�	W�03�/?�/E�	W�W�W�
�����!�!��
���
�
�"�����!�!�
�&�~�U�QY�Qb�"�����!�!��
���
�
�"�����!�!�
�&�~�U�QY�Qb�"�����!�!��
���
�
�"�����!�!���
��$�
�
�
"�����MrD�argvc���|�tjdd�nt|��}g}t|��D]+\}}|tvr|�|��d|��||<�,t
��}d�t|�|�����	��D��}|r||d<d|vrd|d<|d=d|vrd|d	<|d=d
|vr3|d
=|�
dd��rtjd��nd|d<|�
d
d��}|rD|���r tt|����|d
<nt||d
<|S)Nr
�-c��i|]
\}}|�||��SrIrI)r��keyr�s   rB�
<dictcomp>zparse_args.<locals>.<dictcomp>�s$��]�]�]�
��U�W\�]��e�]�]�]rD�remapped_deprecated_argsr�Fr�r��follow_linksr�r�z6Can't set both --float-to-top and --dont-float-to-top.r�)rZr�r��	enumerate�DEPRECATED_SINGLE_DASH_ARGSr�r��vars�
parse_args�items�getr[�isdigitrr�)r�r�index�argr��	argumentsr�s       rBrr�s����<�3�8�A�B�B�<�<�T�$�Z�Z�D�!����o�o�$�$�
��s��-�-�-�$�+�+�C�0�0�0�#�c�)�)�D��K��
�
 �
 �F�]�]�d�6�3D�3D�T�3J�3J�.K�.K�.Q�.Q�.S�.S�]�]�]�I��I�0H�	�,�-��y�(�(�%*�	�/�"��*�+��i�'�'�$)�	�.�!��)�*��i�'�'��)�*��=�=���/�/�	.��H�M�N�N�N�N�(-�I�n�%�!�
�
�&9�4�@�@���J��$�$�&�&�	J�-6�s�;L�7M�7M�-N�-N�I�)�*�*�-6�7H�-I�I�)�*��rD�itemc��t|ttf��rt|��St|t��rt|j��St|t��rt|��St|��r$t|d��rt|j
��Std|�dt|�������)z=Preconverts objects from native types into JSONifyiable typesrEzUnserializable object z	 of type )
�
isinstance�set�	frozensetr�rrY�namer�callable�hasattrrE�	TypeErrorr�)r
s rB�_preconvertr�s����$��i�(�)�)���D�z�z���$�	�"�"���4�9�~�~���$������4�y�y����~�~�"�'�$�
�3�3�"��4�=�!�!�!�
�H�T�H�H�D��J�J�H�H�
I�
I�IrD�stdinc���tjd���}|�ddd���|�ddd	d
���|�d��}|�d
dd	d���|���}|�ddd	d���|�dddt
jjd	d���|�dddt
jjd	d���|�dddt
jj	d	d���|�
|��}|j}|dgkr6tj|�tjn||j|j|j���}n'tj||j|j|j���}|D]�}|jt
jjkr.t'|j�d��d���J|jt
jjkrt'|j���y|jt
jj	krt'|j�d|j������t't/|������dS)Nz^Get all import definitions from a given file.Use `-` as the first argument to represent stdin.)rir�+r�r�z
--top-onlyrpFz@Only identify imports that occur in before functions or classes.rmrkz--follow-linkszMTells isort to follow symlinks that are encountered when running recursively.z--uniquez1If true, isort will only identify unique imports.z
--packages�unique�store_constzHIf true, isort will only identify the unique top level modules imported.)rrrnr�rorlz	--modulesz>If true, isort will only identify the unique modules imported.z--attributeszAIf true, isort will only identify the unique attributes imported.r�)r�top_onlyr�.r)r�r�r�r�r�r�	ImportKey�PACKAGE�MODULE�	ATTRIBUTErr�find_imports_in_streamrZrrrr�find_imports_in_paths�print�module�split�	attributerY)	r�rr�r��
uniquenessr�
file_names�identified_imports�identified_imports	         rB�identify_imports_mainr,�s����
$�<����F�����s�!b�����������
O�	�����,�,�-=�>�>�L�������
\�	�����4�4�6�6�J�������
@�	��������
���m�#��
W�
��������
���m�"��
M�
��������
���m�%��
P�
�����!�!�$�'�'�I���J��c�U��� �7���C�I�I�E��#��'�"�/�	
�
�
���!�6���#��'�"�/�	
�
�
��0�*�*����s�}�4�4�4��#�*�0�0��5�5�a�8�9�9�9�9�
�
���!5�
5�
5��#�*�+�+�+�+�
�
���!8�
8�
8��&�-�M�M�0A�0K�M�M�N�N�N�N��#�'�(�(�)�)�)�)�*�*rDc��$�%�&�'�(�)�*�t|��}|�d��rtt��dS|�dd��}|�dd��}|r|rtjd��d|vr�tj�	|d��rQtj�
|d��|d<tj�|d��|d<n(tj�
|d��|d<d|vrg|d}tj�
|��|d<tj�|d��std	|d����|�d
g��}|s.|s,tt��|rtjd��dSd|vr�tj�
|r|dnd
��ptj��|d<tj�|d��s(tj�|d��|d<|���}|�dd���$|�dd��}|�dd���%|�dd���)|�dd���*|�dd��}	|�dd��}
|�dd��}|�dd���(|�dd��}|�dd��}
d}d}d}d�'|
r#t#|�dd
�����'d|vr#d�|�dd��D��|d<t%di|���&|r1tt'j�&jddt,�����dS|d gkr�|rt/|��nd}|rtjd!��|�t
jn|}�%rt3j|�&�)|�(�"��}|}�nB	t3j|t
j�&�)|�(d�#���n#t:$r5t
j�|�����Y�n�wxYwd$|vrc|satA�&j!�&j"�&j#�%��}|�$d&��|�$d'��tjd(���nq|rJtA�&j!�&j"�&j#�%��}|�$d)��tjd(��g}g}�&j%rVg}|D]O}�&�&t/|����r|�'|���:|�'|���P|}tQj)|�&||��}|r|D]}t|���dSd}d}d}�&j*rtt��|rhddl+}|�,|dkr|n|�-����}|�.t_j0tb�&�%�$�*�(�'�*��|��}n�$�%�&�'�(�)�*fd+�|D��}d,}d} |D]C}!|!s�|!j2}|�dd��r|rd,}|!j3r|d(z
}|!j4s|d(z
}nd,} d}�D|tk|��z
}|r8�&j6s1�&j*r|D]}"t|"�d-����td.|�d/���|tk|��z
}|r8�&j6s1�&j*r|D]}#t|#�d0����td1|�d2���|dkr|rd,}|dkr| sd,}�&j6sc|
s|	r_|
r&td3d4�7|
���d5���|	r&td6d4�7|	���d5���td7��|rtjd(��|rtjd(��|rLtA�&j!�&j"�&j#�%��}|�$d8��tjd(��dSdS)9NrqrxFryz9Error: either specify show-config or show-files not both.r|�
settings_filer�z virtual_env dir does not exist: rz8Error: arguments passed in without any paths or content.rrrMr�rLrzrNr�rr�r��
allow_rootr~r}r�c�P�h|]#}t|�������$SrI)r�resolve)r��src_paths  rB�	<setcomp>zmain.<locals>.<setcomp>]s7��$
�$
�$
�)1�D��N�N�"�"�$�$�$
�$
�$
rDrI�)�,z: )r��
separatorsror�z,Error: can't show files for streaming input.)�input_streamrKrz�	file_path�	extension)r7�
output_streamrKrzr8r9�
raise_on_skip�/raz-it is dangerous to operate recursively on '/'z*use --allow-root to override this failsafer
z:Filename override is intended only for stream (-) sorting.)rKrLrMrNr9�config_triec3�F�K�|]}t|����������V��dS))rKrLrMrzrNr9r=N)r^)	r�rJrMrLrKr=r�rzrNs	  �������rB�	<genexpr>zmain.<locals>.<genexpr>�s`����� � ����!��!-�'�$3�(� +�	�	�	� � � � � � rDTz� was skipped as it's listed in 'skip' setting, matches a glob in 'skip_glob' setting, or is in a .gitignore file with --skip-gitignore enabled.zSkipped z filesz/ was broken path, make sure it exists correctlyzBroken z pathszPW0502: The following deprecated single dash CLI flags were used and translated: r��!zAW0501: The following deprecated CLI flags were used and ignored: zgW0500: Please see the 5.0.0 Upgrade guide: https://pycqa.github.io/isort/docs/upgrade_guides/5.0.0.htmlzNo valid encodings.)8rrr$r�poprZr[�os�path�isfile�abspath�dirname�isdirr�QUICK_GUIDE�getcwd�copyrr�json�dumps�__dict__rrrr�check_stream�sort_stream�stdoutr�write�readrrdrerfr]r��
is_skippedr�r�findrW�multiprocessing�Pool�	cpu_count�imap�	functools�partialr^r;r<r=�lenrvr�)+r�rrrxry�venvr)�config_dictr�r�r�stream_filenamer/r~�wrong_sorted_files�all_attempt_broken�no_valid_encodingsr8r7r;rgr<�broken�filtered_filesrJ�num_skipped�
num_broken�num_invalid_encodingrU�executor�attempt_iterator�
is_no_attempt�any_encoding_valid�sort_attempt�was_skipped�
was_brokenrMrLrKr=r�rzrNs+                                    @@@@@@@rB�mainrn#s2
����������4� � �I��}�}�^�$�$��
�i������!�
�
�m�U�;�;�K� �}�}�\�5�9�9�J��N�z�N���L�M�M�M��)�#�#�
�7�>�>�)�O�4�5�5�	U�)+�����?�9S�)T�)T�I�o�&�)+�����?�9S�)T�)T�I�o�&�&�)+�����?�9S�)T�)T�I�o�&��	�!�!���'��#%�7�?�?�4�#8�#8�	�-� ��w�}�}�Y�}�5�6�6�	P��N�I�m�4L�N�N�O�O�O����w��+�+�J���k��
�k�����	Q��H�O�P�P�P����i�'�'��G�O�O�Z�@�J�q�M�M�S�A�A�P�R�Y�[�[�	�/�"��w�}�}�Y��7�8�8�	U�)+�����?�9S�)T�)T�I�o�&��.�.�"�"�K��?�?�>�5�9�9�L��?�?�6�4�(�(�D��O�O�G�U�+�+�E�����U�3�3�I�!�o�o�&7��?�?�O�"���'9�5�A�A��*���/I�5�Q�Q��!�o�o�j�$�7�7�O�����t�4�4�J�����t�4�4�J�%�/�/�*?��G�G��������"&�K��L�&�{���}�c�'J�'J�K�K���k�!�!�$
�$
�5@�_�_�[�RT�5U�5U�$
�$
�$
��K� ��
"�
"�k�
"�
"�F���
�d�j����{�T_�`�`�`�a�a�a����c�U���-<�F�D��)�)�)�$�	��	E��H�C�D�D�D�$)�M�s�y�y�u���	6�%(�%5�)��#�#�$�&�&�&�"��"4���
6���!-�"%�*�!�'�'�(�"'��������
6�
6�
6��
� � ��!2�!2�!4�!4�5�5�5�5�5�
6����	�
�	�	�:�	�)��%�V�-@�&�J_�
�
�
��	�
�
�E�F�F�F��
�
�B�C�C�C���������	�-��)��1D�f�Nc����G�
�M�M�V�W�W�W��H�Q�K�K�K�������	(��N�'�
5�
5�	��$�$�T�)�_�_�5�5�5��N�N�9�-�-�-�-�"�)�)�)�4�4�4�4�'�J��Z�
�F�G�V�D�D�
��	�'�
!�
!�	��i� � � � ��F����
� ���>�	��)�����	�"�"�"�"�&�+�+�D�1�H�H�D�D�/�B[�B[�B]�B]�^�^�H�'�}�}��!� �!��!-�$3�(� +����� � ��� � � � � � � � � � �",� � � ���
�"��,�	"�	"�L��
��!-�!@���}�}�W�e�,�,�
*�1C�
*�%)�"��#�
����� �2�
*�$��)�$�$�%)�"�!�M�M��s�7�|�|�#���	2�v�|�	2��~�
�#*���K��&�4�4�4�����

�0�[�0�0�0�1�1�1��c�&�k�k�!�
��	0�f�l�	0��~�
Y�"(�Y�Y�J��J�W�W�W�X�X�X�X��.�J�.�.�.�/�/�/���>�>�m�>�!%���!�#�#�,>�#�!%���<�
�5�
�9I�
�#�	��:��9�9�5�6�6�:�:�:�
�
�
��	��2��9�9�-�.�.�2�2�2�
�
�
�	
�
K�	
�	
�	
�
������������������)��%�V�-@�&�J_�
�
�
��	�
�
�+�,�,�,����������s�#%R
�
;S	�S	�__main__)FFF)NNr@)9�__doc__r�rYrKrBrZrr��ior�pathlibr�typingrrrr	r
r�warningsrr`rrrr�
exceptionsrrr�formatr�logorr�settingsrrr�utilsr�
wrap_modesrrrHr:rYrHr^rXr�r�rrr,rnrErIrDrB�<module>r{s���Y�Y�������������	�	�	�	�
�
�
�
� � � � � � �������������=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�������/�/�/�/�/�/�/�/�/�/�/�/�D�D�D�D�D�D�D�D�D�D�+�+�+�+�+�+�������������@�@�@�@�@�@�@�@�@�@�������!�!�!�!�!�!�����:
�
�
�
�
�� 5�5�5�5�5�5�5�5���!�)�)��)��)��)��	)�
�)��
)��k��)�)�)�)�ZTX�����$,�S�M��CK�C�=��	�����V�8�2�V�V�V�V�r��X�h�s�m�,���S�#�X������D
J�c�
J�e�C��c��N�3�
J�
J�
J�
J�LP�S*�S*�
�8�C�=�
!�S*�19�-�1H�S*�	�S*�S*�S*�S*�lk�k�x���
�&�k�h�}�6M�k�Y]�k�k�k�k�\�z����D�F�F�F�F�F��rD