From 40ed7d26333644a6769a01cca10e009b9dd960be Mon Sep 17 00:00:00 2001 From: Matthias Diener Date: Mon, 23 Dec 2024 11:12:41 +0100 Subject: [PATCH] simplify linkcode_resolve --- doc/conf.py | 9 ++++----- logpyle/__init__.py | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 0ca19ec..7ef7688 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -1,11 +1,10 @@ #!/usr/bin/env python3 -import sys from urllib.request import urlopen from logpyle import __version__ -sys._BUILDING_SPHINX_DOCS = True +# {{{ linkcode_resolve _conf_url = \ "https://raw.githubusercontent.com/inducer/sphinxconfig/main/sphinxconfig.py" @@ -15,12 +14,12 @@ old_linkcode_resolve = linkcode_resolve # noqa: F821 (linkcode_resolve comes from the URL above) -def lc(domain, info): +def linkcode_resolve(*args, **kwargs): linkcode_url = "https://github.com/illinois-ceesd/logpyle/blob/main/{filepath}#L{linestart}-L{linestop}" - return old_linkcode_resolve(domain, info, linkcode_url=linkcode_url) + return old_linkcode_resolve(*args, **kwargs, linkcode_url=linkcode_url) -linkcode_resolve = lc +# }}} # General information about the project. project = "logpyle" diff --git a/logpyle/__init__.py b/logpyle/__init__.py index 13d450c..ef21ca3 100644 --- a/logpyle/__init__.py +++ b/logpyle/__init__.py @@ -87,7 +87,7 @@ logger = logging.getLogger(__name__) -if TYPE_CHECKING and not getattr(sys, "_BUILDING_SPHINX_DOCS", False): +if TYPE_CHECKING: import mpi4py