Skip to content

Commit

Permalink
Backport PR scverse#1574 on branch 0.10.x ([pre-commit.ci] pre-commit…
Browse files Browse the repository at this point in the history
… autoupdate) (scverse#1575)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
meeseeksmachine and pre-commit-ci[bot] authored Aug 6, 2024
1 parent 74f96bc commit 0716bb7
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.5
rev: v0.5.6
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
Expand Down
37 changes: 37 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,40 @@ def setup(app: Sphinx):
"Miscellaneous",
)
]


def patch_sphinx_toolbox_autoprotocol():
"""Compat hack: https://github.com/sphinx-toolbox/sphinx-toolbox/issues/168"""

from sphinx.ext.autodoc import ObjectMember
from sphinx_toolbox.more_autodoc.autoprotocol import ProtocolDocumenter

if TYPE_CHECKING:
from typing import Self

class ObjectMemberCompat(ObjectMember):
@classmethod
def from_other(cls, other: ObjectMember) -> Self:
return cls(
other.__name__,
other.object,
docstring=other.docstring,
class_=other.class_,
skipped=other.skipped,
)

def __iter__(self):
return iter([self.__name__, self.object])

filter_orig = ProtocolDocumenter.filter_members

def filter_members(
self, members: list[ObjectMember], want_all: bool
) -> list[tuple[str, object, bool]]:
member_tuples = [ObjectMemberCompat.from_other(m) for m in members]
return filter_orig(self, member_tuples, want_all)

ProtocolDocumenter.filter_members = filter_members


patch_sphinx_toolbox_autoprotocol()
2 changes: 1 addition & 1 deletion docs/news.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Muon paper published {small}`2022-02-02`

Muon has been published in Genome Biology [^cite_bredikhin22].
Muon has been published in Genome Biology [Bredikhin22]_.
Muon is a framework for multimodal data built on top of `AnnData`.

Check out [Muon](https://muon.readthedocs.io/en/latest/) and its datastructure [MuData](https://mudata.readthedocs.io/en/latest/).
Expand Down

0 comments on commit 0716bb7

Please sign in to comment.