|
From: <mi...@us...> - 2022-03-03 22:16:38
|
Revision: 9020
http://sourceforge.net/p/docutils/code/9020
Author: milde
Date: 2022-03-03 22:16:35 +0000 (Thu, 03 Mar 2022)
Log Message:
-----------
Fix unexpected spaces around equals indicating keyword arguments.
flake8 rule E251
Modified Paths:
--------------
trunk/docutils/docutils/nodes.py
trunk/docutils/docutils/utils/math/math2html.py
trunk/docutils/docutils/writers/_html_base.py
trunk/docutils/docutils/writers/html4css1/__init__.py
trunk/docutils/docutils/writers/html5_polyglot/__init__.py
trunk/docutils/docutils/writers/latex2e/__init__.py
trunk/docutils/test/test_writers/test_latex2e.py
trunk/docutils/tools/dev/generate_punctuation_chars.py
trunk/docutils/tools/docutils-cli.py
trunk/docutils/tox.ini
Modified: trunk/docutils/docutils/nodes.py
===================================================================
--- trunk/docutils/docutils/nodes.py 2022-03-03 22:16:23 UTC (rev 9019)
+++ trunk/docutils/docutils/nodes.py 2022-03-03 22:16:35 UTC (rev 9020)
@@ -780,7 +780,7 @@
value = [value]
self.append_attr_list(attr, value)
- def replace_attr(self, attr, value, force = True):
+ def replace_attr(self, attr, value, force=True):
"""
If self[attr] does not exist or force is True or omitted, set
self[attr] to value, otherwise do nothing.
@@ -789,7 +789,7 @@
if force or self.get(attr) is None:
self[attr] = value
- def copy_attr_convert(self, attr, value, replace = True):
+ def copy_attr_convert(self, attr, value, replace=True):
"""
If attr is an attribute of self, set self[attr] to
[self[attr], value], otherwise set self[attr] to value.
@@ -839,8 +839,8 @@
if self.get(attr) is not value:
self.replace_attr(attr, value, replace)
- def update_all_atts(self, dict_, update_fun = copy_attr_consistent,
- replace = True, and_source = False):
+ def update_all_atts(self, dict_, update_fun=copy_attr_consistent,
+ replace=True, and_source=False):
"""
Updates all attributes from node or dictionary `dict_`.
@@ -877,8 +877,8 @@
for att in filter(filter_fun, dict_):
update_fun(self, att, dict_[att], replace)
- def update_all_atts_consistantly(self, dict_, replace = True,
- and_source = False):
+ def update_all_atts_consistantly(self, dict_, replace=True,
+ and_source=False):
"""
Updates all attributes from node or dictionary `dict_`.
@@ -898,8 +898,8 @@
self.update_all_atts(dict_, Element.copy_attr_consistent, replace,
and_source)
- def update_all_atts_concatenating(self, dict_, replace = True,
- and_source = False):
+ def update_all_atts_concatenating(self, dict_, replace=True,
+ and_source=False):
"""
Updates all attributes from node or dictionary `dict_`.
@@ -922,8 +922,8 @@
self.update_all_atts(dict_, Element.copy_attr_concatenate, replace,
and_source)
- def update_all_atts_coercion(self, dict_, replace = True,
- and_source = False):
+ def update_all_atts_coercion(self, dict_, replace=True,
+ and_source=False):
"""
Updates all attributes from node or dictionary `dict_`.
@@ -947,7 +947,7 @@
self.update_all_atts(dict_, Element.copy_attr_coerce, replace,
and_source)
- def update_all_atts_convert(self, dict_, and_source = False):
+ def update_all_atts_convert(self, dict_, and_source=False):
"""
Updates all attributes from node or dictionary `dict_`.
@@ -966,7 +966,7 @@
on the value of update_fun.
"""
self.update_all_atts(dict_, Element.copy_attr_convert,
- and_source = and_source)
+ and_source=and_source)
def clear(self):
self.children = []
Modified: trunk/docutils/docutils/utils/math/math2html.py
===================================================================
--- trunk/docutils/docutils/utils/math/math2html.py 2022-03-03 22:16:23 UTC (rev 9019)
+++ trunk/docutils/docutils/utils/math/math2html.py 2022-03-03 22:16:35 UTC (rev 9020)
@@ -1107,11 +1107,11 @@
"Glob a bit of text up until (excluding) any excluded character."
return self.glob(lambda: self.current() not in excluded)
- def pushending(self, ending, optional = False):
+ def pushending(self, ending, optional=False):
"Push a new ending to the bottom"
self.endinglist.add(ending, optional)
- def popending(self, expected = None):
+ def popending(self, expected=None):
"Pop the ending found at the current position"
if self.isout() and self.leavepending:
return expected
@@ -1134,7 +1134,7 @@
def __init__(self):
self.endings = []
- def add(self, ending, optional = False):
+ def add(self, ending, optional=False):
"Add a new ending to the list"
self.endings.append(PositionEnding(ending, optional))
@@ -1325,7 +1325,7 @@
html = [html]
return html
- def escape(self, line, replacements = EscapeConfig.entities):
+ def escape(self, line, replacements=EscapeConfig.entities):
"Escape a line with replacements from a map"
pieces = sorted(replacements.keys())
# do them in order
@@ -1406,7 +1406,7 @@
while len(container.contents) > 0:
self.contents.insert(index, container.contents.pop())
- def tree(self, level = 0):
+ def tree(self, level=0):
"Show in a tree"
Trace.debug(" " * level + str(self))
for container in self.contents:
@@ -1673,7 +1673,7 @@
self.add(FormulaConstant(constant))
return self
- def complete(self, contents, tag, breaklines = False):
+ def complete(self, contents, tag, breaklines=False):
"Set the constant and the tag"
self.contents = contents
self.output = TaggedOutput().settag(tag, breaklines)
@@ -1681,7 +1681,7 @@
def selfcomplete(self, tag):
"Set the self-closing tag, no contents (as in <hr/>)."
- self.output = TaggedOutput().settag(tag, empty = True)
+ self.output = TaggedOutput().settag(tag, empty=True)
return self
class FormulaConstant(Constant):
Modified: trunk/docutils/docutils/writers/_html_base.py
===================================================================
--- trunk/docutils/docutils/writers/_html_base.py 2022-03-03 22:16:23 UTC (rev 9019)
+++ trunk/docutils/docutils/writers/_html_base.py 2022-03-03 22:16:35 UTC (rev 9020)
@@ -517,7 +517,7 @@
def visit_address(self, node):
self.visit_docinfo_item(node, 'address', meta=False)
self.body.append(self.starttag(node, 'pre',
- suffix= '', CLASS='address'))
+ suffix='', CLASS='address'))
def depart_address(self, node):
self.body.append('\n</pre>\n')
Modified: trunk/docutils/docutils/writers/html4css1/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html4css1/__init__.py 2022-03-03 22:16:23 UTC (rev 9019)
+++ trunk/docutils/docutils/writers/html4css1/__init__.py 2022-03-03 22:16:35 UTC (rev 9020)
@@ -40,40 +40,40 @@
# use a copy of the parent spec with some modifications
settings_spec = frontend.filter_settings_spec(
writers._html_base.Writer.settings_spec,
- template =
- ('Template file. (UTF-8 encoded, default: "%s")' % default_template,
- ['--template'],
- {'default': default_template, 'metavar': '<file>'}),
- stylesheet_path =
- ('Comma separated list of stylesheet paths. '
- 'Relative paths are expanded if a matching file is found in '
- 'the --stylesheet-dirs. With --link-stylesheet, '
- 'the path is rewritten relative to the output HTML file. '
- '(default: "%s")' % ','.join(default_stylesheets),
- ['--stylesheet-path'],
- {'metavar': '<file[,file,...]>', 'overrides': 'stylesheet',
- 'validator': frontend.validate_comma_separated_list,
- 'default': default_stylesheets}),
- stylesheet_dirs =
- ('Comma-separated list of directories where stylesheets are found. '
- 'Used by --stylesheet-path when expanding relative path arguments. '
- '(default: "%s")' % ','.join(default_stylesheet_dirs),
- ['--stylesheet-dirs'],
- {'metavar': '<dir[,dir,...]>',
- 'validator': frontend.validate_comma_separated_list,
- 'default': default_stylesheet_dirs}),
- initial_header_level =
- ('Specify the initial header level. Does not affect document '
- 'title & subtitle (see --no-doc-title). (default: 1 for "<h1>")',
- ['--initial-header-level'],
- {'choices': '1 2 3 4 5 6'.split(), 'default': '1',
- 'metavar': '<level>'}),
- xml_declaration =
- ('Prepend an XML declaration (default). ',
- ['--xml-declaration'],
- {'default': True, 'action': 'store_true',
- 'validator': frontend.validate_boolean}),
- )
+ template=(
+ 'Template file. (UTF-8 encoded, default: "%s")' % default_template,
+ ['--template'],
+ {'default': default_template, 'metavar': '<file>'}),
+ stylesheet_path=(
+ 'Comma separated list of stylesheet paths. '
+ 'Relative paths are expanded if a matching file is found in '
+ 'the --stylesheet-dirs. With --link-stylesheet, '
+ 'the path is rewritten relative to the output HTML file. '
+ '(default: "%s")' % ','.join(default_stylesheets),
+ ['--stylesheet-path'],
+ {'metavar': '<file[,file,...]>', 'overrides': 'stylesheet',
+ 'validator': frontend.validate_comma_separated_list,
+ 'default': default_stylesheets}),
+ stylesheet_dirs=(
+ 'Comma-separated list of directories where stylesheets are found. '
+ 'Used by --stylesheet-path when expanding relative path arguments. '
+ '(default: "%s")' % ','.join(default_stylesheet_dirs),
+ ['--stylesheet-dirs'],
+ {'metavar': '<dir[,dir,...]>',
+ 'validator': frontend.validate_comma_separated_list,
+ 'default': default_stylesheet_dirs}),
+ initial_header_level=(
+ 'Specify the initial header level. Does not affect document '
+ 'title & subtitle (see --no-doc-title). (default: 1 for "<h1>")',
+ ['--initial-header-level'],
+ {'choices': '1 2 3 4 5 6'.split(), 'default': '1',
+ 'metavar': '<level>'}),
+ xml_declaration=(
+ 'Prepend an XML declaration (default). ',
+ ['--xml-declaration'],
+ {'default': True, 'action': 'store_true',
+ 'validator': frontend.validate_boolean}),
+ )
settings_spec = settings_spec + (
'HTML4 Writer Options',
'',
Modified: trunk/docutils/docutils/writers/html5_polyglot/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html5_polyglot/__init__.py 2022-03-03 22:16:23 UTC (rev 9019)
+++ trunk/docutils/docutils/writers/html5_polyglot/__init__.py 2022-03-03 22:16:35 UTC (rev 9020)
@@ -47,38 +47,39 @@
# use a copy of the parent spec with some modifications
settings_spec = frontend.filter_settings_spec(
writers._html_base.Writer.settings_spec,
- template =
- ('Template file. (UTF-8 encoded, default: "%s")' % default_template,
- ['--template'],
- {'default': default_template, 'metavar': '<file>'}),
- stylesheet_path =
- ('Comma separated list of stylesheet paths. '
- 'Relative paths are expanded if a matching file is found in '
- 'the --stylesheet-dirs. With --link-stylesheet, '
- 'the path is rewritten relative to the output HTML file. '
- '(default: "%s")' % ','.join(default_stylesheets),
- ['--stylesheet-path'],
- {'metavar': '<file[,file,...]>', 'overrides': 'stylesheet',
- 'validator': frontend.validate_comma_separated_list,
- 'default': default_stylesheets}),
- stylesheet_dirs =
- ('Comma-separated list of directories where stylesheets are found. '
- 'Used by --stylesheet-path when expanding relative path arguments. '
- '(default: "%s")' % ','.join(default_stylesheet_dirs),
- ['--stylesheet-dirs'],
- {'metavar': '<dir[,dir,...]>',
- 'validator': frontend.validate_comma_separated_list,
- 'default': default_stylesheet_dirs}),
- initial_header_level =
- ('Specify the initial header level. Does not affect document '
- 'title & subtitle (see --no-doc-title). (default: 2 for "<h2>")',
- ['--initial-header-level'],
- {'choices': '1 2 3 4 5 6'.split(), 'default': '2',
- 'metavar': '<level>'}),
- no_xml_declaration =
- ('Omit the XML declaration.',
- ['--no-xml-declaration'],
- {'dest': 'xml_declaration', 'action': 'store_false'}),
+ template=(
+ 'Template file. (UTF-8 encoded, default: "%s")'
+ % default_template,
+ ['--template'],
+ {'default': default_template, 'metavar': '<file>'}),
+ stylesheet_path=(
+ 'Comma separated list of stylesheet paths. '
+ 'Relative paths are expanded if a matching file is found in '
+ 'the --stylesheet-dirs. With --link-stylesheet, '
+ 'the path is rewritten relative to the output HTML file. '
+ '(default: "%s")' % ','.join(default_stylesheets),
+ ['--stylesheet-path'],
+ {'metavar': '<file[,file,...]>', 'overrides': 'stylesheet',
+ 'validator': frontend.validate_comma_separated_list,
+ 'default': default_stylesheets}),
+ stylesheet_dirs=(
+ 'Comma-separated list of directories where stylesheets are found. '
+ 'Used by --stylesheet-path when expanding relative path arguments. '
+ '(default: "%s")' % ','.join(default_stylesheet_dirs),
+ ['--stylesheet-dirs'],
+ {'metavar': '<dir[,dir,...]>',
+ 'validator': frontend.validate_comma_separated_list,
+ 'default': default_stylesheet_dirs}),
+ initial_header_level=(
+ 'Specify the initial header level. Does not affect document '
+ 'title & subtitle (see --no-doc-title). (default: 2 for "<h2>")',
+ ['--initial-header-level'],
+ {'choices': '1 2 3 4 5 6'.split(), 'default': '2',
+ 'metavar': '<level>'}),
+ no_xml_declaration=(
+ 'Omit the XML declaration.',
+ ['--no-xml-declaration'],
+ {'dest': 'xml_declaration', 'action': 'store_false'}),
)
settings_spec = settings_spec + (
'HTML5 Writer Options',
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2022-03-03 22:16:23 UTC (rev 9019)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2022-03-03 22:16:35 UTC (rev 9020)
@@ -276,7 +276,7 @@
except IOError:
templatepath = os.path.join(self.default_template_path,
templatepath)
- with open(templatepath, encoding= 'utf8') as fp:
+ with open(templatepath, encoding='utf8') as fp:
template = fp.read()
# fill template
self.assemble_parts() # create dictionary of parts
Modified: trunk/docutils/test/test_writers/test_latex2e.py
===================================================================
--- trunk/docutils/test/test_writers/test_latex2e.py 2022-03-03 22:16:23 UTC (rev 9019)
+++ trunk/docutils/test/test_writers/test_latex2e.py 2022-03-03 22:16:35 UTC (rev 9020)
@@ -59,24 +59,24 @@
$titledata""")
parts = dict(
-head_prefix = r"""\documentclass[a4paper]{article}
+head_prefix=r"""\documentclass[a4paper]{article}
""",
-requirements = r"""\usepackage{ifthen}
+requirements=r"""\usepackage{ifthen}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
""",
-latex_preamble = r"""% PDF Standard Fonts
+latex_preamble=r"""% PDF Standard Fonts
\usepackage{mathptmx} % Times
\usepackage[scaled=.90]{helvet}
\usepackage{courier}
""",
-longtable = r"""\usepackage{longtable,ltcaption,array}
+longtable=r"""\usepackage{longtable,ltcaption,array}
\setlength{\extrarowheight}{2pt}
\newlength{\DUtablewidth} % internal use in tables
""",
-stylesheet = '',
-fallbacks = '',
-fallbacks_highlight = r"""
+stylesheet='',
+fallbacks='',
+fallbacks_highlight=r"""
% basic code highlight:
\providecommand*\DUrolecomment[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
\providecommand*\DUroledeleted[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
@@ -92,7 +92,7 @@
\fi%
}
""",
-pdfsetup = r"""
+pdfsetup=r"""
% hyperlinks:
\ifthenelse{\isundefined{\hypersetup}}{
\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
@@ -100,12 +100,12 @@
\urlstyle{same} % normal text font (alternatives: tt, rm, sf)
}{}
""",
-titledata = '')
+titledata='')
head = head_template.substitute(parts)
head_table = head_template.substitute(
- dict(parts, requirements = parts['requirements'] + parts['longtable']))
+ dict(parts, requirements=parts['requirements'] + parts['longtable']))
head_booktabs = head_template.substitute(
dict(parts, requirements=parts['requirements']
@@ -116,7 +116,7 @@
+ '\\usepackage{textcomp} % text symbol macros\n'))
head_alltt = head_template.substitute(
- dict(parts, requirements = parts['requirements']
+ dict(parts, requirements=parts['requirements']
+ '\\usepackage{alltt}\n'))
@@ -150,8 +150,8 @@
totest['spanish quote'] = [
[".. role:: language-es\n\nUnd damit :language-es:`basta`!",
-head_template.substitute(dict(parts, requirements =
-r"""\usepackage{ifthen}
+head_template.substitute(dict(parts,
+requirements=r"""\usepackage{ifthen}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[spanish,english]{babel}
@@ -165,9 +165,9 @@
totest['code role'] = [
[':code:`x=1`',
-head_template.substitute(dict(parts, requirements = parts['requirements']
+head_template.substitute(dict(parts, requirements=parts['requirements']
+ '\\usepackage{color}\n',
- fallbacks = parts['fallbacks_highlight']))
+ fallbacks=parts['fallbacks_highlight']))
+ r"""
\texttt{\DUrole{code}{x=1}}
@@ -408,7 +408,7 @@
-------------
""",
# expected output
-head_template.substitute(dict(parts, requirements = parts['requirements'] +
+head_template.substitute(dict(parts, requirements=parts['requirements'] +
r"""\setcounter{secnumdepth}{0}
""")) + r"""
some text
@@ -927,8 +927,8 @@
head_template.substitute(
dict(
parts,
- requirements = parts['requirements'] + parts['longtable'],
- fallbacks = r"""
+ requirements=parts['requirements'] + parts['longtable'],
+ fallbacks=r"""
% class handling for environments (block-level elements)
% \begin{DUclass}{spam} tries \DUCLASSspam and
% \end{DUclass}{spam} tries \endDUCLASSspam
@@ -1042,7 +1042,7 @@
""",
head_template.substitute(
dict(parts,
- fallbacks = r"""
+ fallbacks=r"""
% class handling for environments (block-level elements)
% \begin{DUclass}{spam} tries \DUCLASSspam and
% \end{DUclass}{spam} tries \endDUCLASSspam
@@ -1110,8 +1110,8 @@
totest_stylesheet['two-styles'] = [
# input
["""two stylesheet links in the header""",
-head_template.substitute(dict(parts, stylesheet =
-r"""\usepackage{data/spam}
+head_template.substitute(dict(parts,
+stylesheet=r"""\usepackage{data/spam}
\input{data/ham.tex}
""")) + r"""
two stylesheet links in the header
@@ -1123,8 +1123,8 @@
totest_stylesheet_embed['two-styles'] = [
# input
["""two stylesheets embedded in the header""",
-head_template.substitute(dict(parts, stylesheet =
-r"""% Cannot embed stylesheet:
+head_template.substitute(dict(parts,
+stylesheet=r"""% Cannot embed stylesheet:
% [Errno 2] No such file or directory: 'data/spam.sty'
% embedded stylesheet: data/ham.tex
\newcommand{\ham}{wonderful ham}
Modified: trunk/docutils/tools/dev/generate_punctuation_chars.py
===================================================================
--- trunk/docutils/tools/dev/generate_punctuation_chars.py 2022-03-03 22:16:23 UTC (rev 9019)
+++ trunk/docutils/tools/dev/generate_punctuation_chars.py 2022-03-03 22:16:35 UTC (rev 9020)
@@ -276,7 +276,7 @@
return ''.join(l2)
-def wrap_string(s, startstring= "('", endstring = "')", wrap=67):
+def wrap_string(s, startstring="('", endstring="')", wrap=67):
"""Line-wrap a unicode string literal definition."""
c = len(startstring)
contstring = "'\n" + ' '*(len(startstring)-2) + "'"
Modified: trunk/docutils/tools/docutils-cli.py
===================================================================
--- trunk/docutils/tools/docutils-cli.py 2022-03-03 22:16:23 UTC (rev 9019)
+++ trunk/docutils/tools/docutils-cli.py 2022-03-03 22:16:35 UTC (rev 9020)
@@ -90,7 +90,7 @@
publish_cmdline(reader_name=args.reader,
parser_name=args.parser,
writer_name=args.writer,
- settings_spec = settings_spec,
+ settings_spec=settings_spec,
description=description,
argv=remainder)
except ImportError as error:
Modified: trunk/docutils/tox.ini
===================================================================
--- trunk/docutils/tox.ini 2022-03-03 22:16:23 UTC (rev 9019)
+++ trunk/docutils/tox.ini 2022-03-03 22:16:35 UTC (rev 9020)
@@ -38,7 +38,6 @@
# whitespace around the operators with the lowest priority(ies).
# Use your own judgment; …"
- E251, # unexpected spaces around keyword / parameter equals
E261, # at least two spaces before inline comment
E262, # inline comment should start with '# '
E265, # block comment should start with '# '
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|