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

Function func

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

Source from the content-addressed store, hash-verified

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

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