enable almost all flake8 checks

master
Adeeb Shihadeh 2020-06-01 02:03:03 -07:00
parent 4c59163aa3
commit 1f1ff225bd
5 changed files with 11 additions and 8 deletions

View File

@ -15,7 +15,8 @@ repos:
hooks:
- id: flake8
args:
- --select=F
- --ignore=E111,E114,E121,E124,E302,E501,E741
- --statistics
- repo: local
hooks:
- id: pylint

View File

@ -12,6 +12,7 @@ def int_or_float(s):
else:
return float(s)
DBCSignal = namedtuple(
"DBCSignal", ["name", "start_bit", "size", "is_little_endian", "is_signed",
"factor", "offset", "tmin", "tmax", "units"])
@ -41,7 +42,7 @@ class dbc():
self.def_vals = defaultdict(list)
# lookup to bit reverse each byte
self.bits_index = [(i & ~0b111) + ((-i-1) & 0b111) for i in range(64)]
self.bits_index = [(i & ~0b111) + ((-i - 1) & 0b111) for i in range(64)]
for l in self.txt:
l = l.strip()
@ -103,7 +104,7 @@ class dbc():
# convert strings to UPPER_CASE_WITH_UNDERSCORES
defvals[1::2] = [d.strip().upper().replace(" ", "_") for d in defvals[1::2]]
defvals = '"'+"".join(str(i) for i in defvals)+'"'
defvals = '"' + "".join(str(i) for i in defvals) + '"'
self.def_vals[ids].append((sgname, defvals))
@ -193,12 +194,12 @@ class dbc():
if arr is None:
out = {}
else:
out = [None]*len(arr)
out = [None] * len(arr)
msg = self.msgs.get(x[0])
if msg is None:
if x[0] not in self._warned_addresses:
#print("WARNING: Unknown message address {}".format(x[0]))
# print("WARNING: Unknown message address {}".format(x[0]))
self._warned_addresses.add(x[0])
return None, None

View File

@ -65,4 +65,4 @@ setup(name='CAN packer',
)
if platform.system() == "Darwin":
os.system("install_name_tool -change opendbc/can/libdbc.dylib "+BASEDIR+"/opendbc/can/libdbc.dylib packer_pyx.so")
os.system("install_name_tool -change opendbc/can/libdbc.dylib " + BASEDIR + "/opendbc/can/libdbc.dylib packer_pyx.so")

View File

@ -65,4 +65,4 @@ setup(name='CAN parser',
)
if platform.system() == "Darwin":
os.system("install_name_tool -change opendbc/can/libdbc.dylib "+BASEDIR+"/opendbc/can/libdbc.dylib parser_pyx.so")
os.system("install_name_tool -change opendbc/can/libdbc.dylib " + BASEDIR + "/opendbc/can/libdbc.dylib parser_pyx.so")

View File

@ -10,7 +10,7 @@ from opendbc.can.dbc import dbc
def process(in_fn, out_fn):
dbc_name = os.path.split(out_fn)[-1].replace('.cc', '')
#print("processing %s: %s -> %s" % (dbc_name, in_fn, out_fn))
# print("processing %s: %s -> %s" % (dbc_name, in_fn, out_fn))
template_fn = os.path.join(os.path.dirname(__file__), "dbc_template.cc")
@ -122,5 +122,6 @@ def main():
process(in_fn, out_fn)
if __name__ == '__main__':
main()