Skip to content

Commit

Permalink
refactor: Renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarrabah committed Oct 8, 2024
1 parent 6aa577c commit 100341d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/frformat/enum_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ class Millésime(Enum):


def new(
class_name: str, name: str, description: str, geographical_enum: Dict[str, Set[str]]
class_name: str,
name: str,
description: str,
geographical_enums: Dict[str, Set[str]],
) -> Type:
class EnumFormat(CustomStrFormat):
"""Checks if a value is in a given list
Expand All @@ -28,13 +31,13 @@ def __init__(self, cog: Millésime, options: Options = Options()):
for e in self._options.extra_valid_values
}

if cog.name not in geographical_enum.keys():
if cog.name != geographical_enums.keys():
raise ValueError(f"Invalid geographical enum: {cog.name}")

self._normalized_geo_enum_value = {
normalize_value(code, self._options)
for value in geographical_enum.values()
for code in value
for code_set in geographical_enums.values()
for code in code_set
}.union(_normalized_extra_values)

metadata = Metadata(name, description)
Expand Down

0 comments on commit 100341d

Please sign in to comment.