@@ -1061,14 +1061,14 @@ def status(self, project_id: int):
10611061 print (f"\t { commit ['message' ]} " )
10621062 print ("Use the `push` method to push your changes to the platform." )
10631063
1064- def restore (self , resource_name : str , project_id : int ):
1064+ def restore (self , * resource_names : str , project_id : int ):
10651065 """Removes the resource specified by ``resource_name`` from the staging area.
10661066
10671067 Parameters
10681068 ----------
1069- resource_name : str
1070- The name of the resource to restore. Can be one of ``"model"``, ``"training"``,
1071- or ``"validation"``.
1069+ *resource_names : str
1070+ The names of the resources to restore, separated by comma. Valid resource names
1071+ are ``"model"``, ``"training"``, and ``"validation"``.
10721072
10731073 .. important::
10741074 To see the names of the resources staged, use the :obj:`status` method.
@@ -1093,22 +1093,23 @@ def restore(self, resource_name: str, project_id: int):
10931093 """
10941094 project_dir = f"{ OPENLAYER_DIR } /{ project_id } /staging"
10951095
1096- if not os .path .exists (f"{ project_dir } /{ resource_name } " ):
1097- print (
1098- f"There's no resource named `{ resource_name } ` in the staging area. "
1099- "Make sure that you are trying to restore a staged resource. "
1100- "To see the names of the resources staged, use the `status` method."
1101- )
1102- return
1096+ for resource_name in resource_names :
1097+ if not os .path .exists (f"{ project_dir } /{ resource_name } " ):
1098+ print (
1099+ f"There's no resource named `{ resource_name } ` in the staging area. "
1100+ "Make sure that you are trying to restore a staged resource. "
1101+ "To see the names of the resources staged, use the `status` method."
1102+ )
1103+ return
11031104
1104- shutil .rmtree (f"{ project_dir } /{ resource_name } " )
1105- print (f"Removed resource `{ resource_name } ` from the staging area." )
1105+ shutil .rmtree (f"{ project_dir } /{ resource_name } " )
1106+ print (f"Removed resource `{ resource_name } ` from the staging area." )
11061107
1107- # Remove commit if there are no more resources staged
1108- if len (os .listdir (project_dir )) == 1 and os .path .exists (
1109- f"{ project_dir } /commit.yaml"
1110- ):
1111- os .remove (f"{ project_dir } /commit.yaml" )
1108+ # Remove commit if there are no more resources staged
1109+ if len (os .listdir (project_dir )) == 1 and os .path .exists (
1110+ f"{ project_dir } /commit.yaml"
1111+ ):
1112+ os .remove (f"{ project_dir } /commit.yaml" )
11121113
11131114 def _stage_resource (
11141115 self , resource_name : str , resource_dir : str , project_id : int , force : bool
0 commit comments