diff --git a/pkg/mac/dmg-license.py b/pkg/mac/dmg-license.py index 9003a7c5e..71dd81869 100644 --- a/pkg/mac/dmg-license.py +++ b/pkg/mac/dmg-license.py @@ -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() diff --git a/web/pgadmin/about/__init__.py b/web/pgadmin/about/__init__.py index dc6d89332..4d4006ab5 100644 --- a/web/pgadmin/about/__init__.py +++ b/web/pgadmin/about/__init__.py @@ -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: diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py index 96dcec531..2d2b6fbd7 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py @@ -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": [ diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbfuncs/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbfuncs/__init__.py index 15ab65572..d6a608b08 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbfuncs/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbfuncs/__init__.py @@ -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": [ diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py index 5311db858..1fed25d4c 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py @@ -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 diff --git a/web/pgadmin/tools/debugger/__init__.py b/web/pgadmin/tools/debugger/__init__.py index 2154d342e..fa414ce72 100644 --- a/web/pgadmin/tools/debugger/__init__.py +++ b/web/pgadmin/tools/debugger/__init__.py @@ -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' diff --git a/web/pgadmin/tools/grant_wizard/__init__.py b/web/pgadmin/tools/grant_wizard/__init__.py index 566e7744c..9c6f47e5e 100644 --- a/web/pgadmin/tools/grant_wizard/__init__.py +++ b/web/pgadmin/tools/grant_wizard/__init__.py @@ -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) diff --git a/web/pgadmin/utils/driver/psycopg2/__init__.py b/web/pgadmin/utils/driver/psycopg2/__init__.py index 4391984ef..bdbbee405 100644 --- a/web/pgadmin/utils/driver/psycopg2/__init__.py +++ b/web/pgadmin/utils/driver/psycopg2/__init__.py @@ -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 diff --git a/web/pgadmin/utils/sqlautocomplete/function_metadata.py b/web/pgadmin/utils/sqlautocomplete/function_metadata.py index b8db0ae2d..113c1397d 100644 --- a/web/pgadmin/utils/sqlautocomplete/function_metadata.py +++ b/web/pgadmin/utils/sqlautocomplete/function_metadata.py @@ -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() diff --git a/web/regression/runtests.py b/web/regression/runtests.py index 289c2f9ae..62ed60045 100644 --- a/web/regression/runtests.py +++ b/web/regression/runtests.py @@ -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)