Changeset View
Changeset View
Standalone View
Standalone View
swh/graphql/utils/utils.py
Show All 21 Lines | def get_encoded_cursor(cursor: str) -> 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: str) -> str: | ||||
if cursor is None: | if cursor is None: | ||||
return None | return None | ||||
return base64.b64decode(cursor).decode(ENCODING) | return base64.b64decode(cursor, validate=True).decode() | ||||
def str_to_sha1(sha1: str) -> bytearray: | def str_to_sha1(sha1: str) -> bytearray: | ||||
# FIXME, use core function | # FIXME, use core function | ||||
return bytearray.fromhex(sha1) | return bytearray.fromhex(sha1) | ||||
def get_formatted_date(date: datetime) -> str: | def get_formatted_date(date: datetime) -> str: | ||||
Show All 20 Lines |