1) Ensure that eventlet's subprocess is used for Python versions up to 3.11 and await the issue resolution for Python versions 3.12.

2) Fixed unescape sequence for Python 3.12
This commit is contained in:
Akshay Joshi 2023-11-02 16:03:50 +05:30
parent 5d70803d6d
commit 9eb7c1cbea
9 changed files with 18 additions and 12 deletions

View File

@ -1,5 +1,5 @@
[pycodestyle] [pycodestyle]
ignore = E402,W504,W605,E231,W605 ignore = E402,W504,E231
max-line-length = 79 max-line-length = 79
statistics = True statistics = True
show-source = False show-source = False

View File

@ -27,12 +27,14 @@ New features
Housekeeping Housekeeping
************ ************
| `Issue #6441 <https://github.com/pgadmin-org/pgadmin4/issues/6441>`_ - Update app bundle built to use notarytool instead of altool.
| `Issue #6479 <https://github.com/pgadmin-org/pgadmin4/issues/6479>`_ - Replace the current layout library wcDocker with ReactJS based rc-dock. | `Issue #6479 <https://github.com/pgadmin-org/pgadmin4/issues/6479>`_ - Replace the current layout library wcDocker with ReactJS based rc-dock.
Bug fixes Bug fixes
********* *********
| `Issue #2986 <https://github.com/pgadmin-org/pgadmin4/issues/2986>`_ - Fix an issue where the scroll position of panels was not remembered on Firefox. | `Issue #2986 <https://github.com/pgadmin-org/pgadmin4/issues/2986>`_ - Fix an issue where the scroll position of panels was not remembered on Firefox.
| `Issue #5807 <https://github.com/pgadmin-org/pgadmin4/issues/5807>`_ - Fixed an issue where psql was not taking the role used to connect in server properties.
| `Issue #6459 <https://github.com/pgadmin-org/pgadmin4/issues/6459>`_ - Fix the sorting of size on the statistics panel. | `Issue #6459 <https://github.com/pgadmin-org/pgadmin4/issues/6459>`_ - Fix the sorting of size on the statistics panel.
| `Issue #6487 <https://github.com/pgadmin-org/pgadmin4/issues/6487>`_ - Fixed restoration of query tool database connection after dropping and re-creating the database with the same name. | `Issue #6487 <https://github.com/pgadmin-org/pgadmin4/issues/6487>`_ - Fixed restoration of query tool database connection after dropping and re-creating the database with the same name.
| `Issue #6602 <https://github.com/pgadmin-org/pgadmin4/issues/6602>`_ - Fix an issue where the default server-group is being deleted if the load-server json file contains no servers. | `Issue #6602 <https://github.com/pgadmin-org/pgadmin4/issues/6602>`_ - Fix an issue where the default server-group is being deleted if the load-server json file contains no servers.

View File

@ -21,7 +21,7 @@ PG_CODES_URLS = [
"https://raw.githubusercontent.com/postgres/postgres/master/src/pl/" "https://raw.githubusercontent.com/postgres/postgres/master/src/pl/"
"plpgsql/src/pl_scanner.c", "plpgsql/src/pl_scanner.c",
] ]
PG_CODES_REGEX = "PG_KEYWORD\(\"([a-z]*)\"[A-Z_, ]*\)" PG_CODES_REGEX = r"PG_KEYWORD\(\"([a-z]*)\"[A-Z_, ]*\)"
PG_SQL_DOCS_URL = \ PG_SQL_DOCS_URL = \
"https://www.postgresql.org/docs/current/sql-keywords-appendix.html" "https://www.postgresql.org/docs/current/sql-keywords-appendix.html"

View File

@ -100,7 +100,7 @@ class DomainReverseEngineeredSQLTestCase(BaseTestGenerator):
orig_sql = json.loads(get_response.data.decode('utf-8')) orig_sql = json.loads(get_response.data.decode('utf-8'))
# Replace multiple spaces with one space and check the expected sql # Replace multiple spaces with one space and check the expected sql
sql = re.sub('\s+', ' ', orig_sql).strip() sql = re.sub(r'\s+', ' ', orig_sql).strip()
expected_sql = '-- DOMAIN: {0}.{1} -- DROP DOMAIN IF EXISTS ' \ expected_sql = '-- DOMAIN: {0}.{1} -- DROP DOMAIN IF EXISTS ' \
'{0}.{1}; CREATE DOMAIN {0}.{1} {2} ' \ '{0}.{1}; CREATE DOMAIN {0}.{1} {2} ' \
'ALTER DOMAIN {0}.{1} OWNER' \ 'ALTER DOMAIN {0}.{1} OWNER' \

View File

@ -60,7 +60,7 @@ class ProcedureExecSQLTestCase(BaseTestGenerator):
exec_sql = json.loads(exec_response.data.decode('utf-8')) exec_sql = json.loads(exec_response.data.decode('utf-8'))
# Replace multiple spaces with one space and check the expected sql # Replace multiple spaces with one space and check the expected sql
sql = re.sub('\s+', ' ', exec_sql).strip() sql = re.sub(r'\s+', ' ', exec_sql).strip()
# Verify the expected EXEC SQL # Verify the expected EXEC SQL
if self.server_type == "pg": if self.server_type == "pg":

View File

@ -582,7 +582,7 @@ class EdbFuncView(PGChildNodeView, DataTypeReader):
if sql is None: if sql is None:
return None return None
start = 0 start = 0
start_position = re.search("\s+[is|as]+\s+", sql, flags=re.I) start_position = re.search(r"\s+[is|as]+\s+", sql, flags=re.I)
if start_position: if start_position:
start = start_position.start() + 4 start = start_position.start() + 4

View File

@ -11,7 +11,11 @@ import os
import select import select
import struct import struct
import config import config
import subprocess import sys
if sys.version_info >= (3, 12):
import subprocess
else:
from eventlet.green import subprocess
import re import re
from sys import platform as _platform from sys import platform as _platform
from config import PG_DEFAULT_DRIVER from config import PG_DEFAULT_DRIVER
@ -391,8 +395,8 @@ def enter_key_press(data):
""" """
user_input = data['input'] user_input = data['input']
if user_input == '\q' or user_input == 'q\\q' or user_input in\ if user_input == r'\q' or user_input == 'q\\q' or user_input in\
['\quit', 'exit', 'exit;']: [r'\quit', 'exit', 'exit;']:
# If user enter \q to terminate the PSQL, emit the msg to # If user enter \q to terminate the PSQL, emit the msg to
# notify user connection is terminated. # notify user connection is terminated.
sio.emit('pty-output', sio.emit('pty-output',
@ -553,7 +557,7 @@ def disconnect_socket():
process.terminate() process.terminate()
del app.config['sessions'][request.sid] del app.config['sessions'][request.sid]
else: else:
os.write(app.config['sessions'][request.sid], '\q\n'.encode()) os.write(app.config['sessions'][request.sid], r'\q\n'.encode())
sio.sleep(1) sio.sleep(1)
os.close(app.config['sessions'][request.sid]) os.close(app.config['sessions'][request.sid])
os.close(cdata[request.sid]) os.close(cdata[request.sid])

View File

@ -32,7 +32,7 @@ class TestSQLASCIIEncoding(BaseTestGenerator):
table_name='test_sql_ascii', table_name='test_sql_ascii',
db_encoding='SQL_ASCII', db_encoding='SQL_ASCII',
lc_collate='C', lc_collate='C',
test_str='\\\\Four\\\Three\\Two\One' test_str=r'\\\\Four\\\Three\\Two\One'
)), )),
( (
'Test SQL_ASCII data with file path', 'Test SQL_ASCII data with file path',
@ -40,7 +40,7 @@ class TestSQLASCIIEncoding(BaseTestGenerator):
table_name='test_sql_ascii', table_name='test_sql_ascii',
db_encoding='SQL_ASCII', db_encoding='SQL_ASCII',
lc_collate='C', lc_collate='C',
test_str='\\test\Documents\2017\12\19\AD93E646-' test_str=r'\\test\Documents\2017\12\19\AD93E646-'
'E5FE-11E7-85AE-EB2E217F96F0.tif' 'E5FE-11E7-85AE-EB2E217F96F0.tif'
)), )),
( (

View File

@ -765,7 +765,7 @@ class ReverseEngineeredSQLTestCases(BaseTestGenerator):
password = '' password = ''
for line in resp_sql.split('\n'): for line in resp_sql.split('\n'):
if 'PASSWORD' in line: if 'PASSWORD' in line:
found = re.search("'([\w\W]*)'", line) found = re.search(r"'([\w\W]*)'", line)
if found: if found:
password = found.groups(0)[0] password = found.groups(0)[0]
break break