mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-08-14 06:54:55 -05:00
Python3 pylint fixes
Sprinkle 'pylint disable' comments over the code base to silence a bunch of pylint warnings on Python 3. All silenced warnings are harmless and not bugs. https://fedorahosted.org/freeipa/ticket/4985 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
committed by
Martin Basti
parent
044d887e81
commit
38e8719f72
@@ -39,7 +39,7 @@ import SSSDConfig
|
||||
from six.moves.urllib.parse import urlsplit
|
||||
# pylint: enable=import-error
|
||||
|
||||
from optparse import OptionParser
|
||||
from optparse import OptionParser # pylint: disable=deprecated-module
|
||||
from ipalib import api, errors
|
||||
from ipapython import sysrestore
|
||||
from ipapython import ipautil
|
||||
|
||||
@@ -29,7 +29,7 @@ import ldap
|
||||
|
||||
import six
|
||||
|
||||
from optparse import SUPPRESS_HELP
|
||||
from optparse import SUPPRESS_HELP # pylint: disable=deprecated-module
|
||||
|
||||
from ipaserver.install import adtrustinstance
|
||||
from ipaserver.install.installutils import (
|
||||
|
||||
@@ -24,7 +24,7 @@ from __future__ import print_function
|
||||
import sys
|
||||
from ipaplatform.paths import paths
|
||||
try:
|
||||
from optparse import OptionParser
|
||||
from optparse import OptionParser # pylint: disable=deprecated-module
|
||||
from ipapython import ipautil, config
|
||||
from ipaserver.install import installutils
|
||||
from ipaserver.install.ldapupdate import LDAPUpdate
|
||||
|
||||
@@ -50,7 +50,7 @@ commands = {
|
||||
|
||||
|
||||
def parse_options():
|
||||
from optparse import OptionParser
|
||||
from optparse import OptionParser # pylint: disable=deprecated-module
|
||||
|
||||
parser = OptionParser(version=version.VERSION)
|
||||
parser.add_option("-H", "--host", dest="host", help="starting host")
|
||||
|
||||
@@ -24,7 +24,7 @@ from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
|
||||
from optparse import SUPPRESS_HELP
|
||||
from optparse import SUPPRESS_HELP # pylint: disable=deprecated-module
|
||||
|
||||
from ipaserver.install import bindinstance
|
||||
from ipaserver.install import installutils
|
||||
|
||||
@@ -22,7 +22,7 @@ from __future__ import print_function
|
||||
|
||||
import re
|
||||
import sys
|
||||
from optparse import OptionParser
|
||||
from optparse import OptionParser # pylint: disable=deprecated-module
|
||||
|
||||
from ipapython import config
|
||||
from ipaserver.install import installutils
|
||||
|
||||
@@ -25,7 +25,7 @@ import sys
|
||||
import os
|
||||
from ipaplatform.paths import paths
|
||||
try:
|
||||
from optparse import OptionParser
|
||||
from optparse import OptionParser # pylint: disable=deprecated-module
|
||||
from ipapython import ipautil, config
|
||||
from ipaserver.install import installutils
|
||||
from ipaserver.install.ldapupdate import LDAPUpdate
|
||||
|
||||
@@ -27,7 +27,9 @@ from ipapython import ipautil, certdb
|
||||
from ipalib import api, errors, x509
|
||||
from ipaserver.install import installutils
|
||||
import ipaclient.ipachangeconf
|
||||
# pylint: disable=deprecated-module
|
||||
from optparse import OptionGroup, OptionValueError
|
||||
# pylint: enable=deprecated-module
|
||||
from ipapython.ipa_log_manager import root_logger, standard_logging_setup
|
||||
import sys
|
||||
import os
|
||||
|
||||
@@ -99,7 +99,9 @@ class CertUpdate(admintool.AdminTool):
|
||||
if server_fstore.has_files():
|
||||
self.update_server(certs)
|
||||
try:
|
||||
# pylint: disable=import-error
|
||||
from ipaserver.install import cainstance
|
||||
# pylint: enable=import-error
|
||||
cainstance.add_lightweight_ca_tracking_requests(
|
||||
self.log, lwcas)
|
||||
except Exception:
|
||||
|
||||
+3
-3
@@ -27,7 +27,7 @@ import textwrap
|
||||
import sys
|
||||
import getpass
|
||||
import code
|
||||
import optparse
|
||||
import optparse # pylint: disable=deprecated-module
|
||||
import fcntl
|
||||
import termios
|
||||
import struct
|
||||
@@ -41,8 +41,8 @@ if six.PY3:
|
||||
unicode = str
|
||||
|
||||
if six.PY2:
|
||||
reload(sys) # pylint: disable=reload-builtin
|
||||
sys.setdefaultencoding('utf-8') # pylint: disable=no-member
|
||||
reload(sys) # pylint: disable=reload-builtin, undefined-variable
|
||||
sys.setdefaultencoding('utf-8') # pylint: disable=no-member
|
||||
|
||||
from ipalib import frontend
|
||||
from ipalib import backend
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ import sys
|
||||
import threading
|
||||
import os
|
||||
from os import path
|
||||
import optparse
|
||||
import optparse # pylint: disable=deprecated-module
|
||||
import textwrap
|
||||
import collections
|
||||
import importlib
|
||||
|
||||
@@ -623,7 +623,9 @@ class KerbTransport(SSLTransport):
|
||||
|
||||
while True:
|
||||
if six.PY2:
|
||||
# pylint: disable=no-value-for-parameter
|
||||
self.send_request(h, handler, request_body)
|
||||
# pylint: enable=no-value-for-parameter
|
||||
self.send_host(h, host)
|
||||
self.send_user_agent(h)
|
||||
self.send_content(h, request_body)
|
||||
|
||||
+3
-1
@@ -254,7 +254,7 @@ class Gettext(LazyText):
|
||||
else:
|
||||
t = create_translation(self.key)
|
||||
if six.PY2:
|
||||
return t.ugettext(self.msg)
|
||||
return t.ugettext(self.msg) # pylint: disable=no-member
|
||||
else:
|
||||
return t.gettext(self.msg)
|
||||
|
||||
@@ -409,7 +409,9 @@ class NGettext(LazyText):
|
||||
else:
|
||||
t = create_translation(self.key)
|
||||
if six.PY2:
|
||||
# pylint: disable=no-member
|
||||
return t.ungettext(self.singular, self.plural, count)
|
||||
# pylint: enable=no-member
|
||||
else:
|
||||
return t.ngettext(self.singular, self.plural, count)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ Handles common operations like option parsing and logging
|
||||
import sys
|
||||
import os
|
||||
import traceback
|
||||
from optparse import OptionGroup
|
||||
from optparse import OptionGroup # pylint: disable=deprecated-module
|
||||
|
||||
from ipapython import version
|
||||
from ipapython import config
|
||||
|
||||
+4
-1
@@ -17,7 +17,10 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
from optparse import Option, Values, OptionParser, IndentedHelpFormatter, OptionValueError
|
||||
# pylint: disable=deprecated-module
|
||||
from optparse import (
|
||||
Option, Values, OptionParser, IndentedHelpFormatter, OptionValueError)
|
||||
# pylint: enable=deprecated-module
|
||||
from copy import copy
|
||||
|
||||
from dns import resolver, rdatatype
|
||||
|
||||
@@ -9,7 +9,7 @@ Command line support.
|
||||
import collections
|
||||
import enum
|
||||
import functools
|
||||
import optparse
|
||||
import optparse # pylint: disable=deprecated-module
|
||||
import signal
|
||||
|
||||
import six
|
||||
|
||||
@@ -690,7 +690,9 @@ class CIDict(dict):
|
||||
|
||||
if six.PY2:
|
||||
def has_key(self, key):
|
||||
# pylint: disable=no-member
|
||||
return super(CIDict, self).has_key(key.lower())
|
||||
# pylint: enable=no-member
|
||||
|
||||
def get(self, key, failobj=None):
|
||||
try:
|
||||
|
||||
@@ -30,6 +30,7 @@ import fcntl
|
||||
import time
|
||||
import datetime
|
||||
|
||||
import six
|
||||
from six.moves import configparser
|
||||
|
||||
from ipapython.ipa_log_manager import root_logger
|
||||
@@ -720,7 +721,10 @@ class _CrossProcessLock(object):
|
||||
|
||||
def _read(self, fileobj):
|
||||
p = configparser.RawConfigParser()
|
||||
p.readfp(fileobj)
|
||||
if six.PY2:
|
||||
p.readfp(fileobj) # pylint: disable=deprecated-method
|
||||
else:
|
||||
p.read_file(fileobj) # pylint: disable=no-member
|
||||
|
||||
try:
|
||||
self._locked = p.getboolean('lock', 'locked')
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
from optparse import OptionGroup
|
||||
from optparse import OptionGroup # pylint: disable=deprecated-module
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
import gssapi
|
||||
|
||||
|
||||
@@ -25,7 +25,9 @@ import os
|
||||
import shutil
|
||||
import tempfile
|
||||
import time
|
||||
# pylint: disable=deprecated-module
|
||||
from optparse import OptionGroup, SUPPRESS_HELP
|
||||
# pylint: enable=deprecated-module
|
||||
|
||||
import dns.resolver
|
||||
# pylint: disable=import-error
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
import os
|
||||
import os.path
|
||||
import pwd
|
||||
import optparse
|
||||
import optparse # pylint: disable=deprecated-module
|
||||
|
||||
from ipaplatform.constants import constants
|
||||
from ipaplatform.paths import paths
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ from __future__ import print_function
|
||||
|
||||
# WARNING: Do not import ipa modules, this is also used as a
|
||||
# stand-alone script (invoked from po Makefile).
|
||||
import optparse
|
||||
import optparse # pylint: disable=deprecated-module
|
||||
import sys
|
||||
import gettext
|
||||
import re
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ Unfortunately, SSL support is broken under Python 2.6 with paste 1.7.2, see:
|
||||
"""
|
||||
|
||||
from os import path, getcwd
|
||||
import optparse
|
||||
import optparse # pylint: disable=deprecated-module
|
||||
from paste import httpserver
|
||||
import paste.gzipper
|
||||
from paste.urlmap import URLMap
|
||||
|
||||
Reference in New Issue
Block a user