-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support imports using
importlib.import_module
(#782)
* test: add coverage for dynamic import with importlib * style: lint * feat(WIP): attempt to get importlib imports * test: add test coverage for both importlib formats * feat: also handle case where importlib.import_module is aliased * refactor: consolidate proof of concept test into existing test * refactor(clippy): collapse nested `if let` statements in `Stmt::Expr` match arm * docs: note which sorts of `importlib` import are supported * test: check nested packages with import_module resolve to the top level package (e.g. `http.server` -> `http`) * test: test coverage for aliased import (not being collected) * fix: working import alias coverage * feat: full import path so importlib aliases are acknowledged too * docs: Clarify cases where `importlib.import_module` usage is/is not detected * docs: docstring for `ImportVisitor` explaining what `import_module_names` is * refactor: split long match statement arms into new functions with docstrings (`handle_import`, `handle_import_from`, `handle_expr`) * style(consistency): Add language hint to code block in docs/usage.md Co-authored-by: Mathieu Kniewallner <mathieu.kniewallner@gmail.com> * docs: Link to importlib stdlib docs URL in docs/usage.md Co-authored-by: Mathieu Kniewallner <mathieu.kniewallner@gmail.com> * fix(consistency): Use full language hint on code block in docs/usage.md Co-authored-by: Mathieu Kniewallner <mathieu.kniewallner@gmail.com> * fix(typo): No capitalisation in sentence punctuated by code block in docs/usage.md Co-authored-by: Mathieu Kniewallner <mathieu.kniewallner@gmail.com> * fix(typo): wrong type names used in refactored function --------- Co-authored-by: Mathieu Kniewallner <mathieu.kniewallner@gmail.com>
- Loading branch information
1 parent
355292c
commit 722313a
Showing
4 changed files
with
159 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters