Warn if deprecated and not directly imported with a `from` statement.
(self, node: Node | None, context: Context)
| 8393 | return self.modules[typ.type.module_name].is_stub |
| 8394 | |
| 8395 | def check_deprecated(self, node: Node | None, context: Context) -> None: |
| 8396 | """Warn if deprecated and not directly imported with a `from` statement.""" |
| 8397 | if isinstance(node, Decorator): |
| 8398 | node = node.func |
| 8399 | if isinstance(node, (FuncDef, OverloadedFuncDef, TypeInfo)) and ( |
| 8400 | node.deprecated is not None |
| 8401 | ): |
| 8402 | for imp in self.tree.imports: |
| 8403 | if isinstance(imp, ImportFrom) and any(node.name == n[0] for n in imp.names): |
| 8404 | break |
| 8405 | else: |
| 8406 | self.warn_deprecated(node, context) |
| 8407 | |
| 8408 | def warn_deprecated(self, node: Node | None, context: Context) -> None: |
| 8409 | """Warn if deprecated.""" |
no test coverage detected