[python] Make python lint pass (#4296)

This commit is contained in:
Michael Gottesman
2016-08-14 22:49:14 -04:00
committed by GitHub
parent 46858eb2ee
commit 751e8c51ac
3 changed files with 41 additions and 24 deletions

View File

@@ -14,14 +14,17 @@ _all_integer_type_bitwidths = [8, 16, 32, 64]
# Number of bits in the biggest int type
int_max_bits = max(_all_integer_type_bitwidths)
def int_max(bits, signed):
bits = bits - 1 if signed else bits
def int_max(bits, signed):
bits = bits - 1 if signed else bits
bits = max(bits, 0)
return (1 << bits) - 1
def int_min(bits, signed):
return (-1 * int_max(bits, signed) - 1) if signed else 0
class SwiftIntegerType(object):
def __init__(self, is_word, bits, is_signed):
@@ -33,7 +36,7 @@ class SwiftIntegerType(object):
self.possible_bitwidths = [32, 64]
else:
self.possible_bitwidths = [bits]
self.min = int_min(bits, is_signed)
self.max = int_max(bits, is_signed)
@@ -128,4 +131,3 @@ def all_integer_assignment_operator_names():
def all_integer_or_real_assignment_operator_names():
return ['=', '*=', '/=', '+=', '-=']