MCPcopy Index your code
hub / github.com/commitizen-tools/commitizen / parse_no_raise

Function parse_no_raise

commitizen/cli.py:624–642  ·  view source on GitHub ↗

Convert the given string to exit codes. Receives digits and strings and outputs the parsed integer which represents the exit code found in exceptions.

(comma_separated_no_raise: str)

Source from the content-addressed store, hash-verified

622
623
624def parse_no_raise(comma_separated_no_raise: str) -> list[int]:
625 """Convert the given string to exit codes.
626
627 Receives digits and strings and outputs the parsed integer which
628 represents the exit code found in exceptions.
629 """
630
631 def exit_code_from_str_or_skip(s: str) -> ExitCode | None:
632 try:
633 return ExitCode.from_str(s)
634 except (KeyError, ValueError):
635 out.warn(f"WARN: no_raise value `{s}` is not a valid exit code. Skipping.")
636 return None
637
638 return [
639 code.value
640 for s in comma_separated_no_raise.split(",")
641 if (code := exit_code_from_str_or_skip(s)) is not None
642 ]
643
644
645if TYPE_CHECKING:

Callers 1

mainFunction · 0.85

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…