mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-30 22:55:24 +08:00
implement some minor 3.7 features (#1966)
References: - https://docs.python.org/dev/library/datetime.html#datetime.datetime.fromisoformat - https://docs.python.org/dev/library/crypt.html#crypt.mksalt - https://docs.python.org/dev/library/contextlib.html#contextlib.AbstractAsyncContextManager - https://docs.python.org/dev/library/calendar.html#calendar.HTMLCalendar.cssclasses - https://docs.python.org/dev/library/binascii.html#binascii.b2a_uu Part of #1965.
This commit is contained in:
@@ -21,7 +21,10 @@ else:
|
||||
_Ascii = Union[bytes, Text]
|
||||
|
||||
def a2b_uu(string: _Ascii) -> bytes: ...
|
||||
def b2a_uu(data: _Bytes) -> bytes: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
def b2a_uu(data: _Bytes, *, backtick: bool = ...) -> bytes: ...
|
||||
else:
|
||||
def b2a_uu(data: _Bytes) -> bytes: ...
|
||||
def a2b_base64(string: _Ascii) -> bytes: ...
|
||||
if sys.version_info >= (3, 6):
|
||||
def b2a_base64(data: _Bytes, *, newline: bool = ...) -> bytes: ...
|
||||
|
||||
@@ -65,6 +65,14 @@ class HTMLCalendar(Calendar):
|
||||
def formatmonth(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ...
|
||||
def formatyear(self, theyear: int, width: int = ...) -> str: ...
|
||||
def formatyearpage(self, theyear: int, width: int = ..., css: Optional[str] = ..., encoding: Optional[str] = ...) -> str: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
cssclasses: List[str]
|
||||
cssclass_today: str
|
||||
cssclasses_weekday_head: List[str]
|
||||
cssclass_month_head: str
|
||||
cssclass_month: str
|
||||
cssclass_year: str
|
||||
cssclass_year_head: str
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
class TimeEncoding:
|
||||
|
||||
@@ -14,6 +14,8 @@ if sys.version_info >= (3, 5):
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
from typing import ContextManager as AbstractContextManager
|
||||
if sys.version_info >= (3, 7):
|
||||
from typing import AsyncContextManager as AbstractAsyncContextManager
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
|
||||
@@ -9,10 +9,15 @@ if sys.version_info >= (3, 3):
|
||||
METHOD_MD5: _Method
|
||||
METHOD_SHA256: _Method
|
||||
METHOD_SHA512: _Method
|
||||
if sys.version_info >= (3, 7):
|
||||
METHOD_BLOWFISH: _Method
|
||||
|
||||
methods: List[_Method]
|
||||
|
||||
def mksalt(method: Optional[_Method] = ...) -> str: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
def mksalt(method: Optional[_Method] = ..., *, rounds: Optional[int] = ...) -> str: ...
|
||||
else:
|
||||
def mksalt(method: Optional[_Method] = ...) -> str: ...
|
||||
def crypt(word: str, salt: Optional[Union[str, _Method]] = ...) -> str: ...
|
||||
else:
|
||||
def crypt(word: str, salt: str) -> str: ...
|
||||
|
||||
@@ -223,6 +223,9 @@ class datetime:
|
||||
else:
|
||||
@classmethod
|
||||
def combine(cls, date: date, time: time) -> datetime: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
@classmethod
|
||||
def fromisoformat(cls, date_string: str) -> datetime: ...
|
||||
def strftime(self, fmt: _Text) -> str: ...
|
||||
if sys.version_info >= (3,):
|
||||
def __format__(self, fmt: str) -> str: ...
|
||||
|
||||
Reference in New Issue
Block a user