wizata-dsapi 1.3.35__py3-none-any.whl → 1.3.36__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.
wizata_dsapi/mlmodel.py CHANGED
@@ -1,4 +1,4 @@
1
- from typing import List, Iterator, Union
1
+ from typing import List, Iterator, Union, Optional
2
2
  import os
3
3
  from .api_dto import ApiDto
4
4
  from datetime import datetime, timezone
@@ -49,13 +49,32 @@ class ModelFile:
49
49
  size: int = None,
50
50
  content = None):
51
51
  self.full_path = full_path
52
- self.path = path
53
52
  self.name = name
54
53
  self.extension = extension
54
+ self.path = path
55
55
  self.last_modified = last_modified
56
56
  self.size = size
57
57
  self.content = content
58
58
 
59
+
60
+ @property
61
+ def path(self) -> Optional[str]:
62
+ if self.name and self.extension:
63
+ return f"{self.name}.{self.extension}"
64
+ return self.name or None
65
+
66
+ @path.setter
67
+ def path(self, value: Optional[str]):
68
+ if not value:
69
+ self.name = None
70
+ self.extension = None
71
+ return
72
+
73
+ base = os.path.basename(value.strip())
74
+ name_part, ext = os.path.splitext(base)
75
+ self.name = name_part or None
76
+ self.extension = ext.lstrip(".").lower() if ext else None
77
+
59
78
  def to_json(self):
60
79
  """
61
80
  convert this entity in a dict that can be json serializable
@@ -64,12 +83,12 @@ class ModelFile:
64
83
  obj = {}
65
84
  if self.full_path is not None:
66
85
  obj["full_path"] = str(self.full_path)
67
- if self.path is not None:
68
- obj["path"] = self.path
69
86
  if self.name is not None:
70
87
  obj["name"] = self.name
71
88
  if self.extension is not None:
72
89
  obj["extension"] = self.extension
90
+ if self.path is not None:
91
+ obj["path"] = self.path
73
92
  if self.last_modified is not None:
74
93
  obj["last_modified"] = self.last_modified.timestamp() * 1000.0
75
94
  if self.size is not None:
@@ -82,12 +101,12 @@ class ModelFile:
82
101
  """
83
102
  if "full_path" in obj.keys():
84
103
  self.full_path = obj["full_path"]
85
- if "path" in obj.keys():
86
- self.path = obj["path"]
87
104
  if "name" in obj.keys():
88
105
  self.name = obj["name"]
89
106
  if "extension" in obj.keys():
90
107
  self.extension = obj["extension"]
108
+ if not self.name and not self.extension and "path" in obj:
109
+ self.path = obj["path"]
91
110
  if "last_modified" in obj.keys():
92
111
  self.last_modified = datetime.fromtimestamp(obj["last_modified"] / 1000, tz=timezone.utc)
93
112
  if "size" in obj.keys():
wizata_dsapi/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.3.35"
1
+ __version__ = "1.3.36"
@@ -1104,9 +1104,18 @@ class WizataDSAPIClient(ApiInterface):
1104
1104
  if response.status_code == 200:
1105
1105
  response_json = response.json()
1106
1106
  if "identifier" in response_json:
1107
- key , twin, property, alias = ModelInfo.split_identifier(response_json["identifier"])
1107
+ key , twin, property_value, alias = ModelInfo.split_identifier(response_json["identifier"])
1108
1108
  if alias is not None:
1109
1109
  model_info.alias = alias
1110
+ for file in model_info.files:
1111
+ file: wizata_dsapi.ModelFile
1112
+ if file.name != "trained_model":
1113
+ headers["Content-Type"] = "application/octet-stream"
1114
+ response = requests.post(self.__url() + f"models/{model_info.identifier(include_alias=True)}/files/{file.name}",
1115
+ data=file.content,
1116
+ timeout=60)
1117
+ if response.status_code != 200 and response.status_code != 201:
1118
+ raise self.__raise_error(response)
1110
1119
  return model_info
1111
1120
  else:
1112
1121
  raise self.__raise_error(response)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wizata-dsapi
3
- Version: 1.3.35
3
+ Version: 1.3.36
4
4
  Summary: Wizata Data Science Toolkit
5
5
  Author: Wizata S.A.
6
6
  Author-email: info@wizata.com
@@ -16,7 +16,7 @@ wizata_dsapi/experiment.py,sha256=QYQ1CJ-MTWsXq08xYbm5sAp95dRxbPOmGDgaAOoBMDQ,46
16
16
  wizata_dsapi/group_system.py,sha256=6rUKe0_J3YWACysyBlzuw_TEpKNXgLOMxhpWsNxOzwY,1708
17
17
  wizata_dsapi/ilogger.py,sha256=iYnID-Z-qrYhie26C43404aIuU4_tHSKXbDeQIdo82Q,807
18
18
  wizata_dsapi/insight.py,sha256=ABFZ04DqYxxzqAEfU1tzlTZqqrigM-zN-8Lbetko3g0,6468
19
- wizata_dsapi/mlmodel.py,sha256=VPfjdTAQ2X20kAkfAXKGGlqEUkzMCY9NcKVj422YYQ4,21993
19
+ wizata_dsapi/mlmodel.py,sha256=j86RaIrMlYrJd6oh4zIdj-YvGMZBG2X-J9Q09lK6fi0,22579
20
20
  wizata_dsapi/model_toolkit.py,sha256=UNyw5CFSgZeXydQFsiDIRTjoMeqIsdyIIuiwumLW5bA,1574
21
21
  wizata_dsapi/paged_query_result.py,sha256=0Iyt2Kd4tvrfthhT-tk9EmSERsbJTaPNON2euHcBn6k,1150
22
22
  wizata_dsapi/pipeline.py,sha256=WDJeOxPZJiYW1qwTNZUm3jom2epIxqrSoiUwcrTF9EE,31300
@@ -31,10 +31,10 @@ wizata_dsapi/template.py,sha256=wtCRKKk3PchH4RrNgNYlEF_9C6bzZwKIeLyEvgv6Fdo,1370
31
31
  wizata_dsapi/trigger.py,sha256=w3BZYP-L3SUwvaT0oCTanh_Ewn57peZvlt7vxzHv9J8,5129
32
32
  wizata_dsapi/twin.py,sha256=S0DUzQf1smZXZTdXpXZPtkZYCfKIhw53EecCnsl9i4Q,11017
33
33
  wizata_dsapi/twinregistration.py,sha256=Mi6-YuwroiEXc0c1hgrOaphh4hNVoHupxOnXedVtJtE,13377
34
- wizata_dsapi/version.py,sha256=X9wwJLVQWqESOn2IYyoaDZxF1SSf2EHnlJd49iZiLGU,23
34
+ wizata_dsapi/version.py,sha256=BRWayE816feIKOA2gDVw4549ZSjpuCcSJW19cVRnPLs,23
35
35
  wizata_dsapi/wizard_function.py,sha256=RbM7W7Gf-6Rhp_1dU9DBYkHaciknGAGvuAndhAS_vyo,942
36
36
  wizata_dsapi/wizard_request.py,sha256=v6BaqKLKvTWmUSo0_gda9FabAQz5x_-GOH1Av50GzFo,3762
37
- wizata_dsapi/wizata_dsapi_client.py,sha256=-4fE22nZPSTOzByt6mGebf774gPMoqvoIp33a3BLFis,76691
37
+ wizata_dsapi/wizata_dsapi_client.py,sha256=xOVg-7hlN4gAS01E-mNglSDMS7t-5LqbpEa8hvGQVJU,77303
38
38
  wizata_dsapi/words.py,sha256=tV8CqzCqODZCV7PgBxBF5exBxeF_ya9t5DiUy-cg6Sg,1535
39
39
  wizata_dsapi/models/__init__.py,sha256=O5PHqw8lKILw4apO-MfDxPz73wK0vADD9y3xjuzX7Tw,104
40
40
  wizata_dsapi/models/common.py,sha256=1dTqE80-mFJnUwEdNlJdhJzfZ2N5Kp8Nb3LQ8uwPtLc,3808
@@ -42,8 +42,8 @@ wizata_dsapi/plots/__init__.py,sha256=qgnSFqrjOPur-807M8uh5awIfjM1ZHXUXcAqHc-r2l
42
42
  wizata_dsapi/plots/common.py,sha256=jdPsJqLHBwSKc6dX83BSGPqSRxzIVNHSYO5yI_8sjGk,6568
43
43
  wizata_dsapi/scripts/__init__.py,sha256=hAxiETSQf0qOHde1si1tEAJU48seqEgHrchCzS2-LvQ,80
44
44
  wizata_dsapi/scripts/common.py,sha256=efwq-Rd0lvYljIs3gSFz9izogBD7asOU2cTK-IvHTkM,4244
45
- wizata_dsapi-1.3.35.dist-info/LICENSE.txt,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
46
- wizata_dsapi-1.3.35.dist-info/METADATA,sha256=wl5Nn6q8EQA8vJToONdXUGyW3pEh51dNe4DtveHaD4A,6119
47
- wizata_dsapi-1.3.35.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
48
- wizata_dsapi-1.3.35.dist-info/top_level.txt,sha256=-OeTJbEnh5DuWyTOHtvw0Dw3LRg3G27TNS6W4ZtfwPs,13
49
- wizata_dsapi-1.3.35.dist-info/RECORD,,
45
+ wizata_dsapi-1.3.36.dist-info/LICENSE.txt,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
46
+ wizata_dsapi-1.3.36.dist-info/METADATA,sha256=lTfmPDS4oQn_lwE9XRYhhig7raQMBLhhfVd4_R9G1ew,6119
47
+ wizata_dsapi-1.3.36.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
48
+ wizata_dsapi-1.3.36.dist-info/top_level.txt,sha256=-OeTJbEnh5DuWyTOHtvw0Dw3LRg3G27TNS6W4ZtfwPs,13
49
+ wizata_dsapi-1.3.36.dist-info/RECORD,,