Commit Graph

50 Commits

Author SHA1 Message Date
Takeshi KOMIYA
76e9f57c2e Merge branch '1.8' 2019-01-02 16:16:25 +09:00
Takeshi KOMIYA
1b1ebd2c75 A happy new year! 2019-01-02 16:00:30 +09:00
Jon Dufresne
bade33c7e4 Remove unnecessary encoding cookie from Python source files
In Python 3, the default encoding of source files is utf-8. The encoding
cookie is now unnecessary and redundant so remove it. For more details,
see the docs:

https://docs.python.org/3/howto/unicode.html#the-string-type

> The default encoding for Python source code is UTF-8, so you can
> simply include a Unicode character in a string literal ...

Includes a fix for the flake8 header checks to stop expecting an
encoding cookie.
2018-12-16 12:22:12 -08:00
Takeshi KOMIYA
8b687ac304 Merge branch '1.8' 2018-11-01 01:24:12 +09:00
Takeshi KOMIYA
793792fafc Fix #5480: autodoc: unable to find type hints for unresolvable Forward references 2018-10-15 23:40:05 +09:00
Takeshi KOMIYA
dc44b0d2a9 Merge branch 'master' into HEAD 2018-09-22 22:54:15 +09:00
Takeshi KOMIYA
3a2418a827 refactoring: Drop PY2 and PY3 flags 2018-09-22 21:27:59 +09:00
Takeshi KOMIYA
40a2fdf315 test: Merge py3/test_util_inspect_py3.py to test_util_inspect.py 2018-09-22 16:36:10 +09:00
Takeshi KOMIYA
b18fe13f55 Drop branches for sys.version_info < (3, 4) 2018-09-22 16:31:07 +09:00
Jon Dufresne
490e4aed41 Remove unnecessary object from class definitions
In Python 3, all classes are new-style classes. The object in the
definition is redundant and unnecessary.
2018-09-11 07:07:01 -07:00
Chris Lamb
17d32d625b Ensure frozenset object descriptions are reproducible
Whilst working on the Reproducible Builds effort [0], we noticed
that sphinx could generate output that is not reproducible.

In particular, the rendering of `frozenset` objects in default
arguments and elsewhere is currently non-determinstic.

For example:

    frozenset(['a', 'b', 'c'])

Might be rendered as any of:

    frozenset({'a', 'b', 'c'})
    frozenset({'a', 'c', 'b'})
    frozenset({'b', 'a', 'c'})
    frozenset({'b', 'c', 'a'})
    frozenset({'c', 'a', 'b'})
    frozenset({'c', 'b', 'a'})

Patch attached that sorts the contents of frozensets whilst rendering.
This is parallel to the `dict` and `set` type logic

  [0] https://reproducible-builds.org/
2018-09-05 15:58:54 +01:00
Takeshi KOMIYA
ea3d0b3768 Merge branch '1.7' into 1.8 2018-08-25 03:07:35 +09:00
Takeshi KOMIYA
520797a5e8 test: Upgrade python on Circle CI to 3.5 2018-08-25 02:53:17 +09:00
Takeshi KOMIYA
59a766d7d6 Fix #5322: autodoc: `Any` typehint causes formatting error 2018-08-22 19:57:27 +09:00
Takeshi KOMIYA
11331c5923 Merge branch '1.7' 2018-08-17 00:56:35 +09:00
Takeshi KOMIYA
91650d89c9 Fix #5291: autodoc crashed by ForwardRef types 2018-08-15 21:30:49 +09:00
Takeshi KOMIYA
955c3d388b test Signature annotations in py34 too 2018-08-15 01:22:52 +09:00
Takeshi KOMIYA
e26dc81272 Fix autodoc: Optional types are wrongly rendered 2018-08-15 01:22:52 +09:00
Terence D. Honles
da45604485 handle NoneType as None 2018-08-10 11:58:08 -07:00
Takeshi KOMIYA
3e57ea0a52 Merge branch '1.7' 2018-07-17 00:37:40 +09:00
Dmitry Shachnev
1e11634d51 Add a failing test for formatting Tuple[int, str, int] 2018-07-13 21:21:49 +03:00
Takeshi KOMIYA
71c0eb6b1a Merge branch '1.7' 2018-06-16 18:23:36 +09:00
Takeshi KOMIYA
6c4d6c3b94 Fix #5032: autodoc loses the first staticmethod parameter for old styled classes 2018-06-13 22:30:14 +09:00
Takeshi KOMIYA
057152e9e7 Merge branch '1.7' 2018-05-19 14:25:23 +09:00
Takeshi KOMIYA
b2abab1c45 Fix #4969: autodoc: constructor method should not have return annotation 2018-05-19 11:49:32 +09:00
Chris Lamb
0ffc27b7fa Ensure the set object description is reproducible.
Whilst working on the Reproducible Builds effort [0], we noticed
that sphinx could generate output that is not reproducible.

In particular, the rendering of `set` objects in default arguments
and elsewhere is currently non-determinstic. For example:

    class A_Class(object):
        a_set = {'a', 'b', 'c'}

Might be rendered as any of:

     {'a', 'b', 'c'}
     {'a', 'c', 'b'}
     {'b', 'a', 'c'}
     {'b', 'c', 'a'}
     {'c', 'a', 'b'}
     {'c', 'b', 'a'}

Patch attached that sorts the contents of sets whilst rendering.
This is parallel to the `dict` key sorting.

This was originally filed in Debian as #895553 [1].

 [0] https://reproducible-builds.org/
 [1] https://bugs.debian.org/895553

Signed-off-by: Chris Lamb <lamby@debian.org>
2018-04-14 10:30:54 +01:00
Takeshi KOMIYA
f7027049b1 Fix flake8 violations 2018-02-19 23:20:56 +09:00
Takeshi KOMIYA
656e3be754 Fix #4539: autodoc emits warnings for partialmethods 2018-02-04 23:23:43 +09:00
Takeshi KOMIYA
fd2425238e Fix #4490: autodoc: type annotation is broken with python 3.7.0a4+ 2018-01-27 12:26:53 +09:00
Takeshi KOMIYA
f779fa7ad6 Merge branch 'stable' into 1.7-release 2018-01-25 00:40:21 +09:00
Takeshi KOMIYA
7292386a03 Fix #3570: autodoc: Do not display typing. module for type hints 2018-01-13 12:08:31 +09:00
Takeshi KOMIYA
f1f6ca8cc9 Merge branch 'happy_new_year' into master 2018-01-01 01:09:17 +09:00
Takeshi KOMIYA
2426cedb8b A happy new year! 2018-01-01 01:06:58 +09:00
Takeshi KOMIYA
a9efb2517a Fix flake8 violations 2017-12-23 21:21:21 +09:00
Takeshi KOMIYA
f46c91b652 Merge branch 'stable' 2017-11-02 00:49:10 +09:00
Dmitry Shachnev
eb934cb665 Add a test for the previous change 2017-10-23 23:12:10 +03:00
Takeshi KOMIYA
8d34bc54dd Fix expected result 2017-06-17 19:45:38 +09:00
Takeshi KOMIYA
fd201666a2 Add bound_method hint to Signature class 2017-06-17 18:16:02 +09:00
Takeshi KOMIYA
4dcc35a649 Signature formats args of method correctly in py2 2017-06-17 15:07:31 +09:00
Takeshi KOMIYA
3be5eebd6b Add Signature class 2017-06-17 15:07:31 +09:00
Takeshi KOMIYA
66c957372d Add testcase for sphinx.util.inspect:getargspec() 2017-06-17 00:54:24 +09:00
Takeshi KOMIYA
94b31a2f07 Refactor test_util_inspect: Do not use unittest 2017-06-17 00:54:24 +09:00
Takeshi KOMIYA
5e65316459 Skip testcase for sphinx.util.inspect on 3.4.3
The inspect library of python-3.4.3 also can't handle wrapped
functions.
2017-05-09 23:24:25 +09:00
Takeshi KOMIYA
56d3458584 Fix flake8 violations 2017-05-09 21:57:36 +09:00
Takayuki SHIMIZUKAWA
6cb582fdd3 Merge pull request #3449 from njsmith/getargspec-__wrapped__
On py3, use inspect.signature for more accurate signature calculation
2017-04-19 21:21:19 +09:00
Takeshi KOMIYA
c57e47e042 Year++ 2017-03-26 11:49:34 +09:00
Nathaniel J. Smith
a3b80bc87a Make sure that getargspec raises on built-in types 2017-02-24 06:07:36 -08:00
Nathaniel J. Smith
b56d93158a On Py3, use inspect.signature for more accurate signature calculation
This improves handling of wrapped functions and bound methods.

It turns out that we no longer need to hack in support for
functools.partial; inspect.signature handles this automatically. Added
a test to make sure this didn't/doesn't regress.
2017-02-23 18:18:31 -08:00
Leo Huckvale
fa89582d57 Fix tests for Python 2.6 2016-07-14 16:41:33 +01:00
Leo Huckvale
670049c262 inspect: return defargs[0] if obj.__dict__ raises exception
The fallback implemented in #2731 cannot return `obj.__dict__[name]`
if the `__dict__` method has been redefined in such a way that it
raises an exception when trying to access it.

This commit adds a try-except block to work around this.
2016-07-14 14:13:06 +01:00