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

Method fromordinal

Lib/_pydatetime.py:1030–1037  ·  view source on GitHub ↗

Construct a date from a proleptic Gregorian ordinal. January 1 of year 1 is day 1. Only the year, month and day are non-zero in the result.

(cls, n)

Source from the content-addressed store, hash-verified

1028
1029 @classmethod
1030 def fromordinal(cls, n):
1031 """Construct a date from a proleptic Gregorian ordinal.
1032
1033 January 1 of year 1 is day 1. Only the year, month and day are
1034 non-zero in the result.
1035 """
1036 y, m, d = _ord2ymd(n)
1037 return cls(y, m, d)
1038
1039 @classmethod
1040 def fromisoformat(cls, date_string):

Callers 5

_strptimeFunction · 0.80
__add__Method · 0.80
__add__Method · 0.80
test_extreme_ordinalsMethod · 0.80

Calls 2

_ord2ymdFunction · 0.85
clsClass · 0.50

Tested by 2

test_extreme_ordinalsMethod · 0.64