|
1 |
| -# Stubs for calendar |
| 1 | +from typing import Any, Iterable, Optional, Tuple |
| 2 | +import datetime |
2 | 3 |
|
3 |
| -# NOTE: These are incomplete! |
| 4 | +LocaleType = Tuple[Optional[str], Optional[str]] |
4 | 5 |
|
5 |
| -from typing import overload, Tuple |
| 6 | +class IllegalMonthError(ValueError): |
| 7 | + def __init__(self, month: int) -> None: ... |
| 8 | + def __str__(self) -> str: ... |
6 | 9 |
|
7 |
| -# TODO actually, any number of items larger than 5 is fine |
8 |
| -@overload |
9 |
| -def timegm(t: Tuple[int, int, int, int, int, int]) -> int: ... |
10 |
| -@overload |
11 |
| -def timegm(t: Tuple[int, int, int, int, int, int, int]) -> int: ... |
12 |
| -@overload |
13 |
| -def timegm(t: Tuple[int, int, int, int, int, int, int, int]) -> int: ... |
14 |
| -@overload |
15 |
| -def timegm(t: Tuple[int, int, int, int, int, int, int, int, int]) -> int: ... |
| 10 | +class IllegalWeekdayError(ValueError): |
| 11 | + def __init__(self, weekday: int) -> None: ... |
| 12 | + def __str__(self) -> str: ... |
| 13 | + |
| 14 | +def isleap(year: int) -> bool: ... |
| 15 | +def leapdays(y1: int, y2: int) -> int: ... |
| 16 | +def weekday(year: int, month: int, day: int) -> int: ... |
| 17 | +def monthrange(year: int, month: int) -> Tuple[int, int]: ... |
| 18 | + |
| 19 | +class Calendar(object): |
| 20 | + def __init__(self, firstweekday: int = 0) -> None: ... |
| 21 | + def getfirstweekday(self) -> int: ... |
| 22 | + def setfirstweekday(self, firstweekday: int) -> None: ... |
| 23 | + def iterweekdays(self) -> Iterable[int]: ... |
| 24 | + def itermonthdates(self, year: int, month: int) -> Iterable[datetime.date]: ... |
| 25 | + def itermonthdays2(self, year: int, month: int) -> Iterable[Tuple[int, int]]: ... |
| 26 | + def itermonthdays(self, year: int, month: int) -> Iterable[int]: ... |
| 27 | + def monthdatescalendar(self, year: int, month: int) -> List[List[datetime.date]]: ... |
| 28 | + def monthdays2calendar(self, year: int, month: int) -> List[List[Tuple[int, int]]]: ... |
| 29 | + def monthdayscalendar(self, year: int, month: int) -> List[List[int]]: ... |
| 30 | + def yeardatescalendar(self, year: int, width: int = 3) -> List[List[int]]: ... |
| 31 | + def yeardays2calendar(self, year: int, width: int = 3) -> List[List[Tuple[int, int]]]: ... |
| 32 | + def yeardayscalendar(self, year: int, width: int = 3) -> List[List[int]]: ... |
| 33 | + |
| 34 | +class TextCalendar(Calendar): |
| 35 | + def prweek(self, theweek: int, width: int) -> None: ... |
| 36 | + def formatday(self, day: int, weekday: int, width: int) -> str: ... |
| 37 | + def formatweek(self, theweek: int, width: int) -> str: ... |
| 38 | + def formatweekday(self, day: int, width: int) -> str: ... |
| 39 | + def formatweekheader(self, width: int) -> str: ... |
| 40 | + def formatmonthname(self, theyear: int, themonth: int, width: int, withyear: bool = ...) -> str: ... |
| 41 | + def prmonth(self, theyear: int, themonth: int, w: Any=0, l: Any = 0) -> None: ... |
| 42 | + def formatmonth(self, theyear: int, themonth: int, w: int = 0, l: int = 0) -> str: ... |
| 43 | + def formatyear(self, theyear: int, w: int = 2, l: int = 1, c: int = 6, m: int = 3) -> str: ... |
| 44 | + def pryear(self, theyear: int, w: Any = 0, l: Any = 0, c: Any = 6, m: Any = 3) -> None: ... |
| 45 | + |
| 46 | +class HTMLCalendar(Calendar): |
| 47 | + def formatday(self, day: int, weekday: int) -> str: ... |
| 48 | + def formatweek(self, theweek: int) -> str: ... |
| 49 | + def formatweekday(self, day: int) -> str: ... |
| 50 | + def formatweekheader(self) -> str: ... |
| 51 | + def formatmonthname(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ... |
| 52 | + def formatmonth(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ... |
| 53 | + def formatyear(self, theyear: int, width: int = 3) -> str: ... |
| 54 | + def formatyearpage(self, theyear: int, width: int = 3, css: Optional[str] = 'calendar.css', encoding: Optional[str] = ...) -> str: ... |
| 55 | + |
| 56 | +class different_locale: |
| 57 | + def __init__(self, locale: LocaleType) -> None: ... |
| 58 | + def __enter__(self) -> LocaleType: ... |
| 59 | + def __exit__(self, *args) -> None: ... |
| 60 | + |
| 61 | +class LocaleTextCalendar(TextCalendar): |
| 62 | + def __init__(self, firstweekday: int = 0, locale: Optional[LocaleType] = ...) -> None: ... |
| 63 | + def formatweekday(self, day: int, width: int) -> str: ... |
| 64 | + def formatmonthname(self, theyear: int, themonth: int, width: int, withyear: bool = ...) -> str: ... |
| 65 | + |
| 66 | +class LocaleHTMLCalendar(HTMLCalendar): |
| 67 | + def __init__(self, firstweekday: int = 0, locale: Optional[LocaleType] = ...) -> None: ... |
| 68 | + def formatweekday(self, day: int) -> str: ... |
| 69 | + def formatmonthname(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ... |
| 70 | + |
| 71 | +c = ... # type: TextCalendar |
| 72 | +def setfirstweekday(firstweekday: int) -> None: ... |
| 73 | +def format(cols: int, colwidth: int = ..., spacing: int = ...) -> str: ... |
| 74 | +def formatstring(cols: int, colwidth: int = ..., spacing: int = ...) -> str: ... |
| 75 | +def timegm(tuple: Tuple[int]) -> int: ... |
0 commit comments