providers/saml: fix minor typing issue
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
"""passbook policy task"""
|
"""passbook policy task"""
|
||||||
from multiprocessing import Process
|
from multiprocessing import Process
|
||||||
from multiprocessing.connection import Connection
|
from multiprocessing.connection import Connection
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from structlog import get_logger
|
from structlog import get_logger
|
||||||
@ -12,7 +13,7 @@ from passbook.policies.types import PolicyRequest, PolicyResult
|
|||||||
LOGGER = get_logger()
|
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"""
|
"""Generate Cache key for policy"""
|
||||||
prefix = f"policy_{policy.pk}"
|
prefix = f"policy_{policy.pk}"
|
||||||
if user:
|
if user:
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
"""Time utilities"""
|
"""Time utilities"""
|
||||||
import datetime
|
import datetime
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
@ -38,7 +39,7 @@ def timedelta_from_string(expr: str) -> datetime.timedelta:
|
|||||||
return datetime.timedelta(**kwargs)
|
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"""
|
"""Get Data formatted in SAML format"""
|
||||||
if delta is None:
|
if delta is None:
|
||||||
delta = datetime.timedelta()
|
delta = datetime.timedelta()
|
||||||
|
|||||||
Reference in New Issue
Block a user