aboutsummaryrefslogtreecommitdiffstats
path: root/backend/models/question.py
diff options
context:
space:
mode:
authorGravatar decorator-factory <[email protected]>2020-12-15 08:13:37 +0300
committerGravatar decorator-factory <[email protected]>2020-12-15 08:13:37 +0300
commit947a30f7406b7d025cf2e5754b59389af4213718 (patch)
treec6236edb812db32f583ac0acc9099be33d1a0e2b /backend/models/question.py
parentAdd ks123 (GH ks129) to CODEOWNERS (diff)
fix various type annotation issues
Diffstat (limited to 'backend/models/question.py')
-rw-r--r--backend/models/question.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/backend/models/question.py b/backend/models/question.py
index 1a012ff..3b98024 100644
--- a/backend/models/question.py
+++ b/backend/models/question.py
@@ -11,7 +11,7 @@ class Question(BaseModel):
id: str = Field(alias="_id")
name: str
type: str
- data: t.Dict[str, t.Any]
+ data: dict[str, t.Any]
class Config:
allow_population_by_field_name = True
@@ -31,14 +31,14 @@ class Question(BaseModel):
@root_validator
def validate_question_data(
cls,
- value: t.Dict[str, t.Any]
- ) -> t.Optional[t.Dict[str, t.Any]]:
+ value: dict[str, t.Any]
+ ) -> t.Optional[dict[str, t.Any]]:
"""Check does required data exists for question type and remove other data."""
# When question type don't need data, don't add anything to keep DB clean.
if value.get("type") not in REQUIRED_QUESTION_TYPE_DATA:
return value
- for key, data_type in REQUIRED_QUESTION_TYPE_DATA[value.get("type")].items():
+ for key, data_type in REQUIRED_QUESTION_TYPE_DATA[value["type"]].items():
if key not in value.get("data", {}):
raise ValueError(f"Required question data key '{key}' not provided.")