You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2020/11/11 21:53:47 UTC

[allura] branch master updated: pep8/pycodestyle cleanup

This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git


The following commit(s) were added to refs/heads/master by this push:
     new b24d483  pep8/pycodestyle cleanup
b24d483 is described below

commit b24d483dfb14b24bcafe29e36f79744aa2bfdaf1
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Wed Nov 11 16:53:36 2020 -0500

    pep8/pycodestyle cleanup
---
 Allura/allura/controllers/discuss.py               | 19 ++++++++++---------
 Allura/allura/lib/app_globals.py                   |  2 +-
 Allura/allura/lib/gravatar.py                      |  4 +++-
 Allura/allura/lib/helpers.py                       |  4 +++-
 Allura/allura/lib/import_api.py                    |  4 ++--
 Allura/allura/lib/macro.py                         |  4 +++-
 Allura/allura/lib/plugin.py                        | 15 +++++++--------
 Allura/allura/lib/utils.py                         |  4 +++-
 Allura/allura/model/neighborhood.py                | 13 +++++++------
 Allura/allura/model/project.py                     |  4 +++-
 Allura/allura/scripts/trac_export.py               |  3 ++-
 .../allura/tests/functional/test_neighborhood.py   |  4 +++-
 Allura/allura/tests/test_commands.py               |  4 ++--
 Allura/allura/tests/unit/spam/test_akismet.py      |  4 +++-
 AlluraTest/alluratest/controller.py                |  4 +++-
 AlluraTest/alluratest/validation.py                |  4 +++-
 ForgeBlog/forgeblog/main.py                        |  4 +++-
 .../forgediscussion/controllers/forum.py           |  3 ++-
 ForgeDiscussion/forgediscussion/forum_main.py      |  4 +++-
 ForgeFeedback/forgefeedback/model/feedback.py      |  4 +++-
 ForgeGit/forgegit/tests/model/test_repository.py   |  2 +-
 ForgeImporters/forgeimporters/base.py              | 14 +++++++-------
 ForgeImporters/forgeimporters/github/__init__.py   |  4 +++-
 .../forgeimporters/tests/github/test_extractor.py  |  4 +++-
 .../forgeimporters/trac/tests/test_tickets.py      |  9 ++++-----
 ForgeTracker/forgetracker/model/ticket.py          | 22 +++++++++++++---------
 .../forgetracker/tests/functional/test_rest.py     |  2 +-
 .../forgetracker/tests/functional/test_root.py     |  4 +++-
 .../forgetracker/tests/unit/test_ticket_model.py   |  4 +++-
 fuse/accessfs.py                                   |  5 +++--
 scripts/teamforge-import.py                        |  5 +++--
 scripts/wiki-copy.py                               |  4 +++-
 32 files changed, 116 insertions(+), 74 deletions(-)

diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index c6f18e7..93f2651 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -54,9 +54,10 @@ log = logging.getLogger(__name__)
 
 
 class pass_validator(object):
-
     def validate(self, v, s):
         return v
+
+
 pass_validator = pass_validator()
 
 
@@ -314,7 +315,7 @@ class PostController(six.with_metaclass(h.ProxiedAttrMeta, BaseController)):
         if request.method == 'POST':
             old_text = self.post.text
             require_access(self.post, 'moderate')
-            post_fields = self.W.edit_post.to_python(kw, None)  # could raise Invalid, but doesn't seem like it ever does
+            post_fields = self.W.edit_post.to_python(kw, None)  # could raise Invalid, but doesn't seem like it does
             file_info = post_fields.pop('file_info', None)
             self.post.add_multiple_attachments(file_info)
             for k, v in six.iteritems(post_fields):
@@ -374,15 +375,15 @@ class PostController(six.with_metaclass(h.ProxiedAttrMeta, BaseController)):
             self.post.last_edit_by_id = c.user._id
             self.post.commit()
             g.director.create_activity(c.user, 'modified', self.post,
-                            target=self.post.thread.artifact or self.post.thread,
-                            related_nodes=[self.post.app_config.project],
-                            tags=['comment'])
+                                       target=self.post.thread.artifact or self.post.thread,
+                                       related_nodes=[self.post.app_config.project],
+                                       tags=['comment'])
             return {
-                'status' : 'success'
+                'status': 'success'
             }
         else:
             return {
-                'status' : 'no_permission'
+                'status': 'no_permission'
             }
 
     @expose()
@@ -396,7 +397,7 @@ class PostController(six.with_metaclass(h.ProxiedAttrMeta, BaseController)):
     def post_reaction(self, r, **kw):
         if c.user.is_anonymous():
             return {
-                'error' : 'no_permission'
+                'error': 'no_permission'
             }
         status = 'ok'
         if r in utils.get_reaction_emoji_list():
@@ -563,7 +564,7 @@ class ModerationController(six.with_metaclass(h.ProxiedAttrMeta, BaseController)
                     g.spam_checker.submit_ham(posted.text, artifact=posted, user=posted.author())
                     posted.thread.post_to_feed(posted)
         flash('{} {}'.format(h.text.plural(count, 'post', 'posts'),
-                              'deleted' if delete else 'marked as spam' if spam else 'approved'))
+                             'deleted' if delete else 'marked as spam' if spam else 'approved'))
         redirect(six.ensure_text(request.referer or '/'))
 
     @expose()
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index 7141f66..84c32fa 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -477,7 +477,7 @@ class Globals(object):
 
     @property
     def production_mode(self):
-        return asbool(config.get('debug')) == False
+        return asbool(config.get('debug')) is False
 
     @LazyProperty
     def user_message_time_interval(self):
diff --git a/Allura/allura/lib/gravatar.py b/Allura/allura/lib/gravatar.py
index 60178f9..7a39c87 100644
--- a/Allura/allura/lib/gravatar.py
+++ b/Allura/allura/lib/gravatar.py
@@ -18,7 +18,9 @@
 from __future__ import unicode_literals
 from __future__ import absolute_import
 import re
-import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
+import six.moves.urllib.request
+import six.moves.urllib.parse
+import six.moves.urllib.error
 import hashlib
 
 from tg import config
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index fd660ad..7e15aeb 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -24,7 +24,9 @@ import os
 import os.path
 import difflib
 
-import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
+import six.moves.urllib.request
+import six.moves.urllib.parse
+import six.moves.urllib.error
 import re
 import unicodedata
 import json
diff --git a/Allura/allura/lib/import_api.py b/Allura/allura/lib/import_api.py
index 257f8c8..481264e 100644
--- a/Allura/allura/lib/import_api.py
+++ b/Allura/allura/lib/import_api.py
@@ -17,9 +17,9 @@
 
 from __future__ import unicode_literals
 from __future__ import absolute_import
-import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
-import six.moves.urllib.request, six.moves.urllib.error, six.moves.urllib.parse
+import six.moves.urllib.request
 import six.moves.urllib.parse
+import six.moves.urllib.error
 import hmac
 import hashlib
 import json
diff --git a/Allura/allura/lib/macro.py b/Allura/allura/lib/macro.py
index 147b2bd..a7197de 100644
--- a/Allura/allura/lib/macro.py
+++ b/Allura/allura/lib/macro.py
@@ -21,7 +21,9 @@ import cgi
 import random
 import logging
 import traceback
-import six.moves.urllib.request, six.moves.urllib.error, six.moves.urllib.parse
+import six.moves.urllib.parse
+import six.moves.urllib.request
+import six.moves.urllib.error
 
 import oembed
 import jinja2
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index 0809654..8cae469 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -768,7 +768,8 @@ class LdapAuthenticationProvider(AuthenticationProvider):
                 log.debug('LdapAuth: authorized user {} needs a mongo record registered.  '
                           'Creating...'.format(username))
                 user = M.User.register({'username': username,
-                                        'display_name': LdapUserPreferencesProvider()._get_pref(username, 'display_name'),
+                                        'display_name': LdapUserPreferencesProvider()._get_pref(username,
+                                                                                                'display_name'),
                                         })
             else:
                 log.debug('LdapAuth: no user {} found in local mongo'.format(username))
@@ -933,10 +934,9 @@ class ProjectRegistrationProvider(object):
                       shortname=shortname,
                       name=name,
                       short_description='',
-                      description=(
-                          'You can edit this description in the admin page'),
-                      homepage_title = '# ' + name,
-                      last_updated = datetime.utcnow(),
+                      description='You can edit this description in the admin page',
+                      homepage_title='# ' + name,
+                      last_updated=datetime.utcnow(),
                       is_nbhd_project=True,
                       is_root=True)
         try:
@@ -1025,10 +1025,9 @@ class ProjectRegistrationProvider(object):
                       shortname=shortname,
                       name=project_name,
                       short_description='',
-                      description=(
-                          'You can edit this description in the admin page'),
+                      description='You can edit this description in the admin page',
                       homepage_title=shortname,
-                      last_updated = datetime.utcnow(),
+                      last_updated=datetime.utcnow(),
                       is_nbhd_project=False,
                       is_root=True)
         p.configure_project(
diff --git a/Allura/allura/lib/utils.py b/Allura/allura/lib/utils.py
index 51c08c8..9dd2a75 100644
--- a/Allura/allura/lib/utils.py
+++ b/Allura/allura/lib/utils.py
@@ -36,7 +36,9 @@ from itertools import groupby
 import operator as op
 import collections
 from six.moves.urllib.parse import urlparse
-import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
+import six.moves.urllib.request
+import six.moves.urllib.parse
+import six.moves.urllib.error
 import types
 import socket
 
diff --git a/Allura/allura/model/neighborhood.py b/Allura/allura/model/neighborhood.py
index ffc6c6e..bc201d6 100644
--- a/Allura/allura/model/neighborhood.py
+++ b/Allura/allura/model/neighborhood.py
@@ -47,12 +47,13 @@ class NeighborhoodFile(File):
 
     neighborhood_id = FieldProperty(S.ObjectId)
 
-re_picker_css_type = re.compile('^/\*(.+)\*/')
-re_font_project_title = re.compile('font-family:(.+);\}')
-re_color_project_title = re.compile('color:(.+);\}')
-re_bgcolor_barontop = re.compile('background\-color:([^;}]+);')
-re_bgcolor_titlebar = re.compile('background\-color:([^;}]+);')
-re_color_titlebar = re.compile('color:([^;}]+);')
+
+re_picker_css_type = re.compile(r'^/*(.+)*/')
+re_font_project_title = re.compile(r'font-family:(.+);}')
+re_color_project_title = re.compile(r'color:(.+);}')
+re_bgcolor_barontop = re.compile(r'background-color:([^;}]+);')
+re_bgcolor_titlebar = re.compile(r'background-color:([^;}]+);')
+re_color_titlebar = re.compile(r'color:([^;}]+);')
 
 
 class Neighborhood(MappedClass):
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index c073186..68585b7 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -23,7 +23,9 @@ from calendar import timegm
 from collections import Counter, OrderedDict
 from datetime import datetime
 from copy import deepcopy
-import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
+import six.moves.urllib.request
+import six.moves.urllib.parse
+import six.moves.urllib.error
 import re
 from xml.etree import ElementTree as ET
 
diff --git a/Allura/allura/scripts/trac_export.py b/Allura/allura/scripts/trac_export.py
index e9b1448..a2b9ba4 100644
--- a/Allura/allura/scripts/trac_export.py
+++ b/Allura/allura/scripts/trac_export.py
@@ -24,7 +24,8 @@ import logging
 import sys
 import csv
 import six.moves.urllib.parse
-import six.moves.urllib.request, six.moves.urllib.error, six.moves.urllib.parse
+import six.moves.urllib.request
+import six.moves.urllib.error
 import json
 import time
 import re
diff --git a/Allura/allura/tests/functional/test_neighborhood.py b/Allura/allura/tests/functional/test_neighborhood.py
index ce75e9c..bd69d8e 100644
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -21,7 +21,9 @@ from __future__ import absolute_import
 import json
 import os
 from io import BytesIO
-import six.moves.urllib.request, six.moves.urllib.error, six.moves.urllib.parse
+import six.moves.urllib.parse
+import six.moves.urllib.request
+import six.moves.urllib.error
 from io import open
 
 import PIL
diff --git a/Allura/allura/tests/test_commands.py b/Allura/allura/tests/test_commands.py
index ca6980f..fd5a18b 100644
--- a/Allura/allura/tests/test_commands.py
+++ b/Allura/allura/tests/test_commands.py
@@ -173,14 +173,14 @@ def test_update_neighborhood():
     # make sure the app_configs get freshly queried
     ThreadLocalORMSession.close_all()
     nb = M.Neighborhood.query.get(name='Projects')
-    assert nb.has_home_tool == True
+    assert nb.has_home_tool is True
 
     cmd = create_neighborhood.UpdateNeighborhoodCommand('update-neighborhood')
     cmd.run([test_config, 'Projects', 'False'])
     # make sure the app_configs get freshly queried
     ThreadLocalORMSession.close_all()
     nb = M.Neighborhood.query.get(name='Projects')
-    assert nb.has_home_tool == False
+    assert nb.has_home_tool is False
 
 
 class TestEnsureIndexCommand(object):
diff --git a/Allura/allura/tests/unit/spam/test_akismet.py b/Allura/allura/tests/unit/spam/test_akismet.py
index 670c98f..fbc4cf3 100644
--- a/Allura/allura/tests/unit/spam/test_akismet.py
+++ b/Allura/allura/tests/unit/spam/test_akismet.py
@@ -22,7 +22,9 @@ from __future__ import unicode_literals
 from __future__ import absolute_import
 import mock
 import unittest
-import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
+import six.moves.urllib.request
+import six.moves.urllib.parse
+import six.moves.urllib.error
 from datetime import datetime
 
 from bson import ObjectId
diff --git a/AlluraTest/alluratest/controller.py b/AlluraTest/alluratest/controller.py
index 4f9258f..f34d3fe 100644
--- a/AlluraTest/alluratest/controller.py
+++ b/AlluraTest/alluratest/controller.py
@@ -19,7 +19,9 @@
 from __future__ import unicode_literals
 from __future__ import absolute_import
 import os
-import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
+import six.moves.urllib.request
+import six.moves.urllib.parse
+import six.moves.urllib.error
 import json
 
 import mock
diff --git a/AlluraTest/alluratest/validation.py b/AlluraTest/alluratest/validation.py
index bddfaa2..61188df 100644
--- a/AlluraTest/alluratest/validation.py
+++ b/AlluraTest/alluratest/validation.py
@@ -29,7 +29,9 @@ import logging
 import tempfile
 import subprocess
 import json
-import six.moves.urllib.request, six.moves.urllib.error, six.moves.urllib.parse
+import six.moves.urllib.parse
+import six.moves.urllib.request
+import six.moves.urllib.error
 import re
 import pkg_resources
 import six
diff --git a/ForgeBlog/forgeblog/main.py b/ForgeBlog/forgeblog/main.py
index a362c9b..2d86e2f 100644
--- a/ForgeBlog/forgeblog/main.py
+++ b/ForgeBlog/forgeblog/main.py
@@ -18,7 +18,9 @@
 from __future__ import unicode_literals
 from __future__ import absolute_import
 import logging
-import six.moves.urllib.request, six.moves.urllib.error, six.moves.urllib.parse
+import six.moves.urllib.parse
+import six.moves.urllib.request
+import six.moves.urllib.error
 import json
 
 # Non-stdlib imports
diff --git a/ForgeDiscussion/forgediscussion/controllers/forum.py b/ForgeDiscussion/forgediscussion/controllers/forum.py
index cf0b1f2..0ed159b 100644
--- a/ForgeDiscussion/forgediscussion/controllers/forum.py
+++ b/ForgeDiscussion/forgediscussion/controllers/forum.py
@@ -46,9 +46,10 @@ log = logging.getLogger(__name__)
 
 
 class pass_validator(object):
-
     def validate(self, v, s):
         return v
+
+
 pass_validator = pass_validator()
 
 
diff --git a/ForgeDiscussion/forgediscussion/forum_main.py b/ForgeDiscussion/forgediscussion/forum_main.py
index 47c4735..2bf3f33 100644
--- a/ForgeDiscussion/forgediscussion/forum_main.py
+++ b/ForgeDiscussion/forgediscussion/forum_main.py
@@ -19,7 +19,9 @@
 from __future__ import unicode_literals
 from __future__ import absolute_import
 import logging
-import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
+import six.moves.urllib.request
+import six.moves.urllib.parse
+import six.moves.urllib.error
 import json
 import os
 
diff --git a/ForgeFeedback/forgefeedback/model/feedback.py b/ForgeFeedback/forgefeedback/model/feedback.py
index 3285308..51f53fa 100644
--- a/ForgeFeedback/forgefeedback/model/feedback.py
+++ b/ForgeFeedback/forgefeedback/model/feedback.py
@@ -18,7 +18,9 @@
 from __future__ import unicode_literals
 from __future__ import absolute_import
 import logging
-import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
+import six.moves.urllib.request
+import six.moves.urllib.parse
+import six.moves.urllib.error
 # Non-stdlib imports
 
 from datetime import datetime
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index 39b055c..d69d26f 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -98,7 +98,7 @@ class TestNewGit(unittest.TestCase):
             '1e146e67985dcd71c74de79613719bef7bddca4a/'
             'tree/')
         self.rev.tree.by_name['README']
-        assert self.rev.tree.is_blob('README') == True
+        assert self.rev.tree.is_blob('README') is True
         ThreadLocalORMSession.close_all()
         c.app = None
         converted = g.markdown.convert('[1e146e]')
diff --git a/ForgeImporters/forgeimporters/base.py b/ForgeImporters/forgeimporters/base.py
index ea87738..d959042 100644
--- a/ForgeImporters/forgeimporters/base.py
+++ b/ForgeImporters/forgeimporters/base.py
@@ -22,8 +22,9 @@ import errno
 import logging
 from io import BytesIO
 
-import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
-import six.moves.urllib.request, six.moves.urllib.error, six.moves.urllib.parse
+import six.moves.urllib.request
+import six.moves.urllib.parse
+import six.moves.urllib.error
 from collections import defaultdict
 import traceback
 from six.moves.urllib.parse import urlparse
@@ -337,7 +338,7 @@ class ProjectImporter(BaseController):
         tool imports happen.
 
         :param project: The newly created project.
-        :param \*\*kw: The keyword arguments that were posted to the controller
+        :param **kw: The keyword arguments that were posted to the controller
             method that created the project.
 
         """
@@ -379,8 +380,7 @@ class ToolImporterMeta(type):
     def __init__(cls, name, bases, attrs):
         if not (hasattr(cls, 'target_app_ep_names')
                 or hasattr(cls, 'target_app')):
-            raise AttributeError("{0} must define either "
-                    "`target_app` or `target_app_ep_names`".format(name))
+            raise AttributeError("{0} must define either `target_app` or `target_app_ep_names`".format(name))
         return type.__init__(cls, name, bases, attrs)
 
     def __call__(cls, *args, **kw):
@@ -392,8 +392,8 @@ class ToolImporterMeta(type):
         """
         if not getattr(cls, 'target_app', None):
             cls.target_app = [g.entry_points['tool'][ep_name]
-                    for ep_name in aslist(cls.target_app_ep_names)
-                    if ep_name in g.entry_points['tool']]
+                              for ep_name in aslist(cls.target_app_ep_names)
+                              if ep_name in g.entry_points['tool']]
         return type.__call__(cls, *args, **kw)
 
 
diff --git a/ForgeImporters/forgeimporters/github/__init__.py b/ForgeImporters/forgeimporters/github/__init__.py
index 12fda29..24b0b78 100644
--- a/ForgeImporters/forgeimporters/github/__init__.py
+++ b/ForgeImporters/forgeimporters/github/__init__.py
@@ -21,7 +21,9 @@ import re
 import logging
 import json
 import time
-import six.moves.urllib.request, six.moves.urllib.error, six.moves.urllib.parse
+import six.moves.urllib.parse
+import six.moves.urllib.request
+import six.moves.urllib.error
 from datetime import datetime
 
 from tg import config, session, redirect, request, expose
diff --git a/ForgeImporters/forgeimporters/tests/github/test_extractor.py b/ForgeImporters/forgeimporters/tests/github/test_extractor.py
index 42c9818..4649c24 100644
--- a/ForgeImporters/forgeimporters/tests/github/test_extractor.py
+++ b/ForgeImporters/forgeimporters/tests/github/test_extractor.py
@@ -20,7 +20,9 @@ from __future__ import absolute_import
 import json
 from unittest import TestCase
 from io import BytesIO
-import six.moves.urllib.request, six.moves.urllib.error, six.moves.urllib.parse
+import six.moves.urllib.parse
+import six.moves.urllib.request
+import six.moves.urllib.error
 
 from mock import patch, Mock
 
diff --git a/ForgeImporters/forgeimporters/trac/tests/test_tickets.py b/ForgeImporters/forgeimporters/trac/tests/test_tickets.py
index ee77cd5..a942fd5 100644
--- a/ForgeImporters/forgeimporters/trac/tests/test_tickets.py
+++ b/ForgeImporters/forgeimporters/trac/tests/test_tickets.py
@@ -117,8 +117,7 @@ class TestTracTicketImportController(TestController, TestCase):
         """Mount Trac import controller on the Tracker admin controller"""
         super(TestTracTicketImportController, self).setUp()
         from forgetracker.tracker_main import TrackerAdminController
-        self.importer = TrackerAdminController._importer = \
-                TracTicketImportController(TracTicketImporter())
+        self.importer = TrackerAdminController._importer = TracTicketImportController(TracTicketImporter())
 
     @with_tracker
     def test_index(self):
@@ -194,7 +193,7 @@ class TestTracImportSupport(TestCase):
         import_support.get_slug_by_id = lambda ticket, comment: '123'
         cases = {
             'test link [[2496]](http://testlink.com)':
-            "test link [\[2496\]](http://testlink.com)",
+            r"test link [\[2496\]](http://testlink.com)",
 
             'test ticket ([#201](http://site.net/apps/trac/project/ticket/201))':
             'test ticket ([#201](201))',
@@ -209,7 +208,7 @@ class TestTracImportSupport(TestCase):
             'Fixed in [r1000](r1000)',
 
             '[[Double brackets]](1) the [[whole way]](2).':
-            '[\[Double brackets\]](1) the [\[whole way\]](2).',
+            r'[\[Double brackets\]](1) the [\[whole way\]](2).',
 
             '#200 unchanged':
             '#200 unchanged',
@@ -238,7 +237,7 @@ class TestTracImportSupportFunctional(TestRestApiBase, TestCase):
             status={'$in': ['ok', 'pending']})).sort('timestamp').all()[0].slug
 
         assert '[test comment](204/#%s)' % slug in r
-        assert 'test link [\[2496\]](http://testlink.com)' in r
+        assert r'test link [\[2496\]](http://testlink.com)' in r
         assert 'test ticket ([#201](201))' in r
 
     @with_tracker
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index b287606..6242ba8 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -18,7 +18,9 @@
 from __future__ import unicode_literals
 from __future__ import absolute_import
 import logging
-import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
+import six.moves.urllib.request
+import six.moves.urllib.parse
+import six.moves.urllib.error
 import json
 import difflib
 from datetime import datetime, timedelta
@@ -88,6 +90,7 @@ SOLR_TYPE_DEFAULTS = dict(_b=False, _d=0)
 def get_default_for_solr_type(solr_type):
     return SOLR_TYPE_DEFAULTS.get(solr_type, '')
 
+
 config = utils.ConfigProxy(
     common_suffix='forgemail.domain',
     new_solr='solr.use_new_types')
@@ -534,10 +537,10 @@ class Globals(MappedClass):
     def append_new_labels(self, old_labels, new_labels):
         # append without duplicating any.  preserve order
         labels = old_labels[:]  # make copy to ensure no edits to possible underlying model field
-        for l in new_labels:
-            l = l.strip()
-            if l not in old_labels:
-                labels.append(l)
+        for label in new_labels:
+            label = label.strip()
+            if label not in old_labels:
+                labels.append(label)
         return labels
 
 
@@ -834,9 +837,8 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
         if not fld:
             raise KeyError('Custom field "%s" does not exist.' % custom_user_field_name)
         if fld.type != 'user':
-            raise TypeError('Custom field "%s" is of type "%s"; expected ' \
-                             'type "user".' % (
-                                 custom_user_field_name, fld.type))
+            raise TypeError('Custom field "%s" is of type "%s"; expected type "user".' % (
+                custom_user_field_name, fld.type))
         username = self.custom_fields.get(custom_user_field_name)
         if not username:
             return None
@@ -852,6 +854,7 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
         if bool_flag:
             role_developer = ProjectRole.by_name('Developer')
             role_creator = ProjectRole.by_user(self.reported_by, upsert=True) if self.reported_by else None
+
             def _allow_all(role, perms):
                 return [ACE.allow(role._id, perm) for perm in sorted(perms)]  # sorted just for consistency (for tests)
             # maintain existing access for developers and the ticket creator,
@@ -1306,7 +1309,7 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
                         ticket_by_id[t_id], 'delete', user, app_config.project.root_project)
                     if (security.has_access(ticket_by_id[t_id], 'read', user,
                                             app_config.project.root_project if app_config else None) and
-                            (show_deleted or ticket_by_id[t_id].deleted == False)):
+                            (show_deleted or ticket_by_id[t_id].deleted is False)):
                         tickets.append(ticket_by_id[t_id])
                     else:
                         count = count - 1
@@ -1391,4 +1394,5 @@ class MovedTicket(MovedArtifact):
     def url(self):
         return self.moved_to_url
 
+
 Mapper.compile_all()
diff --git a/ForgeTracker/forgetracker/tests/functional/test_rest.py b/ForgeTracker/forgetracker/tests/functional/test_rest.py
index 68e362d..581e45a 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_rest.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_rest.py
@@ -80,7 +80,7 @@ class TestRestNewTicket(TestTrackerApiBase):
         assert json['reported_by'] == 'test-admin'
         assert json['labels'] == ['foo', 'bar'], json
         assert json['description'] == 'descr', json
-        assert json['private'] == False, json
+        assert json['private'] is False, json
 
     def test_invalid_ticket(self):
         self.app.get('/rest/p/test/bugs/2', status=404)
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index 00ff2c4..587d5c8 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -19,7 +19,9 @@
 from __future__ import unicode_literals
 from __future__ import absolute_import
 from datetime import datetime
-import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
+import six.moves.urllib.request
+import six.moves.urllib.parse
+import six.moves.urllib.error
 import os
 import time
 import json
diff --git a/ForgeTracker/forgetracker/tests/unit/test_ticket_model.py b/ForgeTracker/forgetracker/tests/unit/test_ticket_model.py
index f1ca974..62232b5 100644
--- a/ForgeTracker/forgetracker/tests/unit/test_ticket_model.py
+++ b/ForgeTracker/forgetracker/tests/unit/test_ticket_model.py
@@ -19,7 +19,9 @@ from __future__ import unicode_literals
 from __future__ import absolute_import
 from tg import tmpl_context as c
 from datetime import datetime
-import six.moves.urllib.request, six.moves.urllib.error, six.moves.urllib.parse
+import six.moves.urllib.parse
+import six.moves.urllib.request
+import six.moves.urllib.error
 
 import mock
 from ming.orm.ormsession import ThreadLocalORMSession
diff --git a/fuse/accessfs.py b/fuse/accessfs.py
index 1f7b20d..0eb35f8 100644
--- a/fuse/accessfs.py
+++ b/fuse/accessfs.py
@@ -22,8 +22,9 @@ from __future__ import print_function
 from __future__ import absolute_import
 import os
 import json
-import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
-import six.moves.urllib.request, six.moves.urllib.error, six.moves.urllib.parse
+import six.moves.urllib.request
+import six.moves.urllib.parse
+import six.moves.urllib.error
 import sys
 import pwd
 import errno
diff --git a/scripts/teamforge-import.py b/scripts/teamforge-import.py
index 224d542..22e91f0 100644
--- a/scripts/teamforge-import.py
+++ b/scripts/teamforge-import.py
@@ -28,8 +28,9 @@ from time import mktime
 import time
 import json
 from six.moves.urllib.parse import urlparse
-import six.moves.urllib.request, six.moves.urllib.error, six.moves.urllib.parse
-import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
+import six.moves.urllib.request
+import six.moves.urllib.parse
+import six.moves.urllib.error
 from six.moves.http_cookiejar import CookieJar
 from datetime import datetime
 from six.moves.configparser import ConfigParser
diff --git a/scripts/wiki-copy.py b/scripts/wiki-copy.py
index 1e2b4cb..b931e42 100644
--- a/scripts/wiki-copy.py
+++ b/scripts/wiki-copy.py
@@ -22,7 +22,9 @@ from __future__ import print_function
 from __future__ import absolute_import
 import os
 import sys
-import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
+import six.moves.urllib.request
+import six.moves.urllib.parse
+import six.moves.urllib.error
 import six.moves.urllib.parse
 from optparse import OptionParser
 import json