From 88ee900854f8899d8286ea3716b73bf13c77bdec Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Thu, 3 Oct 2019 17:23:57 -0700 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20import=20typing.Deque=20at=20ru?= =?UTF-8?q?ntime=20(for=20Python=20<=203.5.4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Ubuntu 16.04, which has Python 3.5.2, `apns2.client` failed to import, because `typing.Deque` was not added until Python 3.5.4. Fixes #88. Signed-off-by: Anders Kaseorg --- apns2/client.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apns2/client.py b/apns2/client.py index f15352c..9a5d174 100644 --- a/apns2/client.py +++ b/apns2/client.py @@ -2,11 +2,12 @@ import collections import json import logging import time +import typing import weakref from enum import Enum from json import JSONEncoder from threading import Thread -from typing import Deque, Dict, Iterable, Optional, Tuple, Type, Union +from typing import Dict, Iterable, Optional, Tuple, Type, Union from .credentials import CertificateCredentials, Credentials from .errors import ConnectionFailed, exception_class_for_reason @@ -185,7 +186,7 @@ class APNsClient(object): self.connect() results = {} - open_streams = collections.deque() # type: Deque[RequestStream] + open_streams = collections.deque() # type: typing.Deque[RequestStream] # Loop on the tokens, sending as many requests as possible concurrently to APNs. # When reaching the maximum concurrent streams limit, wait for a response before sending # another request.