mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
"> (3,)" works but looks like the code is checking for Python 4. "<= (3, 5)" was intended to check for versions up to and including 3.5, and probably works that way in current type checkers. However, sys.version_info is actually a 5-tuple that is greater than (3, 5), so a hypothetical type checker that uses the full version info would interpret this check incorrectly. This ensures that all version_info comparisons use <, >=, ==, or !=.
43 lines
1.7 KiB
Python
43 lines
1.7 KiB
Python
# Stubs for base64
|
|
|
|
from typing import IO, Union
|
|
import sys
|
|
|
|
|
|
if sys.version_info < (3, 3):
|
|
_encodable = bytes
|
|
_decodable = bytes
|
|
elif sys.version_info[:2] == (3, 3):
|
|
_encodable = bytes
|
|
_decodable = Union[bytes, str]
|
|
elif sys.version_info >= (3, 4):
|
|
_encodable = Union[bytes, bytearray, memoryview]
|
|
_decodable = Union[bytes, bytearray, memoryview, str]
|
|
|
|
def b64encode(s: _encodable, altchars: bytes = ...) -> bytes: ...
|
|
def b64decode(s: _decodable, altchars: bytes = ...,
|
|
validate: bool = ...) -> bytes: ...
|
|
def standard_b64encode(s: _encodable) -> bytes: ...
|
|
def standard_b64decode(s: _decodable) -> bytes: ...
|
|
def urlsafe_b64encode(s: _encodable) -> bytes: ...
|
|
def urlsafe_b64decode(s: _decodable) -> bytes: ...
|
|
def b32encode(s: _encodable) -> bytes: ...
|
|
def b32decode(s: _decodable, casefold: bool = ...,
|
|
map01: bytes = ...) -> bytes: ...
|
|
def b16encode(s: _encodable) -> bytes: ...
|
|
def b16decode(s: _decodable, casefold: bool = ...) -> bytes: ...
|
|
if sys.version_info >= (3, 4):
|
|
def a85encode(b: _encodable, *, foldspaces: bool = ..., wrapcol: int = ...,
|
|
pad: bool = ..., adobe: bool = ...) -> bytes: ...
|
|
def a85decode(b: _decodable, *, foldspaces: bool = ...,
|
|
adobe: bool = ..., ignorechars: Union[str, bytes] = ...) -> bytes: ...
|
|
def b85encode(b: _encodable, pad: bool = ...) -> bytes: ...
|
|
def b85decode(b: _decodable) -> bytes: ...
|
|
|
|
def decode(input: IO[bytes], output: IO[bytes]) -> None: ...
|
|
def decodebytes(s: bytes) -> bytes: ...
|
|
def decodestring(s: bytes) -> bytes: ...
|
|
def encode(input: IO[bytes], output: IO[bytes]) -> None: ...
|
|
def encodebytes(s: bytes) -> bytes: ...
|
|
def encodestring(s: bytes) -> bytes: ...
|