cache top level files

This commit is contained in:
Georges-Antoine Assi
2025-12-30 16:45:32 -05:00
parent a45bde142e
commit 734645aa07

View File

@@ -308,16 +308,17 @@ class Rom(BaseModel):
def has_simple_single_file(self) -> bool:
return len(self.files) == 1 and not self.files[0].is_nested
@cached_property
def _top_level_files(self) -> list[RomFile]:
return [f for f in self.files if f.is_top_level]
@cached_property
def has_nested_single_file(self) -> bool:
return (
not self.has_simple_single_file
and len([f for f in self.files if f.is_top_level]) == 1
)
return not self.has_simple_single_file and len(self._top_level_files) == 1
@cached_property
def has_multiple_files(self) -> bool:
return len([f for f in self.files if f.is_top_level]) > 1
return len(self._top_level_files) > 1
@property
def fs_resources_path(self) -> str: