Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed May 18, 2023
commit 6775bef6b8a430f2c388a10d832165bdc8f3358c
4 changes: 3 additions & 1 deletion mypy/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1988,7 +1988,9 @@ def check_method_override_for_base_with_name(
# If the attribute is read-only, allow covariance
pass
else:
self.msg.signature_incompatible_with_supertype(defn.name, name, base.name, context, original_type, typ)
self.msg.signature_incompatible_with_supertype(
defn.name, name, base.name, context, original_type, typ
)
return False

def bind_and_map_method(
Expand Down
18 changes: 5 additions & 13 deletions mypy/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,9 @@ def signature_incompatible_with_supertype(
target = self.override_target(name, name_in_super, supertype)
self.fail(f'Signature of "{name}" incompatible with {target}', context, code=code)

original_str, override_str = format_type_distinctly(original, override, options=self.options, bare=True)
original_str, override_str = format_type_distinctly(
original, override, options=self.options, bare=True
)

INCLUDE_DECORATOR = True # Include @classmethod and @staticmethod decorators, if any
ALLOW_DUPS = True # Allow duplicate notes, needed when signatures are duplicates
Expand All @@ -1165,12 +1167,7 @@ def signature_incompatible_with_supertype(
code=code,
)
else:
self.note(
original_str,
context,
offset=ALIGN_OFFSET + 2 * OFFSET,
code=code,
)
self.note(original_str, context, offset=ALIGN_OFFSET + 2 * OFFSET, code=code)

self.note("Subclass:", context, offset=ALIGN_OFFSET + OFFSET, code=code)
if isinstance(override, (CallableType, Overloaded)):
Expand All @@ -1183,12 +1180,7 @@ def signature_incompatible_with_supertype(
code=code,
)
else:
self.note(
override_str,
context,
offset=ALIGN_OFFSET + 2 * OFFSET,
code=code,
)
self.note(override_str, context, offset=ALIGN_OFFSET + 2 * OFFSET, code=code)

def pretty_callable_or_overload(
self,
Expand Down