nexus-extensibility 2.0.0b47__py3-none-any.whl → 2.0.0b49__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.
- nexus_extensibility/_extensibility_data_source.py +25 -9
- {nexus_extensibility-2.0.0b47.dist-info → nexus_extensibility-2.0.0b49.dist-info}/METADATA +1 -1
- {nexus_extensibility-2.0.0b47.dist-info → nexus_extensibility-2.0.0b49.dist-info}/RECORD +5 -5
- {nexus_extensibility-2.0.0b47.dist-info → nexus_extensibility-2.0.0b49.dist-info}/WHEEL +0 -0
- {nexus_extensibility-2.0.0b47.dist-info → nexus_extensibility-2.0.0b49.dist-info}/top_level.txt +0 -0
@@ -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,
|
6
|
-
|
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[
|
60
|
+
request_configuration: Optional[dict[str, Any]]
|
61
61
|
"""The request configuration."""
|
62
62
|
|
63
|
+
@dataclass(frozen=True)
|
64
|
+
class CatalogTimeRange:
|
65
|
+
"""
|
66
|
+
A catalog 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
|
"""
|
@@ -103,6 +119,7 @@ class ReadDataHandler(Protocol):
|
|
103
119
|
|
104
120
|
################# DATA SOURCE ###############
|
105
121
|
|
122
|
+
# use this syntax in future (3.12+): IDataSource[T](ABC)
|
106
123
|
class IDataSource(Generic[T], ABC):
|
107
124
|
"""
|
108
125
|
A data source.
|
@@ -120,7 +137,7 @@ class IDataSource(Generic[T], ABC):
|
|
120
137
|
pass
|
121
138
|
|
122
139
|
@abstractmethod
|
123
|
-
def get_catalog_registrations(self, path: str) -> Awaitable[
|
140
|
+
def get_catalog_registrations(self, path: str) -> Awaitable[list[CatalogRegistration]]:
|
124
141
|
"""
|
125
142
|
Gets the catalog registrations that are located under path.
|
126
143
|
|
@@ -140,7 +157,7 @@ class IDataSource(Generic[T], ABC):
|
|
140
157
|
pass
|
141
158
|
|
142
159
|
@abstractmethod
|
143
|
-
def get_time_range(self, catalog_id: str) -> Awaitable[
|
160
|
+
def get_time_range(self, catalog_id: str) -> Awaitable[CatalogTimeRange]:
|
144
161
|
"""
|
145
162
|
Gets the time range of the ResourceCatalog.
|
146
163
|
|
@@ -186,7 +203,6 @@ class IUpgradableDataSource(ABC):
|
|
186
203
|
Data sources which have configuration data to be upgraded should implement this interface.
|
187
204
|
"""
|
188
205
|
|
189
|
-
@staticmethod
|
190
206
|
@abstractmethod
|
191
207
|
def upgrade_source_configuration(configuration: Any) -> Awaitable[Any]:
|
192
208
|
"""
|
@@ -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[
|
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) ->
|
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")
|
@@ -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=
|
5
|
+
nexus_extensibility/_extensibility_data_source.py,sha256=JcXABjfBhbktNzlnem1ylpLJTRJfEd64__JjPx3GIMk,7928
|
6
6
|
nexus_extensibility/_extensibility_utilities.py,sha256=hQFcY2joHt1goJSCvMfEW5cprN1I-B1-SihqYme8R1A,786
|
7
|
-
nexus_extensibility-2.0.
|
8
|
-
nexus_extensibility-2.0.
|
9
|
-
nexus_extensibility-2.0.
|
10
|
-
nexus_extensibility-2.0.
|
7
|
+
nexus_extensibility-2.0.0b49.dist-info/METADATA,sha256=36GdIqTtdbM0CnQRIP3KDZYlLq-H_cUZ-Dp_dz_Tv7A,775
|
8
|
+
nexus_extensibility-2.0.0b49.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
9
|
+
nexus_extensibility-2.0.0b49.dist-info/top_level.txt,sha256=GTaw9wgS6EKrgO6FhJ3YZuMrkgoK7kP-hW9uybPDbyg,20
|
10
|
+
nexus_extensibility-2.0.0b49.dist-info/RECORD,,
|
File without changes
|
{nexus_extensibility-2.0.0b47.dist-info → nexus_extensibility-2.0.0b49.dist-info}/top_level.txt
RENAMED
File without changes
|