|
From: <mi...@us...> - 2022-01-26 19:04:31
|
Revision: 8978
http://sourceforge.net/p/docutils/code/8978
Author: milde
Date: 2022-01-26 19:04:28 +0000 (Wed, 26 Jan 2022)
Log Message:
-----------
Use "x not in y" over "not x in y"
Modified Paths:
--------------
trunk/docutils/docutils/nodes.py
trunk/docutils/docutils/parsers/rst/directives/admonitions.py
trunk/docutils/docutils/utils/__init__.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/latex2e/__init__.py
trunk/docutils/docutils/writers/manpage.py
trunk/docutils/docutils/writers/odf_odt/__init__.py
trunk/docutils/tools/test/test_buildhtml.py
Modified: trunk/docutils/docutils/nodes.py
===================================================================
--- trunk/docutils/docutils/nodes.py 2022-01-26 19:04:14 UTC (rev 8977)
+++ trunk/docutils/docutils/nodes.py 2022-01-26 19:04:28 UTC (rev 8978)
@@ -765,7 +765,7 @@
"""
# List Concatenation
for value in values:
- if not value in self[attr]:
+ if value not in self[attr]:
self[attr].append(value)
def coerce_append_attr_list(self, attr, value):
Modified: trunk/docutils/docutils/parsers/rst/directives/admonitions.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/directives/admonitions.py 2022-01-26 19:04:14 UTC (rev 8977)
+++ trunk/docutils/docutils/parsers/rst/directives/admonitions.py 2022-01-26 19:04:28 UTC (rev 8978)
@@ -40,7 +40,7 @@
self.state_machine.get_source_and_line(self.lineno))
admonition_node += title
admonition_node += messages
- if not 'classes' in self.options:
+ if 'classes' not in self.options:
admonition_node['classes'] += ['admonition-' +
nodes.make_id(title_text)]
self.state.nested_parse(self.content, self.content_offset,
Modified: trunk/docutils/docutils/utils/__init__.py
===================================================================
--- trunk/docutils/docutils/utils/__init__.py 2022-01-26 19:04:14 UTC (rev 8977)
+++ trunk/docutils/docutils/utils/__init__.py 2022-01-26 19:04:28 UTC (rev 8978)
@@ -168,7 +168,7 @@
if line is not None:
attributes.setdefault('line', line)
# assert source is not None, "node has line- but no source-argument"
- if not 'source' in attributes: # 'line' is absolute line number
+ if 'source' not in attributes: # 'line' is absolute line number
try: # look up (source, line-in-source)
source, line = self.get_source_and_line(attributes.get('line'))
except AttributeError:
@@ -648,7 +648,7 @@
def uniq(L):
r = []
for item in L:
- if not item in r:
+ if item not in r:
r.append(item)
return r
@@ -727,7 +727,7 @@
is not None.
"""
for filename in filenames:
- if not filename in self.list:
+ if filename not in self.list:
self.list.append(filename)
if self.file is not None:
self.file.write(filename+'\n')
Modified: trunk/docutils/docutils/utils/math/math2html.py
===================================================================
--- trunk/docutils/docutils/utils/math/math2html.py 2022-01-26 19:04:14 UTC (rev 8977)
+++ trunk/docutils/docutils/utils/math/math2html.py 2022-01-26 19:04:28 UTC (rev 8978)
@@ -753,7 +753,7 @@
if len(split) == 1:
self.parameters[key] = True
return
- if not '"' in split[1]:
+ if '"' not in split[1]:
self.parameters[key] = split[1].strip()
return
doublesplit = split[1].split('"')
@@ -1414,7 +1414,7 @@
def getparameter(self, name):
"Get the value of a parameter, if present."
- if not name in self.parameters:
+ if name not in self.parameters:
return None
return self.parameters[name]
@@ -1591,7 +1591,7 @@
def parsesingleliner(self, reader, start, ending):
"Parse a formula in one line"
line = reader.currentline().strip()
- if not start in line:
+ if start not in line:
Trace.error('Line ' + line + ' does not contain formula start ' + start)
return ''
if not line.endswith(ending):
@@ -1606,7 +1606,7 @@
"Parse a formula in multiple lines"
formula = ''
line = reader.currentline()
- if not start in line:
+ if start not in line:
Trace.error('Line ' + line.strip() + ' does not contain formula start ' + start)
return ''
index = line.index(start)
@@ -2051,7 +2051,7 @@
def instance(self, type):
"Get an instance of the given type."
- if not type in self.instances or not self.instances[type]:
+ if type not in self.instances or not self.instances[type]:
self.instances[type] = self.create(type)
return self.instances[type]
@@ -2947,7 +2947,7 @@
def getparam(self, name):
"Get a parameter as parsed."
- if not name in self.params:
+ if name not in self.params:
return None
return self.params[name]
@@ -3018,7 +3018,7 @@
def writeparam(self, pos):
"Write a single param of the form $0, $x..."
name = '$' + pos.skipcurrent()
- if not name in self.params:
+ if name not in self.params:
Trace.error('Unknown parameter ' + name)
return None
if not self.params[name]:
@@ -3055,7 +3055,7 @@
Trace.error('Function f' + str(index) + ' is not defined')
return None
tag = self.translated[2 + index]
- if not '$' in tag:
+ if '$' not in tag:
return tag
for variable in self.params:
if variable in tag:
@@ -3076,7 +3076,7 @@
def computehybridsize(self):
"Compute the size of the hybrid function."
- if not self.command in HybridSize.configsizes:
+ if self.command not in HybridSize.configsizes:
self.computesize()
return
self.size = HybridSize().getsize(self)
Modified: trunk/docutils/docutils/writers/_html_base.py
===================================================================
--- trunk/docutils/docutils/writers/_html_base.py 2022-01-26 19:04:14 UTC (rev 8977)
+++ trunk/docutils/docutils/writers/_html_base.py 2022-01-26 19:04:28 UTC (rev 8978)
@@ -996,7 +996,7 @@
if 'height' in node:
atts['height'] = node['height']
if 'scale' in node:
- if (PIL and not ('width' in node and 'height' in node)
+ if (PIL and ('width' not in node or 'height' not in node)
and self.settings.file_insertion_enabled):
imagepath = url2pathname(uri)
try:
@@ -1568,8 +1568,9 @@
self.body.append('</table>\n')
def visit_target(self, node):
- if not ('refuri' in node or 'refid' in node
- or 'refname' in node):
+ if ('refuri' not in node
+ and 'refid' not in node
+ and 'refname' not in node):
self.body.append(self.starttag(node, 'span', '', CLASS='target'))
self.context.append('</span>')
else:
Modified: trunk/docutils/docutils/writers/html4css1/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/html4css1/__init__.py 2022-01-26 19:04:14 UTC (rev 8977)
+++ trunk/docutils/docutils/writers/html4css1/__init__.py 2022-01-26 19:04:28 UTC (rev 8978)
@@ -559,7 +559,7 @@
if 'height' in node:
atts['height'] = node['height']
if 'scale' in node:
- if (PIL and not ('width' in node and 'height' in node)
+ if (PIL and ('width' not in node or 'height' not in node)
and self.settings.file_insertion_enabled):
imagepath = url2pathname(uri)
try:
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2022-01-26 19:04:14 UTC (rev 8977)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2022-01-26 19:04:28 UTC (rev 8978)
@@ -2388,7 +2388,7 @@
# Convert image URI to a local file path
imagepath = url2pathname(attrs['uri']).replace('\\', '/')
# alignment defaults:
- if not 'align' in attrs:
+ if 'align' not in attrs:
# Set default align of image in a figure to 'center'
if isinstance(node.parent, nodes.figure):
attrs['align'] = 'center'
@@ -2763,7 +2763,7 @@
self.out.append('}}')
def visit_raw(self, node):
- if not 'latex' in node.get('format', '').split():
+ if 'latex' not in node.get('format', '').split():
raise nodes.SkipNode
if not (self.is_inline(node)
or isinstance(node.parent, nodes.compound)):
Modified: trunk/docutils/docutils/writers/manpage.py
===================================================================
--- trunk/docutils/docutils/writers/manpage.py 2022-01-26 19:04:14 UTC (rev 8977)
+++ trunk/docutils/docutils/writers/manpage.py 2022-01-26 19:04:28 UTC (rev 8978)
@@ -599,7 +599,7 @@
self._docinfo[name],
self.defs['indent'][1],
self.defs['indent'][1]))
- elif not name in skip:
+ elif name not in skip:
if name in self._docinfo_names:
label = self._docinfo_names[name]
else:
Modified: trunk/docutils/docutils/writers/odf_odt/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/odf_odt/__init__.py 2022-01-26 19:04:14 UTC (rev 8977)
+++ trunk/docutils/docutils/writers/odf_odt/__init__.py 2022-01-26 19:04:28 UTC (rev 8978)
@@ -3175,9 +3175,9 @@
#
# I don't know how to implement targets in ODF.
# How do we create a target in oowriter? A cross-reference?
- if not ('refuri' in node or
- 'refid' in node or
- 'refname' in node):
+ if ('refuri' not in node
+ and 'refid' not in node
+ and 'refname' not in node):
pass
else:
pass
Modified: trunk/docutils/tools/test/test_buildhtml.py
===================================================================
--- trunk/docutils/tools/test/test_buildhtml.py 2022-01-26 19:04:14 UTC (rev 8977)
+++ trunk/docutils/tools/test/test_buildhtml.py 2022-01-26 19:04:28 UTC (rev 8978)
@@ -76,7 +76,7 @@
for s in self.tree:
s = os.path.join(self.root, s)
- if not "." in s:
+ if "." not in s:
os.mkdir(s)
else:
fd_s = open(s, "w")
@@ -86,7 +86,7 @@
def tearDown(self):
for i in range(len(self.tree) - 1, -1, -1):
s = os.path.join(self.root, self.tree[i])
- if not "." in s:
+ if "." not in s:
os.rmdir(s)
else:
os.remove(s)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|