oceanprotocol-job-details 0.1.1__py3-none-any.whl → 0.1.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,8 @@
1
+ import json
1
2
  from dataclasses import InitVar, dataclass, field
2
3
  from pathlib import Path
3
4
  from typing import Iterator, Sequence, final
4
5
 
5
- import json
6
-
7
6
  from oceanprotocol_job_details.config import config
8
7
 
9
8
 
@@ -24,7 +23,14 @@ class DIDPaths:
24
23
 
25
24
  @dataclass(frozen=True)
26
25
  class Files:
27
- files: Sequence[DIDPaths]
26
+ _files: Sequence[DIDPaths]
27
+
28
+ @property
29
+ def files(self) -> Sequence[DIDPaths]:
30
+ return self._files
31
+
32
+ def __getitem__(self, index: int) -> DIDPaths:
33
+ return self.files[index]
28
34
 
29
35
  def __iter__(self) -> Iterator[DIDPaths]:
30
36
  return iter(self.files)
@@ -180,4 +180,15 @@ class JobDetails(Generic[T]):
180
180
  """Read the input parameters and return them in an instance of the dataclass T"""
181
181
 
182
182
  with open(config.path_algorithm_custom_parameters, "r") as f:
183
- return dataclass_json(self._type).from_json(f.read()) # type: ignore
183
+ raw = f.read().strip()
184
+ if not raw:
185
+ raise ValueError(
186
+ f"Custom parameters file {config.path_algorithm_custom_parameters} is empty"
187
+ )
188
+ try:
189
+ return dataclass_json(self._type).from_json(raw) # type: ignore
190
+ except Exception as e:
191
+ raise ValueError(
192
+ f"Failed to parse input paramers into {self._type.__name__}: {e}\n"
193
+ f"Raw content: {raw}"
194
+ ) from e
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oceanprotocol-job-details
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: A Python package to get details from OceanProtocol jobs
5
5
  Project-URL: Homepage, https://github.com/AgrospAI/oceanprotocol-job-details
6
6
  Project-URL: Issues, https://github.com/AgrospAI/oceanprotocol-job-details/issues
@@ -1,15 +1,15 @@
1
1
  oceanprotocol_job_details/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  oceanprotocol_job_details/config.py,sha256=lE9H8rRSF5RCJtMHMTAYf8CUYMyf9GPq0kiB2cT8-gE,1429
3
3
  oceanprotocol_job_details/job_details.py,sha256=98Uvx3jes1f75onYxT-65EOOOwcxdw32slAa3n1MqUc,1477
4
- oceanprotocol_job_details/ocean.py,sha256=zSy6DnMxUH8_geH_cZc6DEXQ0d_m_-J0120AvFPVPdA,3527
4
+ oceanprotocol_job_details/ocean.py,sha256=dFD_KaePWSNJ7gojrO950Vk66aGt1bdKVvQ5TZVXy2c,3975
5
5
  oceanprotocol_job_details/utils.py,sha256=btgys1g4AKSADsde_JRofPVmI0VbR_jf85DIYhuMhgs,940
6
6
  oceanprotocol_job_details/loaders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  oceanprotocol_job_details/loaders/loader.py,sha256=HIzsVKCuGP7ghfM7ppN3ANVybvsA64wr3h8I68mqS6A,195
8
8
  oceanprotocol_job_details/loaders/impl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  oceanprotocol_job_details/loaders/impl/ddo.py,sha256=LcKoDuGnZw8JW68Q5P9gWGYeZqszC97HxnkzOuorHBA,707
10
- oceanprotocol_job_details/loaders/impl/files.py,sha256=hiquES8Wz11XZHRCKlfcuOrv3FlZ6CFv9lPpPUh2zpM,1832
10
+ oceanprotocol_job_details/loaders/impl/files.py,sha256=hft3Y61D6eHpa9ZQ5i2C5tnCv9IZaTudOZaOIQUbkxo,2002
11
11
  oceanprotocol_job_details/loaders/impl/job_details.py,sha256=ERKQm1oH3jW8ebb8l4glL-Wm-9rV8mBfFalVvo0UomU,802
12
- oceanprotocol_job_details-0.1.1.dist-info/METADATA,sha256=7WM9J9ldqahurQCPjZ_akdqrr5kpFRkncp5mhoAIlxE,3141
13
- oceanprotocol_job_details-0.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
- oceanprotocol_job_details-0.1.1.dist-info/licenses/LICENSE,sha256=ni3ix7P_GxK1W3VGC4fJ3o6QoCngCEpSuTJwO4nkpbw,1055
15
- oceanprotocol_job_details-0.1.1.dist-info/RECORD,,
12
+ oceanprotocol_job_details-0.1.3.dist-info/METADATA,sha256=VC4s7hOfXzsE4vHIiVMot2q3IsoxurqX6H6qq77wWIc,3141
13
+ oceanprotocol_job_details-0.1.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
+ oceanprotocol_job_details-0.1.3.dist-info/licenses/LICENSE,sha256=ni3ix7P_GxK1W3VGC4fJ3o6QoCngCEpSuTJwO4nkpbw,1055
15
+ oceanprotocol_job_details-0.1.3.dist-info/RECORD,,