„model.py“ ändern
This commit is contained in:
parent
d5da356345
commit
53407feb35
15
model.py
15
model.py
@ -248,7 +248,20 @@ class CaseBase:
|
|||||||
)
|
)
|
||||||
|
|
||||||
def get_values_by_field(self, field: str) -> set[str]:
|
def get_values_by_field(self, field: str) -> set[str]:
|
||||||
|
"""
|
||||||
|
get the distinct values by the fields
|
||||||
|
|
||||||
|
Args:
|
||||||
|
self: List with corresponding values
|
||||||
|
field: a string value that must be contained in self
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
the distinct values
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
ValueError: if the field value not in the 'problem' or 'solution' list
|
||||||
|
"""
|
||||||
|
|
||||||
if field not in list(self.fields["problem"]) + list(self.fields["solution"]):
|
if field not in list(self.fields["problem"]) + list(self.fields["solution"]):
|
||||||
raise ValueError(f"unknown field {field}")
|
raise ValueError(f"unknown field {field}")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user