MCPcopy Create free account
hub / github.com/dateutil/dateutil / func

Function func

src/dateutil/parser/isoparser.py:22–35  ·  view source on GitHub ↗
(self, str_in, *args, **kwargs)

Source from the content-addressed store, hash-verified

20def _takes_ascii(f):
21 @wraps(f)
22 def func(self, str_in, *args, **kwargs):
23 # If it's a stream, read the whole thing
24 str_in = getattr(str_in, 'read', lambda: str_in)()
25
26 # If it's unicode, turn it into bytes, since ISO-8601 only covers ASCII
27 if isinstance(str_in, str):
28 # ASCII is the same in UTF-8
29 try:
30 str_in = str_in.encode('ascii')
31 except UnicodeEncodeError as e:
32 msg = 'ISO-8601 strings should contain only ASCII characters'
33 raise ValueError(msg) from e
34
35 return f(self, str_in, *args, **kwargs)
36
37 return func
38

Callers 2

_testTzFuncMethod · 0.85
_test_us_zoneMethod · 0.85

Calls

no outgoing calls

Tested by 2

_testTzFuncMethod · 0.68
_test_us_zoneMethod · 0.68