Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add some type hints #774

Merged
merged 10 commits into from
Jan 2, 2023
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