-
Couldn't load subscription status.
- Fork 22
[FIX] Respect top-level conditional imports e.g. (Conditions like TYPE_CHECKING & try/except &) (CF-382) #600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PR Reviewer Guide 🔍(Review updated until commit f2e5cb2)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to f2e5cb2
Previous suggestionsSuggestions up to commit 24f2785
|
|
Persistent review updated to latest commit f2e5cb2 |
User description
example: https://github.com/mohammedahmed18/pydantic-refi-exp/pull/33/files
PR Type
Bug fix, Tests
Description
Introduce ConditionalImportCollector to track conditional imports
Update add_needed_imports_from_module to skip those imports
Refactor final module parsing to reuse parsed AST
Add test_type_checking_imports for validation
Diagram Walkthrough
File Walkthrough
code_extractor.py
Skip conditional imports in extractorcodeflash/code_utils/code_extractor.py
test_code_replacement.py
Add conditional import skipping testtests/test_code_replacement.py
PR Type
Bug fix, Tests
Description
Add ConditionalImportCollector for top-level conditionals
Skip conditional imports in add_needed_imports_from_module
Reuse parsed_dst_module for transformations
Add test_type_checking_imports for validation
Diagram Walkthrough
File Walkthrough
code_extractor.py
Skip conditional top-level importscodeflash/code_utils/code_extractor.py
test_code_replacement.py
Add test for conditional imports skippingtests/test_code_replacement.py