[elbe-devel] [PATCH 28/75] daemons soap faults: Fix Pylint

Torben Hohn torben.hohn at linutronix.de
Tue Jun 2 09:25:52 CEST 2020


On Fri, May 29, 2020 at 11:01:51AM -0400, Olivier Dion wrote:
> On Fri, 29 May 2020, Olivier Dion <dion at linutronix.de> wrote:
> > On Fri, 29 May 2020, Torben Hohn <torben.hohn at linutronix.de> wrote:
> >> On Mon, May 25, 2020 at 11:42:21AM -0400, Olivier Dion wrote:
> >>> 75:4: R1705: (no-else-return)
> >>> 71:0: R0911: (too-many-return-statements)
> >>> 71:0: R0915: (too-many-statements)
> >>> 
> >>> Signed-off-by: Olivier Dion <dion at linutronix.de>
> >>> ---
> >>>  elbepack/daemons/soap/faults.py | 3 +++
> >>>  1 file changed, 3 insertions(+)
> >>> 
> >>> diff --git a/elbepack/daemons/soap/faults.py b/elbepack/daemons/soap/faults.py
> >>> index 288d1c8f..c0d05fb5 100644
> >>> --- a/elbepack/daemons/soap/faults.py
> >>> +++ b/elbepack/daemons/soap/faults.py
> >>> @@ -72,6 +72,9 @@ def soap_faults(func):
> >>>      """ decorator, which wraps Exceptions to the proper
> >>>          Soap Faults, and raises these.
> >>>      """
> >>> +    # pylint: disable=no-else-return
> >>
> >> why ignore no else return ?
> >> just remove  the else.
> >
> > IIRC it generates more errors after that. I'll have a look at it.
> >
> Right.  So fixing the 'else' will spawn a bunch of 'elif' errors. Fine.
> Fixing that will spawn a bunch of 'function-redefined' errors ..
> 
> Pretty sure we can remove all of this and just do:

IIRC this does not work properly with the soap stuff.
It will think the function only takes 2 args.
or somthing like that.

Maybe you can check this.
If that works, this would be great. Of course i would prefer
the *args version.

It it does not work, we should really have a comment there.

But maybe we can also split the problem.

Note that we also have elbepack/daemons/soap/authentication.py
where we could also use *args in the decorators.

Maybe we just have to wrap these decorators with another one,
that gets the argcount straight.



> ----------------------------------------------------------------------
> @wraps(func)
> def wrapped(self, *args):
>     try:
>         return func(self, *args)
>     except InvalidState as e:
>         raise SoapElbeInvalidState()
>     except ProjectManagerError as e:
>         raise SoapElbeProjectError(str(e))
>     except ElbeDBError as e:
>         raise SoapElbeDBError(str(e))
>     except OSError as e:
>         raise SoapElbeProjectError("OSError: " + str(e))
>     except ValidationError as e:
>         raise SoapElbeValidationError(e)
>     except InvalidLogin:
>         raise SoapElbeNotAuthorized()
>     except Exception as e:
>         raise SoapElbeProjectError(format_exc())
> return wrapped
> ----------------------------------------------------------------------
> 
> -- 
> Olivier Dion
> Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen

-- 
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



More information about the elbe-devel mailing list