inferencesh 0.1.22__py3-none-any.whl → 0.1.24__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.
Potentially problematic release.
This version of inferencesh might be problematic. Click here for more details.
- inferencesh/__init__.py +1 -1
- inferencesh/sdk.py +22 -3
- {inferencesh-0.1.22.dist-info → inferencesh-0.1.24.dist-info}/METADATA +1 -1
- inferencesh-0.1.24.dist-info/RECORD +8 -0
- {inferencesh-0.1.22.dist-info → inferencesh-0.1.24.dist-info}/WHEEL +1 -1
- inferencesh-0.1.22.dist-info/RECORD +0 -8
- {inferencesh-0.1.22.dist-info → inferencesh-0.1.24.dist-info}/entry_points.txt +0 -0
- {inferencesh-0.1.22.dist-info → inferencesh-0.1.24.dist-info}/licenses/LICENSE +0 -0
- {inferencesh-0.1.22.dist-info → inferencesh-0.1.24.dist-info}/top_level.txt +0 -0
inferencesh/__init__.py
CHANGED
inferencesh/sdk.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Optional, Union
|
|
1
|
+
from typing import Optional, Union
|
|
2
2
|
from pydantic import BaseModel, ConfigDict, PrivateAttr, model_validator
|
|
3
3
|
import mimetypes
|
|
4
4
|
import os
|
|
@@ -114,6 +114,25 @@ class File(BaseModel):
|
|
|
114
114
|
populate_by_name=True
|
|
115
115
|
)
|
|
116
116
|
|
|
117
|
+
@classmethod
|
|
118
|
+
def __get_validators__(cls):
|
|
119
|
+
# First yield the default validators
|
|
120
|
+
yield cls.validate
|
|
121
|
+
|
|
122
|
+
@classmethod
|
|
123
|
+
def validate(cls, value):
|
|
124
|
+
"""Convert string values to File objects."""
|
|
125
|
+
if isinstance(value, str):
|
|
126
|
+
# If it's a string, treat it as a uri
|
|
127
|
+
return cls(uri=value)
|
|
128
|
+
elif isinstance(value, cls):
|
|
129
|
+
# If it's already a File instance, return it as is
|
|
130
|
+
return value
|
|
131
|
+
elif isinstance(value, dict):
|
|
132
|
+
# If it's a dict, use normal validation
|
|
133
|
+
return cls(**value)
|
|
134
|
+
raise ValueError(f'Invalid input for File: {value}')
|
|
135
|
+
|
|
117
136
|
@model_validator(mode='after')
|
|
118
137
|
def check_uri_or_path(self) -> 'File':
|
|
119
138
|
"""Validate that either uri or path is provided."""
|
|
@@ -170,7 +189,7 @@ class File(BaseModel):
|
|
|
170
189
|
if tmp_file is not None and hasattr(self, '_tmp_path'):
|
|
171
190
|
try:
|
|
172
191
|
os.unlink(self._tmp_path)
|
|
173
|
-
except:
|
|
192
|
+
except (OSError, IOError):
|
|
174
193
|
pass
|
|
175
194
|
raise RuntimeError(f"Error downloading URL {original_url}: {str(e)}")
|
|
176
195
|
|
|
@@ -179,7 +198,7 @@ class File(BaseModel):
|
|
|
179
198
|
if hasattr(self, '_tmp_path') and self._tmp_path:
|
|
180
199
|
try:
|
|
181
200
|
os.unlink(self._tmp_path)
|
|
182
|
-
except:
|
|
201
|
+
except (OSError, IOError):
|
|
183
202
|
pass
|
|
184
203
|
|
|
185
204
|
def _populate_metadata(self) -> None:
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
inferencesh/__init__.py,sha256=hbKkgHCh0lCdhWyHs3FHHRd8JfLeHkTd1bT4v79Fi8M,192
|
|
2
|
+
inferencesh/sdk.py,sha256=u8GbIAn5clg_9zHUy99zu2AidgBION4f1KcMJnmjChg,12417
|
|
3
|
+
inferencesh-0.1.24.dist-info/licenses/LICENSE,sha256=OsgqEWIh2el_QMj0y8O1A5Q5Dl-dxqqYbFE6fszuR4s,1086
|
|
4
|
+
inferencesh-0.1.24.dist-info/METADATA,sha256=FM54ThOJtpP14Z1-DN2ZV0Mv0g73md2u8kW15mJfSE4,2612
|
|
5
|
+
inferencesh-0.1.24.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
|
6
|
+
inferencesh-0.1.24.dist-info/entry_points.txt,sha256=6IC-fyozAqW3ljsMLGCXxJ0_ui2Jb-2fLHtoH1RTnEE,45
|
|
7
|
+
inferencesh-0.1.24.dist-info/top_level.txt,sha256=TSMHg3T1ThMl1HGAWmzBClwOYH1ump5neof9BfHIwaA,12
|
|
8
|
+
inferencesh-0.1.24.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
inferencesh/__init__.py,sha256=pR0MXSJe41LgJkjGK-jhZR7LjqCFdRZtNTV6qcjYSTI,123
|
|
2
|
-
inferencesh/sdk.py,sha256=MdGlTaZITc9nuE94jLU01L1LWsC5RKj-OpFre-x6CeI,11738
|
|
3
|
-
inferencesh-0.1.22.dist-info/licenses/LICENSE,sha256=OsgqEWIh2el_QMj0y8O1A5Q5Dl-dxqqYbFE6fszuR4s,1086
|
|
4
|
-
inferencesh-0.1.22.dist-info/METADATA,sha256=6q9C9dlBs5xz0eI0UzNmTnAl2QdKlEDykKejGlK5JWk,2612
|
|
5
|
-
inferencesh-0.1.22.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
|
6
|
-
inferencesh-0.1.22.dist-info/entry_points.txt,sha256=6IC-fyozAqW3ljsMLGCXxJ0_ui2Jb-2fLHtoH1RTnEE,45
|
|
7
|
-
inferencesh-0.1.22.dist-info/top_level.txt,sha256=TSMHg3T1ThMl1HGAWmzBClwOYH1ump5neof9BfHIwaA,12
|
|
8
|
-
inferencesh-0.1.22.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|