Skip to content

Commit 09a4cba

Browse files
committed
put __new__ below
1 parent 44df653 commit 09a4cba

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

src/openfoodfacts/types.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -893,16 +893,6 @@ class DatasetType(str, enum.Enum):
893893
class TaxonomyType(str, enum.Enum):
894894
dataset_filename: str
895895

896-
def __new__(cls, value: str, dataset_filename: str):
897-
"""
898-
Override __new__ to allow storing the dataset filename
899-
associated with each taxonomy type.
900-
"""
901-
obj = str.__new__(cls, value)
902-
obj._value_ = value
903-
obj.dataset_filename = dataset_filename
904-
return obj
905-
906896
category = ("category", "categories.full.json")
907897
ingredient = ("ingredient", "ingredients.full.json")
908898
label = ("label", "labels.full.json")
@@ -929,6 +919,16 @@ def __new__(cls, value: str, dataset_filename: str):
929919
"other_nutritional_substances.full.json",
930920
)
931921

922+
def __new__(cls, value: str, dataset_filename: str):
923+
"""
924+
Override __new__ to allow storing the dataset filename
925+
associated with each taxonomy type.
926+
"""
927+
obj = str.__new__(cls, value)
928+
obj._value_ = value
929+
obj.dataset_filename = dataset_filename
930+
return obj
931+
932932
@property
933933
def dataset_path(self) -> str:
934934
return f"data/taxonomies/{self.dataset_filename}"

0 commit comments

Comments
 (0)