Use Literal types in calendar, add __all__ (#6827)

This commit is contained in:
Nikita Sobolev
2022-01-05 13:26:29 +03:00
committed by GitHub
parent 9116b2928d
commit 1527f67207

View File

@@ -2,6 +2,34 @@ import datetime
import sys
from time import struct_time
from typing import Any, Iterable, Optional, Sequence
from typing_extensions import Literal
__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",
]
_LocaleType = tuple[Optional[str], Optional[str]]
@@ -105,13 +133,12 @@ day_abbr: Sequence[str]
month_name: Sequence[str]
month_abbr: Sequence[str]
# Below constants are not in docs or __all__, but enough people have used them
# they are now effectively public.
MONDAY: Literal[0]
TUESDAY: Literal[1]
WEDNESDAY: Literal[2]
THURSDAY: Literal[3]
FRIDAY: Literal[4]
SATURDAY: Literal[5]
SUNDAY: Literal[6]
MONDAY: int
TUESDAY: int
WEDNESDAY: int
THURSDAY: int
FRIDAY: int
SATURDAY: int
SUNDAY: int
EPOCH: Literal[1970]