INNER CODE UNIT · Python

_base_dir_for_relative_paths

rio-labs/rio · rio/app.py:543

    def _base_dir_for_relative_paths(self) -> Path:
        if self._calling_module.__file__ is None:
            # TODO: What do we do in this case?
            return Path.cwd()

        return Path(self._calling_module.__file__).parent

    def _infer_app_name(self) -> str:
        main_file_path = self._main_file_path

        name = main_file_path.stem
        if name in ("main", "__main__", "__init__"):
            name = main_file_path.absolute().parent.name

        return name.replace("_", " ").title()

    def _infer_pages(self) -> list[rio.ComponentPage]:
        pages_dir = self._base_dir_for_relative_paths / "pages"

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…