Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
parser.add_argument('-sp', '--settings-path', dest="settings_path",
help='Explicitly set the settings path instead of auto determining based on file location.')
parser.add_argument('-t', '--top', help='Force specific imports to the top of their appropriate section.',
dest='force_to_top', action='append')
parser.add_argument('-tc', '--trailing-comma', dest='include_trailing_comma', action='store_true',
help='Includes a trailing comma on multi line imports that include parentheses.')
parser.add_argument('-up', '--use-parentheses', dest='use_parentheses', action='store_true',
help='Use parenthesis for line continuation on length limit instead of slashes.')
parser.add_argument('-v', '--version', action='store_true', dest='show_version')
parser.add_argument('-vb', '--verbose', action='store_true', dest="verbose",
help='Shows verbose output, such as when files are skipped or when a check is successful.')
parser.add_argument('--virtual-env', dest='virtual_env',
help='Virtual environment to use for determining whether a package is third-party')
parser.add_argument('--conda-env', dest='conda_env',
help='Conda environment to use for determining whether a package is third-party')
parser.add_argument('-vn', '--version-number', action='version', version=__version__,
help='Returns just the current version number without the logo')
parser.add_argument('-w', '--line-width', help='The max length of an import line (used for wrapping long imports).',
dest='line_length', type=int)
parser.add_argument('-wl', '--wrap-length', dest='wrap_length',
help="Specifies how long lines that are wrapped should be, if not set line_length is used.")
parser.add_argument('-ws', '--ignore-whitespace', action='store_true', dest="ignore_whitespace",
help='Tells isort to ignore whitespace differences when --check-only is being used.')
parser.add_argument('-y', '--apply', dest='apply', action='store_true',
help='Tells isort to apply changes recursively without asking')
parser.add_argument('--unsafe', dest='unsafe', action='store_true',
help='Tells isort to look for files in standard library directories, etc. '
'where it may not be safe to operate in')
parser.add_argument('--case-sensitive', dest='case_sensitive', action='store_true',
help='Tells isort to include casing when sorting module names')
parser.add_argument('--filter-files', dest='filter_files', action='store_true',
help='Tells isort to filter files even when they are explicitly passed in as part of the command')
` ``..-..` ``...`.`` ` ```` ``-ssso```
.s:-y- .+osssssso/. ./ossss+:so+:` :+o-`/osso:+sssssssso/
.s::y- osss+.``.`` -ssss+-.`-ossso` ssssso/::..::+ssss:::.
.s::y- /ssss+//:-.` `ssss+ `ssss+ sssso` :ssss`
.s::y- `-/+oossssso/ `ssss/ sssso ssss/ :ssss`
.y-/y- ````:ssss` ossso. :ssss: ssss/ :ssss.
`/so:` `-//::/osss+ `+ssss+-/ossso: /sso- `osssso/.
\/ `-/oooo++/- .:/++:/++/-` .. `://++/.
isort your Python imports for you so you don't have to
VERSION {0}
\########################################################################/
""".format(__version__)
def iter_source_code(paths, config, skipped):
"""Iterate over all Python source files defined in paths."""
for path in paths:
if os.path.isdir(path):
if should_skip(path, config, os.getcwd()):
skipped.append(path)
continue
for dirpath, dirnames, filenames in os.walk(path, topdown=True):
for dirname in list(dirnames):
if should_skip(dirname, config, dirpath):
skipped.append(dirname)
dirnames.remove(dirname)
for filename in filenames:
)
parser.add_argument(
"--virtual-env",
dest="virtual_env",
help="Virtual environment to use for determining whether a package is third-party",
)
parser.add_argument(
"--conda-env",
dest="conda_env",
help="Conda environment to use for determining whether a package is third-party",
)
parser.add_argument(
"--vn",
"--version-number",
action="version",
version=__version__,
help="Returns just the current version number without the logo",
)
parser.add_argument(
"-w",
"--line-width",
help="The max length of an import line (used for wrapping long imports).",
dest="line_length",
type=int,
)
parser.add_argument(
"--wl",
"--wrap-length",
dest="wrap_length",
type=int,
help="Specifies how long lines that are wrapped should be, if not set line_length is used.",
)
` ``..-..` ``...`.`` ` ```` ``-ssso```
.s:-y- .+osssssso/. ./ossss+:so+:` :+o-`/osso:+sssssssso/
.s::y- osss+.``.`` -ssss+-.`-ossso` ssssso/::..::+ssss:::.
.s::y- /ssss+//:-.` `ssss+ `ssss+ sssso` :ssss`
.s::y- `-/+oossssso/ `ssss/ sssso ssss/ :ssss`
.y-/y- ````:ssss` ossso. :ssss: ssss/ :ssss.
`/so:` `-//::/osss+ `+ssss+-/ossso: /sso- `osssso/.
\/ `-/oooo++/- .:/++:/++/-` .. `://++/.
isort your Python imports for you so you don't have to
VERSION {0}
\########################################################################/
""".format(__version__)
shebang_re = re.compile(br'^#!.*\bpython[23w]?\b')
def is_python_file(path):
_root, ext = os.path.splitext(path)
if ext in ('.py', '.pyi'):
return True
if ext in ('.pex', ):
return False
# Skip editor backup files.
if path.endswith('~'):
return False
try: