Format: application/octet-stream
⬇ Download File (5.6 KB)
   1  import datetime
   2  import sys
   3  from time import struct_time
   4  from typing import Any, Iterable, List, Optional, Sequence, Tuple, Union
   5  
   6  _LocaleType = Tuple[Optional[str], Optional[str]]
   7  
   8  class IllegalMonthError(ValueError):
   9      def __init__(self, month: int) -> None: ...
  10      def __str__(self) -> str: ...
  11  
  12  class IllegalWeekdayError(ValueError):
  13      def __init__(self, weekday: int) -> None: ...
  14      def __str__(self) -> str: ...
  15  
  16  def isleap(year: int) -> bool: ...
  17  def leapdays(y1: int, y2: int) -> int: ...
  18  def weekday(year: int, month: int, day: int) -> int: ...
  19  def monthrange(year: int, month: int) -> Tuple[int, int]: ...
  20  
  21  class Calendar:
  22      def __init__(self, firstweekday: int = ...) -> None: ...
  23      def getfirstweekday(self) -> int: ...
  24      def setfirstweekday(self, firstweekday: int) -> None: ...
  25      def iterweekdays(self) -> Iterable[int]: ...
  26      def itermonthdates(self, year: int, month: int) -> Iterable[datetime.date]: ...
  27      def itermonthdays2(self, year: int, month: int) -> Iterable[Tuple[int, int]]: ...
  28      def itermonthdays(self, year: int, month: int) -> Iterable[int]: ...
  29      def monthdatescalendar(self, year: int, month: int) -> List[List[datetime.date]]: ...
  30      def monthdays2calendar(self, year: int, month: int) -> List[List[Tuple[int, int]]]: ...
  31      def monthdayscalendar(self, year: int, month: int) -> List[List[int]]: ...
  32      def yeardatescalendar(self, year: int, width: int = ...) -> List[List[int]]: ...
  33      def yeardays2calendar(self, year: int, width: int = ...) -> List[List[Tuple[int, int]]]: ...
  34      def yeardayscalendar(self, year: int, width: int = ...) -> List[List[int]]: ...
  35      if sys.version_info >= (3, 7):
  36          def itermonthdays3(self, year: int, month: int) -> Iterable[Tuple[int, int, int]]: ...
  37          def itermonthdays4(self, year: int, month: int) -> Iterable[Tuple[int, int, int, int]]: ...
  38  
  39  class TextCalendar(Calendar):
  40      def prweek(self, theweek: int, width: int) -> None: ...
  41      def formatday(self, day: int, weekday: int, width: int) -> str: ...
  42      def formatweek(self, theweek: int, width: int) -> str: ...
  43      def formatweekday(self, day: int, width: int) -> str: ...
  44      def formatweekheader(self, width: int) -> str: ...
  45      def formatmonthname(self, theyear: int, themonth: int, width: int, withyear: bool = ...) -> str: ...
  46      def prmonth(self, theyear: int, themonth: int, w: int = ..., l: int = ...) -> None: ...
  47      def formatmonth(self, theyear: int, themonth: int, w: int = ..., l: int = ...) -> str: ...
  48      def formatyear(self, theyear: int, w: int = ..., l: int = ..., c: int = ..., m: int = ...) -> str: ...
  49      def pryear(self, theyear: int, w: int = ..., l: int = ..., c: int = ..., m: int = ...) -> None: ...
  50  
  51  def firstweekday() -> int: ...
  52  def monthcalendar(year: int, month: int) -> List[List[int]]: ...
  53  def prweek(theweek: int, width: int) -> None: ...
  54  def week(theweek: int, width: int) -> str: ...
  55  def weekheader(width: int) -> str: ...
  56  def prmonth(theyear: int, themonth: int, w: int = ..., l: int = ...) -> None: ...
  57  def month(theyear: int, themonth: int, w: int = ..., l: int = ...) -> str: ...
  58  def calendar(theyear: int, w: int = ..., l: int = ..., c: int = ..., m: int = ...) -> str: ...
  59  def prcal(theyear: int, w: int = ..., l: int = ..., c: int = ..., m: int = ...) -> None: ...
  60  
  61  class HTMLCalendar(Calendar):
  62      def formatday(self, day: int, weekday: int) -> str: ...
  63      def formatweek(self, theweek: int) -> str: ...
  64      def formatweekday(self, day: int) -> str: ...
  65      def formatweekheader(self) -> str: ...
  66      def formatmonthname(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ...
  67      def formatmonth(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ...
  68      def formatyear(self, theyear: int, width: int = ...) -> str: ...
  69      def formatyearpage(self, theyear: int, width: int = ..., css: Optional[str] = ..., encoding: Optional[str] = ...) -> str: ...
  70      if sys.version_info >= (3, 7):
  71          cssclasses: List[str]
  72          cssclass_noday: str
  73          cssclasses_weekday_head: List[str]
  74          cssclass_month_head: str
  75          cssclass_month: str
  76          cssclass_year: str
  77          cssclass_year_head: str
  78  
  79  if sys.version_info < (3, 0):
  80      class TimeEncoding:
  81          def __init__(self, locale: _LocaleType) -> None: ...
  82          def __enter__(self) -> _LocaleType: ...
  83          def __exit__(self, *args: Any) -> None: ...
  84  
  85  else:
  86      class different_locale:
  87          def __init__(self, locale: _LocaleType) -> None: ...
  88          def __enter__(self) -> _LocaleType: ...
  89          def __exit__(self, *args: Any) -> None: ...
  90  
  91  class LocaleTextCalendar(TextCalendar):
  92      def __init__(self, firstweekday: int = ..., locale: Optional[_LocaleType] = ...) -> None: ...
  93      def formatweekday(self, day: int, width: int) -> str: ...
  94      def formatmonthname(self, theyear: int, themonth: int, width: int, withyear: bool = ...) -> str: ...
  95  
  96  class LocaleHTMLCalendar(HTMLCalendar):
  97      def __init__(self, firstweekday: int = ..., locale: Optional[_LocaleType] = ...) -> None: ...
  98      def formatweekday(self, day: int) -> str: ...
  99      def formatmonthname(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ...
 100  
 101  c: TextCalendar
 102  
 103  def setfirstweekday(firstweekday: int) -> None: ...
 104  def format(cols: int, colwidth: int = ..., spacing: int = ...) -> str: ...
 105  def formatstring(cols: int, colwidth: int = ..., spacing: int = ...) -> str: ...
 106  def timegm(tuple: Union[Tuple[int, ...], struct_time]) -> int: ...
 107  
 108  # Data attributes
 109  day_name: Sequence[str]
 110  day_abbr: Sequence[str]
 111  month_name: Sequence[str]
 112  month_abbr: Sequence[str]
 113  
 114  # Below constants are not in docs or __all__, but enough people have used them
 115  # they are now effectively public.
 116  
 117  MONDAY: int
 118  TUESDAY: int
 119  WEDNESDAY: int
 120  THURSDAY: int
 121  FRIDAY: int
 122  SATURDAY: int
 123  SUNDAY: int
 124