Skip to content

Commit

Permalink
simplify linkcode_resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasdiener committed Dec 23, 2024
1 parent e336900 commit 40ed7d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion logpyle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@

logger = logging.getLogger(__name__)

if TYPE_CHECKING and not getattr(sys, "_BUILDING_SPHINX_DOCS", False):
if TYPE_CHECKING:
import mpi4py


Expand Down

0 comments on commit 40ed7d2

Please sign in to comment.