Fix some code inspection complaints

This commit is contained in:
Dave Page 2017-03-25 18:49:25 -04:00
parent a6fa35789c
commit 6152d73f13
10 changed files with 42 additions and 51 deletions

View File

@ -124,9 +124,9 @@ data 'STR#' (5002, "English") {
'UDZO -imagekey zlib-devel=9 -o %s' % dmgFile)
os.remove('%s.temp.dmg' % dmgFile)
if ret == 0:
print "Successfully added license to '%s'" % dmgFile
print("Successfully added license to '%s'" % dmgFile)
else:
print "Failed to add license to '%s'" % dmgFile
print("Failed to add license to '%s'" % dmgFile)
if __name__ == '__main__':
parser = optparse.OptionParser()
@ -155,7 +155,7 @@ if __name__ == '__main__':
options, args = parser.parse_args()
cond = len(args) != 2
if not os.path.exists(options.rez):
print 'Failed to find Rez at "%s"!\n' % options.rez
print('Failed to find Rez at "%s"!\n' % options.rez)
cond = True
if cond:
parser.print_usage()

View File

@ -59,9 +59,7 @@ blueprint = AboutModule(MODULE_NAME, __name__,
@login_required
def index():
"""Render the about box."""
info = {}
info['python_version'] = sys.version
info['flask_version'] = __version__
info = {'python_version': sys.version, 'flask_version': __version__}
if config.SERVER_MODE is True:
info['app_mode'] = gettext('Server')
else:

View File

@ -529,7 +529,7 @@ class FunctionView(PGChildNodeView, DataTypeReader):
dif = len(proargmodes_fltrd) - len(proargdefaultvals)
while (dif > 0):
proargdefaultvals.insert(0, '')
dif = dif - 1
dif -= 1
# Prepare list of Argument list dict to be displayed in the Data Grid.
params = {"arguments": [

View File

@ -431,7 +431,7 @@ It may have been removed by another user or moved to another schema.
dif = len(proargmodes_fltrd) - len(proargdefaultvals)
while (dif > 0):
proargdefaultvals.insert(0, '')
dif = dif - 1
dif -= 1
# Prepare list of Argument list dict to be displayed in the Data Grid.
params = {"arguments": [

View File

@ -2544,25 +2544,25 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
# 'options' we need true/false to render switch ASC(false)/DESC(true)
columns = []
cols = []
for row in rset['rows']:
for col_row in rset['rows']:
# We need all data as collection for ColumnsModel
cols_data = {
'colname': row['attdef'].strip('"'),
'collspcname': row['collnspname'],
'op_class': row['opcname'],
'colname': col_row['attdef'].strip('"'),
'collspcname': col_row['collnspname'],
'op_class': col_row['opcname'],
}
if row['options'][0] == 'DESC':
if col_row['options'][0] == 'DESC':
cols_data['sort_order'] = True
columns.append(cols_data)
# We need same data as string to display in properties window
# If multiple column then separate it by colon
cols_str = row['attdef']
if row['collnspname']:
cols_str += ' COLLATE ' + row['collnspname']
if row['opcname']:
cols_str += ' ' + row['opcname']
if row['options'][0] == 'DESC':
cols_str = col_row['attdef']
if col_row['collnspname']:
cols_str += ' COLLATE ' + col_row['collnspname']
if col_row['opcname']:
cols_str += ' ' + col_row['opcname']
if col_row['options'][0] == 'DESC':
cols_str += ' DESC'
cols.append(cols_str)
@ -2634,8 +2634,8 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings):
# 'tgattr' contains list of columns from table used in trigger
columns = []
for row in rset['rows']:
columns.append({'column': row['name']})
for col_row in rset['rows']:
columns.append({'column': col_row['name']})
data['columns'] = columns

View File

@ -241,12 +241,11 @@ def init_function(node_type, sid, did, scid, fid, trid=None):
else:
function_data = session['funcData']
data = {}
data['name'] = r_set['rows'][0]['proargnames']
data['type'] = r_set['rows'][0]['proargtypenames']
data['use_default'] = r_set['rows'][0]['pronargdefaults']
data['default_value'] = r_set['rows'][0]['proargdefaults']
data['require_input'] = True
data = {'name': r_set['rows'][0]['proargnames'],
'type': r_set['rows'][0]['proargtypenames'],
'use_default': r_set['rows'][0]['pronargdefaults'],
'default_value': r_set['rows'][0]['proargdefaults'],
'require_input': True}
# Below will check do we really required for the user input arguments and show input dialog
if not r_set['rows'][0]['proargtypenames']:
@ -907,7 +906,7 @@ def messages(trans_id):
# and attach listened to that port number
offset = notify[0].find('PLDBGBREAK')
str_len = len('PLDBGBREAK')
str_len = str_len + 1
str_len += 1
tmpOffset = 0
tmpFlag = False
@ -915,9 +914,9 @@ def messages(trans_id):
status = 'Success'
tmpFlag = True
port_number = port_number + notify[0][offset + str_len + tmpOffset]
tmpOffset = tmpOffset + 1
tmpOffset += 1
if tmpFlag == False:
if not tmpFlag:
status = 'Busy'
else:
status = 'Busy'

View File

@ -358,9 +358,8 @@ def msql(gid, sid, did):
# Pass database objects and get SQL for privileges
SQL_data = ''
data_func = {}
data_func['objects'] = data['objects']
data_func['priv'] = data['priv']['function']
data_func = {'objects': data['objects'],
'priv': data['priv']['function']}
SQL = render_template(
"/".join([server_prop['template_path'],
'/sql/grant_function.sql']),
@ -368,9 +367,8 @@ def msql(gid, sid, did):
if SQL and SQL.strip('\n') != '':
SQL_data += SQL
data_seq = {}
data_seq['objects'] = data['objects']
data_seq['priv'] = data['priv']['sequence']
data_seq = {'objects': data['objects'],
'priv': data['priv']['sequence']}
SQL = render_template(
"/".join([server_prop['template_path'],
'/sql/grant_sequence.sql']),
@ -378,9 +376,8 @@ def msql(gid, sid, did):
if SQL and SQL.strip('\n') != '':
SQL_data += SQL
data_table = {}
data_table['objects'] = data['objects']
data_table['priv'] = data['priv']['table']
data_table = {'objects': data['objects'],
'priv': data['priv']['table']}
SQL = render_template(
"/".join([server_prop['template_path'], '/sql/grant_table.sql']),
data=data_table, conn=conn)
@ -449,9 +446,8 @@ def save(gid, sid, did):
# Pass database objects and get SQL for privileges
# Pass database objects and get SQL for privileges
SQL_data = ''
data_func = {}
data_func['objects'] = data['objects']
data_func['priv'] = data['priv']['function']
data_func = {'objects': data['objects'],
'priv': data['priv']['function']}
SQL = render_template(
"/".join([server_prop['template_path'],
'/sql/grant_function.sql']),
@ -459,9 +455,8 @@ def save(gid, sid, did):
if SQL and SQL.strip('\n') != '':
SQL_data += SQL
data_seq = {}
data_seq['objects'] = data['objects']
data_seq['priv'] = data['priv']['sequence']
data_seq = {'objects': data['objects'],
'priv': data['priv']['sequence']}
SQL = render_template(
"/".join([server_prop['template_path'],
'/sql/grant_sequence.sql']),
@ -469,9 +464,8 @@ def save(gid, sid, did):
if SQL and SQL.strip('\n') != '':
SQL_data += SQL
data_table = {}
data_table['objects'] = data['objects']
data_table['priv'] = data['priv']['table']
data_table = {'objects': data['objects'],
'priv': data['priv']['table']}
SQL = render_template(
"/".join([server_prop['template_path'], '/sql/grant_table.sql']),
data=data_table, conn=conn)

View File

@ -1181,7 +1181,7 @@ Failed to reset the connection to the server due to following error:
pos = 0
for col in self.column_info:
col['pos'] = pos
pos = pos + 1
pos += 1
self.row_count = cur.rowcount

View File

@ -90,7 +90,7 @@ def parse_typed_field_list(tokens):
# " ( [ [ argmode ] [ argname ] argtype
# [ { DEFAULT | = } default_expr ] [, ...] ] )"
mode_names = set(('IN', 'OUT', 'INOUT', 'VARIADIC'))
mode_names = {'IN', 'OUT', 'INOUT', 'VARIADIC'}
parse_state = 'type'
parens = 0
field = TypedFieldMetadata()

View File

@ -346,7 +346,7 @@ if __name__ == '__main__':
print("Please check output in file: %s/regression.log\n" % CURRENT_PATH)
if failure == True:
if failure:
sys.exit(1)
else:
sys.exit(0)