Changeset View
Changeset View
Standalone View
Standalone View
swh/graphql/utils/utils.py
Show All 18 Lines | |||||
def get_encoded_cursor(cursor: Optional[str]) -> Optional[str]: | def get_encoded_cursor(cursor: Optional[str]) -> Optional[str]: | ||||
if cursor is None: | if cursor is None: | ||||
return None | return None | ||||
return get_b64_string(cursor) | return get_b64_string(cursor) | ||||
def get_decoded_cursor(cursor: str) -> str: | def get_decoded_cursor(cursor: Optional[str]) -> Optional[str]: | ||||
if cursor is None: | if cursor is None: | ||||
return None | return None | ||||
return base64.b64decode(cursor, validate=True).decode() | return base64.b64decode(cursor, validate=True).decode() | ||||
def get_formatted_date(date: datetime) -> str: | def get_formatted_date(date: datetime) -> str: | ||||
# FIXME, handle error + return other formats | # FIXME, handle error + return other formats | ||||
return date.isoformat() | return date.isoformat() | ||||
Show All 18 Lines |