diff --git a/src/datadoc/backend/dapla_dataset_path_info.py b/src/datadoc/backend/dapla_dataset_path_info.py index 8604edd1..319b4125 100644 --- a/src/datadoc/backend/dapla_dataset_path_info.py +++ b/src/datadoc/backend/dapla_dataset_path_info.py @@ -15,18 +15,18 @@ class SupportedDateFormats(Enum): + """The Date formats supported by the naming convention.""" ISO_YEAR = auto() # String format YYYY ISO_YEAR_MONTH = auto() # String format YYYY-MM ISO_YEAR_MONTH_DAY = auto() # String format YYYY-MM-DD - SSB_YEAR_SEME TER= auto() - # String format YYYY-Hn - SSB_YEAR_TRIMESTER = auto() # String format YYYY-Tn + SSB_YEAR_SEMESTER = auto() SSB_YEAR_TRIMESTER = auto() # String format YYYY-Tn SSB_YEAR_QUARTER = auto() # String format YYYY-Qn SSB_YEAR_BIMESTER = auto() # String format YYYY-Bn SSB_YEAR_WEEK = auto() # String format YYYY-Wnn + class RegexEqual(str): - """Helper class for structual pattern matching using regex"""" + """Helper class for structual pattern matching using regex.""" def __eq__(self, pattern:str)->bool: return bool(re.search(pattern, self)) @@ -48,10 +48,10 @@ def __init__(self, dataset_path: str) -> None: self.second_period_string = _period_strings[1] - def _categorize_period_string(period: str) -> SupportedDateFormats: + def _categorize_period_string(self,period: str) -> SupportedDateFormats: """A naive string validator.""" match RegexEqual(period): - case "\d+": + case r"\d+": return SupportedDateFormats.ISO_YEAR