未验证 提交 da0022e4 编写于 作者: M Matsumoto Ruko 提交者: GitHub

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

上级 89db045a
......@@ -262,7 +262,7 @@ class MultiSlotStringDataGenerator(DataGenerator):
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):
......@@ -311,7 +311,7 @@ class MultiSlotDataGenerator(DataGenerator):
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):
......
......@@ -13,7 +13,6 @@
# limitations under the License.
import logging
import sys
import yaml
......@@ -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)
......
......@@ -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.")
......@@ -40,5 +32,5 @@ try:
# If we get here then we failed:
print("...it DIDN'T!!!!!11!!1one!")
sys.exit(1)
except EXC:
except OSError:
print("...it did, yay.")
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册