from collections.abc import Callable, Iterable
from pathlib import PosixPath
from pprint import PrettyPrinter
from typing import ClassVar, Generic, Literal, NoReturn, Protocol, Type, TypeVar
from google.colab._shell import Shell    # type: ignore
from IPython.core.interactiveshell import InteractiveShell    # type: ignore
from davos.core.project import AbstractProject, ConcreteProject

__all__ = list[Literal['DavosConfig']]

_Environment = Literal['Colaboratory', 'IPython<7.0', 'IPython>=7.0', 'Python']
_I= TypeVar('_I', bound=Iterable)
_DC = TypeVar('_DC', bound=DavosConfig)
IpythonShell = InteractiveShell | Shell

class _IpyShowSyntaxErrorPre7(Protocol):
    def __call__(self, filename: str | None = ...) -> None: ...

class _IpyShowSyntaxErrorPost7(Protocol):
    def __call__(self, filename: str | None = ..., running_compile_code: bool = ...) -> None: ...

class SingletonConfig(type, Generic[_DC]):
    # ignoring an overly strict mypy check that doesn't account for this
    # use case. see https://github.com/python/mypy/issues/5144
    __instance: ClassVar[_DC | None]    # type: ignore[misc]
    def __call__(cls: Type[_DC], *args: object, **kwargs: object) -> _DC: ...    # type: ignore[misc]

class DavosConfig(metaclass=SingletonConfig):
    _active: bool
    _auto_rerun: bool
    _conda_avail: bool | None
    _conda_env: str | None
    _conda_envs_dirs: dict[str, str] | None
    _confirm_install: bool
    _default_pip_executable: str
    _environment: _Environment
    _ipy_showsyntaxerror_orig: _IpyShowSyntaxErrorPre7 | _IpyShowSyntaxErrorPost7 | None
    _ipython_shell: IpythonShell | None
    _noninteractive: bool
    _pip_executable: str
    _project: AbstractProject | ConcreteProject | None
    _repr_formatter: PrettyPrinter
    _smuggled: dict[str, str]
    _stdlib_modules: frozenset[str]
    _suppress_stdout: bool
    @staticmethod
    def __mock_sorted(__iterable: _I, key: Callable | None = ..., reverse: bool = ...) -> _I: ...
    def __init__(self) -> None: ...
    def __repr__(self) -> str: ...
    @property
    def active(self) -> bool: ...
    @active.setter
    def active(self, state: bool) -> None: ...
    @property
    def auto_rerun(self) -> bool: ...
    @auto_rerun.setter
    def auto_rerun(self, value: bool) -> None: ...
    @property
    def conda_avail(self) -> bool: ...
    @conda_avail.setter
    def conda_avail(self, _: object) -> NoReturn: ...
    @property
    def conda_env(self) -> str | None: ...
    @conda_env.setter
    def conda_env(self, new_env: str) -> None: ...
    @property
    def conda_envs_dirs(self) -> dict[str, str] | None: ...
    @conda_envs_dirs.setter
    def conda_envs_dirs(self, _: object) -> NoReturn: ...
    @property
    def confirm_install(self) -> bool: ...
    @confirm_install.setter
    def confirm_install(self, value: bool) -> None: ...
    @property
    def environment(self) -> _Environment: ...
    @environment.setter
    def environment(self, _: object) -> NoReturn: ...
    @property
    def ipython_shell(self) -> IpythonShell | None: ...
    @ipython_shell.setter
    def ipython_shell(self, _: object) -> NoReturn: ...
    @property
    def noninteractive(self) -> bool: ...
    @noninteractive.setter
    def noninteractive(self, value: bool) -> None: ...
    @property
    def pip_executable(self) -> str: ...
    @pip_executable.setter
    def pip_executable(self, exe_path: PosixPath | str) -> None: ...
    @property
    def project(self) -> AbstractProject | ConcreteProject: ...
    @project.setter
    def project(self, proj: AbstractProject | ConcreteProject | PosixPath | str | None) -> None: ...
    @property
    def smuggled(self) -> dict[str, str]: ...
    @smuggled.setter
    def smuggled(self, _: object) -> NoReturn: ...
    @property
    def suppress_stdout(self) -> bool: ...
    @suppress_stdout.setter
    def suppress_stdout(self, value: bool) -> None: ...
    def _find_default_pip_executable(self) -> str: ...

def _block_greedy_ipython_completer() -> None: ...
def _get_stdlib_modules() -> frozenset[str]: ...
