Fix code to work with Sphinx>5.0

The patch [1] introduced the use of Sphinx 6.2.1, which has some
incompatibilities with the current code base.

As we can see in [2], the `no_docstring` argument of
`sphinx.ext.autodoc.Documenter.add_content()` was removed. It was
already not used in our code base, therefore, we can remove its
usage without any issues.

[1] 289feed317
[2] https://www.sphinx-doc.org/en/master/extdev/deprecated.html#dev-deprecated-apis

Change-Id: I65c2bd535fe366933e9aaf842ee9b953c5af375b
This commit is contained in:
Rafael Weingärtner 2023-09-04 13:29:07 -03:00
parent 80bda9053f
commit a45e0af97e

View File

@ -223,13 +223,12 @@ class TypeDocumenter(autodoc.ClassDocumenter):
else: else:
return False return False
def add_content(self, more_content, no_docstring=False): def add_content(self, more_content):
# Check where to include the samples # Check where to include the samples
samples_slot = self.options.samples_slot or self.default_samples_slot samples_slot = self.options.samples_slot or self.default_samples_slot
def add_docstring(): def add_docstring():
super(TypeDocumenter, self).add_content( super(TypeDocumenter, self).add_content(more_content)
more_content, no_docstring)
def add_samples(): def add_samples():
protocols = get_protocols( protocols = get_protocols(
@ -284,14 +283,13 @@ class AttributeDocumenter(autodoc.AttributeDocumenter):
self.datatype = self.object.datatype self.datatype = self.object.datatype
return success return success
def add_content(self, more_content, no_docstring=False): def add_content(self, more_content):
self.add_line( self.add_line(
u':type: %s' % datatypename(self.datatype), u':type: %s' % datatypename(self.datatype),
'<wsmeext.sphinxext>' '<wsmeext.sphinxext>'
) )
self.add_line(u'', '<wsmeext.sphinxext>') self.add_line(u'', '<wsmeext.sphinxext>')
super(AttributeDocumenter, self).add_content( super(AttributeDocumenter, self).add_content(more_content)
more_content, no_docstring)
def add_directive_header(self, sig): def add_directive_header(self, sig):
super(AttributeDocumenter, self).add_directive_header(sig) super(AttributeDocumenter, self).add_directive_header(sig)
@ -528,8 +526,8 @@ class FunctionDocumenter(autodoc.MethodDocumenter):
self.wsme_fd, docstrings, protocols self.wsme_fd, docstrings, protocols
) )
def add_content(self, more_content, no_docstring=False): def add_content(self, more_content):
super(FunctionDocumenter, self).add_content(more_content, no_docstring) super(FunctionDocumenter, self).add_content(more_content)
def format_name(self): def format_name(self):
return self.wsme_fd.name return self.wsme_fd.name