From 3e7d657e2ee8dc8c458dec489de46ba27e145ed4 Mon Sep 17 00:00:00 2001 From: Morten Engen <58786786+mortenengen@users.noreply.github.com> Date: Mon, 11 Jul 2022 13:19:22 +0200 Subject: [PATCH] feat(base): sort serializable attributes (#198) Sorts the serializable attributes before they are returned from .get_serializable_attributes(). Prevents the object id to change if the order of the member names from .get_member_names() changes. --- specklepy/objects/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specklepy/objects/base.py b/specklepy/objects/base.py index cf2e104..0346f2c 100644 --- a/specklepy/objects/base.py +++ b/specklepy/objects/base.py @@ -331,7 +331,7 @@ class Base(_RegisteringBase): def get_serializable_attributes(self) -> List[str]: """Get the attributes that should be serialized""" - return list(set(self.get_member_names()) - self._serialize_ignore) + return sorted(list(set(self.get_member_names()) - self._serialize_ignore)) def get_typed_member_names(self) -> List[str]: """Get all of the names of the defined (typed) properties of this object"""