[PATCH i-g-t 1/4] tools/intel-gfx-fw-info: Annotate abstract method

Lucas De Marchi lucas.demarchi at intel.com
Tue Aug 20 18:13:18 UTC 2024


On Tue, Aug 20, 2024 at 07:35:43PM GMT, Kamil Konieczny wrote:
>Hi Lucas,
>On 2024-08-19 at 12:55:57 -0700, Lucas De Marchi wrote:
>> Make the FW an abstract class and annotate the decode() method.
>>
>> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
>
>Please use pylint and address few issues like Unnecessary semicolon

black also warned about those and a few more... fixed locally

>or Unused variable 'i' (unused-variable)

ok, I can replace that with _ to silence the warning.

>
>Last line from pylint:
>Your code has been rated at 6.75/10 (previous run: 6.75/10, +0.00)
>
>I am not python expert so feel free to ignore this.

If we ignore some, then the code becomes perfect :)

	$ pylint -d C0114,C0103,C0116,C0115 tools/intel-gfx-fw-info

	-------------------------------------------------------------------
	Your code has been rated at 10.00/10 (previous run: 8.46/10, +1.54)

More seriously, those disabled checks are most about missing docstring
and opinionated names. Not very relevant for this simple script, but I
can add some doc on top.

thanks
Lucas De Marchi

>
>Regards,
>Kamil
>
>> ---
>>  tools/intel-gfx-fw-info | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/intel-gfx-fw-info b/tools/intel-gfx-fw-info
>> index b0d41bbae..5156c724c 100755
>> --- a/tools/intel-gfx-fw-info
>> +++ b/tools/intel-gfx-fw-info
>> @@ -4,6 +4,7 @@
>>  #
>>  # Copyright (C) 2023 Intel Corporation
>>
>> +import abc
>>  import argparse
>>  import logging
>>  import hashlib
>> @@ -103,10 +104,14 @@ def FIELD_GET(mask: int, value: int) -> int:
>>      return (value & mask) >> ffs(mask)
>>
>>
>> -class Fw:
>> +class Fw(abc.ABC):
>>      def __init__(self, fw):
>>          self.fw = fw
>>
>> +    @abc.abstractmethod
>> +    def decode(self):
>> +        raise NotImplementedError()
>> +
>>
>>  class FwCss(Fw):
>>      def decode(self):
>> --
>> 2.43.0
>>


More information about the igt-dev mailing list