mirror of https://github.com/rusefi/opendbc.git
add some type hints (#774)
* 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>
This commit is contained in:
parent
dcab27ca50
commit
107b96abfc
|
@ -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
|
||||
|
|
|
@ -10,12 +10,12 @@ include_pattern = re.compile(r'CM_ "IMPORT (.*?)";\n')
|
|||
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)
|
||||
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue