mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-23 23:50:03 -06:00
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>
This commit is contained in:
parent
b2436560df
commit
06a678c159
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user