mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 11:59:10 +00:00
![]() ## Summary We have some code to ensure that if an aliased import is used, any submodules should be marked as used too. This comment says it best: ```rust // If the name of a submodule import is the same as an alias of another import, and the // alias is used, then the submodule import should be marked as used too. // // For example, mark `pyarrow.csv` as used in: // // ```python // import pyarrow as pa // import pyarrow.csv // print(pa.csv.read_csv("test.csv")) // ``` ``` However, it looks like when we go to look up `pyarrow` (of `import pyarrow as pa`), we aren't checking to ensure the resolved binding is _actually_ an import. This was causing us to attribute `print(rm.ANY)` to `def requests_mock` here: ```python import requests_mock as rm def requests_mock(requests_mock: rm.Mocker): print(rm.ANY) ``` Closes https://github.com/astral-sh/ruff/issues/6180. |
||
---|---|---|
.. | ||
flake8_to_ruff | ||
ruff | ||
ruff_benchmark | ||
ruff_cache | ||
ruff_cli | ||
ruff_dev | ||
ruff_diagnostics | ||
ruff_formatter | ||
ruff_index | ||
ruff_macros | ||
ruff_python_ast | ||
ruff_python_codegen | ||
ruff_python_formatter | ||
ruff_python_index | ||
ruff_python_literal | ||
ruff_python_parser | ||
ruff_python_resolver | ||
ruff_python_semantic | ||
ruff_python_stdlib | ||
ruff_python_trivia | ||
ruff_shrinking | ||
ruff_source_file | ||
ruff_text_size | ||
ruff_wasm |