tonik 0.1.5__py3-none-any.whl → 0.1.7__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.
tonik/api.py CHANGED
@@ -1,8 +1,9 @@
1
1
  import logging
2
2
  import os
3
+ import sys
3
4
  from argparse import ArgumentParser
4
5
  from datetime import datetime
5
- from typing import Annotated
6
+ from typing import Annotated, List, Union
6
7
  from urllib.parse import unquote
7
8
 
8
9
  import datashader as dsh
@@ -19,6 +20,13 @@ from .storage import Storage
19
20
 
20
21
  logger = logging.getLogger(__name__)
21
22
 
23
+ if sys.version_info >= (3, 10):
24
+ # For Python 3.10 and above, use the new union operator '|'
25
+ SubdirType = Annotated[list[str] | None, Query()]
26
+ else:
27
+ # For Python 3.9 and below, use Union from typing
28
+ SubdirType = Annotated[Union[List[str], None], Query()]
29
+
22
30
 
23
31
  class TonikAPI:
24
32
 
@@ -62,7 +70,7 @@ class TonikAPI:
62
70
  verticalres: int = 10,
63
71
  log: bool = False,
64
72
  normalise: bool = False,
65
- subdir: Annotated[list[str] | None, Query()] = None):
73
+ subdir: SubdirType = None):
66
74
  _st = self.preprocess_datetime(starttime)
67
75
  _et = self.preprocess_datetime(endtime)
68
76
  g = Storage(group, rootdir=self.rootdir,
@@ -139,7 +147,7 @@ class TonikAPI:
139
147
  d, units='hours since 1970-01-01 00:00:00.0', calendar='gregorian')
140
148
  return freq, dates, spec
141
149
 
142
- def inventory(self, group: str, subdir: Annotated[list[str] | None, Query()] = None, tree: bool = True) -> list | dict:
150
+ def inventory(self, group: str, subdir: SubdirType = None, tree: bool = True) -> list | dict:
143
151
  sg = Storage(group, rootdir=self.rootdir, create=False)
144
152
  try:
145
153
  c = sg.get_substore(*subdir)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: tonik
3
- Version: 0.1.5
3
+ Version: 0.1.7
4
4
  Summary: Store time series data as HDF5 files and access them through an API.
5
5
  Project-URL: Homepage, https://tsc-tools.github.io/tonik
6
6
  Project-URL: Issues, https://github.com/tsc-tools/tonik/issues
@@ -1,12 +1,12 @@
1
1
  tonik/__init__.py,sha256=ZBVGh4dm_l9xwiBGb33O5QV9MfZeNiEd3DBDAm6DiHk,511
2
- tonik/api.py,sha256=8YS0WCMlm5xs2N6V8n9BiP87ywJC_BUzYsPvWR9KWJk,6499
2
+ tonik/api.py,sha256=ALIenzYBClPmP5XtPHPPp1ou1zbsNnFzZR8OIUOugXU,6742
3
3
  tonik/storage.py,sha256=GNJ6w9VHOeTR_ZJMZ-Ipqe3nFK2I91fkHYwg1k9bEuo,9470
4
4
  tonik/utils.py,sha256=3nSRU_GnV6arP4e63YHn4oEV8XbqzVAW8FCvQVIwGdg,2757
5
5
  tonik/xarray2netcdf.py,sha256=RUsPwPDEOnUIMGt7_9F1VDyg83zu8x-Qs3jmZs3Dq0o,5173
6
6
  tonik/xarray2zarr.py,sha256=EhEo5kqzrKyXR37RX2zYtgOAviZdRqstZi_4ZtUmSDc,2342
7
7
  tonik/package_data/index.html,sha256=GKDClUhIam_fAYbNfzAolORhSCG3ae1wW3VjWCg4PMk,2732
8
- tonik-0.1.5.dist-info/METADATA,sha256=AL6lJ2WV8uUOJRabLcQ5Sm-jnHU_K3IS4vv0NwSShr4,1938
9
- tonik-0.1.5.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
10
- tonik-0.1.5.dist-info/entry_points.txt,sha256=VnGfC5qAzpntEHAb5pooUEpYABSgOfQoNhCEtLDJyf8,45
11
- tonik-0.1.5.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
12
- tonik-0.1.5.dist-info/RECORD,,
8
+ tonik-0.1.7.dist-info/METADATA,sha256=ChV_YzGAm2sigY1W3EWWv6NfCkOwNyDDwdt2PqdbDrQ,1938
9
+ tonik-0.1.7.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
10
+ tonik-0.1.7.dist-info/entry_points.txt,sha256=VnGfC5qAzpntEHAb5pooUEpYABSgOfQoNhCEtLDJyf8,45
11
+ tonik-0.1.7.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
12
+ tonik-0.1.7.dist-info/RECORD,,
File without changes