Skip to content

Commit bce69d1

Browse files
committed
Avoid double negative
1 parent 596683b commit bce69d1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

mypy/stubtest.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -706,20 +706,20 @@ def _verify_arg_default_value(
706706
and stub_default is not ...
707707
and runtime_arg.default is not UNREPRESENTABLE
708708
):
709-
no_match = False
709+
defaults_match = True
710710
# We want the types to match exactly, e.g. in case the stub has
711711
# True and the runtime has 1 (or vice versa).
712712
if type(stub_default) is not type(runtime_arg.default):
713-
no_match = True
713+
defaults_match = False
714714
else:
715715
try:
716-
no_match = bool(stub_default != runtime_arg.default)
716+
defaults_match = bool(stub_default == runtime_arg.default)
717717
except Exception:
718718
# Exception can be raised in eq/ne dunder methods (e.g. numpy arrays)
719719
# At this point, consider the default to be different, it is probably
720720
# too complex to put in a stub anyway.
721-
no_match = True
722-
if no_match:
721+
defaults_match = False
722+
if not defaults_match:
723723
yield (
724724
f'runtime argument "{runtime_arg.name}" '
725725
f"has a default value of {runtime_arg.default!r}, "

0 commit comments

Comments
 (0)