From 077651e708cd44118e6ccf28e03f401f52d6ceb0 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Mon, 18 Nov 2024 20:53:46 -0800 Subject: [PATCH] feat: Set output prefix --- nhf/build.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/nhf/build.py b/nhf/build.py index 576b1e3..05e4aaa 100644 --- a/nhf/build.py +++ b/nhf/build.py @@ -214,7 +214,7 @@ class Submodel: def write_to(self, obj, path: str): x = self._method(obj) assert isinstance(x, Model), f"Unexpected type: {type(x)}" - x.build_all(path) + x.build_all(path, prefix=False) @classmethod def methods(cls, subject): @@ -271,11 +271,17 @@ class Model: total += 1 return total - def build_all(self, output_dir: Union[Path, str] = "build", verbose=1): + def build_all( + self, + output_dir: Union[Path, str] = "build", + prefix: bool = True, + verbose=1): """ Build all targets in this model and write the results to file """ - output_dir = Path(output_dir) / self.name + output_dir = Path(output_dir) + if prefix: + output_dir = output_dir / self.name targets = Target.methods(self) for t in targets.values(): file_name = t.file_name