Repository: Avaiga/taipy
File: taipy/gui/page.py (Python)

Code before:
            if len(inspect.stack()) > 3 and inspect.stack()[2].function != "<module>":
                self._frame = t.cast(FrameType, t.cast(FrameType, inspect.stack()[3].frame))
        elif len(inspect.stack()) < 4:
            raise RuntimeError(f"Can't resolve module. Page '{type(self).__name__}' is not registered.")
        else:
            self._frame = t.cast(FrameType, t.cast(FrameType, inspect.stack()[3].frame))
        if self._renderer:
            # Extract the page module's attributes and methods
            cls = type(self)
            cls_locals = dict(vars(self))
            functions = [
                i[0]
                for i in inspect.getmembers(cls)
                if not i[0].startswith("_") and inspect.isroutine(i[1])
            ]
            for f in functions:
                func = getattr(self, f)
                if hasattr(func, "__func__") and func.__func__ is not None:
                    cls_locals[f] = func.__func__
            self._class_module_name = cls.__name__
            self._class_locals = cls_locals
        # Special variables only use for page reloading in notebook context
        self._notebook_gui: t.Optional["Gui"] = None
        self._notebook_page: t.Optional["_Page"] = None
        self.set_style(kwargs.get("style", None))
        self.script_paths(kwargs.get("script_paths", None))

    def create_page(self) -> t.Optional[Page]:
        """Create the page content for page modules.

        If this page is a page module, this method must be overloaded and return the page content.

        This method should never be called directly: only the Taipy GUI internals will.

        The default implementation returns None, indicating that this class does not implement
        a page module.

        Returns:
            The page content for this Page subclass, making it a page module.
        """
        return None

    def set_content(self, content: str) -> None:
        """Set a new page content.

        Reads the new page content and re-initializes the `Page^` instance to reflect the change.

        !!! important
            This function can only be used in an IPython notebook context.

        Arguments:

Review comment (suggestion):
```suggestion
        self.scripts(kwargs.get("scripts", None))
```
(see above)

Code after:
            if len(inspect.stack()) > 3 and inspect.stack()[2].function != "<module>":
                self._frame = t.cast(FrameType, t.cast(FrameType, inspect.stack()[3].frame))
        elif len(inspect.stack()) < 4:
            raise RuntimeError(f"Can't resolve module. Page '{type(self).__name__}' is not registered.")
        else:
            self._frame = t.cast(FrameType, t.cast(FrameType, inspect.stack()[3].frame))
        if self._renderer:
            # Extract the page module's attributes and methods
            cls = type(self)
            cls_locals = dict(vars(self))
            functions = [
                i[0]
                for i in inspect.getmembers(cls)
                if not i[0].startswith("_") and inspect.isroutine(i[1])
            ]
            for f in functions:
                func = getattr(self, f)
                if hasattr(func, "__func__") and func.__func__ is not None:
                    cls_locals[f] = func.__func__
            self._class_module_name = cls.__name__
            self._class_locals = cls_locals
        # Special variables only use for page reloading in notebook context
        self._notebook_gui: t.Optional["Gui"] = None
        self._notebook_page: t.Optional["_Page"] = None
        self.set_style(kwargs.get("style", None))
        self._script_paths(kwargs.get("script_paths", None))

    def create_page(self) -> t.Optional[Page]:
        """Create the page content for page modules.

        If this page is a page module, this method must be overloaded and return the page content.

        This method should never be called directly: only the Taipy GUI internals will.

        The default implementation returns None, indicating that this class does not implement
        a page module.

        Returns:
            The page content for this Page subclass, making it a page module.
        """
        return None

    def set_content(self, content: str) -> None:
        """Set a new page content.

        Reads the new page content and re-initializes the `Page^` instance to reflect the change.

        !!! important
            This function can only be used in an IPython notebook context.

        Arguments: