nexus-extensibility 2.0.0b47__py3-none-any.whl → 2.0.0b48__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.
@@ -2,8 +2,8 @@ import enum
2
2
  from abc import ABC, abstractmethod
3
3
  from dataclasses import dataclass
4
4
  from datetime import datetime
5
- from typing import (Any, Awaitable, Callable, Dict, Generic, List, Optional,
6
- Protocol, Tuple, TypeVar)
5
+ from typing import (Any, Awaitable, Callable, Generic, Optional, Protocol,
6
+ TypeVar)
7
7
  from urllib.parse import ParseResult
8
8
 
9
9
  from ._data_model import CatalogItem, CatalogRegistration, ResourceCatalog
@@ -57,9 +57,25 @@ class DataSourceContext(Generic[T]):
57
57
  source_configuration: T
58
58
  """The source configuration."""
59
59
 
60
- request_configuration: Optional[Dict[str, Any]]
60
+ request_configuration: Optional[dict[str, Any]]
61
61
  """The request configuration."""
62
62
 
63
+ @dataclass(frozen=True)
64
+ class CatalogTimeRange:
65
+ """
66
+ A data source time range.
67
+
68
+ Args:
69
+ begin: The date/time of the first data in the catalog.
70
+ end: The date/time of the last data in the catalog.
71
+ """
72
+
73
+ begin: datetime
74
+ """The date/time of the first data in the catalog."""
75
+
76
+ end: datetime
77
+ """The date/time of the last data in the catalog."""
78
+
63
79
  @dataclass(frozen=True)
64
80
  class ReadRequest:
65
81
  """
@@ -120,7 +136,7 @@ class IDataSource(Generic[T], ABC):
120
136
  pass
121
137
 
122
138
  @abstractmethod
123
- def get_catalog_registrations(self, path: str) -> Awaitable[List[CatalogRegistration]]:
139
+ def get_catalog_registrations(self, path: str) -> Awaitable[list[CatalogRegistration]]:
124
140
  """
125
141
  Gets the catalog registrations that are located under path.
126
142
 
@@ -140,7 +156,7 @@ class IDataSource(Generic[T], ABC):
140
156
  pass
141
157
 
142
158
  @abstractmethod
143
- def get_time_range(self, catalog_id: str) -> Awaitable[Tuple[datetime, datetime]]:
159
+ def get_time_range(self, catalog_id: str) -> Awaitable[CatalogTimeRange]:
144
160
  """
145
161
  Gets the time range of the ResourceCatalog.
146
162
 
@@ -214,15 +230,15 @@ class SimpleDataSource(Generic[T], IDataSource[T], ABC):
214
230
  self.Logger = logger
215
231
 
216
232
  @abstractmethod
217
- def get_catalog_registrations(self, path: str) -> Awaitable[List[CatalogRegistration]]:
233
+ def get_catalog_registrations(self, path: str) -> Awaitable[list[CatalogRegistration]]:
218
234
  pass
219
235
 
220
236
  @abstractmethod
221
237
  def enrich_catalog(self, catalog: ResourceCatalog) -> Awaitable[ResourceCatalog]:
222
238
  pass
223
239
 
224
- async def get_time_range(self, catalog_id: str) -> Tuple[datetime, datetime]:
225
- return (datetime.min, datetime.max)
240
+ async def get_time_range(self, catalog_id: str) -> CatalogTimeRange:
241
+ return CatalogTimeRange(datetime.min, datetime.max)
226
242
 
227
243
  async def get_availability(self, catalog_id: str, begin: datetime, end: datetime) -> float:
228
244
  return float("NaN")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nexus-extensibility
3
- Version: 2.0.0b47
3
+ Version: 2.0.0b48
4
4
  Summary: Type definitions to implement data sources for the Nexus system.
5
5
  Home-page: https://github.com/nexus-main/nexus
6
6
  Author: https://github.com/nexus-main
@@ -2,9 +2,9 @@ nexus_extensibility/__init__.py,sha256=temuSqvUeZusU_0j-QoRalMIDfCHm9JP8W6jEO280
2
2
  nexus_extensibility/_data_model.py,sha256=HBuH2ftXAq_a5pJWc5UtqbEEcQIVAolz3xLUYgAHyk0,11964
3
3
  nexus_extensibility/_data_model_extensions.py,sha256=iLSOVDKvVoorj2h0x_XHGhbKwd_NHtrURgS7aUVe8MI,670
4
4
  nexus_extensibility/_data_model_utilities.py,sha256=cb_uJD4CeYz1m7NEttQ7kR3nrcMjovJQCrSUchnglQE,377
5
- nexus_extensibility/_extensibility_data_source.py,sha256=w2LTMMpBXNeNasaF_7YnhNBP_GZ15bk5JW8sFpTHwaI,7530
5
+ nexus_extensibility/_extensibility_data_source.py,sha256=Gz9Mi8EWeBX7Enaq_3LYkKeXOBeMFhw-OEhGpxOpHPU,7893
6
6
  nexus_extensibility/_extensibility_utilities.py,sha256=hQFcY2joHt1goJSCvMfEW5cprN1I-B1-SihqYme8R1A,786
7
- nexus_extensibility-2.0.0b47.dist-info/METADATA,sha256=f7qtfAi5diLDRJzneDSGeasp95Fnz7gHKvI7fPyVRGM,775
8
- nexus_extensibility-2.0.0b47.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
9
- nexus_extensibility-2.0.0b47.dist-info/top_level.txt,sha256=GTaw9wgS6EKrgO6FhJ3YZuMrkgoK7kP-hW9uybPDbyg,20
10
- nexus_extensibility-2.0.0b47.dist-info/RECORD,,
7
+ nexus_extensibility-2.0.0b48.dist-info/METADATA,sha256=oTkOKtHOHlfjBvM9Z61OEaVef5UDeJGrfQIVSfVy3bU,775
8
+ nexus_extensibility-2.0.0b48.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
9
+ nexus_extensibility-2.0.0b48.dist-info/top_level.txt,sha256=GTaw9wgS6EKrgO6FhJ3YZuMrkgoK7kP-hW9uybPDbyg,20
10
+ nexus_extensibility-2.0.0b48.dist-info/RECORD,,