INNER CODE UNIT · Python

_infer_pages

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

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

        # No `pages` folder exists? No pages, then.
        if not pages_dir.exists():
            return []

        # In order to import the pages correctly correctly we must know the
        # correct module name to use. We know that the `pages` folder is a
        # sibling of `self._calling_module`, so we can deduce the correct module
        # name based on that.
        if self._calling_module.__file__ is None:
            # TODO: Display a warning?
            return []

        caller_file_path = Path(self._calling_module.__file__)

        # Careful: If the calling file is the `__init__.py` of a package, the

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…