zoukankan      html  css  js  c++  java
  • python模块:datetime

      1 # Stubs for datetime
      2 
      3 # NOTE: These are incomplete!
      4 import sys
      5 from typing import Optional, SupportsAbs, Tuple, overload
      6 
      7 MINYEAR = 0
      8 MAXYEAR = 0
      9 
     10 TimeTuple = Tuple[int, int, int, int, int, int, int, int, int]
     11 
     12 class tzinfo:
     13     def tzname(self, dt: Optional[datetime]) -> str: ...
     14     def utcoffset(self, dt: Optional[datetime]) -> Optional[timedelta]: ...
     15     def dst(self, dt: Optional[datetime]) -> Optional[timedelta]: ...
     16     def fromutc(self, dt: datetime) -> datetime: ...
     17 
     18 class timezone(tzinfo):
     19     utc = ...  # type: timezone
     20     min = ...  # type: timezone
     21     max = ...  # type: timezone
     22 
     23     def __init__(self, offset: timedelta, name: str = ...) -> None: ...
     24     def __hash__(self) -> int: ...
     25 
     26 _tzinfo = tzinfo
     27 _timezone = timezone
     28 
     29 class date:
     30     min = ...  # type: date
     31     max = ...  # type: date
     32     resolution = ...  # type: timedelta
     33 
     34     def __init__(self, year: int, month: int, day: int) -> None: ...
     35 
     36     @classmethod
     37     def fromtimestamp(cls, t: float) -> date: ...
     38     @classmethod
     39     def today(cls) -> date: ...
     40     @classmethod
     41     def fromordinal(cls, n: int) -> date: ...
     42 
     43     @property
     44     def year(self) -> int: ...
     45     @property
     46     def month(self) -> int: ...
     47     @property
     48     def day(self) -> int: ...
     49 
     50     def ctime(self) -> str: ...
     51     def strftime(self, fmt: str) -> str: ...
     52     def __format__(self, fmt: str) -> str: ...
     53     def isoformat(self) -> str: ...
     54     def timetuple(self) -> tuple: ...  # TODO return type
     55     def toordinal(self) -> int: ...
     56     def replace(self, year: int = ..., month: int = ..., day: int = ...) -> date: ...
     57     def __le__(self, other: date) -> bool: ...
     58     def __lt__(self, other: date) -> bool: ...
     59     def __ge__(self, other: date) -> bool: ...
     60     def __gt__(self, other: date) -> bool: ...
     61     def __add__(self, other: timedelta) -> date: ...
     62     @overload
     63     def __sub__(self, other: timedelta) -> date: ...
     64     @overload
     65     def __sub__(self, other: date) -> timedelta: ...
     66     def __hash__(self) -> int: ...
     67     def weekday(self) -> int: ...
     68     def isoweekday(self) -> int: ...
     69     def isocalendar(self) -> Tuple[int, int, int]: ...
     70 
     71 class time:
     72     min = ...  # type: time
     73     max = ...  # type: time
     74     resolution = ...  # type: timedelta
     75 
     76     def __init__(self, hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ...,
     77                  tzinfo: Optional[tzinfo] = ...) -> None: ...
     78 
     79     @property
     80     def hour(self) -> int: ...
     81     @property
     82     def minute(self) -> int: ...
     83     @property
     84     def second(self) -> int: ...
     85     @property
     86     def microsecond(self) -> int: ...
     87     @property
     88     def tzinfo(self) -> Optional[_tzinfo]: ...
     89 
     90     def __le__(self, other: time) -> bool: ...
     91     def __lt__(self, other: time) -> bool: ...
     92     def __ge__(self, other: time) -> bool: ...
     93     def __gt__(self, other: time) -> bool: ...
     94     def __hash__(self) -> int: ...
     95     def isoformat(self) -> str: ...
     96     def strftime(self, fmt: str) -> str: ...
     97     def __format__(self, fmt: str) -> str: ...
     98     def utcoffset(self) -> Optional[timedelta]: ...
     99     def tzname(self) -> Optional[str]: ...
    100     def dst(self) -> Optional[int]: ...
    101     def replace(self, hour: int = ..., minute: int = ..., second: int = ...,
    102                 microsecond: int = ..., tzinfo: Optional[_tzinfo] = None) -> time: ...
    103 
    104 _date = date
    105 _time = time
    106 
    107 class timedelta(SupportsAbs[timedelta]):
    108     min = ...  # type: timedelta
    109     max = ...  # type: timedelta
    110     resolution = ...  # type: timedelta
    111 
    112     def __init__(self, days: float = ..., seconds: float = ..., microseconds: float = ...,
    113                  milliseconds: float = ..., minutes: float = ..., hours: float = ...,
    114                  weeks: float = ...) -> None: ...
    115 
    116     @property
    117     def days(self) -> int: ...
    118     @property
    119     def seconds(self) -> int: ...
    120     @property
    121     def microseconds(self) -> int: ...
    122 
    123     def total_seconds(self) -> float: ...
    124     def __add__(self, other: timedelta) -> timedelta: ...
    125     def __radd__(self, other: timedelta) -> timedelta: ...
    126     def __sub__(self, other: timedelta) -> timedelta: ...
    127     def __rsub(self, other: timedelta) -> timedelta: ...
    128     def __neg__(self) -> timedelta: ...
    129     def __pos__(self) -> timedelta: ...
    130     def __abs__(self) -> timedelta: ...
    131     def __mul__(self, other: float) -> timedelta: ...
    132     def __rmul__(self, other: float) -> timedelta: ...
    133     @overload
    134     def __floordiv__(self, other: timedelta) -> int: ...
    135     @overload
    136     def __floordiv__(self, other: int) -> timedelta: ...
    137     @overload
    138     def __truediv__(self, other: timedelta) -> float: ...
    139     @overload
    140     def __truediv__(self, other: float) -> timedelta: ...
    141     def __mod__(self, other: timedelta) -> timedelta: ...
    142     def __divmod__(self, other: timedelta) -> Tuple[int, timedelta]: ...
    143     def __le__(self, other: timedelta) -> bool: ...
    144     def __lt__(self, other: timedelta) -> bool: ...
    145     def __ge__(self, other: timedelta) -> bool: ...
    146     def __gt__(self, other: timedelta) -> bool: ...
    147     def __hash__(self) -> int: ...
    148 
    149 
    150 class datetime:
    151     # TODO: Is a subclass of date, but this would make some types incompatible.
    152     min = ...  # type: datetime
    153     max = ...  # type: datetime
    154     resolution = ...  # type: timedelta
    155 
    156     def __init__(self, year: int, month: int = ..., day: int = ..., hour: int = ...,
    157                  minute: int = ..., second: int = ..., microsecond: int = ...,
    158                  tzinfo: Optional[tzinfo] = ...) -> None: ...
    159 
    160     @property
    161     def year(self) -> int: ...
    162     @property
    163     def month(self) -> int: ...
    164     @property
    165     def day(self) -> int: ...
    166     @property
    167     def hour(self) -> int: ...
    168     @property
    169     def minute(self) -> int: ...
    170     @property
    171     def second(self) -> int: ...
    172     @property
    173     def microsecond(self) -> int: ...
    174     @property
    175     def tzinfo(self) -> Optional[_tzinfo]: ...
    176 
    177     @classmethod
    178     def fromtimestamp(cls, t: float, tz: Optional[_tzinfo] = ...) -> datetime: ...
    179     @classmethod
    180     def utcfromtimestamp(cls, t: float) -> datetime: ...
    181     @classmethod
    182     def today(cls) -> datetime: ...
    183     @classmethod
    184     def fromordinal(cls, n: int) -> datetime: ...
    185     @classmethod
    186     def now(cls, tz: Optional[_tzinfo] = ...) -> datetime: ...
    187     @classmethod
    188     def utcnow(cls) -> datetime: ...
    189     @classmethod
    190     def combine(cls, date: date, time: time) -> datetime: ...
    191     def strftime(self, fmt: str) -> str: ...
    192     def __format__(self, fmt: str) -> str: ...
    193     def toordinal(self) -> int: ...
    194     def timetuple(self) -> TimeTuple: ...  # TODO return type
    195     def timestamp(self) -> float: ...
    196     def utctimetuple(self) -> TimeTuple: ...  # TODO return type
    197     def date(self) -> _date: ...
    198     def time(self) -> _time: ...
    199     def timetz(self) -> _time: ...
    200     def replace(self, year: int = ..., month: int = ..., day: int = ..., hour: int = ...,
    201                 minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo:
    202                 Optional[_tzinfo] = None) -> datetime: ...
    203     def astimezone(self, tz: Optional[_tzinfo] = ...) -> datetime: ...
    204     def ctime(self) -> str: ...
    205     if sys.version_info >= (3, 6):
    206         def isoformat(self, sep: str = ..., timespec: str = ...) -> str: ...
    207     else:
    208         def isoformat(self, sep: str = ...) -> str: ...
    209     @classmethod
    210     def strptime(cls, date_string: str, format: str) -> datetime: ...
    211     def utcoffset(self) -> Optional[timedelta]: ...
    212     def tzname(self) -> Optional[str]: ...
    213     def dst(self) -> Optional[int]: ...
    214     def __le__(self, other: datetime) -> bool: ...
    215     def __lt__(self, other: datetime) -> bool: ...
    216     def __ge__(self, other: datetime) -> bool: ...
    217     def __gt__(self, other: datetime) -> bool: ...
    218     def __add__(self, other: timedelta) -> datetime: ...
    219     @overload
    220     def __sub__(self, other: datetime) -> timedelta: ...
    221     @overload
    222     def __sub__(self, other: timedelta) -> datetime: ...
    223     def __hash__(self) -> int: ...
    224     def weekday(self) -> int: ...
    225     def isoweekday(self) -> int: ...
    226     def isocalendar(self) -> Tuple[int, int, int]: ...
    python:datetime
    每天更新一点点,温习一点点点,进步一点点
  • 相关阅读:
    Python基础之逻辑运算符
    Python基础之赋值运算符
    Python基础之算术运算符
    Python基础之格式化输出
    Python基础之while循环
    Python基础之if语句
    Python基础之注释
    Python基础之变量和常量
    Python基础之Python解释器
    Flask-登录练习
  • 原文地址:https://www.cnblogs.com/lmgsanm/p/8379754.html
Copyright © 2011-2022 走看看