erg/crates/erg_compiler/lib/pystd/datetime.d.er
2024-03-29 12:40:30 +09:00

112 lines
4.6 KiB
Python

{StructTime;} = pyimport "time"
.MINYEAR: {1}
.MAXYEAR: {9999}
.UTC: .TimeZone
.TimeDelta = 'timedelta': ClassType
.TimeDelta <: Eq
.TimeDelta <: Hash
.TimeDelta <: Ord
.TimeDelta.
__call__: (days := Nat, seconds := Nat, microseconds := Nat, milliseconds := Nat, minutes := Nat, hours := Nat, weeks := Nat) -> .TimeDelta
__eq__: (self: .TimeDelta, other: .TimeDelta) -> Bool
__ne__: (self: .TimeDelta, other: .TimeDelta) -> Bool
__lt__: (self: .TimeDelta, other: .TimeDelta) -> Bool
__le__: (self: .TimeDelta, other: .TimeDelta) -> Bool
__gt__: (self: .TimeDelta, other: .TimeDelta) -> Bool
__ge__: (self: .TimeDelta, other: .TimeDelta) -> Bool
min: .TimeDelta
max: .TimeDelta
resolution: .TimeDelta
total_seconds: (self: .TimeDelta) -> Float
.Date = 'date': ClassType
.Date <: Eq
.Date <: Hash
.Date <: Ord
.Date.
__call__: (year: Nat, month: Nat, day: Nat) -> .Date
__eq__: (self: .Date, other: .Date) -> Bool
__ne__: (self: .Date, other: .Date) -> Bool
__lt__: (self: .Date, other: .Date) -> Bool
__le__: (self: .Date, other: .Date) -> Bool
__gt__: (self: .Date, other: .Date) -> Bool
__ge__: (self: .Date, other: .Date) -> Bool
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) -> 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
.TZInfo <: Eq
.TZInfo <: Hash
.TZInfo <: Ord
.Time = 'time': ClassType
.Time <: Eq
.Time <: Hash
.Time <: Ord
.Time.
__call__: (hour: 0..23, minute: 0..59, second := 0..59, microsecond := Nat, tzinfo := .TZInfo or NoneType) -> .Time
__eq__: (self: .Time, other: .Time) -> Bool
__ne__: (self: .Time, other: .Time) -> Bool
__lt__: (self: .Time, other: .Time) -> Bool
__le__: (self: .Time, other: .Time) -> Bool
__gt__: (self: .Time, other: .Time) -> Bool
__ge__: (self: .Time, other: .Time) -> Bool
min: .Time
max: .Time
resolution: .TimeDelta
fromisoformat: (time_string: Str) -> .Time
replace: (self: .Time, hour := 0..23, minute := 0..59, second := 0..59, microsecond := Nat, tzinfo := .TZInfo or NoneType) -> .Time
isoformat: (self: .Time, timespec := Str) -> Str
.DateTime = 'datetime': ClassType
.DateTime <: .Date
.DateTime.
__call__: (year: 0..9999, month: 1..12, day: 1..31, hour := 0..23, minute := 0..59, second := 0..59, microsecond := Nat, tzinfo := .TZInfo or NoneType) -> .DateTime
__eq__: (self: .DateTime, other: .DateTime) -> Bool
__ne__: (self: .DateTime, other: .DateTime) -> Bool
__lt__: (self: .DateTime, other: .DateTime) -> Bool
__le__: (self: .DateTime, other: .DateTime) -> Bool
__gt__: (self: .DateTime, other: .DateTime) -> Bool
__ge__: (self: .DateTime, other: .DateTime) -> Bool
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 := 0..9999, month := 1..12, day := 1..31, hour := 0..23, minute := 0..59, second := 0..59, microsecond := Nat, tzinfo := .TZInfo or NoneType) -> .DateTime
utcoffset: (self: .DateTime) -> .TimeDelta or NoneType
.TimeZone = 'timezone': ClassType
.TimeZone <: .TZInfo
.TimeZone.
utc: .TimeZone
__eq__: (self: .TimeZone, other: .TimeZone) -> Bool
__ne__: (self: .TimeZone, other: .TimeZone) -> Bool
__lt__: (self: .TimeZone, other: .TimeZone) -> Bool
__le__: (self: .TimeZone, other: .TimeZone) -> Bool
__gt__: (self: .TimeZone, other: .TimeZone) -> Bool
__ge__: (self: .TimeZone, other: .TimeZone) -> Bool