diff mbox series

[v2,29/38] qapi/gen.py: delint with pylint

Message ID 20200922210101.4081073-30-jsnow@redhat.com (mailing list archive)
State New, archived
Headers show
Series qapi: static typing conversion, pt1 | expand

Commit Message

John Snow Sept. 22, 2020, 9 p.m. UTC
'fp' and 'fd' are self-evident in context, add them to the list of OK
names.

_top and _bottom also need to stay class methods because some users
override the method and need to use `self`. Tell pylint to shush.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 scripts/qapi/gen.py   | 2 ++
 scripts/qapi/pylintrc | 5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

Comments

Eduardo Habkost Sept. 23, 2020, 3:44 p.m. UTC | #1
On Tue, Sep 22, 2020 at 05:00:52PM -0400, John Snow wrote:
> 'fp' and 'fd' are self-evident in context, add them to the list of OK
> names.
> 
> _top and _bottom also need to stay class methods because some users
> override the method and need to use `self`. Tell pylint to shush.

Do you mean "stay instance methods"?

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>

> 
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  scripts/qapi/gen.py   | 2 ++
>  scripts/qapi/pylintrc | 5 +++--
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py
> index cf340e66d4..ed498397ad 100644
> --- a/scripts/qapi/gen.py
> +++ b/scripts/qapi/gen.py
> @@ -50,9 +50,11 @@ def get_content(self) -> str:
>          return self._top() + self._preamble + self._body + self._bottom()
>  
>      def _top(self) -> str:
> +        # pylint: disable=no-self-use
>          return ''
>  
>      def _bottom(self) -> str:
> +        # pylint: disable=no-self-use
>          return ''
>  
>      def write(self, output_dir: str) -> None:
> diff --git a/scripts/qapi/pylintrc b/scripts/qapi/pylintrc
> index 7438806096..de132d03cf 100644
> --- a/scripts/qapi/pylintrc
> +++ b/scripts/qapi/pylintrc
> @@ -5,7 +5,6 @@
>  ignore-patterns=doc.py,
>                  error.py,
>                  expr.py,
> -                gen.py,
>                  parser.py,
>                  schema.py,
>                  types.py,
> @@ -46,7 +45,9 @@ good-names=i,
>             k,
>             ex,
>             Run,
> -           _
> +           _,
> +           fp,  # fp = open(...)
> +           fd,  # fd = os.open(...)
>  
>  [VARIABLES]
>  
> -- 
> 2.26.2
>
John Snow Sept. 23, 2020, 6:38 p.m. UTC | #2
On 9/23/20 11:44 AM, Eduardo Habkost wrote:
> On Tue, Sep 22, 2020 at 05:00:52PM -0400, John Snow wrote:
>> 'fp' and 'fd' are self-evident in context, add them to the list of OK
>> names.
>>
>> _top and _bottom also need to stay class methods because some users
>> override the method and need to use `self`. Tell pylint to shush.
> 
> Do you mean "stay instance methods"?
> 

Yep. Fixed, thank you.

> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
> 

Thanks!

>>
>> Signed-off-by: John Snow <jsnow@redhat.com>
>> ---
>>   scripts/qapi/gen.py   | 2 ++
>>   scripts/qapi/pylintrc | 5 +++--
>>   2 files changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py
>> index cf340e66d4..ed498397ad 100644
>> --- a/scripts/qapi/gen.py
>> +++ b/scripts/qapi/gen.py
>> @@ -50,9 +50,11 @@ def get_content(self) -> str:
>>           return self._top() + self._preamble + self._body + self._bottom()
>>   
>>       def _top(self) -> str:
>> +        # pylint: disable=no-self-use
>>           return ''
>>   
>>       def _bottom(self) -> str:
>> +        # pylint: disable=no-self-use
>>           return ''
>>   
>>       def write(self, output_dir: str) -> None:
>> diff --git a/scripts/qapi/pylintrc b/scripts/qapi/pylintrc
>> index 7438806096..de132d03cf 100644
>> --- a/scripts/qapi/pylintrc
>> +++ b/scripts/qapi/pylintrc
>> @@ -5,7 +5,6 @@
>>   ignore-patterns=doc.py,
>>                   error.py,
>>                   expr.py,
>> -                gen.py,
>>                   parser.py,
>>                   schema.py,
>>                   types.py,
>> @@ -46,7 +45,9 @@ good-names=i,
>>              k,
>>              ex,
>>              Run,
>> -           _
>> +           _,
>> +           fp,  # fp = open(...)
>> +           fd,  # fd = os.open(...)
>>   
>>   [VARIABLES]
>>   
>> -- 
>> 2.26.2
>>
>
Cleber Rosa Sept. 24, 2020, 6:44 p.m. UTC | #3
On Tue, Sep 22, 2020 at 05:00:52PM -0400, John Snow wrote:
> 'fp' and 'fd' are self-evident in context, add them to the list of OK
> names.
> 
> _top and _bottom also need to stay class methods because some users
> override the method and need to use `self`. Tell pylint to shush.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>

With the commit message change caught by Eduardo:

Reviewed-by: Cleber Rosa <crosa@redhat.com>
diff mbox series

Patch

diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py
index cf340e66d4..ed498397ad 100644
--- a/scripts/qapi/gen.py
+++ b/scripts/qapi/gen.py
@@ -50,9 +50,11 @@  def get_content(self) -> str:
         return self._top() + self._preamble + self._body + self._bottom()
 
     def _top(self) -> str:
+        # pylint: disable=no-self-use
         return ''
 
     def _bottom(self) -> str:
+        # pylint: disable=no-self-use
         return ''
 
     def write(self, output_dir: str) -> None:
diff --git a/scripts/qapi/pylintrc b/scripts/qapi/pylintrc
index 7438806096..de132d03cf 100644
--- a/scripts/qapi/pylintrc
+++ b/scripts/qapi/pylintrc
@@ -5,7 +5,6 @@ 
 ignore-patterns=doc.py,
                 error.py,
                 expr.py,
-                gen.py,
                 parser.py,
                 schema.py,
                 types.py,
@@ -46,7 +45,9 @@  good-names=i,
            k,
            ex,
            Run,
-           _
+           _,
+           fp,  # fp = open(...)
+           fd,  # fd = os.open(...)
 
 [VARIABLES]