Paths and folders for data and resources.
Load the config for data folders.
Methods:
Source code in src/laife/params/laife_paths.py
| def __init__(
self,
env_type: EnvType,
) -> None:
"""Load the config for data folders."""
self.env_type = env_type
self.load_config()
|
__str__
Return the string representation of the object.
Source code in src/laife/params/laife_paths.py
| def __str__(self) -> str:
"""Return the string representation of the object."""
s = "LaifePaths:\n"
s += f" src_fol: {self.src_fol}\n"
s += f" root_fol: {self.root_fol}\n"
s += f" cache_fol: {self.cache_fol}\n"
s += f" data_fol: {self.data_fol}\n"
s += f" static_fol: {self.static_fol}\n"
s += f" sprites_fol: {self.sprites_fol}\n"
s += f" ui_fol: {self.ui_fol}\n"
s += f"vendor_manifest: {self.vendor_manifest}\n"
s += f" vendor_fol: {self.vendor_fol}\n"
s += f"templates_fol: {self.templates_fol}\n"
s += f" prompts_fol: {self.prompts_fol}\n"
return s.rstrip()
|
load_common_config_pre
load_common_config_pre() -> None
Pre load the common config.
Source code in src/laife/params/laife_paths.py
| def load_common_config_pre(self) -> None:
"""Pre load the common config."""
# src folder of the package
self.src_fol = Path(laife.__file__).parent
# root folder of the project repository
self.root_fol = self.src_fol.parents[1]
# cache
self.cache_fol = self.root_fol / "cache"
# data
self.data_fol = self.root_fol / "data"
# static
self.static_fol = self.root_fol / "static"
self.sprites_fol = self.static_fol / "sprites"
# browser pages, one folder each, and their third-party files
self.ui_fol = self.root_fol / "ui"
self.vendor_manifest = self.ui_fol / "vendor.toml"
self.vendor_fol = self.cache_fol / "vendor"
# templates
self.templates_fol = self.root_fol / "templates"
# prompts
self.prompts_fol = self.src_fol / "prompts"
|
load_config
Load the config for data folders.
Source code in src/laife/params/laife_paths.py
| def load_config(self) -> None:
"""Load the config for data folders."""
self.load_common_config_pre()
match self.env_type.location:
case EnvLocationType.LOCAL:
self.load_local_config()
case EnvLocationType.RENDER:
self.load_render_config()
case _:
raise UnknownEnvLocationError(self.env_type.location)
|
load_local_config
load_local_config() -> None
Load the config for local environment.
Source code in src/laife/params/laife_paths.py
| def load_local_config(self) -> None:
"""Load the config for local environment."""
|
load_render_config
load_render_config() -> None
Load the config for Render environment.
Source code in src/laife/params/laife_paths.py
| def load_render_config(self) -> None:
"""Load the config for Render environment."""
|