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

Function counted_compile

tests/test_version_increment.py:263–267  ·  view source on GitHub ↗

Record each pattern compilation while preserving regex behavior.

(pattern: str, flags: int = 0)

Source from the content-addressed store, hash-verified

261 original_compile = re.compile
262
263 def counted_compile(pattern: str, flags: int = 0) -> re.Pattern[str]:
264 """Record each pattern compilation while preserving regex behavior."""
265 nonlocal compile_calls
266 compile_calls += 1
267 return original_compile(pattern, flags)
268
269 monkeypatch.setattr("commitizen.version_increment.re.compile", counted_compile)
270

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected