Skip to content

Commit

Permalink
Finish merge
Browse files Browse the repository at this point in the history
  • Loading branch information
flying-sheep committed Oct 24, 2023
1 parent 41b715b commit ad29ca5
Show file tree
Hide file tree
Showing 19 changed files with 32 additions and 32 deletions.
6 changes: 3 additions & 3 deletions scanpy/_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@

# Collected from the print_* functions in matplotlib.backends
_Format = Union[
Literal['png', 'jpg', 'tif', 'tiff'],
Literal['pdf', 'ps', 'eps', 'svg', 'svgz', 'pgf'],
Literal['raw', 'rgba'],
Literal["png", "jpg", "tif", "tiff"],
Literal["pdf", "ps", "eps", "svg", "svgz", "pgf"],
Literal["raw", "rgba"],
]


Expand Down
2 changes: 1 addition & 1 deletion scanpy/external/pl.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from .tl._wishbone import _anndata_to_wishbone


@doctest_needs('phate')
@doctest_needs("phate")
@_wraps_plot_scatter
@_doc_params(
adata_color_etc=doc_adata_color_etc,
Expand Down
2 changes: 1 addition & 1 deletion scanpy/external/pp/_harmony_integrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from ...testing._doctests import doctest_needs


@doctest_needs('harmonypy')
@doctest_needs("harmonypy")
def harmony_integrate(
adata: AnnData,
key: str,
Expand Down
2 changes: 1 addition & 1 deletion scanpy/external/pp/_hashsolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def _calculate_bayes_rule(data, priors, number_of_noise_barcodes):
}


@doctest_skip('Illustrative but not runnable doctest code')
@doctest_skip("Illustrative but not runnable doctest code")
def hashsolo(
adata: anndata.AnnData,
cell_hashing_columns: list,
Expand Down
2 changes: 1 addition & 1 deletion scanpy/external/pp/_magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
MIN_VERSION = "2.0"


@doctest_needs('magic')
@doctest_needs("magic")
def magic(
adata: AnnData,
name_list: Union[Literal["all_genes", "pca_only"], Sequence[str], None] = None,
Expand Down
2 changes: 1 addition & 1 deletion scanpy/external/pp/_scanorama_integrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from ...testing._doctests import doctest_needs


@doctest_needs('scanorama')
@doctest_needs("scanorama")
def scanorama_integrate(
adata: AnnData,
key: str,
Expand Down
2 changes: 1 addition & 1 deletion scanpy/external/tl/_harmony_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from ...testing._doctests import doctest_needs


@doctest_needs('harmony')
@doctest_needs("harmony")
def harmony_timeseries(
adata: AnnData,
tp: str,
Expand Down
2 changes: 1 addition & 1 deletion scanpy/external/tl/_palantir.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from ...testing._doctests import doctest_needs


@doctest_needs('palantir')
@doctest_needs("palantir")
def palantir(
adata: AnnData,
n_components: int = 10,
Expand Down
2 changes: 1 addition & 1 deletion scanpy/external/tl/_phate.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from ...testing._doctests import doctest_needs


@doctest_needs('phate')
@doctest_needs("phate")
def phate(
adata: AnnData,
n_components: int = 2,
Expand Down
2 changes: 1 addition & 1 deletion scanpy/external/tl/_phenograph.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from ...testing._doctests import doctest_needs


@doctest_needs('phenograph')
@doctest_needs("phenograph")
def phenograph(
adata: Union[AnnData, np.ndarray, spmatrix],
clustering_algo: Optional[Literal["louvain", "leiden"]] = "louvain",
Expand Down
2 changes: 1 addition & 1 deletion scanpy/external/tl/_pypairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Genes = Collection[Union[str, int, bool]]


@doctest_needs('pypairs')
@doctest_needs("pypairs")
def sandbag(
adata: AnnData,
annotation: Optional[Mapping[str, Genes]] = None,
Expand Down
2 changes: 1 addition & 1 deletion scanpy/external/tl/_sam.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from ...testing._doctests import doctest_needs


@doctest_needs('samalg')
@doctest_needs("samalg")
def sam(
adata: AnnData,
max_iter: int = 10,
Expand Down
2 changes: 1 addition & 1 deletion scanpy/external/tl/_trimap.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from ...testing._doctests import doctest_needs


@doctest_needs('trimap')
@doctest_needs("trimap")
def trimap(
adata: AnnData,
n_components: int = 2,
Expand Down
2 changes: 1 addition & 1 deletion scanpy/external/tl/_wishbone.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from ...testing._doctests import doctest_needs


@doctest_needs('wishbone')
@doctest_needs("wishbone")
def wishbone(
adata: AnnData,
start_cell: str,
Expand Down
8 changes: 4 additions & 4 deletions scanpy/queries/_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def simple_query(
return res


@doctest_needs('pybiomart')
@doctest_needs("pybiomart")
@_doc_params(doc_org=_doc_org, doc_host=_doc_host, doc_use_cache=_doc_use_cache)
def biomart_annotations(
org: str,
Expand Down Expand Up @@ -110,7 +110,7 @@ def biomart_annotations(
return simple_query(org=org, attrs=attrs, host=host, use_cache=use_cache)


@doctest_needs('pybiomart')
@doctest_needs("pybiomart")
@_doc_params(doc_org=_doc_org, doc_host=_doc_host, doc_use_cache=_doc_use_cache)
def gene_coordinates(
org: str,
Expand Down Expand Up @@ -156,7 +156,7 @@ def gene_coordinates(
return res[~res["chromosome_name"].isin(chr_exclude)]


@doctest_needs('pybiomart')
@doctest_needs("pybiomart")
@_doc_params(doc_org=_doc_org, doc_host=_doc_host, doc_use_cache=_doc_use_cache)
def mitochondrial_genes(
org: str,
Expand Down Expand Up @@ -201,7 +201,7 @@ def mitochondrial_genes(
)


@doctest_needs('gprofiler')
@doctest_needs("gprofiler")
@singledispatch
@_doc_params(doc_org=_doc_org)
def enrich(
Expand Down
2 changes: 1 addition & 1 deletion scanpy/testing/_doctests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from collections.abc import Callable


F = TypeVar('F', bound=FunctionType)
F = TypeVar("F", bound=FunctionType)


def doctest_needs(mod: str) -> Callable[[F], F]:
Expand Down
18 changes: 9 additions & 9 deletions scanpy/testing/_pytest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from .fixtures import * # noqa: F403


doctest_env_marker = pytest.mark.usefixtures('doctest_env')
doctest_env_marker = pytest.mark.usefixtures("doctest_env")


# Defining it here because it’s autouse.
Expand All @@ -20,14 +20,14 @@ def global_test_context() -> Generator[None, None, None]:
from matplotlib import pyplot
from scanpy import settings

pyplot.switch_backend('agg')
pyplot.switch_backend("agg")
settings.logfile = sys.stderr
settings.verbosity = 'hint'
settings.verbosity = "hint"
settings.autoshow = True

yield

pyplot.close('all')
pyplot.close("all")


def pytest_addoption(parser: pytest.Parser) -> None:
Expand Down Expand Up @@ -65,25 +65,25 @@ def pytest_itemcollected(item: pytest.Item) -> None:
item.add_marker(doctest_env_marker)

func = _import_name(item.name)
if marker := getattr(func, '_doctest_mark', None):
if marker := getattr(func, "_doctest_mark", None):
item.add_marker(marker)
if skip_reason := getattr(func, '_doctest_skip_reason', False):
if skip_reason := getattr(func, "_doctest_skip_reason", False):
item.add_marker(pytest.mark.skip(reason=skip_reason))


def _import_name(name: str) -> Any:
from importlib import import_module

parts = name.split('.')
parts = name.split(".")
obj = import_module(parts[0])
for i, name in enumerate(parts[1:]):
try:
obj = import_module(f'{obj.__name__}.{name}')
obj = import_module(f"{obj.__name__}.{name}")
except ModuleNotFoundError:
break
for name in parts[i + 1 :]:
try:
obj = getattr(obj, name)
except AttributeError:
raise RuntimeError(f'{parts[:i]}, {parts[i+1:]}, {obj} {name}')
raise RuntimeError(f"{parts[:i]}, {parts[i+1:]}, {obj} {name}")
return obj
2 changes: 1 addition & 1 deletion scanpy/tools/_ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
ANNDATA_MIN_VERSION = version.parse("0.7rc1")


@doctest_skip('illustrative short example but not runnable')
@doctest_skip("illustrative short example but not runnable")
def ingest(
adata: AnnData,
adata_ref: AnnData,
Expand Down
2 changes: 1 addition & 1 deletion scanpy/tools/_marker_gene_overlap.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def _calc_jaccard(markers1: dict, markers2: dict):
_Method = Literal["overlap_count", "overlap_coef", "jaccard"]


@doctest_needs('leidenalg')
@doctest_needs("leidenalg")
def marker_gene_overlap(
adata: AnnData,
reference_markers: Union[Dict[str, set], Dict[str, list]],
Expand Down

0 comments on commit ad29ca5

Please sign in to comment.