Skip to content

Commit 3ff1ce6

Browse files
committed
chore: updated oceanprotocol-job-details version
1 parent 9af1c53 commit 3ff1ce6

6 files changed

Lines changed: 51 additions & 122 deletions

File tree

.DS_Store

6 KB
Binary file not shown.

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@ repos:
1919

2020
- id: ruff
2121
name: ruff
22-
entry: ruff check --fix
22+
entry: uv run ruff check --fix
2323
language: system
2424
types: [python]
2525
require_serial: true
2626

2727
- id: ruff-format
2828
name: ruff-format
29-
entry: ruff format
29+
entry: uv run ruff format
3030
language: system
3131
types: [python]
3232
require_serial: true
3333

34-
- id: mypy
35-
name: mypy
36-
entry: mypy
34+
- id: ty
35+
name: ty
36+
entry: uv run ty check
3737
language: system
3838
types: [python]
3939
exclude: ^tests/|test_.*\.py$

ocean_runner/runner.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@
1818
)
1919

2020
from oceanprotocol_job_details import (
21+
EmptyInputParameters,
2122
EmptyJobDetails,
2223
ParametrizedJobDetails,
2324
load_job_details,
2425
run_in_executor,
2526
)
2627
from oceanprotocol_job_details.ocean import _BaseJobDetails
2728
from pydantic import BaseModel, JsonValue
28-
from returns.result import Failure, Success
2929
from typing_extensions import override
3030

3131
from ocean_runner.config import Config
3232

33-
InputT = TypeVar("InputT", bound=BaseModel | None)
33+
InputT = TypeVar("InputT", bound=BaseModel)
3434
ResultT = TypeVar("ResultT")
3535
T = TypeVar("T")
3636

@@ -251,19 +251,18 @@ class ParametrizedAlgorithm(Algorithm[InputT, ResultT]):
251251
@override
252252
@cached_property
253253
def job_details(self) -> ParametrizedJobDetails[InputT]:
254-
match self._job_details.read():
255-
case Success(parametrized_job_details):
256-
return parametrized_job_details
257-
case Failure(error):
258-
raise error
259-
case _: # pragma: no cover
260-
raise RuntimeError("Unreachable code")
254+
result = self._job_details.read()
261255

256+
if isinstance(result, Exception):
257+
raise result
262258

263-
class EmptyAlgorithm(Algorithm[None, ResultT]):
259+
return result
260+
261+
262+
class EmptyAlgorithm(Algorithm[EmptyInputParameters, ResultT]):
264263
"""For algorithms with no custom parameters"""
265264

266265
@override
267266
@cached_property
268-
def job_details(self) -> EmptyJobDetails[None]:
269-
return cast(EmptyJobDetails[None], self._job_details)
267+
def job_details(self) -> EmptyJobDetails[EmptyInputParameters]:
268+
return cast(EmptyJobDetails[EmptyInputParameters], self._job_details)

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ classifiers = [
1616
]
1717
dependencies = [
1818
"aiofiles>=25.1.0",
19-
"oceanprotocol-job-details>=0.4.4",
19+
"oceanprotocol-job-details>=0.4.5",
2020
"pydantic>=2.12.5",
2121
"pydantic-settings>=2.12.0",
22-
"returns[compatible-mypy]>=0.26.0",
2322
]
2423

2524
[project.urls]
@@ -42,12 +41,12 @@ build-backend = "hatchling.build"
4241
[dependency-groups]
4342
dev = [
4443
"coverage-badge>=1.1.2",
45-
"mypy<1.18.0",
4644
"pre-commit>=4.5.1",
4745
"pytest>=9.0.2",
4846
"pytest-cov>=7.0.0",
4947
"pytest-mock>=3.15.1",
5048
"ruff>=0.14.14",
49+
"ty>=0.0.29",
5150
"types-aiofiles>=25.1.0.20251011",
5251
]
5352

tests/test_runner.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
from returns.result import Failure
2-
from unittest.mock import patch
31
import logging
42
from functools import partial
53
from pathlib import Path
4+
from unittest.mock import patch
65

76
import aiofiles
87
from pydantic import BaseModel
@@ -84,10 +83,7 @@ class MockError(Exception): ...
8483
algorithm = Algorithm[CustomInput, int].create(config)
8584
algorithm.load()
8685

87-
with patch(
88-
"oceanprotocol_job_details.JobDetails.read",
89-
return_value=Failure(MockError()),
90-
):
86+
with patch("oceanprotocol_job_details.JobDetails.read", return_value=MockError()):
9187
with raises(MockError):
9288
algorithm.job_details
9389

0 commit comments

Comments
 (0)