summaryrefslogtreecommitdiff
path: root/docutils/utils
diff options
context:
space:
mode:
authormilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2022-01-26 19:03:19 +0000
committermilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2022-01-26 19:03:19 +0000
commitdf86fa8525b848efc79172c1e05d16a03f088e80 (patch)
tree90d118d9a81952c9acbc5e85757f0e7316a11bd1 /docutils/utils
parentd03bb68e6944d839d296dcc3940cccf16937cf29 (diff)
downloaddocutils-df86fa8525b848efc79172c1e05d16a03f088e80.tar.gz
Small fixes and clean-ups by Adam Turner.
Remove duplicate definitions in language modules. Import locale_encoding from `docutils.io` Use decorator for staticmethod Use True/False over 1/0. `collections.OrderedDict` no longer required, all dictionaries are ordered from Python 3.7 Remove obsolete `__cmp__` method cf. https://docs.python.org/3/whatsnew/3.0.html#ordering-comparisons Use str instead of type(''). Zero-argument ``super()`` Simplify test support module as "u" prefix isn't used by repr in Python 3. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8973 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/utils')
-rw-r--r--docutils/utils/math/latex2mathml.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/docutils/utils/math/latex2mathml.py b/docutils/utils/math/latex2mathml.py
index 5bbae315d..459281b92 100644
--- a/docutils/utils/math/latex2mathml.py
+++ b/docutils/utils/math/latex2mathml.py
@@ -24,7 +24,6 @@ the API is not settled and may change with any minor Docutils version.
#
# >>> from latex2mathml import *
-import collections
import copy
import re
import sys
@@ -340,7 +339,7 @@ class math(object):
self.children = []
self.extend(children)
- self.attributes = collections.OrderedDict()
+ self.attributes = {}
# sort attributes for predictable functional tests
# as self.attributes.update(attributes) does not keep order in Python < 3.6
for key in sorted(attributes.keys()):
@@ -472,7 +471,7 @@ class mrow(math):
self.children[0].parent = parent
except (AttributeError, ValueError):
return self.children[0]
- return super(mrow, self).close()
+ return super().close()
# >>> mrow(displaystyle=False)
# mrow(displaystyle=False)
@@ -509,7 +508,7 @@ class MathToken(math):
def __init__(self, data, **attributes):
self.data = data
- super(MathToken, self).__init__(**attributes)
+ super().__init__(**attributes)
def _xml_body(self, level=0):
return [str(self.data).translate(self.xml_entities)]
@@ -538,7 +537,7 @@ class MathSchema(math):
math.__init__(self, *children, **kwargs)
def append(self, child):
- current_node = super(MathSchema, self).append(child)
+ current_node = super().append(child)
# normalize order if full
if self.switch and self.full():
self.children[-1], self.children[-2] = self.children[-2], self.children[-1]