diff --git a/.pylintrc b/.pylintrc index 8c3132a..dd76acc 100644 --- a/.pylintrc +++ b/.pylintrc @@ -2,6 +2,7 @@ disable= missing-module-docstring, too-few-public-methods, + too-many-public-methods, too-many-locals, too-many-arguments, too-many-instance-attributes, diff --git a/README.rst b/README.rst index c2db2ca..9c27fce 100644 --- a/README.rst +++ b/README.rst @@ -351,7 +351,7 @@ __ https://docs.scale.com/reference#project-creation print(project.name) # Test_Project -Throws ``ScaleDuplicateResource`` exception if a project with the same name already exists. +Specify ``rapid=true`` for Rapid projects and ``studio=true`` for Studio projects. Throws ``ScaleDuplicateResource`` exception if a project with the same name already exists. Retrieve Project ^^^^^^^^^^^^^^^^ diff --git a/scaleapi/__init__.py b/scaleapi/__init__.py index c374cf7..99c4e08 100644 --- a/scaleapi/__init__.py +++ b/scaleapi/__init__.py @@ -855,8 +855,8 @@ def create_training_task( e.g.. `TaskType.ImageAnnotation` **kwargs: The same set of parameters are expected with - create_task function and an additional expected_response. - Scale's API documentation. + create_task function and an additional + expected_response. Scale's API documentation. https://docs.scale.com/reference Returns: diff --git a/scaleapi/_version.py b/scaleapi/_version.py index a60612d..f63d0be 100644 --- a/scaleapi/_version.py +++ b/scaleapi/_version.py @@ -1,2 +1,2 @@ -__version__ = "2.7.0" +__version__ = "2.8.0" __package_name__ = "scaleapi" diff --git a/scaleapi/evaluation_tasks.py b/scaleapi/evaluation_tasks.py index 0b5307e..9a99331 100644 --- a/scaleapi/evaluation_tasks.py +++ b/scaleapi/evaluation_tasks.py @@ -1,22 +1,11 @@ -class EvaluationTask: - """EvaluationTask class, containing EvaluationTask information.""" +from scaleapi.quality_tasks import QualityTask - def __init__(self, json, client): - self._json = json - self.id = json["id"] - self.initial_response = getattr(json, "initial_response", None) - self.expected_response = json["expected_response"] - self._client = client - def __hash__(self): - return hash(self.id) +class EvaluationTask(QualityTask): + """EvaluationTask class, containing EvaluationTask information.""" def __str__(self): return f"EvaluationTask(id={self.id})" def __repr__(self): return f"EvaluationTask({self._json})" - - def as_dict(self): - """Returns all attributes as a dictionary""" - return self._json diff --git a/scaleapi/quality_tasks.py b/scaleapi/quality_tasks.py new file mode 100644 index 0000000..a4fb1b9 --- /dev/null +++ b/scaleapi/quality_tasks.py @@ -0,0 +1,23 @@ +class QualityTask: + """Quality class to be inherited by training_tasks or + evaluation_tasks.""" + + def __init__(self, json, client): + self._json = json + self.id = json["id"] + self.initial_response = getattr(json, "initial_response", None) + self.expected_response = json["expected_response"] + self._client = client + + def __hash__(self): + return hash(self.id) + + def __str__(self): + return f"QualityTask(id={self.id})" + + def __repr__(self): + return f"QualityTask({self._json})" + + def as_dict(self): + """Returns all attributes as a dictionary""" + return self._json diff --git a/scaleapi/training_tasks.py b/scaleapi/training_tasks.py index b1f3895..b1efeba 100644 --- a/scaleapi/training_tasks.py +++ b/scaleapi/training_tasks.py @@ -1,22 +1,11 @@ -class TrainingTask: - """TrainingTask class, containing TrainingTask information.""" +from scaleapi.quality_tasks import QualityTask - def __init__(self, json, client): - self._json = json - self.id = json["id"] - self.initial_response = getattr(json, "initial_response", None) - self.expected_response = json["expected_response"] - self._client = client - def __hash__(self): - return hash(self.id) +class TrainingTask(QualityTask): + """TrainingTask class, containing TrainingTask information.""" def __str__(self): return f"TrainingTask(id={self.id})" def __repr__(self): return f"TrainingTask({self._json})" - - def as_dict(self): - """Returns all attributes as a dictionary""" - return self._json