Skip to content

Commit 7a1baf9

Browse files
CopilotDanielNoord
andcommitted
Fix docstring for import_type() to list all return values
Agent-Logs-Url: https://github.com/PyCQA/isort/sessions/ede8ce0d-f07c-4a61-8637-2887d3f02354 Co-authored-by: DanielNoord <13665637+DanielNoord@users.noreply.github.com>
1 parent f8871a2 commit 7a1baf9

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

isort/_parse_utils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,12 @@ def normalize_from_import_string(import_string: str) -> str:
169169
def import_type(
170170
line: str, config: Config
171171
) -> Literal["from", "straight", "lazy_from", "lazy_straight"] | None:
172-
"""If the current line is an import line it will return its type (from or straight).
172+
"""If the current line is an import line it will return its type.
173173
174-
For PEP 810 lazy imports (``lazy import X`` / ``lazy from X import Y``) the
175-
returned type is prefixed with ``"lazy_"`` so callers can distinguish them
176-
from regular (eager) imports.
174+
Possible return values are ``"straight"`` (``import X``), ``"from"``
175+
(``from X import Y``), ``"lazy_straight"`` (``lazy import X``), and
176+
``"lazy_from"`` (``lazy from X import Y``). Returns ``None`` for
177+
non-import lines or lines that should be skipped.
177178
"""
178179
if config.honor_noqa and line.lower().rstrip().endswith("noqa"):
179180
return None

0 commit comments

Comments
 (0)