Commit Graph

133 Commits

Author SHA1 Message Date
Takeshi KOMIYA
53917f228f Move to py3 mode for mypy (and remove many "type: ignore" comments) 2018-12-15 02:42:42 +09:00
Takeshi KOMIYA
fcc53447a3 Fix annotations (in some modules) 2018-12-01 12:29:49 +09:00
Takeshi KOMIYA
3c99d00605 Add sphinx.util.typing:unicode to help mypy-3 migration 2018-11-24 23:19:51 +09:00
Jon Dufresne
b8631079bf Replace six.string_types with native str 2018-11-21 06:47:15 -08:00
Jon Dufresne
27a6787d63 Remove use of six.binary_type
Remove type checks for cases that don't apply to Python 3.

For remaining uses, use bytes instead
2018-11-11 19:09:47 -08:00
Takeshi KOMIYA
8b687ac304 Merge branch '1.8' 2018-11-01 01:24:12 +09:00
Takeshi KOMIYA
e7e07fd697 Merge branch '1.8' 2018-10-16 09:57:54 +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
b2cc425909 Fix #5498: autodoc: unable to find type hints for a `functools.partial` 2018-10-14 16:29:04 +09:00
Jon Dufresne
ce8227c6cf Replace all six.itervalues()/.iteritems() with .values()/.items() 2018-09-23 18:26:31 -07:00
Jon Dufresne
02d06bdaf0 Remove uses of six.moves that did not cause any type errors
Removal of the remaining imports may require passing "--python-version
3.5" to the mypy command.
2018-09-23 09:22:06 -07: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
b18fe13f55 Drop branches for sys.version_info < (3, 4) 2018-09-22 16:31:07 +09:00
Takeshi KOMIYA
02204db99f Merge branch '1.8' 2018-09-16 21:40:37 +09:00
Takeshi KOMIYA
c93ede5bc4 Fix typo 2018-09-14 22:36: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
18f107b0bc autodoc: Fix typing.get_type_hints() raises AttributeError for partial objects 2018-08-25 10:57:34 +09:00
Takeshi KOMIYA
ea3d0b3768 Merge branch '1.7' into 1.8 2018-08-25 03:07:35 +09:00
Takeshi KOMIYA
59a766d7d6 Fix #5322: autodoc: `Any` typehint causes formatting error 2018-08-22 19:57:27 +09:00
Takeshi KOMIYA
7f52ef7512 Merge branch '1.7' 2018-08-19 02:19:06 +09:00
Takeshi KOMIYA
7975d73a17 Fix #5306: autodoc: emit a warning for invalid typehints 2018-08-17 10:39:02 +09:00
Takeshi KOMIYA
c4fa1aed34 Fix #5211: autodoc: No docs generated for functools.partial functions 2018-08-17 01:24:19 +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
cc3de81deb Fix mypy annotations 2018-08-15 11:39:54 +09:00
Takeshi KOMIYA
5a0f0bdc61 refactor: format_annotation() 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
Terence Honles
742c89f99b change format_args to prefer annotations from typing.get_type_hints
The current code looks for the pattern::

    class Node:
        def parent(self) -> 'Node': pass

This change allows more complex forward references::

    class Node:
        def children(self) -> Set['Node']: pass
2018-08-10 11:58:08 -07:00
Takeshi KOMIYA
3e57ea0a52 Merge branch '1.7' 2018-07-17 00:37:40 +09:00
Takeshi KOMIYA
9734bf5a77
Merge pull request #5167 from mitya57/long-tuples
Fix formatting type annotations for tuples with more than two arguments
2018-07-16 15:17:17 +09:00
Takeshi KOMIYA
62dbe44858 Fix #5143: autodoc: crashed on inspecting dict like object 2018-07-15 18:12:03 +09:00
Takeshi KOMIYA
9bc2a93d36
Merge pull request #5170 from tk0miya/5143_autodoc_crashed_on_inspecting
Fix #5143: autodoc: crashed on inspecting dict like object
2018-07-15 18:10:21 +09:00
Takeshi KOMIYA
2d7fe69362 Fix #5143: autodoc: crashed on inspecting dict like object 2018-07-15 15:44:31 +09:00
Dmitry Shachnev
432f8c5b1c inspect: Handle Tuple type as a special case 2018-07-13 21:37:47 +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
Takeshi KOMIYA
c0c9a41400
Merge pull request #4834 from lamby/895553-sphinx-please-make-the-set-object-description-reproducible
Ensure set object descriptions are reproducible.
2018-04-14 21:15:19 +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
Chris Lamb
3231676936 Call object_description recursively for dict keys and values. 2018-04-14 10:00:50 +01:00
Takeshi KOMIYA
af4647c492 Merge branch '1.7' 2018-04-14 15:43:38 +09:00
Takeshi KOMIYA
aefb3bbaaa Fix #4543: testcase for partialmethod is failed with py3.6.5 2018-04-08 21:54:00 +09:00
Takeshi KOMIYA
9efaf18852 Merge branch '1.7' 2018-03-18 01:21:01 +09:00
Takeshi KOMIYA
70a622b86c Revert "Use typing.TYPE_CHECKING for typehints"
This reverts commit a073e17537.
2018-03-13 23:23:15 +09:00
Takeshi KOMIYA
e2f481c956 Merge branch '1.7' 2018-03-03 20:03:45 +09:00
Takeshi KOMIYA
fd89be7f0f Fix mypy violations 2018-03-03 14:56:46 +09:00