mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '1.7' into 5036_quickstart
This commit is contained in:
commit
3ac069ae57
2
CHANGES
2
CHANGES
@ -26,6 +26,8 @@ Bugs fixed
|
||||
* C++, fix lookup of full template specializations with no template arguments.
|
||||
* #4667: C++, fix assertion on missing references in global scope when using
|
||||
intersphinx. Thanks to Alan M. Carroll.
|
||||
* #5019: autodoc: crashed by Form Feed Character
|
||||
* #5032: autodoc: loses the first staticmethod parameter for old styled classes
|
||||
* #5036: quickstart: Typing Ctrl-U clears the whole of line
|
||||
|
||||
Testing
|
||||
|
1
EXAMPLES
1
EXAMPLES
@ -218,6 +218,7 @@ Documentation using sphinx_rtd_theme
|
||||
* peewee: http://docs.peewee-orm.com/
|
||||
* Phinx: http://docs.phinx.org/
|
||||
* phpMyAdmin: https://docs.phpmyadmin.net/
|
||||
* PROS: https://pros.cs.purdue.edu/v5/ (customized)
|
||||
* Pweave: http://mpastell.com/pweave/
|
||||
* PyPy: http://doc.pypy.org/
|
||||
* python-sqlparse: https://sqlparse.readthedocs.io/
|
||||
|
@ -374,7 +374,7 @@ There are also new config values that you can set:
|
||||
This value contains a list of modules to be mocked up. This is useful when
|
||||
some external dependencies are not met at build time and break the building
|
||||
process. You may only specify the root package of the dependencies
|
||||
themselves and ommit the sub-modules:
|
||||
themselves and omit the sub-modules:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
@ -92,7 +92,7 @@ Deprecated APIs
|
||||
|
||||
On developing Sphinx, we are always careful to the compatibility of our APIs.
|
||||
But, sometimes, the change of interface are needed for some reasons. In such
|
||||
cases, we've marked thme as deprecated. And they are kept during the two
|
||||
cases, we've marked them as deprecated. And they are kept during the two
|
||||
major versions (for more details, please see :ref:`deprecation-policy`).
|
||||
|
||||
The following is a list of deprecated interface.
|
||||
|
@ -34,6 +34,11 @@ else:
|
||||
ASSIGN_NODES = (ast.Assign)
|
||||
|
||||
|
||||
def filter_whitespace(code):
|
||||
# type: (unicode) -> unicode
|
||||
return code.replace('\f', ' ') # replace FF (form feed) with whitespace
|
||||
|
||||
|
||||
def get_assign_targets(node):
|
||||
# type: (ast.AST) -> List[ast.expr]
|
||||
"""Get list of targets from Assign and AnnAssign node."""
|
||||
@ -466,7 +471,7 @@ class Parser(object):
|
||||
|
||||
def __init__(self, code, encoding='utf-8'):
|
||||
# type: (unicode, unicode) -> None
|
||||
self.code = code
|
||||
self.code = filter_whitespace(code)
|
||||
self.encoding = encoding
|
||||
self.comments = {} # type: Dict[Tuple[unicode, unicode], unicode]
|
||||
self.deforders = {} # type: Dict[unicode, int]
|
||||
|
@ -176,8 +176,8 @@ def isstaticmethod(obj, cls=None, name=None):
|
||||
elif cls and name:
|
||||
# trace __mro__ if the method is defined in parent class
|
||||
#
|
||||
# .. note:: This only works with new style classes.
|
||||
for basecls in getattr(cls, '__mro__', []):
|
||||
# .. note:: This only works well with new style classes.
|
||||
for basecls in getattr(cls, '__mro__', [cls]):
|
||||
meth = basecls.__dict__.get(name)
|
||||
if meth:
|
||||
if isinstance(meth, staticmethod):
|
||||
|
@ -315,3 +315,12 @@ def test_decorators():
|
||||
'func3': ('def', 7, 9),
|
||||
'Foo': ('class', 11, 15),
|
||||
'Foo.method': ('def', 13, 15)}
|
||||
|
||||
|
||||
def test_formfeed_char():
|
||||
source = ('class Foo:\n'
|
||||
'\f\n'
|
||||
' attr = 1234 #: comment\n')
|
||||
parser = Parser(source)
|
||||
parser.parse()
|
||||
assert parser.comments == {('Foo', 'attr'): 'comment'}
|
||||
|
@ -362,3 +362,26 @@ def test_dict_customtype():
|
||||
description = inspect.object_description(dictionary)
|
||||
# Type is unsortable, just check that it does not crash
|
||||
assert "<CustomType(2)>: 2" in description
|
||||
|
||||
|
||||
def test_isstaticmethod():
|
||||
class Foo():
|
||||
@staticmethod
|
||||
def method1():
|
||||
pass
|
||||
|
||||
def method2(self):
|
||||
pass
|
||||
|
||||
class Bar(Foo):
|
||||
pass
|
||||
|
||||
assert inspect.isstaticmethod(Foo.method1, Foo, 'method1') is True
|
||||
assert inspect.isstaticmethod(Foo.method2, Foo, 'method2') is False
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
assert inspect.isstaticmethod(Bar.method1, Bar, 'method1') is False
|
||||
assert inspect.isstaticmethod(Bar.method2, Bar, 'method2') is False
|
||||
else:
|
||||
assert inspect.isstaticmethod(Bar.method1, Bar, 'method1') is True
|
||||
assert inspect.isstaticmethod(Bar.method2, Bar, 'method2') is False
|
||||
|
Loading…
Reference in New Issue
Block a user