[elbe-devel] [PATCH 09/40] pylint: fix Attribute <x> defined outside __init__

Torben Hohn torben.hohn at linutronix.de
Thu Sep 20 11:21:58 CEST 2018


On Fri, Sep 14, 2018 at 01:56:21PM +0200, Manuel Traut wrote:
> avoid the pylint warning by preinitialize class members
> with 'None' in __init__
> 
> Signed-off-by: Manuel Traut <manut at linutronix.de>
> ---
>  elbepack/asyncworker.py    | 8 +++++---
>  elbepack/debianize/base.py | 7 +++++++
>  elbepack/updated.py        | 1 +
>  3 files changed, 13 insertions(+), 3 deletions(-)
> 
> index b9aaf74c..c17a0da9 100644
> --- a/elbepack/debianize/base.py
> +++ b/elbepack/debianize/base.py
> @@ -43,6 +43,13 @@ class DebianizeBase (FormMultiPage):
>      def __init__(self):
>          self.deb = {}
>          self.tmpl_dir = None
> +        self.p_name = None
> +        self.p_version = None
> +        self.p_arch = None
> +        self.m_name = None
> +        self.m_mail = None
> +        self.release = None
> +        self.source_format = None

iirc there was a subtle problem with this.
but maybe i had tried to set the fields to default strings,
and this failed.

if you say, you tested it, you get

Reviewed-by: Torben Hohn <torben.hohn at linutronix.de>

>  
>          self.archs = ["arm64", "armhf", "armel", "amd64", "i386", "powerpc"]
>          self.formats = ["native", "git", "quilt"]
> diff --git a/elbepack/updated.py b/elbepack/updated.py
> index f0254d75..af4207f0 100644
> --- a/elbepack/updated.py
> +++ b/elbepack/updated.py
> @@ -156,6 +156,7 @@ class rw_access_file(object):
>      def __init__(self, filename, status):
>          self.filename = filename
>          self.rw = rw_access(filename, status)
> +        self.f = None
>  
>      def __enter__(self):
>          self.rw.__enter__()
> -- 
> 2.19.0.rc2
> 

-- 
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/kontakt/Datenschutz.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen | 
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700 
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.linutronix.de/pipermail/elbe-devel/attachments/20180920/90ea7732/attachment.sig>


More information about the elbe-devel mailing list