Skip to content

Commit

Permalink
require totaltasks (#28)
Browse files Browse the repository at this point in the history
* require totaltasks

* bump version

* also add ability to have lists in examples for ilas

* get the other manifest too
  • Loading branch information
gaieges authored Feb 26, 2020
1 parent 94bc30a commit ee27d78
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions basemodels/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ def validate_requester_question_example(self, data, value):
if not data.get('request_type'):
raise ValidationError("request_type missing")

if data['request_type'] != 'image_label_binary' and isinstance(value, list):
# based on https://github.com/hCaptcha/hmt-basemodels/issues/27#issuecomment-590706643
supports_lists = ['image_label_area_select', 'image_label_binary']

if isinstance(value, list) and not data['request_type'] in supports_lists:
raise ValidationError("Lists are not allowed in this challenge type")
return value

Expand Down Expand Up @@ -134,7 +137,7 @@ class Manifest(Model):
job_mode = StringType(required=True, choices=["batch", "online", "instant_delivery"])
job_api_key = UUIDType(default=uuid.uuid4)
job_id = UUIDType(default=uuid.uuid4)
job_total_tasks = IntType()
job_total_tasks = IntType(required=True)

requester_restricted_answer_set = DictType(DictType(StringType))

Expand Down Expand Up @@ -162,7 +165,10 @@ def validate_requester_question_example(self, data, value):
if not data.get('request_type'):
raise ValidationError("request_type missing")

if data['request_type'] != 'image_label_binary' and isinstance(value, list):
# based on https://github.com/hCaptcha/hmt-basemodels/issues/27#issuecomment-590706643
supports_lists = ['image_label_area_select', 'image_label_binary']

if isinstance(value, list) and not data['request_type'] in supports_lists:
raise ValidationError("Lists are not allowed in this challenge type")
return value

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setuptools.setup(
name="hmt-basemodels",
version="0.0.13",
version="0.0.14",
author="HUMAN Protocol",
description="Common data models shared by various components of the Human Protocol stack",
url="https://github.com/hCaptcha/hmt-basemodels",
Expand Down

0 comments on commit ee27d78

Please sign in to comment.