Re: [PATCH v8 04/13] tools: ynl_gen_rst.py: cleanup coding style
From: Donald Hunter
Date: Fri Jun 27 2025 - 07:08:43 EST
Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> writes:
> @staticmethod
> def rst_ref(namespace: str, prefix: str, name: str) -> str:
> """Add a hyperlink to the document"""
> @@ -119,10 +100,9 @@ class RstFormatters:
> 'nested-attributes': 'attribute-set',
> 'struct': 'definition'}
> if prefix in mappings:
> - prefix = mappings[prefix]
> + prefix = mappings.get(prefix, "")
This gives me a sad face because fixing the erroneous pylint warning
makes the code look worse. I'd prefer to either suppress the warning
or to change this:
if prefix in mappings:
prefix = mappings[prefix]
to this:
prefix = mappings.get(prefix, prefix)
But IMHO the intent of the original is clearer.