Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kwant
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michael Wimmer
kwant
Commits
5280260b
Commit
5280260b
authored
11 years ago
by
Christoph Groth
Browse files
Options
Downloads
Patches
Plain Diff
sphinxext: remove unnecessary module
parent
a85d4d70
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/sphinxext/numpydoc/linkcode.py
+0
-83
0 additions, 83 deletions
doc/sphinxext/numpydoc/linkcode.py
doc/sphinxext/numpydoc/tests/test_linkcode.py
+0
-5
0 additions, 5 deletions
doc/sphinxext/numpydoc/tests/test_linkcode.py
with
0 additions
and
88 deletions
doc/sphinxext/numpydoc/linkcode.py
deleted
100644 → 0
+
0
−
83
View file @
a85d4d70
# -*- coding: utf-8 -*-
"""
linkcode
~~~~~~~~
Add external links to module code in Python object descriptions.
:copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from
__future__
import
division
,
absolute_import
,
print_function
import
warnings
import
collections
warnings
.
warn
(
"
This extension has been accepted to Sphinx upstream.
"
"
Use the version from there (Sphinx >= 1.2)
"
"
https://bitbucket.org/birkenfeld/sphinx/pull-request/47/sphinxextlinkcode
"
,
FutureWarning
,
stacklevel
=
1
)
from
docutils
import
nodes
from
sphinx
import
addnodes
from
sphinx.locale
import
_
from
sphinx.errors
import
SphinxError
class
LinkcodeError
(
SphinxError
):
category
=
"
linkcode error
"
def
doctree_read
(
app
,
doctree
):
env
=
app
.
builder
.
env
resolve_target
=
getattr
(
env
.
config
,
'
linkcode_resolve
'
,
None
)
if
not
isinstance
(
env
.
config
.
linkcode_resolve
,
collections
.
Callable
):
raise
LinkcodeError
(
"
Function `linkcode_resolve` is not given in conf.py
"
)
domain_keys
=
dict
(
py
=
[
'
module
'
,
'
fullname
'
],
c
=
[
'
names
'
],
cpp
=
[
'
names
'
],
js
=
[
'
object
'
,
'
fullname
'
],
)
for
objnode
in
doctree
.
traverse
(
addnodes
.
desc
):
domain
=
objnode
.
get
(
'
domain
'
)
uris
=
set
()
for
signode
in
objnode
:
if
not
isinstance
(
signode
,
addnodes
.
desc_signature
):
continue
# Convert signode to a specified format
info
=
{}
for
key
in
domain_keys
.
get
(
domain
,
[]):
value
=
signode
.
get
(
key
)
if
not
value
:
value
=
''
info
[
key
]
=
value
if
not
info
:
continue
# Call user code to resolve the link
uri
=
resolve_target
(
domain
,
info
)
if
not
uri
:
# no source
continue
if
uri
in
uris
or
not
uri
:
# only one link per name, please
continue
uris
.
add
(
uri
)
onlynode
=
addnodes
.
only
(
expr
=
'
html
'
)
onlynode
+=
nodes
.
reference
(
''
,
''
,
internal
=
False
,
refuri
=
uri
)
onlynode
[
0
]
+=
nodes
.
inline
(
''
,
_
(
'
[source]
'
),
classes
=
[
'
viewcode-link
'
])
signode
+=
onlynode
def
setup
(
app
):
app
.
connect
(
'
doctree-read
'
,
doctree_read
)
app
.
add_config_value
(
'
linkcode_resolve
'
,
None
,
''
)
This diff is collapsed.
Click to expand it.
doc/sphinxext/numpydoc/tests/test_linkcode.py
deleted
100644 → 0
+
0
−
5
View file @
a85d4d70
from
__future__
import
division
,
absolute_import
,
print_function
import
numpydoc.linkcode
# No tests at the moment...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment