Skip to content
Merged
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
stubtest: make the --ignore-disjoint-bases hack less inconsistent
  • Loading branch information
jorenham committed Aug 27, 2025
commit 1abe75e9f69669b2aaa2d008cc7bb971c3df39fb
14 changes: 9 additions & 5 deletions mypy/stubtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ def is_positional_only_related(self) -> bool:
# TODO: This is hacky, use error codes or something more resilient
return "should be positional" in self.message

def is_disjoint_base_related(self) -> bool:
"""Whether or not the error is related to @disjoint_base."""
# TODO: This is hacky, use error codes or something more resilient
return "@disjoint_base" in self.message

def get_description(self, concise: bool = False) -> str:
"""Returns a description of the error.

Expand Down Expand Up @@ -630,11 +635,7 @@ def verify_typeinfo(
return

yield from _verify_final(stub, runtime, object_path)

# TODO: Once PEP 800 gets accepted, remove the conditional (always verify)
if "--ignore-disjoint-bases" not in sys.argv[1:]:
yield from _verify_disjoint_base(stub, runtime, object_path)

yield from _verify_disjoint_base(stub, runtime, object_path)
is_runtime_typeddict = stub.typeddict_type is not None and is_typeddict(runtime)
yield from _verify_metaclass(
stub, runtime, object_path, is_runtime_typeddict=is_runtime_typeddict
Expand Down Expand Up @@ -2185,6 +2186,7 @@ class _Arguments:
concise: bool
ignore_missing_stub: bool
ignore_positional_only: bool
ignore_disjoint_bases: bool
allowlist: list[str]
generate_allowlist: bool
ignore_unused_allowlist: bool
Expand Down Expand Up @@ -2278,6 +2280,8 @@ def warning_callback(msg: str) -> None:
continue
if args.ignore_positional_only and error.is_positional_only_related():
continue
if args.ignore_disjoint_bases and error.is_disjoint_base_related():
continue
if error.object_desc in allowlist:
allowlist[error.object_desc] = True
continue
Expand Down
Loading