[elbe-devel] [PATCH 02/13] pylint - fix 'function already defined' warning

Manuel Traut manut at linutronix.de
Wed Aug 29 21:07:23 CEST 2018


the warning can be avoid if elif instead of multiple if
statements are used.

Signed-off-by: Manuel Traut <manut at linutronix.de>
---
 elbepack/daemons/soap/faults.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/elbepack/daemons/soap/faults.py b/elbepack/daemons/soap/faults.py
index 1ed46e19..288d1c8f 100644
--- a/elbepack/daemons/soap/faults.py
+++ b/elbepack/daemons/soap/faults.py
@@ -92,7 +92,7 @@ def soap_faults(func):
             except Exception as e:
                 raise SoapElbeProjectError(format_exc())
         return wrapped
-    if func.__code__.co_argcount == 2:
+    elif func.__code__.co_argcount == 2:
         @wraps(func)
         def wrapped(self, arg1):
             try:
@@ -112,7 +112,7 @@ def soap_faults(func):
             except Exception as e:
                 raise SoapElbeProjectError(format_exc())
         return wrapped
-    if func.__code__.co_argcount == 3:
+    elif func.__code__.co_argcount == 3:
         @wraps(func)
         def wrapped(self, arg1, arg2):
             try:
@@ -132,7 +132,7 @@ def soap_faults(func):
             except Exception as e:
                 raise SoapElbeProjectError(format_exc())
         return wrapped
-    if func.__code__.co_argcount == 4:
+    elif func.__code__.co_argcount == 4:
         @wraps(func)
         def wrapped(self, arg1, arg2, arg3):
             try:
@@ -152,7 +152,7 @@ def soap_faults(func):
             except Exception as e:
                 raise SoapElbeProjectError(format_exc())
         return wrapped
-    if func.__code__.co_argcount == 5:
+    elif func.__code__.co_argcount == 5:
         @wraps(func)
         def wrapped(self, arg1, arg2, arg3, arg4):
             try:
@@ -172,7 +172,7 @@ def soap_faults(func):
             except Exception as e:
                 raise SoapElbeProjectError(format_exc())
         return wrapped
-    if func.__code__.co_argcount == 6:
+    elif func.__code__.co_argcount == 6:
         @wraps(func)
         def wrapped(self, arg1, arg2, arg3, arg4, arg5):
             # pylint: disable=too-many-arguments
@@ -193,7 +193,7 @@ def soap_faults(func):
             except Exception as e:
                 raise SoapElbeProjectError(format_exc())
         return wrapped
-    if func.__code__.co_argcount == 7:
+    elif func.__code__.co_argcount == 7:
         @wraps(func)
         def wrapped(self, arg1, arg2, arg3, arg4, arg5, arg6):
             # pylint: disable=too-many-arguments
-- 
2.18.0




More information about the elbe-devel mailing list