MCPcopy
hub / github.com/python/mypy / select_options_affecting_cache

Method select_options_affecting_cache

mypy/options.py:649–663  ·  view source on GitHub ↗

Return (platform, [values...]) for options that affect the cache. The list contains values for OPTIONS_AFFECTING_CACHE_NO_PLATFORM in sorted attribute name order. Keys are omitted since the cache is invalidated when the mypy version changes, and keys are constant on

(self)

Source from the content-addressed store, hash-verified

647 return re.compile(expr + "\\Z")
648
649 def select_options_affecting_cache(self) -> tuple[str, list[object]]:
650 """Return (platform, [values...]) for options that affect the cache.
651
652 The list contains values for OPTIONS_AFFECTING_CACHE_NO_PLATFORM
653 in sorted attribute name order. Keys are omitted since the cache
654 is invalidated when the mypy version changes, and keys are constant
655 on any specific mypy version.
656 """
657 result: list[object] = []
658 for opt in OPTIONS_AFFECTING_CACHE_NO_PLATFORM:
659 val = getattr(self, opt)
660 if opt in ("disabled_error_codes", "enabled_error_codes"):
661 val = sorted([code.code for code in val])
662 result.append(val)
663 return self.platform, result
664
665 def dep_import_options(self) -> bytes:
666 """Return opaque bytes with options that can affect dependent modules as well.

Callers 1

options_snapshotFunction · 0.80

Calls 3

getattrFunction · 0.85
sortedFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected