Add type annotations (PEP 484) (#25)

This commit is contained in:
Sergey Petrov
2019-07-29 01:26:15 +03:00
committed by GitHub
parent be7438a653
commit fde28abb04
9 changed files with 151 additions and 76 deletions
+5 -2
View File
@@ -1,3 +1,6 @@
from typing import Type, Optional
class APNsException(Exception):
pass
@@ -128,7 +131,7 @@ class MethodNotAllowed(InternalException):
class Unregistered(APNsException):
"""The device token is inactive for the specified topic."""
def __init__(self, timestamp=None):
def __init__(self, timestamp: Optional[str] = None) -> None:
super(Unregistered, self).__init__()
self.timestamp = timestamp
@@ -164,7 +167,7 @@ class Shutdown(APNsException):
pass
def exception_class_for_reason(reason):
def exception_class_for_reason(reason: str) -> Type[APNsException]:
return {
'BadCollapseId': BadCollapseId,
'BadDeviceToken': BadDeviceToken,