in client/securedrop_client/sdk/sdlocalobjects.py [0:0]
def __init__(self, **kwargs) -> None: # type: ignore
self.download_url = "" # type: str
self.filename = "" # type: str
self.is_read = False # type: bool
self.size = 0 # type: int
self.source_url = "" # type: str
self.source_uuid = "" # type: str
self.submission_url = "" # type: str
self.uuid = "" # type: str
if list(kwargs.keys()) == ["uuid"]:
# Means we are creating an object only for fetching from server.
self.uuid = kwargs["uuid"]
return
elif list(kwargs.keys()) == ["uuid", "source_uuid"]:
self.uuid = kwargs["uuid"]
self.source_uuid = kwargs["source_uuid"]
return
try:
self.download_url = kwargs["download_url"]
self.filename = kwargs["filename"]
self.is_read = kwargs["is_read"]
self.size = kwargs["size"]
self.source_url = kwargs["source_url"]
self.submission_url = kwargs["submission_url"]
self.uuid = kwargs["uuid"]
self.seen_by = kwargs["seen_by"]
except KeyError as err:
raise AttributeError(f"Missing key {err.args[0]}") from err
_, self.source_uuid = self.source_url.rsplit("/", 1)