-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathcalendar.pyi
More file actions
210 lines (189 loc) · 7.27 KB
/
calendar.pyi
File metadata and controls
210 lines (189 loc) · 7.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
import datetime
import enum
import sys
from _typeshed import Unused
from collections.abc import Iterable, Sequence
from time import struct_time
from typing import ClassVar, Final
from typing_extensions import TypeAlias
__all__ = [
"IllegalMonthError",
"IllegalWeekdayError",
"setfirstweekday",
"firstweekday",
"isleap",
"leapdays",
"weekday",
"monthrange",
"monthcalendar",
"prmonth",
"month",
"prcal",
"calendar",
"timegm",
"month_name",
"month_abbr",
"day_name",
"day_abbr",
"Calendar",
"TextCalendar",
"HTMLCalendar",
"LocaleTextCalendar",
"LocaleHTMLCalendar",
"weekheader",
]
if sys.version_info >= (3, 10):
__all__ += ["FRIDAY", "MONDAY", "SATURDAY", "SUNDAY", "THURSDAY", "TUESDAY", "WEDNESDAY"]
if sys.version_info >= (3, 12):
__all__ += [
"Day",
"Month",
"JANUARY",
"FEBRUARY",
"MARCH",
"APRIL",
"MAY",
"JUNE",
"JULY",
"AUGUST",
"SEPTEMBER",
"OCTOBER",
"NOVEMBER",
"DECEMBER",
]
_LocaleType: TypeAlias = tuple[str | None, str | None]
class IllegalMonthError(ValueError, IndexError):
month: int
def __init__(self, month: int) -> None: ...
class IllegalWeekdayError(ValueError):
weekday: int
def __init__(self, weekday: int) -> None: ...
def isleap(year: int) -> bool: ...
def leapdays(y1: int, y2: int) -> int: ...
def weekday(year: int, month: int, day: int) -> int: ...
def monthrange(year: int, month: int) -> tuple[int, int]: ...
class Calendar:
firstweekday: int
def __init__(self, firstweekday: int = 0) -> None: ...
def getfirstweekday(self) -> int: ...
def setfirstweekday(self, firstweekday: int) -> None: ...
def iterweekdays(self) -> Iterable[int]: ...
def itermonthdates(self, year: int, month: int) -> Iterable[datetime.date]: ...
def itermonthdays2(self, year: int, month: int) -> Iterable[tuple[int, int]]: ...
def itermonthdays(self, year: int, month: int) -> Iterable[int]: ...
def monthdatescalendar(self, year: int, month: int) -> list[list[datetime.date]]: ...
def monthdays2calendar(self, year: int, month: int) -> list[list[tuple[int, int]]]: ...
def monthdayscalendar(self, year: int, month: int) -> list[list[int]]: ...
def yeardatescalendar(self, year: int, width: int = 3) -> list[list[list[list[datetime.date]]]]: ...
def yeardays2calendar(self, year: int, width: int = 3) -> list[list[list[list[tuple[int, int]]]]]: ...
def yeardayscalendar(self, year: int, width: int = 3) -> list[list[list[list[int]]]]: ...
def itermonthdays3(self, year: int, month: int) -> Iterable[tuple[int, int, int]]: ...
def itermonthdays4(self, year: int, month: int) -> Iterable[tuple[int, int, int, int]]: ...
class TextCalendar(Calendar):
def prweek(self, theweek: Iterable[tuple[int, int]], width: int) -> None: ...
def formatday(self, day: int, weekday: int, width: int) -> str: ...
def formatweek(self, theweek: Iterable[tuple[int, int]], width: int) -> str: ...
def formatweekday(self, day: int, width: int) -> str: ...
def formatweekheader(self, width: int) -> str: ...
def formatmonthname(self, theyear: int, themonth: int, width: int, withyear: bool = True) -> str: ...
def prmonth(self, theyear: int, themonth: int, w: int = 0, l: int = 0) -> None: ...
def formatmonth(self, theyear: int, themonth: int, w: int = 0, l: int = 0) -> str: ...
def formatyear(self, theyear: int, w: int = 2, l: int = 1, c: int = 6, m: int = 3) -> str: ...
def pryear(self, theyear: int, w: int = 0, l: int = 0, c: int = 6, m: int = 3) -> None: ...
def firstweekday() -> int: ...
def monthcalendar(year: int, month: int) -> list[list[int]]: ...
def prweek(theweek: int, width: int) -> None: ...
def week(theweek: int, width: int) -> str: ...
def weekheader(width: int) -> str: ...
def prmonth(theyear: int, themonth: int, w: int = 0, l: int = 0) -> None: ...
def month(theyear: int, themonth: int, w: int = 0, l: int = 0) -> str: ...
def calendar(theyear: int, w: int = 2, l: int = 1, c: int = 6, m: int = 3) -> str: ...
def prcal(theyear: int, w: int = 0, l: int = 0, c: int = 6, m: int = 3) -> None: ...
class HTMLCalendar(Calendar):
cssclasses: ClassVar[list[str]]
cssclass_noday: ClassVar[str]
cssclasses_weekday_head: ClassVar[list[str]]
cssclass_month_head: ClassVar[str]
cssclass_month: ClassVar[str]
cssclass_year: ClassVar[str]
cssclass_year_head: ClassVar[str]
def formatday(self, day: int, weekday: int) -> str: ...
def formatweek(self, theweek: int) -> str: ...
def formatweekday(self, day: int) -> str: ...
def formatweekheader(self) -> str: ...
def formatmonthname(self, theyear: int, themonth: int, withyear: bool = True) -> str: ...
def formatmonth(self, theyear: int, themonth: int, withyear: bool = True) -> str: ...
def formatyear(self, theyear: int, width: int = 3) -> str: ...
def formatyearpage(
self, theyear: int, width: int = 3, css: str | None = "calendar.css", encoding: str | None = None
) -> bytes: ...
class different_locale:
def __init__(self, locale: _LocaleType) -> None: ...
def __enter__(self) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
class LocaleTextCalendar(TextCalendar):
def __init__(self, firstweekday: int = 0, locale: _LocaleType | None = None) -> None: ...
class LocaleHTMLCalendar(HTMLCalendar):
def __init__(self, firstweekday: int = 0, locale: _LocaleType | None = None) -> None: ...
def formatweekday(self, day: int) -> str: ...
def formatmonthname(self, theyear: int, themonth: int, withyear: bool = True) -> str: ...
c: TextCalendar
def setfirstweekday(firstweekday: int) -> None: ...
def format(cols: int, colwidth: int = 20, spacing: int = 6) -> str: ...
def formatstring(cols: Iterable[str], colwidth: int = 20, spacing: int = 6) -> str: ...
def timegm(tuple: tuple[int, ...] | struct_time) -> int: ...
# Data attributes
day_name: Sequence[str]
day_abbr: Sequence[str]
month_name: Sequence[str]
month_abbr: Sequence[str]
if sys.version_info >= (3, 12):
class Month(enum.IntEnum):
JANUARY = 1
FEBRUARY = 2
MARCH = 3
APRIL = 4
MAY = 5
JUNE = 6
JULY = 7
AUGUST = 8
SEPTEMBER = 9
OCTOBER = 10
NOVEMBER = 11
DECEMBER = 12
JANUARY: Final = Month.JANUARY
FEBRUARY: Final = Month.FEBRUARY
MARCH: Final = Month.MARCH
APRIL: Final = Month.APRIL
MAY: Final = Month.MAY
JUNE: Final = Month.JUNE
JULY: Final = Month.JULY
AUGUST: Final = Month.AUGUST
SEPTEMBER: Final = Month.SEPTEMBER
OCTOBER: Final = Month.OCTOBER
NOVEMBER: Final = Month.NOVEMBER
DECEMBER: Final = Month.DECEMBER
class Day(enum.IntEnum):
MONDAY = 0
TUESDAY = 1
WEDNESDAY = 2
THURSDAY = 3
FRIDAY = 4
SATURDAY = 5
SUNDAY = 6
MONDAY: Final = Day.MONDAY
TUESDAY: Final = Day.TUESDAY
WEDNESDAY: Final = Day.WEDNESDAY
THURSDAY: Final = Day.THURSDAY
FRIDAY: Final = Day.FRIDAY
SATURDAY: Final = Day.SATURDAY
SUNDAY: Final = Day.SUNDAY
else:
MONDAY: Final = 0
TUESDAY: Final = 1
WEDNESDAY: Final = 2
THURSDAY: Final = 3
FRIDAY: Final = 4
SATURDAY: Final = 5
SUNDAY: Final = 6
EPOCH: Final = 1970