Add type annotations (PEP 484) (#25)
This commit is contained in:
+5
-2
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user