Skip to content

Commit 4e3cf55

Browse files
gustavocidornelaswhoseoyster
authored andcommitted
Fix pylint issues
1 parent 67c2c36 commit 4e3cf55

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

openlayer/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,7 +1183,7 @@ def _post_push_cleanup(self, project_dir: str) -> None:
11831183
shutil.rmtree(project_dir)
11841184
os.makedirs(project_dir, exist_ok=True)
11851185

1186-
def export(self, destination_dir: str, project_id: int):
1186+
def export(self, destination_dir: str, project_id: int, task_type: TaskType):
11871187
"""Exports the commited resources as a tarfile to the location specified
11881188
by ``destination_dir``.
11891189
@@ -1216,7 +1216,7 @@ def export(self, destination_dir: str, project_id: int):
12161216
"""
12171217
project_dir = f"{OPENLAYER_DIR}/{project_id}/staging"
12181218

1219-
if self._ready_for_push(project_dir=project_dir):
1219+
if self._ready_for_push(project_dir=project_dir, task_type=task_type):
12201220
# Tar the project's staging area
12211221
with tempfile.TemporaryDirectory() as tmp_dir:
12221222
tar_file_path = os.path.join(tmp_dir, "tarfile")

openlayer/models.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -467,10 +467,10 @@ def get_model_runner(
467467
logger : Optional[logging.Logger], optional
468468
Logger to use, by default None
469469
"""
470-
if (
471-
task_type == tasks.TaskType.TabularClassification
472-
or task_type == tasks.TaskType.TextClassification
473-
):
470+
if task_type in [
471+
tasks.TaskType.TabularClassification,
472+
tasks.TaskType.TextClassification,
473+
]:
474474
return ClassificationModelRunner(model_package, logger)
475475
elif task_type == tasks.TaskType.TabularRegression:
476476
return RegressionModelRunner(model_package, logger)

openlayer/projects.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ def push(self, *args, **kwargs):
8585

8686
def export(self, *args, **kwargs):
8787
"""Exports the commited resources to a specified location."""
88-
return self.client.export(*args, project_id=self.id, **kwargs)
88+
return self.client.export(
89+
*args, project_id=self.id, task_type=tasks.TaskType(self.taskType), **kwargs
90+
)
8991

9092
def status(self, *args, **kwargs):
9193
"""Shows the state of the staging area."""

openlayer/schemas.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class BaselineModelSchema(maos.OneOfSchema):
5353

5454
def get_obj_type(self, obj):
5555
if obj != "tabular-classification":
56-
raise Exception(f"Unknown object type: {obj.__class__.__name__}")
56+
raise ma.ValidationError(f"Unknown object type: {obj.__class__.__name__}")
5757
return obj
5858

5959

@@ -187,7 +187,7 @@ def get_obj_type(self, obj):
187187
"text-classification",
188188
"tabular-regression",
189189
}:
190-
raise Exception(f"Unknown object type: {obj.__class__.__name__}")
190+
raise ma.ValidationError(f"Unknown object type: {obj.__class__.__name__}")
191191
return obj
192192

193193

@@ -299,7 +299,7 @@ def get_obj_type(self, obj):
299299
"text-classification",
300300
"tabular-regression",
301301
}:
302-
raise Exception(f"Unknown object type: {obj.__class__.__name__}")
302+
raise ma.ValidationError(f"Unknown object type: {obj.__class__.__name__}")
303303
return obj
304304

305305

0 commit comments

Comments
 (0)