Skip to content

Commit

Permalink
Add pydocs
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmittag committed Mar 22, 2024
1 parent 03a958c commit 6128785
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/velocitas/model_generator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ def generate_model(
ext_attributes_list: List[str] = [],
overlays: List[str] = [],
) -> None:
"""Generates a model to a file (json, vspec)
input_file_path str: The file to convert.
input_unit_file_path_list List[str]: The unit file(s) used to generate the model.
language str: The programming language used (python/cpp).
target_folder str: The folder where the model should be generated to.
name str: The name of the model
strict bool: If enabled checks for VSS terminoligy.
include_dir: which directories to include for file searches
ext_attributes_list List[str]: The extended attributes that aren't considered by the generator (no warnings)
overlays List[str]: The overlay that is used to generate the model.
"""

include_dirs = ["."]
include_dirs.extend(include_dir)

Expand Down
2 changes: 2 additions & 0 deletions src/velocitas/model_generator/tree_generator/file_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def __init__(
self.overlays = overlays

def load_tree(self):
"""loads a tree of a vspec file through vss-tools"""
print("Loading vspec...")
vspec.load_units(
self.file_path,
Expand Down Expand Up @@ -95,6 +96,7 @@ def __extend_fields(self, d: dict):
return

def load_tree(self):
"""loads a tree of a json file through vss-tools"""
print("Loading json...")
output_json = json.load(open(self.file_path))
self.__extend_fields(next(iter(output_json.values())))
Expand Down
9 changes: 9 additions & 0 deletions src/velocitas/model_generator/tree_generator/file_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ def __get_format_implementation(
file_path: str,
unit_file_path_list: List[str],
):
"""Initialize implementation of VSPEC or JSON.
Args:
file_path str: path to the file that is used for format checking
unit_file_path_list List[str]: a list of unit files that get checked to be yaml files
Returns:
Error UnsupportedFileFormat: If either file specified is not supported.
"""
file_ext = os.path.splitext(file_path)[1][1:]
for unit_file_path in unit_file_path_list:
unit_file_ext = os.path.splitext(unit_file_path)[1][1:]
Expand Down

0 comments on commit 6128785

Please sign in to comment.