Skip to content

Commit bac5821

Browse files
Ruff format fixes
1 parent 8d18cf7 commit bac5821

6 files changed

Lines changed: 10 additions & 10 deletions

File tree

tilebox-datasets/tests/query/time_interval.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def datetime_scalar_for_datetime(draw: DrawFn, dt: datetime) -> DatetimeScalar:
4949
"""
5050
understood_formats = [
5151
lambda dt: dt, # converting a datetime to a datetime scalar should be a no-op
52-
lambda dt: pd.to_datetime(dt), # pandas Timestamp objects are also supported
52+
lambda dt: pd.to_datetime(dt), # noqa: PLW0108 # pandas Timestamp objects are also supported
5353
lambda dt: pd.to_datetime(dt).to_datetime64(), # and so are numpy datetime64 objects
5454
lambda dt: datetime_to_us(dt) * 10**3, # timestamp in nanoseconds
5555
# as well as strings in various formats

tilebox-datasets/tilebox/datasets/data/data_access.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ class SpatialFilter:
6262
def from_message(cls, filter_message: data_access_pb2.SpatialFilter) -> "SpatialFilter":
6363
return SpatialFilter(
6464
geometry=from_wkb(filter_message.geometry.wkb),
65-
mode=_filter_mode_int_to_enum.get(filter_message.mode, None),
66-
coordinate_system=_coordinate_system_int_to_enum.get(filter_message.coordinate_system, None),
65+
mode=_filter_mode_int_to_enum.get(filter_message.mode),
66+
coordinate_system=_coordinate_system_int_to_enum.get(filter_message.coordinate_system),
6767
)
6868

6969
def to_message(self) -> data_access_pb2.SpatialFilter:
@@ -91,10 +91,10 @@ def parse(cls, spatial_filter_like: SpatialFilterLike) -> "SpatialFilter":
9191
if isinstance(spatial_filter_like, dict):
9292
mode = spatial_filter_like.get("mode", None)
9393
if isinstance(mode, str):
94-
mode = _filter_modes_from_string.get(mode.lower(), None)
94+
mode = _filter_modes_from_string.get(mode.lower())
9595
coordinate_system = spatial_filter_like.get("coordinate_system", None)
9696
if isinstance(coordinate_system, str):
97-
coordinate_system = _coordinate_systems_from_string.get(coordinate_system.lower(), None)
97+
coordinate_system = _coordinate_systems_from_string.get(coordinate_system.lower())
9898
return SpatialFilter(
9999
geometry=spatial_filter_like["geometry"], mode=mode, coordinate_system=coordinate_system
100100
)

tilebox-datasets/tilebox/datasets/data/datasets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class DatasetType:
136136
@classmethod
137137
def from_message(cls, dataset_type: dataset_type_pb2.DatasetType) -> "DatasetType":
138138
return cls(
139-
kind=_dataset_kind_int_to_enum.get(dataset_type.kind, None),
139+
kind=_dataset_kind_int_to_enum.get(dataset_type.kind),
140140
fields=[Field.from_message(f) for f in dataset_type.fields],
141141
)
142142

tilebox-storage/tilebox/storage/aio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ async def writer(chunk: bytes) -> None:
209209
if progress is not None:
210210
progress.close()
211211

212-
output_dir.mkdir(parents=True, exist_ok=True)
212+
output_dir.mkdir(parents=True, exist_ok=True) # noqa: ASYNC240
213213
output_file = output_dir / url.rsplit("/", 1)[-1]
214214
shutil.move(download_file, output_file)
215215
return output_file

tilebox-storage/tilebox/storage/granule.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def from_data(cls, dataset: "xr.Dataset | ASFStorageGranule") -> "ASFStorageGran
5151

5252

5353
def _asf_download_urls(granule_name: str) -> StorageURLs:
54-
platform = granule_name.split("_")[0]
54+
platform = granule_name.split("_", maxsplit=1)[0]
5555
file_name = granule_name
5656
processing_level = "L0"
5757
quicklook = None
@@ -100,7 +100,7 @@ def _thumbnail_relative_to_eodata_location(thumbnail_url: str, location: str) ->
100100
"preview/thumbnail.png"
101101
"""
102102

103-
url_path = thumbnail_url.split("?path=")[-1]
103+
url_path = thumbnail_url.rsplit("?path=", maxsplit=1)[-1]
104104
url_path = url_path.removeprefix("/")
105105
location = location.removeprefix("/eodata/")
106106
return str(ObjectPath(url_path).relative_to(location))

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)