Skip to content

Commit

Permalink
enable almost all flake8 checks
Browse files Browse the repository at this point in the history
  • Loading branch information
adeebshihadeh committed Jun 1, 2020
1 parent 4c59163 commit 1f1ff22
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions can/dbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down Expand Up @@ -41,7 +42,7 @@ def __init__(self, fn):
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()
Expand Down Expand Up @@ -103,7 +104,7 @@ def __init__(self, fn):

# 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))

Expand Down Expand Up @@ -193,12 +194,12 @@ def decode(self, x, arr=None, debug=False):
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

Expand Down
2 changes: 1 addition & 1 deletion can/packer_pyx_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ def get_ext_filename(self, ext_name):
)

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")
2 changes: 1 addition & 1 deletion can/parser_pyx_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ def get_ext_filename(self, ext_name):
)

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")
3 changes: 2 additions & 1 deletion can/process_dbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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")

Expand Down Expand Up @@ -122,5 +122,6 @@ def main():

process(in_fn, out_fn)


if __name__ == '__main__':
main()

0 comments on commit 1f1ff22

Please sign in to comment.