MCPcopy Index your code
hub / github.com/python/cpython / time

Class time

Lib/_pydatetime.py:1399–1772  ·  view source on GitHub ↗

Time with time zone. Constructors: __new__() strptime() Operators: __repr__, __str__ __eq__, __le__, __lt__, __ge__, __gt__, __hash__ Methods: strftime() isoformat() utcoffset() tzname() dst() Properties (readonly): hour, minute, second,

Source from the content-addressed store, hash-verified

1397_tzinfo_class = tzinfo
1398
1399class time:
1400 """Time with time zone.
1401
1402 Constructors:
1403
1404 __new__()
1405 strptime()
1406
1407 Operators:
1408
1409 __repr__, __str__
1410 __eq__, __le__, __lt__, __ge__, __gt__, __hash__
1411
1412 Methods:
1413
1414 strftime()
1415 isoformat()
1416 utcoffset()
1417 tzname()
1418 dst()
1419
1420 Properties (readonly):
1421 hour, minute, second, microsecond, tzinfo, fold
1422 """
1423 __slots__ = '_hour', '_minute', '_second', '_microsecond', '_tzinfo', '_hashcode', '_fold'
1424
1425 def __new__(cls, hour=0, minute=0, second=0, microsecond=0, tzinfo=None, *, fold=0):
1426 """Constructor.
1427
1428 Arguments:
1429
1430 hour, minute (required)
1431 second, microsecond (default to zero)
1432 tzinfo (default to None)
1433 fold (keyword only, default to zero)
1434 """
1435 if (isinstance(hour, (bytes, str)) and len(hour) == 6 and
1436 ord(hour[0:1])&0x7F < 24):
1437 # Pickle support
1438 if isinstance(hour, str):
1439 try:
1440 hour = hour.encode('latin1')
1441 except UnicodeEncodeError:
1442 # More informative error message.
1443 raise ValueError(
1444 "Failed to encode latin1 string when unpickling "
1445 "a time object. "
1446 "pickle.load(data, encoding='latin1') is assumed.")
1447 self = object.__new__(cls)
1448 self.__setstate(hour, minute or None)
1449 self._hashcode = -1
1450 return self
1451 hour, minute, second, microsecond, fold = _check_time_fields(
1452 hour, minute, second, microsecond, fold)
1453 _check_tzinfo_arg(tzinfo)
1454 self = object.__new__(cls)
1455 self._hour = hour
1456 self._minute = minute

Callers 15

__init__Method · 0.90
writeMethod · 0.90
handle_requestMethod · 0.90
putMethod · 0.90
getMethod · 0.90
_getdateFunction · 0.90
setUpMethod · 0.90
assert_logMethod · 0.90
test_rate_limitMethod · 0.90
test_extractMethod · 0.90
test_combineMethod · 0.90

Calls

no outgoing calls

Tested by 15

setUpMethod · 0.72
assert_logMethod · 0.72
test_rate_limitMethod · 0.72
test_extractMethod · 0.72
test_combineMethod · 0.72
test_zonesMethod · 0.72
test_combineMethod · 0.72
test_extractMethod · 0.72
test_extra_attributesMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…