Skip to content

Commit 4377d24

Browse files
committed
minor code formatting cleanups
mix of `ruff format` and some manual fixes
1 parent 71bf07a commit 4377d24

2 files changed

Lines changed: 9 additions & 14 deletions

File tree

‎openeo/metadata.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def __init__(self, type: str, name: str):
4646
def __repr__(self):
4747
return "{c}({f})".format(
4848
c=self.__class__.__name__,
49-
f=", ".join("{k!s}={v!r}".format(k=k, v=v) for (k, v) in self.__dict__.items())
49+
f=", ".join("{k!s}={v!r}".format(k=k, v=v) for (k, v) in self.__dict__.items()),
5050
)
5151

5252
def __eq__(self, other):
@@ -201,7 +201,7 @@ def filter_bands(self, bands: List[Union[int, str]]) -> BandDimension:
201201
"""
202202
return BandDimension(
203203
name=self.name,
204-
bands=[self.bands[self.band_index(b)] for b in bands]
204+
bands=[self.bands[self.band_index(b)] for b in bands],
205205
)
206206

207207
def append_band(self, band: Union[Band, str]) -> BandDimension:
@@ -213,7 +213,7 @@ def append_band(self, band: Union[Band, str]) -> BandDimension:
213213

214214
return BandDimension(
215215
name=self.name,
216-
bands=self.bands + [band]
216+
bands=self.bands + [band],
217217
)
218218

219219
def rename_labels(self, target, source) -> Dimension:
@@ -994,7 +994,7 @@ def bands_from_stac_collection(
994994
elif _PYSTAC_1_12_ITEM_ASSETS and collection.item_assets:
995995
return self._bands_from_item_assets(collection.item_assets)
996996
elif (
997-
collection.ext.has("item_assets")
997+
collection.ext.has("item_assets")
998998
and collection.extra_fields.get("item-assets")
999999
and collection.ext.item_assets
10001000
):

‎openeo/rest/_datacube.py‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def _build_pgnode(
8888
process_id: str,
8989
arguments: Optional[dict] = None,
9090
namespace: Optional[str] = None,
91-
**kwargs
91+
**kwargs,
9292
) -> PGNode:
9393
"""
9494
Helper to build a PGNode from given argument dict and/or kwargs,
@@ -213,9 +213,7 @@ def from_file(
213213
"""
214214
path = pathlib.Path(path)
215215
code = path.read_text(encoding="utf-8")
216-
return cls(
217-
code=code, runtime=runtime, version=version, context=context, _source=path
218-
)
216+
return cls(code=code, runtime=runtime, version=version, context=context, _source=path)
219217

220218
@classmethod
221219
def from_url(
@@ -239,9 +237,7 @@ def from_url(
239237
resp = requests.get(url)
240238
resp.raise_for_status()
241239
code = resp.text
242-
return cls(
243-
code=code, runtime=runtime, version=version, context=context, _source=url
244-
)
240+
return cls(code=code, runtime=runtime, version=version, context=context, _source=url)
245241

246242
def _guess_runtime(self, connection: Optional[Connection] = None) -> str:
247243
"""Guess UDF runtime from UDF source (path) or source code."""
@@ -250,9 +246,7 @@ def _guess_runtime(self, connection: Optional[Connection] = None) -> str:
250246
if isinstance(self._source, pathlib.Path):
251247
language = self._guess_runtime_from_suffix(self._source.suffix)
252248
elif isinstance(self._source, str):
253-
url_match = re.match(
254-
r"https?://.*?(?P<suffix>\.\w+)([&#].*)?$", self._source
255-
)
249+
url_match = re.match(r"https?://.*?(?P<suffix>\.\w+)([&#].*)?$", self._source)
256250
if url_match:
257251
language = self._guess_runtime_from_suffix(url_match.group("suffix"))
258252
if not language:
@@ -316,6 +310,7 @@ def build_child_callback(
316310
# Assume given reducer is a simple predefined reduce process_id
317311
# TODO: avoid local import (workaround for circular import issue)
318312
import openeo.processes
313+
319314
if process in openeo.processes.__dict__:
320315
process_params = get_parameter_names(openeo.processes.__dict__[process])
321316
# TODO: switch to "Callable" handling here

0 commit comments

Comments
 (0)