mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
Simplify base64 input and output parameters. (#2587)
This allows passing bytearray() objects to the base64 encode and decode functions, on both Python 2.7 and 3.4. This also simplifies the code by ignoring 3.2 and 3.3, which are out of scope.
This commit is contained in:
committed by
Sebastian Rittau
parent
744f572c68
commit
0ebba82bfc
@@ -4,17 +4,11 @@ from typing import IO, Union, Text
|
||||
import sys
|
||||
|
||||
if sys.version_info < (3,):
|
||||
_encodable = Union[bytes, Text]
|
||||
_decodable = Union[bytes, Text]
|
||||
elif sys.version_info < (3, 3):
|
||||
_encodable = bytes
|
||||
_decodable = bytes
|
||||
elif sys.version_info[:2] == (3, 3):
|
||||
_encodable = Union[bytes, unicode]
|
||||
_decodable = Union[bytes, unicode]
|
||||
else:
|
||||
_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 = ...,
|
||||
|
||||
Reference in New Issue
Block a user