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:
Anders Kaseorg authored and Sergey Petrov committed 2019-10-08 22:49:46 +03:00
1 parent 88ee900854
commit a3c5b48cef
1 file changed
+2 -3
+2 -3
View File
@@ -5,9 +5,8 @@ import time
import typing
import weakref
from enum import Enum
from json import JSONEncoder
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 .errors import ConnectionFailed, exception_class_for_reason
@@ -50,7 +49,7 @@ class APNsClient(object):
def __init__(self,
credentials: Union[Credentials, str],
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,
heartbeat_period: Optional[float] = None) -> None:
if isinstance(credentials, str):