Format: application/octet-stream
⬇ Download File (12.4 KB)
   1  import sys
   2  from time import struct_time
   3  from typing import AnyStr, ClassVar, Optional, SupportsAbs, Tuple, Type, TypeVar, Union, overload
   4  
   5  _S = TypeVar("_S")
   6  
   7  if sys.version_info >= (3,):
   8      _Text = str
   9  else:
  10      _Text = Union[str, unicode]
  11  
  12  MINYEAR: int
  13  MAXYEAR: int
  14  
  15  class tzinfo:
  16      def tzname(self, dt: Optional[datetime]) -> Optional[str]: ...
  17      def utcoffset(self, dt: Optional[datetime]) -> Optional[timedelta]: ...
  18      def dst(self, dt: Optional[datetime]) -> Optional[timedelta]: ...
  19      def fromutc(self, dt: datetime) -> datetime: ...
  20  
  21  if sys.version_info >= (3, 2):
  22      class timezone(tzinfo):
  23          utc: ClassVar[timezone]
  24          min: ClassVar[timezone]
  25          max: ClassVar[timezone]
  26          def __init__(self, offset: timedelta, name: str = ...) -> None: ...
  27          def __hash__(self) -> int: ...
  28  
  29  _tzinfo = tzinfo
  30  
  31  class date:
  32      min: ClassVar[date]
  33      max: ClassVar[date]
  34      resolution: ClassVar[timedelta]
  35      def __new__(cls: Type[_S], year: int, month: int, day: int) -> _S: ...
  36      @classmethod
  37      def fromtimestamp(cls: Type[_S], __timestamp: float) -> _S: ...
  38      @classmethod
  39      def today(cls: Type[_S]) -> _S: ...
  40      @classmethod
  41      def fromordinal(cls: Type[_S], n: int) -> _S: ...
  42      if sys.version_info >= (3, 7):
  43          @classmethod
  44          def fromisoformat(cls: Type[_S], date_string: str) -> _S: ...
  45      if sys.version_info >= (3, 8):
  46          @classmethod
  47          def fromisocalendar(cls: Type[_S], year: int, week: int, day: int) -> _S: ...
  48      @property
  49      def year(self) -> int: ...
  50      @property
  51      def month(self) -> int: ...
  52      @property
  53      def day(self) -> int: ...
  54      def ctime(self) -> str: ...
  55      def strftime(self, fmt: _Text) -> str: ...
  56      if sys.version_info >= (3,):
  57          def __format__(self, fmt: str) -> str: ...
  58      else:
  59          def __format__(self, fmt: AnyStr) -> AnyStr: ...
  60      def isoformat(self) -> str: ...
  61      def timetuple(self) -> struct_time: ...
  62      def toordinal(self) -> int: ...
  63      def replace(self, year: int = ..., month: int = ..., day: int = ...) -> date: ...
  64      def __le__(self, other: date) -> bool: ...
  65      def __lt__(self, other: date) -> bool: ...
  66      def __ge__(self, other: date) -> bool: ...
  67      def __gt__(self, other: date) -> bool: ...
  68      if sys.version_info >= (3, 8):
  69          def __add__(self: _S, other: timedelta) -> _S: ...
  70          def __radd__(self: _S, other: timedelta) -> _S: ...
  71      else:
  72          def __add__(self, other: timedelta) -> date: ...
  73          def __radd__(self, other: timedelta) -> date: ...
  74      @overload
  75      def __sub__(self, other: timedelta) -> date: ...
  76      @overload
  77      def __sub__(self, other: date) -> timedelta: ...
  78      def __hash__(self) -> int: ...
  79      def weekday(self) -> int: ...
  80      def isoweekday(self) -> int: ...
  81      def isocalendar(self) -> Tuple[int, int, int]: ...
  82  
  83  class time:
  84      min: ClassVar[time]
  85      max: ClassVar[time]
  86      resolution: ClassVar[timedelta]
  87  
  88      if sys.version_info >= (3, 6):
  89          def __init__(
  90              self,
  91              hour: int = ...,
  92              minute: int = ...,
  93              second: int = ...,
  94              microsecond: int = ...,
  95              tzinfo: Optional[_tzinfo] = ...,
  96              *,
  97              fold: int = ...,
  98          ) -> None: ...
  99      else:
 100          def __init__(
 101              self, hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo: Optional[_tzinfo] = ...
 102          ) -> None: ...
 103      @property
 104      def hour(self) -> int: ...
 105      @property
 106      def minute(self) -> int: ...
 107      @property
 108      def second(self) -> int: ...
 109      @property
 110      def microsecond(self) -> int: ...
 111      @property
 112      def tzinfo(self) -> Optional[_tzinfo]: ...
 113      if sys.version_info >= (3, 6):
 114          @property
 115          def fold(self) -> int: ...
 116      def __le__(self, other: time) -> bool: ...
 117      def __lt__(self, other: time) -> bool: ...
 118      def __ge__(self, other: time) -> bool: ...
 119      def __gt__(self, other: time) -> bool: ...
 120      def __hash__(self) -> int: ...
 121      if sys.version_info >= (3, 6):
 122          def isoformat(self, timespec: str = ...) -> str: ...
 123      else:
 124          def isoformat(self) -> str: ...
 125      if sys.version_info >= (3, 7):
 126          @classmethod
 127          def fromisoformat(cls: Type[_S], time_string: str) -> _S: ...
 128      def strftime(self, fmt: _Text) -> str: ...
 129      if sys.version_info >= (3,):
 130          def __format__(self, fmt: str) -> str: ...
 131      else:
 132          def __format__(self, fmt: AnyStr) -> AnyStr: ...
 133      def utcoffset(self) -> Optional[timedelta]: ...
 134      def tzname(self) -> Optional[str]: ...
 135      def dst(self) -> Optional[timedelta]: ...
 136      if sys.version_info >= (3, 6):
 137          def replace(
 138              self,
 139              hour: int = ...,
 140              minute: int = ...,
 141              second: int = ...,
 142              microsecond: int = ...,
 143              tzinfo: Optional[_tzinfo] = ...,
 144              *,
 145              fold: int = ...,
 146          ) -> time: ...
 147      else:
 148          def replace(
 149              self, hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo: Optional[_tzinfo] = ...
 150          ) -> time: ...
 151  
 152  _date = date
 153  _time = time
 154  
 155  class timedelta(SupportsAbs[timedelta]):
 156      min: ClassVar[timedelta]
 157      max: ClassVar[timedelta]
 158      resolution: ClassVar[timedelta]
 159  
 160      if sys.version_info >= (3, 6):
 161          def __init__(
 162              self,
 163              days: float = ...,
 164              seconds: float = ...,
 165              microseconds: float = ...,
 166              milliseconds: float = ...,
 167              minutes: float = ...,
 168              hours: float = ...,
 169              weeks: float = ...,
 170              *,
 171              fold: int = ...,
 172          ) -> None: ...
 173      else:
 174          def __init__(
 175              self,
 176              days: float = ...,
 177              seconds: float = ...,
 178              microseconds: float = ...,
 179              milliseconds: float = ...,
 180              minutes: float = ...,
 181              hours: float = ...,
 182              weeks: float = ...,
 183          ) -> None: ...
 184      @property
 185      def days(self) -> int: ...
 186      @property
 187      def seconds(self) -> int: ...
 188      @property
 189      def microseconds(self) -> int: ...
 190      def total_seconds(self) -> float: ...
 191      def __add__(self, other: timedelta) -> timedelta: ...
 192      def __radd__(self, other: timedelta) -> timedelta: ...
 193      def __sub__(self, other: timedelta) -> timedelta: ...
 194      def __rsub__(self, other: timedelta) -> timedelta: ...
 195      def __neg__(self) -> timedelta: ...
 196      def __pos__(self) -> timedelta: ...
 197      def __abs__(self) -> timedelta: ...
 198      def __mul__(self, other: float) -> timedelta: ...
 199      def __rmul__(self, other: float) -> timedelta: ...
 200      @overload
 201      def __floordiv__(self, other: timedelta) -> int: ...
 202      @overload
 203      def __floordiv__(self, other: int) -> timedelta: ...
 204      if sys.version_info >= (3,):
 205          @overload
 206          def __truediv__(self, other: timedelta) -> float: ...
 207          @overload
 208          def __truediv__(self, other: float) -> timedelta: ...
 209          def __mod__(self, other: timedelta) -> timedelta: ...
 210          def __divmod__(self, other: timedelta) -> Tuple[int, timedelta]: ...
 211      else:
 212          @overload
 213          def __div__(self, other: timedelta) -> float: ...
 214          @overload
 215          def __div__(self, other: float) -> timedelta: ...
 216      def __le__(self, other: timedelta) -> bool: ...
 217      def __lt__(self, other: timedelta) -> bool: ...
 218      def __ge__(self, other: timedelta) -> bool: ...
 219      def __gt__(self, other: timedelta) -> bool: ...
 220      def __hash__(self) -> int: ...
 221  
 222  class datetime(date):
 223      min: ClassVar[datetime]
 224      max: ClassVar[datetime]
 225      resolution: ClassVar[timedelta]
 226  
 227      if sys.version_info >= (3, 6):
 228          def __new__(
 229              cls: Type[_S],
 230              year: int,
 231              month: int,
 232              day: int,
 233              hour: int = ...,
 234              minute: int = ...,
 235              second: int = ...,
 236              microsecond: int = ...,
 237              tzinfo: Optional[_tzinfo] = ...,
 238              *,
 239              fold: int = ...,
 240          ) -> _S: ...
 241      else:
 242          def __new__(
 243              cls: Type[_S],
 244              year: int,
 245              month: int,
 246              day: int,
 247              hour: int = ...,
 248              minute: int = ...,
 249              second: int = ...,
 250              microsecond: int = ...,
 251              tzinfo: Optional[_tzinfo] = ...,
 252          ) -> _S: ...
 253      @property
 254      def year(self) -> int: ...
 255      @property
 256      def month(self) -> int: ...
 257      @property
 258      def day(self) -> int: ...
 259      @property
 260      def hour(self) -> int: ...
 261      @property
 262      def minute(self) -> int: ...
 263      @property
 264      def second(self) -> int: ...
 265      @property
 266      def microsecond(self) -> int: ...
 267      @property
 268      def tzinfo(self) -> Optional[_tzinfo]: ...
 269      if sys.version_info >= (3, 6):
 270          @property
 271          def fold(self) -> int: ...
 272      @classmethod
 273      def fromtimestamp(cls: Type[_S], t: float, tz: Optional[_tzinfo] = ...) -> _S: ...
 274      @classmethod
 275      def utcfromtimestamp(cls: Type[_S], t: float) -> _S: ...
 276      @classmethod
 277      def today(cls: Type[_S]) -> _S: ...
 278      @classmethod
 279      def fromordinal(cls: Type[_S], n: int) -> _S: ...
 280      if sys.version_info >= (3, 8):
 281          @classmethod
 282          def now(cls: Type[_S], tz: Optional[_tzinfo] = ...) -> _S: ...
 283      else:
 284          @overload
 285          @classmethod
 286          def now(cls: Type[_S], tz: None = ...) -> _S: ...
 287          @overload
 288          @classmethod
 289          def now(cls, tz: _tzinfo) -> datetime: ...
 290      @classmethod
 291      def utcnow(cls: Type[_S]) -> _S: ...
 292      if sys.version_info >= (3, 6):
 293          @classmethod
 294          def combine(cls, date: _date, time: _time, tzinfo: Optional[_tzinfo] = ...) -> datetime: ...
 295      else:
 296          @classmethod
 297          def combine(cls, date: _date, time: _time) -> datetime: ...
 298      if sys.version_info >= (3, 7):
 299          @classmethod
 300          def fromisoformat(cls: Type[_S], date_string: str) -> _S: ...
 301      def strftime(self, fmt: _Text) -> str: ...
 302      if sys.version_info >= (3,):
 303          def __format__(self, fmt: str) -> str: ...
 304      else:
 305          def __format__(self, fmt: AnyStr) -> AnyStr: ...
 306      def toordinal(self) -> int: ...
 307      def timetuple(self) -> struct_time: ...
 308      if sys.version_info >= (3, 3):
 309          def timestamp(self) -> float: ...
 310      def utctimetuple(self) -> struct_time: ...
 311      def date(self) -> _date: ...
 312      def time(self) -> _time: ...
 313      def timetz(self) -> _time: ...
 314      if sys.version_info >= (3, 6):
 315          def replace(
 316              self,
 317              year: int = ...,
 318              month: int = ...,
 319              day: int = ...,
 320              hour: int = ...,
 321              minute: int = ...,
 322              second: int = ...,
 323              microsecond: int = ...,
 324              tzinfo: Optional[_tzinfo] = ...,
 325              *,
 326              fold: int = ...,
 327          ) -> datetime: ...
 328      else:
 329          def replace(
 330              self,
 331              year: int = ...,
 332              month: int = ...,
 333              day: int = ...,
 334              hour: int = ...,
 335              minute: int = ...,
 336              second: int = ...,
 337              microsecond: int = ...,
 338              tzinfo: Optional[_tzinfo] = ...,
 339          ) -> datetime: ...
 340      if sys.version_info >= (3, 8):
 341          def astimezone(self: _S, tz: Optional[_tzinfo] = ...) -> _S: ...
 342      elif sys.version_info >= (3, 3):
 343          def astimezone(self, tz: Optional[_tzinfo] = ...) -> datetime: ...
 344      else:
 345          def astimezone(self, tz: _tzinfo) -> datetime: ...
 346      def ctime(self) -> str: ...
 347      if sys.version_info >= (3, 6):
 348          def isoformat(self, sep: str = ..., timespec: str = ...) -> str: ...
 349      else:
 350          def isoformat(self, sep: str = ...) -> str: ...
 351      @classmethod
 352      def strptime(cls, date_string: _Text, format: _Text) -> datetime: ...
 353      def utcoffset(self) -> Optional[timedelta]: ...
 354      def tzname(self) -> Optional[str]: ...
 355      def dst(self) -> Optional[timedelta]: ...
 356      def __le__(self, other: datetime) -> bool: ...  # type: ignore
 357      def __lt__(self, other: datetime) -> bool: ...  # type: ignore
 358      def __ge__(self, other: datetime) -> bool: ...  # type: ignore
 359      def __gt__(self, other: datetime) -> bool: ...  # type: ignore
 360      if sys.version_info >= (3, 8):
 361          def __add__(self: _S, other: timedelta) -> _S: ...
 362          def __radd__(self: _S, other: timedelta) -> _S: ...
 363      else:
 364          def __add__(self, other: timedelta) -> datetime: ...
 365          def __radd__(self, other: timedelta) -> datetime: ...
 366      @overload  # type: ignore
 367      def __sub__(self, other: datetime) -> timedelta: ...
 368      @overload
 369      def __sub__(self, other: timedelta) -> datetime: ...
 370      def __hash__(self) -> int: ...
 371      def weekday(self) -> int: ...
 372      def isoweekday(self) -> int: ...
 373      def isocalendar(self) -> Tuple[int, int, int]: ...
 374