INNER CODE UNIT · Python

urls_for_pages

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

        def urls_for_pages(
            pages: t.Iterable[rio.ComponentPage | rio.Redirect],
        ) -> t.Iterator[str]:
            for page in pages:
                if isinstance(page, rio.ComponentPage):
                    yield from urls_for_component_page(page)

                elif include_redirects and isinstance(page, rio.Redirect):
                    yield page.url_segment

        def urls_for_component_page(page: rio.ComponentPage) -> t.Iterator[str]:
            # A page can have multiple URLs if it has path parameters. Start by
            # creating a list of URLs that are valid for this page.
            if page._url_pattern.path_parameter_names:
                # If this page has path parameters, we don't know what it
                # considers a valid URL. One exception are Literals - we simply
                # insert every allowed value into the URL.
                options = dict[str, t.Sequence[str]]()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…