Skip to content

Commit

Permalink
Support dynamic_enum in AMM pretty_repr() (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
ya-kc authored Dec 4, 2023
1 parent 71260f0 commit 093fe07
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
)

import attr
from dynamic_enum import DynamicEnum

from dl_attrs_model_mapper.structs.mappings import FrozenMappingStrToStrOrStrSeq
from dl_attrs_model_mapper.structs.singleormultistring import SingleOrMultiString
Expand Down Expand Up @@ -97,6 +98,10 @@ def _get_lines_internal_primitive(self, model: Union[int, float, str, None]) ->
def _get_lines_internal_enum(self, model: enum.Enum) -> list[str]:
return [f"{self.get_type_str(type(model))}.{model.name}"]

@_get_lines_internal.register
def _get_lines_internal_dyn_enum(self, model: DynamicEnum) -> list[str]:
return [f'{self.get_type_str(type(model))}("{model.name}")']

@_get_lines_internal.register
def _get_lines_internal_list(self, model: list) -> list[str]:
return self._get_lines_for_simple_collection(
Expand Down

0 comments on commit 093fe07

Please sign in to comment.