Skip to content

Commit cf65397

Browse files
committed
updated with formatter changes
1 parent 651a0c0 commit cf65397

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

ads/model/datascience_model.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ def to_yaml(self) -> str:
411411
def validate(self) -> bool:
412412
"""Validates the backup operation details."""
413413
return not (
414-
(self.backup_state is not None and not self.backup_state in SettingStatus.values()) or
414+
(self.backup_state is not None and self.backup_state not in SettingStatus.values()) or
415415
(self.time_last_backup is not None and not isinstance(self.time_last_backup, int))
416416
)
417417

@@ -1536,15 +1536,16 @@ def update(self, **kwargs) -> "DataScienceModel":
15361536
self.dsc_model = self._to_oci_dsc_model(**kwargs).update()
15371537

15381538
logger.debug(f"Updating a model provenance metadata {self.provenance_metadata}")
1539-
try:
1540-
self.dsc_model.get_model_provenance()
1541-
self.dsc_model.update_model_provenance(
1542-
self.provenance_metadata._to_oci_metadata()
1543-
)
1544-
except ModelProvenanceNotFoundError:
1545-
self.dsc_model.create_model_provenance(
1546-
self.provenance_metadata._to_oci_metadata()
1547-
)
1539+
if self.provenance_metadata:
1540+
try:
1541+
self.dsc_model.get_model_provenance()
1542+
self.dsc_model.update_model_provenance(
1543+
self.provenance_metadata._to_oci_metadata()
1544+
)
1545+
except ModelProvenanceNotFoundError:
1546+
self.dsc_model.create_model_provenance(
1547+
self.provenance_metadata._to_oci_metadata()
1548+
)
15481549

15491550
return self.sync()
15501551

@@ -2036,7 +2037,7 @@ def add_artifact(
20362037
"Both 'prefix' and 'files' cannot be provided. Please provide only one."
20372038
)
20382039

2039-
if self.model_file_description == None:
2040+
if self.model_file_description is None:
20402041
self.empty_json = {
20412042
"version": "1.0",
20422043
"type": "modelOSSReferenceDescription",
@@ -2086,7 +2087,7 @@ def list_obj_versions_unpaginated():
20862087

20872088
# Fetch object details and put it into the objects variable
20882089
objectStorageList = []
2089-
if files == None:
2090+
if files is None:
20902091
objectStorageList = list_obj_versions_unpaginated()
20912092
else:
20922093
for fileName in files:
@@ -2174,7 +2175,7 @@ def remove_artifact(
21742175
if (not namespace) or (not bucket):
21752176
raise ValueError("Both 'namespace' and 'bucket' must be provided.")
21762177

2177-
def findModelIdx():
2178+
def find_model_idx():
21782179
for idx, model in enumerate(self.model_file_description["models"]):
21792180
if (
21802181
model["namespace"],
@@ -2184,10 +2185,10 @@ def findModelIdx():
21842185
return idx
21852186
return -1
21862187

2187-
if self.model_file_description == None:
2188+
if self.model_file_description is None:
21882189
return
21892190

2190-
modelSearchIdx = findModelIdx()
2191+
modelSearchIdx = find_model_idx()
21912192
if modelSearchIdx == -1:
21922193
return
21932194
else:

0 commit comments

Comments
 (0)