"""
This type stub file was generated by pyright.
"""

import tornado.web
from typing import Final, TYPE_CHECKING
from tornado.httpserver import HTTPServer
from collections.abc import Awaitable

if TYPE_CHECKING:
    ...
_LOGGER: Final = ...
TORNADO_SETTINGS = ...
MAX_PORT_SEARCH_RETRIES: Final = ...
UNIX_SOCKET_PREFIX: Final = ...
MEDIA_ENDPOINT: Final = ...
COMPONENT_ENDPOINT: Final = ...
STATIC_SERVING_ENDPOINT: Final = ...
UPLOAD_FILE_ENDPOINT: Final = ...
STREAM_ENDPOINT: Final = ...
METRIC_ENDPOINT: Final = ...
MESSAGE_ENDPOINT: Final = ...
NEW_HEALTH_ENDPOINT: Final = ...
HEALTH_ENDPOINT: Final = ...
HOST_CONFIG_ENDPOINT: Final = ...
SCRIPT_HEALTH_CHECK_ENDPOINT: Final = ...
OAUTH2_CALLBACK_ENDPOINT: Final = ...
AUTH_LOGIN_ENDPOINT: Final = ...
AUTH_LOGOUT_ENDPOINT: Final = ...
class RetriesExceeded(Exception):
    ...


def server_port_is_manually_set() -> bool:
    ...

def server_address_is_unix_socket() -> bool:
    ...

def start_listening(app: tornado.web.Application) -> None:
    """Makes the server start listening at the configured port.

    In case the port is already taken it tries listening to the next available
    port.  It will error after MAX_PORT_SEARCH_RETRIES attempts.

    """
    ...

def start_listening_unix_socket(http_server: HTTPServer) -> None:
    ...

def start_listening_tcp_socket(http_server: HTTPServer) -> None:
    ...

class Server:
    def __init__(self, main_script_path: str, is_hello: bool) -> None:
        """Create the server. It won't be started yet."""
        ...
    
    @classmethod
    def initialize_mimetypes(cls) -> None:
        """Ensures that common mime-types are robust against system misconfiguration."""
        ...
    
    def __repr__(self) -> str:
        ...
    
    @property
    def main_script_path(self) -> str:
        ...
    
    async def start(self) -> None:
        """Start the server.

        When this returns, Streamlit is ready to accept new sessions.
        """
        ...
    
    @property
    def stopped(self) -> Awaitable[None]:
        """A Future that completes when the Server's run loop has exited."""
        ...
    
    @property
    def browser_is_connected(self) -> bool:
        ...
    
    @property
    def is_running_hello(self) -> bool:
        ...
    
    def stop(self) -> None:
        ...
    


