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

Method compile_glob

mypy/options.py:639–647  ·  view source on GitHub ↗
(self, s: str)

Source from the content-addressed store, hash-verified

637 return self._unused_configs.copy()
638
639 def compile_glob(self, s: str) -> Pattern[str]:
640 # Compile one of the glob patterns to a regex so that '.*' can
641 # match *zero or more* module sections. This means we compile
642 # '.*' into '(\..*)?'.
643 parts = s.split(".")
644 expr = re.escape(parts[0]) if parts[0] != "*" else ".*"
645 for part in parts[1:]:
646 expr += re.escape("." + part) if part != "*" else r"(\..*)?"
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.

Callers 1

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected