MCPcopy Index your code
hub / github.com/python/mypy / warn_deprecated

Method warn_deprecated

mypy/checker.py:8408–8422  ·  view source on GitHub ↗

Warn if deprecated.

(self, node: Node | None, context: Context)

Source from the content-addressed store, hash-verified

8406 self.warn_deprecated(node, context)
8407
8408 def warn_deprecated(self, node: Node | None, context: Context) -> None:
8409 """Warn if deprecated."""
8410 if isinstance(node, Decorator):
8411 node = node.func
8412 if (
8413 isinstance(node, (FuncDef, OverloadedFuncDef, TypeInfo))
8414 and (deprecated := node.deprecated) is not None
8415 and not self.is_typeshed_stub
8416 and not any(
8417 node.fullname == p or node.fullname.startswith(f"{p}.")
8418 for p in self.options.deprecated_calls_exclude
8419 )
8420 ):
8421 warn = self.msg.note if self.options.report_deprecated_as_note else self.msg.fail
8422 warn(deprecated, context, code=codes.DEPRECATED)
8423
8424 def new_unique_dummy_name(self, namespace: str) -> str:
8425 """Generate a name that is guaranteed to be unique for this TypeChecker instance."""

Callers 9

visit_import_fromMethod · 0.95
check_deprecatedMethod · 0.95
check_overload_callMethod · 0.45
visit_member_exprMethod · 0.45

Calls 3

isinstanceFunction · 0.85
anyFunction · 0.85
startswithMethod · 0.45

Tested by

no test coverage detected