Skip to content

Commit

Permalink
fix code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jdelic committed Aug 13, 2024
1 parent a14368e commit ef4f417
Showing 1 changed file with 13 additions and 32 deletions.
45 changes: 13 additions & 32 deletions aptly_api/parts/mirrors.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,35 +38,19 @@ class MirrorsAPISection(BaseAPIClient):
@staticmethod
def mirror_from_response(api_response: Dict[str, str]) -> Mirror:
return Mirror(
uuid=cast(str, api_response["UUID"]
) if "UUID" in api_response else None,
name=cast(str, api_response["Name"]),
archiveurl=cast(
str, api_response["ArchiveRoot"]),
distribution=cast(
str, api_response["Distribution"])
if "Distribution" in api_response else None,
components=cast(List[str], api_response["Components"]
)if "Components" in api_response else None,
architectures=cast(List[str], api_response["Architectures"]
) if "Architectures" in api_response else None,
meta=cast(List[Dict[str, str]], api_response["Meta"]
) if "Meta" in api_response else None,
downloaddate=cast(
str, api_response["LastDownloadDate"])
if "LastDownloadDate" in api_response else None,
filter=cast(str, api_response["Filter"]
) if "Filter" in api_response else None,
status=cast(int, api_response["Status"]
)if "Status" in api_response else None,
worker_pid=cast(
int, api_response["WorkerPID"])
if "WorkerPID" in api_response else None,
uuid=cast(str, api_response["UUID"]) if "UUID" in api_response else None,
name=cast(str, api_response["Name"]), archiveurl=cast(str, api_response["ArchiveRoot"]),
distribution=cast(str, api_response["Distribution"]) if "Distribution" in api_response else None,
components=cast(List[str], api_response["Components"])if "Components" in api_response else None,
architectures=cast(List[str], api_response["Architectures"]) if "Architectures" in api_response else None,
meta=cast(List[Dict[str, str]], api_response["Meta"]) if "Meta" in api_response else None,
downloaddate=cast(str, api_response["LastDownloadDate"]) if "LastDownloadDate" in api_response else None,
filter=cast(str, api_response["Filter"]) if "Filter" in api_response else None,
status=cast(int, api_response["Status"])if "Status" in api_response else None,
worker_pid=cast(int, api_response["WorkerPID"]) if "WorkerPID" in api_response else None,
filter_with_deps=cast(bool, api_response["FilterWithDeps"]),
skip_component_check=cast(
bool, api_response["SkipComponentCheck"]),
skip_architecture_check=cast(
bool, api_response["SkipArchitectureCheck"]),
skip_component_check=cast(bool, api_response["SkipComponentCheck"]),
skip_architecture_check=cast(bool, api_response["SkipArchitectureCheck"]),
download_sources=cast(bool, api_response["DownloadSources"]),
download_udebs=cast(bool, api_response["DownloadUdebs"]),
download_installer=cast(bool, api_response["DownloadInstaller"])
Expand All @@ -77,9 +61,7 @@ def list(self) -> Sequence[Mirror]:

mirrors = []
for mirr in resp.json():
mirrors.append(
self.mirror_from_response(mirr)
)
mirrors.append(self.mirror_from_response(mirr))
return mirrors

def update(self, name: str, ignore_signatures: bool = False) -> None:
Expand Down Expand Up @@ -130,7 +112,6 @@ def edit(self, name: str, newname: Optional[str] = None, archiveurl: Optional[st

def show(self, name: str) -> Mirror:
resp = self.do_get("api/mirrors/%s" % (quote(name)))

return self.mirror_from_response(resp.json())

def list_packages(self, name: str, query: Optional[str] = None, with_deps: bool = False,
Expand Down

0 comments on commit ef4f417

Please sign in to comment.