Added changes to the code necesarry for removal of false positives reported by the lint script (see my previous patch).

--
Jan Cholasta
>From c766cbccb463ced328a0f34f4f31f9f9cc70a0f7 Mon Sep 17 00:00:00 2001
From: Jan Cholasta <jchol...@redhat.com>
Date: Thu, 7 Apr 2011 16:53:52 +0200
Subject: [PATCH] Fix lint false positives.

---
 contrib/RHEL4/ipachangeconf.py        |    2 +-
 install/tools/ipa-server-install      |    2 +-
 ipa-client/ipaclient/ipachangeconf.py |    2 +-
 ipalib/backend.py                     |    2 +-
 ipalib/cli.py                         |    4 ++--
 ipalib/compat.py                      |    2 +-
 ipalib/frontend.py                    |    8 ++++----
 ipalib/parameters.py                  |    4 +++-
 ipalib/plugins/baseldap.py            |    5 +++++
 ipalib/plugins/cert.py                |    2 +-
 ipapython/ipautil.py                  |    1 +
 ipaserver/install/replication.py      |    4 ++--
 12 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/contrib/RHEL4/ipachangeconf.py b/contrib/RHEL4/ipachangeconf.py
index 4007229..1a36151 100644
--- a/contrib/RHEL4/ipachangeconf.py
+++ b/contrib/RHEL4/ipachangeconf.py
@@ -179,7 +179,7 @@ class IPAChangeConf:
 
         value = self.matchComment(line)
         if value:
-            return {'name':'comment', 'type':'comment', 'value':value.rstrip()}
+            return {'name':'comment', 'type':'comment', 'value':value.rstrip()} #pylint: disable=E1103
 
         parts = line.split(self.dassign, 1)
         if len(parts) < 2:
diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install
index f3a01e8..6bab7f4 100755
--- a/install/tools/ipa-server-install
+++ b/install/tools/ipa-server-install
@@ -329,7 +329,7 @@ def read_realm_name(domain_name, unattended):
     if unattended:
         return domain_name.upper()
     realm_name = user_input("Please provide a realm name", domain_name.upper())
-    upper_dom = realm_name.upper()
+    upper_dom = realm_name.upper()  #pylint: disable=E1103
     if upper_dom != realm_name:
         print "An upper-case realm name is required."
         if not user_input("Do you want to use " + upper_dom + " as realm name?", True):
diff --git a/ipa-client/ipaclient/ipachangeconf.py b/ipa-client/ipaclient/ipachangeconf.py
index 957a290..f628806 100644
--- a/ipa-client/ipaclient/ipachangeconf.py
+++ b/ipa-client/ipaclient/ipachangeconf.py
@@ -180,7 +180,7 @@ class IPAChangeConf:
 
         value = self.matchComment(line)
         if value:
-            return {'name':'comment', 'type':'comment', 'value':value.rstrip()}
+            return {'name':'comment', 'type':'comment', 'value':value.rstrip()} #pylint: disable=E1103
 
         parts = line.split(self.dassign, 1)
         if len(parts) < 2:
diff --git a/ipalib/backend.py b/ipalib/backend.py
index 2262e92..79f1908 100644
--- a/ipalib/backend.py
+++ b/ipalib/backend.py
@@ -139,4 +139,4 @@ class Executioner(Backend):
         if error is None:
             return result
         assert isinstance(error, PublicError)
-        raise error
+        raise error #pylint: disable=E0702
diff --git a/ipalib/cli.py b/ipalib/cli.py
index 60afb7d..003df49 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -587,9 +587,9 @@ class textui(backend.Backend):
             except EOFError:
                 return -2
 
-            if resp.lower() == "q":
+            if resp.lower() == "q": #pylint: disable=E1103
                 return -2
-            if resp.lower() == "a":
+            if resp.lower() == "a": #pylint: disable=E1103
                 return -1
             try:
                 selection = int(resp) - 1
diff --git a/ipalib/compat.py b/ipalib/compat.py
index 614644f..36d0384 100644
--- a/ipalib/compat.py
+++ b/ipalib/compat.py
@@ -75,7 +75,7 @@ else:
     import simplejson as json
     from cgi import parse_qs
 try:
-    from hashlib import sha1, md5
+    from hashlib import sha1, md5   #pylint: disable=E0611
 except ImportError:
     from sha import new as sha1
     from md5 import new as md5
diff --git a/ipalib/frontend.py b/ipalib/frontend.py
index 9c7b80b..ae86e73 100644
--- a/ipalib/frontend.py
+++ b/ipalib/frontend.py
@@ -383,8 +383,8 @@ class Command(HasParam):
 
     takes_options = tuple()
     takes_args = tuple()
-    args = None
-    options = None
+    args = lambda: None
+    options = lambda: None
     params = None
     output_for_cli = None
     obj = None
@@ -392,7 +392,7 @@ class Command(HasParam):
     use_output_validation = True
     output = None
     has_output = ('result',)
-    output_params = None
+    output_params = lambda: None
     has_output_params = tuple()
 
     msg_summary = None
@@ -1021,7 +1021,7 @@ class Object(HasParam):
     backend = None
     methods = None
     properties = None
-    params = None
+    params = lambda: None
     primary_key = None
     params_minus_pk = None
 
diff --git a/ipalib/parameters.py b/ipalib/parameters.py
index 47d5322..ef62aab 100644
--- a/ipalib/parameters.py
+++ b/ipalib/parameters.py
@@ -479,7 +479,7 @@ class Param(ReadOnly):
         else:
             value = self.convert(self.normalize(value))
         if hasattr(self, 'env'):
-            self.validate(value, self.env.context)
+            self.validate(value, self.env.context)  #pylint: disable=E1101
         else:
             self.validate(value)
         return value
@@ -1007,6 +1007,7 @@ class Int(Number):
     )
 
     def __init__(self, name, *rules, **kw):
+        #pylint: disable=E1003
         super(Number, self).__init__(name, *rules, **kw)
 
         if (self.minvalue > self.maxvalue) and (self.minvalue is not None and self.maxvalue is not None):
@@ -1078,6 +1079,7 @@ class Float(Number):
     )
 
     def __init__(self, name, *rules, **kw):
+        #pylint: disable=E1003
         super(Number, self).__init__(name, *rules, **kw)
 
         if (self.minvalue > self.maxvalue) and (self.minvalue is not None and self.maxvalue is not None):
diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index 8053b27..d516ed6 100644
--- a/ipalib/plugins/baseldap.py
+++ b/ipalib/plugins/baseldap.py
@@ -439,6 +439,7 @@ class CallbackInterface(Method):
     Callback registration interface
     """
     def __init__(self):
+        #pylint: disable=E1003
         if not hasattr(self.__class__, 'PRE_CALLBACKS'):
             self.__class__.PRE_CALLBACKS = []
         if not hasattr(self.__class__, 'POST_CALLBACKS'):
@@ -512,6 +513,7 @@ class LDAPCreate(CallbackInterface, crud.Create):
     takes_options = _attr_options
 
     def get_args(self):
+        #pylint: disable=E1003
         for key in self.obj.get_ancestor_primary_keys():
             yield key
         if self.obj.primary_key:
@@ -645,6 +647,7 @@ class LDAPQuery(CallbackInterface, crud.PKQuery):
     Base class for commands that need to retrieve an existing entry.
     """
     def get_args(self):
+        #pylint: disable=E1003
         for key in self.obj.get_ancestor_primary_keys():
             yield key
         if self.obj.primary_key:
@@ -665,6 +668,7 @@ class LDAPMultiQuery(LDAPQuery):
     )
 
     def get_args(self):
+        #pylint: disable=E1003
         for key in self.obj.get_ancestor_primary_keys():
             yield key
         if self.obj.primary_key:
@@ -1268,6 +1272,7 @@ class LDAPSearch(CallbackInterface, crud.Search):
     )
 
     def get_args(self):
+        #pylint: disable=E1003
         for key in self.obj.get_ancestor_primary_keys():
             yield key
         yield Str('criteria?')
diff --git a/ipalib/plugins/cert.py b/ipalib/plugins/cert.py
index 0ddae7b..b219835 100644
--- a/ipalib/plugins/cert.py
+++ b/ipalib/plugins/cert.py
@@ -494,7 +494,7 @@ class cert_show(VirtualCommand):
         if hostname:
             # If we have a hostname we want to verify that the subject
             # of the certificate matches it, otherwise raise an error
-            if hostname != cert.subject.common_name:
+            if hostname != cert.subject.common_name:    #pylint: disable=E1101
                 raise acierr
 
         return dict(result=result)
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py
index 85db920..81719cc 100644
--- a/ipapython/ipautil.py
+++ b/ipapython/ipautil.py
@@ -131,6 +131,7 @@ def run(args, stdin=None, raiseonerr=True,
     p = subprocess.Popen(args, stdin=p_in, stdout=p_out, stderr=p_err,
                          close_fds=True, env=env)
     stdout,stderr = p.communicate(stdin)
+    stdout,stderr = str(stdout), str(stderr)    # Make pylint happy
 
     # The command and its output may include passwords that we don't want
     # to log. Run through the nolog items.
diff --git a/ipaserver/install/replication.py b/ipaserver/install/replication.py
index 091a4de..1dc112b 100644
--- a/ipaserver/install/replication.py
+++ b/ipaserver/install/replication.py
@@ -879,9 +879,9 @@ class ReplicationManager:
             pass
         except Exception, e:
             if force and err:
-                raise err
+                raise err   #pylint: disable=E0702
             else:
                 raise e
 
         if err:
-            raise err
+            raise err   #pylint: disable=E0702
-- 
1.7.4.2

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to