Skip to content

Commit 6705646

Browse files
committed
improving serialisation of Class instances
1 parent 2370efb commit 6705646

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

piccolo/apps/migrations/auto/serialisation.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,10 @@ def __hash__(self):
4242
def __eq__(self, other):
4343
return self.__hash__() == other.__hash__()
4444

45-
def _serialise_value(self, value):
46-
return f"'{value}'" if isinstance(value, str) else value
47-
4845
def __repr__(self):
4946
args = ", ".join(
5047
[
51-
f"{key}={self._serialise_value(value)}"
48+
f"{key}={value.__repr__()}"
5249
for key, value in self.instance.__dict__.items()
5350
]
5451
)
@@ -66,13 +63,10 @@ def __hash__(self):
6663
def __eq__(self, other):
6764
return self.__hash__() == other.__hash__()
6865

69-
def _serialise_value(self, value):
70-
return f"'{value}'" if isinstance(value, str) else value
71-
7266
def __repr__(self):
7367
args = ", ".join(
7468
[
75-
f"{key}={self._serialise_value(self.serialised_params.params.get(key))}" # noqa: E501
69+
f"{key}={self.serialised_params.params.get(key).__repr__()}" # noqa: E501
7670
for key in self.instance._meta.params.keys()
7771
]
7872
)

0 commit comments

Comments
 (0)