erg/crates/erg_compiler/lib/pystd/datetime.d.er
2023-03-11 14:21:15 +09:00

65 lines
2.8 KiB
Python

time = pyimport "time"
.MINYEAR: {1}
.MAXYEAR: {9999}
.TimeDelta = 'timedelta': ClassType
.TimeDelta.
__call__: (days := Nat, seconds := Nat, microseconds := Nat, milliseconds := Nat, minutes := Nat, hours := Nat, weeks := Nat) -> .TimeDelta
min: .TimeDelta
max: .TimeDelta
resolution: .TimeDelta
total_seconds: (self: .TimeDelta) -> Float
.Date = 'date': ClassType
.Date.
__call__: (year: Nat, month: Nat, day: Nat) -> .Date
fromtimestamp: (timestamp: Float) -> .Date
fromordinal: (ordinal: Nat) -> .Date
fromisoformat: (date_string: Str) -> .Date
fromisocalendar: (year: Nat, week: Nat, day: Nat) -> .Date
replace: (self: .Date, year := Nat, month := Nat, day := Nat) -> .Date
timetuple: (self: .Date) -> time.StructTime
toordinal: (self: .Date) -> Nat
weekday: (self: .Date) -> 0..6
isoweekday: (self: .Date) -> 1..7
isocalendar: (self: .Date) -> {year = Nat; week = Nat; weekday = 1..7}
isoformat: (self: .Date) -> Str
strftime: (self: .Date, format: Str) -> Str
'''
Current date or datetime: same as `self.__class__.fromtimestamp(time.time())`.
'''
today!: () => .Date
min: .Date
max: .Date
resolution: .TimeDelta
.TZInfo = 'tzinfo': ClassType
.Time = 'time': ClassType
.Time.
__call__: (hour: Nat, minute: Nat, second := Nat, microsecond := Nat, tzinfo := .TZInfo or NoneType) -> .Time
min: .Time
max: .Time
resolution: .TimeDelta
fromisoformat: (time_string: Str) -> .Time
replace: (self: .Time, hour := Nat, minute := Nat, second := Nat, microsecond := Nat, tzinfo := .TZInfo or NoneType) -> .Time
isoformat: (self: .Time, timespec := Str) -> Str
.DateTime = 'datetime': ClassType
.DateTime.
__call__: (year: Nat, month: Nat, day: Nat, hour := Nat, minute := Nat, second := Nat, microsecond := Nat, tzinfo := .TZInfo or NoneType) -> .DateTime
today!: () => .DateTime
now!: (tz := .TZInfo or NoneType) => .DateTime
utcnow!: () => .DateTime
fromtimestamp: (timestamp: Float, tz := .TZInfo or NoneType) -> .DateTime
utcfromtimestamp: (timestamp: Float) -> .DateTime
fromordinal: (ordinal: Nat) -> .DateTime
combine: (date: .Date, time: .Time, tzinfo := .TZInfo or NoneType) -> .DateTime
fromisoformat: (date_string: Str) -> .DateTime
fromisocalendar: (year: Nat, week: Nat, day: Nat) -> .DateTime
strptime: (date_string: Str, format: Str) -> .DateTime
min: .DateTime
max: .DateTime
resolution: .TimeDelta
date: (self: .DateTime) -> .Date
time: (self: .DateTime) -> .Time
replace: (self: .DateTime, year := Nat, month := Nat, day := Nat, hour := Nat, minute := Nat, second := Nat, microsecond := Nat, tzinfo := .TZInfo or NoneType) -> .DateTime
utcoffset: (self: .DateTime) -> .TimeDelta or NoneType
.TimeZone = 'timezone': ClassType