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

Method compare_stable

mypy/options.py:539–548  ·  view source on GitHub ↗

Compare options in a way that is stable for snapshot() -> apply_changes() roundtrip. This is needed because apply_changes() has non-trivial effects for some flags, so Options().apply_changes(options.snapshot()) may result in a (slightly) different object.

(self, other_snapshot: dict[str, object])

Source from the content-addressed store, hash-verified

537 return new_options
538
539 def compare_stable(self, other_snapshot: dict[str, object]) -> bool:
540 """Compare options in a way that is stable for snapshot() -> apply_changes() roundtrip.
541
542 This is needed because apply_changes() has non-trivial effects for some flags, so
543 Options().apply_changes(options.snapshot()) may result in a (slightly) different object.
544 """
545 return (
546 Options().apply_changes(self.snapshot()).snapshot()
547 == Options().apply_changes(other_snapshot).snapshot()
548 )
549
550 def build_per_module_cache(self) -> None:
551 self._per_module_cache = {}

Callers 1

cmd_runMethod · 0.80

Calls 3

snapshotMethod · 0.95
apply_changesMethod · 0.80
OptionsClass · 0.70

Tested by

no test coverage detected