MCPcopy Index your code
hub / github.com/RustPython/RustPython / _date_from_string

Function _date_from_string

Lib/plistlib.py:146–157  ·  view source on GitHub ↗
(s, aware_datetime)

Source from the content-addressed store, hash-verified

144
145
146def _date_from_string(s, aware_datetime):
147 order = ('year', 'month', 'day', 'hour', 'minute', 'second')
148 gd = _dateParser.match(s).groupdict()
149 lst = []
150 for key in order:
151 val = gd[key]
152 if val is None:
153 break
154 lst.append(int(val))
155 if aware_datetime:
156 return datetime.datetime(*lst, tzinfo=datetime.UTC)
157 return datetime.datetime(*lst)
158
159
160def _date_to_string(d, aware_datetime):

Callers 1

end_dateMethod · 0.85

Calls 4

groupdictMethod · 0.80
datetimeMethod · 0.80
matchMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected