Gentoo Archives: gentoo-commits

From: Andrew Ammerlaan <andrewammerlaan@××××××.net>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/guru:master commit in: dev-python/sphinx-autodoc-typehints/, dev-python/sphinx-autodoc-typehints/files/
Date: Mon, 09 Mar 2020 17:55:33
Message-Id: 1583775755.2402a53b05ba2aa1e4e785385c0cb580b44e183c.andrewammerlaan@gentoo
1 commit: 2402a53b05ba2aa1e4e785385c0cb580b44e183c
2 Author: Andrew Ammerlaan <andrewammerlaan <AT> riseup <DOT> net>
3 AuthorDate: Mon Mar 9 17:42:35 2020 +0000
4 Commit: Andrew Ammerlaan <andrewammerlaan <AT> riseup <DOT> net>
5 CommitDate: Mon Mar 9 17:42:35 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=2402a53b
7
8 dev-python/sphinx-autodoc-typehints: replace patch with sed lines
9
10 Package-Manager: Portage-2.3.93, Repoman-2.3.20
11 Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> riseup.net>
12
13 ...utodoc-typehints-1.10.3-skip-online-tests.patch | 772 ---------------------
14 .../sphinx-autodoc-typehints-1.10.3.ebuild | 14 +-
15 2 files changed, 13 insertions(+), 773 deletions(-)
16
17 diff --git a/dev-python/sphinx-autodoc-typehints/files/sphinx-autodoc-typehints-1.10.3-skip-online-tests.patch b/dev-python/sphinx-autodoc-typehints/files/sphinx-autodoc-typehints-1.10.3-skip-online-tests.patch
18 deleted file mode 100644
19 index c5a1e6e..0000000
20 --- a/dev-python/sphinx-autodoc-typehints/files/sphinx-autodoc-typehints-1.10.3-skip-online-tests.patch
21 +++ /dev/null
22 @@ -1,772 +0,0 @@
23 -diff --git a/tests/test_sphinx_autodoc_typehints.py b/tests/test_sphinx_autodoc_typehints.py
24 -index 4287385..75bcf20 100644
25 ---- a/tests/test_sphinx_autodoc_typehints.py
26 -+++ b/tests/test_sphinx_autodoc_typehints.py
27 -@@ -58,142 +58,142 @@ class Metaclass(type):
28 - pass
29 -
30 -
31 --@×××××××××××.parametrize('annotation, module, class_name, args', [
32 -- pytest.param(str, 'builtins', 'str', (), id='str'),
33 -- pytest.param(None, 'builtins', 'None', (), id='None'),
34 -- pytest.param(Any, 'typing', 'Any', (), id='Any'),
35 -- pytest.param(AnyStr, 'typing', 'AnyStr', (), id='AnyStr'),
36 -- pytest.param(Dict, 'typing', 'Dict', (), id='Dict'),
37 -- pytest.param(Dict[str, int], 'typing', 'Dict', (str, int), id='Dict_parametrized'),
38 -- pytest.param(Dict[T, int], 'typing', 'Dict', (T, int), id='Dict_typevar'),
39 -- pytest.param(Tuple, 'typing', 'Tuple', (), id='Tuple'),
40 -- pytest.param(Tuple[str, int], 'typing', 'Tuple', (str, int), id='Tuple_parametrized'),
41 -- pytest.param(Union[str, int], 'typing', 'Union', (str, int), id='Union'),
42 -- pytest.param(Callable, 'typing', 'Callable', (), id='Callable'),
43 -- pytest.param(Callable[..., str], 'typing', 'Callable', (..., str), id='Callable_returntype'),
44 -- pytest.param(Callable[[int, str], str], 'typing', 'Callable', (int, str, str),
45 -- id='Callable_all_types'),
46 -- pytest.param(Pattern, 'typing', 'Pattern', (), id='Pattern'),
47 -- pytest.param(Pattern[str], 'typing', 'Pattern', (str,), id='Pattern_parametrized'),
48 -- pytest.param(Match, 'typing', 'Match', (), id='Match'),
49 -- pytest.param(Match[str], 'typing', 'Match', (str,), id='Match_parametrized'),
50 -- pytest.param(IO, 'typing', 'IO', (), id='IO'),
51 -- pytest.param(W, 'typing', 'NewType', (str,), id='W'),
52 -- pytest.param(Metaclass, __name__, 'Metaclass', (), id='Metaclass'),
53 -- pytest.param(Slotted, __name__, 'Slotted', (), id='Slotted'),
54 -- pytest.param(A, __name__, 'A', (), id='A'),
55 -- pytest.param(B, __name__, 'B', (), id='B'),
56 -- pytest.param(C, __name__, 'C', (), id='C'),
57 -- pytest.param(D, __name__, 'D', (), id='D'),
58 -- pytest.param(E, __name__, 'E', (), id='E'),
59 -- pytest.param(E[int], __name__, 'E', (int,), id='E_parametrized'),
60 -- pytest.param(A.Inner, __name__, 'A.Inner', (), id='Inner')
61 --])
62 --def test_parse_annotation(annotation, module, class_name, args):
63 -- assert get_annotation_module(annotation) == module
64 -- assert get_annotation_class_name(annotation, module) == class_name
65 -- assert get_annotation_args(annotation, module, class_name) == args
66 --
67 --
68 --@×××××××××××.parametrize('annotation, expected_result', [
69 -- (str, ':py:class:`str`'),
70 -- (int, ':py:class:`int`'),
71 -- (type(None), '``None``'),
72 -- (type, ':py:class:`type`'),
73 -- (Type, ':py:class:`~typing.Type`'),
74 -- (Type[A], ':py:class:`~typing.Type`\\[:py:class:`~%s.A`]' % __name__),
75 -- (Any, ':py:data:`~typing.Any`'),
76 -- (AnyStr, ':py:data:`~typing.AnyStr`'),
77 -- (Generic[T], ':py:class:`~typing.Generic`\\[\\~T]'),
78 -- (Mapping, ':py:class:`~typing.Mapping`'),
79 -- (Mapping[T, int], ':py:class:`~typing.Mapping`\\[\\~T, :py:class:`int`]'),
80 -- (Mapping[str, V], ':py:class:`~typing.Mapping`\\[:py:class:`str`, \\-V]'),
81 -- (Mapping[T, U], ':py:class:`~typing.Mapping`\\[\\~T, \\+U]'),
82 -- (Mapping[str, bool], ':py:class:`~typing.Mapping`\\[:py:class:`str`, '
83 -- ':py:class:`bool`]'),
84 -- (Dict, ':py:class:`~typing.Dict`'),
85 -- (Dict[T, int], ':py:class:`~typing.Dict`\\[\\~T, :py:class:`int`]'),
86 -- (Dict[str, V], ':py:class:`~typing.Dict`\\[:py:class:`str`, \\-V]'),
87 -- (Dict[T, U], ':py:class:`~typing.Dict`\\[\\~T, \\+U]'),
88 -- (Dict[str, bool], ':py:class:`~typing.Dict`\\[:py:class:`str`, '
89 -- ':py:class:`bool`]'),
90 -- (Tuple, ':py:data:`~typing.Tuple`'),
91 -- (Tuple[str, bool], ':py:data:`~typing.Tuple`\\[:py:class:`str`, '
92 -- ':py:class:`bool`]'),
93 -- (Tuple[int, int, int], ':py:data:`~typing.Tuple`\\[:py:class:`int`, '
94 -- ':py:class:`int`, :py:class:`int`]'),
95 -- (Tuple[str, ...], ':py:data:`~typing.Tuple`\\[:py:class:`str`, ...]'),
96 -- (Union, ':py:data:`~typing.Union`'),
97 -- (Union[str, bool], ':py:data:`~typing.Union`\\[:py:class:`str`, '
98 -- ':py:class:`bool`]'),
99 -- pytest.param(Union[str, Any], ':py:data:`~typing.Union`\\[:py:class:`str`, '
100 -- ':py:data:`~typing.Any`]',
101 -- marks=pytest.mark.skipif((3, 5, 0) <= sys.version_info[:3] <= (3, 5, 2),
102 -- reason='Union erases the str on 3.5.0 -> 3.5.2')),
103 -- (Optional[str], ':py:data:`~typing.Optional`\\[:py:class:`str`]'),
104 -- (Callable, ':py:data:`~typing.Callable`'),
105 -- (Callable[..., int], ':py:data:`~typing.Callable`\\[..., :py:class:`int`]'),
106 -- (Callable[[int], int], ':py:data:`~typing.Callable`\\[\\[:py:class:`int`], '
107 -- ':py:class:`int`]'),
108 -- (Callable[[int, str], bool], ':py:data:`~typing.Callable`\\[\\[:py:class:`int`, '
109 -- ':py:class:`str`], :py:class:`bool`]'),
110 -- (Callable[[int, str], None], ':py:data:`~typing.Callable`\\[\\[:py:class:`int`, '
111 -- ':py:class:`str`], ``None``]'),
112 -- (Callable[[T], T], ':py:data:`~typing.Callable`\\[\\[\\~T], \\~T]'),
113 -- (Pattern, ':py:class:`~typing.Pattern`'),
114 -- (Pattern[str], ':py:class:`~typing.Pattern`\\[:py:class:`str`]'),
115 -- (IO, ':py:class:`~typing.IO`'),
116 -- (Metaclass, ':py:class:`~%s.Metaclass`' % __name__),
117 -- (A, ':py:class:`~%s.A`' % __name__),
118 -- (B, ':py:class:`~%s.B`' % __name__),
119 -- (B[int], ':py:class:`~%s.B`\\[:py:class:`int`]' % __name__),
120 -- (C, ':py:class:`~%s.C`' % __name__),
121 -- (D, ':py:class:`~%s.D`' % __name__),
122 -- (E, ':py:class:`~%s.E`' % __name__),
123 -- (E[int], ':py:class:`~%s.E`\\[:py:class:`int`]' % __name__),
124 -- (W, ':py:func:`~typing.NewType`\\(:py:data:`~W`, :py:class:`str`)')
125 --])
126 --def test_format_annotation(inv, annotation, expected_result):
127 -- result = format_annotation(annotation)
128 -- assert result == expected_result
129 --
130 -- # Test with the "fully_qualified" flag turned on
131 -- if 'typing' in expected_result or __name__ in expected_result:
132 -- expected_result = expected_result.replace('~typing', 'typing')
133 -- expected_result = expected_result.replace('~' + __name__, __name__)
134 -- assert format_annotation(annotation, fully_qualified=True) == expected_result
135 --
136 -- # Test for the correct role (class vs data) using the official Sphinx inventory
137 -- if 'typing' in expected_result:
138 -- m = re.match('^:py:(?P<role>class|data|func):`~(?P<name>[^`]+)`', result)
139 -- assert m, 'No match'
140 -- name = m.group('name')
141 -- expected_role = next((o.role for o in inv.objects if o.name == name), None)
142 -- if expected_role:
143 -- if expected_role == 'function':
144 -- expected_role = 'func'
145 --
146 -- assert m.group('role') == expected_role
147 --
148 --
149 --@×××××××××××.parametrize('library', [typing, typing_extensions],
150 -- ids=['typing', 'typing_extensions'])
151 --@×××××××××××.parametrize('annotation, params, expected_result', [
152 -- ('ClassVar', int, ":py:data:`~typing.ClassVar`\\[:py:class:`int`]"),
153 -- ('NoReturn', None, ":py:data:`~typing.NoReturn`"),
154 -- ('Literal', ('a', 1), ":py:data:`~typing.Literal`\\['a', 1]"),
155 -- ('Type', None, ':py:class:`~typing.Type`'),
156 -- ('Type', (A,), ':py:class:`~typing.Type`\\[:py:class:`~%s.A`]' % __name__)
157 --])
158 --def test_format_annotation_both_libs(inv, library, annotation, params, expected_result):
159 -- try:
160 -- annotation_cls = getattr(library, annotation)
161 -- except AttributeError:
162 -- pytest.skip('{} not available in the {} module'.format(annotation, library.__name__))
163 --
164 -- ann = annotation_cls if params is None else annotation_cls[params]
165 -- result = format_annotation(ann)
166 -- assert result == expected_result
167 -+# @pytest.mark.parametrize('annotation, module, class_name, args', [
168 -+# pytest.param(str, 'builtins', 'str', (), id='str'),
169 -+# pytest.param(None, 'builtins', 'None', (), id='None'),
170 -+# pytest.param(Any, 'typing', 'Any', (), id='Any'),
171 -+# pytest.param(AnyStr, 'typing', 'AnyStr', (), id='AnyStr'),
172 -+# pytest.param(Dict, 'typing', 'Dict', (), id='Dict'),
173 -+# pytest.param(Dict[str, int], 'typing', 'Dict', (str, int), id='Dict_parametrized'),
174 -+# pytest.param(Dict[T, int], 'typing', 'Dict', (T, int), id='Dict_typevar'),
175 -+# pytest.param(Tuple, 'typing', 'Tuple', (), id='Tuple'),
176 -+# pytest.param(Tuple[str, int], 'typing', 'Tuple', (str, int), id='Tuple_parametrized'),
177 -+# pytest.param(Union[str, int], 'typing', 'Union', (str, int), id='Union'),
178 -+# pytest.param(Callable, 'typing', 'Callable', (), id='Callable'),
179 -+# pytest.param(Callable[..., str], 'typing', 'Callable', (..., str), id='Callable_returntype'),
180 -+# pytest.param(Callable[[int, str], str], 'typing', 'Callable', (int, str, str),
181 -+# id='Callable_all_types'),
182 -+# pytest.param(Pattern, 'typing', 'Pattern', (), id='Pattern'),
183 -+# pytest.param(Pattern[str], 'typing', 'Pattern', (str,), id='Pattern_parametrized'),
184 -+# pytest.param(Match, 'typing', 'Match', (), id='Match'),
185 -+# pytest.param(Match[str], 'typing', 'Match', (str,), id='Match_parametrized'),
186 -+# pytest.param(IO, 'typing', 'IO', (), id='IO'),
187 -+# pytest.param(W, 'typing', 'NewType', (str,), id='W'),
188 -+# pytest.param(Metaclass, __name__, 'Metaclass', (), id='Metaclass'),
189 -+# pytest.param(Slotted, __name__, 'Slotted', (), id='Slotted'),
190 -+# pytest.param(A, __name__, 'A', (), id='A'),
191 -+# pytest.param(B, __name__, 'B', (), id='B'),
192 -+# pytest.param(C, __name__, 'C', (), id='C'),
193 -+# pytest.param(D, __name__, 'D', (), id='D'),
194 -+# pytest.param(E, __name__, 'E', (), id='E'),
195 -+# pytest.param(E[int], __name__, 'E', (int,), id='E_parametrized'),
196 -+# pytest.param(A.Inner, __name__, 'A.Inner', (), id='Inner')
197 -+# ])
198 -+# def test_parse_annotation(annotation, module, class_name, args):
199 -+# assert get_annotation_module(annotation) == module
200 -+# assert get_annotation_class_name(annotation, module) == class_name
201 -+# assert get_annotation_args(annotation, module, class_name) == args
202 -+
203 -+
204 -+# @pytest.mark.parametrize('annotation, expected_result', [
205 -+# (str, ':py:class:`str`'),
206 -+# (int, ':py:class:`int`'),
207 -+# (type(None), '``None``'),
208 -+# (type, ':py:class:`type`'),
209 -+# (Type, ':py:class:`~typing.Type`'),
210 -+# (Type[A], ':py:class:`~typing.Type`\\[:py:class:`~%s.A`]' % __name__),
211 -+# (Any, ':py:data:`~typing.Any`'),
212 -+# (AnyStr, ':py:data:`~typing.AnyStr`'),
213 -+# (Generic[T], ':py:class:`~typing.Generic`\\[\\~T]'),
214 -+# (Mapping, ':py:class:`~typing.Mapping`'),
215 -+# (Mapping[T, int], ':py:class:`~typing.Mapping`\\[\\~T, :py:class:`int`]'),
216 -+# (Mapping[str, V], ':py:class:`~typing.Mapping`\\[:py:class:`str`, \\-V]'),
217 -+# (Mapping[T, U], ':py:class:`~typing.Mapping`\\[\\~T, \\+U]'),
218 -+# (Mapping[str, bool], ':py:class:`~typing.Mapping`\\[:py:class:`str`, '
219 -+# ':py:class:`bool`]'),
220 -+# (Dict, ':py:class:`~typing.Dict`'),
221 -+# (Dict[T, int], ':py:class:`~typing.Dict`\\[\\~T, :py:class:`int`]'),
222 -+# (Dict[str, V], ':py:class:`~typing.Dict`\\[:py:class:`str`, \\-V]'),
223 -+# (Dict[T, U], ':py:class:`~typing.Dict`\\[\\~T, \\+U]'),
224 -+# (Dict[str, bool], ':py:class:`~typing.Dict`\\[:py:class:`str`, '
225 -+# ':py:class:`bool`]'),
226 -+# (Tuple, ':py:data:`~typing.Tuple`'),
227 -+# (Tuple[str, bool], ':py:data:`~typing.Tuple`\\[:py:class:`str`, '
228 -+# ':py:class:`bool`]'),
229 -+# (Tuple[int, int, int], ':py:data:`~typing.Tuple`\\[:py:class:`int`, '
230 -+# ':py:class:`int`, :py:class:`int`]'),
231 -+# (Tuple[str, ...], ':py:data:`~typing.Tuple`\\[:py:class:`str`, ...]'),
232 -+# (Union, ':py:data:`~typing.Union`'),
233 -+# (Union[str, bool], ':py:data:`~typing.Union`\\[:py:class:`str`, '
234 -+# ':py:class:`bool`]'),
235 -+# pytest.param(Union[str, Any], ':py:data:`~typing.Union`\\[:py:class:`str`, '
236 -+# ':py:data:`~typing.Any`]',
237 -+# marks=pytest.mark.skipif((3, 5, 0) <= sys.version_info[:3] <= (3, 5, 2),
238 -+# reason='Union erases the str on 3.5.0 -> 3.5.2')),
239 -+# (Optional[str], ':py:data:`~typing.Optional`\\[:py:class:`str`]'),
240 -+# (Callable, ':py:data:`~typing.Callable`'),
241 -+# (Callable[..., int], ':py:data:`~typing.Callable`\\[..., :py:class:`int`]'),
242 -+# (Callable[[int], int], ':py:data:`~typing.Callable`\\[\\[:py:class:`int`], '
243 -+# ':py:class:`int`]'),
244 -+# (Callable[[int, str], bool], ':py:data:`~typing.Callable`\\[\\[:py:class:`int`, '
245 -+# ':py:class:`str`], :py:class:`bool`]'),
246 -+# (Callable[[int, str], None], ':py:data:`~typing.Callable`\\[\\[:py:class:`int`, '
247 -+# ':py:class:`str`], ``None``]'),
248 -+# (Callable[[T], T], ':py:data:`~typing.Callable`\\[\\[\\~T], \\~T]'),
249 -+# (Pattern, ':py:class:`~typing.Pattern`'),
250 -+# (Pattern[str], ':py:class:`~typing.Pattern`\\[:py:class:`str`]'),
251 -+# (IO, ':py:class:`~typing.IO`'),
252 -+# (Metaclass, ':py:class:`~%s.Metaclass`' % __name__),
253 -+# (A, ':py:class:`~%s.A`' % __name__),
254 -+# (B, ':py:class:`~%s.B`' % __name__),
255 -+# (B[int], ':py:class:`~%s.B`\\[:py:class:`int`]' % __name__),
256 -+# (C, ':py:class:`~%s.C`' % __name__),
257 -+# (D, ':py:class:`~%s.D`' % __name__),
258 -+# (E, ':py:class:`~%s.E`' % __name__),
259 -+# (E[int], ':py:class:`~%s.E`\\[:py:class:`int`]' % __name__),
260 -+# (W, ':py:func:`~typing.NewType`\\(:py:data:`~W`, :py:class:`str`)')
261 -+# ])
262 -+# def test_format_annotation(inv, annotation, expected_result):
263 -+# result = format_annotation(annotation)
264 -+# assert result == expected_result
265 -+
266 -+# # Test with the "fully_qualified" flag turned on
267 -+# if 'typing' in expected_result or __name__ in expected_result:
268 -+# expected_result = expected_result.replace('~typing', 'typing')
269 -+# expected_result = expected_result.replace('~' + __name__, __name__)
270 -+# assert format_annotation(annotation, fully_qualified=True) == expected_result
271 -+
272 -+# # Test for the correct role (class vs data) using the official Sphinx inventory
273 -+# if 'typing' in expected_result:
274 -+# m = re.match('^:py:(?P<role>class|data|func):`~(?P<name>[^`]+)`', result)
275 -+# assert m, 'No match'
276 -+# name = m.group('name')
277 -+# expected_role = next((o.role for o in inv.objects if o.name == name), None)
278 -+# if expected_role:
279 -+# if expected_role == 'function':
280 -+# expected_role = 'func'
281 -+
282 -+# assert m.group('role') == expected_role
283 -+
284 -+
285 -+# @pytest.mark.parametrize('library', [typing, typing_extensions],
286 -+# ids=['typing', 'typing_extensions'])
287 -+# @pytest.mark.parametrize('annotation, params, expected_result', [
288 -+# ('ClassVar', int, ":py:data:`~typing.ClassVar`\\[:py:class:`int`]"),
289 -+# ('NoReturn', None, ":py:data:`~typing.NoReturn`"),
290 -+# ('Literal', ('a', 1), ":py:data:`~typing.Literal`\\['a', 1]"),
291 -+# ('Type', None, ':py:class:`~typing.Type`'),
292 -+# ('Type', (A,), ':py:class:`~typing.Type`\\[:py:class:`~%s.A`]' % __name__)
293 -+# ])
294 -+# def test_format_annotation_both_libs(inv, library, annotation, params, expected_result):
295 -+# try:
296 -+# annotation_cls = getattr(library, annotation)
297 -+# except AttributeError:
298 -+# pytest.skip('{} not available in the {} module'.format(annotation, library.__name__))
299 -+
300 -+# ann = annotation_cls if params is None else annotation_cls[params]
301 -+# result = format_annotation(ann)
302 -+# assert result == expected_result
303 -
304 -
305 - def test_process_docstring_slot_wrapper():
306 -@@ -202,304 +202,304 @@ def test_process_docstring_slot_wrapper():
307 - assert not lines
308 -
309 -
310 --@×××××××××××.parametrize('always_document_param_types', [True, False])
311 --@×××××××××××.sphinx('text', testroot='dummy')
312 --def test_sphinx_output(app, status, warning, always_document_param_types):
313 -- test_path = pathlib.Path(__file__).parent
314 -+# @pytest.mark.parametrize('always_document_param_types', [True, False])
315 -+# @pytest.mark.sphinx('text', testroot='dummy')
316 -+# def test_sphinx_output(app, status, warning, always_document_param_types):
317 -+# test_path = pathlib.Path(__file__).parent
318 -
319 -- # Add test directory to sys.path to allow imports of dummy module.
320 -- if str(test_path) not in sys.path:
321 -- sys.path.insert(0, str(test_path))
322 -+# # Add test directory to sys.path to allow imports of dummy module.
323 -+# if str(test_path) not in sys.path:
324 -+# sys.path.insert(0, str(test_path))
325 -
326 -- app.config.always_document_param_types = always_document_param_types
327 -- app.config.autodoc_mock_imports = ['mailbox']
328 -- app.build()
329 -+# app.config.always_document_param_types = always_document_param_types
330 -+# app.config.autodoc_mock_imports = ['mailbox']
331 -+# app.build()
332 -
333 -- assert 'build succeeded' in status.getvalue() # Build succeeded
334 -+# assert 'build succeeded' in status.getvalue() # Build succeeded
335 -
336 -- # There should be a warning about an unresolved forward reference
337 -- warnings = warning.getvalue().strip()
338 -- assert 'Cannot resolve forward reference in type annotations of ' in warnings, warnings
339 -+# # There should be a warning about an unresolved forward reference
340 -+# warnings = warning.getvalue().strip()
341 -+# assert 'Cannot resolve forward reference in type annotations of ' in warnings, warnings
342 -
343 -- format_args = {}
344 -- if always_document_param_types:
345 -- format_args['undoc_params'] = '\n\n Parameters:\n **x** ("int") --'
346 -- else:
347 -- format_args['undoc_params'] = ""
348 -+# format_args = {}
349 -+# if always_document_param_types:
350 -+# format_args['undoc_params'] = '\n\n Parameters:\n **x** ("int") --'
351 -+# else:
352 -+# format_args['undoc_params'] = ""
353 -
354 -- if sys.version_info < (3, 6):
355 -- format_args['dataclass_docstring'] = ('Initialize self. See help(type(self)) for '
356 -- 'accurate signature.')
357 -- else:
358 -- format_args['dataclass_docstring'] = 'Return type:\n "None"'
359 -+# if sys.version_info < (3, 6):
360 -+# format_args['dataclass_docstring'] = ('Initialize self. See help(type(self)) for '
361 -+# 'accurate signature.')
362 -+# else:
363 -+# format_args['dataclass_docstring'] = 'Return type:\n "None"'
364 -
365 -- text_path = pathlib.Path(app.srcdir) / '_build' / 'text' / 'index.txt'
366 -- with text_path.open('r') as f:
367 -- text_contents = f.read().replace('–', '--')
368 -- expected_contents = textwrap.dedent('''\
369 -- Dummy Module
370 -- ************
371 -+# text_path = pathlib.Path(app.srcdir) / '_build' / 'text' / 'index.txt'
372 -+# with text_path.open('r') as f:
373 -+# text_contents = f.read().replace('–', '--')
374 -+# expected_contents = textwrap.dedent('''\
375 -+# Dummy Module
376 -+# ************
377 -
378 -- class dummy_module.Class(x, y, z=None)
379 -+# class dummy_module.Class(x, y, z=None)
380 -
381 -- Initializer docstring.
382 -+# Initializer docstring.
383 -
384 -- Parameters:
385 -- * **x** ("bool") – foo
386 -+# Parameters:
387 -+# * **x** ("bool") – foo
388 -
389 -- * **y** ("int") – bar
390 -+# * **y** ("int") – bar
391 -
392 -- * **z** ("Optional"["str"]) – baz
393 -+# * **z** ("Optional"["str"]) – baz
394 -
395 -- class InnerClass
396 -+# class InnerClass
397 -
398 -- Inner class.
399 -+# Inner class.
400 -
401 -- _InnerClass__dunder_inner_method(x)
402 -+# _InnerClass__dunder_inner_method(x)
403 -
404 -- Dunder inner method.
405 -+# Dunder inner method.
406 -
407 -- Parameters:
408 -- **x** ("bool") -- foo
409 -+# Parameters:
410 -+# **x** ("bool") -- foo
411 -
412 -- Return type:
413 -- "str"
414 -+# Return type:
415 -+# "str"
416 -
417 -- inner_method(x)
418 -+# inner_method(x)
419 -
420 -- Inner method.
421 -+# Inner method.
422 -
423 -- Parameters:
424 -- **x** ("bool") -- foo
425 -+# Parameters:
426 -+# **x** ("bool") -- foo
427 -
428 -- Return type:
429 -- "str"
430 -+# Return type:
431 -+# "str"
432 -
433 -- _Class__dunder_method(x)
434 -+# _Class__dunder_method(x)
435 -
436 -- Dunder method docstring.
437 -+# Dunder method docstring.
438 -
439 -- Parameters:
440 -- **x** ("str") -- foo
441 -+# Parameters:
442 -+# **x** ("str") -- foo
443 -
444 -- Return type:
445 -- "str"
446 -+# Return type:
447 -+# "str"
448 -
449 -- __magic_custom_method__(x)
450 -+# __magic_custom_method__(x)
451 -
452 -- Magic dunder method docstring.
453 -+# Magic dunder method docstring.
454 -
455 -- Parameters:
456 -- **x** ("str") -- foo
457 -+# Parameters:
458 -+# **x** ("str") -- foo
459 -
460 -- Return type:
461 -- "str"
462 -+# Return type:
463 -+# "str"
464 -
465 -- _private_method(x)
466 -+# _private_method(x)
467 -
468 -- Private method docstring.
469 -+# Private method docstring.
470 -
471 -- Parameters:
472 -- **x** ("str") -- foo
473 -+# Parameters:
474 -+# **x** ("str") -- foo
475 -
476 -- Return type:
477 -- "str"
478 -+# Return type:
479 -+# "str"
480 -
481 -- classmethod a_classmethod(x, y, z=None)
482 -+# classmethod a_classmethod(x, y, z=None)
483 -
484 -- Classmethod docstring.
485 -+# Classmethod docstring.
486 -
487 -- Parameters:
488 -- * **x** ("bool") – foo
489 -+# Parameters:
490 -+# * **x** ("bool") – foo
491 -
492 -- * **y** ("int") – bar
493 -+# * **y** ("int") – bar
494 -
495 -- * **z** ("Optional"["str"]) – baz
496 -+# * **z** ("Optional"["str"]) – baz
497 -
498 -- Return type:
499 -- "str"
500 -+# Return type:
501 -+# "str"
502 -
503 -- a_method(x, y, z=None)
504 -+# a_method(x, y, z=None)
505 -
506 -- Method docstring.
507 -+# Method docstring.
508 -
509 -- Parameters:
510 -- * **x** ("bool") – foo
511 -+# Parameters:
512 -+# * **x** ("bool") – foo
513 -
514 -- * **y** ("int") – bar
515 -+# * **y** ("int") – bar
516 -
517 -- * **z** ("Optional"["str"]) – baz
518 -+# * **z** ("Optional"["str"]) – baz
519 -
520 -- Return type:
521 -- "str"
522 -+# Return type:
523 -+# "str"
524 -
525 -- property a_property
526 -+# property a_property
527 -
528 -- Property docstring
529 -+# Property docstring
530 -
531 -- Return type:
532 -- "str"
533 -+# Return type:
534 -+# "str"
535 -
536 -- static a_staticmethod(x, y, z=None)
537 -+# static a_staticmethod(x, y, z=None)
538 -
539 -- Staticmethod docstring.
540 -+# Staticmethod docstring.
541 -
542 -- Parameters:
543 -- * **x** ("bool") – foo
544 -+# Parameters:
545 -+# * **x** ("bool") – foo
546 -
547 -- * **y** ("int") – bar
548 -+# * **y** ("int") – bar
549 -
550 -- * **z** ("Optional"["str"]) – baz
551 -+# * **z** ("Optional"["str"]) – baz
552 -
553 -- Return type:
554 -- "str"
555 -+# Return type:
556 -+# "str"
557 -
558 -- locally_defined_callable_field() -> str
559 -+# locally_defined_callable_field() -> str
560 -
561 -- Wrapper
562 -+# Wrapper
563 -
564 -- Return type:
565 -- "str"
566 -+# Return type:
567 -+# "str"
568 -
569 -- exception dummy_module.DummyException(message)
570 -+# exception dummy_module.DummyException(message)
571 -
572 -- Exception docstring
573 -+# Exception docstring
574 -
575 -- Parameters:
576 -- **message** ("str") – blah
577 -+# Parameters:
578 -+# **message** ("str") – blah
579 -
580 -- dummy_module.function(x, y, z_=None)
581 -+# dummy_module.function(x, y, z_=None)
582 -
583 -- Function docstring.
584 -+# Function docstring.
585 -
586 -- Parameters:
587 -- * **x** ("bool") – foo
588 -+# Parameters:
589 -+# * **x** ("bool") – foo
590 -
591 -- * **y** ("int") – bar
592 -+# * **y** ("int") – bar
593 -
594 -- * **z_** ("Optional"["str"]) – baz
595 -+# * **z_** ("Optional"["str"]) – baz
596 -
597 -- Returns:
598 -- something
599 -+# Returns:
600 -+# something
601 -
602 -- Return type:
603 -- bytes
604 -+# Return type:
605 -+# bytes
606 -
607 -- dummy_module.function_with_escaped_default(x='\\x08')
608 -+# dummy_module.function_with_escaped_default(x='\\x08')
609 -
610 -- Function docstring.
611 -+# Function docstring.
612 -
613 -- Parameters:
614 -- **x** ("str") – foo
615 -+# Parameters:
616 -+# **x** ("str") – foo
617 -
618 -- dummy_module.function_with_unresolvable_annotation(x)
619 -+# dummy_module.function_with_unresolvable_annotation(x)
620 -
621 -- Function docstring.
622 -+# Function docstring.
623 -
624 -- Parameters:
625 -- **x** (*a.b.c*) – foo
626 -+# Parameters:
627 -+# **x** (*a.b.c*) – foo
628 -
629 -- dummy_module.function_with_typehint_comment(x, y)
630 -+# dummy_module.function_with_typehint_comment(x, y)
631 -
632 -- Function docstring.
633 -+# Function docstring.
634 -
635 -- Parameters:
636 -- * **x** ("int") – foo
637 -+# Parameters:
638 -+# * **x** ("int") – foo
639 -
640 -- * **y** ("str") – bar
641 -+# * **y** ("str") – bar
642 -
643 -- Return type:
644 -- "None"
645 -+# Return type:
646 -+# "None"
647 -
648 -- class dummy_module.ClassWithTypehints(x)
649 -+# class dummy_module.ClassWithTypehints(x)
650 -
651 -- Class docstring.
652 -+# Class docstring.
653 -
654 -- Parameters:
655 -- **x** ("int") -- foo
656 -+# Parameters:
657 -+# **x** ("int") -- foo
658 -
659 -- foo(x)
660 -+# foo(x)
661 -
662 -- Method docstring.
663 -+# Method docstring.
664 -
665 -- Parameters:
666 -- **x** ("str") -- foo
667 -+# Parameters:
668 -+# **x** ("str") -- foo
669 -
670 -- Return type:
671 -- "int"
672 -+# Return type:
673 -+# "int"
674 -
675 -- dummy_module.function_with_typehint_comment_not_inline(x=None, *y, z, **kwargs)
676 -+# dummy_module.function_with_typehint_comment_not_inline(x=None, *y, z, **kwargs)
677 -
678 -- Function docstring.
679 -+# Function docstring.
680 -
681 -- Parameters:
682 -- * **x** ("Union"["str", "bytes", "None"]) -- foo
683 -+# Parameters:
684 -+# * **x** ("Union"["str", "bytes", "None"]) -- foo
685 -
686 -- * **y** ("str") -- bar
687 -+# * **y** ("str") -- bar
688 -
689 -- * **z** ("bytes") -- baz
690 -+# * **z** ("bytes") -- baz
691 -
692 -- * **kwargs** ("int") -- some kwargs
693 -+# * **kwargs** ("int") -- some kwargs
694 -
695 -- Return type:
696 -- "None"
697 -+# Return type:
698 -+# "None"
699 -
700 -- class dummy_module.ClassWithTypehintsNotInline(x=None)
701 -+# class dummy_module.ClassWithTypehintsNotInline(x=None)
702 -
703 -- Class docstring.
704 -+# Class docstring.
705 -
706 -- Parameters:
707 -- **x** ("Optional"["Callable"[["int", "bytes"], "int"]]) -- foo
708 -+# Parameters:
709 -+# **x** ("Optional"["Callable"[["int", "bytes"], "int"]]) -- foo
710 -
711 -- foo(x=1)
712 -+# foo(x=1)
713 -
714 -- Method docstring.
715 -+# Method docstring.
716 -
717 -- Parameters:
718 -- **x** ("Callable"[["int", "bytes"], "int"]) -- foo
719 -+# Parameters:
720 -+# **x** ("Callable"[["int", "bytes"], "int"]) -- foo
721 -
722 -- Return type:
723 -- "int"
724 -+# Return type:
725 -+# "int"
726 -
727 -- classmethod mk(x=None)
728 -+# classmethod mk(x=None)
729 -
730 -- Method docstring.
731 -+# Method docstring.
732 -
733 -- Parameters:
734 -- **x** (*Callable**[**[**int**, **bytes**]**, **int**]*) --
735 -- foo
736 -+# Parameters:
737 -+# **x** (*Callable**[**[**int**, **bytes**]**, **int**]*) --
738 -+# foo
739 -
740 -- Return type:
741 -- ClassWithTypehintsNotInline
742 -+# Return type:
743 -+# ClassWithTypehintsNotInline
744 -
745 -- dummy_module.undocumented_function(x)
746 -+# dummy_module.undocumented_function(x)
747 -
748 -- Hi{undoc_params}
749 -+# Hi{undoc_params}
750 -
751 -- Return type:
752 -- "str"
753 -+# Return type:
754 -+# "str"
755 -
756 -- class dummy_module.DataClass
757 -+# class dummy_module.DataClass
758 -
759 -- Class docstring.
760 -+# Class docstring.
761 -
762 -- __init__()
763 -+# __init__()
764 -
765 -- {dataclass_docstring}
766 -+# {dataclass_docstring}
767 -
768 -- @dummy_module.Decorator(func)
769 -+# @dummy_module.Decorator(func)
770 -
771 -- Initializer docstring.
772 -+# Initializer docstring.
773 -
774 -- Parameters:
775 -- **func** ("Callable"[["int", "str"], "str"]) -- function
776 -+# Parameters:
777 -+# **func** ("Callable"[["int", "str"], "str"]) -- function
778 -
779 -- dummy_module.mocked_import(x)
780 -+# dummy_module.mocked_import(x)
781 -
782 -- A docstring.
783 -+# A docstring.
784 -
785 -- Parameters:
786 -- **x** ("Mailbox") -- function
787 -- ''')
788 -- expected_contents = expected_contents.format(**format_args).replace('–', '--')
789 -- assert text_contents == expected_contents
790 -+# Parameters:
791 -+# **x** ("Mailbox") -- function
792 -+# ''')
793 -+# expected_contents = expected_contents.format(**format_args).replace('–', '--')
794 -+# assert text_contents == expected_contents
795
796 diff --git a/dev-python/sphinx-autodoc-typehints/sphinx-autodoc-typehints-1.10.3.ebuild b/dev-python/sphinx-autodoc-typehints/sphinx-autodoc-typehints-1.10.3.ebuild
797 index c125449..20e2095 100644
798 --- a/dev-python/sphinx-autodoc-typehints/sphinx-autodoc-typehints-1.10.3.ebuild
799 +++ b/dev-python/sphinx-autodoc-typehints/sphinx-autodoc-typehints-1.10.3.ebuild
800 @@ -24,4 +24,16 @@ DEPEND="test? ( dev-python/sphobjinv[${PYTHON_USEDEP}]
801
802 distutils_enable_tests pytest
803
804 -PATCHES="${FILESDIR}/${P}-skip-online-tests.patch"
805 +python_prepare_all() {
806 + # skip these tests
807 + sed -i -e 's:test_parse_annotation:_&:' \
808 + -e 's:test_format_annotation:_&:' \
809 + -e 's:test_format_annotation_both_libs:_&:' \
810 + -e 's:test_sphinx_output:_&:' \
811 + -e 's:test_format_annotation_both_libs:_&:' \
812 + -e 's:test_format_annotation_both_libs:_&:' \
813 + -e 's:test_format_annotation_both_libs:_&:' \
814 + tests/test_sphinx_autodoc_typehints.py || die
815 +
816 + distutils-r1_python_prepare_all
817 +}