MCPcopy Create free account
hub / github.com/commitizen-tools/commitizen / _resolve_files_and_regexes

Function _resolve_files_and_regexes

commitizen/bump.py:69–84  ·  view source on GitHub ↗

Resolve all distinct files with their regexp from a list of glob patterns with optional regexp

(
    patterns: Iterable[str], version: str
)

Source from the content-addressed store, hash-verified

67
68
69def _resolve_files_and_regexes(
70 patterns: Iterable[str], version: str
71) -> Generator[tuple[str, re.Pattern], None, None]:
72 """
73 Resolve all distinct files with their regexp from a list of glob patterns with optional regexp
74 """
75 filepath_set: set[tuple[str, str]] = set()
76 for pattern in patterns:
77 drive, tail = os.path.splitdrive(pattern)
78 path, _, regex = tail.partition(":")
79 filepath = drive + path
80 regex = regex or re.escape(version)
81
82 filepath_set.update((path, regex) for path in iglob(filepath))
83
84 return ((path, re.compile(regex)) for path, regex in sorted(filepath_set))
85
86
87def create_commit_message(

Callers 1

update_version_in_filesFunction · 0.85

Calls 1

updateMethod · 0.80

Tested by

no test coverage detected