Skip to content

Commit

Permalink
Merge branch '1.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
tk0miya committed Aug 24, 2018
2 parents 3dcbe14 + ea3d0b3 commit 0a99a58
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 20 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ jobs:
working_directory: /sphinx
steps:
- checkout
- run: /python3.4/bin/pip install -U pip setuptools
- run: /python3.4/bin/pip install -U .[test,websupport]
- run: make test PYTHON=/python3.4/bin/python
- run: /python3.5/bin/pip install -U pip setuptools
- run: /python3.5/bin/pip install -U .[test,websupport]
- run: make test PYTHON=/python3.5/bin/python
7 changes: 7 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ Features added
Bugs fixed
----------

* html: search box overrides to other elements if scrolled
* #5325: latex: cross references has been broken by multiply labeled objects

Testing
--------

Expand Down Expand Up @@ -307,6 +310,10 @@ Features added
Bugs fixed
----------

* #5320: intersphinx: crashed if invalid url given
* #5326: manpage: crashed when invalid docname is specified as ``man_pages``
* #5322: autodoc: ``Any`` typehint causes formatting error

Testing
--------

Expand Down
2 changes: 1 addition & 1 deletion doc/usage/extensions/autodoc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ There are also new config values that you can set:
.. confval:: autodoc_default_options

The default options for autodoc directives. They are applied to all autodoc
directives automatically. It must be a dictionally which maps option names
directives automatically. It must be a dictionary which maps option names
to the values. For example::

autodoc_default_options = {
Expand Down
4 changes: 4 additions & 0 deletions sphinx/builders/manpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ def write(self, *ignored):

for info in self.config.man_pages:
docname, name, description, authors, section = info
if docname not in self.env.all_docs:
logger.warning(__('"man_pages" config value references unknown '
'document %s'), docname)
continue
if isinstance(authors, string_types):
if authors:
authors = [authors]
Expand Down
4 changes: 1 addition & 3 deletions sphinx/ext/graphviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ def run(self):
line=self.lineno)]
node = graphviz()
node['code'] = dotcode
node['options'] = {
'docname': path.splitext(self.state.document.current_source)[0],
}
node['options'] = {'docname': self.env.docname}

if 'graphviz_dot' in self.options:
node['options']['graphviz_dot'] = self.options['graphviz_dot']
Expand Down
21 changes: 13 additions & 8 deletions sphinx/ext/intersphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,14 +410,19 @@ def warn(self, msg):
# type: (unicode) -> None
print(msg, file=sys.stderr)

filename = argv[0]
invdata = fetch_inventory(MockApp(), '', filename) # type: ignore
for key in sorted(invdata or {}):
print(key)
for entry, einfo in sorted(invdata[key].items()):
print('\t%-40s %s%s' % (entry,
einfo[3] != '-' and '%-40s: ' % einfo[3] or '',
einfo[2]))
try:
filename = argv[0]
invdata = fetch_inventory(MockApp(), '', filename) # type: ignore
for key in sorted(invdata or {}):
print(key)
for entry, einfo in sorted(invdata[key].items()):
print('\t%-40s %s%s' % (entry,
einfo[3] != '-' and '%-40s: ' % einfo[3] or '',
einfo[2]))
except ValueError as exc:
print(exc.args[0] % exc.args[1:])
except Exception as exc:
print('Unknown error: %r' % exc)


if __name__ == '__main__':
Expand Down
4 changes: 4 additions & 0 deletions sphinx/themes/basic/static/basic.css_t
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ div.sphinxsidebar input {
font-size: 1em;
}

div.sphinxsidebar #searchbox form.search {
overflow: hidden;
}

div.sphinxsidebar #searchbox input[type="text"] {
float: left;
width: 80%;
Expand Down
4 changes: 3 additions & 1 deletion sphinx/util/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,10 @@ def format_annotation_old(self, annotation):
qualname = annotation.__qualname__
elif getattr(annotation, '__forward_arg__', None):
qualname = annotation.__forward_arg__
else:
elif getattr(annotation, '__origin__', None):
qualname = self.format_annotation(annotation.__origin__) # ex. Union
else:
qualname = repr(annotation).replace('typing.', '')
elif hasattr(annotation, '__qualname__'):
qualname = '%s.%s' % (module, annotation.__qualname__)
else:
Expand Down
5 changes: 4 additions & 1 deletion sphinx/writers/latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -1858,8 +1858,11 @@ def add_target(id):
self.body.append(self.hypertarget(id, anchor=anchor))

# skip if visitor for next node supports hyperlink
next_node = node
while isinstance(next_node, nodes.target):
next_node = next_node.next_node(ascend=True)

domain = self.builder.env.get_domain('std')
next_node = node.next_node(ascend=True)
if isinstance(next_node, HYPERLINK_SUPPORT_NODES):
return
elif domain.get_enumerable_node_type(next_node) and domain.get_numfig_title(next_node):
Expand Down
11 changes: 9 additions & 2 deletions tests/test_util_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def meth2(self, arg1, arg2):
reason='type annotation test is available on py34 or above')
def test_Signature_annotations():
from typing_test_data import (
f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, Node)
f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, Node)

# Class annotations
sig = inspect.Signature(f0).format_args()
Expand Down Expand Up @@ -293,9 +293,16 @@ def test_Signature_annotations():
sig = inspect.Signature(f13).format_args()
assert sig == '() -> Optional[str]'

# Any
sig = inspect.Signature(f14).format_args()
assert sig == '() -> Any'

# type hints by string
sig = inspect.Signature(Node.children).format_args()
assert sig == '(self) -> List[typing_test_data.Node]'
if (3, 5, 0) <= sys.version_info < (3, 5, 3):
assert sig == '(self) -> List[Node]'
else:
assert sig == '(self) -> List[typing_test_data.Node]'

sig = inspect.Signature(Node.__init__).format_args()
assert sig == '(self, parent: Optional[Node]) -> None'
Expand Down
6 changes: 5 additions & 1 deletion tests/typing_test_data.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from numbers import Integral
from typing import List, TypeVar, Union, Callable, Tuple, Optional
from typing import Any, List, TypeVar, Union, Callable, Tuple, Optional


def f0(x: int, y: Integral) -> None:
Expand Down Expand Up @@ -72,6 +72,10 @@ def f13() -> Optional[str]:
pass


def f14() -> Any:
pass


class Node:
def __init__(self, parent: Optional['Node']) -> None:
pass
Expand Down

0 comments on commit 0a99a58

Please sign in to comment.