Skip to content

Commit

Permalink
fix(repo): Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
devsjc committed Nov 14, 2024
1 parent b1bc468 commit 4066c3b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
import numpy as np
import xarray as xr
from joblib import delayed
from returns.result import Failure, Result, ResultE, Success
from returns.result import Failure, ResultE, Success

from nwp_consumer.internal import entities, ports

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def fetch_init_data(
return
try:
data = json.loads(
response.read().decode(response.info().get_param("charset") or "utf-8"),
response.read().decode(response.info().get_param("charset") or "utf-8"), # type: ignore
)
except Exception as e:
yield delayed(Failure(
Expand Down Expand Up @@ -197,10 +197,10 @@ def _download(self, url: str) -> ResultE[pathlib.Path]:
timeout=60,
)
except Exception as e:
return Failure(
return Failure(OSError(
"Unable to request file data from MetOffice DataHub at "
f"'{url}': {e}",
)
))

# Download the file
log.debug("Downloading %s to %s", url, local_path)
Expand All @@ -220,7 +220,7 @@ def _download(self, url: str) -> ResultE[pathlib.Path]:
),
)

return Success(local_path)
return Success(local_path)

@staticmethod
def _convert(path: pathlib.Path) -> ResultE[list[xr.DataArray]]:
Expand Down Expand Up @@ -270,7 +270,7 @@ def _convert(path: pathlib.Path) -> ResultE[list[xr.DataArray]]:

try:
da: xr.DataArray = (
ds.pipe(MetOfficeDatahubModelRepository._rename_or_drop_vars, )
ds.pipe(MetOfficeDatahubModelRepository._rename_or_drop_vars )
.rename(name_dict={"time": "init_time"})
.expand_dims(dim="init_time")
.expand_dims(dim="step")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import dataclasses
import datetime as dt
import os
import unittest

from returns.pipeline import flow, is_successful
from returns.pointfree import bind
from returns.pipeline import is_successful

from nwp_consumer.internal import entities
from .mo_datahub import MetOfficeDatahubModelRepository


class TestMetOfficeDatahubModelRepository(unittest.TestCase):
"""Test the business methods of the MetOfficeDatahubModelRepository class."""

Expand Down

0 comments on commit 4066c3b

Please sign in to comment.