synapse-sdk 1.0.0a44__py3-none-any.whl → 1.0.0a45__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 synapse-sdk might be problematic. Click here for more details.
- synapse_sdk/plugins/categories/export/actions/export.py +3 -4
- synapse_sdk/plugins/categories/export/templates/plugin/export.py +1 -1
- synapse_sdk/plugins/categories/upload/templates/config.yaml +2 -0
- synapse_sdk/utils/http.py +10 -9
- {synapse_sdk-1.0.0a44.dist-info → synapse_sdk-1.0.0a45.dist-info}/METADATA +1 -1
- {synapse_sdk-1.0.0a44.dist-info → synapse_sdk-1.0.0a45.dist-info}/RECORD +10 -10
- {synapse_sdk-1.0.0a44.dist-info → synapse_sdk-1.0.0a45.dist-info}/WHEEL +0 -0
- {synapse_sdk-1.0.0a44.dist-info → synapse_sdk-1.0.0a45.dist-info}/entry_points.txt +0 -0
- {synapse_sdk-1.0.0a44.dist-info → synapse_sdk-1.0.0a45.dist-info}/licenses/LICENSE +0 -0
- {synapse_sdk-1.0.0a44.dist-info → synapse_sdk-1.0.0a45.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import json
|
|
2
1
|
from abc import ABC, abstractmethod
|
|
3
2
|
from datetime import datetime
|
|
4
3
|
from typing import Annotated, Any, Literal
|
|
@@ -33,7 +32,7 @@ class ExportRun(Run):
|
|
|
33
32
|
"""Log export file information.
|
|
34
33
|
|
|
35
34
|
Args:
|
|
36
|
-
log_type (str): The type of log ('export_data_file' or '
|
|
35
|
+
log_type (str): The type of log ('export_data_file' or 'export_original_file').
|
|
37
36
|
target_id (int): The ID of the data file.
|
|
38
37
|
data_file_info (dict): The JSON info of the data file.
|
|
39
38
|
status (ExportStatus): The status of the data file.
|
|
@@ -44,7 +43,7 @@ class ExportRun(Run):
|
|
|
44
43
|
log_type,
|
|
45
44
|
self.DataFileLog(
|
|
46
45
|
target_id=target_id,
|
|
47
|
-
data_file_info=
|
|
46
|
+
data_file_info=data_file_info,
|
|
48
47
|
status=status.value,
|
|
49
48
|
error=error,
|
|
50
49
|
created=now,
|
|
@@ -69,7 +68,7 @@ class ExportRun(Run):
|
|
|
69
68
|
error: str | None = None,
|
|
70
69
|
):
|
|
71
70
|
"""Log export origin data file."""
|
|
72
|
-
self.log_file('
|
|
71
|
+
self.log_file('export_original_file', target_id, data_file_info, status, error)
|
|
73
72
|
|
|
74
73
|
|
|
75
74
|
class ExportTargetHandler(ABC):
|
|
@@ -140,7 +140,7 @@ def save_as_json(run, result, base_path, error_file_list):
|
|
|
140
140
|
# Default save file name: original file name
|
|
141
141
|
file_name = get_original_file_pathlib(result['files']).stem
|
|
142
142
|
json_data = result['data']
|
|
143
|
-
file_info = {'file_name': file_name}
|
|
143
|
+
file_info = {'file_name': f'{file_name}.json'}
|
|
144
144
|
error_msg = ''
|
|
145
145
|
try:
|
|
146
146
|
with (base_path / f'{file_name}.json').open('w', encoding='utf-8') as f:
|
synapse_sdk/utils/http.py
CHANGED
|
@@ -28,7 +28,7 @@ class SingleFileHttpServer(SimpleHTTPRequestHandler):
|
|
|
28
28
|
"""Handle GET requests by serving the single file."""
|
|
29
29
|
try:
|
|
30
30
|
# Check if the path matches our random path
|
|
31
|
-
if self.random_path and self.path == f
|
|
31
|
+
if self.random_path and self.path == f'/{self.random_path}':
|
|
32
32
|
self.send_response(200)
|
|
33
33
|
if self.content_type:
|
|
34
34
|
self.send_header('Content-type', self.content_type)
|
|
@@ -37,13 +37,13 @@ class SingleFileHttpServer(SimpleHTTPRequestHandler):
|
|
|
37
37
|
|
|
38
38
|
with open(self.file_path, 'rb') as file:
|
|
39
39
|
self.wfile.write(file.read())
|
|
40
|
-
elif self.path ==
|
|
40
|
+
elif self.path == '/':
|
|
41
41
|
# Redirect root to the random path
|
|
42
42
|
self.send_response(302)
|
|
43
|
-
self.send_header('Location', f
|
|
43
|
+
self.send_header('Location', f'/{self.random_path}')
|
|
44
44
|
self.end_headers()
|
|
45
45
|
else:
|
|
46
|
-
self.send_error(404,
|
|
46
|
+
self.send_error(404, 'File not found')
|
|
47
47
|
|
|
48
48
|
except Exception as e:
|
|
49
49
|
self.send_error(500, str(e))
|
|
@@ -81,8 +81,8 @@ def temp_file_server(image=None, file_path=None, format='JPEG', host='0.0.0.0',
|
|
|
81
81
|
temp_file_path = None
|
|
82
82
|
|
|
83
83
|
try:
|
|
84
|
-
random_filename = f
|
|
85
|
-
|
|
84
|
+
random_filename = f'{uuid.uuid4().hex}'
|
|
85
|
+
|
|
86
86
|
if image is not None:
|
|
87
87
|
temp_dir = tempfile.mkdtemp()
|
|
88
88
|
ext_map = {'JPEG': '.jpg', 'PNG': '.png', 'GIF': '.gif', 'WEBP': '.webp'}
|
|
@@ -101,8 +101,9 @@ def temp_file_server(image=None, file_path=None, format='JPEG', host='0.0.0.0',
|
|
|
101
101
|
random_filename += ext
|
|
102
102
|
|
|
103
103
|
def handler(*args, **kwargs):
|
|
104
|
-
return SingleFileHttpServer(
|
|
105
|
-
|
|
104
|
+
return SingleFileHttpServer(
|
|
105
|
+
*args, file_path=file_path, content_type=content_type, random_path=random_filename, **kwargs
|
|
106
|
+
)
|
|
106
107
|
|
|
107
108
|
server = HTTPServer((host, port), handler)
|
|
108
109
|
|
|
@@ -120,7 +121,7 @@ def temp_file_server(image=None, file_path=None, format='JPEG', host='0.0.0.0',
|
|
|
120
121
|
except requests.exceptions.ConnectionError:
|
|
121
122
|
pass
|
|
122
123
|
time.sleep(0.01)
|
|
123
|
-
|
|
124
|
+
|
|
124
125
|
try:
|
|
125
126
|
yield url
|
|
126
127
|
finally:
|
|
@@ -61,10 +61,10 @@ synapse_sdk/plugins/categories/data_validation/templates/plugin/validation.py,sh
|
|
|
61
61
|
synapse_sdk/plugins/categories/export/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
62
62
|
synapse_sdk/plugins/categories/export/enums.py,sha256=gtyngvQ1DKkos9iKGcbecwTVQQ6sDwbrBPSGPNb5Am0,127
|
|
63
63
|
synapse_sdk/plugins/categories/export/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
64
|
-
synapse_sdk/plugins/categories/export/actions/export.py,sha256=
|
|
64
|
+
synapse_sdk/plugins/categories/export/actions/export.py,sha256=CHALeT0qE4tsMivDCNTQqsSBs0BNBXYsN-c6D4KFl8c,9898
|
|
65
65
|
synapse_sdk/plugins/categories/export/templates/config.yaml,sha256=N7YmnFROb3s3M35SA9nmabyzoSb5O2t2TRPicwFNN2o,56
|
|
66
66
|
synapse_sdk/plugins/categories/export/templates/plugin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
67
|
-
synapse_sdk/plugins/categories/export/templates/plugin/export.py,sha256=
|
|
67
|
+
synapse_sdk/plugins/categories/export/templates/plugin/export.py,sha256=UzPOYvH2rwUlTUpMgcbn7mBsenf3hmWytE-eD_cB_9A,5202
|
|
68
68
|
synapse_sdk/plugins/categories/neural_net/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
69
69
|
synapse_sdk/plugins/categories/neural_net/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
70
70
|
synapse_sdk/plugins/categories/neural_net/actions/deployment.py,sha256=y2LrS-pwazqRI5O0q1NUy45NQYsBj6ykbrXnDMs_fqE,1987
|
|
@@ -101,7 +101,7 @@ synapse_sdk/plugins/categories/smart_tool/templates/plugin/auto_label.py,sha256=
|
|
|
101
101
|
synapse_sdk/plugins/categories/upload/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
102
102
|
synapse_sdk/plugins/categories/upload/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
103
103
|
synapse_sdk/plugins/categories/upload/actions/upload.py,sha256=9DIH4Aw70LxDpfhrpD0MfncE1m9oj-v52FpaChkVEnA,14755
|
|
104
|
-
synapse_sdk/plugins/categories/upload/templates/config.yaml,sha256=
|
|
104
|
+
synapse_sdk/plugins/categories/upload/templates/config.yaml,sha256=PARk7_F5zNqMK6VMXiMtzG16Um9i0-f-tHYa38Nf498,225
|
|
105
105
|
synapse_sdk/plugins/categories/upload/templates/plugin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
106
106
|
synapse_sdk/plugins/categories/upload/templates/plugin/upload.py,sha256=dnK8gy33GjG5ettayawDJv1gM3xCm1K6lM-PfeeTjQw,1163
|
|
107
107
|
synapse_sdk/plugins/templates/cookiecutter.json,sha256=NxOWk9A_v1pO0Ny4IYT9Cj5iiJ16--cIQrGC67QdR0I,396
|
|
@@ -120,7 +120,7 @@ synapse_sdk/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
|
|
|
120
120
|
synapse_sdk/utils/dataset.py,sha256=zWTzFmv589izFr62BDuApi3r5FpTsdm-5AmriC0AEdM,1865
|
|
121
121
|
synapse_sdk/utils/debug.py,sha256=F7JlUwYjTFZAMRbBqKm6hxOIz-_IXYA8lBInOS4jbS4,100
|
|
122
122
|
synapse_sdk/utils/file.py,sha256=wWBQAx0cB5a-fjfRMeJV-KjBil1ZyKRz-vXno3xBSoo,6834
|
|
123
|
-
synapse_sdk/utils/http.py,sha256=
|
|
123
|
+
synapse_sdk/utils/http.py,sha256=yRxYfru8tMnBVeBK-7S0Ga13yOf8oRHquG5e8K_FWcI,4759
|
|
124
124
|
synapse_sdk/utils/module_loading.py,sha256=chHpU-BZjtYaTBD_q0T7LcKWtqKvYBS4L0lPlKkoMQ8,1020
|
|
125
125
|
synapse_sdk/utils/network.py,sha256=WI8qn6KlKpHdMi45V57ofKJB8zusJrbQsxT74LwVfsY,1000
|
|
126
126
|
synapse_sdk/utils/string.py,sha256=rEwuZ9SAaZLcQ8TYiwNKr1h2u4CfnrQx7SUL8NWmChg,216
|
|
@@ -134,9 +134,9 @@ synapse_sdk/utils/storage/providers/__init__.py,sha256=x7RGwZryT2FpVxS7fGWryRVpq
|
|
|
134
134
|
synapse_sdk/utils/storage/providers/gcp.py,sha256=i2BQCu1Kej1If9SuNr2_lEyTcr5M_ncGITZrL0u5wEA,363
|
|
135
135
|
synapse_sdk/utils/storage/providers/s3.py,sha256=W94rQvhGRXti3R4mYP7gmU5pcyCQpGFIBLvxxqLVdRM,2231
|
|
136
136
|
synapse_sdk/utils/storage/providers/sftp.py,sha256=_8s9hf0JXIO21gvm-JVS00FbLsbtvly4c-ETLRax68A,1426
|
|
137
|
-
synapse_sdk-1.0.
|
|
138
|
-
synapse_sdk-1.0.
|
|
139
|
-
synapse_sdk-1.0.
|
|
140
|
-
synapse_sdk-1.0.
|
|
141
|
-
synapse_sdk-1.0.
|
|
142
|
-
synapse_sdk-1.0.
|
|
137
|
+
synapse_sdk-1.0.0a45.dist-info/licenses/LICENSE,sha256=bKzmC5YAg4V1Fhl8OO_tqY8j62hgdncAkN7VrdjmrGk,1101
|
|
138
|
+
synapse_sdk-1.0.0a45.dist-info/METADATA,sha256=Txp3cPnNXTEMiw3T0QPEdBZVg2gUi8M8Bv9c48yEvbw,1203
|
|
139
|
+
synapse_sdk-1.0.0a45.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
140
|
+
synapse_sdk-1.0.0a45.dist-info/entry_points.txt,sha256=VNptJoGoNJI8yLXfBmhgUefMsmGI0m3-0YoMvrOgbxo,48
|
|
141
|
+
synapse_sdk-1.0.0a45.dist-info/top_level.txt,sha256=ytgJMRK1slVOKUpgcw3LEyHHP7S34J6n_gJzdkcSsw8,12
|
|
142
|
+
synapse_sdk-1.0.0a45.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|