Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/utils.py
Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | if isinstance(date, list): | ||||
date = date[0] | date = date[0] | ||||
if isinstance(date, str): | if isinstance(date, str): | ||||
date = iso8601.parse_date(date) | date = iso8601.parse_date(date) | ||||
tstz = TimestampWithTimezone.from_dict(date) | tstz = TimestampWithTimezone.from_dict(date) | ||||
return { | return { | ||||
"timestamp": tstz.timestamp.to_dict(), | "timestamp": tstz.timestamp.to_dict(), | ||||
"offset": tstz.offset, | "offset": tstz.offset_minutes(), | ||||
} | } | ||||
def compute_metadata_context(swhid_reference: QualifiedSWHID) -> Dict[str, Any]: | def compute_metadata_context(swhid_reference: QualifiedSWHID) -> Dict[str, Any]: | ||||
"""Given a SWHID object, determine the context as a dict. | """Given a SWHID object, determine the context as a dict. | ||||
""" | """ | ||||
metadata_context: Dict[str, Any] = {"origin": None} | metadata_context: Dict[str, Any] = {"origin": None} | ||||
▲ Show 20 Lines • Show All 130 Lines • Show Last 20 Lines |