MCPcopy
hub / github.com/psf/black / validate_regex

Function validate_regex

src/black/__init__.py:245–253  ·  view source on GitHub ↗
(
    ctx: click.Context,
    param: click.Parameter,
    value: str | None,
)

Source from the content-addressed store, hash-verified

243
244
245def validate_regex(
246 ctx: click.Context,
247 param: click.Parameter,
248 value: str | None,
249) -> Pattern[str] | None:
250 try:
251 return re_compile_maybe_verbose(value) if value is not None else None
252 except re.error as e:
253 raise click.BadParameter(f"Not a valid regular expression: {e}") from None
254
255
256@click.command(

Callers

nothing calls this directly

Calls 1

re_compile_maybe_verboseFunction · 0.85

Tested by

no test coverage detected