(cls, _value: str, _check: bool = True)
| 32 | _DIGITS = frozenset("01") |
| 33 | |
| 34 | def __new__(cls, _value: str, _check: bool = True) -> BitString: |
| 35 | if isinstance(_value, BitString): |
| 36 | return _value |
| 37 | elif _check and cls._DIGITS.union(_value) > cls._DIGITS: |
| 38 | raise ValueError("BitString must only contain '0' and '1' chars") |
| 39 | else: |
| 40 | return super().__new__(cls, _value) |
| 41 | |
| 42 | @classmethod |
| 43 | def from_int(cls, value: int, length: int) -> BitString: |