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

@ -72,7 +72,7 @@ def find_replace(directory, find, replace):
print("Done") print("Done")
else: else:
print("N/A") print("N/A")
except Exception as e: except Exception:
failed.append(current_file) failed.append(current_file)
print("FAILED") print("FAILED")

View File

@ -65,7 +65,7 @@ def get_python_deps():
try: try:
distribution = pkg_resources.get_distribution(pkg) distribution = pkg_resources.get_distribution(pkg)
except IndexError as e: except IndexError:
# The package probably isn't required on this version of Python, # The package probably isn't required on this version of Python,
# thus we have no info about it. # thus we have no info about it.
have_unknowns = True have_unknowns = True

View File

@ -61,11 +61,11 @@ def get_chrome_version(args):
def _read_registry(root, key, value): def _read_registry(root, key, value):
try: try:
hkey = winreg.OpenKey(root, key) hkey = winreg.OpenKey(root, key)
except Exception as e: except Exception:
return None return None
try: try:
(val, typ) = winreg.QueryValueEx(hkey, value) (val, typ) = winreg.QueryValueEx(hkey, value)
except Exception as e: except Exception:
winreg.CloseKey(hkey) winreg.CloseKey(hkey)
return None return None

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1020,7 +1020,7 @@ class PgadminPage:
WebDriverWait(self.driver, timeout, .01).until( WebDriverWait(self.driver, timeout, .01).until(
EC.visibility_of_element_located((By.XPATH, xpath))) EC.visibility_of_element_located((By.XPATH, xpath)))
element_found = True element_found = True
except Exception as e: except Exception:
pass pass
return element_found return element_found
@ -1141,7 +1141,7 @@ class PgadminPage:
EC.visibility_of_any_elements_located(( EC.visibility_of_any_elements_located((
By.XPATH, locator))): By.XPATH, locator))):
elements_located_status = True elements_located_status = True
except Exception as e: except Exception:
pass pass
return elements_located_status 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) time.sleep(6)
count -= 1 count -= 1
if count == 0: if count == 0:
print(str(e))
exception_msg = 'Web-page title did not match to {0}. ' \ exception_msg = 'Web-page title did not match to {0}. ' \
'Please check url {1} accessible on ' \ 'Please check url {1} accessible on ' \
'internet.'.format(title, url) 'internet.'.format(title, url)
@ -1475,7 +1476,7 @@ def get_selenium_grid_status_json(selenoid_url):
selenoid_status = json.load(selenoid_status) selenoid_status = json.load(selenoid_status)
if isinstance(selenoid_status, dict): if isinstance(selenoid_status, dict):
return selenoid_status return selenoid_status
except Exception as e: except Exception:
print("Unable to find Selenoid Status.Kindly check url passed -'{0}'." print("Unable to find Selenoid Status.Kindly check url passed -'{0}'."
"Check parsing errors in test_config.json".format(selenoid_url)) "Check parsing errors in test_config.json".format(selenoid_url))
return None return None