Skip to content

Commit a179020

Browse files
committed
Fix PEP-8 issues.
1 parent 8d35c53 commit a179020

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

web/pgadmin/tools/sqleditor/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,9 @@ def initialize_viewdata(trans_id, cmd_type, obj_type, sgid, sid, did, obj_id):
210210

211211
filter_sql = _data['filter_sql'] if 'filter_sql' in _data else None
212212
server_cursor = _data['server_cursor'] if\
213-
'server_cursor' in _data and (_data['server_cursor'] == 'true' or
214-
_data['server_cursor'] is True) else False
213+
'server_cursor' in _data and (
214+
_data['server_cursor'] == 'true' or _data['server_cursor'] is True
215+
) else False
215216

216217
# Create asynchronous connection using random connection id.
217218
conn_id = str(secrets.choice(range(1, 9999999)))
@@ -1893,8 +1894,8 @@ def set_pref_options(trans_id, operation):
18931894
info='DATAGRID_TRANSACTION_REQUIRED',
18941895
status=404)
18951896

1896-
if status and conn is not None and \
1897-
trans_obj is not None and session_obj is not None:
1897+
if (status and conn is not None and
1898+
trans_obj is not None and session_obj is not None):
18981899

18991900
res = None
19001901

web/pgadmin/tools/sqleditor/command.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,8 @@ def __init__(self, **kwargs):
365365
self.limit = 100
366366

367367
self.thread_native_id = None
368-
self.server_cursor = kwargs['server_cursor'] if 'server_cursor' in kwargs else None
368+
self.server_cursor = kwargs['server_cursor'] if\
369+
'server_cursor' in kwargs else None
369370

370371
def get_primary_keys(self, *args, **kwargs):
371372
return None, None
@@ -429,6 +430,7 @@ def set_thread_native_id(self, thread_native_id):
429430
def set_server_cursor(self, server_cursor):
430431
self.server_cursor = server_cursor
431432

433+
432434
class TableCommand(GridCommand):
433435
"""
434436
class TableCommand(GridCommand)

web/pgadmin/tools/sqleditor/tests/test_server_cursor.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ def runTest(self):
9696

9797
self.assertEqual(response.status_code, 200)
9898
csv_data = response.data.decode()
99-
print(csv_data)
10099

101100
self.set_server_cursor(False)
102101

@@ -105,7 +104,6 @@ def runTest(self):
105104
response = self.tester.delete(url)
106105
self.assertEqual(response.status_code, 200)
107106

108-
109107
database_utils.disconnect_database(self, self._sid, self._did)
110108

111109
def tearDown(self):

web/pgadmin/tools/sqleditor/utils/start_running_query.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ def __execute_query(self, conn, session_obj, sql, trans_id, trans_obj):
149149

150150
trans_obj.set_thread_native_id(None)
151151

152-
153152
@copy_current_request_context
154153
def asyn_exec_query(conn, sql, trans_obj, is_rollback_req,
155154
app):
@@ -162,8 +161,9 @@ def asyn_exec_query(conn, sql, trans_obj, is_rollback_req,
162161
else:
163162
_, _ = conn.execute_async(
164163
sql, server_cursor=trans_obj.server_cursor)
165-
# # If the transaction aborted for some reason and
166-
# # Auto RollBack is True then issue a rollback to cleanup.
164+
# If the transaction aborted for some reason and
165+
# Auto RollBack is True then issue a rollback
166+
# to cleanup.
167167
if is_rollback_req:
168168
conn.execute_void("ROLLBACK;")
169169
except Exception as e:
@@ -184,11 +184,11 @@ def asyn_exec_query(conn, sql, trans_obj, is_rollback_req,
184184
@staticmethod
185185
def is_begin_required_for_sql_query(trans_obj, conn, sql):
186186

187-
return ((trans_obj.server_cursor
188-
) or (not trans_obj.auto_commit and
189-
conn.transaction_status() == TX_STATUS_IDLE and
190-
is_begin_required(sql)
191-
))
187+
return ((trans_obj.server_cursor) or (
188+
not trans_obj.auto_commit and
189+
conn.transaction_status() == TX_STATUS_IDLE and
190+
is_begin_required(sql)
191+
))
192192

193193
@staticmethod
194194
def is_rollback_statement_required(trans_obj, conn):

web/pgadmin/utils/driver/psycopg3/connection.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,6 @@ def __reset_auto_commit(self, autocommit):
692692
async def __reset_auto_commit_for(self, autocommit):
693693
await self.conn.set_autocommit(autocommit)
694694

695-
696695
def __cursor(self, server_cursor=False, scrollable=False):
697696

698697
if not get_crypt_key()[0] and config.SERVER_MODE:
@@ -716,7 +715,7 @@ def __cursor(self, server_cursor=False, scrollable=False):
716715

717716
if self.connected() and cur and not cur.closed:
718717
if not server_cursor or (
719-
server_cursor and type(cur) == AsyncDictServerCursor):
718+
server_cursor and type(cur) is AsyncDictServerCursor):
720719
return True, cur
721720

722721
if not self.connected():

0 commit comments

Comments
 (0)