ONE-api 3.4.0__py3-none-any.whl → 3.4.2__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.
- one/__init__.py +1 -1
- one/alf/cache.py +7 -2
- one/webclient.py +12 -6
- {one_api-3.4.0.dist-info → one_api-3.4.2.dist-info}/METADATA +4 -4
- {one_api-3.4.0.dist-info → one_api-3.4.2.dist-info}/RECORD +8 -8
- {one_api-3.4.0.dist-info → one_api-3.4.2.dist-info}/WHEEL +1 -1
- {one_api-3.4.0.dist-info → one_api-3.4.2.dist-info}/licenses/LICENSE +0 -0
- {one_api-3.4.0.dist-info → one_api-3.4.2.dist-info}/top_level.txt +0 -0
one/__init__.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""The Open Neurophysiology Environment (ONE) API."""
|
|
2
|
-
__version__ = '3.4.
|
|
2
|
+
__version__ = '3.4.2'
|
one/alf/cache.py
CHANGED
|
@@ -538,13 +538,18 @@ def merge_tables(cache, strict=False, origin=None, **kwargs):
|
|
|
538
538
|
cache[table] = pd.concat(frames).sort_index()
|
|
539
539
|
updated = datetime.datetime.now()
|
|
540
540
|
# Update the table metadata with the origin
|
|
541
|
+
table_meta = cache['_meta']['raw'].get(table, {})
|
|
541
542
|
if origin is not None:
|
|
542
|
-
table_meta = cache['_meta']['raw'].get(table, {})
|
|
543
543
|
if 'origin' not in table_meta:
|
|
544
|
-
table_meta['origin'] = set(origin)
|
|
544
|
+
table_meta['origin'] = set(ensure_list(origin))
|
|
545
545
|
else:
|
|
546
546
|
table_meta['origin'].add(origin)
|
|
547
547
|
cache['_meta']['raw'][table] = table_meta
|
|
548
|
+
# Makes sure that the `date_created` field exists for a new table
|
|
549
|
+
if 'date_created' not in table_meta.keys():
|
|
550
|
+
table_meta['date_created'] = datetime.datetime.now().isoformat(
|
|
551
|
+
sep=' ', timespec='minutes')
|
|
552
|
+
cache['_meta']['raw'][table] = table_meta
|
|
548
553
|
cache['_meta']['modified_time'] = updated
|
|
549
554
|
return updated
|
|
550
555
|
|
one/webclient.py
CHANGED
|
@@ -134,12 +134,16 @@ def _cache_response(method):
|
|
|
134
134
|
# Reversible but length may exceed 255 chars
|
|
135
135
|
# name = base64.urlsafe_b64encode(args[2].encode('UTF-8')).decode('UTF-8')
|
|
136
136
|
files = list(rest_cache.glob(name))
|
|
137
|
-
cached = None
|
|
137
|
+
cached, when = None, None
|
|
138
138
|
if len(files) == 1 and not clobber:
|
|
139
139
|
_logger.debug('loading REST response from cache')
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
try:
|
|
141
|
+
with open(files[0], 'r') as f:
|
|
142
|
+
cached, when = json.load(f)
|
|
143
|
+
except json.JSONDecodeError as e:
|
|
144
|
+
_logger.debug(f'corrupted cache file {name}: {e}')
|
|
145
|
+
files[0].unlink() # delete corrupted cache file
|
|
146
|
+
if cached and datetime.fromisoformat(when) > datetime.now():
|
|
143
147
|
return cached
|
|
144
148
|
try:
|
|
145
149
|
response = method(alyx_client, *args, **kwargs)
|
|
@@ -409,7 +413,7 @@ def http_download_file(full_link_to_file, chunks=None, *, clobber=False, silent=
|
|
|
409
413
|
Directory in which files are downloaded; defaults to user's Download directory
|
|
410
414
|
return_md5 : bool
|
|
411
415
|
If True an MD5 hash of the file is additionally returned
|
|
412
|
-
headers :
|
|
416
|
+
headers : dict
|
|
413
417
|
Additional headers to add to the request (auth tokens etc.)
|
|
414
418
|
|
|
415
419
|
Returns
|
|
@@ -1502,7 +1506,9 @@ class AlyxClient:
|
|
|
1502
1506
|
if len(set(kwargs.keys()) - set(self.rest_schemes.field_names(endpoint, action))):
|
|
1503
1507
|
missing = set(kwargs.keys()) - set(
|
|
1504
1508
|
self.rest_schemes.field_names(endpoint, action))
|
|
1505
|
-
|
|
1509
|
+
warnings.warn(
|
|
1510
|
+
f"Error: Unsupported fields '{missing}' in query parameters"
|
|
1511
|
+
f" for endpoint {endpoint}.")
|
|
1506
1512
|
query_params = {k: ','.join(map(str, ensure_list(v))) for k, v in kwargs.items()}
|
|
1507
1513
|
url = update_url_params(url, query_params)
|
|
1508
1514
|
return self.get('/' + url, **cache_args)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ONE-api
|
|
3
|
-
Version: 3.4.
|
|
3
|
+
Version: 3.4.2
|
|
4
4
|
Summary: Open Neurophysiology Environment
|
|
5
5
|
Author: IBL Staff
|
|
6
6
|
License: MIT
|
|
@@ -13,8 +13,8 @@ Requires-Python: >=3.10
|
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
15
|
Requires-Dist: ruff
|
|
16
|
-
Requires-Dist: numpy
|
|
17
|
-
Requires-Dist: pandas
|
|
16
|
+
Requires-Dist: numpy<2.4,>=1.18
|
|
17
|
+
Requires-Dist: pandas<3.0.0,>=1.5.0
|
|
18
18
|
Requires-Dist: tqdm>=4.32.1
|
|
19
19
|
Requires-Dist: requests>=2.22.0
|
|
20
20
|
Requires-Dist: iblutil>=1.14.0
|
|
@@ -46,7 +46,7 @@ pip install ONE-api
|
|
|
46
46
|
For using ONE with a local cache directory:
|
|
47
47
|
```python
|
|
48
48
|
from one.api import One
|
|
49
|
-
one = One(cache_dir='/home/user/
|
|
49
|
+
one = One(cache_dir='/home/user/downloads/ONE/behavior_paper')
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
To use the default setup settings that connect you to the [IBL public database](https://openalyx.internationalbrainlab.org):
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
one/__init__.py,sha256=
|
|
1
|
+
one/__init__.py,sha256=f5lexfu1SjyD_0KnM8kbdiDOU6tIW5X-gV18sSAlKSs,76
|
|
2
2
|
one/api.py,sha256=iPt_fwXqtSRCzmTdaG7NQwkhheETMRn9USrJYSzZX-s,137364
|
|
3
3
|
one/converters.py,sha256=icKlwPyxf3tJtyOFBj_SG06QDLIZLdTGalCSk1-cAvk,30733
|
|
4
4
|
one/params.py,sha256=zwR0Yq09ztROfH3fJsCUc-IDs_PBixT3WU3dm1vX728,15050
|
|
5
5
|
one/registration.py,sha256=cWvQFAzCF04wMZJjdOzBPJkYOJ3BO2KEgqtVG7qOlmA,36177
|
|
6
6
|
one/util.py,sha256=knjwgpSK427mTovHN1UJgzCmQDrsOoU9_prDVlFPDRk,20558
|
|
7
|
-
one/webclient.py,sha256=
|
|
7
|
+
one/webclient.py,sha256=msKVP8uVFk5Mgy45nb35bMP1-AuY1JL2YyJQ6dZRMVo,61747
|
|
8
8
|
one/alf/__init__.py,sha256=DaFIi7PKlurp5HnyNOpJuIlY3pyhiottFpJfxR59VsY,70
|
|
9
|
-
one/alf/cache.py,sha256=
|
|
9
|
+
one/alf/cache.py,sha256=w2Egr9xDXQetS6m9_bNmPAcENC3e9QaTouXGFWE21QI,25124
|
|
10
10
|
one/alf/exceptions.py,sha256=6Gw8_ZObLnuYUpY4i0UyU4IA0kBZMBnJBGQyzIcDlUM,3427
|
|
11
11
|
one/alf/io.py,sha256=7mmd1wJwh7qok0WKkpGzkLxEuw4WSnaQ6EkGVvaODLI,30798
|
|
12
12
|
one/alf/path.py,sha256=ylOUQK0TmBBHC_lJbgc0b_u8DTY8yP2hpouT0sIklvs,54065
|
|
@@ -32,8 +32,8 @@ one/tests/fixtures/rest_responses/db1731fb8df0208944ae85f76718430813a8bf50,sha25
|
|
|
32
32
|
one/tests/fixtures/rest_responses/dcce48259bb929661f60a02a48563f70aa6185b3,sha256=skaKl6sPgTyrufCIGNVNJfccXM-jSjYvAdyqNS3HXuA,416
|
|
33
33
|
one/tests/fixtures/rest_responses/f530d6022f61cdc9e38cc66beb3cb71f3003c9a1,sha256=6TgUqgqa7OgSyW3apDAnzjAOjMyHi_xV2M8uwOvvYoY,22575
|
|
34
34
|
one/tests/fixtures/rest_responses/openapiv3.json,sha256=wsmvJbNXy3t-9oGQyKJZjeCGXFpzxdJCjYsaJfv3s6g,317831
|
|
35
|
-
one_api-3.4.
|
|
36
|
-
one_api-3.4.
|
|
37
|
-
one_api-3.4.
|
|
38
|
-
one_api-3.4.
|
|
39
|
-
one_api-3.4.
|
|
35
|
+
one_api-3.4.2.dist-info/licenses/LICENSE,sha256=W6iRQJcr-tslNfY4gL98IWvPtpe0E3tcWCFOD3IFUqg,1087
|
|
36
|
+
one_api-3.4.2.dist-info/METADATA,sha256=lk6Bsxsy4FqPM4hn6hLCPm6Omd3agVeFK6IW3xsJDOc,4182
|
|
37
|
+
one_api-3.4.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
38
|
+
one_api-3.4.2.dist-info/top_level.txt,sha256=LIsI2lzmA5jh8Zrw5dzMdE3ydLgmq-WF6rpoxSVDSAY,4
|
|
39
|
+
one_api-3.4.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|