Construct a time from a string in one of the ISO 8601 formats.
(cls, time_string)
| 1532 | |
| 1533 | @classmethod |
| 1534 | def fromisoformat(cls, time_string): |
| 1535 | """Construct a time from a string in one of the ISO 8601 formats.""" |
| 1536 | if not isinstance(time_string, str): |
| 1537 | raise TypeError('fromisoformat: argument must be str') |
| 1538 | |
| 1539 | # The spec actually requires that time-only ISO 8601 strings start with |
| 1540 | # T, but the extended format allows this to be omitted as long as there |
| 1541 | # is no ambiguity with date strings. |
| 1542 | time_string = time_string.removeprefix('T') |
| 1543 | |
| 1544 | try: |
| 1545 | return cls(*_parse_isoformat_time(time_string)) |
| 1546 | except Exception: |
| 1547 | raise ValueError(f'Invalid isoformat string: {time_string!r}') |
| 1548 | |
| 1549 | |
| 1550 | def strftime(self, fmt): |
nothing calls this directly
no test coverage detected