Skip to content

Commit d80b89b

Browse files
committed
fix print_cfg
1 parent 0d0712f commit d80b89b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/model_constructor/helpers.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,14 @@ def _get_str(self, value: Any) -> str:
8585
def _get_str_value(self, field: str) -> str:
8686
return self._get_str(getattr(self, field))
8787

88-
def __repr__(self) -> str:
88+
def _cfg_str(self) -> str:
8989
return f"{self.__repr_name__()}(\n {self.__repr_str__(chr(10) + ' ')})"
9090

91+
def __repr__(self) -> str:
92+
return self._cfg_str()
93+
9194
def __str__(self) -> str:
92-
return f"{self.__repr_name__()}(\n {self.__repr_str__(chr(10) + ' ')})"
95+
return self._cfg_str()
9396

9497
def __repr_args__(self) -> List[Tuple[str, str]]:
9598
return [
@@ -125,7 +128,7 @@ def changed_fields(self) -> Dict[str, Any]:
125128

126129
def print_cfg(self) -> None:
127130
"""Print full config"""
128-
print(repr(self))
131+
print(self._cfg_str())
129132

130133
def print_set_fields(self) -> None:
131134
"""Print fields changed at init."""

0 commit comments

Comments
 (0)