From a3c5b48cefef05b81cbbfe60b8d2f926135767f3 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Thu, 3 Oct 2019 17:53:35 -0700 Subject: [PATCH] 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 --- apns2/client.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apns2/client.py b/apns2/client.py index 9a5d174..7774240 100644 --- a/apns2/client.py +++ b/apns2/client.py @@ -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):