# 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:


import numpy as np
import pandas as pd
from scvelo import logging as logg
    from scanpy.tools._score_genes import score_genes
    S_score: `adata.obs`, dtype `object`
        The score for S phase for each cell.
    G2M_score: `adata.obs`, dtype `object`
        The score for G2M phase for each cell.
    phase: `adata.obs`, dtype `object`
        The cell cycle phase (`S`, `G2M` or `G1`) for each cell.
    """

    logg.info("calculating cell cycle phase")

    adata = adata.copy() if copy else adata

    s_genes_, g2m_genes_ = get_phase_marker_genes(adata)
    if s_genes is None:
        s_genes = s_genes_
    if g2m_genes is None:
        g2m_genes = g2m_genes_

    ctrl_size = min(len(s_genes), len(g2m_genes))

    kwargs.update({"ctrl_size": ctrl_size})
    score_genes(adata, gene_list=s_genes, score_name="S_score", **kwargs)
    score_genes(adata, gene_list=g2m_genes, score_name="G2M_score", **kwargs)
    scores = adata.obs[["S_score", "G2M_score"]]

    phase = pd.Series("S", index=scores.index)  # default phase is S
    phase[scores.G2M_score > scores.S_score] = "G2M"  # G2M, if G2M is higher than S
    phase[np.all(scores < 0, axis=1)] = "G1"  # G1, if all scores are negative

    adata.obs["phase"] = phase

# 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/tools/score_genes_cell_cycle.py
import numpy as np
import pandas as pd
from scvelo import logging as logg
    from scanpy.tools._score_genes import score_genes

    S_score: `adata.obs`, dtype `object`
        The score for S phase for each cell.
    G2M_score: `adata.obs`, dtype `object`
        The score for G2M phase for each cell.
    phase: `adata.obs`, dtype `object`
        The cell cycle phase (`S`, `G2M` or `G1`) for each cell.
    """

    logg.info("calculating cell cycle phase")

    adata = adata.copy() if copy else adata

    s_genes_, g2m_genes_ = get_phase_marker_genes(adata)
    if s_genes is None:
        s_genes = s_genes_
    if g2m_genes is None:
        g2m_genes = g2m_genes_

    ctrl_size = min(len(s_genes), len(g2m_genes))

    kwargs.update({"ctrl_size": ctrl_size})
    score_genes(adata, gene_list=s_genes, score_name="S_score", **kwargs)
    score_genes(adata, gene_list=g2m_genes, score_name="G2M_score", **kwargs)
    scores = adata.obs[["S_score", "G2M_score"]]

    phase = pd.Series("S", index=scores.index)  # default phase is S
    phase[scores.G2M_score > scores.S_score] = "G2M"  # G2M, if G2M is higher than S
    phase[np.all(scores < 0, axis=1)] = "G1"  # G1, if all scores are negative

    adata.obs["phase"] = phase

    logg.hint("    'S_score' and 'G2M_score', scores of cell cycle phases (adata.obs)")