MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / fromisoformat

Method fromisoformat

tools/python-3.11.9-amd64/Lib/datetime.py:1534–1547  ·  view source on GitHub ↗

Construct a time from a string in one of the ISO 8601 formats.

(cls, time_string)

Source from the content-addressed store, hash-verified

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):

Callers

nothing calls this directly

Calls 2

_parse_isoformat_timeFunction · 0.85
removeprefixMethod · 0.80

Tested by

no test coverage detected