Skip to content

Commit

Permalink
ruff formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanieKemna committed Jul 22, 2024
1 parent 8211865 commit d2f0b89
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/mlfmu/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def from_string(command_string: str):
return None
return matches[0]


# run for mlfmu
def run(
command: MlFmuCommand,
Expand Down Expand Up @@ -138,7 +139,6 @@ def __del__(self):
logger.debug("MlFmuBuilder: destructor called, removing temporary build directory.")
# The destructor should automatically delete the temporary directory (goes out of scope).


def build(self):
"""
Build an FMU from ml_model_file and interface_file and saves it to fmu_output_folder.
Expand Down Expand Up @@ -267,7 +267,6 @@ def compile(self):
print(ex)
logger.debug("MLFmuBuilder: Done with compile")


def default_interface_file(self):
"""Return the path to a interface json file inside self.root_directory if it can be inferred."""
return MlFmuBuilder._find_default_file(self.root_directory, "json", "interface")
Expand Down Expand Up @@ -413,7 +412,7 @@ def __init__(
ml_model_file=ml_model_file,
source_folder=source_folder,
fmu_output_folder=fmu_output_folder,
build_folder=build_folder
build_folder=build_folder,
)

def run(self):
Expand Down
9 changes: 7 additions & 2 deletions src/mlfmu/cli/mlfmu.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

logger = logging.getLogger(__name__)


def _argparser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
prog="mlfmu",
Expand Down Expand Up @@ -73,7 +74,9 @@ def _argparser() -> argparse.ArgumentParser:
)

# Add options for build command
_ = build_parser.add_argument("-i", "--interface-file", type=str, help="JSON file describing the FMU following schema")
_ = build_parser.add_argument(
"-i", "--interface-file", type=str, help="JSON file describing the FMU following schema"
)
_ = build_parser.add_argument("-m", "--model-file", type=str, help="ONNX file containing the ML Model")
_ = build_parser.add_argument("-f", "--fmu-path", type=str, help="Path to where the built FMU should be saved")

Expand All @@ -90,7 +93,9 @@ def _argparser() -> argparse.ArgumentParser:
_ = code_generation_parser.add_argument(
"--interface-file", type=str, help="json file describing the FMU following schema (e.g. interface.json)."
)
_ = code_generation_parser.add_argument("--model-file", type=str, help="onnx file containing the ML Model (e.g. example.onnx).")
_ = code_generation_parser.add_argument(
"--model-file", type=str, help="onnx file containing the ML Model (e.g. example.onnx)."
)
_ = code_generation_parser.add_argument(
"--fmu-source-path",
help="Path to where the generated FMU source code should be saved. Given path/to/folder the files can be found in path/to/folder/[FmuName]",
Expand Down
1 change: 1 addition & 0 deletions src/mlfmu/utils/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

logger = logging.getLogger(__name__)


# Replacing all the template strings with their corresponding values and saving to new file
def format_template_file(template_path: Path, save_path: Path, data: dict[str, str]):
# TODO: Need to check that these calls are safe from a cybersecurity point of view
Expand Down

0 comments on commit d2f0b89

Please sign in to comment.