From: Kefu Chai Date: Tue, 1 Sep 2020 13:25:53 +0000 (+0800) Subject: python-common: s/unicode/str/ X-Git-Tag: v16.1.0~1183^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b9492d46d8460d6818e13d730f6a0bc3a0e4bdaa;p=ceph.git python-common: s/unicode/str/ we've dropped python2 support. so it's safe to replace unicde with str. Signed-off-by: Kefu Chai --- diff --git a/src/python-common/ceph/deployment/utils.py b/src/python-common/ceph/deployment/utils.py index 33c84cae1017..075aa8fe7259 100644 --- a/src/python-common/ceph/deployment/utils.py +++ b/src/python-common/ceph/deployment/utils.py @@ -1,8 +1,4 @@ import ipaddress -import sys - -if sys.version_info > (3, 0): - unicode = str def unwrap_ipv6(address): @@ -19,7 +15,7 @@ def wrap_ipv6(address): # it's already wrapped it'll not pass (like if it's a hostname) and trigger # the ValueError try: - if ipaddress.ip_address(unicode(address)).version == 6: + if ipaddress.ip_address(address).version == 6: return f"[{address}]" except ValueError: pass @@ -31,6 +27,6 @@ def is_ipv6(address): # type: (str) -> bool address = unwrap_ipv6(address) try: - return ipaddress.ip_address(unicode(address)).version == 6 + return ipaddress.ip_address(address).version == 6 except ValueError: return False