summaryrefslogtreecommitdiff
path: root/docutils
diff options
context:
space:
mode:
authormilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2022-03-05 23:27:30 +0000
committermilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2022-03-05 23:27:30 +0000
commit306823e816c6d6ea3c427b67ad29d4a2ec8eca7f (patch)
treeb9f9a0c9b46030aaf2b910170b540241697c8f1c /docutils
parente45243a10d457bf01bbd3bf3aaf1aaa50e298cbf (diff)
downloaddocutils-306823e816c6d6ea3c427b67ad29d4a2ec8eca7f.tar.gz
Fix imports.
flake8 rules E401: multiple imports on one line E402: module level import not at top of file git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@9027 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils')
-rw-r--r--docutils/__init__.py5
-rw-r--r--docutils/utils/smartquotes.py46
-rw-r--r--docutils/writers/_html_base.py3
3 files changed, 27 insertions, 27 deletions
diff --git a/docutils/__init__.py b/docutils/__init__.py
index 760c6f5cb..30382be06 100644
--- a/docutils/__init__.py
+++ b/docutils/__init__.py
@@ -50,6 +50,8 @@ Subpackages:
- writers: Format-specific output translators.
"""
+from collections import namedtuple
+
__docformat__ = 'reStructuredText'
__version__ = '0.19b.dev'
@@ -69,9 +71,6 @@ __version_details__ = 'release'
"""
-from collections import namedtuple
-
-
class VersionInfo(namedtuple('VersionInfo',
'major minor micro releaselevel serial release')):
diff --git a/docutils/utils/smartquotes.py b/docutils/utils/smartquotes.py
index 7b3fea9a5..0d8abd2cf 100644
--- a/docutils/utils/smartquotes.py
+++ b/docutils/utils/smartquotes.py
@@ -259,7 +259,7 @@ the source::
Version History
===============
-1.8.2 2022-01-27
+1.9 2022-03-04
- Code cleanup. Require Python 3.
1.8.1 2017-10-25
@@ -317,6 +317,10 @@ Version History
- Initial release
"""
+import re
+import sys
+
+
options = r"""
Options
=======
@@ -379,12 +383,6 @@ example, ``"1"`` is equivalent to ``"qBde"``.
"""
-default_smartypants_attr = "1"
-
-
-import re, sys
-
-
class smartchars:
"""Smart quotes and dashes"""
@@ -502,11 +500,13 @@ class smartchars:
self.opquote, self.cpquote, self.osquote, self.csquote = '""\'\''
+default_smartypants_attr = '1'
+
+
def smartyPants(text, attr=default_smartypants_attr, language='en'):
"""Main function for "traditional" use."""
- return "".join(t for t in educate_tokens(tokenize(text),
- attr, language))
+ return "".join(t for t in educate_tokens(tokenize(text), attr, language))
def educate_tokens(text_tokens, attr=default_smartypants_attr, language='en'):
@@ -534,36 +534,36 @@ def educate_tokens(text_tokens, attr=default_smartypants_attr, language='en'):
do_stupefy = False
# if attr == "0": # pass tokens unchanged (see below).
- if attr == "1": # Do everything, turn all options on.
+ if attr == '1': # Do everything, turn all options on.
do_quotes = True
do_backticks = True
do_dashes = 1
do_ellipses = True
- elif attr == "2":
+ elif attr == '2':
# Do everything, turn all options on, use old school dash shorthand.
do_quotes = True
do_backticks = True
do_dashes = 2
do_ellipses = True
- elif attr == "3":
+ elif attr == '3':
# Do everything, use inverted old school dash shorthand.
do_quotes = True
do_backticks = True
do_dashes = 3
do_ellipses = True
- elif attr == "-1": # Special "stupefy" mode.
+ elif attr == '-1': # Special "stupefy" mode.
do_stupefy = True
else:
- if "q" in attr: do_quotes = True
- if "b" in attr: do_backticks = True
- if "B" in attr: do_backticks = 2
- if "d" in attr: do_dashes = 1
- if "D" in attr: do_dashes = 2
- if "i" in attr: do_dashes = 3
- if "e" in attr: do_ellipses = True
- if "w" in attr: convert_quot = True
-
- prev_token_last_char = " "
+ if 'q' in attr: do_quotes = True
+ if 'b' in attr: do_backticks = True
+ if 'B' in attr: do_backticks = 2
+ if 'd' in attr: do_dashes = 1
+ if 'D' in attr: do_dashes = 2
+ if 'i' in attr: do_dashes = 3
+ if 'e' in attr: do_ellipses = True
+ if 'w' in attr: convert_quot = True
+
+ prev_token_last_char = ' '
# Last character of the previous text token. Used as
# context to curl leading quote characters correctly.
diff --git a/docutils/writers/_html_base.py b/docutils/writers/_html_base.py
index 1a3b74a53..90ec310f6 100644
--- a/docutils/writers/_html_base.py
+++ b/docutils/writers/_html_base.py
@@ -18,7 +18,8 @@
import base64
import mimetypes
-import os, os.path
+import os
+import os.path
import re
from urllib.request import url2pathname
import warnings