Skip to content

Commit 88ee900

Browse files
anderskPr0Ger
authored andcommitted
Don’t import typing.Deque at runtime (for Python < 3.5.4)
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 <[email protected]>
1 parent 2f02f0f commit 88ee900

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

apns2/client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
import json
33
import logging
44
import time
5+
import typing
56
import weakref
67
from enum import Enum
78
from json import JSONEncoder
89
from threading import Thread
9-
from typing import Deque, Dict, Iterable, Optional, Tuple, Type, Union
10+
from typing import Dict, Iterable, Optional, Tuple, Type, Union
1011

1112
from .credentials import CertificateCredentials, Credentials
1213
from .errors import ConnectionFailed, exception_class_for_reason
@@ -185,7 +186,7 @@ def send_notification_batch(self, notifications: Iterable[Notification], topic:
185186
self.connect()
186187

187188
results = {}
188-
open_streams = collections.deque() # type: Deque[RequestStream]
189+
open_streams = collections.deque() # type: typing.Deque[RequestStream]
189190
# Loop on the tokens, sending as many requests as possible concurrently to APNs.
190191
# When reaching the maximum concurrent streams limit, wait for a response before sending
191192
# another request.

0 commit comments

Comments
 (0)