[elbe-devel] [PATCH v2 21/66] daemons soap faults: Fix Pylint
Torben Hohn
torben.hohn at linutronix.de
Wed Jun 10 13:31:54 CEST 2020
On Fri, Jun 05, 2020 at 01:06:45PM -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>
Reviewed-by: Torben Hohn <torben.hohn at linutronix.de>
> ---
> elbepack/daemons/soap/faults.py | 30 ++++++++++++++++++++----------
> 1 file changed, 20 insertions(+), 10 deletions(-)
>
> diff --git a/elbepack/daemons/soap/faults.py b/elbepack/daemons/soap/faults.py
> index 288d1c8f..912a0370 100644
> --- a/elbepack/daemons/soap/faults.py
> +++ b/elbepack/daemons/soap/faults.py
> @@ -72,6 +72,17 @@ def soap_faults(func):
> """ decorator, which wraps Exceptions to the proper
> Soap Faults, and raises these.
> """
> +
> + # Do not edit this code. Although using *args is tempting here,
> + # it will not work because Spyne is doing introspection on the
> + # function's signature. I think it would be possible to do
> + # something with func.__code__.replace, but this requires deep
> + # Python's internal knowledges.
> +
> + # pylint: disable=too-many-return-statements
> + # pylint: disable=too-many-statements
> + # pylint: disable=function-redefined
> +
> if func.__code__.co_argcount == 1:
> @wraps(func)
> def wrapped(self):
> @@ -92,7 +103,7 @@ def soap_faults(func):
> except Exception as e:
> raise SoapElbeProjectError(format_exc())
> return wrapped
> - elif func.__code__.co_argcount == 2:
> + if func.__code__.co_argcount == 2:
> @wraps(func)
> def wrapped(self, arg1):
> try:
> @@ -112,7 +123,7 @@ def soap_faults(func):
> except Exception as e:
> raise SoapElbeProjectError(format_exc())
> return wrapped
> - elif func.__code__.co_argcount == 3:
> + if func.__code__.co_argcount == 3:
> @wraps(func)
> def wrapped(self, arg1, arg2):
> try:
> @@ -132,7 +143,7 @@ def soap_faults(func):
> except Exception as e:
> raise SoapElbeProjectError(format_exc())
> return wrapped
> - elif func.__code__.co_argcount == 4:
> + if func.__code__.co_argcount == 4:
> @wraps(func)
> def wrapped(self, arg1, arg2, arg3):
> try:
> @@ -152,7 +163,7 @@ def soap_faults(func):
> except Exception as e:
> raise SoapElbeProjectError(format_exc())
> return wrapped
> - elif func.__code__.co_argcount == 5:
> + if func.__code__.co_argcount == 5:
> @wraps(func)
> def wrapped(self, arg1, arg2, arg3, arg4):
> try:
> @@ -172,7 +183,7 @@ def soap_faults(func):
> except Exception as e:
> raise SoapElbeProjectError(format_exc())
> return wrapped
> - elif func.__code__.co_argcount == 6:
> + if func.__code__.co_argcount == 6:
> @wraps(func)
> def wrapped(self, arg1, arg2, arg3, arg4, arg5):
> # pylint: disable=too-many-arguments
> @@ -193,7 +204,7 @@ def soap_faults(func):
> except Exception as e:
> raise SoapElbeProjectError(format_exc())
> return wrapped
> - elif func.__code__.co_argcount == 7:
> + if func.__code__.co_argcount == 7:
> @wraps(func)
> def wrapped(self, arg1, arg2, arg3, arg4, arg5, arg6):
> # pylint: disable=too-many-arguments
> @@ -214,7 +225,6 @@ def soap_faults(func):
> except Exception as e:
> raise SoapElbeProjectError(format_exc())
> return wrapped
> - else:
> - raise Exception(
> - "arg count %d not implemented" %
> - func.__code__.co_argcount)
> +
> + raise Exception("arg count %d not implemented" %
> + func.__code__.co_argcount)
> --
> 2.27.0
>
>
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel
--
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