Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

del python2 code #33556

Merged
merged 1 commit into from
Jun 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ option(WITH_STRIP "Strip so files of Whl packages" OFF)

# PY_VERSION
if(NOT PY_VERSION)
set(PY_VERSION 2.7)
set(PY_VERSION 3.7)
endif()
set(PYBIND11_PYTHON_VERSION ${PY_VERSION})

Expand Down
3 changes: 1 addition & 2 deletions python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
requests>=2.20.0
numpy>=1.13, <=1.16.4 ; python_version<"3.5"
numpy>=1.13 ; python_version>="3.5" and platform_system != "Windows"
numpy>=1.13, <=1.19.3 ; python_version>="3.5" and platform_system == "Windows"
protobuf>=3.1.0
gast>=0.3.3 ; platform_system != "Windows"
gast==0.3.3 ; platform_system == "Windows"
Pillow
six
decorator==4.4.2
decorator
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good job。删了版本号肯定是好事

这个就是为了py2才指定的4.4.2版本么?还是有别的目的指定的版本号?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的,当时Py2上需要指定版本号,现在删除能跑过说明可以删除。之前PR:#32043

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work

astor
6 changes: 2 additions & 4 deletions python/unittest_py/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ pycrypto ; platform_system != "Windows"
mock
gym
opencv-python<=4.2.0.32
visualdl ; python_version>="3.5"
visualdl
paddle2onnx>=0.4
scipy>=0.19.0, <=1.2.1 ; python_version<"3.5"
scipy<=1.3.1 ; python_version=="3.5"
scipy ; python_version>"3.5"
scipy
prettytable
distro
5 changes: 1 addition & 4 deletions tools/count_api_without_core_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@
def md5(doc):
try:
hashinst = hashlib.md5()
if platform.python_version()[0] == "2":
hashinst.update(str(doc))
else:
hashinst.update(str(doc).encode('utf-8'))
hashinst.update(str(doc).encode('utf-8'))
md5sum = hashinst.hexdigest()
except UnicodeDecodeError as e:
md5sum = None
Expand Down
7 changes: 2 additions & 5 deletions tools/print_signatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@
def md5(doc):
try:
hashinst = hashlib.md5()
if platform.python_version()[0] == "2":
hashinst.update(str(doc))
else:
hashinst.update(str(doc).encode('utf-8'))
hashinst.update(str(doc).encode('utf-8'))
md5sum = hashinst.hexdigest()
except UnicodeDecodeError as e:
md5sum = None
Expand Down Expand Up @@ -156,7 +153,7 @@ def visit_member(parent_name, member, member_name=None):


def is_primitive(instance):
int_types = (int, long) if platform.python_version()[0] == "2" else (int, )
int_types = (int, )
pritimitive_types = int_types + (float, str)
if isinstance(instance, pritimitive_types):
return True
Expand Down
2 changes: 1 addition & 1 deletion tools/sampcd_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ def execute_samplecode(tfname):
"""
result = True
msg = None
if platform.python_version()[0] in ["2", "3"]:
if platform.python_version()[0] in ["3"]:
cmd = [sys.executable, tfname]
else:
logger.error("Error: fail to parse python version!")
Expand Down