Remove old Python 2 compatibility code. Fixes #5700

This commit is contained in:
Cyril Jouve authored and Dave Page committed 2020-07-27 11:03:13 +01:00
1 parent 7a22cff28c
commit f93cfe8c4c
197 files changed
+47 -354

No files matched your search

@@ -29,7 +29,6 @@ It also depends on the following environment variable for proper execution.
PROCID - Process-id
OUTDIR - Output directory
"""
from __future__ import print_function
# To make print function compatible with python2 & python3
import sys
+1 -2
View File
@@ -294,8 +294,7 @@ class BatchProcess(object):
# anyway be the redundant value in paths.
if not current_app.PGADMIN_RUNTIME:
paths.insert(0, os.path.join(u_encode(sys.prefix), u'bin'))
python_binary_name = 'python{0}'.format(sys.version_info[0]) \
if sys.version_info[0] >= 3 else 'python'
python_binary_name = 'python{0}'.format(sys.version_info[0])
interpreter = which(u_encode(python_binary_name), paths)
p = None
+2 -13
View File
@@ -15,6 +15,7 @@ import random
import string
import sys
import time
from urllib.parse import unquote
from sys import platform as _platform
import config
import codecs
@@ -39,18 +40,6 @@ if _platform == "win32":
SEM_FAIL = SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS
file_root = ""
# uppercase supported in py2, ascii_uppercase supported in py3
try:
letters = string.uppercase
except Exception:
letters = string.ascii_uppercase
# import unquote from urlib for python2.x and python3.x
try:
from urllib import unquote
except Exception as e:
from urllib.parse import unquote
MODULE_NAME = 'file_manager'
global transid
@@ -517,7 +506,7 @@ class Filemanager(object):
try:
drives = []
bitmask = ctypes.windll.kernel32.GetLogicalDrives()
for letter in letters:
for letter in string.ascii_uppercase:
if bitmask & 1:
drives.append(letter)
bitmask >>= 1