diff options
author | Timothy Crosley <timothy.crosley@gmail.com> | 2020-12-17 22:02:41 -0800 |
---|---|---|
committer | Timothy Crosley <timothy.crosley@gmail.com> | 2020-12-17 22:02:41 -0800 |
commit | 53ff355317901406de3544cdb943269f57eb74a1 (patch) | |
tree | 33d09d43c099778fc4aa533a7efcecc615c5eebb | |
parent | 7bd317143c36ca28860daf71eb9a65b86c57d368 (diff) | |
download | isort-53ff355317901406de3544cdb943269f57eb74a1.tar.gz |
Reformatted with black+isort
-rw-r--r-- | isort/identify.py | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/isort/identify.py b/isort/identify.py index ebb1fd3e..3e0779a0 100644 --- a/isort/identify.py +++ b/isort/identify.py @@ -27,7 +27,9 @@ class IdentifiedImport(NamedTuple): file_path: Optional[Path] = None -def imports(input_stream: TextIO, config: Config = DEFAULT_CONFIG, file_path: Optional[Path]=None) -> Iterator[IdentifiedImport]: +def imports( + input_stream: TextIO, config: Config = DEFAULT_CONFIG, file_path: Optional[Path] = None +) -> Iterator[IdentifiedImport]: """Parses a python file taking out and categorizing imports.""" in_quote = "" @@ -144,13 +146,32 @@ def imports(input_stream: TextIO, config: Config = DEFAULT_CONFIG, file_path: Op module = just_imports[as_index - 1] alias = just_imports[as_index + 1] if not (module == alias and config.remove_redundant_aliases): - yield IdentifiedImport(index, indented, module, alias, cimport=cimports, file_path=file_path,) + yield IdentifiedImport( + index, + indented, + module, + alias, + cimport=cimports, + file_path=file_path, + ) else: if type_of_import == "from": module = just_imports.pop(0) for attribute in just_imports: - yield IdentifiedImport(index, indented, module, attribute, file_path=file_path,) + yield IdentifiedImport( + index, + indented, + module, + attribute, + file_path=file_path, + ) else: for module in just_imports: - yield IdentifiedImport(index, indented, module, cimport=cimports, file_path=file_path,) + yield IdentifiedImport( + index, + indented, + module, + cimport=cimports, + file_path=file_path, + ) |