[elbe-devel] [PATCH 28/75] daemons soap faults: Fix Pylint
Olivier Dion
dion at linutronix.de
Fri May 29 17:01:51 CEST 2020
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:
----------------------------------------------------------------------
@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
More information about the elbe-devel
mailing list