mirror of https://github.com/astral-sh/ruff
Ignore relative imports in `banned-api` rules (#4024)
This commit is contained in:
parent
13fda30051
commit
c4cda301aa
|
|
@ -31,3 +31,6 @@ typing.TypedDict.anything()
|
|||
# import aliases are resolved
|
||||
import typing as totally_not_typing
|
||||
totally_not_typing.TypedDict
|
||||
|
||||
# relative imports are respected
|
||||
from .typing import TypedDict
|
||||
|
|
|
|||
|
|
@ -1155,6 +1155,7 @@ where
|
|||
}
|
||||
|
||||
if self.settings.rules.enabled(Rule::BannedApi) {
|
||||
if level.map_or(true, |level| level == 0) {
|
||||
if let Some(module) = module {
|
||||
for name in names {
|
||||
flake8_tidy_imports::banned_api::name_is_banned(self, module, name);
|
||||
|
|
@ -1164,6 +1165,7 @@ where
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if self
|
||||
.settings
|
||||
|
|
|
|||
|
|
@ -113,6 +113,8 @@ TID251.py:33:1: TID251 `typing.TypedDict` is banned: Use typing_extensions.Typed
|
|||
34 | import typing as totally_not_typing
|
||||
35 | totally_not_typing.TypedDict
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TID251
|
||||
36 |
|
||||
37 | # relative imports are respected
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue