diff options
author | Jan Cholasta <jcholast@redhat.com> | 2013-01-28 14:55:20 +0100 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2013-01-29 15:39:49 +0100 |
commit | 77bb4b517769f7707514b0f7e3da5762ff0f1cc4 (patch) | |
tree | 36009d639a72d746c653b79d9562cd738cf3ac43 /ipalib | |
parent | 41d11f443bebc0a1303980363a4f751bfdbf2c12 (diff) | |
download | freeipa-77bb4b517769f7707514b0f7e3da5762ff0f1cc4.tar.gz freeipa-77bb4b517769f7707514b0f7e3da5762ff0f1cc4.tar.xz freeipa-77bb4b517769f7707514b0f7e3da5762ff0f1cc4.zip |
Pylint cleanup.
Add more dynamic attribute info to IPATypeChecker in make-lint. Remove
unnecessary pylint comments. Fix false positivies introduced by Pylint 0.26.
https://fedorahosted.org/freeipa/ticket/3379
Diffstat (limited to 'ipalib')
-rw-r--r-- | ipalib/frontend.py | 20 | ||||
-rw-r--r-- | ipalib/krb_utils.py | 6 | ||||
-rw-r--r-- | ipalib/parameters.py | 8 | ||||
-rw-r--r-- | ipalib/plugins/dns.py | 4 |
4 files changed, 18 insertions, 20 deletions
diff --git a/ipalib/frontend.py b/ipalib/frontend.py index fadcb8632..52ddf28c7 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -478,10 +478,10 @@ class Command(HasParam): >>> list(c._repr_iter(login=u'Okay.', passwd=u'Private!')) ["u'Okay.'", "passwd=u'********'"] """ - for arg in self.args(): #pylint: disable=E1102 + for arg in self.args(): value = params.get(arg.name, None) yield repr(arg.safe_value(value)) - for option in self.options(): #pylint: disable=E1102 + for option in self.options(): if option.name not in params: continue value = params[option.name] @@ -506,7 +506,7 @@ class Command(HasParam): def __args_2_params(self, values): multivalue = False - for (i, arg) in enumerate(self.args()): #pylint: disable=E1102 + for (i, arg) in enumerate(self.args()): assert not multivalue if len(values) > i: if arg.multivalue: @@ -784,7 +784,7 @@ class Command(HasParam): else: self.max_args = None self._create_param_namespace('options') - params_nosort = tuple(self.args()) + tuple(self.options()) #pylint: disable=E1102 + params_nosort = tuple(self.args()) + tuple(self.options()) def get_key(p): if p.required: if p.sortorder < 0: @@ -963,7 +963,7 @@ class Command(HasParam): rv = 0 - order = [p.name for p in self.output_params()] #pylint: disable=E1102 + order = [p.name for p in self.output_params()] if options.get('all', False): order.insert(0, 'dn') print_all = True @@ -973,8 +973,8 @@ class Command(HasParam): if options.get('raw', False): labels = None else: - labels = dict((p.name, unicode(p.label)) for p in self.output_params()) #pylint: disable=E1102 - flags = dict((p.name, p.flags) for p in self.output_params()) #pylint: disable=E1102 + labels = dict((p.name, unicode(p.label)) for p in self.output_params()) + flags = dict((p.name, p.flags) for p in self.output_params()) for o in self.output: outp = self.output[o] @@ -1112,7 +1112,7 @@ class Object(HasParam): self.__get_attrs('Property'), sort=False, name_attr='attr_name' ) self._create_param_namespace('params') - pkeys = filter(lambda p: p.primary_key, self.params()) #pylint: disable=E1102 + pkeys = filter(lambda p: p.primary_key, self.params()) if len(pkeys) > 1: raise ValueError( '%s (Object) has multiple primary keys: %s' % ( @@ -1123,7 +1123,7 @@ class Object(HasParam): if len(pkeys) == 1: self.primary_key = pkeys[0] self.params_minus_pk = NameSpace( - filter(lambda p: not p.primary_key, self.params()), sort=False #pylint: disable=E1102 + filter(lambda p: not p.primary_key, self.params()), sort=False ) else: self.primary_key = None @@ -1141,7 +1141,7 @@ class Object(HasParam): if len(names) == 1 and not isinstance(names[0], (Param, str)): names = names[0] minus = frozenset(names) - for param in self.params(): #pylint: disable=E1102 + for param in self.params(): if param.name in minus or param in minus: continue yield param diff --git a/ipalib/krb_utils.py b/ipalib/krb_utils.py index b0010e9e5..9a557ce5c 100644 --- a/ipalib/krb_utils.py +++ b/ipalib/krb_utils.py @@ -231,7 +231,7 @@ class KRB5_CCache(object): error_code = e.args[0] if error_code == KRB5_CC_NOTFOUND: raise KeyError('"%s" credential not found in "%s" ccache' % \ - (krbV_principal.name, self.ccache_str())) #pylint: disable=E1103 + (krbV_principal.name, self.ccache_str())) raise e except Exception, e: raise e @@ -282,7 +282,7 @@ class KRB5_CCache(object): authtime, starttime, endtime, renew_till = cred[3] self.debug('get_credential_times: principal=%s, authtime=%s, starttime=%s, endtime=%s, renew_till=%s', - krbV_principal.name, #pylint: disable=E1103 + krbV_principal.name, krb5_format_time(authtime), krb5_format_time(starttime), krb5_format_time(endtime), krb5_format_time(renew_till)) @@ -291,7 +291,7 @@ class KRB5_CCache(object): except KeyError, e: raise e except Exception, e: - self.error('get_credential_times failed, principal="%s" error="%s"', krbV_principal.name, e) #pylint: disable=E1103 + self.error('get_credential_times failed, principal="%s" error="%s"', krbV_principal.name, e) raise e def credential_is_valid(self, principal): diff --git a/ipalib/parameters.py b/ipalib/parameters.py index 670e03605..502f173c9 100644 --- a/ipalib/parameters.py +++ b/ipalib/parameters.py @@ -1101,8 +1101,7 @@ class Int(Number): ) def __init__(self, name, *rules, **kw): - #pylint: disable=E1003 - super(Number, self).__init__(name, *rules, **kw) + super(Int, self).__init__(name, *rules, **kw) if (self.minvalue > self.maxvalue) and (self.minvalue is not None and self.maxvalue is not None): raise ValueError( @@ -1257,7 +1256,6 @@ class Decimal(Number): ) def _enforce_numberclass(self, value): - #pylint: disable=E1101 numberclass = value.number_class() if numberclass not in self.numberclass: raise ValidationError(name=self.get_param_name(), @@ -1281,7 +1279,7 @@ class Decimal(Number): def _remove_exponent(self, value): assert type(value) is decimal.Decimal - if not self.exponential: #pylint: disable=E1101 + if not self.exponential: try: # adopted from http://docs.python.org/library/decimal.html value = value.quantize(decimal.Decimal(1)) \ @@ -1499,7 +1497,7 @@ class Str(Data): Do not allow leading/trailing spaces. """ assert type(value) is unicode - if self.noextrawhitespace is False: #pylint: disable=E1101 + if self.noextrawhitespace is False: return if len(value) != len(value.strip()): return _('Leading and trailing spaces are not allowed') diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py index ae72f3053..c329c1003 100644 --- a/ipalib/plugins/dns.py +++ b/ipalib/plugins/dns.py @@ -630,7 +630,7 @@ class DNSRecord(Str): return super(DNSRecord, self)._convert_scalar(value, index) def normalize(self, value): - if self.normalizedns: #pylint: disable=E1101 + if self.normalizedns: if isinstance(value, (tuple, list)): value = tuple( self._normalize_parts(v) for v in value \ @@ -667,7 +667,7 @@ class DNSRecord(Str): return value def _rule_validatedns(self, _, value): - if not self.validatedns: #pylint: disable=E1101 + if not self.validatedns: return if value is None: |