Re: [PATCH v8 04/13] tools: ynl_gen_rst.py: cleanup coding style

Donald Hunter <[email protected]>
Newsgroups dev.linux.lists.lkmm,dev.linux.lists.linux-kernel-mentees,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kernel.vger.netdev
Message-ID <[email protected]>
Mauro Carvalho Chehab <[email protected]> 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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.