Skip to content

Commit 74ead07

Browse files
committed
refactor according to ruff checks
1 parent 16e1166 commit 74ead07

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

deep_code/tests/utils/test_dataset_stac_generator.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,14 @@ def test_build_zarr_stac_item_structure(self):
232232
self.assertIn("collection", link_rels)
233233

234234
# root and parent point to the S3 catalog
235-
root_link = next(l for l in item.links if l.rel == "root")
235+
root_link = next(lnk for lnk in item.links if lnk.rel == "root")
236236
self.assertEqual(
237237
root_link.target,
238238
"s3://test-bucket/stac/my-collection/catalog.json",
239239
)
240240

241241
# collection link points to the OSC GitHub collection
242-
coll_link = next(l for l in item.links if l.rel == "collection")
242+
coll_link = next(lnk for lnk in item.links if lnk.rel == "collection")
243243
self.assertIn("open-science-catalog-metadata", coll_link.target)
244244
self.assertIn("mock-collection-id", coll_link.target)
245245

@@ -286,9 +286,9 @@ def test_build_dataset_stac_collection_adds_s3_catalog_child_link(self):
286286
collection = self.generator.build_dataset_stac_collection(
287287
mode="dataset", stac_catalog_s3_root=s3_root
288288
)
289-
child_links = [l for l in collection.links if l.rel == "child"]
289+
child_links = [lnk for lnk in collection.links if lnk.rel == "child"]
290290
s3_child = next(
291-
(l for l in child_links if "s3://" in str(l.target)), None
291+
(lnk for lnk in child_links if "s3://" in str(lnk.target)), None
292292
)
293293
self.assertIsNotNone(s3_child, "Expected a child link pointing to S3 catalog")
294294
self.assertEqual(
@@ -300,9 +300,9 @@ def test_build_dataset_stac_collection_no_s3_child_link_by_default(self):
300300
"""No S3 child link is added when stac_catalog_s3_root is absent."""
301301
collection = self.generator.build_dataset_stac_collection(mode="dataset")
302302
s3_child_links = [
303-
l
304-
for l in collection.links
305-
if l.rel == "child" and "s3://" in str(getattr(l, "target", ""))
303+
lnk
304+
for lnk in collection.links
305+
if lnk.rel == "child" and "s3://" in str(getattr(lnk, "target", ""))
306306
]
307307
self.assertEqual(len(s3_child_links), 0)
308308

deep_code/utils/dataset_stac_generator.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from datetime import datetime, timezone
88

99
import pandas as pd
10-
import pystac
1110
from pystac import Catalog, Collection, Extent, Item, Asset, Link, SpatialExtent, TemporalExtent
1211

1312
from deep_code.constants import (

0 commit comments

Comments
 (0)