Skip to content

Commit

Permalink
add some type hints (commaai#774)
Browse files Browse the repository at this point in the history
* type stubs for common, parser_pyx

* Cleanup imports

* values are indeed floats

* common.pyi complete, added cpp stubs

* parser_pyx.pyi complete

* CANPacker completed

* Holding temp changes...

* remove *.pyi

* just remove skip-file

Co-authored-by: Jason Shuler <jshuler@gmail.com>
  • Loading branch information
adeebshihadeh and JMPZ11 committed Jan 2, 2023
1 parent dcab27c commit 107b96a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions can/packer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# pylint: skip-file
from opendbc.can.packer_pyx import CANPacker
from opendbc.can.packer_pyx import CANPacker # pylint: disable=no-name-in-module, import-error
assert CANPacker
6 changes: 3 additions & 3 deletions generator/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
generated_suffix = '_generated.dbc'


def read_dbc(src_dir, filename):
def read_dbc(src_dir: str, filename: str) -> str:
with open(os.path.join(src_dir, filename)) as file_in:
return file_in.read()


def create_dbc(src_dir, filename, output_path):
def create_dbc(src_dir: str, filename: str, output_path: str):
dbc_file_in = read_dbc(src_dir, filename)

includes = include_pattern.findall(dbc_file_in)
Expand All @@ -39,7 +39,7 @@ def create_dbc(src_dir, filename, output_path):
dbc_file_out.write(core_dbc)


def create_all(output_path):
def create_all(output_path: str):
# clear out old DBCs
for f in glob.glob(f"{output_path}/*{generated_suffix}"):
os.remove(f)
Expand Down

0 comments on commit 107b96a

Please sign in to comment.