Rephrase problematic Optional[Type[JSONEncoder]] (for Python < 3.5.3)
On Ubuntu 16.04, which has Python 3.5.2, this raised `TypeError: descriptor '__subclasses__' of 'type' object needs an argument` (https://github.com/python/typing/issues/266). Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
committed by
Sergey Petrov
parent
88ee900854
commit
a3c5b48cef
+2
-3
@@ -5,9 +5,8 @@ import time
|
|||||||
import typing
|
import typing
|
||||||
import weakref
|
import weakref
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from json import JSONEncoder
|
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from typing import Dict, Iterable, Optional, Tuple, Type, Union
|
from typing import Dict, Iterable, Optional, Tuple, Union
|
||||||
|
|
||||||
from .credentials import CertificateCredentials, Credentials
|
from .credentials import CertificateCredentials, Credentials
|
||||||
from .errors import ConnectionFailed, exception_class_for_reason
|
from .errors import ConnectionFailed, exception_class_for_reason
|
||||||
@@ -50,7 +49,7 @@ class APNsClient(object):
|
|||||||
def __init__(self,
|
def __init__(self,
|
||||||
credentials: Union[Credentials, str],
|
credentials: Union[Credentials, str],
|
||||||
use_sandbox: bool = False, use_alternative_port: bool = False, proto: Optional[str] = None,
|
use_sandbox: bool = False, use_alternative_port: bool = False, proto: Optional[str] = None,
|
||||||
json_encoder: Optional[Type[JSONEncoder]] = None, password: Optional[str] = None,
|
json_encoder: Optional[type] = None, password: Optional[str] = None,
|
||||||
proxy_host: Optional[str] = None, proxy_port: Optional[int] = None,
|
proxy_host: Optional[str] = None, proxy_port: Optional[int] = None,
|
||||||
heartbeat_period: Optional[float] = None) -> None:
|
heartbeat_period: Optional[float] = None) -> None:
|
||||||
if isinstance(credentials, str):
|
if isinstance(credentials, str):
|
||||||
|
|||||||
Reference in New Issue
Block a user