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

Code before:
            )
        if not flask_log:
            log = logging.getLogger("werkzeug")
            log.disabled = True
            if not is_running_from_reloader():
                _TaipyLogger._get_logger().info(f" * Server starting on http://{host_value}:{port}")
            else:
                _TaipyLogger._get_logger().info(f" * Server reloaded on http://{host_value}:{port}")
            _TaipyLogger._get_logger().info(f" * Application is accessible at {client_url}")
        if not is_running_from_reloader() and self._gui._get_config("run_browser", False):
            webbrowser.open(client_url, new=2)
        if _is_in_notebook() or run_in_thread:
            self._thread = KThread(target=self._run_notebook)
            self._thread.start()
            return
        self._is_running = True
        run_config = {
            "app": self._flask,
            "host": host,
            "port": port,
            "debug": debug,
            "use_reloader": use_reloader,
        }
        if self.__ssl_context is not None:
            run_config["ssl_context"] = self.__ssl_context
        # flask-socketio specific conditions for 'allow_unsafe_werkzeug' arguments to be popped out of kwargs
        if self._get_async_mode() == "threading" and (not sys.stdin or not sys.stdin.isatty()):
            run_config = {**run_config, "allow_unsafe_werkzeug": allow_unsafe_werkzeug}
        try:
            self._ws.run(**run_config)
        except KeyboardInterrupt:
            pass

    def stop_thread(self):
        if hasattr(self, "_thread") and self._thread.is_alive() and self._is_running:
            self._is_running = False
            with contextlib.suppress(Exception):
                if self._get_async_mode() == "gevent":
                    if self._ws.wsgi_server is not None:  # type: ignore[reportAttributeAccessIssue]
                        self._ws.wsgi_server.stop()  # type: ignore[reportAttributeAccessIssue]
                    else:
                        self._thread.kill()
                else:
                    self._thread.kill()
            while _is_port_open(self._host, self._port):
                time.sleep(0.1)

    def stop_proxy(self):
        if hasattr(self, "_proxy"):
            self._proxy.stop()


Review comment (suggestion):
```suggestion
        # flask-socketio specific conditions for 'allow_unsafe_werkzeug' parameters to be popped out of kwargs
```

Code after:
            )
        if not flask_log:
            log = logging.getLogger("werkzeug")
            log.disabled = True
            if not is_running_from_reloader():
                _TaipyLogger._get_logger().info(f" * Server starting on http://{host_value}:{port}")
            else:
                _TaipyLogger._get_logger().info(f" * Server reloaded on http://{host_value}:{port}")
            _TaipyLogger._get_logger().info(f" * Application is accessible at {client_url}")
        if not is_running_from_reloader() and self._gui._get_config("run_browser", False):
            webbrowser.open(client_url, new=2)
        if _is_in_notebook() or run_in_thread:
            self._thread = KThread(target=self._run_notebook)
            self._thread.start()
            return
        self._is_running = True
        run_config = {
            "app": self._flask,
            "host": host,
            "port": port,
            "debug": debug,
            "use_reloader": use_reloader,
        }
        if self.__ssl_context is not None:
            run_config["ssl_context"] = self.__ssl_context
        # flask-socketio specific conditions for 'allow_unsafe_werkzeug' parameters to be popped out of kwargs
        if self._get_async_mode() == "threading" and (not sys.stdin or not sys.stdin.isatty()):
            run_config = {**run_config, "allow_unsafe_werkzeug": allow_unsafe_werkzeug}
        try:
            self._ws.run(**run_config)
        except KeyboardInterrupt:
            pass

    def stop_thread(self):
        if hasattr(self, "_thread") and self._thread.is_alive() and self._is_running:
            self._is_running = False
            with contextlib.suppress(Exception):
                if self._get_async_mode() == "gevent":
                    if self._ws.wsgi_server is not None:  # type: ignore[reportAttributeAccessIssue]
                        self._ws.wsgi_server.stop()  # type: ignore[reportAttributeAccessIssue]
                    else:
                        self._thread.kill()
                else:
                    self._thread.kill()
            while _is_port_open(self._host, self._port):
                time.sleep(0.1)

    def stop_proxy(self):
        if hasattr(self, "_proxy"):
            self._proxy.stop()