home · contact · privacy
For design raw output, only show non-default parameters. master
authorPlom Heller <plom@plomlompom.com>
Tue, 21 Jul 2026 23:13:45 +0000 (01:13 +0200)
committerPlom Heller <plom@plomlompom.com>
Tue, 21 Jul 2026 23:13:45 +0000 (01:13 +0200)
bricksplom.py

index dd08f5df8b3059798a89af64e6aa8cdadb0d6f16..21264f2097fca4fa5627183a8541c9daca4770f7 100755 (executable)
@@ -357,14 +357,16 @@ class BrickDesign(Textfiled, Lookupable):
     def raw(
             self
             ) -> str:
-        return (
-            f'{self.id_indented()} '
-            + (f'{CHAR_DESIGN_ALT}{self.alternate_to.id_}' if self.alternate_to
-               else ('|'.join(
-                   [f'{k}{CHAR_ATTR_EQ}{getattr(self, k)}'
-                    for k in BrickDesignData.__annotations__
-                    if k != 'description'])
-                     + f'{SEP_DESIGN_DESC}{self.description}')))
+        raw = f'{self.id_indented()} '
+        if self.alternate_to:
+            return f'{raw}{CHAR_DESIGN_ALT}{self.alternate_to.id_}'
+        attrs = []
+        for attr_key in [k for k in BrickDesignData.__annotations__
+                         if k != 'description']:
+            attr_val = getattr(self, attr_key)
+            if attr_val != getattr(BrickDesignData, attr_key):
+                attrs += [f'{attr_key}{CHAR_ATTR_EQ}{attr_val}']
+        return f'{raw}{"|".join(attrs)}{SEP_DESIGN_DESC}{self.description}'
 
 
 class Brick(Textfiled, WithDb, Lookupable):