Skip to content

Commit 761b9e4

Browse files
committed
Black reformat & add_model_content fix for duplicate content
1 parent ff2b57a commit 761b9e4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/sasctl/_services/model_repository.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -336,10 +336,9 @@ def create_model(
336336
)
337337
model["scoreCodeType"] = score_code_type or model.get("scoreCodeType")
338338
model["trainTable"] = training_table or model.get("trainTable")
339-
model[
340-
"classificationEventProbabilityVariableName"
341-
] = event_prob_variable or model.get(
342-
"classificationEventProbabilityVariableName"
339+
model["classificationEventProbabilityVariableName"] = (
340+
event_prob_variable
341+
or model.get("classificationEventProbabilityVariableName")
343342
)
344343
model["classificationTargetEventValue"] = event_target_value or model.get(
345344
"classificationTargetEventValue"
@@ -412,13 +411,15 @@ def add_model_content(
412411
return cls.post(
413412
"/models/{}/contents".format(id_), files=files, params=params
414413
)
415-
# Delete the older duplicate model and rerun the API call
414+
# Deletes the duplicate content and reruns the API call
416415
except HTTPError as e:
417416
if e.code == 409:
418417
model_contents = cls.get_model_contents(id_)
419418
for item in model_contents:
420419
if item.name == name:
421420
cls.delete("/models/{}/contents/{}".format(id_, item.id))
421+
# Return json stream to beginning of file content
422+
files["files"][1].seek(0)
422423
return cls.post(
423424
"/models/{}/contents".format(id_),
424425
files=files,

0 commit comments

Comments
 (0)