Skip to content

Commit

Permalink
🐛 datcore-adapter (Pennsieve API): filter out deleted files (#5254)
Browse files Browse the repository at this point in the history
Co-authored-by: Dustin Kaiser <[email protected]>
Co-authored-by: Sylvain <[email protected]>
  • Loading branch information
3 people authored Jan 19, 2024
1 parent c0e329d commit 12fd547
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from dataclasses import dataclass
from itertools import islice
from pathlib import Path
from typing import Any, Final, Optional, TypedDict, cast
from typing import Any, Final, TypedDict, cast

import boto3
from aiocache import SimpleMemoryCache
Expand Down Expand Up @@ -128,8 +128,8 @@ async def _request(
api_secret: str,
method: str,
path: str,
params: Optional[dict[str, Any]] = None,
json: Optional[dict[str, Any]] = None,
params: dict[str, Any] | None = None,
json: dict[str, Any] | None = None,
) -> Any:
response = await self.client.request(
method,
Expand Down Expand Up @@ -181,7 +181,7 @@ async def _get_dataset_packages(
page_size: int,
cursor: str,
) -> dict[str, Any]:
return cast(
packages = cast(
dict[str, Any],
await self._request(
api_key,
Expand All @@ -195,6 +195,10 @@ async def _get_dataset_packages(
},
),
)
packages["packages"] = [
f for f in packages["packages"] if f["content"]["state"] != "DELETED"
]
return packages

async def _get_package(
self, api_key: str, api_secret: str, package_id: str
Expand Down

0 comments on commit 12fd547

Please sign in to comment.