add comment to show valid modes

This commit is contained in:
WorldTeacher
2024-06-26 16:34:04 +02:00
parent cbe0e597da
commit ee229a41c5

View File

@@ -88,9 +88,23 @@ class WebRequest:
class BibTextTransformer: class BibTextTransformer:
def __init__(self, mode: str) -> None: """Transforms data from the web into a BibText format.
Valid Modes are ARRAY, COinS, BibTeX, RIS, RDS
Raises:
ValueError: Raised if mode is not in valid_modes
Returns:
None
"""
valid_modes = ["ARRAY", "COinS", "BibTeX", "RIS", "RDS"]
def __init__(self, mode: str = "ARRAY") -> None:
self.mode = mode self.mode = mode
self.field = None self.field = None
if mode not in self.valid_modes:
logger.log_error(f"Mode {mode} not valid")
raise ValueError(f"Mode {mode} not valid")
# print(self.field) # print(self.field)
self.data = None self.data = None
# self.bookdata = BookData(**self.data) # self.bookdata = BookData(**self.data)