Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 5, 2024
1 parent 286371f commit 6f54dab
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions mypy/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -7578,7 +7578,8 @@ class that may be used later if the deprecated feature is used."""
overload = False
deprecation: str | None = None
for decorator in decorators:
if (isinstance(typ, CallableType)
if (
isinstance(typ, CallableType)
and isinstance(decorator, NameExpr)
and (decorator.fullname in OVERLOAD_NAMES)
):
Expand All @@ -7601,7 +7602,9 @@ class that may be used later if the deprecated feature is used."""
else:
typ.deprecated = f"{name} is deprecated: {deprecation}"

def check_deprecated(self, typ: CallableType | Overloaded | TypeInfo, context: Context) -> None:
def check_deprecated(
self, typ: CallableType | Overloaded | TypeInfo, context: Context
) -> None:
"""Warn if deprecated and not directly imported with a `from` statement."""
if typ.deprecated is not None:
for imp in self.tree.imports:
Expand All @@ -7610,9 +7613,7 @@ def check_deprecated(self, typ: CallableType | Overloaded | TypeInfo, context: C
else:
self.warn_deprecated(typ, context)

def warn_deprecated(
self, typ: CallableType | Overloaded | TypeInfo, context: Context
) -> None:
def warn_deprecated(self, typ: CallableType | Overloaded | TypeInfo, context: Context) -> None:
"""Warn if deprecated."""
if (deprecated := typ.deprecated) is not None:
warn = self.msg.fail if self.options.report_deprecated_as_error else self.msg.note
Expand Down

0 comments on commit 6f54dab

Please sign in to comment.