Skip to content
Commit 611dc767 authored by copilot-swe-agent[bot]'s avatar copilot-swe-agent[bot]
Browse files

Extract normalize_from_import_string into _parse_utils.py



The from-import normalization block (clean up import(, backslash
continuations, newlines; split on ' import '/' cimport '; reconstruct
the canonical from X import Y, Z form) was copy-pasted almost identically
in both parse.py and identify.py.

Introduce normalize_from_import_string(import_string, cimports=None)
in _parse_utils.py. When cimports is None (parse.py path) the function
auto-detects it from the normalized string; when the caller already knows
the value (identify.py path) it can pass it explicitly.

Both parse.py and identify.py are updated to use the new helper,
removing ~15 lines of duplicated code.

Co-authored-by: default avatarDanielNoord <13665637+DanielNoord@users.noreply.github.com>
parent 11a9d4cd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment