lint: Clean up E741 PEP-8 rule.

This commit is contained in:
Tim Abbott
2017-01-23 21:06:46 -08:00
parent e5daec46ec
commit d96f392147
3 changed files with 10 additions and 11 deletions

View File

@@ -89,7 +89,6 @@ def check_pep8(files):
# #
'E123', 'E126', 'E226', 'E241', 'E261', 'E302', 'E123', 'E126', 'E226', 'E241', 'E261', 'E302',
'E401', 'E501', 'E702', 'E711', 'E712', 'E713', 'E714', 'E401', 'E501', 'E702', 'E711', 'E712', 'E713', 'E714',
'E741',
# #
# Each of these rules are ignored for the explained reason. # Each of these rules are ignored for the explained reason.

View File

@@ -37,14 +37,14 @@ import six
# there is already an ASN.1 implementation, but in the interest of # there is already an ASN.1 implementation, but in the interest of
# limiting MIT Kerberos's exposure to malformed ccaches, encode it # limiting MIT Kerberos's exposure to malformed ccaches, encode it
# ourselves. To that end, here's the laziest DER encoder ever. # ourselves. To that end, here's the laziest DER encoder ever.
def der_encode_length(l): def der_encode_length(length):
# type: (int) -> str # type: (int) -> str
if l <= 127: if length <= 127:
return chr(l) return chr(length)
out = "" out = ""
while l > 0: while length > 0:
out = chr(l & 0xff) + out out = chr(length & 0xff) + out
l >>= 8 length >>= 8
out = chr(len(out) | 0x80) + out out = chr(len(out) | 0x80) + out
return out return out

View File

@@ -14,9 +14,9 @@ def add(x=0, y=0):
# type: (Any, Any) -> Any # type: (Any, Any) -> Any
return x + y return x + y
def to_dict(l=[]): def to_dict(v=[]):
# type: (Iterable[Tuple[Any, Any]]) -> Dict[Any, Any] # type: (Iterable[Tuple[Any, Any]]) -> Dict[Any, Any]
return dict(l) return dict(v)
class TypesPrintTest(TestCase): class TypesPrintTest(TestCase):
@@ -120,9 +120,9 @@ class TypesPrintTest(TestCase):
class A(dict): class A(dict):
pass pass
def to_A(l=[]): def to_A(v=[]):
# type: (Iterable[Tuple[Any, Any]]) -> A # type: (Iterable[Tuple[Any, Any]]) -> A
return A(l) return A(v)
self.check_signature("to_A() -> A([])", A(()), to_A) self.check_signature("to_A() -> A([])", A(()), to_A)
self.check_signature("to_A([(int, str)]) -> A([(int, str)])", self.check_signature("to_A([(int, str)]) -> A([(int, str)])",