mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #5814 from jdufresne/str-format-coerce
Remove redundant coerce to str in string formatting
This commit is contained in:
commit
c7ed4f3ddd
@ -3149,8 +3149,7 @@ class ASTDeclaratorNameParamQual(ASTBase):
|
|||||||
# cv-qualifiers
|
# cv-qualifiers
|
||||||
if self.paramQual:
|
if self.paramQual:
|
||||||
return self.paramQual.get_modifiers_id(version)
|
return self.paramQual.get_modifiers_id(version)
|
||||||
raise Exception(
|
raise Exception("This should only be called on a function: %s" % self)
|
||||||
"This should only be called on a function: %s" % text_type(self))
|
|
||||||
|
|
||||||
def get_param_id(self, version): # only the parameters (if any)
|
def get_param_id(self, version): # only the parameters (if any)
|
||||||
# type: (int) -> str
|
# type: (int) -> str
|
||||||
@ -6143,7 +6142,7 @@ class DefinitionParser:
|
|||||||
% (numArgs, numParams, numExtra)
|
% (numArgs, numParams, numExtra)
|
||||||
msg += " Declaration:\n\t"
|
msg += " Declaration:\n\t"
|
||||||
if templatePrefix:
|
if templatePrefix:
|
||||||
msg += "%s\n\t" % text_type(templatePrefix)
|
msg += "%s\n\t" % templatePrefix
|
||||||
msg += text_type(nestedName)
|
msg += text_type(nestedName)
|
||||||
self.warn(msg)
|
self.warn(msg)
|
||||||
|
|
||||||
@ -6360,7 +6359,7 @@ class CPPObject(ObjectDescription):
|
|||||||
assert newestId # shouldn't be None
|
assert newestId # shouldn't be None
|
||||||
if not re.compile(r'^[a-zA-Z0-9_]*$').match(newestId):
|
if not re.compile(r'^[a-zA-Z0-9_]*$').match(newestId):
|
||||||
self.warn('Index id generation for C++ object "%s" failed, please '
|
self.warn('Index id generation for C++ object "%s" failed, please '
|
||||||
'report as bug (id=%s).' % (text_type(ast), newestId))
|
'report as bug (id=%s).' % (ast, newestId))
|
||||||
|
|
||||||
name = ast.symbol.get_full_nested_name().get_display_string().lstrip(':')
|
name = ast.symbol.get_full_nested_name().get_display_string().lstrip(':')
|
||||||
# Add index entry, but not if it's a declaration inside a concept
|
# Add index entry, but not if it's a declaration inside a concept
|
||||||
|
@ -18,7 +18,6 @@ from subprocess import Popen, PIPE
|
|||||||
|
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
from docutils.parsers.rst import directives
|
from docutils.parsers.rst import directives
|
||||||
from six import text_type
|
|
||||||
|
|
||||||
import sphinx
|
import sphinx
|
||||||
from sphinx.errors import SphinxError
|
from sphinx.errors import SphinxError
|
||||||
@ -284,7 +283,7 @@ def render_dot_html(self, node, code, options, prefix='graphviz',
|
|||||||
"'svg', but is %r") % format)
|
"'svg', but is %r") % format)
|
||||||
fname, outfn = render_dot(self, code, options, format, prefix)
|
fname, outfn = render_dot(self, code, options, format, prefix)
|
||||||
except GraphvizError as exc:
|
except GraphvizError as exc:
|
||||||
logger.warning(__('dot code %r: %s'), code, text_type(exc))
|
logger.warning(__('dot code %r: %s'), code, exc)
|
||||||
raise nodes.SkipNode
|
raise nodes.SkipNode
|
||||||
|
|
||||||
if imgcls:
|
if imgcls:
|
||||||
@ -338,7 +337,7 @@ def render_dot_latex(self, node, code, options, prefix='graphviz'):
|
|||||||
try:
|
try:
|
||||||
fname, outfn = render_dot(self, code, options, 'pdf', prefix)
|
fname, outfn = render_dot(self, code, options, 'pdf', prefix)
|
||||||
except GraphvizError as exc:
|
except GraphvizError as exc:
|
||||||
logger.warning(__('dot code %r: %s'), code, text_type(exc))
|
logger.warning(__('dot code %r: %s'), code, exc)
|
||||||
raise nodes.SkipNode
|
raise nodes.SkipNode
|
||||||
|
|
||||||
is_inline = self.is_inline(node)
|
is_inline = self.is_inline(node)
|
||||||
@ -376,7 +375,7 @@ def render_dot_texinfo(self, node, code, options, prefix='graphviz'):
|
|||||||
try:
|
try:
|
||||||
fname, outfn = render_dot(self, code, options, 'png', prefix)
|
fname, outfn = render_dot(self, code, options, 'png', prefix)
|
||||||
except GraphvizError as exc:
|
except GraphvizError as exc:
|
||||||
logger.warning(__('dot code %r: %s'), code, text_type(exc))
|
logger.warning(__('dot code %r: %s'), code, exc)
|
||||||
raise nodes.SkipNode
|
raise nodes.SkipNode
|
||||||
if fname is not None:
|
if fname is not None:
|
||||||
self.body.append('@image{%s,,,[graphviz],png}\n' % fname[:-4])
|
self.body.append('@image{%s,,,[graphviz],png}\n' % fname[:-4])
|
||||||
|
@ -92,7 +92,7 @@ class Table:
|
|||||||
table.add_row()
|
table.add_row()
|
||||||
table.add_cell(Cell("FOO"))
|
table.add_cell(Cell("FOO"))
|
||||||
table.add_cell(Cell("BAR"))
|
table.add_cell(Cell("BAR"))
|
||||||
print(str(table))
|
print(table)
|
||||||
+--------+--------+
|
+--------+--------+
|
||||||
| foo | bar |
|
| foo | bar |
|
||||||
|========|========|
|
|========|========|
|
||||||
|
@ -43,7 +43,7 @@ def check(name, input, idDict, output=None):
|
|||||||
res = text_type(ast)
|
res = text_type(ast)
|
||||||
if res != output:
|
if res != output:
|
||||||
print("")
|
print("")
|
||||||
print("Input: ", text_type(input))
|
print("Input: ", input)
|
||||||
print("Result: ", res)
|
print("Result: ", res)
|
||||||
print("Expected: ", output)
|
print("Expected: ", output)
|
||||||
raise DefinitionError("")
|
raise DefinitionError("")
|
||||||
@ -74,13 +74,13 @@ def check(name, input, idDict, output=None):
|
|||||||
res.append(idExpected[i] == idActual[i])
|
res.append(idExpected[i] == idActual[i])
|
||||||
|
|
||||||
if not all(res):
|
if not all(res):
|
||||||
print("input: %s" % text_type(input).rjust(20))
|
print("input: %s" % input.rjust(20))
|
||||||
for i in range(1, _max_id + 1):
|
for i in range(1, _max_id + 1):
|
||||||
if res[i]:
|
if res[i]:
|
||||||
continue
|
continue
|
||||||
print("Error in id version %d." % i)
|
print("Error in id version %d." % i)
|
||||||
print("result: %s" % str(idActual[i]))
|
print("result: %s" % idActual[i])
|
||||||
print("expected: %s" % str(idExpected[i]))
|
print("expected: %s" % idExpected[i])
|
||||||
print(rootSymbol.dump(0))
|
print(rootSymbol.dump(0))
|
||||||
raise DefinitionError("")
|
raise DefinitionError("")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user