How to use the isort.settings.from_path function in isort

To help you get started, we’ve selected a few isort examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DonJayamanne / pythonVSCode / pythonFiles / isort / main.py View on Github external
def finalize_options(self):
        "Get options from config files."
        self.arguments = {}
        computed_settings = from_path(os.getcwd())
        for (key, value) in itemsview(computed_settings):
            self.arguments[key] = value
github konstellation-io / science-toolkit / vscode / extensions / ms-python.python-2020.3.69010 / pythonFiles / lib / python / isort / main.py View on Github external
if file_names == ['-']:
        try:
            # python 3
            file_ = sys.stdin.buffer
        except AttributeError:
            # python 2
            file_ = sys.stdin
        SortImports(file_=file_, write_to_stdout=True, **arguments)
    else:
        if not file_names:
            file_names = ['.']
            arguments['recursive'] = True
            if not arguments.get('apply', False):
                arguments['ask_to_apply'] = True

        config = from_path(arguments.get('settings_path', '') or os.path.abspath(file_names[0]) or os.getcwd()).copy()
        config.update(arguments)
        wrong_sorted_files = False
        skipped = []

        if config.get('filter_files'):
            filtered_files = []
            for file_name in file_names:
                if should_skip(file_name, config):
                    skipped.append(file_name)
                else:
                    filtered_files.append(file_name)
            file_names = filtered_files

        if arguments.get('recursive', False):
            file_names = iter_source_code(file_names, config, skipped)
        num_skipped = 0