Convert external increment input into a known increment. This lenient path is used for inputs such as CLI arguments where an unknown string should behave like "no increment" instead of raising. Matched ``bump_map`` values are validated separately so custom rules keep
(cls, value: object)
| 48 | |
| 49 | @classmethod |
| 50 | def from_value(cls, value: object) -> VersionIncrement: |
| 51 | """Convert external increment input into a known increment. |
| 52 | |
| 53 | This lenient path is used for inputs such as CLI arguments where an |
| 54 | unknown string should behave like "no increment" instead of raising. |
| 55 | Matched ``bump_map`` values are validated separately so custom rules keep |
| 56 | their historical fail-fast behavior. |
| 57 | """ |
| 58 | if not isinstance(value, str): |
| 59 | return VersionIncrement.NONE |
| 60 | try: |
| 61 | return cls[value] |
| 62 | except KeyError: |
| 63 | return VersionIncrement.NONE |
| 64 | |
| 65 | @classmethod |
| 66 | def _compile_pattern(cls, regex: RegexPattern) -> re.Pattern[str]: |
no outgoing calls