mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed SonarQube code smell 'Rename function and variable name to match the regular expression'.
This commit is contained in:
committed by
Akshay Joshi
parent
6dd3ca31be
commit
b30c590866
@@ -215,7 +215,7 @@ class DataTypeReader:
|
||||
return length, precision, typeval
|
||||
|
||||
@staticmethod
|
||||
def get_full_type(nsp, typname, isDup, numdims, typmod):
|
||||
def get_full_type(nsp, typname, is_dup, numdims, typmod):
|
||||
"""
|
||||
Returns full type name with Length and Precision.
|
||||
|
||||
|
||||
@@ -547,9 +547,9 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
).format(arg)
|
||||
)
|
||||
try:
|
||||
SQL, nameOrError = self.getSQL(gid, sid, did, data)
|
||||
SQL, name_or_error = self.getSQL(gid, sid, did, data)
|
||||
if SQL is None:
|
||||
return nameOrError
|
||||
return name_or_error
|
||||
SQL = SQL.strip('\n').strip(' ')
|
||||
status, res = self.conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
@@ -729,9 +729,9 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
except ValueError:
|
||||
data[k] = v
|
||||
|
||||
sql, nameOrError = self.getSQL(gid, sid, did, data, vid)
|
||||
sql, name_or_error = self.getSQL(gid, sid, did, data, vid)
|
||||
if sql is None:
|
||||
return nameOrError
|
||||
return name_or_error
|
||||
|
||||
sql = sql.strip('\n').strip(' ')
|
||||
|
||||
@@ -967,7 +967,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
"""
|
||||
|
||||
self.rule_temp_path = 'rules'
|
||||
SQL_data = ''
|
||||
sql_data = ''
|
||||
SQL = render_template("/".join(
|
||||
[self.rule_temp_path, 'sql/properties.sql']), tid=vid)
|
||||
|
||||
@@ -989,16 +989,16 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
SQL = render_template("/".join(
|
||||
[self.rule_temp_path, 'sql/create.sql']),
|
||||
data=res, display_comments=display_comments)
|
||||
SQL_data += '\n'
|
||||
SQL_data += SQL
|
||||
return SQL_data
|
||||
sql_data += '\n'
|
||||
sql_data += SQL
|
||||
return sql_data
|
||||
|
||||
def get_compound_trigger_sql(self, vid, display_comments=True):
|
||||
"""
|
||||
Get all compound trigger nodes associated with view node,
|
||||
generate their sql and render into sql tab
|
||||
"""
|
||||
SQL_data = ''
|
||||
sql_data = ''
|
||||
if self.manager.server_type == 'ppas' \
|
||||
and self.manager.version >= 120000:
|
||||
|
||||
@@ -1065,10 +1065,10 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
'sql/{0}/#{1}#/create.sql'.format(
|
||||
self.manager.server_type, self.manager.version)]),
|
||||
data=res_rows, display_comments=display_comments)
|
||||
SQL_data += '\n'
|
||||
SQL_data += SQL
|
||||
sql_data += '\n'
|
||||
sql_data += SQL
|
||||
|
||||
return SQL_data
|
||||
return sql_data
|
||||
|
||||
def get_trigger_sql(self, vid, display_comments=True):
|
||||
"""
|
||||
@@ -1085,7 +1085,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
# Define template path
|
||||
self.trigger_temp_path = 'triggers'
|
||||
|
||||
SQL_data = ''
|
||||
sql_data = ''
|
||||
SQL = render_template("/".join(
|
||||
[self.trigger_temp_path,
|
||||
'sql/{0}/#{1}#/properties.sql'.format(
|
||||
@@ -1158,10 +1158,10 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
'sql/{0}/#{1}#/create.sql'.format(
|
||||
self.manager.server_type, self.manager.version)]),
|
||||
data=res_rows, display_comments=display_comments)
|
||||
SQL_data += '\n'
|
||||
SQL_data += SQL
|
||||
sql_data += '\n'
|
||||
sql_data += SQL
|
||||
|
||||
return SQL_data
|
||||
return sql_data
|
||||
|
||||
def get_index_sql(self, did, vid, display_comments=True):
|
||||
"""
|
||||
@@ -1171,7 +1171,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
"""
|
||||
|
||||
self.index_temp_path = 'indexes'
|
||||
SQL_data = ''
|
||||
sql_data = ''
|
||||
SQL = render_template("/".join(
|
||||
[self.index_temp_path,
|
||||
'sql/#{0}#/properties.sql'.format(self.manager.version)]),
|
||||
@@ -1204,9 +1204,9 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
[self.index_temp_path,
|
||||
'sql/#{0}#/create.sql'.format(self.manager.version)]),
|
||||
data=data, display_comments=display_comments)
|
||||
SQL_data += '\n'
|
||||
SQL_data += SQL
|
||||
return SQL_data
|
||||
sql_data += '\n'
|
||||
sql_data += SQL
|
||||
return sql_data
|
||||
|
||||
@check_precondition
|
||||
def sql(self, gid, sid, did, scid, vid, diff_schema=None,
|
||||
@@ -1220,7 +1220,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
if not json_resp:
|
||||
display_comments = False
|
||||
|
||||
SQL_data = ''
|
||||
sql_data = ''
|
||||
SQL = render_template("/".join(
|
||||
[self.template_path, 'sql/properties.sql']),
|
||||
vid=vid,
|
||||
@@ -1289,15 +1289,15 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
SQL += render_template("/".join(
|
||||
[self.template_path, 'sql/grant.sql']), data=result)
|
||||
|
||||
SQL_data += SQL
|
||||
SQL_data += self.get_rule_sql(vid, display_comments)
|
||||
SQL_data += self.get_trigger_sql(vid, display_comments)
|
||||
SQL_data += self.get_compound_trigger_sql(vid, display_comments)
|
||||
SQL_data += self.get_index_sql(did, vid, display_comments)
|
||||
sql_data += SQL
|
||||
sql_data += self.get_rule_sql(vid, display_comments)
|
||||
sql_data += self.get_trigger_sql(vid, display_comments)
|
||||
sql_data += self.get_compound_trigger_sql(vid, display_comments)
|
||||
sql_data += self.get_index_sql(did, vid, display_comments)
|
||||
|
||||
if not json_resp:
|
||||
return SQL_data
|
||||
return ajax_response(response=SQL_data)
|
||||
return sql_data
|
||||
return ajax_response(response=sql_data)
|
||||
|
||||
@check_precondition
|
||||
def get_tblspc(self, gid, sid, did, scid):
|
||||
@@ -1531,7 +1531,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
if data:
|
||||
if diff_schema:
|
||||
data['schema'] = diff_schema
|
||||
sql, nameOrError = self.getSQL(gid, sid, did, data, oid)
|
||||
sql, name_or_error = self.getSQL(gid, sid, did, data, oid)
|
||||
if sql.find('DROP VIEW') != -1:
|
||||
sql = gettext("""
|
||||
-- Changing the columns in a view requires dropping and re-creating the view.
|
||||
@@ -1767,7 +1767,7 @@ class MViewNode(ViewNode, VacuumSettings):
|
||||
if not json_resp:
|
||||
display_comments = False
|
||||
|
||||
SQL_data = ''
|
||||
sql_data = ''
|
||||
status, result = self._fetch_properties(did, scid, vid)
|
||||
|
||||
if not status:
|
||||
@@ -1817,15 +1817,15 @@ class MViewNode(ViewNode, VacuumSettings):
|
||||
SQL += render_template("/".join(
|
||||
[self.template_path, 'sql/grant.sql']), data=result)
|
||||
|
||||
SQL_data += SQL
|
||||
SQL_data += self.get_rule_sql(vid, display_comments)
|
||||
SQL_data += self.get_trigger_sql(vid, display_comments)
|
||||
SQL_data += self.get_index_sql(did, vid, display_comments)
|
||||
SQL_data = SQL_data.strip('\n')
|
||||
sql_data += SQL
|
||||
sql_data += self.get_rule_sql(vid, display_comments)
|
||||
sql_data += self.get_trigger_sql(vid, display_comments)
|
||||
sql_data += self.get_index_sql(did, vid, display_comments)
|
||||
sql_data = sql_data.strip('\n')
|
||||
|
||||
if not json_resp:
|
||||
return SQL_data
|
||||
return ajax_response(response=SQL_data)
|
||||
return sql_data
|
||||
return ajax_response(response=sql_data)
|
||||
|
||||
@check_precondition
|
||||
def get_table_vacuum(self, gid, sid, did, scid):
|
||||
|
||||
@@ -97,7 +97,7 @@ class BackupMessage(IProcessDesc):
|
||||
self.database = _kwargs['database'] if 'database' in _kwargs else None
|
||||
self.cmd = ''
|
||||
|
||||
def cmdArg(x):
|
||||
def cmd_arg(x):
|
||||
if x:
|
||||
x = x.replace('\\', '\\\\')
|
||||
x = x.replace('"', '\\"')
|
||||
@@ -109,7 +109,7 @@ class BackupMessage(IProcessDesc):
|
||||
if arg and len(arg) >= 2 and arg[:2] == '--':
|
||||
self.cmd += ' ' + arg
|
||||
else:
|
||||
self.cmd += cmdArg(arg)
|
||||
self.cmd += cmd_arg(arg)
|
||||
|
||||
def get_server_details(self):
|
||||
# Fetch the server details like hostname, port, roles etc
|
||||
|
||||
@@ -81,7 +81,7 @@ class IEMessage(IProcessDesc):
|
||||
if _storage:
|
||||
_storage = _storage.replace('\\', '/')
|
||||
|
||||
def cmdArg(x):
|
||||
def cmd_arg(x):
|
||||
if x:
|
||||
x = x.replace('\\', '\\\\')
|
||||
x = x.replace('"', '\\"')
|
||||
@@ -97,12 +97,12 @@ class IEMessage(IProcessDesc):
|
||||
replace_next = True
|
||||
self._cmd += ' ' + arg
|
||||
elif replace_next:
|
||||
arg = cmdArg(arg)
|
||||
arg = cmd_arg(arg)
|
||||
if _storage is not None:
|
||||
arg = arg.replace(_storage, '<STORAGE_DIR>')
|
||||
self._cmd += ' "' + arg + '"'
|
||||
else:
|
||||
self._cmd += cmdArg(arg)
|
||||
self._cmd += cmd_arg(arg)
|
||||
|
||||
@property
|
||||
def message(self):
|
||||
|
||||
@@ -71,7 +71,7 @@ class RestoreMessage(IProcessDesc):
|
||||
self.bfile = _bfile
|
||||
self.cmd = ''
|
||||
|
||||
def cmdArg(x):
|
||||
def cmd_arg(x):
|
||||
if x:
|
||||
x = x.replace('\\', '\\\\')
|
||||
x = x.replace('"', '\\"')
|
||||
@@ -83,7 +83,7 @@ class RestoreMessage(IProcessDesc):
|
||||
if arg and len(arg) >= 2 and arg[:2] == '--':
|
||||
self.cmd += ' ' + arg
|
||||
else:
|
||||
self.cmd += cmdArg(arg)
|
||||
self.cmd += cmd_arg(arg)
|
||||
|
||||
def get_server_details(self):
|
||||
# Fetch the server details like hostname, port, roles etc
|
||||
|
||||
Reference in New Issue
Block a user