MCPcopy Create free account
hub / github.com/ipython/ipython / utc_aware

Function utc_aware

IPython/utils/tz.py:38–43  ·  view source on GitHub ↗

decorator for adding UTC tzinfo to datetime's utcfoo methods

(unaware)

Source from the content-addressed store, hash-verified

36UTC = tzUTC()
37
38def utc_aware(unaware):
39 """decorator for adding UTC tzinfo to datetime's utcfoo methods"""
40 def utc_method(*args, **kwargs):
41 dt = unaware(*args, **kwargs)
42 return dt.replace(tzinfo=UTC)
43 return utc_method
44
45utcfromtimestamp = utc_aware(datetime.utcfromtimestamp)
46utcnow = utc_aware(datetime.utcnow)

Callers 1

tz.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected