Skip to content

Commit 12f103a

Browse files
[Cherry-Pick 33556]del python2 code (#33987)
* del python2 code * cherry-pick 33556
1 parent 0d6c753 commit 12f103a

File tree

6 files changed

+8
-17
lines changed

6 files changed

+8
-17
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ option(WITH_STRIP "Strip so files of Whl packages" OFF)
209209

210210
# PY_VERSION
211211
if(NOT PY_VERSION)
212-
set(PY_VERSION 2.7)
212+
set(PY_VERSION 3.6)
213213
endif()
214214
set(PYBIND11_PYTHON_VERSION ${PY_VERSION})
215215

python/requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
requests>=2.20.0
2-
numpy>=1.13, <=1.16.4 ; python_version<"3.5"
32
numpy>=1.13 ; python_version>="3.5" and platform_system != "Windows"
43
numpy>=1.13, <=1.19.3 ; python_version>="3.5" and platform_system == "Windows"
54
protobuf>=3.1.0
65
gast>=0.3.3, <=0.4.0 ; platform_system != "Windows"
76
gast==0.3.3 ; platform_system == "Windows"
87
Pillow
98
six
10-
decorator==4.4.2
9+
decorator
1110
astor

python/unittest_py/requirements.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ pycrypto ; platform_system != "Windows"
44
mock
55
gym
66
opencv-python<=4.2.0.32
7-
visualdl ; python_version>="3.5"
7+
visualdl
88
paddle2onnx>=0.4
9-
scipy>=0.19.0, <=1.2.1 ; python_version<"3.5"
10-
scipy<=1.3.1 ; python_version=="3.5"
11-
scipy ; python_version>"3.5"
9+
scipy
1210
prettytable
1311
distro

tools/count_api_without_core_ops.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@
3737
def md5(doc):
3838
try:
3939
hashinst = hashlib.md5()
40-
if platform.python_version()[0] == "2":
41-
hashinst.update(str(doc))
42-
else:
43-
hashinst.update(str(doc).encode('utf-8'))
40+
hashinst.update(str(doc).encode('utf-8'))
4441
md5sum = hashinst.hexdigest()
4542
except UnicodeDecodeError as e:
4643
md5sum = None

tools/print_signatures.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@
3636
def md5(doc):
3737
try:
3838
hashinst = hashlib.md5()
39-
if platform.python_version()[0] == "2":
40-
hashinst.update(str(doc))
41-
else:
42-
hashinst.update(str(doc).encode('utf-8'))
39+
hashinst.update(str(doc).encode('utf-8'))
4340
md5sum = hashinst.hexdigest()
4441
except UnicodeDecodeError as e:
4542
md5sum = None
@@ -142,7 +139,7 @@ def visit_member(parent_name, member, member_name=None):
142139

143140

144141
def is_primitive(instance):
145-
int_types = (int, long) if platform.python_version()[0] == "2" else (int, )
142+
int_types = (int, )
146143
pritimitive_types = int_types + (float, str)
147144
if isinstance(instance, pritimitive_types):
148145
return True

tools/sampcd_processor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ def execute_samplecode(tfname):
389389
"""
390390
result = True
391391
msg = None
392-
if platform.python_version()[0] in ["2", "3"]:
392+
if platform.python_version()[0] in ["3"]:
393393
cmd = [sys.executable, tfname]
394394
else:
395395
logger.error("Error: fail to parse python version!")

0 commit comments

Comments
 (0)