URL: https://github.com/freeipa/freeipa/pull/594
Author: tiran
 Title: #594: Fix Python 3 pylint errors
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/594/head:pr594
git checkout pr594
From 31b7eed3e8eb03e8c34e0642bf8f80cd8f56a3b3 Mon Sep 17 00:00:00 2001
From: Christian Heimes <chei...@redhat.com>
Date: Wed, 15 Mar 2017 08:47:46 +0100
Subject: [PATCH] Fix Python 3 pylint errors

************* Module ipaserver.install.ipa_kra_install
ipaserver/install/ipa_kra_install.py:25: [W0402(deprecated-module), ] Uses of a deprecated module 'optparse')
************* Module ipapython.install.core
ipapython/install/core.py:163: [E1101(no-member), _knob] Module 'types' has no 'TypeType' member)
************* Module ipatests.test_ipapython.test_dn
ipatests/test_ipapython/test_dn.py:1205: [W1505(deprecated-method), TestDN.test_x500_text] Using deprecated method assertEquals())
************* Module ipa-ca-install
install/tools/ipa-ca-install:228: [E1101(no-member), install_master] Instance of 'ValueError' has no 'message' member)
install/tools/ipa-ca-install:232: [E1101(no-member), install_master] Instance of 'ValueError' has no 'message' member)

Signed-off-by: Christian Heimes <chei...@redhat.com>
---
 install/tools/ipa-ca-install         | 4 ++--
 ipapython/install/core.py            | 5 +++--
 ipaserver/install/ipa_kra_install.py | 2 +-
 ipatests/test_ipapython/test_dn.py   | 2 +-
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/install/tools/ipa-ca-install b/install/tools/ipa-ca-install
index c05abb9..60261aa 100755
--- a/install/tools/ipa-ca-install
+++ b/install/tools/ipa-ca-install
@@ -225,11 +225,11 @@ def install_master(safe_options, options):
     try:
         ca.subject_validator(ca.VALID_SUBJECT_BASE_ATTRS, options.subject_base)
     except ValueError as e:
-        sys.exit("Subject base: {}".format(e.message))
+        sys.exit("Subject base: {}".format(e))
     try:
         ca.subject_validator(ca.VALID_SUBJECT_ATTRS, options.ca_subject)
     except ValueError as e:
-        sys.exit("CA subject: {}".format(e.message))
+        sys.exit("CA subject: {}".format(e))
 
     ca.install_check(True, None, options)
     ca.install(True, None, options)
diff --git a/ipapython/install/core.py b/ipapython/install/core.py
index 1e4c36d..5420c6f 100644
--- a/ipapython/install/core.py
+++ b/ipapython/install/core.py
@@ -6,12 +6,12 @@
 The framework core.
 """
 
+
 import abc
 import collections
 import functools
 import itertools
 import sys
-import types
 
 import six
 
@@ -24,6 +24,7 @@
            'Configurable', 'group', 'Component', 'Composite']
 
 NoneType = type(None)
+builtin_type = type
 
 # Configurable states
 _VALIDATE_PENDING = 'VALIDATE_PENDING'
@@ -160,7 +161,7 @@ def _knob(type=_missing, default=_missing, bases=_missing, _order=_missing,
 
     if bases is _missing:
         bases = (KnobBase,)
-    elif isinstance(bases, types.TypeType):
+    elif isinstance(bases, builtin_type):
         bases = (bases,)
 
     if cli_names is None or isinstance(cli_names, str):
diff --git a/ipaserver/install/ipa_kra_install.py b/ipaserver/install/ipa_kra_install.py
index 2576654..8b1cb63 100644
--- a/ipaserver/install/ipa_kra_install.py
+++ b/ipaserver/install/ipa_kra_install.py
@@ -22,7 +22,7 @@
 
 import sys
 import tempfile
-from optparse import SUPPRESS_HELP
+from optparse import SUPPRESS_HELP  # pylint: disable=deprecated-module
 
 from textwrap import dedent
 from ipalib import api
diff --git a/ipatests/test_ipapython/test_dn.py b/ipatests/test_ipapython/test_dn.py
index 24b6093..0f004c5 100644
--- a/ipatests/test_ipapython/test_dn.py
+++ b/ipatests/test_ipapython/test_dn.py
@@ -1202,7 +1202,7 @@ def test_x500_text(self):
         longdn_rev = DN(longdn_x500)
         l = len(self.base_container_dn)
         for i in range(l):
-            self.assertEquals(longdn_rev[i], self.base_container_dn[l-1-i])
+            self.assertEqual(longdn_rev[i], self.base_container_dn[l-1-i])
 
 
 class TestEscapes(unittest.TestCase):
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to