diff --git a/passbook/policies/process.py b/passbook/policies/process.py index 50cd4c1bd..64ccf4962 100644 --- a/passbook/policies/process.py +++ b/passbook/policies/process.py @@ -1,6 +1,7 @@ """passbook policy task""" from multiprocessing import Process from multiprocessing.connection import Connection +from typing import Optional from django.core.cache import cache from structlog import get_logger @@ -12,7 +13,7 @@ from passbook.policies.types import PolicyRequest, PolicyResult LOGGER = get_logger() -def cache_key(policy: Policy, user: User = None) -> str: +def cache_key(policy: Policy, user: Optional[User] = None) -> str: """Generate Cache key for policy""" prefix = f"policy_{policy.pk}" if user: diff --git a/passbook/providers/saml/utils/time.py b/passbook/providers/saml/utils/time.py index 3e88e0d93..2fe490ba9 100644 --- a/passbook/providers/saml/utils/time.py +++ b/passbook/providers/saml/utils/time.py @@ -1,5 +1,6 @@ """Time utilities""" import datetime +from typing import Optional from django.core.exceptions import ValidationError from django.utils.translation import gettext_lazy as _ @@ -38,7 +39,7 @@ def timedelta_from_string(expr: str) -> datetime.timedelta: return datetime.timedelta(**kwargs) -def get_time_string(delta: datetime.timedelta = None) -> str: +def get_time_string(delta: Optional[datetime.timedelta] = None) -> str: """Get Data formatted in SAML format""" if delta is None: delta = datetime.timedelta()