From d90346c6ce43a48e9540fa16d60377cc852586aa Mon Sep 17 00:00:00 2001 From: Martin Basti Date: Mon, 27 Jun 2016 01:15:31 +0200 Subject: [PATCH] Pylint: enable superfluous-parens check --- dns/e164.py | 2 +- dns/entropy.py | 2 +- dns/inet.py | 4 ++-- dns/opcode.py | 4 +--- dns/resolver.py | 2 +- dns/tokenizer.py | 2 +- dns/tsig.py | 2 +- pylintrc | 1 - 8 files changed, 8 insertions(+), 11 deletions(-) diff --git a/dns/e164.py b/dns/e164.py index 8804becf..99300730 100644 --- a/dns/e164.py +++ b/dns/e164.py @@ -56,7 +56,7 @@ def to_e164(name, origin=public_enum_domain, want_plus_prefix=True): """ if origin is not None: name = name.relativize(origin) - dlabels = [d for d in name.labels if (d.isdigit() and len(d) == 1)] + dlabels = [d for d in name.labels if d.isdigit() and len(d) == 1] if len(dlabels) != len(name.labels): raise dns.exception.SyntaxError('non-digit labels in ENUM domain name') dlabels.reverse() diff --git a/dns/entropy.py b/dns/entropy.py index 5497882e..e3409283 100644 --- a/dns/entropy.py +++ b/dns/entropy.py @@ -114,7 +114,7 @@ class EntropyPool(object): else: rand = self.random_8 max = 255 - return (first + size * rand() // (max + 1)) + return first + size * rand() // (max + 1) pool = EntropyPool() diff --git a/dns/inet.py b/dns/inet.py index 966285e7..cc22e644 100644 --- a/dns/inet.py +++ b/dns/inet.py @@ -102,10 +102,10 @@ def is_multicast(text): """ try: first = ord(dns.ipv4.inet_aton(text)[0]) - return (first >= 224 and first <= 239) + return first >= 224 and first <= 239 except: try: first = ord(dns.ipv6.inet_aton(text)[0]) - return (first == 255) + return first == 255 except: raise ValueError diff --git a/dns/opcode.py b/dns/opcode.py index 2b2918e9..70d704fb 100644 --- a/dns/opcode.py +++ b/dns/opcode.py @@ -104,6 +104,4 @@ def is_update(flags): @rtype: bool """ - if (from_flags(flags) == UPDATE): - return True - return False + return from_flags(flags) == UPDATE diff --git a/dns/resolver.py b/dns/resolver.py index 86a17362..5ab58ec5 100644 --- a/dns/resolver.py +++ b/dns/resolver.py @@ -807,7 +807,7 @@ class Resolver(object): # Based on experimentation, bit 0x1 indicates that the # device is disabled. - return not (flags & 0x1) + return not flags & 0x1 finally: device_key.Close() diff --git a/dns/tokenizer.py b/dns/tokenizer.py index 6ac867b1..04b98254 100644 --- a/dns/tokenizer.py +++ b/dns/tokenizer.py @@ -96,7 +96,7 @@ class Token(object): return self.ttype == DELIMITER def is_eol_or_eof(self): - return (self.ttype == EOL or self.ttype == EOF) + return self.ttype == EOL or self.ttype == EOF def __eq__(self, other): if not isinstance(other, Token): diff --git a/dns/tsig.py b/dns/tsig.py index b9d7bb62..c57d879f 100644 --- a/dns/tsig.py +++ b/dns/tsig.py @@ -194,7 +194,7 @@ def validate(wire, keyname, secret, now, request_mac, tsig_start, tsig_rdata, (junk, our_mac, ctx) = sign(new_wire, keyname, secret, time, fudge, original_id, error, other_data, request_mac, ctx, multi, first, aname) - if (our_mac != mac): + if our_mac != mac: raise BadSignature return ctx diff --git a/pylintrc b/pylintrc index befcb733..60344173 100644 --- a/pylintrc +++ b/pylintrc @@ -33,7 +33,6 @@ disable= protected-access, redefined-builtin, round-builtin, - superfluous-parens, too-many-lines, unused-argument, unused-variable, -- 2.47.3