[elbe-devel] [PATCH 16/37] Remove unused exception variables

Benedikt Spranger b.spranger at linutronix.de
Wed Feb 7 15:28:43 CET 2024


From: Eduard Krein <eduard.krein at linutronix.de>

A variety of exception handlers declare a exception variable, but
do not use it. Remove these unused variables.

Signed-off-by: Eduard Krein <eduard.krein at linutronix.de>
Signed-off-by: Benedikt Spranger <b.spranger at linutronix.de>
---
 elbepack/commands/control.py    |  6 +++---
 elbepack/commands/prjrepo.py    |  6 +++---
 elbepack/daemons/soap/faults.py | 28 ++++++++++++++--------------
 elbepack/elbeproject.py         |  2 +-
 4 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/elbepack/commands/control.py b/elbepack/commands/control.py
index 27beb762..e0cde08e 100644
--- a/elbepack/commands/control.py
+++ b/elbepack/commands/control.py
@@ -127,7 +127,7 @@ def run_command(argv):
             debug=opt.debug,
             retries=int(
                 opt.retries))
-    except URLError as e:
+    except URLError:
         print(
             f"Failed to connect to Soap server {opt.host}:{opt.port}\n",
             file=sys.stderr)
@@ -135,7 +135,7 @@ def run_command(argv):
         print("Check, whether the initvm is actually running.", file=sys.stderr)
         print("try 'elbe initvm start'", file=sys.stderr)
         sys.exit(13)
-    except socket.error as e:
+    except socket.error:
         print(
             f"Failed to connect to Soap server {opt.host}:{opt.port}\n",
             file=sys.stderr)
@@ -145,7 +145,7 @@ def run_command(argv):
             file=sys.stderr)
         print("try 'elbe initvm attach'", file=sys.stderr)
         sys.exit(14)
-    except BadStatusLine as e:
+    except BadStatusLine:
         print(
             f"Failed to connect to Soap server {opt.host}:{opt.port}\n",
             file=sys.stderr)
diff --git a/elbepack/commands/prjrepo.py b/elbepack/commands/prjrepo.py
index 67e2d272..7e89eb87 100644
--- a/elbepack/commands/prjrepo.py
+++ b/elbepack/commands/prjrepo.py
@@ -71,7 +71,7 @@ def run_command(argv):
             debug=opt.debug,
             retries=int(
                 opt.retries))
-    except URLError as e:
+    except URLError:
         print(
             f"Failed to connect to Soap server {opt.host}:{opt.port}\n",
             file=sys.stderr)
@@ -79,7 +79,7 @@ def run_command(argv):
         print("Check, wether the initvm is actually running.", file=sys.stderr)
         print("try `elbe initvm start`", file=sys.stderr)
         sys.exit(10)
-    except socket.error as e:
+    except socket.error:
         print(
             f"Failed to connect to Soap server {opt.host}:{opt.port}\n",
             file=sys.stderr)
@@ -89,7 +89,7 @@ def run_command(argv):
             file=sys.stderr)
         print("try 'elbe initvm attach'", file=sys.stderr)
         sys.exit(11)
-    except BadStatusLine as e:
+    except BadStatusLine:
         print(
             f"Failed to connect to Soap server {opt.host}:{opt.port}\n",
             file=sys.stderr)
diff --git a/elbepack/daemons/soap/faults.py b/elbepack/daemons/soap/faults.py
index 379e6251..58b0f64b 100644
--- a/elbepack/daemons/soap/faults.py
+++ b/elbepack/daemons/soap/faults.py
@@ -86,7 +86,7 @@ def soap_faults(func):
         def wrapped(self):
             try:
                 return func(self)
-            except InvalidState as e:
+            except InvalidState:
                 raise SoapElbeInvalidState()
             except ProjectManagerError as e:
                 raise SoapElbeProjectError(str(e))
@@ -98,7 +98,7 @@ def soap_faults(func):
                 raise SoapElbeValidationError(e)
             except InvalidLogin:
                 raise SoapElbeNotAuthorized()
-            except Exception as e:
+            except Exception:
                 raise SoapElbeProjectError(format_exc())
         return wrapped
     if func.__code__.co_argcount == 2:
@@ -106,7 +106,7 @@ def soap_faults(func):
         def wrapped(self, arg1):
             try:
                 return func(self, arg1)
-            except InvalidState as e:
+            except InvalidState:
                 raise SoapElbeInvalidState()
             except ProjectManagerError as e:
                 raise SoapElbeProjectError(str(e))
@@ -118,7 +118,7 @@ def soap_faults(func):
                 raise SoapElbeValidationError(e)
             except InvalidLogin:
                 raise SoapElbeNotAuthorized()
-            except Exception as e:
+            except Exception:
                 raise SoapElbeProjectError(format_exc())
         return wrapped
     if func.__code__.co_argcount == 3:
@@ -126,7 +126,7 @@ def soap_faults(func):
         def wrapped(self, arg1, arg2):
             try:
                 return func(self, arg1, arg2)
-            except InvalidState as e:
+            except InvalidState:
                 raise SoapElbeInvalidState()
             except ProjectManagerError as e:
                 raise SoapElbeProjectError(str(e))
@@ -138,7 +138,7 @@ def soap_faults(func):
                 raise SoapElbeValidationError(e)
             except InvalidLogin:
                 raise SoapElbeNotAuthorized()
-            except Exception as e:
+            except Exception:
                 raise SoapElbeProjectError(format_exc())
         return wrapped
     if func.__code__.co_argcount == 4:
@@ -146,7 +146,7 @@ def soap_faults(func):
         def wrapped(self, arg1, arg2, arg3):
             try:
                 return func(self, arg1, arg2, arg3)
-            except InvalidState as e:
+            except InvalidState:
                 raise SoapElbeInvalidState()
             except ProjectManagerError as e:
                 raise SoapElbeProjectError(str(e))
@@ -158,7 +158,7 @@ def soap_faults(func):
                 raise SoapElbeValidationError(e)
             except InvalidLogin:
                 raise SoapElbeNotAuthorized()
-            except Exception as e:
+            except Exception:
                 raise SoapElbeProjectError(format_exc())
         return wrapped
     if func.__code__.co_argcount == 5:
@@ -166,7 +166,7 @@ def soap_faults(func):
         def wrapped(self, arg1, arg2, arg3, arg4):
             try:
                 return func(self, arg1, arg2, arg3, arg4)
-            except InvalidState as e:
+            except InvalidState:
                 raise SoapElbeInvalidState()
             except ProjectManagerError as e:
                 raise SoapElbeProjectError(str(e))
@@ -178,7 +178,7 @@ def soap_faults(func):
                 raise SoapElbeValidationError(e)
             except InvalidLogin:
                 raise SoapElbeNotAuthorized()
-            except Exception as e:
+            except Exception:
                 raise SoapElbeProjectError(format_exc())
         return wrapped
     if func.__code__.co_argcount == 6:
@@ -187,7 +187,7 @@ def soap_faults(func):
             # pylint: disable=too-many-arguments
             try:
                 return func(self, arg1, arg2, arg3, arg4, arg5)
-            except InvalidState as e:
+            except InvalidState:
                 raise SoapElbeInvalidState()
             except ProjectManagerError as e:
                 raise SoapElbeProjectError(str(e))
@@ -199,7 +199,7 @@ def soap_faults(func):
                 raise SoapElbeValidationError(e)
             except InvalidLogin:
                 raise SoapElbeNotAuthorized()
-            except Exception as e:
+            except Exception:
                 raise SoapElbeProjectError(format_exc())
         return wrapped
     if func.__code__.co_argcount == 7:
@@ -208,7 +208,7 @@ def soap_faults(func):
             # pylint: disable=too-many-arguments
             try:
                 return func(self, arg1, arg2, arg3, arg4, arg5, arg6)
-            except InvalidState as e:
+            except InvalidState:
                 raise SoapElbeInvalidState()
             except ProjectManagerError as e:
                 raise SoapElbeProjectError(str(e))
@@ -220,7 +220,7 @@ def soap_faults(func):
                 raise SoapElbeValidationError(e)
             except InvalidLogin:
                 raise SoapElbeNotAuthorized()
-            except Exception as e:
+            except Exception:
                 raise SoapElbeProjectError(format_exc())
         return wrapped
 
diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index 5703e324..e9dc6ef9 100644
--- a/elbepack/elbeproject.py
+++ b/elbepack/elbeproject.py
@@ -277,7 +277,7 @@ class ElbeProject:
             try:
                 cache.mark_install_devpkgs(set(ignore_pkgs),
                                            set(ignore_dev_pkgs))
-            except SystemError as e:
+            except SystemError:
                 logging.exception("Mark install devpkgs failed")
             try:
                 cache.commit()
-- 
2.43.0



More information about the elbe-devel mailing list