6b24f153d7
All of those patches are picked from upstream. xbps-src check python3-docutils works fine now!
394 lines
10 KiB
Diff
394 lines
10 KiB
Diff
From 41f436c476b1cb6736050a12de0c9732c800019a Mon Sep 17 00:00:00 2001
|
|
From: Stephen Finucane <stephen@that.guru>
|
|
Date: Tue, 19 Nov 2019 23:40:58 +0700
|
|
Subject: [PATCH 01/26] py3: Use new style classes
|
|
|
|
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
|
|
|
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8345 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
|
|
Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
|
|
---
|
|
docutils/__init__.py | 2 +-
|
|
docutils/core.py | 2 +-
|
|
docutils/nodes.py | 54 +++++++++++++++++++++--------
|
|
docutils/parsers/rst/roles.py | 4 +--
|
|
docutils/parsers/rst/states.py | 4 +--
|
|
docutils/parsers/rst/tableparser.py | 2 +-
|
|
docutils/statemachine.py | 8 ++---
|
|
docutils/transforms/__init__.py | 2 +-
|
|
docutils/utils/__init__.py | 2 +-
|
|
docutils/utils/math/latex2mathml.py | 2 +-
|
|
test/DocutilsTestSupport.py | 2 +-
|
|
test/alltests.py | 2 +-
|
|
test/test_statemachine.py | 2 +-
|
|
tools/buildhtml.py | 4 +--
|
|
tools/dev/create_unimap.py | 4 +--
|
|
tools/dev/unicode2rstsubs.py | 2 +-
|
|
16 files changed, 61 insertions(+), 37 deletions(-)
|
|
|
|
diff --git a/docutils/__init__.py b/docutils/__init__.py
|
|
index f06e810..7d6a679 100644
|
|
--- a/docutils/__init__.py
|
|
+++ b/docutils/__init__.py
|
|
@@ -92,7 +92,7 @@ class ApplicationError(StandardError): pass
|
|
class DataError(ApplicationError): pass
|
|
|
|
|
|
-class SettingsSpec:
|
|
+class SettingsSpec(object):
|
|
|
|
"""
|
|
Runtime setting specification base class.
|
|
diff --git a/docutils/core.py b/docutils/core.py
|
|
index 3dc12e8..2eebbf2 100644
|
|
--- a/docutils/core.py
|
|
+++ b/docutils/core.py
|
|
@@ -23,7 +23,7 @@ from docutils.transforms import Transformer
|
|
from docutils.utils.error_reporting import ErrorOutput, ErrorString
|
|
import docutils.readers.doctree
|
|
|
|
-class Publisher:
|
|
+class Publisher(object):
|
|
|
|
"""
|
|
A facade encapsulating the high-level logic of a Docutils system.
|
|
diff --git a/docutils/nodes.py b/docutils/nodes.py
|
|
index d830616..9573208 100644
|
|
--- a/docutils/nodes.py
|
|
+++ b/docutils/nodes.py
|
|
@@ -1112,12 +1112,12 @@ class FixedTextElement(TextElement):
|
|
# Mixins
|
|
# ========
|
|
|
|
-class Resolvable:
|
|
+class Resolvable(object):
|
|
|
|
resolved = 0
|
|
|
|
|
|
-class BackLinkable:
|
|
+class BackLinkable(object):
|
|
|
|
def add_backref(self, refid):
|
|
self['backrefs'].append(refid)
|
|
@@ -1127,39 +1127,63 @@ class BackLinkable:
|
|
# Element Categories
|
|
# ====================
|
|
|
|
-class Root: pass
|
|
+class Root(object):
|
|
+ pass
|
|
+
|
|
+
|
|
+class Titular(object):
|
|
+ pass
|
|
|
|
-class Titular: pass
|
|
|
|
-class PreBibliographic:
|
|
+class PreBibliographic(object):
|
|
"""Category of Node which may occur before Bibliographic Nodes."""
|
|
|
|
-class Bibliographic: pass
|
|
|
|
-class Decorative(PreBibliographic): pass
|
|
+class Bibliographic(object):
|
|
+ pass
|
|
+
|
|
+
|
|
+class Decorative(PreBibliographic):
|
|
+ pass
|
|
+
|
|
+
|
|
+class Structural(object):
|
|
+ pass
|
|
+
|
|
+
|
|
+class Body(object):
|
|
+ pass
|
|
|
|
-class Structural: pass
|
|
|
|
-class Body: pass
|
|
+class General(Body):
|
|
+ pass
|
|
|
|
-class General(Body): pass
|
|
|
|
class Sequential(Body):
|
|
"""List-like elements."""
|
|
|
|
+
|
|
class Admonition(Body): pass
|
|
|
|
+
|
|
class Special(Body):
|
|
"""Special internal body elements."""
|
|
|
|
+
|
|
class Invisible(PreBibliographic):
|
|
"""Internal elements that don't appear in output."""
|
|
|
|
-class Part: pass
|
|
|
|
-class Inline: pass
|
|
+class Part(object):
|
|
+ pass
|
|
+
|
|
+
|
|
+class Inline(object):
|
|
+ pass
|
|
+
|
|
|
|
-class Referential(Resolvable): pass
|
|
+class Referential(Resolvable):
|
|
+ pass
|
|
|
|
|
|
class Targetable(Resolvable):
|
|
@@ -1171,7 +1195,7 @@ class Targetable(Resolvable):
|
|
Required for MoinMoin/reST compatibility."""
|
|
|
|
|
|
-class Labeled:
|
|
+class Labeled(object):
|
|
"""Contains a `label` as its first element."""
|
|
|
|
|
|
@@ -1856,7 +1880,7 @@ node_class_names = """
|
|
"""A list of names of all concrete Node subclasses."""
|
|
|
|
|
|
-class NodeVisitor:
|
|
+class NodeVisitor(object):
|
|
|
|
"""
|
|
"Visitor" pattern [GoF95]_ abstract superclass implementation for
|
|
diff --git a/docutils/parsers/rst/roles.py b/docutils/parsers/rst/roles.py
|
|
index 918e564..aa42c80 100644
|
|
--- a/docutils/parsers/rst/roles.py
|
|
+++ b/docutils/parsers/rst/roles.py
|
|
@@ -181,7 +181,7 @@ def register_generic_role(canonical_name, node_class):
|
|
register_canonical_role(canonical_name, role)
|
|
|
|
|
|
-class GenericRole:
|
|
+class GenericRole(object):
|
|
|
|
"""
|
|
Generic interpreted text role, where the interpreted text is simply
|
|
@@ -198,7 +198,7 @@ class GenericRole:
|
|
return [self.node_class(rawtext, utils.unescape(text), **options)], []
|
|
|
|
|
|
-class CustomRole:
|
|
+class CustomRole(object):
|
|
|
|
"""
|
|
Wrapper for custom interpreted text roles.
|
|
diff --git a/docutils/parsers/rst/states.py b/docutils/parsers/rst/states.py
|
|
index d8ca9f0..2ece3b3 100644
|
|
--- a/docutils/parsers/rst/states.py
|
|
+++ b/docutils/parsers/rst/states.py
|
|
@@ -126,7 +126,7 @@ class ParserError(ApplicationError): pass
|
|
class MarkupMismatch(Exception): pass
|
|
|
|
|
|
-class Struct:
|
|
+class Struct(object):
|
|
|
|
"""Stores data attributes for dotted-attribute access."""
|
|
|
|
@@ -459,7 +459,7 @@ def build_regexp(definition, compile=True):
|
|
return regexp
|
|
|
|
|
|
-class Inliner:
|
|
+class Inliner(object):
|
|
|
|
"""
|
|
Parse inline markup; call the `parse()` method.
|
|
diff --git a/docutils/parsers/rst/tableparser.py b/docutils/parsers/rst/tableparser.py
|
|
index e19388b..45af72f 100644
|
|
--- a/docutils/parsers/rst/tableparser.py
|
|
+++ b/docutils/parsers/rst/tableparser.py
|
|
@@ -40,7 +40,7 @@ class TableMarkupError(DataError):
|
|
DataError.__init__(self, *args)
|
|
|
|
|
|
-class TableParser:
|
|
+class TableParser(object):
|
|
|
|
"""
|
|
Abstract superclass for the common parts of the syntax-specific parsers.
|
|
diff --git a/docutils/statemachine.py b/docutils/statemachine.py
|
|
index 6bb3c6b..2188982 100644
|
|
--- a/docutils/statemachine.py
|
|
+++ b/docutils/statemachine.py
|
|
@@ -114,7 +114,7 @@ from docutils import utils
|
|
from docutils.utils.error_reporting import ErrorOutput
|
|
|
|
|
|
-class StateMachine:
|
|
+class StateMachine(object):
|
|
|
|
"""
|
|
A finite state machine for text filters using regular expressions.
|
|
@@ -518,7 +518,7 @@ class StateMachine:
|
|
observer(*info)
|
|
|
|
|
|
-class State:
|
|
+class State(object):
|
|
|
|
"""
|
|
State superclass. Contains a list of transitions, and transition methods.
|
|
@@ -1034,7 +1034,7 @@ class StateWS(State):
|
|
return context, next_state, results
|
|
|
|
|
|
-class _SearchOverride:
|
|
+class _SearchOverride(object):
|
|
|
|
"""
|
|
Mix-in class to override `StateMachine` regular expression behavior.
|
|
@@ -1067,7 +1067,7 @@ class SearchStateMachineWS(_SearchOverride, StateMachineWS):
|
|
pass
|
|
|
|
|
|
-class ViewList:
|
|
+class ViewList(object):
|
|
|
|
"""
|
|
List with extended functionality: slices of ViewList objects are child
|
|
diff --git a/docutils/transforms/__init__.py b/docutils/transforms/__init__.py
|
|
index b009c5f..9271133 100644
|
|
--- a/docutils/transforms/__init__.py
|
|
+++ b/docutils/transforms/__init__.py
|
|
@@ -30,7 +30,7 @@ from docutils import languages, ApplicationError, TransformSpec
|
|
class TransformError(ApplicationError): pass
|
|
|
|
|
|
-class Transform:
|
|
+class Transform(object):
|
|
|
|
"""
|
|
Docutils transform component abstract base class.
|
|
diff --git a/docutils/utils/__init__.py b/docutils/utils/__init__.py
|
|
index be1c37e..7760f38 100644
|
|
--- a/docutils/utils/__init__.py
|
|
+++ b/docutils/utils/__init__.py
|
|
@@ -33,7 +33,7 @@ class SystemMessage(ApplicationError):
|
|
class SystemMessagePropagation(ApplicationError): pass
|
|
|
|
|
|
-class Reporter:
|
|
+class Reporter(object):
|
|
|
|
"""
|
|
Info/warning/error reporter and ``system_message`` element generator.
|
|
diff --git a/docutils/utils/math/latex2mathml.py b/docutils/utils/math/latex2mathml.py
|
|
index bcb4877..1a01bc8 100644
|
|
--- a/docutils/utils/math/latex2mathml.py
|
|
+++ b/docutils/utils/math/latex2mathml.py
|
|
@@ -155,7 +155,7 @@ negatables = {'=': u'\u2260',
|
|
r'\equiv': u'\u2262'}
|
|
|
|
# LaTeX to MathML translation stuff:
|
|
-class math:
|
|
+class math(object):
|
|
"""Base class for MathML elements."""
|
|
|
|
nchildren = 1000000
|
|
diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py
|
|
index 54ba1c4..f7986f5 100644
|
|
--- a/test/DocutilsTestSupport.py
|
|
+++ b/test/DocutilsTestSupport.py
|
|
@@ -92,7 +92,7 @@ except:
|
|
StringList.__repr__ = StringList.__str__
|
|
|
|
|
|
-class DevNull:
|
|
+class DevNull(object):
|
|
|
|
"""Output sink."""
|
|
|
|
diff --git a/test/alltests.py b/test/alltests.py
|
|
index 4a9b50f..9373124 100755
|
|
--- a/test/alltests.py
|
|
+++ b/test/alltests.py
|
|
@@ -24,7 +24,7 @@ import DocutilsTestSupport # must be imported before docutils
|
|
import docutils
|
|
|
|
|
|
-class Tee:
|
|
+class Tee(object):
|
|
|
|
"""Write to a file and a stream (default: stdout) simultaneously."""
|
|
|
|
diff --git a/test/test_statemachine.py b/test/test_statemachine.py
|
|
index 0e41337..07c561e 100755
|
|
--- a/test/test_statemachine.py
|
|
+++ b/test/test_statemachine.py
|
|
@@ -203,7 +203,7 @@ class SMWSTests(unittest.TestCase):
|
|
self.assertEqual(self.sm.run(testtext), expected)
|
|
|
|
|
|
-class EmptyClass:
|
|
+class EmptyClass(object):
|
|
pass
|
|
|
|
|
|
diff --git a/tools/buildhtml.py b/tools/buildhtml.py
|
|
index 3333eab..aa4c759 100755
|
|
--- a/tools/buildhtml.py
|
|
+++ b/tools/buildhtml.py
|
|
@@ -107,7 +107,7 @@ class OptionParser(frontend.OptionParser):
|
|
return source, destination
|
|
|
|
|
|
-class Struct:
|
|
+class Struct(object):
|
|
|
|
"""Stores data attributes for dotted-attribute access."""
|
|
|
|
@@ -115,7 +115,7 @@ class Struct:
|
|
self.__dict__.update(keywordargs)
|
|
|
|
|
|
-class Builder:
|
|
+class Builder(object):
|
|
|
|
def __init__(self):
|
|
self.publishers = {
|
|
diff --git a/tools/dev/create_unimap.py b/tools/dev/create_unimap.py
|
|
index 0e45458..a1d92ac 100755
|
|
--- a/tools/dev/create_unimap.py
|
|
+++ b/tools/dev/create_unimap.py
|
|
@@ -28,8 +28,8 @@ def w(s):
|
|
text_map = {}
|
|
math_map = {}
|
|
|
|
-class Visitor:
|
|
-
|
|
+
|
|
+class Visitor(object):
|
|
"""Node visitor for contents of unicode.xml."""
|
|
|
|
def visit_character(self, node):
|
|
diff --git a/tools/dev/unicode2rstsubs.py b/tools/dev/unicode2rstsubs.py
|
|
index b741894..d719005 100755
|
|
--- a/tools/dev/unicode2rstsubs.py
|
|
+++ b/tools/dev/unicode2rstsubs.py
|
|
@@ -59,7 +59,7 @@ def process(infile):
|
|
grouper.write_sets()
|
|
|
|
|
|
-class CharacterEntitySetExtractor:
|
|
+class CharacterEntitySetExtractor(object):
|
|
|
|
"""
|
|
Extracts character entity information from unicode.xml file, groups it by
|
|
--
|
|
2.24.0.375.geb5ae68d41
|
|
|