Skip to content

Commit 7b6e043

Browse files
authored
Unpin marshmallow library (#440)
functools.partial is not supported by mypy, so the lines that call the partial functions need have the 'type:ignore' comment. python/mypy#1484
1 parent b46eaf5 commit 7b6e043

File tree

4 files changed

+37
-29
lines changed

4 files changed

+37
-29
lines changed

Pipfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ blinker = "*"
5252
"boto3" = "*"
5353
humanize = "*"
5454
flask-talisman = "*"
55-
marshmallow = "==3.0.0rc6"
55+
marshmallow = "*"
5656
python-snappy = "*"
5757
google-cloud-storage = "*"
5858
jsonpointer = "*"

Pipfile.lock

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/data_models/app_models.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class DateTimeSchemaMixin:
4747
updated_at = fields.DateTime()
4848

4949
@pre_dump
50-
def set_date(self, data):
50+
def set_date(self, data, **kwargs):
5151
data.updated_at = datetime.now(tz=tzutc())
5252
return data
5353

@@ -58,7 +58,7 @@ class QuestionnaireStateSchema(Schema, DateTimeSchemaMixin):
5858
version = fields.Integer()
5959

6060
@post_load
61-
def make_model(self, data):
61+
def make_model(self, data, **kwargs):
6262
created_at = data.pop("created_at", None)
6363
updated_at = data.pop("updated_at", None)
6464
model = QuestionnaireState(**data)
@@ -74,7 +74,7 @@ class EQSessionSchema(Schema, DateTimeSchemaMixin):
7474
expires_at = Timestamp()
7575

7676
@post_load
77-
def make_model(self, data):
77+
def make_model(self, data, **kwargs):
7878
created_at = data.pop("created_at", None)
7979
updated_at = data.pop("updated_at", None)
8080
model = EQSession(**data)
@@ -88,5 +88,5 @@ class UsedJtiClaimSchema(Schema):
8888
expires_at = Timestamp()
8989

9090
@post_load
91-
def make_model(self, data):
91+
def make_model(self, data, **kwargs):
9292
return UsedJtiClaim(**data)

app/storage/metadata_parser.py

+28-20
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ def _deserialize(self, *args, **kwargs): # pylint: disable=arguments-differ
5757

5858

5959
class StripWhitespaceMixin:
60-
@pre_load
61-
def strip_whitespace(self, items): # pylint: disable=no-self-use
60+
@pre_load()
61+
def strip_whitespace(self, items, **kwargs): # pylint: disable=no-self-use
6262
for key, value in items.items():
6363
if isinstance(value, str):
6464
items[key] = value.strip()
@@ -68,33 +68,41 @@ def strip_whitespace(self, items): # pylint: disable=no-self-use
6868
class RunnerMetadataSchema(Schema, StripWhitespaceMixin):
6969
"""Metadata which is required for the operation of runner itself"""
7070

71-
jti = VALIDATORS["uuid"]()
72-
ru_ref = VALIDATORS["string"](validate=validate.Length(min=1))
73-
collection_exercise_sid = VALIDATORS["string"](validate=validate.Length(min=1))
74-
tx_id = VALIDATORS["uuid"]()
75-
questionnaire_id = VALIDATORS["string"](validate=validate.Length(min=1))
76-
response_id = VALIDATORS["string"](validate=validate.Length(min=1))
77-
78-
account_service_url = VALIDATORS["url"](required=False)
79-
case_id = VALIDATORS["uuid"](required=False)
80-
account_service_log_out_url = VALIDATORS["url"](required=False)
71+
jti = VALIDATORS["uuid"]() # type:ignore
72+
ru_ref = VALIDATORS["string"](validate=validate.Length(min=1)) # type:ignore
73+
collection_exercise_sid = VALIDATORS["string"](
74+
validate=validate.Length(min=1)
75+
) # type:ignore
76+
tx_id = VALIDATORS["uuid"]() # type:ignore
77+
questionnaire_id = VALIDATORS["string"](
78+
validate=validate.Length(min=1)
79+
) # type:ignore
80+
response_id = VALIDATORS["string"](validate=validate.Length(min=1)) # type:ignore
81+
82+
account_service_url = VALIDATORS["url"](required=False) # type:ignore
83+
case_id = VALIDATORS["uuid"](required=False) # type:ignore
84+
account_service_log_out_url = VALIDATORS["url"](required=False) # type:ignore
8185
roles = fields.List(fields.String(), required=False)
82-
survey_url = VALIDATORS["url"](required=False)
83-
language_code = VALIDATORS["string"](required=False)
84-
channel = VALIDATORS["string"](required=False, validate=validate.Length(min=1))
85-
case_type = VALIDATORS["string"](required=False)
86+
survey_url = VALIDATORS["url"](required=False) # type:ignore
87+
language_code = VALIDATORS["string"](required=False) # type:ignore
88+
channel = VALIDATORS["string"](
89+
required=False, validate=validate.Length(min=1)
90+
) # type:ignore
91+
case_type = VALIDATORS["string"](required=False) # type:ignore
8692

8793
# Either schema_name OR the three census parameters are required. Should be required after census.
88-
schema_name = VALIDATORS["string"](required=False)
94+
schema_name = VALIDATORS["string"](required=False) # type:ignore
8995

9096
# The following three parameters can be removed after Census
9197
survey = VALIDATORS["string"](
9298
required=False, validate=validate.OneOf(("CENSUS", "CCS")), missing="CENSUS"
93-
)
99+
) # type:ignore
94100
form_type = VALIDATORS["string"](
95101
required=False, validate=validate.OneOf(("H", "I", "C"))
96-
)
97-
region_code = VALIDATORS["string"](required=False, validate=RegionCode())
102+
) # type:ignore
103+
region_code = VALIDATORS["string"](
104+
required=False, validate=RegionCode()
105+
) # type:ignore
98106

99107
@validates_schema
100108
def validate_schema_name(self, data, **kwargs):

0 commit comments

Comments
 (0)