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

[CodeStyle][py36] remove sys.version branch for py36 #48540

Merged
merged 2 commits into from
Dec 1, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def _gen_str(self, line):
Returns:
Return a string data that can be read directly by the MultiSlotDataFeed.
'''
if sys.version > '3' and isinstance(line, zip):
if isinstance(line, zip):
line = list(line)

if not isinstance(line, list) and not isinstance(line, tuple):
Expand Down Expand Up @@ -311,7 +311,7 @@ def _gen_str(self, line):
Returns:
Return a string data that can be read directly by the MultiSlotDataFeed.
'''
if sys.version > '3' and isinstance(line, zip):
if isinstance(line, zip):
line = list(line)

if not isinstance(line, list) and not isinstance(line, tuple):
Expand Down
7 changes: 2 additions & 5 deletions python/paddle/distributed/metric/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

import logging
import sys

import yaml

Expand All @@ -36,10 +35,8 @@ def init_metric(
bucket_size=1000000,
):
yaml_fobj = open(metric_yaml_path)
if sys.version.startswith('2.7.13'):
content = yaml.load(yaml_fobj)
else:
content = yaml.load(yaml_fobj, Loader=yaml.FullLoader)

content = yaml.load(yaml_fobj, Loader=yaml.FullLoader)

print("yaml metric config: \n")
print(content)
Expand Down
16 changes: 4 additions & 12 deletions tools/dockerfile/build_scripts/ssl-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,14 @@

# cf. https://github.com/pypa/manylinux/issues/53

import sys
from urllib.request import urlopen

GOOD_SSL = "https://google.com"
BAD_SSL = "https://self-signed.badssl.com"

import sys

print("Testing SSL certificate checking for Python:", sys.version)

if sys.version_info[0] >= 3:
from urllib.request import urlopen

EXC = OSError
else:
from urllib import urlopen

EXC = IOError

print("Connecting to %s should work" % (GOOD_SSL,))
urlopen(GOOD_SSL)
print("...it did, yay.")
Expand All @@ -40,5 +32,5 @@
# If we get here then we failed:
print("...it DIDN'T!!!!!11!!1one!")
sys.exit(1)
except EXC:
except OSError:
print("...it did, yay.")