sdata 1.5.0__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.
- sdata/__init__.py +140 -0
- sdata/base.py +684 -0
- sdata/contrib/__init__.py +0 -0
- sdata/contrib/piexif/__init__.py +12 -0
- sdata/contrib/piexif/_common.py +94 -0
- sdata/contrib/piexif/_dump.py +346 -0
- sdata/contrib/piexif/_exceptions.py +2 -0
- sdata/contrib/piexif/_exif.py +638 -0
- sdata/contrib/piexif/_insert.py +60 -0
- sdata/contrib/piexif/_load.py +270 -0
- sdata/contrib/piexif/_remove.py +56 -0
- sdata/contrib/piexif/_transplant.py +45 -0
- sdata/contrib/piexif/_webp.py +240 -0
- sdata/contrib/piexif/helper.py +66 -0
- sdata/contrib/ranger/__init__.py +8 -0
- sdata/contrib/ranger/collections/__init__.py +0 -0
- sdata/contrib/ranger/collections/rangebucketmap.py +346 -0
- sdata/contrib/ranger/collections/rangemap.py +396 -0
- sdata/contrib/ranger/collections/rangeset.py +483 -0
- sdata/contrib/ranger/range/__init__.py +0 -0
- sdata/contrib/ranger/range/cut.py +285 -0
- sdata/contrib/ranger/range/range.py +644 -0
- sdata/contrib/sobol_seq.py +394 -0
- sdata/contrib/sortedcontainers/LICENSE +13 -0
- sdata/contrib/sortedcontainers/__init__.py +74 -0
- sdata/contrib/sortedcontainers/sorteddict.py +789 -0
- sdata/contrib/sortedcontainers/sortedlist.py +2646 -0
- sdata/contrib/sortedcontainers/sortedset.py +733 -0
- sdata/contrib/sqlitedict.py +598 -0
- sdata/contrib/timeflake/__init__.py +40 -0
- sdata/contrib/timeflake/flake.py +69 -0
- sdata/contrib/timeflake/utils.py +47 -0
- sdata/deprecated/__init__.py +10 -0
- sdata/deprecated/data.py +1503 -0
- sdata/did/__init__.py +129 -0
- sdata/did/_http.py +67 -0
- sdata/did/base58btc.py +49 -0
- sdata/did/did_github.py +152 -0
- sdata/did/did_peer4.py +155 -0
- sdata/did/did_web.py +222 -0
- sdata/did/diddoc.py +75 -0
- sdata/did/ed25519.py +225 -0
- sdata/did/eddsa.py +107 -0
- sdata/did/errors.py +40 -0
- sdata/did/issue_vc.py +193 -0
- sdata/did/jose.py +126 -0
- sdata/did/keys.py +104 -0
- sdata/did/utils_didkey.py +161 -0
- sdata/did/verify_vp.py +158 -0
- sdata/doe.py +101 -0
- sdata/dtypes.py +510 -0
- sdata/experiments/__init__.py +331 -0
- sdata/experiments/blob0.py +131 -0
- sdata/experiments/file.py +42 -0
- sdata/experiments/filegroup.py +144 -0
- sdata/experiments/image_old.py +313 -0
- sdata/experiments/ks2.py +15 -0
- sdata/experiments/lapshear.py +8 -0
- sdata/experiments/material.py +7 -0
- sdata/experiments/parameters_deprecated.py +394 -0
- sdata/experiments/workbook.py +226 -0
- sdata/format.py +125 -0
- sdata/imagemeta.py +533 -0
- sdata/interactive.py +118 -0
- sdata/iolib/__init__.py +51 -0
- sdata/iolib/hashtree.py +264 -0
- sdata/iolib/json1sqlitestore.py +554 -0
- sdata/iolib/jsonsqlitestore.py +704 -0
- sdata/iolib/pud.py +242 -0
- sdata/iolib/reader.py +262 -0
- sdata/iolib/writer.py +419 -0
- sdata/metadata.py +882 -0
- sdata/parameter.py +414 -0
- sdata/schema.py +273 -0
- sdata/sclass/__init__.py +111 -0
- sdata/sclass/bfo_classes.py +362 -0
- sdata/sclass/blob.py +362 -0
- sdata/sclass/content.py +87 -0
- sdata/sclass/dataframe.py +1251 -0
- sdata/sclass/dataframegroup.py +187 -0
- sdata/sclass/dependency_graph.py +85 -0
- sdata/sclass/filereference.py +124 -0
- sdata/sclass/image.py +218 -0
- sdata/sclass/lazy_namespace.py +155 -0
- sdata/sclass/process.py +383 -0
- sdata/sclass/process_graph.py +221 -0
- sdata/sclass/zipfile.py +135 -0
- sdata/semantic.py +346 -0
- sdata/suuid.py +136 -0
- sdata/timestamp.py +336 -0
- sdata/tools.py +14 -0
- sdata/units.py +602 -0
- sdata/vocab.py +149 -0
- sdata-1.5.0.dist-info/METADATA +264 -0
- sdata-1.5.0.dist-info/RECORD +98 -0
- sdata-1.5.0.dist-info/WHEEL +5 -0
- sdata-1.5.0.dist-info/licenses/LICENSE-MIT +21 -0
- sdata-1.5.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
class Cut(object):
|
|
2
|
+
"""
|
|
3
|
+
Class used to represent a cutpoint in a range, such that any range can
|
|
4
|
+
be represented by 2 Cuts
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
def __init__(self, the_type, above_all=False, below_all=False, point=None,
|
|
8
|
+
below=False):
|
|
9
|
+
""" Instantiates a cut point
|
|
10
|
+
|
|
11
|
+
Parameters
|
|
12
|
+
----------
|
|
13
|
+
the_type : type
|
|
14
|
+
Specify the most inclusive type that can be used for comparison
|
|
15
|
+
above_all : boolean
|
|
16
|
+
Specifies that cut point is above all possible values
|
|
17
|
+
within the domain
|
|
18
|
+
below_all : boolean
|
|
19
|
+
Specifies that cut point is below all possible values
|
|
20
|
+
within the domain
|
|
21
|
+
point : instance of the domain
|
|
22
|
+
A specific point in the domain where the cut should
|
|
23
|
+
occur
|
|
24
|
+
below : boolean
|
|
25
|
+
If true, cut point is infinitesimally below specified point.
|
|
26
|
+
Otherwise, is infinitesimally above specified point
|
|
27
|
+
|
|
28
|
+
Raises
|
|
29
|
+
------
|
|
30
|
+
ValueError
|
|
31
|
+
If input is invalid
|
|
32
|
+
"""
|
|
33
|
+
self.the_type = the_type
|
|
34
|
+
self.above_all = False
|
|
35
|
+
self.below_all = False
|
|
36
|
+
self.point = None
|
|
37
|
+
self.below = False
|
|
38
|
+
# Validate input
|
|
39
|
+
if point is None:
|
|
40
|
+
if not any((above_all, below_all)):
|
|
41
|
+
raise ValueError("Must specify a type of cut point")
|
|
42
|
+
elif all((above_all, below_all)):
|
|
43
|
+
raise ValueError("Cannot be both above_all and below_all")
|
|
44
|
+
else:
|
|
45
|
+
# Correct input
|
|
46
|
+
self.above_all = above_all
|
|
47
|
+
self.below_all = below_all
|
|
48
|
+
else:
|
|
49
|
+
if any((above_all, below_all)):
|
|
50
|
+
raise ValueError("Cannot be both point and above/below all")
|
|
51
|
+
elif not isinstance(point, the_type):
|
|
52
|
+
raise ValueError("Point must be instance of the_type")
|
|
53
|
+
else:
|
|
54
|
+
self.point = point
|
|
55
|
+
self.below = below
|
|
56
|
+
|
|
57
|
+
def _validate_query_pt(self, pt):
|
|
58
|
+
if not isinstance(pt, self.the_type):
|
|
59
|
+
raise ValueError("Type is not compatible with cutpoint type")
|
|
60
|
+
return True
|
|
61
|
+
|
|
62
|
+
def __hash__(self):
|
|
63
|
+
if self.below_all:
|
|
64
|
+
return hash(self.the_type) * 31 - hash(None)
|
|
65
|
+
elif self.above_all:
|
|
66
|
+
return hash(self.the_type) * 31 + hash(None)
|
|
67
|
+
elif self.below:
|
|
68
|
+
return hash(self.the_type) * 31 - hash(self.point)
|
|
69
|
+
else:
|
|
70
|
+
return hash(self.the_type) * 31 + hash(self.point)
|
|
71
|
+
|
|
72
|
+
def __repr__(self):
|
|
73
|
+
if self.below_all:
|
|
74
|
+
return "Cut(Below all %s)" % str(self.the_type)
|
|
75
|
+
elif self.above_all:
|
|
76
|
+
return "Cut(Above all %s)" % str(self.the_type)
|
|
77
|
+
elif self.below:
|
|
78
|
+
return "Cut(Below %s)" % str(self.point)
|
|
79
|
+
else:
|
|
80
|
+
return "Cut(Above %s)" % str(self.point)
|
|
81
|
+
|
|
82
|
+
def __cmp__(self, other):
|
|
83
|
+
if self == other:
|
|
84
|
+
return 0
|
|
85
|
+
elif self < other:
|
|
86
|
+
return -1
|
|
87
|
+
elif self > other:
|
|
88
|
+
return 1
|
|
89
|
+
|
|
90
|
+
def __eq__(self, other):
|
|
91
|
+
""" Returns whether Cuts are at EXACT same place """
|
|
92
|
+
if not isinstance(other, Cut):
|
|
93
|
+
return False
|
|
94
|
+
elif self.above_all:
|
|
95
|
+
return other.above_all
|
|
96
|
+
elif self.below_all:
|
|
97
|
+
return other.below_all
|
|
98
|
+
elif (self.point is not None) and (other.point is not None):
|
|
99
|
+
return ((self.point == other.point) and (self.below == other.below))
|
|
100
|
+
else:
|
|
101
|
+
return False
|
|
102
|
+
|
|
103
|
+
def __ne__(self, other):
|
|
104
|
+
return not self.__eq__(other)
|
|
105
|
+
|
|
106
|
+
def __lt__(self, other):
|
|
107
|
+
""" Returns whether cutpoint is less than a specified value """
|
|
108
|
+
if isinstance(other, Cut):
|
|
109
|
+
if self.below_all:
|
|
110
|
+
return True
|
|
111
|
+
elif self.above_all:
|
|
112
|
+
return False
|
|
113
|
+
elif other.below_all:
|
|
114
|
+
return False
|
|
115
|
+
elif other.above_all:
|
|
116
|
+
return True
|
|
117
|
+
else:
|
|
118
|
+
if self.point < other.point:
|
|
119
|
+
return True
|
|
120
|
+
elif self.point == other.point and self.below and \
|
|
121
|
+
not other.below:
|
|
122
|
+
return True
|
|
123
|
+
else:
|
|
124
|
+
return False
|
|
125
|
+
else:
|
|
126
|
+
return self.is_less_than(other)
|
|
127
|
+
|
|
128
|
+
def __gt__(self, other):
|
|
129
|
+
""" Returns whether cutpoint is greater than a specified value """
|
|
130
|
+
if isinstance(other, Cut):
|
|
131
|
+
if self.below_all:
|
|
132
|
+
return False
|
|
133
|
+
elif self.above_all:
|
|
134
|
+
return True
|
|
135
|
+
elif other.below_all:
|
|
136
|
+
return True
|
|
137
|
+
elif other.above_all:
|
|
138
|
+
return False
|
|
139
|
+
else:
|
|
140
|
+
if self.point > other.point:
|
|
141
|
+
return True
|
|
142
|
+
elif self.point == other.point and not self.below and \
|
|
143
|
+
other.below:
|
|
144
|
+
return True
|
|
145
|
+
else:
|
|
146
|
+
return False
|
|
147
|
+
else:
|
|
148
|
+
return self.is_greater_than(other)
|
|
149
|
+
|
|
150
|
+
def __ge__(self, other):
|
|
151
|
+
return (self.__eq__(other) or self.__gt__(other))
|
|
152
|
+
|
|
153
|
+
def __le__(self, other):
|
|
154
|
+
return (self.__eq__(other) or self.__lt__(other))
|
|
155
|
+
|
|
156
|
+
def is_less_than(self, val):
|
|
157
|
+
""" Returns whether the cutpoint is less than a specified value
|
|
158
|
+
|
|
159
|
+
Parameters
|
|
160
|
+
----------
|
|
161
|
+
val : Comparable, of compatible type
|
|
162
|
+
The value to compare the cutpoint to
|
|
163
|
+
|
|
164
|
+
Raises
|
|
165
|
+
------
|
|
166
|
+
ValueError
|
|
167
|
+
If the value type not compatible with cutpoint type
|
|
168
|
+
|
|
169
|
+
Returns
|
|
170
|
+
-------
|
|
171
|
+
True if the cutpoint is strictly less than the specified value
|
|
172
|
+
"""
|
|
173
|
+
self._validate_query_pt(val)
|
|
174
|
+
if self.below_all:
|
|
175
|
+
return True
|
|
176
|
+
elif self.above_all:
|
|
177
|
+
return False
|
|
178
|
+
elif self.point < val:
|
|
179
|
+
return True
|
|
180
|
+
elif self.point == val and self.below:
|
|
181
|
+
return True
|
|
182
|
+
else:
|
|
183
|
+
return False
|
|
184
|
+
|
|
185
|
+
def is_greater_than(self, val):
|
|
186
|
+
""" Returns whether the cutpoint is greater than a specified value
|
|
187
|
+
|
|
188
|
+
Parameters
|
|
189
|
+
----------
|
|
190
|
+
val : Comparable, of compatible type
|
|
191
|
+
The value to compare the cutpoint to
|
|
192
|
+
|
|
193
|
+
Raises
|
|
194
|
+
------
|
|
195
|
+
ValueError
|
|
196
|
+
If the value type not compatible with cutpoint type
|
|
197
|
+
|
|
198
|
+
Returns
|
|
199
|
+
-------
|
|
200
|
+
True if the cutpoint is strictly greater than the specified value
|
|
201
|
+
"""
|
|
202
|
+
self._validate_query_pt(val)
|
|
203
|
+
if self.above_all:
|
|
204
|
+
return True
|
|
205
|
+
elif self.below_all:
|
|
206
|
+
return False
|
|
207
|
+
elif self.point > val:
|
|
208
|
+
return True
|
|
209
|
+
elif self.point == val and not self.below:
|
|
210
|
+
return True
|
|
211
|
+
else:
|
|
212
|
+
return False
|
|
213
|
+
|
|
214
|
+
@staticmethod
|
|
215
|
+
def below_value(val, the_type=None):
|
|
216
|
+
""" Create a cut point, where everything below some value is
|
|
217
|
+
included
|
|
218
|
+
|
|
219
|
+
Parameters
|
|
220
|
+
----------
|
|
221
|
+
val : value in the domain
|
|
222
|
+
Cut point, where everything below value is included
|
|
223
|
+
the_type : type
|
|
224
|
+
Most inclusive type that can be used for comparison. If
|
|
225
|
+
None, then the type of the value is used
|
|
226
|
+
Returns
|
|
227
|
+
-------
|
|
228
|
+
The cut object
|
|
229
|
+
"""
|
|
230
|
+
if the_type is None:
|
|
231
|
+
return Cut(type(val), point=val, below=True)
|
|
232
|
+
else:
|
|
233
|
+
return Cut(the_type, point=val, below=True)
|
|
234
|
+
|
|
235
|
+
@staticmethod
|
|
236
|
+
def below_all(the_type):
|
|
237
|
+
""" Create a cut point outside the lower end of the domain
|
|
238
|
+
|
|
239
|
+
Parameters
|
|
240
|
+
----------
|
|
241
|
+
the_type : type
|
|
242
|
+
Most inclusive type that can be used for comparison.
|
|
243
|
+
|
|
244
|
+
Returns
|
|
245
|
+
-------
|
|
246
|
+
The cut object
|
|
247
|
+
"""
|
|
248
|
+
return Cut(the_type, below_all=True)
|
|
249
|
+
|
|
250
|
+
@staticmethod
|
|
251
|
+
def above_value(val, the_type=None):
|
|
252
|
+
""" Create a cut point, where everything above some value is
|
|
253
|
+
included
|
|
254
|
+
|
|
255
|
+
Parameters
|
|
256
|
+
----------
|
|
257
|
+
val : value in the domain
|
|
258
|
+
Cut point, where everything above value is included
|
|
259
|
+
the_type : type
|
|
260
|
+
Most inclusive type that can be used for comparison. If
|
|
261
|
+
None, then the type of the value is used
|
|
262
|
+
|
|
263
|
+
Returns
|
|
264
|
+
-------
|
|
265
|
+
The cut object
|
|
266
|
+
"""
|
|
267
|
+
if the_type is None:
|
|
268
|
+
return Cut(type(val), point=val, below=False)
|
|
269
|
+
else:
|
|
270
|
+
return Cut(the_type, point=val, below=False)
|
|
271
|
+
|
|
272
|
+
@staticmethod
|
|
273
|
+
def above_all(the_type):
|
|
274
|
+
""" Create a cut point outside the upper end of the domain
|
|
275
|
+
|
|
276
|
+
Parameters
|
|
277
|
+
----------
|
|
278
|
+
the_type : type
|
|
279
|
+
Most inclusive type that can be used for comparison
|
|
280
|
+
|
|
281
|
+
Returns
|
|
282
|
+
-------
|
|
283
|
+
The cut object
|
|
284
|
+
"""
|
|
285
|
+
return Cut(the_type, above_all=True)
|