mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed code smells having rule 'Nested blocks of code should not be left empty'.
This commit is contained in:
parent
707ff450b5
commit
c7a16a4bd5
@ -150,8 +150,7 @@ def check_and_download_vnc_browser_image(browser_name, browser_version):
|
||||
elif idx == len(version_tag):
|
||||
print("{0} Image is not available.".format(image_name))
|
||||
vnc_image_available = False
|
||||
else:
|
||||
pass
|
||||
|
||||
return vnc_image_available
|
||||
|
||||
|
||||
|
@ -776,9 +776,6 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
return False
|
||||
return True
|
||||
|
||||
elif key == 'exclude_constraint':
|
||||
pass
|
||||
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
|
@ -36,9 +36,7 @@ def Themes(app):
|
||||
try:
|
||||
misc_preference = Preferences.module('misc')
|
||||
theme = misc_preference.preference('theme').get()
|
||||
if theme not in all_themes:
|
||||
pass
|
||||
else:
|
||||
if theme in all_themes:
|
||||
theme_css = all_themes[theme]['cssfile'] + '.css'
|
||||
except Exception:
|
||||
# Let the default theme go if exception occurs
|
||||
|
@ -240,34 +240,33 @@ def filename_with_file_manager_path(_file, create_file=True):
|
||||
Args:
|
||||
file: File name returned from client file manager
|
||||
create_file: Set flag to False when file creation doesn't required
|
||||
|
||||
Returns:
|
||||
Filename to use for backup with full path taken from preference
|
||||
"""
|
||||
# Set file manager directory from preference
|
||||
storage_dir = get_storage_directory()
|
||||
|
||||
if storage_dir:
|
||||
_file = os.path.join(storage_dir, _file.lstrip(u'/').lstrip(u'\\'))
|
||||
elif not os.path.isabs(_file):
|
||||
_file = os.path.join(document_dir(), _file)
|
||||
|
||||
def short_filepath():
|
||||
short_path = fs_short_path(_file)
|
||||
# fs_short_path() function may return empty path on Windows
|
||||
# if directory doesn't exists. In that case we strip the last path
|
||||
# component and get the short path.
|
||||
if os.name == 'nt' and short_path == '':
|
||||
base_name = os.path.basename(_file)
|
||||
dir_name = os.path.dirname(_file)
|
||||
short_path = fs_short_path(dir_name) + '\\' + base_name
|
||||
return short_path
|
||||
|
||||
if create_file:
|
||||
# Touch the file to get the short path of the file on windows.
|
||||
with open(_file, 'a'):
|
||||
pass
|
||||
return short_filepath()
|
||||
|
||||
short_path = fs_short_path(_file)
|
||||
|
||||
# fs_short_path() function may return empty path on Windows
|
||||
# if directory doesn't exists. In that case we strip the last path
|
||||
# component and get the short path.
|
||||
if os.name == 'nt' and short_path == '':
|
||||
base_name = os.path.basename(_file)
|
||||
dir_name = os.path.dirname(_file)
|
||||
short_path = fs_short_path(dir_name) + '\\' + base_name
|
||||
|
||||
return short_path
|
||||
return short_filepath()
|
||||
|
||||
|
||||
@blueprint.route(
|
||||
|
@ -192,7 +192,7 @@ def filename_with_file_manager_path(_file, _present=False):
|
||||
if not _present:
|
||||
# Touch the file to get the short path of the file on windows.
|
||||
with open(_file, 'a'):
|
||||
pass
|
||||
return fs_short_path(_file)
|
||||
else:
|
||||
if not os.path.isfile(_file):
|
||||
return None
|
||||
|
@ -345,7 +345,7 @@ def directory_diff(source_dict, target_dict, ignore_keys=[], difference={}):
|
||||
|
||||
# ignore the keys if available.
|
||||
if key in ignore_keys:
|
||||
pass
|
||||
continue
|
||||
elif key in tar_only:
|
||||
if type(target_dict[key]) is list:
|
||||
difference[key] = {}
|
||||
|
@ -383,17 +383,15 @@ class reader(object):
|
||||
self.parse_add_char(c)
|
||||
|
||||
def _parse_in_quoted_field(self, c):
|
||||
if c == '\0':
|
||||
pass
|
||||
elif c == self.dialect.escapechar:
|
||||
if c != '\0' and c == self.dialect.escapechar:
|
||||
self.state = ESCAPE_IN_QUOTED_FIELD
|
||||
elif (c == self.dialect.quotechar and
|
||||
self.dialect.quoting != QUOTE_NONE):
|
||||
elif c != '\0' and (c == self.dialect.quotechar and
|
||||
self.dialect.quoting != QUOTE_NONE):
|
||||
if self.dialect.doublequote:
|
||||
self.state = QUOTE_IN_QUOTED_FIELD
|
||||
else:
|
||||
self.state = IN_FIELD
|
||||
else:
|
||||
elif c != '\0':
|
||||
self.parse_add_char(c)
|
||||
|
||||
def _parse_escape_in_quoted_field(self, c):
|
||||
@ -427,11 +425,9 @@ class reader(object):
|
||||
))
|
||||
|
||||
def _parse_eat_crnl(self, c):
|
||||
if c == '\n' or c == '\r':
|
||||
pass
|
||||
elif c == '\0':
|
||||
if c != '\n' and c != '\r' and c == '\0':
|
||||
self.state = START_RECORD
|
||||
else:
|
||||
elif c != '\n' and c != '\r':
|
||||
raise Error('new-line character seen in unquoted field - do you '
|
||||
'need to open the file in universal-newline mode?')
|
||||
|
||||
|
@ -219,7 +219,7 @@ class FileBackedSessionManager(SessionManager):
|
||||
|
||||
# touch the file
|
||||
with open(fname, 'wb'):
|
||||
pass
|
||||
return ManagedSession(sid=sid)
|
||||
|
||||
return ManagedSession(sid=sid)
|
||||
|
||||
|
@ -107,7 +107,5 @@ class BaseFeatureTest(BaseTestGenerator):
|
||||
try:
|
||||
os.mkdir(path)
|
||||
except OSError as e:
|
||||
if e.errno == errno.EEXIST:
|
||||
pass
|
||||
else:
|
||||
if e.errno != errno.EEXIST:
|
||||
raise
|
||||
|
Loading…
Reference in New Issue
Block a user