# Path: scvelo/logging.py
# _VERBOSITY_LEVELS_FROM_STRINGS = {"error": 0, "warn": 1, "info": 2, "hint": 3}
# def info(*args, **kwargs):
# def error(*args, **kwargs):
# def warn(*args, **kwargs):
# def hint(*args, **kwargs):
# def _settings_verbosity_greater_or_equal_than(v):
# def msg(
#     *msg,
#     v=None,
#     time=False,
#     memory=False,
#     reset=False,
#     end="\n",
#     no_indent=False,
#     t=None,
#     m=None,
#     r=None,
# ):
# def _write_log(*msg, end="\n"):
# def _sec_to_str(t, show_microseconds=False):
# def get_passed_time():
# def print_passed_time():
# def timeout(func, args=(), timeout_duration=2, default=None, **kwargs):
#         def __init__(self):
#         def run(self):
# def get_latest_pypi_version():
# def check_if_latest_version():
# def print_version():
# def print_versions():
# def get_date_string():
# def switch_verbosity(mode="on", module=None):
#     def __init__(self, total, interval=3):
#     def update(self):
#     def finish(self):
# def profiler(command, filename="profile.stats", n_stats=10):
#     class InterruptableThread(threading.Thread):
# class ProgressReporter:
# 
# Path: scvelo/settings.py
# def set_rcParams_scvelo(fontsize=12, color_map=None, frameon=None):
# def set_rcParams_scanpy(fontsize=12, color_map=None, frameon=None):
# def set_figure_params(
#     style="scvelo",
#     dpi=100,
#     dpi_save=150,
#     frameon=None,
#     vector_friendly=True,
#     transparent=True,
#     fontsize=12,
#     figsize=None,
#     color_map=None,
#     facecolor=None,
#     format="pdf",
#     ipython_format="png2x",
# ):
# def set_rcParams_defaults():
# def _set_ipython(ipython_format="png2x"):
# def _set_start_time():
# 
# Path: scvelo/preprocessing/neighbors.py
# def get_connectivities(
#     adata, mode="connectivities", n_neighbors=None, recurse_neighbors=False
# ):
#     if "neighbors" in adata.uns.keys():
#         C = get_neighs(adata, mode)
#         if n_neighbors is not None and n_neighbors < get_n_neighs(adata):
#             if mode == "connectivities":
#                 C = select_connectivities(C, n_neighbors)
#             else:
#                 C = select_distances(C, n_neighbors)
#         connectivities = C > 0
#         with warnings.catch_warnings():
#             warnings.simplefilter("ignore")
#             connectivities.setdiag(1)
#             if recurse_neighbors:
#                 connectivities += connectivities.dot(connectivities * 0.5)
#                 connectivities.data = np.clip(connectivities.data, 0, 1)
#             connectivities = connectivities.multiply(1.0 / connectivities.sum(1))
#         return connectivities.tocsr().astype(np.float32)
#     else:
#         return None
# 
# Path: scvelo/plotting/docs.py
# def doc_params(**kwds):
#     def dec(obj):


from inspect import signature
from pandas import unique
from matplotlib.colors import is_color_like
from anndata import AnnData
from scvelo import logging as logg
from scvelo import settings
from scvelo.preprocessing.neighbors import get_connectivities
from .docs import doc_params, doc_scatter
from .utils import *
import numpy as np
import pandas as pd
import matplotlib.pyplot as pl
                if groups is not None and len(groups) == 1:
                    if (
                        isinstance(groups[0], str)
                        and groups[0] in adata.var.keys()
                        and basis in adata.var_names
                    ):
                        groups = f"{adata[:, basis].var[groups[0]][0]}"
                idx = groups_to_bool(adata, groups, color)
                if idx is not None:
                    if np.sum(idx) > 0:  # if any group to be highlighted
                        x, y = x[idx], y[idx]
                        if not isinstance(c, str) and len(c) == adata.n_obs:
                            c = c[idx]
                        if isinstance(kwargs["s"], np.ndarray):
                            kwargs["s"] = np.array(kwargs["s"])[idx]
                        if (
                            title is None
                            and groups is not None
                            and len(groups) == 1
                            and isinstance(groups[0], str)
                        ):
                            title = groups[0]
                    else:  # if nothing to be highlighted
                        add_linfit, add_polyfit, add_density = None, None, None
            else:
                idx = None

            if not isinstance(c, str) and len(c) != len(x):
                c = "grey"
                if not isinstance(color, str) or color != default_color(adata):

# Path: scvelo/logging.py
# _VERBOSITY_LEVELS_FROM_STRINGS = {"error": 0, "warn": 1, "info": 2, "hint": 3}
# def info(*args, **kwargs):
# def error(*args, **kwargs):
# def warn(*args, **kwargs):
# def hint(*args, **kwargs):
# def _settings_verbosity_greater_or_equal_than(v):
# def msg(
#     *msg,
#     v=None,
#     time=False,
#     memory=False,
#     reset=False,
#     end="\n",
#     no_indent=False,
#     t=None,
#     m=None,
#     r=None,
# ):
# def _write_log(*msg, end="\n"):
# def _sec_to_str(t, show_microseconds=False):
# def get_passed_time():
# def print_passed_time():
# def timeout(func, args=(), timeout_duration=2, default=None, **kwargs):
#         def __init__(self):
#         def run(self):
# def get_latest_pypi_version():
# def check_if_latest_version():
# def print_version():
# def print_versions():
# def get_date_string():
# def switch_verbosity(mode="on", module=None):
#     def __init__(self, total, interval=3):
#     def update(self):
#     def finish(self):
# def profiler(command, filename="profile.stats", n_stats=10):
#     class InterruptableThread(threading.Thread):
# class ProgressReporter:
# 
# Path: scvelo/settings.py
# def set_rcParams_scvelo(fontsize=12, color_map=None, frameon=None):
# def set_rcParams_scanpy(fontsize=12, color_map=None, frameon=None):
# def set_figure_params(
#     style="scvelo",
#     dpi=100,
#     dpi_save=150,
#     frameon=None,
#     vector_friendly=True,
#     transparent=True,
#     fontsize=12,
#     figsize=None,
#     color_map=None,
#     facecolor=None,
#     format="pdf",
#     ipython_format="png2x",
# ):
# def set_rcParams_defaults():
# def _set_ipython(ipython_format="png2x"):
# def _set_start_time():
# 
# Path: scvelo/preprocessing/neighbors.py
# def get_connectivities(
#     adata, mode="connectivities", n_neighbors=None, recurse_neighbors=False
# ):
#     if "neighbors" in adata.uns.keys():
#         C = get_neighs(adata, mode)
#         if n_neighbors is not None and n_neighbors < get_n_neighs(adata):
#             if mode == "connectivities":
#                 C = select_connectivities(C, n_neighbors)
#             else:
#                 C = select_distances(C, n_neighbors)
#         connectivities = C > 0
#         with warnings.catch_warnings():
#             warnings.simplefilter("ignore")
#             connectivities.setdiag(1)
#             if recurse_neighbors:
#                 connectivities += connectivities.dot(connectivities * 0.5)
#                 connectivities.data = np.clip(connectivities.data, 0, 1)
#             connectivities = connectivities.multiply(1.0 / connectivities.sum(1))
#         return connectivities.tocsr().astype(np.float32)
#     else:
#         return None
# 
# Path: scvelo/plotting/docs.py
# def doc_params(**kwds):
#     def dec(obj):


# Path: scvelo/plotting/scatter.py
from inspect import signature
from pandas import unique
from matplotlib.colors import is_color_like
from anndata import AnnData
from scvelo import logging as logg
from scvelo import settings
from scvelo.preprocessing.neighbors import get_connectivities
from .docs import doc_params, doc_scatter
from .utils import *
import numpy as np
import pandas as pd
import matplotlib.pyplot as pl

                if groups is not None and len(groups) == 1:
                    if (
                        isinstance(groups[0], str)
                        and groups[0] in adata.var.keys()
                        and basis in adata.var_names
                    ):
                        groups = f"{adata[:, basis].var[groups[0]][0]}"
                idx = groups_to_bool(adata, groups, color)
                if idx is not None:
                    if np.sum(idx) > 0:  # if any group to be highlighted
                        x, y = x[idx], y[idx]
                        if not isinstance(c, str) and len(c) == adata.n_obs:
                            c = c[idx]
                        if isinstance(kwargs["s"], np.ndarray):
                            kwargs["s"] = np.array(kwargs["s"])[idx]
                        if (
                            title is None
                            and groups is not None
                            and len(groups) == 1
                            and isinstance(groups[0], str)
                        ):
                            title = groups[0]
                    else:  # if nothing to be highlighted
                        add_linfit, add_polyfit, add_density = None, None, None
            else:
                idx = None

            if not isinstance(c, str) and len(c) != len(x):
                c = "grey"
                if not isinstance(color, str) or color != default_color(adata):

                    logg.warn("Invalid color key. Using grey instead.")