From 48dfdf4a9ee943c2d1f4525bfae2f916144b3f76 Mon Sep 17 00:00:00 2001
From: Aurélien Bompard <aurelien@bompard.org>
Date: Mar 16 2017 10:20:53 +0000
Subject: Fix all flake8 errors


---

diff --git a/check-cache-coverage.py b/check-cache-coverage.py
index d092dfd..efe45ab 100755
--- a/check-cache-coverage.py
+++ b/check-cache-coverage.py
@@ -16,7 +16,6 @@ Authors:    Ralph Bean <rbean@redhat.com>
 from __future__ import unicode_literals, print_function
 
 import sys
-import dogpile.cache
 
 import hubs.app
 import hubs.widgets
diff --git a/check-queue-length.py b/check-queue-length.py
index 5b14d0f..1a07f79 100755
--- a/check-queue-length.py
+++ b/check-queue-length.py
@@ -13,14 +13,14 @@ We could also graph this in collectd, for fun and profit.
 Authors:    Ralph Bean <rbean@redhat.com>
 """
 
-from __future__ import unicode_literals
+from __future__ import unicode_literals, print_function
+
+import retask
 
 import fedmsg.config
 config = fedmsg.config.load_config()
 
-import retask
-
 for item in ['triage', 'work']:
     queue = retask.queue.Queue(config['hubs.redis.%s-queue-name' % item])
     queue.connect()
-    print ' (%s) queue length is %i' % (item, queue.length)
+    print(' (%s) queue length is %i' % (item, queue.length))
diff --git a/delete-user.py b/delete-user.py
index 8c54582..9c79fc9 100755
--- a/delete-user.py
+++ b/delete-user.py
@@ -4,32 +4,31 @@
 Useful for testing what happens when you recreate them.
 """
 
-from __future__ import unicode_literals
-
-import sys
+from __future__ import unicode_literals, print_function
 
 import fedmsg.config
-fedmsg_config = fedmsg.config.load_config()
 
 import hubs.models
 
+fedmsg_config = fedmsg.config.load_config()
+
 session = hubs.models.init(fedmsg_config['hubs.sqlalchemy.uri'])
 
-username = raw_input('What user do you want to delete: ')
+username = input('What user do you want to delete: ')
 openid = '%s.id.fedoraproject.org' % username
-print "Looking for account %r" % openid
+print("Looking for account %r" % openid)
 user = hubs.models.User.get(openid)
 if not user:
-    print "No such user %r" % openid
+    print("No such user %r" % openid)
 else:
-    print "Found %r.  Deleting." % user
+    print("Found %r.  Deleting." % user)
     session.delete(user)
 
 hub = hubs.models.Hub.get(username)
 if not hub:
-    print "No such hub %r" % username
+    print("No such hub %r" % username)
 else:
-    print "Found %r.  Deleting." % hub
+    print("Found %r.  Deleting." % hub)
     session.delete(hub)
 
 session.commit()
diff --git a/docs/conf.py b/docs/conf.py
index 27b4be2..9264743 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -150,8 +150,8 @@ html_theme = 'alabaster'
 # html_logo = None
 
 # The name of an image file (relative to this directory) to use as a favicon of
-# the docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
-# pixels large.
+# the docs.  This file should be a Windows icon file (.ico) being 16x16 or
+# 32x32 pixels large.
 #
 # html_favicon = None
 
diff --git a/fedmsg.d/base.py b/fedmsg.d/base.py
index ddc1a81..57b487a 100644
--- a/fedmsg.d/base.py
+++ b/fedmsg.d/base.py
@@ -17,8 +17,6 @@
 #
 # Authors:  Ralph Bean <rbean@redhat.com>
 
-import os
-
 config = dict(
     # Set this to dev if you're hacking on fedmsg or an app.
     # Set to stg or prod if running in the Fedora Infrastructure
@@ -28,14 +26,14 @@ config = dict(
     high_water_mark=0,
     io_threads=1,
 
-    ## For the fedmsg-hub and fedmsg-relay. ##
+    # # For the fedmsg-hub and fedmsg-relay. # #
 
     # This is a status dir to keep a record of the last processed message
-    #status_directory=os.getcwd() + "/status",
-    #status_directory='/var/run/fedmsg/status',
+    # status_directory=os.getcwd() + "/status",
+    # status_directory='/var/run/fedmsg/status',
 
     # This is the URL of a datagrepper instance that we can query for backlog.
-    #datagrepper_url="https://apps.fedoraproject.org/datagrepper/raw",
+    # datagrepper_url="https://apps.fedoraproject.org/datagrepper/raw",
 
     # We almost always want the fedmsg-hub to be sending messages with zmq as
     # opposed to amqp or stomp.
diff --git a/fedmsg.d/testconfig.py b/fedmsg.d/testconfig.py
index 1f45487..8f4f105 100644
--- a/fedmsg.d/testconfig.py
+++ b/fedmsg.d/testconfig.py
@@ -21,7 +21,8 @@ config = {
         ]
     },
 
-    'datanommer.sqlalchemy.uri': 'postgres://postgres:laksjdf@127.0.0.1/datanommer',
+    'datanommer.sqlalchemy.uri':
+        'postgres://postgres:laksjdf@127.0.0.1/datanommer',
 
     'fmn.url': 'https://apps.fedoraproject.org/notifications',
 
@@ -47,7 +48,8 @@ config = {
 
     # Run datanommer locally, just for development.
     'datanommer.enabled': True,
-    'datanommer.sqlalchemy.url': 'postgres://postgres:laksjdf@127.0.0.1/datanommer',
+    'datanommer.sqlalchemy.url':
+        'postgres://postgres:laksjdf@127.0.0.1/datanommer',
 
     # Only do one of these so we can try to not run out of memory.
     'moksha.workers_per_consumer': 1,
diff --git a/hubs/app.py b/hubs/app.py
index 0e81a8d..a32788b 100644
--- a/hubs/app.py
+++ b/hubs/app.py
@@ -1,20 +1,18 @@
 from __future__ import unicode_literals
 
 import datetime
-import json
 import logging
 import os
 
+import datanommer.models
+import fedmsg.config
+import fedmsg.meta
 import flask
 import flask.json
 import munch
-
 from flask_oidc import OpenIDConnect
 
 import hubs.models
-
-import datanommer.models
-
 from hubs.utils import username2avatar
 
 app = flask.Flask(__name__)
@@ -34,15 +32,13 @@ app.config.from_object('hubs.default_config')
 if 'HUBS_CONFIG' in os.environ:
     app.config.from_envvar('HUBS_CONFIG')
 
-import fedmsg.config
-import fedmsg.meta
-
 fedmsg_config = fedmsg.config.load_config()
 fedmsg.meta.make_processors(**fedmsg_config)
 
 session = hubs.models.init(fedmsg_config['hubs.sqlalchemy.uri'])
 datanommer.models.init(fedmsg_config['datanommer.sqlalchemy.uri'])
 
+
 @app.before_request
 def store_db():
     flask.g.db = session
@@ -74,7 +70,7 @@ def shutdown_session(exception=None):
 
 
 # Set up OpenIDConnect
-OIDC = OpenIDConnect(app, credentials_store=flask.session )
+OIDC = OpenIDConnect(app, credentials_store=flask.session)
 
 
 @app.before_request
@@ -86,17 +82,16 @@ def check_auth():
         if not hasattr(flask.session, 'auth') or not flask.session.auth:
             flask.session.auth = munch.Munch(
                 fullname=OIDC.user_getfield('name'),
-                nickname=OIDC.user_getfield('nickname') \
-                    or OIDC.user_getfield('sub'),
+                nickname=(OIDC.user_getfield('nickname') or
+                          OIDC.user_getfield('sub')),
                 email=OIDC.user_getfield('email'),
                 timezone=OIDC.user_getfield('zoneinfo'),
-                cla_done=\
-                    'http://admin.fedoraproject.org/accounts/cla/done' \
-                    in OIDC.user_getfield('cla'),
+                cla_done=('http://admin.fedoraproject.org/accounts/cla/done'
+                          in OIDC.user_getfield('cla')),
                 groups=OIDC.user_getfield('groups'),
                 logged_in=True,
             )
-            flask.session.auth.avatar=username2avatar(
+            flask.session.auth.avatar = username2avatar(
                 flask.session.auth.nickname)
             flask.session.auth.user = hubs.models.User.by_username(
                 flask.session.auth.nickname)
@@ -105,11 +100,11 @@ def check_auth():
         flask.g.auth = munch.Munch(logged_in=False)
 
 # Register widgets
-import hubs.widgets
+import hubs.widgets  # noqa
 hubs.widgets.registry.register_list(app.config["WIDGETS"])
 
 # Register routes
-import hubs.views
+import hubs.views  # noqa
 
 # Add widget-specific routes
 hubs.widgets.registry.register_routes(app)
diff --git a/hubs/backend/triage.py b/hubs/backend/triage.py
index 7320460..7ea3645 100755
--- a/hubs/backend/triage.py
+++ b/hubs/backend/triage.py
@@ -21,28 +21,27 @@ handle.
 
 from __future__ import unicode_literals
 
-import hubs.app
-import hubs.models
-
-import hubs.widgets.base
+import json
+import logging
+import logging.config
+import random
+import sys
 
 import fedmsg.config
 import fedmsg.meta
-config = fedmsg.config.load_config()
-
 import retask.queue
 
-import json
-import random
-import sys
-import logging
-import logging.config
+import hubs.app
+import hubs.models
+import hubs.widgets.base
+
+
 log = logging.getLogger('hubs.backend.triage')
+config = fedmsg.config.load_config()
 
 
 def triage(session, outbound, msg):
     topic = msg['topic']
-    category = topic.split('.')[3]
 
     for suffix in config['hubs.junk_suffixes']:
         if topic.endswith(suffix):
@@ -115,5 +114,6 @@ def main(args):
 
     return 0
 
+
 if __name__ == '__main__':
     sys.exit(main(sys.argv))
diff --git a/hubs/backend/worker.py b/hubs/backend/worker.py
index e8e63e3..552d781 100755
--- a/hubs/backend/worker.py
+++ b/hubs/backend/worker.py
@@ -26,29 +26,29 @@ clients with the new content produced here.
 
 from __future__ import unicode_literals
 
-import hubs.app
-import hubs.models
-
-import hubs.widgets.base
+import json
+import logging
+import logging.config
+import sys
 
 import fedmsg.config
 import fedmsg.meta
-config = fedmsg.config.load_config()
-
 import retask.queue
 
-import json
-import sys
-import logging
-import logging.config
+import hubs.app
+import hubs.models
+import hubs.widgets.base
+
+
 log = logging.getLogger('hubs.backend.worker')
+config = fedmsg.config.load_config()
 
 
 def work(widget_idx, fn_name):
     # Get a real widget, because we update last_refreshed on it.
     widget = hubs.models.Widget.by_idx(widget_idx)
     fn_class = widget.module.get_cached_functions()[fn_name]
-    log.info("! Rebuilding cache for %r:%r" % (widget, cached_fn))
+    log.info("! Rebuilding cache for %r:%r" % (widget, fn_name))
     # Invalidate the cache...
     fn_class(widget).rebuild()
     # TODO -- fire off an EventSource notice that we updated stuff
@@ -88,7 +88,6 @@ def main(args):
             task = queue.wait()  # Wait forever...  timeout is optional.
             log.info("Working on %r.  (backlog is %r)" % (task, queue.length))
             item = json.loads(task.data)
-            idx = item['idx']  # A widget ID
             handle(item['idx'], item['fn_name'])
             log.debug("  Done.")
     except KeyboardInterrupt:
@@ -96,5 +95,6 @@ def main(args):
 
     return 0
 
+
 if __name__ == '__main__':
     sys.exit(main(sys.argv))
diff --git a/hubs/default_config.py b/hubs/default_config.py
index 688e51c..5837486 100644
--- a/hubs/default_config.py
+++ b/hubs/default_config.py
@@ -31,7 +31,8 @@ OIDC_SCOPES = [
 
 # TODO - instead of 'develop', use the version from pkg_resources to figure out
 #        the right tag to link people to.  AGPL ftw.
-SOURCE_URL = 'https://pagure.io/fedora-hubs/blob/develop/f'  # /hubs/widgets/badges.py'
+SOURCE_URL = 'https://pagure.io/fedora-hubs/blob/develop/f'
+# Example of what will be appended: '/hubs/widgets/badges.py'
 
 CHAT_NETWORKS = [
     {
diff --git a/hubs/defaults.py b/hubs/defaults.py
index 7b5129a..2d27239 100644
--- a/hubs/defaults.py
+++ b/hubs/defaults.py
@@ -20,9 +20,9 @@ def add_user_widgets(session, hub, username, fullname):
     # Right Side Widgets
     widget = hubs.models.Widget(
         plugin='contact', index=-2,
-            _config=json.dumps({
-                'username': username,
-            }))
+        _config=json.dumps({
+            'username': username,
+        }))
     hub.widgets.append(widget)
 
     widget = hubs.models.Widget(
diff --git a/hubs/migrations/env.py b/hubs/migrations/env.py
index e00d82b..db92033 100644
--- a/hubs/migrations/env.py
+++ b/hubs/migrations/env.py
@@ -1,25 +1,24 @@
 from __future__ import absolute_import, unicode_literals
 
-from alembic import context
-from sqlalchemy import create_engine, pool
 from logging.config import fileConfig
 
-
 import fedmsg.config
-
-fedmsg_config = fedmsg.config.load_config()
+from alembic import context
+from sqlalchemy import create_engine, pool
 
 
 try:
-    import hubs
+    import hubs  # noqa
 except ImportError:
-    import os, sys
+    import os
+    import sys
     if "hubs" not in os.listdir("."):
         raise
     sys.path.append(os.getcwd())
 
 from hubs.models import BASE
 
+
 # This is the Alembic Config object, which provides
 # access to the values within the .ini file in use.
 # The config_file_name property may be None when used programatically.
@@ -28,6 +27,7 @@ if context.config.config_file_name is not None:
     # This line sets up loggers basically.
     fileConfig(context.config.config_file_name)
 
+fedmsg_config = fedmsg.config.load_config()
 url = fedmsg_config['hubs.sqlalchemy.uri']
 target_metadata = BASE.metadata
 
@@ -73,6 +73,7 @@ def run_migrations_online():
         with context.begin_transaction():
             context.run_migrations()
 
+
 if context.is_offline_mode():
     run_migrations_offline()
 else:
diff --git a/hubs/migrations/versions/1d660b32b83a_hub_config.py b/hubs/migrations/versions/1d660b32b83a_hub_config.py
index 7f2aefb..348aad5 100644
--- a/hubs/migrations/versions/1d660b32b83a_hub_config.py
+++ b/hubs/migrations/versions/1d660b32b83a_hub_config.py
@@ -35,11 +35,13 @@ depends_on = None
 
 
 def upgrade():
-    op.create_table('hubs_config',
+    op.create_table(
+        'hubs_config',
         sa.Column('id', sa.Integer(), nullable=False),
         sa.Column('hub_id', sa.String(length=50), nullable=False),
         sa.Column('summary', sa.String(length=128), nullable=True),
-        sa.Column('left_width', sa.Integer(), nullable=False, server_default="8"),
+        sa.Column('left_width', sa.Integer(), nullable=False,
+                  server_default="8"),
         sa.Column('avatar', sa.String(length=256), nullable=True),
         sa.Column('header_img', sa.String(length=256), nullable=True),
         sa.ForeignKeyConstraint(['hub_id'], ['hubs.name'], ),
@@ -59,13 +61,20 @@ def upgrade():
 
 
 def downgrade():
-    op.add_column('hubs', sa.Column('avatar', sa.VARCHAR(length=256), nullable=True))
-    op.add_column('hubs', sa.Column('summary', sa.VARCHAR(length=128), nullable=True))
-    op.add_column('hubs', sa.Column('header_img', sa.VARCHAR(length=256), nullable=True))
-    op.add_column('hubs', sa.Column('left_width', sa.INTEGER(), server_default="8", nullable=False))
+    op.add_column(
+        'hubs', sa.Column('avatar', sa.VARCHAR(length=256), nullable=True))
+    op.add_column(
+        'hubs', sa.Column('summary', sa.VARCHAR(length=128), nullable=True))
+    op.add_column(
+        'hubs', sa.Column('header_img', sa.VARCHAR(length=256), nullable=True))
+    op.add_column(
+        'hubs', sa.Column('left_width', sa.INTEGER(), server_default="8",
+                          nullable=False))
     connection = op.get_bind()
-    query = "SELECT hub_id, summary, left_width, avatar, header_img FROM hubs_config"
-    hubs_table = sa.sql.table('hubs',
+    query = ("SELECT hub_id, summary, left_width, avatar, header_img "
+             "FROM hubs_config")
+    hubs_table = sa.sql.table(
+        'hubs',
         sa.sql.column('name', sa.String),
         sa.sql.column('summary', sa.String),
         sa.sql.column('left_width', sa.Integer),
@@ -74,7 +83,7 @@ def downgrade():
     )
     for row in connection.execute(query):
         op.execute(hubs_table.update().where(
-            hubs_table.c.name==op.inline_literal(row["hub_id"])
+            hubs_table.c.name == op.inline_literal(row["hub_id"])
             ).values({
                 "summary": op.inline_literal(row["summary"]),
                 "left_width": op.inline_literal(row["left_width"]),
diff --git a/hubs/models.py b/hubs/models.py
index 4102eeb..48ed695 100644
--- a/hubs/models.py
+++ b/hubs/models.py
@@ -30,7 +30,6 @@ import os
 import random
 
 import bleach
-import dogpile
 import sqlalchemy as sa
 
 from alembic import command as alembic_command
@@ -69,7 +68,7 @@ BASE = declarative_base(cls=HubsBase)
 log = logging.getLogger(__name__)
 
 
-placekitten = lambda: "https://placekitten.com/g/320/320"
+placekitten = "https://placekitten.com/g/320/320"
 
 
 def randomheader():
@@ -122,8 +121,10 @@ class Association(BASE):
                         primary_key=True)
     role = sa.Column(sa.Enum(*roles), primary_key=True)
 
-    user = relation("User", backref=backref('associations', cascade="all, delete"))
-    hub = relation("Hub", backref=backref('associations', cascade="all, delete"))
+    user = relation("User", backref=backref(
+        'associations', cascade="all, delete"))
+    hub = relation("Hub", backref=backref(
+        'associations', cascade="all, delete"))
 
     @classmethod
     def get(cls, hub, user, role):
@@ -139,7 +140,8 @@ class Hub(BASE):
     name = sa.Column(sa.String(50), primary_key=True)
     created_on = sa.Column(sa.DateTime, default=datetime.datetime.utcnow)
     widgets = relation('Widget', cascade='all,delete', backref='hub')
-    config = relation('HubConfig', uselist=False, cascade='all,delete', backref='hub')
+    config = relation('HubConfig', uselist=False, cascade='all,delete',
+                      backref='hub')
     archived = sa.Column(sa.Boolean, default=False)
     user_hub = sa.Column(sa.Boolean, default=False)
     # Timestamps about various kinds of "freshness"
@@ -358,7 +360,6 @@ class Widget(BASE):
         self._config = json.dumps(config)
 
     def __json__(self):
-        session = object_session(self)
         module = hubs.widgets.registry[self.plugin]
         root_view = module.get_views()["root"](module)
         data = root_view.get_context(self)
@@ -395,7 +396,7 @@ class User(BASE):
     fullname = sa.Column(sa.Text)
     created_on = sa.Column(sa.DateTime, default=datetime.datetime.utcnow)
     saved_notifications = relation('SavedNotification', backref='users',
-                                       lazy='dynamic')
+                                   lazy='dynamic')
 
     def __json__(self):
         return {
@@ -432,10 +433,10 @@ class User(BASE):
         # TODO -- someday make this editable/configurable.
         return sorted(list(set([
             assoc.hub for assoc in self.associations
-            if assoc.role == 'member'
-            or assoc.role == 'subscriber'
-            or assoc.role == 'owner'
-            and assoc.hub.name != self.username
+            if assoc.role == 'member' or
+            assoc.role == 'subscriber' or
+            assoc.role == 'owner' and
+            assoc.hub.name != self.username
         ])), key=operator.attrgetter('name'))
 
     @classmethod
@@ -468,16 +469,16 @@ class VisitCounter(BASE):
     __tablename__ = 'visit_counter'
     count = sa.Column(sa.Integer, default=0, nullable=False)
 
-    visited_hub = sa.Column(sa.String(50),
-                       sa.ForeignKey('hubs.name'),
-                       primary_key=True)
+    visited_hub = sa.Column(sa.String(50), sa.ForeignKey('hubs.name'),
+                            primary_key=True)
 
-    username = sa.Column(sa.Text,
-                        sa.ForeignKey('users.username'),
-                        primary_key=True)
+    username = sa.Column(sa.Text, sa.ForeignKey('users.username'),
+                         primary_key=True)
 
-    user = relation("User", backref=backref('visit_counters', cascade="all, delete, delete-orphan"))
-    hub = relation("Hub", backref=backref('visit_counters', cascade="all, delete, delete-orphan"))
+    user = relation("User", backref=backref(
+                    'visit_counters', cascade="all, delete, delete-orphan"))
+    hub = relation("Hub", backref=backref(
+                   'visit_counters', cascade="all, delete, delete-orphan"))
 
     @classmethod
     def by_username(cls, username):
@@ -485,7 +486,8 @@ class VisitCounter(BASE):
 
     @classmethod
     def get_visits_by_username_hub(cls, username, visited_hub):
-        return cls.query.filter_by(username=username, visited_hub=visited_hub).first()
+        return cls.query.filter_by(
+            username=username, visited_hub=visited_hub).first()
 
     @classmethod
     def increment_visits(cls, session, username, visited_hub):
@@ -534,8 +536,8 @@ class SavedNotification(BASE):
     markup = sa.Column(sa.Text)
     secondary_icon = sa.Column(sa.Text)
 
-
-    def __init__(self, username=None, markup='', link='', secondary_icon='', dom_id=''):
+    def __init__(self, username=None, markup='', link='', secondary_icon='',
+                 dom_id=''):
         self.user = username
         self.markup = markup
         self.link = link
diff --git a/hubs/stream.py b/hubs/stream.py
index ced01b9..f939ab3 100644
--- a/hubs/stream.py
+++ b/hubs/stream.py
@@ -1,8 +1,8 @@
 from __future__ import unicode_literals
 
-import json
 import os
 
+
 class Stream(object):
     def get_json(self):
         here = os.path.dirname(os.path.abspath(__file__))
diff --git a/hubs/tests/test_api/test_hub.py b/hubs/tests/test_api/test_hub.py
index 622fd9d..abf1e3d 100644
--- a/hubs/tests/test_api/test_hub.py
+++ b/hubs/tests/test_api/test_hub.py
@@ -1,7 +1,5 @@
 from __future__ import unicode_literals
 
-import flask
-import unittest
 from six.moves.urllib.parse import urlparse
 
 import hubs.tests
diff --git a/hubs/tests/test_api/test_notifications.py b/hubs/tests/test_api/test_notifications.py
index c9c7657..c224a77 100644
--- a/hubs/tests/test_api/test_notifications.py
+++ b/hubs/tests/test_api/test_notifications.py
@@ -1,7 +1,6 @@
 from __future__ import unicode_literals
 
 import json
-from six.moves.urllib.parse import urlparse
 
 import hubs.tests
 import hubs.models
diff --git a/hubs/tests/test_fedora_hubs_flask_api.py b/hubs/tests/test_fedora_hubs_flask_api.py
index 006f99e..c9e8c39 100644
--- a/hubs/tests/test_fedora_hubs_flask_api.py
+++ b/hubs/tests/test_fedora_hubs_flask_api.py
@@ -404,7 +404,8 @@ class HubsAPITest(hubs.tests.APPTest):
                 "left_width": 8,
                 "avatar": (
                     "https://seccdn.libravatar.org/avatar/9c9f7784935381befc30"
-                    "2fe3c814f9136e7a33953d0318761669b8643f4df55c?s=312&d=retro"
+                    "2fe3c814f9136e7a33953d0318761669b8643f4df55c"
+                    "?s=312&d=retro"
                     ),
                 "chat_channel": None,
                 "chat_domain": None,
diff --git a/hubs/tests/test_widget_base.py b/hubs/tests/test_widget_base.py
index 9d0e64d..53d1bf8 100644
--- a/hubs/tests/test_widget_base.py
+++ b/hubs/tests/test_widget_base.py
@@ -8,15 +8,16 @@ from hubs.widgets.view import WidgetView
 
 from mock import Mock
 from hubs.tests import APPTest
-#import hubs.models
 
 
 class TestingWidget(Widget):
     name = "testing"
 
+
 class TestingView(WidgetView):
     name = "root"
 
+
 class TestingFunction(CachedFunction):
     pass
 
@@ -40,8 +41,10 @@ class WidgetTest(APPTest):
     def test_validate(self):
         class LocalTestWidget(Widget):
             views = {}
+
             def get_views(self):
                 return self.views
+
         self.assertRaisesRegexp(
             AttributeError, '.* "name" .*', LocalTestWidget)
         LocalTestWidget.name = "invalid name \xe2\x98\xba"
@@ -109,10 +112,11 @@ class WidgetTest(APPTest):
             {"TestingFunction": TestingFunction}
             )
 
-    def test_list_views(self):
+    def test_list_additional_views(self):
         class TestView1(WidgetView):
             name = "root"
             url_rules = ["/", "/test-1/"]
+
         class TestView2(WidgetView):
             name = "test2"
             url_rules = ["/test-2"]
@@ -127,7 +131,9 @@ class WidgetTest(APPTest):
         self.assertIn("testing_root",
                       self.app.application.url_map._rules_by_endpoint)
         self.assertIn("testing_root", self.app.application.view_functions)
-        rules = list(self.app.application.url_map.iter_rules(endpoint="testing_root"))
+        rules = list(
+            self.app.application.url_map.iter_rules(endpoint="testing_root")
+            )
         self.assertEqual(len(rules), 2)
         self.assertEqual(rules[0].rule, "/<hub>/w/testing/<int:idx>/")
         self.assertEqual(rules[1].rule, "/<hub>/w/testing/<int:idx>/test-1/")
@@ -135,6 +141,8 @@ class WidgetTest(APPTest):
         self.assertIn("testing_test2",
                       self.app.application.url_map._rules_by_endpoint)
         self.assertIn("testing_test2", self.app.application.view_functions)
-        rules = list(self.app.application.url_map.iter_rules(endpoint="testing_test2"))
+        rules = list(
+            self.app.application.url_map.iter_rules(endpoint="testing_test2")
+            )
         self.assertEqual(len(rules), 1)
         self.assertEqual(rules[0].rule, "/<hub>/w/testing/<int:idx>/test-2")
diff --git a/hubs/tests/test_widget_validators.py b/hubs/tests/test_widget_validators.py
index 567c60f..2cadf7f 100644
--- a/hubs/tests/test_widget_validators.py
+++ b/hubs/tests/test_widget_validators.py
@@ -1,13 +1,10 @@
 from __future__ import unicode_literals
 
-import six
 import unittest
 
 from hubs.widgets import validators
 
-#from mock import Mock
 from hubs.tests import APPTest
-from hubs.models import User
 
 
 class ValidatorsTest(APPTest):
@@ -30,7 +27,8 @@ class ValidatorsTest(APPTest):
 
     def test_username(self):
         self.assertEqual(validators.Username.from_string("ralph"), "ralph")
-        self.assertRaises(ValueError, validators.Username.from_string, "nobody")
+        self.assertRaises(
+            ValueError, validators.Username.from_string, "nobody")
 
     @unittest.skip("Not implemented yet")
     def test_github_organization(self):
diff --git a/hubs/tests/test_widgets/__init__.py b/hubs/tests/test_widgets/__init__.py
index 7579b19..3297022 100644
--- a/hubs/tests/test_widgets/__init__.py
+++ b/hubs/tests/test_widgets/__init__.py
@@ -1,12 +1,6 @@
 from __future__ import unicode_literals
 
 import json
-from datetime import datetime, timedelta
-from os.path import dirname
-import unittest
-
-import requests
-import vcr
 
 import hubs.models
 from hubs.tests import APPTest
@@ -20,7 +14,8 @@ class WidgetTest(APPTest):
         widget = hubs.models.Widget(
             plugin='library',
             index=51,
-            _config=json.dumps({"urls": "ralph/"})  # we must add a url or itll crash
+            # We must add a url in the config or it'll crash.
+            _config=json.dumps({"urls": "ralph/"})
         )
         hub.widgets.append(widget)
         hubs.app.session.commit()
diff --git a/hubs/tests/test_widgets/test_about.py b/hubs/tests/test_widgets/test_about.py
index 7865a34..d86435f 100644
--- a/hubs/tests/test_widgets/test_about.py
+++ b/hubs/tests/test_widgets/test_about.py
@@ -2,8 +2,6 @@ from __future__ import unicode_literals
 
 import json
 
-from nose.tools import assert_dict_equal
-
 import hubs.tests.test_widgets
 
 
diff --git a/hubs/tests/test_widgets/test_badges.py b/hubs/tests/test_widgets/test_badges.py
index 45e1ce8..3521ec2 100644
--- a/hubs/tests/test_widgets/test_badges.py
+++ b/hubs/tests/test_widgets/test_badges.py
@@ -2,7 +2,6 @@ from __future__ import unicode_literals
 
 import json
 
-from mock import patch, MagicMock
 import hubs.tests.test_widgets
 
 
@@ -29,7 +28,8 @@ class TestBadges(hubs.tests.test_widgets.WidgetTest):
     def test_should_invalidate_wrong_user(self):
         widget = self.widget_instance('ralph', self.plugin)
         # msg = self.get_fedmsg('2016-e371c7f6-bc8e-4632-8e33-b9102dc30b5f')
-        msg = {'topic': 'fedbadges.badge.award', 'msg': {'user': {'username': 'not_ralph'}}}
+        msg = {'topic': 'fedbadges.badge.award',
+               'msg': {'user': {'username': 'not_ralph'}}}
         module = hubs.widgets.registry[widget.plugin]
         func = module.get_cached_functions()['GetBadges']
         result = func(widget).should_invalidate(msg)
@@ -38,7 +38,8 @@ class TestBadges(hubs.tests.test_widgets.WidgetTest):
     def test_should_invalidate_good_match_fedbadges(self):
         widget = self.widget_instance('ralph', self.plugin)
         # msg = self.get_fedmsg('2016-1fbb1135-681b-4d3b-9a40-d0f6ebd313f4')
-        msg = {'topic': 'fedbadges.badge.award', 'msg': {'user': {'username': 'ralph'}}}
+        msg = {'topic': 'fedbadges.badge.award',
+               'msg': {'user': {'username': 'ralph'}}}
         module = hubs.widgets.registry[widget.plugin]
         func = module.get_cached_functions()['GetBadges']
         result = func(widget).should_invalidate(msg)
@@ -47,7 +48,8 @@ class TestBadges(hubs.tests.test_widgets.WidgetTest):
     def test_should_invalidate_good_match_hubswidget(self):
         widget = self.widget_instance('ralph', self.plugin)
         # msg = self.get_fedmsg('2016-1fbb1135-681b-4d3b-9a40-d0f6ebd313f4')
-        msg = {'topic': 'hubs.widget.update', 'msg': {'widget': {'id': widget.idx + 1}}}
+        msg = {'topic': 'hubs.widget.update',
+               'msg': {'widget': {'id': widget.idx + 1}}}
         module = hubs.widgets.registry[widget.plugin]
         func = module.get_cached_functions()['GetBadges']
         result = func(widget).should_invalidate(msg)
diff --git a/hubs/tests/test_widgets/test_library.py b/hubs/tests/test_widgets/test_library.py
index a41e60e..0e09a7d 100644
--- a/hubs/tests/test_widgets/test_library.py
+++ b/hubs/tests/test_widgets/test_library.py
@@ -5,6 +5,7 @@ import json
 import hubs.tests.test_widgets
 import hubs.models
 
+
 class TestLibrary(hubs.tests.test_widgets.WidgetTest):
     plugin = 'library'  # The name in hubs.widgets.registry
 
diff --git a/hubs/utils.py b/hubs/utils.py
index f1ecd92..830d5ae 100755
--- a/hubs/utils.py
+++ b/hubs/utils.py
@@ -1,13 +1,11 @@
 from __future__ import unicode_literals
 
-import json
 import logging
 from hashlib import sha256
 
 import arrow
 import markdown
 import requests
-import six
 
 from six.moves.urllib_parse import urlencode
 
diff --git a/hubs/views/__init__.py b/hubs/views/__init__.py
index f3d8a0c..87da5d9 100644
--- a/hubs/views/__init__.py
+++ b/hubs/views/__init__.py
@@ -1,5 +1,7 @@
 from __future__ import absolute_import
 
+# flake8:noqa
+
 from .root import *
 from .hub import *
 from .widget import *
diff --git a/hubs/views/api.py b/hubs/views/api.py
index 4c96e44..777bcda 100644
--- a/hubs/views/api.py
+++ b/hubs/views/api.py
@@ -75,4 +75,3 @@ def hub_leave(hub):
         return flask.abort(400)
     flask.g.db.commit()
     return flask.redirect(flask.url_for('hub', name=hub.name))
-
diff --git a/hubs/views/hub.py b/hubs/views/hub.py
index 3534c70..4227357 100644
--- a/hubs/views/hub.py
+++ b/hubs/views/hub.py
@@ -4,7 +4,7 @@ import datetime
 import flask
 import hubs.models
 
-from hubs.app import app, session
+from hubs.app import app
 from .utils import get_hub, login_required, RequestValidator
 
 
diff --git a/hubs/views/root.py b/hubs/views/root.py
index 386f233..1250490 100644
--- a/hubs/views/root.py
+++ b/hubs/views/root.py
@@ -3,7 +3,7 @@ from __future__ import unicode_literals, absolute_import
 import flask
 import hubs.models
 
-from hubs.app import app, session, OIDC
+from hubs.app import app, OIDC
 from .utils import authenticated, is_safe_url
 
 
@@ -49,7 +49,8 @@ def login():
         return_point = default
 
     hubs.models.User.get_or_create(
-        flask.g.db, username=flask.g.auth.nickname, fullname=flask.g.auth.fullname)
+        flask.g.db, username=flask.g.auth.nickname,
+        fullname=flask.g.auth.fullname)
     flask.flash('Login successful', 'success')
 
     return flask.redirect(return_point)
diff --git a/hubs/views/user.py b/hubs/views/user.py
index 692daf3..62866ae 100644
--- a/hubs/views/user.py
+++ b/hubs/views/user.py
@@ -5,7 +5,7 @@ import json
 import hubs.models
 import hubs.stream
 
-from hubs.app import app, session
+from hubs.app import app
 from .utils import login_required, get_hub
 
 
@@ -62,16 +62,20 @@ def notifications(user):
             dict(notification=notification.__json__(), success=True)
         )
 
+
 @app.route('/<user>/notifications/<int:idx>', methods=['DELETE'])
 @app.route('/<user>/notifications/<int:idx>/', methods=['DELETE'])
 @login_required
 def delete_notifications(user, idx):
-    notification = flask.g.db.query(hubs.models.SavedNotification).filter_by(idx=idx).first()
+    notification = flask.g.db.query(
+        hubs.models.SavedNotification).filter_by(idx=idx).first()
     if not notification:
         return flask.abort(400)
     flask.g.db.delete(notification)
     flask.g.db.commit()
     return flask.jsonify(dict(status_code=200))
+
+
 @app.route('/visit/<visited_hub>/', methods=['GET', 'POST'])
 @app.route('/visit/<visited_hub>', methods=['GET', 'POST'])
 @login_required
@@ -80,9 +84,8 @@ def increment_counter(visited_hub):
 
     if str(visited_hub) != str(nickname):
         try:
-            vc = hubs.models.VisitCounter.get_or_create(session=flask.g.db,
-                                                        username=nickname,
-                                                        visited_hub=visited_hub)
+            vc = hubs.models.VisitCounter.get_or_create(
+                session=flask.g.db, username=nickname, visited_hub=visited_hub)
         except ValueError:  # this should never trip
             # flask will 405 if visited_hub is blank
             # @login_required forces flask.g.auth to be sets
diff --git a/hubs/widgets/caching.py b/hubs/widgets/caching.py
index 990dce6..c94dddb 100644
--- a/hubs/widgets/caching.py
+++ b/hubs/widgets/caching.py
@@ -28,6 +28,7 @@ def _get_cache():
     cache.configure(**config.get('fedora-hubs.cache', cache_defaults))
     return cache
 
+
 cache = _get_cache()
 
 
diff --git a/hubs/widgets/github_pr/__init__.py b/hubs/widgets/github_pr/__init__.py
index 07374fb..c5970f9 100644
--- a/hubs/widgets/github_pr/__init__.py
+++ b/hubs/widgets/github_pr/__init__.py
@@ -69,7 +69,7 @@ class GetPRs(CachedFunction):
                 for repo in repos
             ], [])
             # Reverse-sort by time (newest-first)
-            pulls.sort(lambda a, b: cmp(b['timestamp'], a['timestamp']))
+            pulls.sort(key=lambda x: x['timestamp'], reverse=True)
 
             # Some hints for display
             len_pulls = len(pulls)
diff --git a/hubs/widgets/validators.py b/hubs/widgets/validators.py
index 9c96320..a037a94 100644
--- a/hubs/widgets/validators.py
+++ b/hubs/widgets/validators.py
@@ -122,8 +122,7 @@ class FMNContext(Validator):
     @classmethod
     def from_string(cls, value):
         # TODO get this from the fedmsg config.
-        if value in [
-            'irc', 'email', 'android', 'desktop', 'hubs',]:
+        if value in ['irc', 'email', 'android', 'desktop', 'hubs']:
             return value
         raise ValueError('Invalid FMN context')
 
diff --git a/populate-from-fas.py b/populate-from-fas.py
index 959c5e4..b5ed9ce 100755
--- a/populate-from-fas.py
+++ b/populate-from-fas.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 """ Populate the hubs db with lots of data from FAS. """
 
-from __future__ import unicode_literals
+from __future__ import unicode_literals, print_function
 
 import getpass
 import socket
@@ -14,7 +14,7 @@ import fedmsg.config
 fedmsg_config = fedmsg.config.load_config()
 
 fasclient = fedora.client.fas2.AccountSystem(
-    username=raw_input('Your FAS username: '),
+    username=input('Your FAS username: '),
     password=getpass.getpass(),
 )
 timeout = socket.getdefaulttimeout()
@@ -39,7 +39,7 @@ suffix_blacklist = [
 for letter in reversed(sorted(list(set(string.letters.lower())))):
     session = hubs.models.init(
         fedmsg_config['hubs.sqlalchemy.uri'], True, True)
-    print "Querying FAS for the %r users.. hang on." % letter
+    print("Querying FAS for the %r users.. hang on." % letter)
     request = fasclient.send_request(
         '/user/list',
         req_params={'search': '%s*' % letter, 'status': 'active'},
@@ -50,7 +50,7 @@ for letter in reversed(sorted(list(set(string.letters.lower())))):
     for user in users:
         username = user['username']
         fullname = user['human_name']
-        print "Creating account for %r" % username
+        print("Creating account for %r" % username)
         hubs_user = hubs.models.User.get_or_create(
             session, username=username, fullname=fullname)
 
diff --git a/populate.py b/populate.py
index 5a5d5a2..08feaa3 100755
--- a/populate.py
+++ b/populate.py
@@ -35,7 +35,7 @@ for username in users:
 
 session.commit()
 
-############## Internationalizationteam
+# ############# Internationalizationteam
 hub = hubs.models.Hub(name='i18n', archived=True)
 session.add(hub)
 session.add(hubs.models.HubConfig(
@@ -45,13 +45,14 @@ widget = hubs.models.Widget(plugin='contact', index=-1)
 hub.widgets.append(widget)
 widget = hubs.models.Widget(plugin='stats', index=0)
 hub.widgets.append(widget)
-widget = hubs.models.Widget(plugin='rules', index=1,
-                            _config=json.dumps({
-                                'link': 'https://fedoraproject.org/wiki/I18N',
-                                'schedule_text': None,
-                                'schedule_link': None,
-                                'minutes_link': 'https://meetbot.fedoraproject.org/sresults/?group_id=i18n&type=team',
-                            }))
+widget = hubs.models.Widget(
+    plugin='rules', index=1, _config=json.dumps({
+        'link': 'https://fedoraproject.org/wiki/I18N',
+        'schedule_text': None,
+        'schedule_link': None,
+        'minutes_link': 'https://meetbot.fedoraproject.org/sresults/'
+                        '?group_id=i18n&type=team',
+    }))
 hub.widgets.append(widget)
 
 widget = hubs.models.Widget(plugin='meetings', index=2,
@@ -59,16 +60,25 @@ widget = hubs.models.Widget(plugin='meetings', index=2,
 hub.widgets.append(widget)
 
 # Added a hubs about widget
-widget = hubs.models.Widget(plugin='about', index=3,
-                            _config=json.dumps({
-                                "text": "I'm a Fedora user, and this is my about widget text!",
-                            }))
-hub.widgets.append(widget)
-
-widget = hubs.models.Widget(plugin='sticky', index=1, left=True,
-                            _config=json.dumps({
-                                'text': "<p>The Fedora I18N project works on internationalization (i18n) to support the localization (l10n) of Fedora in many languages. Translation of Fedora software and documentation are handled by the Fedora L10N project.</p> <p>The goals of the Project are to:</p> <ul><li>Develop, package, and maintain applications like input methods for different languages</li> <li>Improve applications and utilities to support and process different languages</li> <li>Quality-assure that existing applications meet i18n standards</li> <li>Support the infrastructure of the Fedora Localization Project</li></ul>",
-                            }))
+widget = hubs.models.Widget(
+    plugin='about', index=3, _config=json.dumps({
+        "text": "I'm a Fedora user, and this is my about widget text!",
+    }))
+hub.widgets.append(widget)
+
+widget = hubs.models.Widget(
+    plugin='sticky', index=1, left=True, _config=json.dumps({
+        'text': """
+<p>The Fedora I18N project works on internationalization (i18n) to support the
+localization (l10n) of Fedora in many languages. Translation of Fedora software
+and documentation are handled by the Fedora L10N project.</p> <p>The goals of
+the Project are to:</p> <ul><li>Develop, package, and maintain applications
+like input methods for different languages</li> <li>Improve applications and
+utilities to support and process different languages</li> <li>Quality-assure
+that existing applications meet i18n standards</li> <li>Support the
+infrastructure of the Fedora Localization Project</li></ul>
+""",
+    }))
 hub.widgets.append(widget)
 widget = hubs.models.Widget(plugin='dummy', index=2, left=True)
 hub.widgets.append(widget)
@@ -82,7 +92,7 @@ hub.subscribe(hubs.models.User.by_username('ralph'), 'subscriber')
 
 session.commit()
 
-############## CommOps
+# ############# CommOps
 hub = hubs.models.Hub(name='commops')
 session.add(hub)
 session.add(hubs.models.HubConfig(
@@ -92,17 +102,20 @@ widget = hubs.models.Widget(plugin='contact', index=-1)
 hub.widgets.append(widget)
 widget = hubs.models.Widget(plugin='stats', index=0)
 hub.widgets.append(widget)
-widget = hubs.models.Widget(plugin='rules', index=1,
-                            _config=json.dumps({
-                                'link': 'https://fedoraproject.org/wiki/CommOps',
-                                'schedule_text': None,
-                                'schedule_link': None,
-                                'minutes_link': 'http://meetbot.fedoraproject.org/sresults/?group_id=commops&type=team',
-                            }))
+widget = hubs.models.Widget(
+    plugin='rules', index=1, _config=json.dumps({
+        'link': 'https://fedoraproject.org/wiki/CommOps',
+        'schedule_text': None,
+        'schedule_link': None,
+        'minutes_link': 'http://meetbot.fedoraproject.org/sresults/'
+                        '?group_id=commops&type=team',
+    }))
 hub.widgets.append(widget)
 
-widget = hubs.models.Widget(plugin='meetings', index=2,
-                            _config=json.dumps({'calendar': 'commops', 'n_meetings': 4}))
+widget = hubs.models.Widget(
+    plugin='meetings', index=2, _config=json.dumps({
+        'calendar': 'commops', 'n_meetings': 4
+    }))
 hub.widgets.append(widget)
 
 # Added a hubs about widget
@@ -112,10 +125,12 @@ widget = hubs.models.Widget(plugin='about', index=3,
                             }))
 hub.widgets.append(widget)
 
-widget = hubs.models.Widget(plugin='sticky', index=1, left=True,
-                            _config=json.dumps({
-                                'text': "Bringing more heat and light to Fedora, so you don't have to choose between 'building things' and 'building communities that build things.'",
-                            }))
+widget = hubs.models.Widget(
+    plugin='sticky', index=1, left=True, _config=json.dumps({
+        'text': "Bringing more heat and light to Fedora, so you don't have "
+                "to choose between 'building things' and 'building "
+                "communities that build things.'",
+    }))
 hub.widgets.append(widget)
 widget = hubs.models.Widget(plugin='dummy', index=2, left=True)
 hub.widgets.append(widget)
@@ -131,7 +146,7 @@ hub.subscribe(hubs.models.User.by_username('linuxmodder'), 'member')
 
 session.commit()
 
-############## Marketing team
+# ############# Marketing team
 hub = hubs.models.Hub(name='marketing')
 session.add(hub)
 session.add(hubs.models.HubConfig(
@@ -141,30 +156,41 @@ widget = hubs.models.Widget(plugin='contact', index=-1)
 hub.widgets.append(widget)
 widget = hubs.models.Widget(plugin='stats', index=0)
 hub.widgets.append(widget)
-widget = hubs.models.Widget(plugin='rules', index=1,
-                            _config=json.dumps({
-                                'link': 'https://fedoraproject.org/wiki/Marketing',
-                                'schedule_text': None,
-                                'schedule_link': None,
-                                'minutes_link': 'http://meetbot.fedoraproject.org/sresults/?group_id=fedora-mktg&type=channel',
-                            }))
+widget = hubs.models.Widget(
+    plugin='rules', index=1, _config=json.dumps({
+        'link': 'https://fedoraproject.org/wiki/Marketing',
+        'schedule_text': None,
+        'schedule_link': None,
+        'minutes_link': 'http://meetbot.fedoraproject.org/sresults/'
+                        '?group_id=fedora-mktg&type=channel',
+    }))
 hub.widgets.append(widget)
 
-widget = hubs.models.Widget(plugin='meetings', index=2,
-                            _config=json.dumps({'calendar': 'marketing', 'n_meetings': 4}))
+widget = hubs.models.Widget(
+    plugin='meetings', index=2, _config=json.dumps({
+        'calendar': 'marketing', 'n_meetings': 4
+    }))
 hub.widgets.append(widget)
 
 # Added a hubs about widget
-widget = hubs.models.Widget(plugin='about', index=3,
-                            _config=json.dumps({
-                                "text": "I'm a Fedora user, and this is my about widget text!",
-                            }))
-hub.widgets.append(widget)
-
-widget = hubs.models.Widget(plugin='sticky', index=1, left=True,
-                            _config=json.dumps({
-                                'text': "The Fedora Marketing Team develops and executes marketing strategies to promote the usage and support of Fedora worldwide. Through the development of processes and content, this project aims to support the efforts of other Fedora projects to spread Fedora and to provide a central repository of ideas and information that can be used to deliver Fedora to new audiences. We work closely with the Fedora Ambassadors who spread the word about Fedora at events and allow the Fedora Project to interact directly with its existing and prospective users. ",
-                            }))
+widget = hubs.models.Widget(
+    plugin='about', index=3, _config=json.dumps({
+        "text": "I'm a Fedora user, and this is my about widget text!",
+    }))
+hub.widgets.append(widget)
+
+widget = hubs.models.Widget(
+    plugin='sticky', index=1, left=True, _config=json.dumps({
+        'text': """
+The Fedora Marketing Team develops and executes marketing strategies to promote
+the usage and support of Fedora worldwide. Through the development of processes
+and content, this project aims to support the efforts of other Fedora projects
+to spread Fedora and to provide a central repository of ideas and information
+that can be used to deliver Fedora to new audiences. We work closely with the
+Fedora Ambassadors who spread the word about Fedora at events and allow the
+Fedora Project to interact directly with its existing and prospective users.
+""",
+    }))
 hub.widgets.append(widget)
 widget = hubs.models.Widget(plugin='dummy', index=2, left=True)
 hub.widgets.append(widget)
@@ -181,7 +207,7 @@ hub.subscribe(hubs.models.User.by_username('ralph'), 'subscriber')
 
 session.commit()
 
-############## Design team
+# ############# Design team
 hub = hubs.models.Hub(name='designteam')
 session.add(hub)
 session.add(hubs.models.HubConfig(
@@ -191,30 +217,37 @@ widget = hubs.models.Widget(plugin='contact', index=-1)
 hub.widgets.append(widget)
 widget = hubs.models.Widget(plugin='stats', index=0)
 hub.widgets.append(widget)
-widget = hubs.models.Widget(plugin='rules', index=1,
-                            _config=json.dumps({
-                                'link': 'https://fedoraproject.org/wiki/Design',
-                                'schedule_text': 'Meetings are every other Tuesday at 16:00 UTC',
-                                'schedule_link': 'https://apps.fedoraproject.org/calendar/design/',
-                                'minutes_link': 'http://meetbot.fedoraproject.org/sresults/?group_id=fedora-design&type=channel',
-                            }))
+widget = hubs.models.Widget(
+    plugin='rules', index=1, _config=json.dumps({
+        'link': 'https://fedoraproject.org/wiki/Design',
+        'schedule_text': 'Meetings are every other Tuesday at 16:00 UTC',
+        'schedule_link': 'https://apps.fedoraproject.org/calendar/design/',
+        'minutes_link': 'http://meetbot.fedoraproject.org/sresults/'
+                        '?group_id=fedora-design&type=channel',
+    }))
 hub.widgets.append(widget)
 
-widget = hubs.models.Widget(plugin='meetings', index=2,
-                            _config=json.dumps({'calendar': 'design', 'n_meetings': 4}))
+widget = hubs.models.Widget(
+    plugin='meetings', index=2, _config=json.dumps({
+        'calendar': 'design', 'n_meetings': 4
+    }))
 hub.widgets.append(widget)
 
 # Added a hubs about widget
-widget = hubs.models.Widget(plugin='about', index=3,
-                            _config=json.dumps({
-                                "text": "I'm a Fedora user, and this is my about widget text!",
-                            }))
+widget = hubs.models.Widget(
+    plugin='about', index=3, _config=json.dumps({
+        "text": "I'm a Fedora user, and this is my about widget text!",
+    }))
 hub.widgets.append(widget)
 
-widget = hubs.models.Widget(plugin='sticky', index=1, left=True,
-                            _config=json.dumps({
-                                'text': "The Design Team is the design group of the Fedora project. Our interests are not only in creating graphics for use by the Fedora community, but also in advocating the use of the creative tools that are a part of Fedora.",
-                            }))
+widget = hubs.models.Widget(
+    plugin='sticky', index=1, left=True, _config=json.dumps({
+        'text': """
+The Design Team is the design group of the Fedora project. Our interests are
+not only in creating graphics for use by the Fedora community, but also in
+advocating the use of the creative tools that are a part of Fedora.
+""",
+    }))
 hub.widgets.append(widget)
 widget = hubs.models.Widget(plugin='dummy', index=2, left=True)
 hub.widgets.append(widget)
@@ -232,7 +265,7 @@ hub.subscribe(hubs.models.User.by_username('ralph'), 'subscriber')
 session.commit()
 
 
-############## Infra team
+# ############# Infra team
 hub = hubs.models.Hub(name='infrastructure')
 session.add(hub)
 session.add(hubs.models.HubConfig(
@@ -242,30 +275,39 @@ widget = hubs.models.Widget(plugin='contact', index=-1)
 hub.widgets.append(widget)
 widget = hubs.models.Widget(plugin='stats', index=0)
 hub.widgets.append(widget)
-widget = hubs.models.Widget(plugin='rules', index=1,
-                            _config=json.dumps({
-                                'link': 'https://fedoraproject.org/wiki/Infrastructure',
-                                'schedule_text': 'We meet weekly in #fedora-meeting at 18:00 UTC',
-                                'schedule_link': 'https://apps.fedoraproject.org/calendar/infrastructure/',
-                                'minutes_link': 'http://meetbot.fedoraproject.org/sresults/?group_id=infrastructure&type=team',
-                            }))
+widget = hubs.models.Widget(
+    plugin='rules', index=1, _config=json.dumps({
+        'link': 'https://fedoraproject.org/wiki/Infrastructure',
+        'schedule_text': 'We meet weekly in #fedora-meeting at 18:00 UTC',
+        'schedule_link':
+            'https://apps.fedoraproject.org/calendar/infrastructure/',
+        'minutes_link': 'http://meetbot.fedoraproject.org/sresults/'
+                        '?group_id=infrastructure&type=team',
+    }))
 hub.widgets.append(widget)
 
-widget = hubs.models.Widget(plugin='meetings', index=2,
-                            _config=json.dumps({'calendar': 'infrastructure', 'n_meetings': 4}))
+widget = hubs.models.Widget(
+    plugin='meetings', index=2, _config=json.dumps({
+        'calendar': 'infrastructure', 'n_meetings': 4
+    }))
 hub.widgets.append(widget)
 
 # Added a hubs about widget
-widget = hubs.models.Widget(plugin='about', index=3,
-                            _config=json.dumps({
-                                "text": "I'm a Fedora user, and this is my about widget text!",
-                            }))
-hub.widgets.append(widget)
-
-widget = hubs.models.Widget(plugin='sticky', index=2, left=True,
-                            _config=json.dumps({
-                                'text': "The Infrastructure Team consists of dedicated volunteers and professionals managing the servers, building the tools and utilities, and creating new applications to make Fedora development a smoother process. We're located all over the globe and communicate primarily by IRC and e-mail. ",
-                            }))
+widget = hubs.models.Widget(
+    plugin='about', index=3, _config=json.dumps({
+        "text": "I'm a Fedora user, and this is my about widget text!",
+    }))
+hub.widgets.append(widget)
+
+widget = hubs.models.Widget(
+    plugin='sticky', index=2, left=True, _config=json.dumps({
+        'text': """
+The Infrastructure Team consists of dedicated volunteers and professionals
+managing the servers, building the tools and utilities, and creating new
+applications to make Fedora development a smoother process. We're located all
+over the globe and communicate primarily by IRC and e-mail.
+""",
+    }))
 hub.widgets.append(widget)
 widget = hubs.models.Widget(plugin='dummy', index=3, left=True)
 hub.widgets.append(widget)
diff --git a/runserver.py b/runserver.py
index 9552b0a..f41b3cd 100755
--- a/runserver.py
+++ b/runserver.py
@@ -3,7 +3,6 @@
 from __future__ import unicode_literals
 
 import argparse
-import sys
 import os
 
 parser = argparse.ArgumentParser(
@@ -32,7 +31,7 @@ if args.config:
     os.environ['HUBS_CONFIG'] = config
 
 
-from hubs.app import app
+from hubs.app import app  # noqa
 
 app.debug = True
 app.run(debug=True, host=args.host, port=int(args.port))
diff --git a/setup.py b/setup.py
index aa9b63e..cb267d0 100644
--- a/setup.py
+++ b/setup.py
@@ -26,8 +26,8 @@ setup(
     download_url="https://pypi.python.org/pypi/fedora-hubs/",
     license='AGPLv3+',
     install_requires=get_requirements(),
-    #tests_require=tests_require,
-    #test_suite='nose.collector',
+    # tests_require=tests_require,
+    # test_suite='nose.collector',
     packages=find_packages(),
     include_package_data=True,
     zip_safe=False,
@@ -40,7 +40,7 @@ setup(
     ],
     entry_points={
         'moksha.consumer': [
-            "cache_invalidator = hubs.backend.consumer:CacheInvalidatorExtraordinaire",
+            "cache_invalidator = hubs.backend.consumer:CacheInvalidatorExtraordinaire",  # noqa
         ],
     },
 )
diff --git a/smart_cache_invalidator.py b/smart_cache_invalidator.py
index ebf0de6..5150b0c 100755
--- a/smart_cache_invalidator.py
+++ b/smart_cache_invalidator.py
@@ -11,9 +11,7 @@ made to a widget without dropping the entire cache database.
 from __future__ import print_function, unicode_literals
 
 import argparse
-import os
 
-import dogpile.cache
 import fedmsg.config
 import fedmsg.meta
 
@@ -39,8 +37,8 @@ def do_list(args):
         widget = w_instance.module
         for fn_name, fn_class in widget.get_cached_functions().items():
             if fn_class(w_instance).is_cached():
-                print('- Widget cached {0} (#{1}) in {2}'.format(
-                          w_instance.hub_id, w_instance.idx, w_instance.plugin))
+                print(('- Widget cached {inst.hub_id} (#{inst.idx}) '
+                       'in {inst.plugin}').format(inst=w_instance))
 
 
 def do_clean(args):
diff --git a/tox.ini b/tox.ini
index 03e75ca..a77ac69 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
 [tox]
-envlist = py{27,34,35},js,docs
+envlist = py{27,34,35},js,docs,lint
 skipsdist = True
 
 

