File: 0001-Fix-for-newer-Sphinx.patch

package info (click to toggle)
sphinxcontrib-asyncio 0.3.0-3
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 172 kB
  • sloc: python: 231; makefile: 188
file content (49 lines) | stat: -rw-r--r-- 1,845 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From: Edward Betts <edward@4angle.com>
Date: Thu, 3 Aug 2023 12:42:56 +0100
Subject: Fix for newer Sphinx
Forwarded: https://github.com/aio-libs/sphinxcontrib-asyncio/pull/16

---
 sphinxcontrib/asyncio.py | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/sphinxcontrib/asyncio.py b/sphinxcontrib/asyncio.py
index b5077be..c658cf7 100644
--- a/sphinxcontrib/asyncio.py
+++ b/sphinxcontrib/asyncio.py
@@ -1,4 +1,6 @@
+from docutils import nodes
 from docutils.parsers.rst import directives
+from sphinx import addnodes
 from sphinx.domains.python import PyFunction, PyMethod
 from sphinx.ext.autodoc import FunctionDocumenter, MethodDocumenter, \
     bool_option
@@ -26,22 +28,22 @@ class PyCoroutineMixin(object):
                    'async-for': directives.flag}
 
     def get_signature_prefix(self, sig):
-        ret = ''
+        ret = []
         if 'staticmethod' in self.options:
-            ret += 'staticmethod '
+            ret += [nodes.Text('staticmethod'), addnodes.desc_sig_space()]
         if 'classmethod' in self.options:
-            ret += 'classmethod '
+            ret += [nodes.Text('classmethod'), addnodes.desc_sig_space()]
         if 'coroutine' in self.options:
             coroutine = True
         else:
             coroutine = ('async-with' not in self.options and
                          'async-for' not in self.options)
         if coroutine:
-            ret += 'coroutine '
+            ret += [nodes.Text('coroutine'), addnodes.desc_sig_space()]
         if 'async-with' in self.options:
-            ret += 'async-with '
+            ret += [nodes.Text('async-with'), addnodes.desc_sig_space()]
         if 'async-for' in self.options:
-            ret += 'async-for '
+            ret += [nodes.Text('async-for'), addnodes.desc_sig_space()]
         return ret