@@ -1467,7 +1467,7 @@ def _download_file_description_artifact(self) -> Tuple[Union[str, List[str]], in
14671467 bucket_uri .append (uri )
14681468
14691469 return bucket_uri [0 ] if len (bucket_uri ) == 1 else bucket_uri , artifact_size
1470-
1470+
14711471 def add_artifact (
14721472 self ,
14731473 uri : Optional [str ] = None ,
@@ -1512,29 +1512,39 @@ def add_artifact(
15121512 """
15131513
15141514 if uri and (namespace or bucket ):
1515- raise ValueError ("Either 'uri' must be provided or both 'namespace' and 'bucket' must be provided." )
1515+ raise ValueError (
1516+ "Either 'uri' must be provided or both 'namespace' and 'bucket' must be provided."
1517+ )
15161518 if uri :
15171519 object_storage_details = ObjectStorageDetails .from_path (uri )
15181520 bucket = object_storage_details .bucket
15191521 namespace = object_storage_details .namespace
1520- prefix = None if object_storage_details .filepath == "" else object_storage_details .filepath
1521- if ((not namespace ) or (not bucket )):
1522+ prefix = (
1523+ None
1524+ if object_storage_details .filepath == ""
1525+ else object_storage_details .filepath
1526+ )
1527+ if (not namespace ) or (not bucket ):
15221528 raise ValueError ("Both 'namespace' and 'bucket' must be provided." )
15231529
15241530 # Check if both prefix and files are provided
15251531 if prefix is not None and files is not None :
1526- raise ValueError ("Both 'prefix' and 'files' cannot be provided. Please provide only one." )
1527-
1532+ raise ValueError (
1533+ "Both 'prefix' and 'files' cannot be provided. Please provide only one."
1534+ )
1535+
15281536 if self .model_file_description == None :
15291537 self .empty_json = {
15301538 "version" : "1.0" ,
15311539 "type" : "modelOSSReferenceDescription" ,
15321540 "models" : [],
15331541 }
15341542 self .set_spec (self .CONST_MODEL_FILE_DESCRIPTION , self .empty_json )
1535-
1543+
15361544 # Get object storage client
1537- self .object_storage_client = oc .OCIClientFactory (** (self .dsc_model .auth )).object_storage
1545+ self .object_storage_client = oc .OCIClientFactory (
1546+ ** (self .dsc_model .auth )
1547+ ).object_storage
15381548
15391549 # Remove if the model already exists
15401550 self .remove_artifact (namespace = namespace , bucket = bucket , prefix = prefix )
@@ -1611,14 +1621,14 @@ def list_obj_versions_unpaginated():
16111621 }
16121622 )
16131623 self .set_spec (self .CONST_MODEL_FILE_DESCRIPTION , tmp_model_file_description )
1614-
1624+
16151625 def remove_artifact (
1616- self ,
1617- uri : Optional [str ] = None ,
1618- namespace : Optional [str ] = None ,
1619- bucket : Optional [str ] = None ,
1620- prefix : Optional [str ] = None
1621- ):
1626+ self ,
1627+ uri : Optional [str ] = None ,
1628+ namespace : Optional [str ] = None ,
1629+ bucket : Optional [str ] = None ,
1630+ prefix : Optional [str ] = None ,
1631+ ):
16221632 """
16231633 Removes information about objects in a specified bucket or using a specified URI from the model description JSON.
16241634
@@ -1644,15 +1654,21 @@ def remove_artifact(
16441654 - If neither 'uri' nor both 'namespace' and 'bucket' are provided.
16451655 - If the model description JSON is None.
16461656 """
1647-
1657+
16481658 if uri and (namespace or bucket ):
1649- raise ValueError ("Either 'uri' must be provided or both 'namespace' and 'bucket' must be provided." )
1659+ raise ValueError (
1660+ "Either 'uri' must be provided or both 'namespace' and 'bucket' must be provided."
1661+ )
16501662 if uri :
16511663 object_storage_details = ObjectStorageDetails .from_path (uri )
16521664 bucket = object_storage_details .bucket
16531665 namespace = object_storage_details .namespace
1654- prefix = None if object_storage_details .filepath == "" else object_storage_details .filepath
1655- if ((not namespace ) or (not bucket )):
1666+ prefix = (
1667+ None
1668+ if object_storage_details .filepath == ""
1669+ else object_storage_details .filepath
1670+ )
1671+ if (not namespace ) or (not bucket ):
16561672 raise ValueError ("Both 'namespace' and 'bucket' must be provided." )
16571673
16581674 def findModelIdx ():
@@ -1667,10 +1683,10 @@ def findModelIdx():
16671683
16681684 if self .model_file_description == None :
16691685 return
1670-
1686+
16711687 modelSearchIdx = findModelIdx ()
16721688 if modelSearchIdx == - 1 :
16731689 return
16741690 else :
16751691 # model found case
1676- self .model_file_description ["models" ].pop (modelSearchIdx )
1692+ self .model_file_description ["models" ].pop (modelSearchIdx )
0 commit comments