diff roundup/cgi/templating.py @ 7032:f529cca242dc

flake8: fix imports, flake8 reported the following: templating.py:25:1: F401 'base64' imported but unused templating.py:25:1: F401 'mimetypes' imported but unused templating.py:25:1: F401 'string' imported but unused templating.py:28:1: F401 'time' imported but unused templating.py:28:1: F401 'hashlib' imported but unused templating.py:34:1: F401 'roundup.i18n' imported but unused templating.py:35:1: F401 'roundup.i18n._' imported but unused templating.py:36:1: F401 'roundup.anypy.strings.b2s' imported but unused templating.py:36:1: F401 'roundup.anypy.strings.s2b' imported but unused templating.py:43:1: F401 'roundup.anypy.random_' imported but unused templating.py:47:5: F401 'pickle' imported but unused Turns out time import was used by test_templating via from roundup.cgi.templating import * so added import time to test_templating Also split out multiple imports on one line into sepearate lines. Changed todo = to __todo__ to make flake8 shut up about module level imports not at top of file. Moved definiton of _disable_url_schemes for same reason.
author John Rouillard <rouilj@ieee.org>
date Sun, 09 Oct 2022 18:40:46 -0400
parents 0c99d1d0254a
children 036267634a89
line wrap: on
line diff
--- a/roundup/cgi/templating.py	Sun Oct 09 18:06:16 2022 -0400
+++ b/roundup/cgi/templating.py	Sun Oct 09 18:40:46 2022 -0400
@@ -1,7 +1,7 @@
 """Implements the API used in the HTML templating for the web interface.
 """
 
-todo = """
+__todo__ = """
 - Document parameters to Template.render() method
 - Add tests for Loader.load() method
 - Most methods should have a "default" arg to supply a value
@@ -19,32 +19,22 @@
 
 __docformat__ = 'restructuredtext'
 
-# List of schemes that are not rendered as links in rst and markdown.
-_disable_url_schemes = ['javascript', 'data']
-
-import base64, cgi, re, os.path, mimetypes, csv, string
 import calendar
+import cgi
+import csv
+import os.path
+import re
 import textwrap
-import time, hashlib
-
-from roundup.anypy.html import html_escape
-
-from roundup.anypy import urllib_
+
 from roundup import hyperdb, date, support
-from roundup import i18n
-from roundup.i18n import _
-from roundup.anypy.strings import is_us, b2s, s2b, us2s, s2u, u2s, StringIO
-
-from .KeywordsExpr import render_keywords_expression_editor
-
+from roundup.anypy import urllib_
+from roundup.anypy.html import html_escape
+from roundup.anypy.strings import is_us, us2s, s2u, u2s, StringIO
+from roundup.cgi import TranslationService, ZTUtils
 from roundup.cgi.timestamp import pack_timestamp
-from roundup.cgi import TranslationService
-
-import roundup.anypy.random_ as random_
-try:
-    import cPickle as pickle
-except ImportError:
-    import pickle
+from roundup.exceptions import RoundupException
+from .KeywordsExpr import render_keywords_expression_editor
+
 try:
     from StructuredText.StructuredText import HTML as StructuredText
 except ImportError:
@@ -61,12 +51,15 @@
 except ImportError:
     from itertools import izip_longest as zip_longest
 
-from roundup.exceptions import RoundupException
+
+# List of schemes that are not rendered as links in rst and markdown.
+_disable_url_schemes = ['javascript', 'data']
 
 
 def _import_markdown2():
     try:
-        import markdown2, re
+        import markdown2
+        import re
 
         class Markdown(markdown2.Markdown):
             # don't allow disabled protocols in links
@@ -205,9 +198,6 @@
 
 markdown = _import_markdown2() or _import_markdown() or _import_mistune()
 
-# bring in the templating support
-from roundup.cgi import ZTUtils
-
 
 def anti_csrf_nonce(client, lifetime=None):
     ''' Create a nonce for defending against CSRF attack.

Roundup Issue Tracker: http://roundup-tracker.org/