mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed code smell 'Unused local variables should be removed'.
This commit is contained in:
parent
1fbf298d30
commit
dd27e08a98
@ -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")
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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:
|
||||||
|
@ -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(
|
||||||
|
@ -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."
|
||||||
|
@ -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
|
||||||
|
@ -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()
|
||||||
|
@ -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:
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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.
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user