Fixed code smell 'Unused local variables should be removed'.

This commit is contained in:
Yogesh Mahajan
2020-07-24 12:15:29 +05:30
committed by Akshay Joshi
parent 1fbf298d30
commit dd27e08a98
14 changed files with 16 additions and 16 deletions

View File

@@ -718,7 +718,7 @@ def utils():
from pgadmin.utils.driver import get_driver
driver = get_driver(PG_DEFAULT_DRIVER)
pg_libpq_version = driver.libpq_version()
except Exception as e:
except Exception:
pg_libpq_version = 0
for submodule in current_blueprint.submodules:

View File

@@ -232,7 +232,6 @@ class DatabaseView(PGChildNodeView):
if self.manager.db == row['name']:
row['canDrop'] = False
else:
conn = self.manager.connection(row['name'], did=row['did'])
row['canDrop'] = True
return ajax_response(

View File

@@ -428,7 +428,7 @@ class PGChildNodeView(NodeView):
return internal_server_error(errormsg=msg)
except (ConnectionLost, SSHTunnelConnectionLost, CryptKeyMissing):
raise
except Exception as e:
except Exception:
return precondition_required(
gettext(
"Connection to the server has been lost."

View File

@@ -104,7 +104,7 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest):
lambda driver: driver.find_element_by_name(
NavMenuLocators.backup_filename_txt_box_name)):
click = False
except Exception as e:
except Exception:
pass
# Wait for the backup status alertfier

View File

@@ -674,7 +674,7 @@ SELECT 1, pg_sleep(300)"""
show_jit = pg_cursor.fetchone()
if show_jit[0] == 'on':
jit_enabled = True
except Exception as e:
except Exception:
pass
connection.close()

View File

@@ -314,7 +314,7 @@ class CheckForXssFeatureTest(BaseFeatureTest):
)
).perform()
break
except Exception as e:
except Exception:
if idx != 2:
continue
else:

View File

@@ -88,7 +88,7 @@ class CheckDebuggerForXssFeatureTest(BaseFeatureTest):
"contains(@class,'ajs-header')]")
))
except TimeoutException as e:
except TimeoutException:
is_error = None
# If debugger plugin is not found

View File

@@ -485,7 +485,7 @@ def register_dialect(name, dialect='excel', **fmtparams):
try:
Dialect.validate(dialect)
except Exception as e:
except Exception:
raise TypeError('dialect is invalid')
assert name not in _dialect_registry

View File

@@ -49,7 +49,7 @@ class AppStarter:
random_server_port
)
except WebDriverException as e:
except WebDriverException:
# In case of WebDriverException sleep for 1 second and retry
# again. Retry 10 times and if still app will not start then
# raise exception.

View File

@@ -1020,7 +1020,7 @@ class PgadminPage:
WebDriverWait(self.driver, timeout, .01).until(
EC.visibility_of_element_located((By.XPATH, xpath)))
element_found = True
except Exception as e:
except Exception:
pass
return element_found
@@ -1141,7 +1141,7 @@ class PgadminPage:
EC.visibility_of_any_elements_located((
By.XPATH, locator))):
elements_located_status = True
except Exception as e:
except Exception:
pass
return elements_located_status

View File

@@ -1331,6 +1331,7 @@ def launch_url_in_browser(driver_instance, url, title='pgAdmin 4', timeout=50):
time.sleep(6)
count -= 1
if count == 0:
print(str(e))
exception_msg = 'Web-page title did not match to {0}. ' \
'Please check url {1} accessible on ' \
'internet.'.format(title, url)
@@ -1475,7 +1476,7 @@ def get_selenium_grid_status_json(selenoid_url):
selenoid_status = json.load(selenoid_status)
if isinstance(selenoid_status, dict):
return selenoid_status
except Exception as e:
except Exception:
print("Unable to find Selenoid Status.Kindly check url passed -'{0}'."
"Check parsing errors in test_config.json".format(selenoid_url))
return None