From: Plom Heller Date: Tue, 21 Jul 2026 23:13:45 +0000 (+0200) Subject: For design raw output, only show non-default parameters. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%22https:/validator.w3.org/%7B%7Bprefix%7D%7D?a=commitdiff_plain;h=11e74dc1d26a3c5e44b9d520b3f7b9441d2e9488;p=bricksplom For design raw output, only show non-default parameters. --- diff --git a/bricksplom.py b/bricksplom.py index dd08f5d..21264f2 100755 --- a/bricksplom.py +++ b/bricksplom.py @@ -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):