Skip to content

Commit 6b846b6

Browse files
committed
patches
1 parent 3edac60 commit 6b846b6

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

osparc/api_client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,11 @@ def __deserialize(self, data, klass):
288288
# convert str to class
289289
if klass in self.NATIVE_TYPES_MAPPING:
290290
klass = self.NATIVE_TYPES_MAPPING[klass]
291+
# PATCH ----------------------
291292
elif klass.startswith("AnyOf"):
292293
from .models._any_of import deserialize_any_of
293294
return deserialize_any_of(data, self.__deserialize)
295+
# PATCH ----------------------
294296
else:
295297
klass = getattr(osparc.models, klass)
296298

@@ -555,14 +557,14 @@ def __deserialize_file(self, response):
555557
filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?',
556558
content_disposition).group(1)
557559
path = os.path.join(os.path.dirname(path), filename)
558-
560+
# PATCH -----------------
559561
try:
560562
with open(path, "w") as f:
561563
f.write(response.data)
562564
except TypeError:
563565
with open(path, "wb") as f:
564566
f.write(response.data)
565-
567+
# PATCH -----------------
566568
return path
567569

568570
def __deserialize_primitive(self, data, klass):

osparc/configuration.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,12 @@ class Configuration(object):
9696
)
9797
)
9898
"""
99-
99+
# PATCH ----------
100100
def __init__(self, host="https://api.osparc.io",
101101
api_key=None, api_key_prefix=None,
102102
username=None, password=None,
103103
signing_info=None):
104+
# PATCH ----------
104105
"""Constructor
105106
"""
106107
self.host = host

osparc/models/_any_of.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44
from .file import File
55

6-
AnyOfFilenumberintegerstring = Union[File, float, int, str]
6+
AnyOfFilenumberintegerbooleanstring = Union[File, float, int, bool, str]
77

88
def deserialize_any_of(
99
data: Any,
1010
deserialize_func: Callable,
1111
):
12-
for klass in [File, float, int, str]:
12+
for klass in [File, float, int, bool, str]:
1313
with suppress(Exception):
1414
return deserialize_func(data, klass)
1515
raise ValueError(f"Cannot deserialize {data}")

osparc/rest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,13 @@ def request(self, method, url, query_params=None, headers=None,
220220
# In the python 3, the response.data is bytes.
221221
# we need to decode it to string.
222222
if six.PY3:
223+
# PATCH-------------------------------------
223224
try:
224225
r.data = r.data.decode('utf8')
225226
except UnicodeDecodeError:
226227
# NOTE: hdf5 files cannot be decoded
227228
pass
229+
# PATCH-------------------------------------
228230

229231
if not 200 <= r.status <= 299:
230232
raise ApiException(http_resp=r)

0 commit comments

Comments
 (0)