clarifai 11.3.0rc1__py3-none-any.whl → 11.3.0rc2__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.
- clarifai/__init__.py +1 -1
- clarifai/runners/utils/data_utils.py +104 -11
- {clarifai-11.3.0rc1.dist-info → clarifai-11.3.0rc2.dist-info}/METADATA +2 -13
- {clarifai-11.3.0rc1.dist-info → clarifai-11.3.0rc2.dist-info}/RECORD +8 -8
- {clarifai-11.3.0rc1.dist-info → clarifai-11.3.0rc2.dist-info}/WHEEL +1 -1
- {clarifai-11.3.0rc1.dist-info → clarifai-11.3.0rc2.dist-info}/LICENSE +0 -0
- {clarifai-11.3.0rc1.dist-info → clarifai-11.3.0rc2.dist-info}/entry_points.txt +0 -0
- {clarifai-11.3.0rc1.dist-info → clarifai-11.3.0rc2.dist-info}/top_level.txt +0 -0
clarifai/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "11.3.
|
1
|
+
__version__ = "11.3.0rc2"
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import operator
|
1
2
|
from io import BytesIO
|
2
3
|
from typing import List
|
3
4
|
|
@@ -61,15 +62,13 @@ def is_openai_chat_format(messages):
|
|
61
62
|
class InputField(MessageData):
|
62
63
|
"""A field that can be used to store input data."""
|
63
64
|
|
64
|
-
def __init__(
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
is_param=True
|
72
|
-
):
|
65
|
+
def __init__(self,
|
66
|
+
default=None,
|
67
|
+
description=None,
|
68
|
+
min_value=None,
|
69
|
+
max_value=None,
|
70
|
+
choices=None,
|
71
|
+
is_param=True):
|
73
72
|
self.default = default
|
74
73
|
self.description = description
|
75
74
|
self.min_value = min_value
|
@@ -92,6 +91,101 @@ class InputField(MessageData):
|
|
92
91
|
attrs.append(f"is_param={self.is_param!r}")
|
93
92
|
return f"InputField({', '.join(attrs)})"
|
94
93
|
|
94
|
+
# All *explicit* conversions
|
95
|
+
def __int__(self):
|
96
|
+
return int(self.default)
|
97
|
+
|
98
|
+
def __float__(self):
|
99
|
+
return float(self.default)
|
100
|
+
|
101
|
+
def __str__(self):
|
102
|
+
return str(self.default)
|
103
|
+
|
104
|
+
def __bool__(self):
|
105
|
+
return bool(self.default)
|
106
|
+
|
107
|
+
def __index__(self):
|
108
|
+
return int(self.default) # for slicing
|
109
|
+
|
110
|
+
# sequence / mapping protocol delegation
|
111
|
+
def __len__(self):
|
112
|
+
return len(self.default)
|
113
|
+
|
114
|
+
def __iter__(self):
|
115
|
+
return iter(self.default)
|
116
|
+
|
117
|
+
def __reversed__(self):
|
118
|
+
return reversed(self.default)
|
119
|
+
|
120
|
+
def __contains__(self, item):
|
121
|
+
return item in self.default
|
122
|
+
|
123
|
+
def __getitem__(self, key):
|
124
|
+
return self.default[key]
|
125
|
+
|
126
|
+
def __setitem__(self, k, v):
|
127
|
+
self.default[k] = v
|
128
|
+
|
129
|
+
def __delitem__(self, k):
|
130
|
+
del self.default[k]
|
131
|
+
|
132
|
+
def __hash__(self):
|
133
|
+
return hash(self.default)
|
134
|
+
|
135
|
+
def __call__(self, *args, **kwargs):
|
136
|
+
return self.default(*args, **kwargs)
|
137
|
+
|
138
|
+
# Comparison operators
|
139
|
+
def __eq__(self, other):
|
140
|
+
return self.default == other
|
141
|
+
|
142
|
+
def __lt__(self, other):
|
143
|
+
return self.default < other
|
144
|
+
|
145
|
+
def __le__(self, other):
|
146
|
+
return self.default <= other
|
147
|
+
|
148
|
+
def __gt__(self, other):
|
149
|
+
return self.default > other
|
150
|
+
|
151
|
+
def __ge__(self, other):
|
152
|
+
return self.default >= other
|
153
|
+
|
154
|
+
# Arithmetic operators – # arithmetic & bitwise operators – auto-generated
|
155
|
+
_arith_ops = {
|
156
|
+
"__add__": operator.add,
|
157
|
+
"__sub__": operator.sub,
|
158
|
+
"__mul__": operator.mul,
|
159
|
+
"__truediv__": operator.truediv,
|
160
|
+
"__floordiv__": operator.floordiv,
|
161
|
+
"__mod__": operator.mod,
|
162
|
+
"__pow__": operator.pow,
|
163
|
+
"__and__": operator.and_,
|
164
|
+
"__or__": operator.or_,
|
165
|
+
"__xor__": operator.xor,
|
166
|
+
"__lshift__": operator.lshift,
|
167
|
+
"__rshift__": operator.rshift,
|
168
|
+
}
|
169
|
+
|
170
|
+
# Create both left- and right-hand versions of each operator
|
171
|
+
for _name, _op in _arith_ops.items():
|
172
|
+
|
173
|
+
def _make(op):
|
174
|
+
|
175
|
+
def _f(self, other, *, _op=op): # default arg binds op
|
176
|
+
return _op(self.default, other)
|
177
|
+
|
178
|
+
return _f
|
179
|
+
|
180
|
+
locals()[_name] = _make(_op)
|
181
|
+
locals()["__r" + _name[2:]] = _make(lambda x, y, _op=_op: _op(y, x))
|
182
|
+
del _name, _op, _make
|
183
|
+
|
184
|
+
# Attribute access delegation – anything we did *not* define above
|
185
|
+
# will automatically be looked up on the wrapped default value.
|
186
|
+
def __getattr__(self, item):
|
187
|
+
return getattr(self.default, item)
|
188
|
+
|
95
189
|
def to_proto(self, proto=None) -> InputFieldProto:
|
96
190
|
if proto is None:
|
97
191
|
proto = InputFieldProto()
|
@@ -159,8 +253,7 @@ class InputField(MessageData):
|
|
159
253
|
min_value=min_value,
|
160
254
|
max_value=max_value,
|
161
255
|
choices=choices,
|
162
|
-
is_param=proto.is_param
|
163
|
-
)
|
256
|
+
is_param=proto.is_param)
|
164
257
|
|
165
258
|
@classmethod
|
166
259
|
def set_default(cls, proto=None, default=None):
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.1
|
2
2
|
Name: clarifai
|
3
|
-
Version: 11.3.
|
3
|
+
Version: 11.3.0rc2
|
4
4
|
Summary: Clarifai Python SDK
|
5
5
|
Home-page: https://github.com/Clarifai/clarifai-python
|
6
6
|
Author: Clarifai
|
@@ -35,17 +35,6 @@ Requires-Dist: requests>=2.32.3
|
|
35
35
|
Requires-Dist: aiohttp>=3.10.0
|
36
36
|
Provides-Extra: all
|
37
37
|
Requires-Dist: pycocotools==2.0.6; extra == "all"
|
38
|
-
Dynamic: author
|
39
|
-
Dynamic: author-email
|
40
|
-
Dynamic: classifier
|
41
|
-
Dynamic: description
|
42
|
-
Dynamic: description-content-type
|
43
|
-
Dynamic: home-page
|
44
|
-
Dynamic: license
|
45
|
-
Dynamic: provides-extra
|
46
|
-
Dynamic: requires-dist
|
47
|
-
Dynamic: requires-python
|
48
|
-
Dynamic: summary
|
49
38
|
|
50
39
|
<h1 align="center">
|
51
40
|
<a href="https://www.clarifai.com/"><img alt="Clarifai" title="Clarifai" src="https://github.com/user-attachments/assets/623b883b-7fe5-4b95-bbfa-8691f5779af4"></a>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
clarifai/__init__.py,sha256=
|
1
|
+
clarifai/__init__.py,sha256=kMeZnAgSEbqXO6Bgi3rMVqiYvvDUpKkq1GVSh_Di1rA,26
|
2
2
|
clarifai/cli.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
clarifai/errors.py,sha256=RwzTajwds51wLD0MVlMC5kcpBnzRpreDLlazPSBZxrg,2605
|
4
4
|
clarifai/versions.py,sha256=jctnczzfGk_S3EnVqb2FjRKfSREkNmvNEwAAa_VoKiQ,222
|
@@ -218,7 +218,7 @@ clarifai/runners/utils/const.py,sha256=9qnOC1Bt6SGLQ9XCQEQ6519XhW4gzcztsV1Rgej67
|
|
218
218
|
clarifai/runners/utils/data_handler.py,sha256=sxy9zlAgI6ETuxCQhUgEXAn2GCsaW1GxpK6GTaMne0g,6966
|
219
219
|
clarifai/runners/utils/data_handler_refract.py,sha256=3M-V4hkOoF-9Ix4hE6ocXWiTJPc9dewtu6FMtddd-jQ,6343
|
220
220
|
clarifai/runners/utils/data_types.py,sha256=l_yd09GIlAZ_0bJdY558BuNSKTM48rx7fYA7-HNxETY,12415
|
221
|
-
clarifai/runners/utils/data_utils.py,sha256=
|
221
|
+
clarifai/runners/utils/data_utils.py,sha256=sfUuxhzHUi0f9iImSEy7cPfRrHcB3nV5BIcDz-lFXwo,15188
|
222
222
|
clarifai/runners/utils/loader.py,sha256=Sl0m29RDtMPx2cIiSbbDFtKHQj2ktXQ5CnkvaHi-zDc,8804
|
223
223
|
clarifai/runners/utils/logger.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
224
224
|
clarifai/runners/utils/method_signatures.py,sha256=2SSStcBuBUbIgvFgAJFt4By0ZHos2c7bDWJOiUxQxZQ,18190
|
@@ -314,9 +314,9 @@ clarifai/workflows/__pycache__/utils.cpython-310.pyc,sha256=M9_KTM7GOOS5SPrWwAzq
|
|
314
314
|
clarifai/workflows/__pycache__/utils.cpython-311.pyc,sha256=JCnQKQqbOOOEOUzZ3TTSp-HOlQcW4rknjrwgL8dWZy4,3340
|
315
315
|
clarifai/workflows/__pycache__/validate.cpython-310.pyc,sha256=c18Jgp_-CAm8RD_tmUpDCPoqZeexaoWELG0yBzb9rjw,2149
|
316
316
|
clarifai/workflows/__pycache__/validate.cpython-311.pyc,sha256=2zbJD8DHvTRtxbB0gKO6IyQuDhQp-lUPOa8_-RAOzrU,3509
|
317
|
-
clarifai-11.3.
|
318
|
-
clarifai-11.3.
|
319
|
-
clarifai-11.3.
|
320
|
-
clarifai-11.3.
|
321
|
-
clarifai-11.3.
|
322
|
-
clarifai-11.3.
|
317
|
+
clarifai-11.3.0rc2.dist-info/LICENSE,sha256=mUqF_d12-qE2n41g7C5_sq-BMLOcj6CNN-jevr15YHU,555
|
318
|
+
clarifai-11.3.0rc2.dist-info/METADATA,sha256=3nrcZz6zDKqobEwqj80MLd4TnZtqfGtR7Ha-ZtiaspE,22215
|
319
|
+
clarifai-11.3.0rc2.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
320
|
+
clarifai-11.3.0rc2.dist-info/entry_points.txt,sha256=X9FZ4Z-i_r2Ud1RpZ9sNIFYuu_-9fogzCMCRUD9hyX0,51
|
321
|
+
clarifai-11.3.0rc2.dist-info/top_level.txt,sha256=wUMdCQGjkxaynZ6nZ9FAnvBUCgp5RJUVFSy2j-KYo0s,9
|
322
|
+
clarifai-11.3.0rc2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|