summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2016-01-05 13:57:51 +0100
committerJan Cholasta <jcholast@redhat.com>2016-01-20 11:59:21 +0100
commit06a678c1592928403d7619e11dc0fdb6828d51f9 (patch)
treeb3bb0deef2afa8a7a9e6c182ab6ad0ee37f08083
parentb2436560dfb4f2d45d3bf4bdfe1b2a05ff98ee38 (diff)
downloadfreeipa-06a678c1592928403d7619e11dc0fdb6828d51f9.tar.gz
freeipa-06a678c1592928403d7619e11dc0fdb6828d51f9.tar.xz
freeipa-06a678c1592928403d7619e11dc0fdb6828d51f9.zip
Avoid builtins that were removed in Python 3
- `file` was removed in favor of `open`. Switch to the new spelling. - `buffer` was removed in favor of a buffer protocol (and memoryview), and `reload` was moved to importlib. Both are used in py2-only blocks, so just placate PyLint. https://fedorahosted.org/freeipa/ticket/5623 Reviewed-By: Jan Cholasta <jcholast@redhat.com> Reviewed-By: Martin Basti <mbasti@redhat.com>
-rwxr-xr-xipa-client/ipa-install/ipa-client-install2
-rw-r--r--ipalib/cli.py2
-rw-r--r--ipalib/x509.py2
3 files changed, 3 insertions, 3 deletions
diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install
index af8d27bd0..81443fd23 100755
--- a/ipa-client/ipa-install/ipa-client-install
+++ b/ipa-client/ipa-install/ipa-client-install
@@ -1573,7 +1573,7 @@ def do_nsupdate(update_txt):
root_logger.debug("Writing nsupdate commands to %s:", UPDATE_FILE)
root_logger.debug("%s", update_txt)
- update_fd = file(UPDATE_FILE, "w")
+ update_fd = open(UPDATE_FILE, "w")
update_fd.write(update_txt)
update_fd.flush()
update_fd.close()
diff --git a/ipalib/cli.py b/ipalib/cli.py
index f9839a78e..136e0aeb8 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -40,7 +40,7 @@ if six.PY3:
unicode = str
if six.PY2:
- reload(sys)
+ reload(sys) # pylint: disable=reload-builtin
sys.setdefaultencoding('utf-8') # pylint: disable=no-member
from ipalib import frontend
diff --git a/ipalib/x509.py b/ipalib/x509.py
index 886bf6af6..2d28876de 100644
--- a/ipalib/x509.py
+++ b/ipalib/x509.py
@@ -130,7 +130,7 @@ def load_certificate(data, datatype=PEM, dbdir=None):
initialize_nss_database(dbdir=dbdir)
if six.PY2:
- return nss.Certificate(buffer(data))
+ return nss.Certificate(buffer(data)) # pylint: disable=buffer-builtin
else:
# In python 3 , `bytes` has the buffer interface
return nss.Certificate(data)