ONE-api 3.0b1__py3-none-any.whl → 3.0b4__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.
Files changed (33) hide show
  1. {ONE_api-3.0b1.dist-info → ONE_api-3.0b4.dist-info}/LICENSE +21 -21
  2. {ONE_api-3.0b1.dist-info → ONE_api-3.0b4.dist-info}/METADATA +115 -115
  3. ONE_api-3.0b4.dist-info/RECORD +37 -0
  4. one/__init__.py +2 -2
  5. one/alf/__init__.py +1 -1
  6. one/alf/cache.py +640 -653
  7. one/alf/exceptions.py +105 -105
  8. one/alf/io.py +876 -876
  9. one/alf/path.py +1450 -1450
  10. one/alf/spec.py +519 -504
  11. one/api.py +2949 -2973
  12. one/converters.py +850 -850
  13. one/params.py +414 -414
  14. one/registration.py +845 -845
  15. one/remote/__init__.py +1 -1
  16. one/remote/aws.py +313 -313
  17. one/remote/base.py +142 -142
  18. one/remote/globus.py +1254 -1254
  19. one/tests/fixtures/params/.caches +6 -6
  20. one/tests/fixtures/params/.test.alyx.internationalbrainlab.org +8 -8
  21. one/tests/fixtures/rest_responses/1f187d80fd59677b395fcdb18e68e4401bfa1cc9 +1 -1
  22. one/tests/fixtures/rest_responses/47893cf67c985e6361cdee009334963f49fb0746 +1 -1
  23. one/tests/fixtures/rest_responses/535d0e9a1e2c1efbdeba0d673b131e00361a2edb +1 -1
  24. one/tests/fixtures/rest_responses/6dc96f7e9bcc6ac2e7581489b9580a6cd3f28293 +1 -1
  25. one/tests/fixtures/rest_responses/db1731fb8df0208944ae85f76718430813a8bf50 +1 -1
  26. one/tests/fixtures/rest_responses/dcce48259bb929661f60a02a48563f70aa6185b3 +1 -1
  27. one/tests/fixtures/rest_responses/f530d6022f61cdc9e38cc66beb3cb71f3003c9a1 +1 -1
  28. one/tests/fixtures/test_dbs.json +14 -14
  29. one/util.py +524 -524
  30. one/webclient.py +1366 -1354
  31. ONE_api-3.0b1.dist-info/RECORD +0 -37
  32. {ONE_api-3.0b1.dist-info → ONE_api-3.0b4.dist-info}/WHEEL +0 -0
  33. {ONE_api-3.0b1.dist-info → ONE_api-3.0b4.dist-info}/top_level.txt +0 -0
one/alf/exceptions.py CHANGED
@@ -1,105 +1,105 @@
1
- """ALyx File related errors and warnings.
2
-
3
- A set of Alyx and ALF related error classes which provide a more verbose description of the raised
4
- issues.
5
- """
6
-
7
-
8
- class ALFError(Exception):
9
- """A base class for ALF-related errors.
10
-
11
- Attributes
12
- ----------
13
- explanation : str
14
- An optional, verbose but general explanation of the error class. All errors will display
15
- the same explanation.
16
-
17
- """
18
-
19
- explanation = ''
20
-
21
- def __init__(self, *args, terse=False):
22
- """A base ALF exception.
23
-
24
- Parameters
25
- ----------
26
- args : str, any
27
- A specific error message to display or items to include in message.
28
- terse : bool
29
- If True, the explanation string is not included in exception message.
30
-
31
- Examples
32
- --------
33
- >>> raise ALFError("ALF directory doesn't exist")
34
- one.alf.exceptions.ALFError: ALF directory doesn't exist
35
-
36
- >>> raise ALFError('invalid/path/one', 'invalid/path/two')
37
- one.alf.exceptions.ALFError: "invalid/path/one", "invalid/path/two"
38
-
39
- """
40
- if args:
41
- if len(args) == 1 and isinstance(args[0], str):
42
- self.message = args[0]
43
- else:
44
- self.message = '"' + '", "'.join(map(str, args)) + '"'
45
- else:
46
- self.message = ''
47
- self.terse = terse
48
-
49
- def __str__(self):
50
- if not self.message and not self.explanation:
51
- return ''
52
- return self.message if self.terse else f'{self.message} \n {self.explanation} '
53
-
54
-
55
- class AlyxSubjectNotFound(ALFError):
56
- """'Subject not found' error."""
57
-
58
- explanation = 'The subject was not found in Alyx database'
59
-
60
-
61
- class ALFObjectNotFound(ALFError):
62
- """'Object not found' error."""
63
-
64
- explanation = ('The ALF object was not found. This may occur if the object or namespace or '
65
- 'incorrectly formatted e.g. the object "_ibl_trials.intervals.npy" would be '
66
- 'found with the filters `object="trials", namespace="ibl"`')
67
-
68
-
69
- class ALFMultipleObjectsFound(ALFError):
70
- """'Multiple objects found' error."""
71
-
72
- explanation = ('Dataset files belonging to more than one object found. '
73
- 'ALF names have the pattern '
74
- '(_namespace_)object.attribute(_timescale).extension, e.g. for the file '
75
- '"_ibl_trials.intervals.npy" the object is "trials"')
76
-
77
-
78
- class ALFMultipleCollectionsFound(ALFError):
79
- """'Multiple collections found' error."""
80
-
81
- explanation = ('The matching object/file(s) belong to more than one collection. '
82
- 'ALF names have the pattern '
83
- 'collection/(_namespace_)object.attribute(_timescale).extension, e.g. for the '
84
- 'file "alf/probe01/spikes.times.npy" the collection is "alf/probe01"')
85
-
86
-
87
- class ALFMultipleRevisionsFound(ALFError):
88
- """'Multiple objects found' error."""
89
-
90
- explanation = ('The matching object/file(s) belong to more than one revision. '
91
- 'Multiple datasets in different revision folders were found with no default '
92
- 'specified.')
93
-
94
-
95
- class ALFWarning(Warning):
96
- """Cautions when loading ALF datasets."""
97
-
98
- pass
99
-
100
-
101
- class ALFInvalid(ALFError, ValueError):
102
- """ALF path invalid."""
103
-
104
- explanation = ('The file path provided is does not match the ALF path specification defined '
105
- 'in `one.alf.spec`.')
1
+ """ALyx File related errors and warnings.
2
+
3
+ A set of Alyx and ALF related error classes which provide a more verbose description of the raised
4
+ issues.
5
+ """
6
+
7
+
8
+ class ALFError(Exception):
9
+ """A base class for ALF-related errors.
10
+
11
+ Attributes
12
+ ----------
13
+ explanation : str
14
+ An optional, verbose but general explanation of the error class. All errors will display
15
+ the same explanation.
16
+
17
+ """
18
+
19
+ explanation = ''
20
+
21
+ def __init__(self, *args, terse=False):
22
+ """A base ALF exception.
23
+
24
+ Parameters
25
+ ----------
26
+ args : str, any
27
+ A specific error message to display or items to include in message.
28
+ terse : bool
29
+ If True, the explanation string is not included in exception message.
30
+
31
+ Examples
32
+ --------
33
+ >>> raise ALFError("ALF directory doesn't exist")
34
+ one.alf.exceptions.ALFError: ALF directory doesn't exist
35
+
36
+ >>> raise ALFError('invalid/path/one', 'invalid/path/two')
37
+ one.alf.exceptions.ALFError: "invalid/path/one", "invalid/path/two"
38
+
39
+ """
40
+ if args:
41
+ if len(args) == 1 and isinstance(args[0], str):
42
+ self.message = args[0]
43
+ else:
44
+ self.message = '"' + '", "'.join(map(str, args)) + '"'
45
+ else:
46
+ self.message = ''
47
+ self.terse = terse
48
+
49
+ def __str__(self):
50
+ if not self.message and not self.explanation:
51
+ return ''
52
+ return self.message if self.terse else f'{self.message} \n {self.explanation} '
53
+
54
+
55
+ class AlyxSubjectNotFound(ALFError):
56
+ """'Subject not found' error."""
57
+
58
+ explanation = 'The subject was not found in Alyx database'
59
+
60
+
61
+ class ALFObjectNotFound(ALFError):
62
+ """'Object not found' error."""
63
+
64
+ explanation = ('The ALF object was not found. This may occur if the object or namespace or '
65
+ 'incorrectly formatted e.g. the object "_ibl_trials.intervals.npy" would be '
66
+ 'found with the filters `object="trials", namespace="ibl"`')
67
+
68
+
69
+ class ALFMultipleObjectsFound(ALFError):
70
+ """'Multiple objects found' error."""
71
+
72
+ explanation = ('Dataset files belonging to more than one object found. '
73
+ 'ALF names have the pattern '
74
+ '(_namespace_)object.attribute(_timescale).extension, e.g. for the file '
75
+ '"_ibl_trials.intervals.npy" the object is "trials"')
76
+
77
+
78
+ class ALFMultipleCollectionsFound(ALFError):
79
+ """'Multiple collections found' error."""
80
+
81
+ explanation = ('The matching object/file(s) belong to more than one collection. '
82
+ 'ALF names have the pattern '
83
+ 'collection/(_namespace_)object.attribute(_timescale).extension, e.g. for the '
84
+ 'file "alf/probe01/spikes.times.npy" the collection is "alf/probe01"')
85
+
86
+
87
+ class ALFMultipleRevisionsFound(ALFError):
88
+ """'Multiple objects found' error."""
89
+
90
+ explanation = ('The matching object/file(s) belong to more than one revision. '
91
+ 'Multiple datasets in different revision folders were found with no default '
92
+ 'specified.')
93
+
94
+
95
+ class ALFWarning(Warning):
96
+ """Cautions when loading ALF datasets."""
97
+
98
+ pass
99
+
100
+
101
+ class ALFInvalid(ALFError, ValueError):
102
+ """ALF path invalid."""
103
+
104
+ explanation = ('The file path provided is does not match the ALF path specification defined '
105
+ 'in `one.alf.spec`.')