Skip to content

Commit 80cfa20

Browse files
committed
Remove unnecessary special handling for colons in paths.
1 parent 7de91c8 commit 80cfa20

File tree

1 file changed

+8
-21
lines changed

1 file changed

+8
-21
lines changed

doc/sphinxext/missing_references.py

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -95,41 +95,28 @@ def get_location(node, app):
9595
has injected text into the sphinx parsing engine).
9696
"""
9797
(path, line) = get_source_line(node)
98-
9998
if path:
100-
# sometimes the 'path' can contain ':' which are forbidden on
101-
# windows, but on posix just passes through.
102-
path, *post = path.partition(':')
103-
post = ''.join(post)
104-
# We locate references relative to the parent of the doc
105-
# directory, which for matplotlib, will be the root of the
106-
# matplotlib repo. When matplotlib is not an editable install
107-
# weird things will happen, but we can't totally recover from
108-
# that.
99+
# We locate references relative to the parent of the doc directory,
100+
# which for matplotlib, will be the root of the matplotlib repo. When
101+
# matplotlib is not an editable install weird things will happen, but
102+
# we can't totally recover from that.
109103
basepath = Path(app.srcdir).parent.resolve()
110-
111104
fullpath = Path(path).resolve()
112-
113105
try:
114106
path = fullpath.relative_to(basepath)
115107
except ValueError:
116-
# Sometimes docs directly contain e.g. docstrings
117-
# from installed modules, and we record those as
118-
# <external> so as to be independent of where the
119-
# module was installed
108+
# Sometimes docs directly contain e.g. docstrings from installed
109+
# modules, and we record those as <external> so as to be
110+
# independent of where the module was installed.
120111
path = Path("<external>") / fullpath.name
121-
122112
# Ensure that all reported paths are POSIX so that docs
123113
# on windows result in the same warnings in the JSON file.
124114
path = path.as_posix()
125-
126115
else:
127116
path = "<unknown>"
128-
post = ''
129117
if not line:
130118
line = ""
131-
132-
return f"{path}{post}:{line}"
119+
return f"{path}:{line}"
133120

134121

135122
def _truncate_location(location):

0 commit comments

Comments
 (0)