changeset 6864:7691290837d2

codingstyle: trivial whitespace fixes Reported by flake8.
author Lars Kruse <devel@sumpfralle.de>
date Fri, 25 Aug 2017 14:32:50 +0200
parents bfd7fc9a814e
children 94bbb7eb5b64
files kallithea/bin/base.py kallithea/bin/kallithea_api.py kallithea/bin/kallithea_backup.py kallithea/config/app_cfg.py kallithea/config/middleware.py kallithea/config/post_receive_tmpl.py kallithea/config/pre_receive_tmpl.py kallithea/config/rcextensions/__init__.py kallithea/config/routing.py kallithea/controllers/admin/admin.py kallithea/controllers/admin/gists.py kallithea/controllers/admin/my_account.py kallithea/controllers/admin/repo_groups.py kallithea/controllers/admin/repos.py kallithea/controllers/admin/settings.py kallithea/controllers/admin/user_groups.py kallithea/controllers/admin/users.py kallithea/controllers/changelog.py kallithea/controllers/changeset.py kallithea/controllers/compare.py kallithea/controllers/feed.py kallithea/controllers/files.py kallithea/controllers/home.py kallithea/controllers/journal.py kallithea/controllers/pullrequests.py kallithea/controllers/root.py kallithea/lib/annotate.py kallithea/lib/auth.py kallithea/lib/auth_modules/__init__.py kallithea/lib/base.py kallithea/lib/caching_query.py kallithea/lib/celerylib/__init__.py kallithea/lib/celerylib/tasks.py kallithea/lib/celerypylons/__init__.py kallithea/lib/compat.py kallithea/lib/db_manage.py kallithea/lib/dbmigrate/__init__.py kallithea/lib/diffs.py kallithea/lib/ext_json.py kallithea/lib/graphmod.py kallithea/lib/helpers.py kallithea/lib/hooks.py kallithea/lib/indexers/__init__.py kallithea/lib/indexers/daemon.py kallithea/lib/ipaddr.py kallithea/lib/markup_renderer.py kallithea/lib/middleware/pygrack.py kallithea/lib/middleware/sessionmiddleware.py kallithea/lib/middleware/simplehg.py kallithea/lib/page.py kallithea/lib/paster_commands/cleanup.py kallithea/lib/paster_commands/install_iis.py kallithea/lib/paster_commands/make_config.py kallithea/lib/pidlock.py kallithea/lib/rcmail/response.py kallithea/lib/rcmail/utils.py kallithea/lib/utils.py kallithea/lib/utils2.py kallithea/lib/vcs/backends/base.py kallithea/lib/vcs/backends/git/repository.py kallithea/lib/vcs/backends/hg/changeset.py kallithea/lib/vcs/backends/hg/repository.py kallithea/lib/vcs/nodes.py kallithea/lib/vcs/subprocessio.py kallithea/lib/vcs/utils/__init__.py kallithea/lib/vcs/utils/annotate.py kallithea/lib/vcs/utils/diffs.py kallithea/lib/vcs/utils/hgcompat.py kallithea/lib/vcs/utils/lazy.py kallithea/lib/vcs/utils/progressbar.py kallithea/lib/vcs/utils/termcolors.py kallithea/lib/verlib.py kallithea/model/changeset_status.py kallithea/model/comment.py kallithea/model/db.py kallithea/model/forms.py kallithea/model/gist.py kallithea/model/meta.py kallithea/model/notification.py kallithea/model/permission.py kallithea/model/pull_request.py kallithea/model/repo.py kallithea/model/repo_group.py kallithea/model/scm.py kallithea/model/user_group.py kallithea/model/validators.py kallithea/tests/api/api_base.py kallithea/tests/base.py kallithea/tests/conftest.py kallithea/tests/fixture.py kallithea/tests/functional/test_admin_auth_settings.py kallithea/tests/functional/test_admin_gists.py kallithea/tests/functional/test_admin_notifications.py kallithea/tests/functional/test_admin_permissions.py kallithea/tests/functional/test_admin_repo_groups.py kallithea/tests/functional/test_admin_repos.py kallithea/tests/functional/test_admin_user_groups.py kallithea/tests/functional/test_admin_users.py kallithea/tests/functional/test_changelog.py kallithea/tests/functional/test_changeset_comments.py kallithea/tests/functional/test_compare.py kallithea/tests/functional/test_compare_local.py kallithea/tests/functional/test_feed.py kallithea/tests/functional/test_files.py kallithea/tests/functional/test_forks.py kallithea/tests/functional/test_home.py kallithea/tests/functional/test_login.py kallithea/tests/functional/test_my_account.py kallithea/tests/functional/test_pullrequests.py kallithea/tests/functional/test_search_indexing.py kallithea/tests/functional/test_summary.py kallithea/tests/models/test_changeset_status.py kallithea/tests/models/test_notifications.py kallithea/tests/models/test_permissions.py kallithea/tests/models/test_repo_groups.py kallithea/tests/models/test_repos.py kallithea/tests/models/test_settings.py kallithea/tests/models/test_user_permissions_on_repos.py kallithea/tests/models/test_users.py kallithea/tests/other/test_libs.py kallithea/tests/other/test_mail.py kallithea/tests/other/test_validators.py kallithea/tests/other/test_vcs_operations.py kallithea/tests/performance/test_vcs.py kallithea/tests/scripts/manual_test_concurrency.py kallithea/tests/scripts/manual_test_crawler.py kallithea/tests/vcs/__init__.py kallithea/tests/vcs/conf.py kallithea/tests/vcs/test_archives.py kallithea/tests/vcs/test_changesets.py kallithea/tests/vcs/test_git.py kallithea/tests/vcs/test_hg.py kallithea/tests/vcs/test_nodes.py kallithea/tests/vcs/test_tags.py kallithea/tests/vcs/test_utils.py kallithea/tests/vcs/test_vcs.py
diffstat 136 files changed, 526 insertions(+), 428 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/bin/base.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/bin/base.py	Fri Aug 25 14:32:50 2017 +0200
@@ -158,7 +158,7 @@
         """
         try:
             with open(self._conf_name, 'rb') as conf:
-                return  json.load(conf)
+                return json.load(conf)
         except IOError as e:
             #sys.stderr.write(str(e) + '\n')
             pass
--- a/kallithea/bin/kallithea_api.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/bin/kallithea_api.py	Fri Aug 25 14:32:50 2017 +0200
@@ -121,5 +121,6 @@
         )
     return 0
 
+
 if __name__ == '__main__':
     sys.exit(main(sys.argv))
--- a/kallithea/bin/kallithea_backup.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/bin/kallithea_backup.py	Fri Aug 25 14:32:50 2017 +0200
@@ -92,6 +92,7 @@
         logging.info('Removing file %s', self.backup_file_name)
         os.remove(os.path.join(self.backup_file_path, self.backup_file_name))
 
+
 if __name__ == "__main__":
 
     repo_location = '/home/repo_path'
--- a/kallithea/config/app_cfg.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/config/app_cfg.py	Fri Aug 25 14:32:50 2017 +0200
@@ -95,6 +95,7 @@
         # Disable transaction manager -- currently Kallithea takes care of transactions itself
         self['tm.enabled'] = False
 
+
 base_config = KallitheaAppConfig()
 
 # TODO still needed as long as we use pylonslib
@@ -174,6 +175,7 @@
         repo2db_mapper(ScmModel().repo_scan(repos_path),
                        remove_obsolete=False, install_git_hooks=False)
 
+
 hooks.register('configure_new_app', setup_configuration)
 
 
@@ -190,4 +192,5 @@
         app = HttpsFixup(app, config)
     return app
 
+
 hooks.register('before_config', setup_application)
--- a/kallithea/config/middleware.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/config/middleware.py	Fri Aug 25 14:32:50 2017 +0200
@@ -23,10 +23,12 @@
 # make_base_app will wrap the TurboGears2 app with all the middleware it needs.
 make_base_app = base_config.setup_tg_wsgi_app(load_environment)
 
+
 def make_app_without_logging(global_conf, full_stack=True, **app_conf):
     """The core of make_app for use from gearbox commands (other than 'serve')"""
     return make_base_app(global_conf, full_stack=full_stack, **app_conf)
 
+
 def make_app(global_conf, full_stack=True, **app_conf):
     """
     Set up Kallithea with the settings found in the PasteDeploy configuration
--- a/kallithea/config/post_receive_tmpl.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/config/post_receive_tmpl.py	Fri Aug 25 14:32:50 2017 +0200
@@ -25,5 +25,6 @@
     _handler(repo_path, push_data, os.environ)
     sys.exit(0)
 
+
 if __name__ == '__main__':
     main()
--- a/kallithea/config/pre_receive_tmpl.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/config/pre_receive_tmpl.py	Fri Aug 25 14:32:50 2017 +0200
@@ -25,5 +25,6 @@
     _handler(repo_path, push_data, os.environ)
     sys.exit(0)
 
+
 if __name__ == '__main__':
     main()
--- a/kallithea/config/rcextensions/__init__.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/config/rcextensions/__init__.py	Fri Aug 25 14:32:50 2017 +0200
@@ -49,6 +49,8 @@
      :param created_by:
     """
     return 0
+
+
 CREATE_REPO_HOOK = _crrepohook
 
 
@@ -73,6 +75,8 @@
     """
     reason = 'allowed'
     return True, reason
+
+
 PRE_CREATE_USER_HOOK = _pre_cruserhook
 
 #==============================================================================
@@ -105,6 +109,8 @@
       :param created_by:
     """
     return 0
+
+
 CREATE_USER_HOOK = _cruserhook
 
 
@@ -132,6 +138,8 @@
      :param deleted_on:
     """
     return 0
+
+
 DELETE_REPO_HOOK = _dlrepohook
 
 
@@ -165,6 +173,8 @@
       :param deleted_by:
     """
     return 0
+
+
 DELETE_USER_HOOK = _dluserhook
 
 
@@ -189,6 +199,8 @@
       :param pushed_revs: list of pushed revisions
     """
     return 0
+
+
 PUSH_HOOK = _pushhook
 
 
@@ -212,4 +224,6 @@
       :param repository: repository name
     """
     return 0
+
+
 PULL_HOOK = _pullhook
--- a/kallithea/config/routing.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/config/routing.py	Fri Aug 25 14:32:50 2017 +0200
@@ -94,7 +94,7 @@
     # CUSTOM ROUTES HERE
     #==========================================================================
 
-    #MAIN PAGE
+    # MAIN PAGE
     rmap.connect('home', '/', controller='home', action='index')
     rmap.connect('about', '/about', controller='home', action='about')
     rmap.connect('repo_switcher_data', '/_repos', controller='home',
@@ -106,7 +106,7 @@
     rmap.connect('kallithea_project_url', "https://kallithea-scm.org/", _static=True)
     rmap.connect('issues_url', 'https://bitbucket.org/conservancy/kallithea/issues', _static=True)
 
-    #ADMIN REPOSITORY ROUTES
+    # ADMIN REPOSITORY ROUTES
     with rmap.submapper(path_prefix=ADMIN_PREFIX,
                         controller='admin/repos') as m:
         m.connect("repos", "/repos",
@@ -121,7 +121,7 @@
         m.connect("delete_repo", "/repos/{repo_name:.*?}/delete",
                   action="delete", conditions=dict(method=["POST"]))
 
-    #ADMIN REPOSITORY GROUPS ROUTES
+    # ADMIN REPOSITORY GROUPS ROUTES
     with rmap.submapper(path_prefix=ADMIN_PREFIX,
                         controller='admin/repo_groups') as m:
         m.connect("repos_groups", "/repo_groups",
@@ -138,7 +138,7 @@
                   action="show", conditions=dict(method=["GET"],
                                                  function=check_group))
 
-        #EXTRAS REPO GROUP ROUTES
+        # EXTRAS REPO GROUP ROUTES
         m.connect("edit_repo_group", "/repo_groups/{group_name:.*?}/edit",
                   action="edit",
                   conditions=dict(method=["GET"], function=check_group))
@@ -161,8 +161,7 @@
                   action="delete", conditions=dict(method=["POST"],
                                                    function=check_group_skip_path))
 
-
-    #ADMIN USER ROUTES
+    # ADMIN USER ROUTES
     with rmap.submapper(path_prefix=ADMIN_PREFIX,
                         controller='admin/users') as m:
         m.connect("new_user", "/users/new",
@@ -180,7 +179,7 @@
         m.connect("edit_user", "/users/{id}/edit",
                   action="edit", conditions=dict(method=["GET"]))
 
-        #EXTRAS USER ROUTES
+        # EXTRAS USER ROUTES
         m.connect("edit_user_advanced", "/users/{id}/edit/advanced",
                   action="edit_advanced", conditions=dict(method=["GET"]))
 
@@ -210,7 +209,7 @@
         m.connect("edit_user_ips_delete", "/users/{id}/edit/ips/delete",
                   action="delete_ip", conditions=dict(method=["POST"]))
 
-    #ADMIN USER GROUPS REST ROUTES
+    # ADMIN USER GROUPS REST ROUTES
     with rmap.submapper(path_prefix=ADMIN_PREFIX,
                         controller='admin/user_groups') as m:
         m.connect("users_groups", "/user_groups",
@@ -227,13 +226,12 @@
                   action="edit", conditions=dict(method=["GET"]),
                   function=check_user_group)
 
-        #EXTRAS USER GROUP ROUTES
+        # EXTRAS USER GROUP ROUTES
         m.connect("edit_user_group_default_perms", "/user_groups/{id}/edit/default_perms",
                   action="edit_default_perms", conditions=dict(method=["GET"]))
         m.connect("edit_user_group_default_perms_update", "/user_groups/{id}/edit/default_perms",
                   action="update_default_perms", conditions=dict(method=["POST"]))
 
-
         m.connect("edit_user_group_perms", "/user_groups/{id}/edit/perms",
                   action="edit_perms", conditions=dict(method=["GET"]))
         m.connect("edit_user_group_perms_update", "/user_groups/{id}/edit/perms",
@@ -247,9 +245,7 @@
         m.connect("edit_user_group_members", "/user_groups/{id}/edit/members",
                   action="edit_members", conditions=dict(method=["GET"]))
 
-
-
-    #ADMIN PERMISSIONS ROUTES
+    # ADMIN PERMISSIONS ROUTES
     with rmap.submapper(path_prefix=ADMIN_PREFIX,
                         controller='admin/permissions') as m:
         m.connect("admin_permissions", "/permissions",
@@ -263,8 +259,7 @@
         m.connect("admin_permissions_perms", "/permissions/perms",
                   action="permission_perms", conditions=dict(method=["GET"]))
 
-
-    #ADMIN DEFAULTS ROUTES
+    # ADMIN DEFAULTS ROUTES
     with rmap.submapper(path_prefix=ADMIN_PREFIX,
                         controller='admin/defaults') as m:
         m.connect('defaults', 'defaults',
@@ -272,14 +267,14 @@
         m.connect('defaults_update', 'defaults/{id}/update',
                   action="update", conditions=dict(method=["POST"]))
 
-    #ADMIN AUTH SETTINGS
+    # ADMIN AUTH SETTINGS
     rmap.connect('auth_settings', '%s/auth' % ADMIN_PREFIX,
                  controller='admin/auth_settings', action='auth_settings',
                  conditions=dict(method=["POST"]))
     rmap.connect('auth_home', '%s/auth' % ADMIN_PREFIX,
                  controller='admin/auth_settings')
 
-    #ADMIN SETTINGS ROUTES
+    # ADMIN SETTINGS ROUTES
     with rmap.submapper(path_prefix=ADMIN_PREFIX,
                         controller='admin/settings') as m:
         m.connect("admin_settings", "/settings",
@@ -326,7 +321,7 @@
         m.connect("admin_settings_system_update", "/settings/system/updates",
                   action="settings_system_update", conditions=dict(method=["GET"]))
 
-    #ADMIN MY ACCOUNT
+    # ADMIN MY ACCOUNT
     with rmap.submapper(path_prefix=ADMIN_PREFIX,
                         controller='admin/my_account') as m:
 
@@ -363,7 +358,7 @@
         m.connect("my_account_api_keys_delete", "/my_account/api_keys/delete",
                   action="my_account_api_keys_delete", conditions=dict(method=["POST"]))
 
-    #NOTIFICATION REST ROUTES
+    # NOTIFICATION REST ROUTES
     with rmap.submapper(path_prefix=ADMIN_PREFIX,
                         controller='admin/notifications') as m:
         m.connect("notifications", "/notifications",
@@ -381,7 +376,7 @@
         m.connect("formatted_notification", "/notifications/{notification_id}.{format}",
                   action="show", conditions=dict(method=["GET"]))
 
-    #ADMIN GIST
+    # ADMIN GIST
     with rmap.submapper(path_prefix=ADMIN_PREFIX,
                         controller='admin/gists') as m:
         m.connect("gists", "/gists",
@@ -391,7 +386,6 @@
         m.connect("new_gist", "/gists/new",
                   action="new", conditions=dict(method=["GET"]))
 
-
         m.connect("gist_delete", "/gists/{gist_id}/delete",
                   action="delete", conditions=dict(method=["POST"]))
         m.connect("edit_gist", "/gists/{gist_id}/edit",
@@ -399,7 +393,6 @@
         m.connect("edit_gist_check_revision", "/gists/{gist_id}/edit/check_revision",
                   action="check_revision", conditions=dict(method=["POST"]))
 
-
         m.connect("gist", "/gists/{gist_id}",
                   action="show", conditions=dict(method=["GET"]))
         m.connect("gist_rev", "/gists/{gist_id}/{revision}",
@@ -412,7 +405,7 @@
                   revision='tip',
                   action="show", conditions=dict(method=["GET"]))
 
-    #ADMIN MAIN PAGES
+    # ADMIN MAIN PAGES
     with rmap.submapper(path_prefix=ADMIN_PREFIX,
                         controller='admin/admin') as m:
         m.connect('admin_home', '', action='index')
@@ -425,7 +418,7 @@
                         action='_dispatch') as m:
         m.connect('api', '/api')
 
-    #USER JOURNAL
+    # USER JOURNAL
     rmap.connect('journal', '%s/journal' % ADMIN_PREFIX,
                  controller='journal', action='index')
     rmap.connect('journal_rss', '%s/journal/rss' % ADMIN_PREFIX,
@@ -454,7 +447,7 @@
                  controller='journal', action='toggle_following',
                  conditions=dict(method=["POST"]))
 
-    #SEARCH
+    # SEARCH
     rmap.connect('search', '%s/search' % ADMIN_PREFIX, controller='search',)
     rmap.connect('search_repo_admin', '%s/search/{repo_name:.*}' % ADMIN_PREFIX,
                  controller='search',
@@ -464,7 +457,7 @@
                  conditions=dict(function=check_repo),
                  )
 
-    #LOGIN/LOGOUT/REGISTER/SIGN IN
+    # LOGIN/LOGOUT/REGISTER/SIGN IN
     rmap.connect('authentication_token', '%s/authentication_token' % ADMIN_PREFIX, controller='login', action='authentication_token')
     rmap.connect('login_home', '%s/login' % ADMIN_PREFIX, controller='login')
     rmap.connect('logout_home', '%s/logout' % ADMIN_PREFIX, controller='login',
@@ -480,7 +473,7 @@
                  '%s/password_reset_confirmation' % ADMIN_PREFIX,
                  controller='login', action='password_reset_confirmation')
 
-    #FEEDS
+    # FEEDS
     rmap.connect('rss_feed_home', '/{repo_name:.*?}/feed/rss',
                 controller='feed', action='rss',
                 conditions=dict(function=check_repo))
@@ -551,7 +544,6 @@
                  controller='admin/repos', action="delete_repo_field",
                  conditions=dict(method=["POST"], function=check_repo))
 
-
     rmap.connect("edit_repo_advanced", "/{repo_name:.*?}/settings/advanced",
                  controller='admin/repos', action="edit_advanced",
                  conditions=dict(method=["GET"], function=check_repo))
@@ -571,7 +563,6 @@
                  controller='admin/repos', action="edit_advanced_fork",
                  conditions=dict(method=["POST"], function=check_repo))
 
-
     rmap.connect("edit_repo_caches", "/{repo_name:.*?}/settings/caches",
                  controller='admin/repos', action="edit_caches",
                  conditions=dict(method=["GET"], function=check_repo))
@@ -579,7 +570,6 @@
                  controller='admin/repos', action="edit_caches",
                  conditions=dict(method=["POST"], function=check_repo))
 
-
     rmap.connect("edit_repo_remote", "/{repo_name:.*?}/settings/remote",
                  controller='admin/repos', action="edit_remote",
                  conditions=dict(method=["GET"], function=check_repo))
@@ -594,7 +584,7 @@
                  controller='admin/repos', action="edit_statistics",
                  conditions=dict(method=["POST"], function=check_repo))
 
-    #still working url for backward compat.
+    # still working url for backward compat.
     rmap.connect('raw_changeset_home_depraced',
                  '/{repo_name:.*?}/raw-changeset/{revision}',
                  controller='changeset', action='changeset_raw',
@@ -812,7 +802,9 @@
     """
     def __call__(self, *args, **kwargs):
         return request.environ['routes.url'](*args, **kwargs)
+
     def current(self, *args, **kwargs):
         return request.environ['routes.url'].current(*args, **kwargs)
 
+
 url = UrlGenerator()
--- a/kallithea/controllers/admin/admin.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/controllers/admin/admin.py	Fri Aug 25 14:32:50 2017 +0200
@@ -65,11 +65,11 @@
 
     def wildcard_handler(col, wc_term):
         if wc_term.startswith('*') and not wc_term.endswith('*'):
-            #postfix == endswith
+            # postfix == endswith
             wc_term = remove_prefix(wc_term, prefix='*')
             return func.lower(col).endswith(func.lower(wc_term))
         elif wc_term.startswith('*') and wc_term.endswith('*'):
-            #wildcard == ilike
+            # wildcard == ilike
             wc_term = remove_prefix(wc_term, prefix='*')
             wc_term = remove_suffix(wc_term, suffix='*')
             return func.lower(col).contains(func.lower(wc_term))
@@ -88,7 +88,7 @@
             field = getattr(UserLog, field)
         log.debug('filter field: %s val=>%s', field, val)
 
-        #sql filtering
+        # sql filtering
         if isinstance(term, query.Wildcard):
             return wildcard_handler(field, val)
         elif isinstance(term, query.Prefix):
@@ -130,7 +130,7 @@
                 .options(joinedload(UserLog.user)) \
                 .options(joinedload(UserLog.repository))
 
-        #FILTERING
+        # FILTERING
         c.search_term = request.GET.get('filter')
         users_log = _journal_filter(users_log, c.search_term)
 
--- a/kallithea/controllers/admin/gists.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/controllers/admin/gists.py	Fri Aug 25 14:32:50 2017 +0200
@@ -106,7 +106,7 @@
         gist_form = GistForm([x[0] for x in c.lifetime_values])()
         try:
             form_result = gist_form.to_python(dict(request.POST))
-            #TODO: multiple files support, from the form
+            # TODO: multiple files support, from the form
             filename = form_result['filename'] or Gist.DEFAULT_FILENAME
             nodes = {
                 filename: {
@@ -250,7 +250,7 @@
         success = True
         revision = request.POST.get('revision')
 
-        ##TODO: maybe move this to model ?
+        # TODO: maybe move this to model ?
         if revision != last_rev.raw_id:
             log.error('Last revision %s is different than submitted %s',
                       revision, last_rev)
--- a/kallithea/controllers/admin/my_account.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/controllers/admin/my_account.py	Fri Aug 25 14:32:50 2017 +0200
@@ -131,7 +131,7 @@
                     force_defaults=False)
             except Exception:
                 log.error(traceback.format_exc())
-                h.flash(_('Error occurred during update of user %s') \
+                h.flash(_('Error occurred during update of user %s')
                         % form_result.get('username'), category='error')
         if update:
             raise HTTPFound(location='my_account')
@@ -173,7 +173,7 @@
         c.active = 'repos'
         self.__load_data()
 
-        #data used to render the grid
+        # data used to render the grid
         c.data = self._load_my_repos_data()
         return render('admin/my_account/my_account.html')
 
@@ -181,7 +181,7 @@
         c.active = 'watched'
         self.__load_data()
 
-        #data used to render the grid
+        # data used to render the grid
         c.data = self._load_my_repos_data(watched=True)
         return render('admin/my_account/my_account.html')
 
--- a/kallithea/controllers/admin/repo_groups.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/controllers/admin/repo_groups.py	Fri Aug 25 14:32:50 2017 +0200
@@ -166,7 +166,7 @@
                 copy_permissions=form_result['group_copy_permissions']
             )
             Session().commit()
-            #TODO: in future action_logger(, '', '', '')
+            # TODO: in future action_logger(, '', '', '')
         except formencode.Invalid as errors:
             return htmlfill.render(
                 render('admin/repo_groups/repo_group_add.html'),
@@ -177,10 +177,10 @@
                 force_defaults=False)
         except Exception:
             log.error(traceback.format_exc())
-            h.flash(_('Error occurred during creation of repository group %s') \
+            h.flash(_('Error occurred during creation of repository group %s')
                     % request.POST.get('group_name'), category='error')
             parent_group_id = form_result['parent_group_id']
-            #TODO: maybe we should get back to the main view, not the admin one
+            # TODO: maybe we should get back to the main view, not the admin one
             raise HTTPFound(location=url('repos_groups', parent_group=parent_group_id))
         h.flash(_('Created repository group %s') % gr.group_name,
                 category='success')
@@ -188,7 +188,7 @@
 
     def new(self):
         if HasPermissionAny('hg.admin')('group create'):
-            #we're global admin, we're ok and we can create TOP level groups
+            # we're global admin, we're ok and we can create TOP level groups
             pass
         else:
             # we pass in parent group into creation form, thus we know
@@ -212,7 +212,7 @@
 
         # TODO: kill allow_empty_group - it is only used for redundant form validation!
         if HasPermissionAny('hg.admin')('group edit'):
-            #we're global admin, we're ok and we can create TOP level groups
+            # we're global admin, we're ok and we can create TOP level groups
             allow_empty_group = True
         elif not c.repo_group.parent_group:
             allow_empty_group = True
@@ -229,11 +229,11 @@
 
             new_gr = RepoGroupModel().update(group_name, form_result)
             Session().commit()
-            h.flash(_('Updated repository group %s') \
+            h.flash(_('Updated repository group %s')
                     % form_result['group_name'], category='success')
             # we now have new name !
             group_name = new_gr.group_name
-            #TODO: in future action_logger(, '', '', '')
+            # TODO: in future action_logger(, '', '', '')
         except formencode.Invalid as errors:
             c.active = 'settings'
             return htmlfill.render(
@@ -245,7 +245,7 @@
                 force_defaults=False)
         except Exception:
             log.error(traceback.format_exc())
-            h.flash(_('Error occurred during update of repository group %s') \
+            h.flash(_('Error occurred during update of repository group %s')
                     % request.POST.get('group_name'), category='error')
 
         raise HTTPFound(location=url('edit_repo_group', group_name=group_name))
@@ -270,7 +270,7 @@
             Session().commit()
             h.flash(_('Removed repository group %s') % group_name,
                     category='success')
-            #TODO: in future action_logger(, '', '', '')
+            # TODO: in future action_logger(, '', '', '')
         except Exception:
             log.error(traceback.format_exc())
             h.flash(_('Error occurred during deletion of repository group %s')
@@ -369,7 +369,7 @@
                                              form_result['perms_new'],
                                              form_result['perms_updates'],
                                              recursive)
-        #TODO: implement this
+        # TODO: implement this
         #action_logger(request.authuser, 'admin_changed_repo_permissions',
         #              repo_name, request.ip_addr)
         Session().commit()
--- a/kallithea/controllers/admin/repos.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/controllers/admin/repos.py	Fri Aug 25 14:32:50 2017 +0200
@@ -104,7 +104,7 @@
         repos_data = RepoModel().get_repos_as_dict(repos_list=c.repos_list,
                                                    admin=True,
                                                    super_user_actions=True)
-        #data used to render the grid
+        # data used to render the grid
         c.data = repos_data
 
         return render('admin/repos/repos.html')
@@ -257,7 +257,7 @@
 
         except Exception:
             log.error(traceback.format_exc())
-            h.flash(_('Error occurred during update of repository %s') \
+            h.flash(_('Error occurred during update of repository %s')
                     % repo_name, category='error')
         raise HTTPFound(location=url('edit_repo', repo_name=changed_name))
 
@@ -331,7 +331,7 @@
         form = RepoPermsForm()().to_python(request.POST)
         RepoModel()._update_permissions(repo_name, form['perms_new'],
                                         form['perms_updates'])
-        #TODO: implement this
+        # TODO: implement this
         #action_logger(request.authuser, 'admin_changed_repo_permissions',
         #              repo_name, request.ip_addr)
         Session().commit()
@@ -353,7 +353,7 @@
                 RepoModel().revoke_user_group_permission(
                     repo=repo_name, group_name=obj_id
                 )
-            #TODO: implement this
+            # TODO: implement this
             #action_logger(request.authuser, 'admin_revoked_repo_permissions',
             #              repo_name, request.ip_addr)
             Session().commit()
@@ -456,7 +456,6 @@
                     category='error')
         raise HTTPFound(location=url('edit_repo_advanced', repo_name=repo_name))
 
-
     @HasRepoPermissionLevelDecorator('admin')
     def edit_advanced_fork(self, repo_name):
         """
--- a/kallithea/controllers/admin/settings.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/controllers/admin/settings.py	Fri Aug 25 14:32:50 2017 +0200
@@ -102,7 +102,7 @@
                     sett = Ui.get_by_key('paths', '/')
                     sett.ui_value = form_result['paths_root_path']
 
-                #HOOKS
+                # HOOKS
                 sett = Ui.get_by_key('hooks', Ui.HOOK_UPDATE)
                 sett.ui_active = form_result['hooks_changegroup_update']
 
@@ -160,7 +160,7 @@
         if request.POST:
             rm_obsolete = request.POST.get('destroy', False)
             install_git_hooks = request.POST.get('hooks', False)
-            overwrite_git_hooks = request.POST.get('hooks_overwrite', False);
+            overwrite_git_hooks = request.POST.get('hooks_overwrite', False)
             invalidate_cache = request.POST.get('invalidate', False)
             log.debug('rescanning repo location with destroy obsolete=%s, '
                       'install git hooks=%s and '
--- a/kallithea/controllers/admin/user_groups.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/controllers/admin/user_groups.py	Fri Aug 25 14:32:50 2017 +0200
@@ -155,7 +155,7 @@
                 force_defaults=False)
         except Exception:
             log.error(traceback.format_exc())
-            h.flash(_('Error occurred during creation of user group %s') \
+            h.flash(_('Error occurred during creation of user group %s')
                     % request.POST.get('users_group_name'), category='error')
 
         raise HTTPFound(location=url('users_groups'))
@@ -205,7 +205,7 @@
                 force_defaults=False)
         except Exception:
             log.error(traceback.format_exc())
-            h.flash(_('Error occurred during update of user group %s') \
+            h.flash(_('Error occurred during update of user group %s')
                     % request.POST.get('users_group_name'), category='error')
 
         raise HTTPFound(location=url('edit_users_group', id=id))
@@ -283,7 +283,7 @@
         except RepoGroupAssignmentError:
             h.flash(_('Target group cannot be the same'), category='error')
             raise HTTPFound(location=url('edit_user_group_perms', id=id))
-        #TODO: implement this
+        # TODO: implement this
         #action_logger(request.authuser, 'admin_changed_repo_permissions',
         #              repo_name, request.ip_addr)
         Session().commit()
@@ -415,7 +415,6 @@
                                      key=lambda u: u.username.lower())
         return render('admin/user_groups/user_group_edit.html')
 
-
     @HasUserGroupPermissionLevelDecorator('admin')
     def edit_members(self, id):
         c.user_group = UserGroup.get_or_404(id)
--- a/kallithea/controllers/admin/users.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/controllers/admin/users.py	Fri Aug 25 14:32:50 2017 +0200
@@ -137,7 +137,7 @@
             h.flash(e, 'error')
         except Exception:
             log.error(traceback.format_exc())
-            h.flash(_('Error occurred during creation of user %s') \
+            h.flash(_('Error occurred during creation of user %s')
                     % request.POST.get('username'), category='error')
         raise HTTPFound(location=url('edit_user', id=user.user_id))
 
@@ -180,7 +180,7 @@
                 force_defaults=False)
         except Exception:
             log.error(traceback.format_exc())
-            h.flash(_('Error occurred during update of user %s') \
+            h.flash(_('Error occurred during update of user %s')
                     % form_result.get('username'), category='error')
         raise HTTPFound(location=url('edit_user', id=id))
 
--- a/kallithea/controllers/changelog.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/controllers/changelog.py	Fri Aug 25 14:32:50 2017 +0200
@@ -114,7 +114,7 @@
                 try:
                     collection = tip_cs.get_file_history(f_path)
                 except (NodeDoesNotExistError, ChangesetError):
-                    #this node is not present at tip !
+                    # this node is not present at tip !
                     try:
                         cs = self.__get_cs(revision, repo_name)
                         collection = cs.get_file_history(f_path)
--- a/kallithea/controllers/changeset.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/controllers/changeset.py	Fri Aug 25 14:32:50 2017 +0200
@@ -115,7 +115,7 @@
         ln_ctx = filter(lambda k: k.startswith('C'), GET.getall(fid))
     else:
         _ln_ctx = filter(lambda k: k.startswith('C'), GET)
-        ln_ctx = GET.get(_ln_ctx[0]) if _ln_ctx  else ln_ctx_global
+        ln_ctx = GET.get(_ln_ctx[0]) if _ln_ctx else ln_ctx_global
         if ln_ctx:
             ln_ctx = [ln_ctx]
 
@@ -207,7 +207,7 @@
         c.ignorews_url = _ignorews_url
         c.context_url = _context_url
         c.fulldiff = fulldiff = request.GET.get('fulldiff')
-        #get ranges of revisions if preset
+        # get ranges of revisions if preset
         rev_range = revision.split('...')[:2]
         enable_comments = True
         c.cs_repo = c.db_repo
@@ -300,7 +300,7 @@
                 file_diff_data.append(('', None, None, None, diff, None))
             c.changes[changeset.raw_id] = (cs1, cs2, file_diff_data)
 
-        #sort comments in creation order
+        # sort comments in creation order
         c.comments = [com for com_id, com in sorted(comments.items())]
 
         # count inline comments
--- a/kallithea/controllers/compare.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/controllers/compare.py	Fri Aug 25 14:32:50 2017 +0200
@@ -94,7 +94,7 @@
             other_changesets = []
 
         elif alias == 'hg':
-            #case two independent repos
+            # case two independent repos
             if org_repo != other_repo:
                 hgrepo = unionrepo.unionrepository(other_repo.baseui,
                                                    other_repo.path,
@@ -102,7 +102,7 @@
                 # all ancestors of other_rev will be in other_repo and
                 # rev numbers from hgrepo can be used in other_repo - org_rev ancestors cannot
 
-            #no remote compare do it on the same repository
+            # no remote compare do it on the same repository
             else:
                 hgrepo = other_repo._repo
 
--- a/kallithea/controllers/feed.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/controllers/feed.py	Fri Aug 25 14:32:50 2017 +0200
@@ -83,7 +83,7 @@
     def __get_desc(self, cs):
         desc_msg = [(_('%s committed on %s')
                      % (h.person(cs.author), h.fmt_date(cs.date))) + '<br/>']
-        #branches, tags, bookmarks
+        # branches, tags, bookmarks
         if cs.branch:
             desc_msg.append('branch: %s<br/>' % cs.branch)
         for book in cs.bookmarks:
--- a/kallithea/controllers/files.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/controllers/files.py	Fri Aug 25 14:32:50 2017 +0200
@@ -166,7 +166,7 @@
 
             if c.file.is_file():
                 c.load_full_history = False
-                #determine if we're on branch head
+                # determine if we're on branch head
                 _branches = c.db_repo_scm_instance.branches
                 c.on_branch_head = revision in _branches.keys() + _branches.values()
                 _hist = []
@@ -460,7 +460,7 @@
                 h.flash(_('No filename'), category='warning')
                 raise HTTPFound(location=url('changeset_home', repo_name=c.repo_name,
                                     revision='tip'))
-            #strip all crap out of file, just leave the basename
+            # strip all crap out of file, just leave the basename
             filename = os.path.basename(filename)
             node_path = posixpath.join(location, filename)
             author = request.authuser.full_contact
@@ -599,8 +599,8 @@
         c.changes = OrderedDict()
         c.changes[diff2] = []
 
-        #special case if we want a show rev only, it's impl here
-        #to reduce JS and callbacks
+        # special case if we want a show rev only, it's impl here
+        # to reduce JS and callbacks
 
         if request.GET.get('show_rev'):
             if str2bool(request.GET.get('annotate', 'False')):
@@ -748,7 +748,7 @@
             try:
                 changesets = tip_cs.get_file_history(f_path)
             except (NodeDoesNotExistError, ChangesetError):
-                #this node is not present at tip !
+                # this node is not present at tip !
                 changesets = cs.get_file_history(f_path)
         hist_l = []
 
--- a/kallithea/controllers/home.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/controllers/home.py	Fri Aug 25 14:32:50 2017 +0200
@@ -57,7 +57,7 @@
 
         repos_data = RepoModel().get_repos_as_dict(repos_list=repos_list,
                                                    admin=False, short_name=True)
-        #data used to render the grid
+        # data used to render the grid
         c.data = repos_data
 
         return render('/index.html')
@@ -65,7 +65,7 @@
     @LoginRequired()
     @jsonify
     def repo_switcher_data(self):
-        #wrapper for conditional cache
+        # wrapper for conditional cache
         def _c():
             log.debug('generating switcher repo/groups list')
             all_repos = Repository.query(sorted=True).all()
--- a/kallithea/controllers/journal.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/controllers/journal.py	Fri Aug 25 14:32:50 2017 +0200
@@ -69,7 +69,7 @@
         groups = []
         for k, g in groupby(journal, lambda x: x.action_as_day):
             user_group = []
-            #groupby username if it's a present value, else fallback to journal username
+            # groupby username if it's a present value, else fallback to journal username
             for _unused, g2 in groupby(list(g), lambda x: x.user.username if x.user else x.username):
                 l = list(g2)
                 user_group.append((l[0].user, l))
@@ -97,7 +97,7 @@
             journal = UserLog.query() \
                 .options(joinedload(UserLog.user)) \
                 .options(joinedload(UserLog.repository))
-            #filter
+            # filter
             journal = _journal_filter(journal, c.search_term)
             journal = journal.filter(filtering_criterion) \
                         .order_by(UserLog.action_date.desc())
@@ -125,7 +125,7 @@
         for entry in journal[:feed_nr]:
             user = entry.user
             if user is None:
-                #fix deleted users
+                # fix deleted users
                 user = AttributeDict({'short_contact': entry.username,
                                       'email': '',
                                       'full_contact': ''})
@@ -167,7 +167,7 @@
         for entry in journal[:feed_nr]:
             user = entry.user
             if user is None:
-                #fix deleted users
+                # fix deleted users
                 user = AttributeDict({'short_contact': entry.username,
                                       'email': '',
                                       'full_contact': ''})
@@ -217,7 +217,7 @@
 
         repos_data = RepoModel().get_repos_as_dict(repos_list=repos_list,
                                                    admin=True)
-        #data used to render the grid
+        # data used to render the grid
         c.data = repos_data
 
         return render('journal/journal.html')
--- a/kallithea/controllers/pullrequests.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/controllers/pullrequests.py	Fri Aug 25 14:32:50 2017 +0200
@@ -391,7 +391,7 @@
         if pull_request.is_closed():
             raise HTTPForbidden()
         assert pull_request.other_repo.repo_name == repo_name
-        #only owner or admin can update it
+        # only owner or admin can update it
         owner = pull_request.owner_id == request.authuser.user_id
         repo_admin = h.HasRepoPermissionLevel('admin')(c.repo_name)
         if not (h.HasPermissionAny('hg.admin')() or repo_admin or owner):
@@ -446,7 +446,7 @@
     @jsonify
     def delete(self, repo_name, pull_request_id):
         pull_request = PullRequest.get_or_404(pull_request_id)
-        #only owner can delete it !
+        # only owner can delete it !
         if pull_request.owner_id == request.authuser.user_id:
             PullRequestModel().delete(pull_request)
             Session().commit()
@@ -596,7 +596,7 @@
                                                 ignore_whitespace=ignore_whitespace,
                                                 context=line_context)
         except ChangesetDoesNotExistError:
-            txtdiff =  _("The diff can't be shown - the PR revisions could not be found.")
+            txtdiff = _("The diff can't be shown - the PR revisions could not be found.")
         diff_processor = diffs.DiffProcessor(txtdiff or '', format='gitdiff',
                                              diff_limit=diff_limit)
         _parsed = diff_processor.prepare()
@@ -734,7 +734,7 @@
     def delete_comment(self, repo_name, comment_id):
         co = ChangesetComment.get(comment_id)
         if co.pull_request.is_closed():
-            #don't allow deleting comments on closed pull request
+            # don't allow deleting comments on closed pull request
             raise HTTPForbidden()
 
         owner = co.author_id == request.authuser.user_id
--- a/kallithea/controllers/root.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/controllers/root.py	Fri Aug 25 14:32:50 2017 +0200
@@ -17,6 +17,7 @@
 from kallithea.controllers.error import ErrorController
 from tg import config
 
+
 # This is the main Kallithea entry point; TurboGears will forward all requests
 # to an instance of 'controller.root.RootController' in the configured
 # 'application' module (set by app_cfg.py).  Requests are forwarded to
--- a/kallithea/lib/annotate.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/annotate.py	Fri Aug 25 14:32:50 2017 +0200
@@ -149,7 +149,7 @@
             for i in range(fl, fl + lncount):
                 if i % st == 0:
                     if aln:
-                        lines.append('<a href="#%s-%d">%*d</a>' \
+                        lines.append('<a href="#%s-%d">%*d</a>'
                                      % (la, i, mw, i))
                     else:
                         lines.append('%*d' % (mw, i))
@@ -158,7 +158,7 @@
             ls = '\n'.join(lines)
 
 #        annotate_changesets = [tup[1] for tup in self.filenode.annotate]
-##        TODO: not sure what that fixes
+#        # TODO: not sure what that fixes
 #        # If pygments cropped last lines break we need do that too
 #        ln_cs = len(annotate_changesets)
 #        ln_ = len(ls.splitlines())
--- a/kallithea/lib/auth.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/auth.py	Fri Aug 25 14:32:50 2017 +0200
@@ -104,7 +104,7 @@
         import bcrypt
         return bcrypt.hashpw(safe_str(password), bcrypt.gensalt(10))
     else:
-        raise Exception('Unknown or unsupported platform %s' \
+        raise Exception('Unknown or unsupported platform %s'
                         % __platform__)
 
 
@@ -121,7 +121,7 @@
         return hashlib.sha256(password).hexdigest() == hashed
     elif is_unix:
         import bcrypt
-        print (safe_str(password), safe_str(hashed))
+        print(safe_str(password), safe_str(hashed))
         try:
             return bcrypt.checkpw(safe_str(password), safe_str(hashed))
         except ValueError as e:
@@ -129,7 +129,7 @@
             log.error('error from bcrypt checking password: %s', e)
             return False
     else:
-        raise Exception('Unknown or unsupported platform %s' \
+        raise Exception('Unknown or unsupported platform %s'
                         % __platform__)
 
 
@@ -261,7 +261,7 @@
     for gr, perms in _grouped:
         # since user can be in multiple groups iterate over them and
         # select the lowest permissions first (more explicit)
-        ##TODO: do this^^
+        # TODO: do this^^
         if not gr.inherit_default_permissions:
             # NEED TO IGNORE all configurable permissions and
             # replace them with explicitly set
@@ -409,7 +409,7 @@
             p = _choose_perm(p, cur_perm)
         permissions[UK][g_k] = p
 
-    #user explicit permission for user groups
+    # user explicit permission for user groups
     user_user_groups_perms = Permission.get_default_user_group_perms(user_id)
     for perm in user_user_groups_perms:
         u_k = perm.UserUserGroupToPerm.user_group.users_group_name
@@ -437,7 +437,7 @@
     else:
         msg = 'controller: %s is *NOT* in API whitelist' % (controller_name)
         if api_key:
-            #if we use API key and don't have access it's a warning
+            # if we use API key and don't have access it's a warning
             log.warning(msg)
         else:
             log.debug(msg)
@@ -510,7 +510,7 @@
 
         # If user cannot be found, try falling back to anonymous.
         if not is_user_loaded:
-            is_user_loaded =  self._fill_data(self._default_user)
+            is_user_loaded = self._fill_data(self._default_user)
 
         self.is_default_user = (self.user_id == self._default_user.user_id)
         self.is_anonymous = not is_user_loaded or self.is_default_user
--- a/kallithea/lib/auth_modules/__init__.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/auth_modules/__init__.py	Fri Aug 25 14:32:50 2017 +0200
@@ -40,7 +40,7 @@
         from inspect import isfunction
         formencode_obj = self.formencode_obj
         if isfunction(formencode_obj):
-            #case we wrap validators into functions
+            # case we wrap validators into functions
             formencode_obj = self.formencode_obj(*args, **kwargs)
         return formencode_obj(*self.args, **self.kwargs)
 
@@ -76,7 +76,6 @@
                 #log.debug('Initializing lazy formencode object: %s', obj)
                 return LazyFormencode(obj, *args, **kwargs)
 
-
         class ProxyGet(object):
             def __getattribute__(self, name):
                 return LazyCaller(name)
@@ -420,6 +419,7 @@
                         username, module)
     return None
 
+
 def get_managed_fields(user):
     """return list of fields that are managed by the user's auth source, usually some of
     'username', 'firstname', 'lastname', 'email', 'active', 'password'
--- a/kallithea/lib/base.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/base.py	Fri Aug 25 14:32:50 2017 +0200
@@ -290,7 +290,7 @@
             log.error(traceback.format_exc())
             return None, webob.exc.HTTPInternalServerError()
 
-        #check permissions for this repository
+        # check permissions for this repository
         perm = self._check_permission(action, user, repo_name, ip_addr)
         if not perm:
             return None, webob.exc.HTTPForbidden()
@@ -522,7 +522,7 @@
 
             self._basic_security_checks()
 
-            #set globals for auth user
+            # set globals for auth user
 
             bearer_token = None
             try:
--- a/kallithea/lib/caching_query.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/caching_query.py	Fri Aug 25 14:32:50 2017 +0200
@@ -220,8 +220,8 @@
 
     """
     v = []
+
     def visit_bindparam(bind):
-
         if bind.key in query._params:
             value = query._params[bind.key]
         elif bind.callable:
@@ -234,7 +234,7 @@
 
         v.append(value)
     if query._criterion is not None:
-        visitors.traverse(query._criterion, {}, {'bindparam':visit_bindparam})
+        visitors.traverse(query._criterion, {}, {'bindparam': visit_bindparam})
     for f in query._from_obj:
-        visitors.traverse(f, {}, {'bindparam':visit_bindparam})
+        visitors.traverse(f, {}, {'bindparam': visit_bindparam})
     return v
--- a/kallithea/lib/celerylib/__init__.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/celerylib/__init__.py	Fri Aug 25 14:32:50 2017 +0200
@@ -74,6 +74,7 @@
         f_async.__name__ = f_org.__name__
         from kallithea.lib import celerypylons
         runner = celerypylons.task(ignore_result=True)(f_async)
+
         def f_wrapped(*args, **kwargs):
             t = runner.apply_async(args=args, kwargs=kwargs)
             log.info('executing task %s in async mode - id %s', f_org, t.task_id)
--- a/kallithea/lib/celerylib/tasks.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/celerylib/tasks.py	Fri Aug 25 14:32:50 2017 +0200
@@ -180,7 +180,7 @@
                                         "schema": ["commits"],
                                         }
 
-            #gather all data by day
+            # gather all data by day
             if k in commits_by_day_aggregate:
                 commits_by_day_aggregate[k] += 1
             else:
@@ -321,6 +321,7 @@
         return False
     return True
 
+
 @celerylib.task
 @celerylib.dbsession
 def create_repo(form_data, cur_user):
@@ -471,7 +472,7 @@
     except Exception as e:
         log.warning('Exception %s occurred when forking repository, '
                     'doing cleanup...' % e)
-        #rollback things manually !
+        # rollback things manually !
         repo = Repository.get_by_repo_name(repo_name_full)
         if repo:
             Repository.delete(repo.repo_id)
--- a/kallithea/lib/celerypylons/__init__.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/celerypylons/__init__.py	Fri Aug 25 14:32:50 2017 +0200
@@ -27,7 +27,9 @@
     # Verify .ini file configuration has been loaded
     assert config['celery.imports'] == 'kallithea.lib.celerylib.tasks', 'Kallithea Celery configuration has not been loaded'
 
-    class CeleryConfig(object): pass
+    class CeleryConfig(object):
+        pass
+
     celery_config = CeleryConfig()
 
     PREFIXES = """ADMINS BROKER CASSANDRA CELERYBEAT CELERYD CELERYMON CELERY EMAIL SERVER""".split()
--- a/kallithea/lib/compat.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/compat.py	Fri Aug 25 14:32:50 2017 +0200
@@ -55,6 +55,7 @@
 
 # Python Software Foundation License
 
+
 # XXX: it feels like using the class with "is" and "is not" instead of "==" and
 # "!=" should be faster.
 class _Nil(object):
@@ -74,6 +75,7 @@
         else:
             return NotImplemented
 
+
 _nil = _Nil()
 
 
--- a/kallithea/lib/db_manage.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/db_manage.py	Fri Aug 25 14:32:50 2017 +0200
@@ -84,7 +84,7 @@
         if SESSION:
             self.sa = SESSION
         else:
-            #init new sessions
+            # init new sessions
             engine = create_engine(self.dburi)
             init_model(engine)
             self.sa = Session()
@@ -205,7 +205,7 @@
             if password is None:
                 password = get_password()
                 if not password:
-                    #second try
+                    # second try
                     password = get_password()
                     if not password:
                         sys.exit()
@@ -234,7 +234,7 @@
         Creates ui settings, fills out hooks
         """
 
-        #HOOKS
+        # HOOKS
         hooks1_key = Ui.HOOK_UPDATE
         hooks1_ = Ui.query() \
             .filter(Ui.ui_key == hooks1_key).scalar()
--- a/kallithea/lib/dbmigrate/__init__.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/dbmigrate/__init__.py	Fri Aug 25 14:32:50 2017 +0200
@@ -1,5 +1,6 @@
 from gearbox.command import Command
 
+
 class UpgradeDb(Command):
     '''(removed)'''
 
--- a/kallithea/lib/diffs.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/diffs.py	Fri Aug 25 14:32:50 2017 +0200
@@ -130,6 +130,7 @@
                                 ignore_whitespace, context)
     return vcs_gitdiff
 
+
 NEW_FILENODE = 1
 DEL_FILENODE = 2
 MOD_FILENODE = 3
@@ -205,7 +206,6 @@
 
     _escape_re = re.compile(r'(&)|(<)|(>)|(\t)|(\r)|(?<=.)( \n| $)')
 
-
     def __init__(self, diff, vcs='hg', format='gitdiff', diff_limit=None):
         """
         :param diff:   a text in diff format
@@ -375,7 +375,7 @@
 
     def _clean_line(self, line, command):
         if command in ['+', '-', ' ']:
-            #only modify the line if it's actually a diff thing
+            # only modify the line if it's actually a diff thing
             line = line[1:]
         return line
 
@@ -383,7 +383,7 @@
         _files = []
         diff_container = lambda arg: arg
 
-        ##split the diff in chunks of separate --git a/file b/file chunks
+        # split the diff in chunks of separate --git a/file b/file chunks
         for raw_diff in ('\n' + self._diff).split('\ndiff --git')[1:]:
             head, diff = self._get_header(raw_diff)
 
--- a/kallithea/lib/ext_json.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/ext_json.py	Fri Aug 25 14:32:50 2017 +0200
@@ -22,6 +22,7 @@
     return (value.tzinfo is not None
             and value.tzinfo.utcoffset(value) is not None)
 
+
 def _obj_dump(obj):
     """
     Custom function for dumping objects to JSON, if obj has __json__ attribute
--- a/kallithea/lib/graphmod.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/graphmod.py	Fri Aug 25 14:32:50 2017 +0200
@@ -19,6 +19,7 @@
 
 nullrev = -1
 
+
 def _first_known_ancestors(parentrev_func, minrev, knownrevs, head):
     """
     Return the apparent parents of the head revision in a filtered DAG.
@@ -45,6 +46,7 @@
             seen.add(r)
     return ancestors
 
+
 def graph_data(repo, revs):
     """Return a DAG with colored edge information for revs
 
@@ -61,6 +63,7 @@
     dag = _dagwalker(repo, revs)
     return list(_colored(repo, dag))
 
+
 def _dagwalker(repo, revs):
     """Iterate over revs, yielding revs (highest first) and parents to show in the graph."""
     if not revs:
@@ -102,6 +105,7 @@
         parents.
     """
     branch_cache = {}
+
     def branch(rev):
         """Return branch for rev, using cache for efficiency.
         For Mercurial, always return the named branch name (which may be 'default').
--- a/kallithea/lib/helpers.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/helpers.py	Fri Aug 25 14:32:50 2017 +0200
@@ -64,6 +64,7 @@
         kargs['qualified'] = True
     return url(*args, **kargs)
 
+
 def canonical_hostname():
     '''Return canonical hostname of system'''
     from kallithea import CONFIG
@@ -74,6 +75,7 @@
         parts = url('home', qualified=True).split('://', 1)
         return parts[1].split('/', 1)[0]
 
+
 def html_escape(s):
     """Return string with all html escaped.
     This is also safe for javascript in html but not necessarily correct.
@@ -116,6 +118,7 @@
         .replace('>', r'\x3e')
     )
 
+
 def jshtml(val):
     """HTML escapes a string value, then converts the resulting string
     to its corresponding JavaScript representation (see `js`).
@@ -150,6 +153,7 @@
     convert_boolean_attrs(attrs, ["disabled"])
     return HTML.input(**attrs)
 
+
 reset = _reset
 safeid = _make_safe_id_component
 
@@ -190,6 +194,7 @@
 
         return literal('/'.join(url_l))
 
+
 files_breadcrumbs = _FilesBreadCrumbs()
 
 
@@ -272,6 +277,7 @@
 
 _whitespace_re = re.compile(r'(\t)|( )(?=\n|</div>)')
 
+
 def _markup_whitespace(m):
     groups = m.groups()
     if groups[0]:
@@ -279,9 +285,11 @@
     if groups[1]:
         return ' <i></i>'
 
+
 def markup_whitespace(s):
     return _whitespace_re.sub(_markup_whitespace, s)
 
+
 def pygmentize(filenode, **kwargs):
     """
     pygmentize function using pygments
@@ -399,6 +407,7 @@
     def __html__(self):
         return escape(safe_unicode(self.message))
 
+
 class Flash(_Flash):
 
     def __call__(self, message, category=None, ignore_duplicate=False, logf=None):
@@ -430,6 +439,7 @@
         session.save()
         return [_Message(*m) for m in messages]
 
+
 flash = Flash()
 
 #==============================================================================
@@ -438,7 +448,7 @@
 from kallithea.lib.vcs.utils import author_name, author_email
 from kallithea.lib.utils2 import credentials_filter, age as _age
 
-age = lambda  x, y=False: _age(x, y)
+age = lambda x, y=False: _age(x, y)
 capitalize = lambda x: x.capitalize()
 email = author_email
 short_id = lambda x: x[:12]
@@ -499,6 +509,7 @@
         return User.get_by_email(email, cache=True) # cache will only use sql_cache_short
     return None
 
+
 def email_or_none(author):
     """Try to match email part of VCS committer string with a local user.
     Return primary email of user, email part of the specified author name, or None."""
@@ -516,6 +527,7 @@
     # No valid email, not a valid user in the system, none!
     return None
 
+
 def person(author, show_attr="username"):
     """Find the user identified by 'author', return one of the users attributes,
     default to the username attribute, None if there is no user"""
@@ -540,7 +552,7 @@
     # attr to return from fetched user
     person_getter = lambda usr: getattr(usr, show_attr)
 
-    #maybe it's an ID ?
+    # maybe it's an ID ?
     if str(id_).isdigit() or isinstance(id_, int):
         id_ = int(id_)
         user = User.get(id_)
@@ -614,7 +626,7 @@
             if parse_cs:
                 return link_to(lbl, url_, title=title_, **{'data-toggle': 'tooltip'})
             return link_to(lbl, url_, class_='lazy-cs' if lazy_cs else '',
-                           **{'data-raw_id':rev.raw_id, 'data-repo_name':repo_name})
+                           **{'data-raw_id': rev.raw_id, 'data-repo_name': repo_name})
 
         def _get_op(rev_txt):
             _op = None
@@ -848,6 +860,7 @@
                    (''.join(attributes),
                     gravatar(email_address, cls=cls, size=size)))
 
+
 def gravatar(email_address, cls='', size=30):
     """return html element of the gravatar
 
@@ -875,6 +888,7 @@
 
     return literal(html)
 
+
 def gravatar_url(email_address, size=30, default=''):
     # doh, we need to re-import those to mock it later
     from kallithea.config.routing import url
@@ -931,7 +945,7 @@
     width = 100
 
     if stats['binary']:
-        #binary mode
+        # binary mode
         lbl = ''
         bin_op = 1
 
@@ -951,7 +965,7 @@
             lbl += _('rename')
             bin_op = RENAMED_FILENODE
 
-        #chmod can go with other operations
+        # chmod can go with other operations
         if CHMOD_FILENODE in stats['ops']:
             _org_lbl = _('chmod')
             lbl += _org_lbl if lbl.endswith('+') else '+%s' % _org_lbl
@@ -970,7 +984,7 @@
     p_sum = a_p + d_p
 
     if p_sum > width:
-        #adjust the percentage to be == 100% since we adjusted to 9
+        # adjust the percentage to be == 100% since we adjusted to 9
         if a_p > d_p:
             a_p = a_p - (p_sum - width)
         else:
@@ -1013,7 +1027,6 @@
     re.VERBOSE | re.MULTILINE | re.IGNORECASE)
 
 
-
 def urlify_text(s, repo_name=None, link_=None, truncate=None, stylize=False, truncatef=truncate):
     """
     Parses given text message and make literal html with markup.
@@ -1131,6 +1144,7 @@
 
             # Wrap tmp_urlify_issues_f with substitution of this pattern, while making sure all loop variables (and compiled regexpes) are bound
             issue_re = re.compile(issue_pat)
+
             def issues_replace(match_obj,
                                issue_server_link=issue_server_link, issue_prefix=issue_prefix):
                 leadingspace = ' ' if match_obj.group().startswith(' ') else ''
@@ -1174,6 +1188,7 @@
         return short_id(ref_name)
     return ref_name
 
+
 def link_to_ref(repo_name, ref_type, ref_name, rev=None):
     """
     Return full markup for a href to changeset_home for a changeset.
@@ -1191,6 +1206,7 @@
         l = literal('%s (%s)' % (l, link_to(short_id(rev), url('changeset_home', repo_name=repo_name, revision=rev))))
     return l
 
+
 def changeset_status(repo, revision):
     from kallithea.model.changeset_status import ChangesetStatusModel
     return ChangesetStatusModel().get_status(repo, revision)
--- a/kallithea/lib/hooks.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/hooks.py	Fri Aug 25 14:32:50 2017 +0200
@@ -98,7 +98,7 @@
         # on that proper return code is server to client
         _http_ret = HTTPLockedRC(ex.repository, locked_by)
         if str(_http_ret.code).startswith('2'):
-            #2xx Codes don't raise exceptions
+            # 2xx Codes don't raise exceptions
             ui.status(safe_str(_http_ret.title))
         else:
             raise _http_ret
@@ -113,7 +113,7 @@
         # on that proper return code is server to client
         _http_ret = HTTPLockedRC(ex.repository, locked_by)
         if str(_http_ret.code).startswith('2'):
-            #2xx Codes don't raise exceptions
+            # 2xx Codes don't raise exceptions
             ui.status(safe_str(_http_ret.title))
         else:
             raise _http_ret
@@ -148,7 +148,7 @@
         locked_by = User.get(ex.locked_by[0]).username
         _http_ret = HTTPLockedRC(ex.repository, locked_by)
         if str(_http_ret.code).startswith('2'):
-            #2xx Codes don't raise exceptions
+            # 2xx Codes don't raise exceptions
             ui.status(safe_str(_http_ret.title))
     return 0
 
@@ -203,7 +203,7 @@
         locked_by = User.get(ex.locked_by[0]).username
         _http_ret = HTTPLockedRC(ex.repository, locked_by)
         if str(_http_ret.code).startswith('2'):
-            #2xx Codes don't raise exceptions
+            # 2xx Codes don't raise exceptions
             ui.status(safe_str(_http_ret.title))
 
     return 0
@@ -446,7 +446,7 @@
                         repo._repo.refs.set_symbolic_ref('HEAD',
                                             'refs/heads/%s' % push_ref['name'])
 
-                    cmd = ['for-each-ref', '--format=%(refname)','refs/heads/*']
+                    cmd = ['for-each-ref', '--format=%(refname)', 'refs/heads/*']
                     heads = repo.run_git_command(cmd)[0]
                     cmd = ['log', push_ref['new_rev'],
                            '--reverse', '--pretty=format:%H', '--not']
@@ -456,7 +456,7 @@
                     git_revs += repo.run_git_command(cmd)[0].splitlines()
 
                 elif push_ref['new_rev'] == EmptyChangeset().raw_id:
-                    #delete branch case
+                    # delete branch case
                     git_revs += ['delete_branch=>%s' % push_ref['name']]
                 else:
                     cmd = ['log', '%(old_rev)s..%(new_rev)s' % push_ref,
--- a/kallithea/lib/indexers/__init__.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/indexers/__init__.py	Fri Aug 25 14:32:50 2017 +0200
@@ -50,7 +50,7 @@
 # - avoid removing "stop words" from text
 # - search case-insensitively
 #
-EMAILADDRANALYZER =  RegexTokenizer() | LowercaseFilter()
+EMAILADDRANALYZER = RegexTokenizer() | LowercaseFilter()
 
 # CUSTOM ANALYZER raw-string + lowercase filter
 #
@@ -77,7 +77,7 @@
 #
 PATHANALYZER = RegexTokenizer() | LowercaseFilter()
 
-#INDEX SCHEMA DEFINITION
+# INDEX SCHEMA DEFINITION
 SCHEMA = Schema(
     fileid=ID(unique=True),
     owner=TEXT(analyzer=EMAILADDRANALYZER),
--- a/kallithea/lib/indexers/daemon.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/indexers/daemon.py	Fri Aug 25 14:32:50 2017 +0200
@@ -77,9 +77,9 @@
 
         self.repo_paths = ScmModel().repo_scan(self.repo_location)
 
-        #filter repo list
+        # filter repo list
         if repo_list:
-            #Fix non-ascii repo names to unicode
+            # Fix non-ascii repo names to unicode
             repo_list = map(safe_unicode, repo_list)
             self.filtered_repo_paths = {}
             for repo_name, repo in self.repo_paths.items():
@@ -88,7 +88,7 @@
 
             self.repo_paths = self.filtered_repo_paths
 
-        #filter update repo list
+        # filter update repo list
         self.filtered_repo_update_paths = {}
         if repo_update_list:
             self.filtered_repo_update_paths = {}
--- a/kallithea/lib/ipaddr.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/ipaddr.py	Fri Aug 25 14:32:50 2017 +0200
@@ -367,9 +367,11 @@
     return _collapse_address_list_recursive(sorted(
         addrs + nets, key=_BaseNet._get_networks_key))
 
+
 # backwards compatibility
 CollapseAddrList = collapse_address_list
 
+
 # We need to distinguish between the string and packed-bytes representations
 # of an IP address.  For example, b'0::1' is the IPv4 address 48.58.58.49,
 # while '0::1' is an IPv6 address.
--- a/kallithea/lib/markup_renderer.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/markup_renderer.py	Fri Aug 25 14:32:50 2017 +0200
@@ -79,6 +79,7 @@
 
         # Extract pre blocks.
         extractions = {}
+
         def pre_extraction_callback(matchobj):
             digest = md5(matchobj.group(0)).hexdigest()
             extractions[digest] = matchobj.group(0)
--- a/kallithea/lib/middleware/pygrack.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/middleware/pygrack.py	Fri Aug 25 14:32:50 2017 +0200
@@ -72,7 +72,7 @@
 
     def __init__(self, repo_name, content_path, extras):
         files = set([f.lower() for f in os.listdir(content_path)])
-        if  not (self.git_folder_signature.intersection(files)
+        if not (self.git_folder_signature.intersection(files)
                 == self.git_folder_signature):
             raise OSError('%s missing git signature' % content_path)
         self.content_path = content_path
--- a/kallithea/lib/middleware/sessionmiddleware.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/middleware/sessionmiddleware.py	Fri Aug 25 14:32:50 2017 +0200
@@ -26,6 +26,7 @@
 from beaker.session import SessionObject
 from beaker.middleware import SessionMiddleware
 
+
 class SecureSessionMiddleware(SessionMiddleware):
     def __call__(self, environ, start_response):
         """
--- a/kallithea/lib/middleware/simplehg.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/middleware/simplehg.py	Fri Aug 25 14:32:50 2017 +0200
@@ -62,6 +62,7 @@
     )
     return ishg_path
 
+
 class SimpleHg(BaseVCSController):
 
     def _handle_request(self, environ, start_response):
@@ -229,7 +230,7 @@
         repoui = make_ui('file', hgrc)
 
         if repoui:
-            #overwrite our ui instance with the section from hgrc file
+            # overwrite our ui instance with the section from hgrc file
             for section in ui_sections:
                 for k, v in repoui.configitems(section):
                     baseui.setconfig(section, k, v)
--- a/kallithea/lib/page.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/page.py	Fri Aug 25 14:32:50 2017 +0200
@@ -21,6 +21,7 @@
 from webhelpers.html import literal, HTML
 from webhelpers.paginate import Page as _Page
 
+
 class Page(_Page):
     """
     Custom pager to match rendering style with YUI paginator emitting Bootstrap paginators
--- a/kallithea/lib/paster_commands/cleanup.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/paster_commands/cleanup.py	Fri Aug 25 14:32:50 2017 +0200
@@ -84,7 +84,7 @@
             if dirs:
                 print 'Scanning: %s' % dn_
 
-        #filter older than (if present)!
+        # filter older than (if present)!
         now = datetime.datetime.now()
         older_than = args.older_than
         if older_than:
--- a/kallithea/lib/paster_commands/install_iis.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/paster_commands/install_iis.py	Fri Aug 25 14:32:50 2017 +0200
@@ -61,6 +61,7 @@
     HandleCommandLine(params)
 '''
 
+
 class Command(BasePasterCommand):
     '''Kallithea: Install into IIS using isapi-wsgi'''
 
--- a/kallithea/lib/paster_commands/make_config.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/paster_commands/make_config.py	Fri Aug 25 14:32:50 2017 +0200
@@ -118,7 +118,7 @@
         tmpl_stored_args.update(kwargs)
 
     if args.show_defaults:
-        for k,v in tmpl_stored_args.iteritems():
+        for k, v in tmpl_stored_args.iteritems():
             print '%s=%s' % (k, v)
         sys.exit(0)
 
--- a/kallithea/lib/pidlock.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/pidlock.py	Fri Aug 25 14:32:50 2017 +0200
@@ -42,7 +42,7 @@
         self.desc = desc
         self.debug = debug
         self.held = False
-        #run the lock automatically !
+        # run the lock automatically!
         self.lock()
         self._finalize = Finalize(self, DaemonLock._on_finalize,
                                   args=(self, debug), exitpriority=10)
--- a/kallithea/lib/rcmail/response.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/rcmail/response.py	Fri Aug 25 14:32:50 2017 +0200
@@ -196,7 +196,7 @@
         self.attachments.append({'filename': filename,
                                  'content_type': content_type,
                                  'data': data,
-                                 'disposition': disposition,})
+                                 'disposition': disposition})
 
     def attach_part(self, part):
         """
--- a/kallithea/lib/rcmail/utils.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/rcmail/utils.py	Fri Aug 25 14:32:50 2017 +0200
@@ -16,4 +16,5 @@
             self._fqdn = socket.getfqdn()
         return self._fqdn
 
+
 DNS_NAME = CachedDnsName()
--- a/kallithea/lib/utils.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/utils.py	Fri Aug 25 14:32:50 2017 +0200
@@ -214,7 +214,7 @@
             if REMOVED_REPO_PAT.match(subdir):
                 continue
 
-            #skip .<something> dirs TODO: rly? then we should prevent creating them ...
+            # skip .<something> dirs TODO: rly? then we should prevent creating them ...
             if subdir.startswith('.'):
                 continue
 
@@ -303,7 +303,7 @@
     return False
 
 
-#propagated from mercurial documentation
+# propagated from mercurial documentation
 ui_sections = ['alias', 'auth',
                 'decode/encode', 'defaults',
                 'diff', 'email',
@@ -479,7 +479,7 @@
         user = User.get_first_admin()
     added = []
 
-    ##creation defaults
+    # creation defaults
     defs = Setting.get_default_repo_settings(strip_prefix=True)
     enable_statistics = defs.get('repo_enable_statistics')
     enable_locking = defs.get('repo_enable_locking')
@@ -556,13 +556,13 @@
         # Additional mappings that are not present in the pygments lexers
         conf.LANGUAGES_EXTENSIONS_MAP.update(getattr(EXT, 'EXTRA_MAPPINGS', {}))
 
-        #OVERRIDE OUR EXTENSIONS FROM RC-EXTENSIONS (if present)
+        # OVERRIDE OUR EXTENSIONS FROM RC-EXTENSIONS (if present)
 
         if getattr(EXT, 'INDEX_EXTENSIONS', []):
             log.debug('settings custom INDEX_EXTENSIONS')
             conf.INDEX_EXTENSIONS = getattr(EXT, 'INDEX_EXTENSIONS', [])
 
-        #ADDITIONAL MAPPINGS
+        # ADDITIONAL MAPPINGS
         log.debug('adding extra into INDEX_EXTENSIONS')
         conf.INDEX_EXTENSIONS.extend(getattr(EXT, 'EXTRA_INDEX_EXTENSIONS', []))
 
--- a/kallithea/lib/utils2.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/utils2.py	Fri Aug 25 14:32:50 2017 +0200
@@ -297,7 +297,7 @@
             return ''.join([COLOR_SEQ % COLOR_SQL, sql, normal])
 
         if configuration['debug']:
-            #attach events only for debug configuration
+            # attach events only for debug configuration
 
             def before_cursor_execute(conn, cursor, statement,
                                     parameters, context, executemany):
@@ -458,7 +458,7 @@
     """
 
     uri = uri_filter(uri)
-    #check if we have port
+    # check if we have port
     if len(uri) > 2 and uri[2]:
         uri[2] = ':' + uri[2]
 
@@ -531,6 +531,7 @@
 # Matching is greedy so we don't have to look beyond the end.
 MENTIONS_REGEX = re.compile(r'(?:^|(?<=[^a-zA-Z0-9]))@([a-zA-Z0-9][-_.a-zA-Z0-9]*[a-zA-Z0-9])')
 
+
 def extract_mentioned_usernames(text):
     r"""
     Returns list of (possible) usernames @mentioned in given text.
@@ -540,6 +541,7 @@
     """
     return MENTIONS_REGEX.findall(text)
 
+
 def extract_mentioned_users(text):
     """ Returns set of actual database Users @mentioned in given text. """
     from kallithea.model.db import User
@@ -649,7 +651,8 @@
     def __call__(self):
         return self
 
-#alias
+
+# alias
 OAttr = OptionalAttr
 
 
@@ -697,5 +700,6 @@
             return val.getval()
         return val
 
+
 def urlreadable(s, _cleanstringsub=re.compile('[^-a-zA-Z0-9./]+').sub):
     return _cleanstringsub('_', safe_str(s)).rstrip('_')
--- a/kallithea/lib/vcs/backends/base.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/vcs/backends/base.py	Fri Aug 25 14:32:50 2017 +0200
@@ -700,6 +700,7 @@
     def phase(self):
         return ''
 
+
 class BaseWorkdir(object):
     """
     Working directory representation of single repository.
--- a/kallithea/lib/vcs/backends/git/repository.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/vcs/backends/git/repository.py	Fri Aug 25 14:32:50 2017 +0200
@@ -118,7 +118,7 @@
             _copts = ['-c', 'core.quotepath=false', ]
         safe_call = False
         if '_safe' in opts:
-            #no exc on failure
+            # no exc on failure
             del opts['_safe']
             safe_call = True
 
@@ -189,7 +189,7 @@
             test_uri = test_uri.rstrip('/') + '/info/refs'
 
         if authinfo:
-            #create a password manager
+            # create a password manager
             passmgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
             passmgr.add_password(*authinfo)
 
@@ -262,7 +262,7 @@
         return so.splitlines()
 
     def _get_all_revisions2(self):
-        #alternate implementation using dulwich
+        # alternate implementation using dulwich
         includes = [x[1][0] for x in self._parsed_refs.iteritems()
                     if x[1][1] != 'T']
         return [c.commit.id for c in self._repo.get_walker(include=includes)]
@@ -527,7 +527,7 @@
 
         """
         if branch_name and branch_name not in self.branches:
-            raise BranchDoesNotExistError("Branch '%s' not found" \
+            raise BranchDoesNotExistError("Branch '%s' not found"
                                           % branch_name)
         # actually we should check now if it's not an empty repo to not spaw
         # subprocess commands
--- a/kallithea/lib/vcs/backends/hg/changeset.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/vcs/backends/hg/changeset.py	Fri Aug 25 14:32:50 2017 +0200
@@ -18,6 +18,7 @@
 
 from mercurial import obsolete
 
+
 class MercurialChangeset(BaseChangeset):
     """
     Represents state of the repository at the single revision.
@@ -37,7 +38,7 @@
 
     @LazyProperty
     def branch(self):
-        return  safe_unicode(self._ctx.branch())
+        return safe_unicode(self._ctx.branch())
 
     @LazyProperty
     def closesbranch(self):
@@ -411,7 +412,7 @@
         """
         Returns list of modified ``FileNode`` objects.
         """
-        return ChangedFileNodesGenerator([n for n in  self.status[0]], self)
+        return ChangedFileNodesGenerator([n for n in self.status[0]], self)
 
     @property
     def removed(self):
--- a/kallithea/lib/vcs/backends/hg/repository.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/vcs/backends/hg/repository.py	Fri Aug 25 14:32:50 2017 +0200
@@ -300,7 +300,7 @@
         cleaned_uri = str(url_obj)
 
         if authinfo:
-            #create a password manager
+            # create a password manager
             passmgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
             passmgr.add_password(*authinfo)
 
@@ -395,7 +395,7 @@
         try:
             return time.mktime(self.get_changeset().date.timetuple())
         except RepositoryError:
-            #fallback to filesystem
+            # fallback to filesystem
             cl_path = os.path.join(self.path, '.hg', "00changelog.i")
             st_path = os.path.join(self.path, '.hg', "store")
             if os.path.exists(cl_path):
@@ -529,7 +529,7 @@
             raise BranchDoesNotExistError(msg)
         if end_pos is not None:
             end_pos += 1
-        #filter branches
+        # filter branches
         filter_ = []
         if branch_name:
             filter_.append('branch("%s")' % (branch_name))
--- a/kallithea/lib/vcs/nodes.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/vcs/nodes.py	Fri Aug 25 14:32:50 2017 +0200
@@ -328,7 +328,7 @@
                 mtype = 'text/plain'
                 encoding = None
 
-                #try with pygments
+                # try with pygments
                 try:
                     from pygments import lexers
                     mt = lexers.get_lexer_for_filename(self.name).mimetypes
@@ -609,7 +609,7 @@
 
     def _extract_submodule_url(self):
         if self.alias == 'git':
-            #TODO: find a way to parse gits submodule file and extract the
+            # TODO: find a way to parse gits submodule file and extract the
             # linking URL
             return self.path
         if self.alias == 'hg':
--- a/kallithea/lib/vcs/subprocessio.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/vcs/subprocessio.py	Fri Aug 25 14:32:50 2017 +0200
@@ -45,7 +45,7 @@
             self.bytes = bytes(source)
         else:  # can be either file pointer or file-like
             if type(source) in (int, long):  # file pointer it is
-                ## converting file descriptor (int) stdin into file-like
+                # converting file descriptor (int) stdin into file-like
                 source = os.fdopen(source, 'rb', 16384)
             # let's see if source is file-like by now
             filelike = hasattr(source, 'read')
--- a/kallithea/lib/vcs/utils/__init__.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/vcs/utils/__init__.py	Fri Aug 25 14:32:50 2017 +0200
@@ -157,6 +157,7 @@
     r"""(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?""",
     re.IGNORECASE)
 
+
 def author_email(author):
     """
     Returns email address of given author string.
--- a/kallithea/lib/vcs/utils/annotate.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/vcs/utils/annotate.py	Fri Aug 25 14:32:50 2017 +0200
@@ -122,7 +122,7 @@
             for i in range(fl, fl + lncount):
                 if i % st == 0:
                     if aln:
-                        lines.append('<a href="#%s-%d">%*d</a>' \
+                        lines.append('<a href="#%s-%d">%*d</a>'
                                      % (la, i, mw, i))
                     else:
                         lines.append('%*d' % (mw, i))
@@ -134,7 +134,7 @@
         # If pygments cropped last lines break we need do that too
         ln_cs = len(annotate_changesets)
         ln_ = len(ls.splitlines())
-        if  ln_cs > ln_:
+        if ln_cs > ln_:
             annotate_changesets = annotate_changesets[:ln_ - ln_cs]
         annotate = ''.join((self.annotate_from_changeset(changeset)
             for changeset in annotate_changesets))
--- a/kallithea/lib/vcs/utils/diffs.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/vcs/utils/diffs.py	Fri Aug 25 14:32:50 2017 +0200
@@ -160,7 +160,7 @@
             l.extend(output[1].splitlines(1))
             return map(line_decoder, l)
         elif size == 1:
-            return  map(line_decoder, output[0].splitlines(1))
+            return map(line_decoder, output[0].splitlines(1))
         elif size == 0:
             return []
 
--- a/kallithea/lib/vcs/utils/hgcompat.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/vcs/utils/hgcompat.py	Fri Aug 25 14:32:50 2017 +0200
@@ -4,7 +4,7 @@
 
 import mercurial
 import mercurial.demandimport
-## patch demandimport, due to bug in mercurial when it always triggers demandimport.enable()
+# patch demandimport, due to bug in mercurial when it always triggers demandimport.enable()
 mercurial.demandimport.enable = lambda *args, **kwargs: 1
 from mercurial import archival, merge as hg_merge, patch, ui
 from mercurial import discovery
@@ -37,7 +37,8 @@
 import inspect
 # Mercurial 3.1 503bb3af70fe
 if inspect.getargspec(memfilectx.__init__).args[1] != 'repo':
-    _org__init__=memfilectx.__init__
+    _org__init__ = memfilectx.__init__
+
     def _memfilectx__init__(self, repo, *a, **b):
         return _org__init__(self, *a, **b)
     memfilectx.__init__ = _memfilectx__init__
--- a/kallithea/lib/vcs/utils/lazy.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/vcs/utils/lazy.py	Fri Aug 25 14:32:50 2017 +0200
@@ -9,6 +9,7 @@
     def __reduce__(self):
         return '_missing'
 
+
 _missing = _Missing()
 
 
--- a/kallithea/lib/vcs/utils/progressbar.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/vcs/utils/progressbar.py	Fri Aug 25 14:32:50 2017 +0200
@@ -10,6 +10,7 @@
 class ProgressBarError(Exception):
     pass
 
+
 class AlreadyFinishedError(ProgressBarError):
     pass
 
@@ -179,6 +180,7 @@
 RESET = '0'
 opt_dict = {'bold': '1', 'underscore': '4', 'blink': '5', 'reverse': '7', 'conceal': '8'}
 
+
 def colorize(text='', opts=(), **kwargs):
     """
     Returns your text, enclosed in ANSI graphics codes.
@@ -223,6 +225,7 @@
         text = text + '\x1b[%sm' % RESET
     return ('\x1b[%sm' % ';'.join(code_list)) + text
 
+
 def make_style(opts=(), **kwargs):
     """
     Returns a function with default parameters for colorize()
@@ -235,6 +238,7 @@
     """
     return lambda text: colorize(text, opts, **kwargs)
 
+
 NOCOLOR_PALETTE = 'nocolor'
 DARK_PALETTE = 'dark'
 LIGHT_PALETTE = 'light'
@@ -348,7 +352,6 @@
     pass
 
 
-
 def main():
     import time
 
--- a/kallithea/lib/vcs/utils/termcolors.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/vcs/utils/termcolors.py	Fri Aug 25 14:32:50 2017 +0200
@@ -11,6 +11,7 @@
 RESET = '0'
 opt_dict = {'bold': '1', 'underscore': '4', 'blink': '5', 'reverse': '7', 'conceal': '8'}
 
+
 def colorize(text='', opts=(), **kwargs):
     """
     Returns your text, enclosed in ANSI graphics codes.
@@ -55,6 +56,7 @@
         text = text + '\x1b[%sm' % RESET
     return ('\x1b[%sm' % ';'.join(code_list)) + text
 
+
 def make_style(opts=(), **kwargs):
     """
     Returns a function with default parameters for colorize()
@@ -67,6 +69,7 @@
     """
     return lambda text: colorize(text, opts, **kwargs)
 
+
 NOCOLOR_PALETTE = 'nocolor'
 DARK_PALETTE = 'dark'
 LIGHT_PALETTE = 'light'
@@ -120,6 +123,7 @@
 }
 DEFAULT_PALETTE = DARK_PALETTE
 
+
 def parse_color_setting(config_string):
     """Parse a DJANGO_COLORS environment variable to produce the system palette
 
--- a/kallithea/lib/verlib.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/lib/verlib.py	Fri Aug 25 14:32:50 2017 +0200
@@ -5,10 +5,12 @@
 
 import re
 
+
 class IrrationalVersionError(Exception):
     """This is an irrational version."""
     pass
 
+
 class HugeMajorVersionNumError(IrrationalVersionError):
     """An irrational version because the major version number is huge
     (often because a year or date was used).
@@ -18,6 +20,7 @@
     """
     pass
 
+
 # A marker used in the second and third parts of the `parts` tuple, for
 # versions that don't have those segments, to sort properly. An example
 # of versions in sort order ('highest' last):
@@ -47,6 +50,7 @@
     (?P<postdev>(\.post(?P<post>\d+))?(\.dev(?P<dev>\d+))?)?
     $''', re.VERBOSE)
 
+
 class NormalizedVersion(object):
     """A rational version.
 
@@ -212,6 +216,7 @@
     def __ge__(self, other):
         return self.__eq__(other) or self.__gt__(other)
 
+
 def suggest_normalized_version(s):
     """Suggest a normalized version close to the given version string.
 
@@ -267,7 +272,7 @@
         rs = rs[1:]
 
     # Clean leading '0's on numbers.
-    #TODO: unintended side-effect on, e.g., "2003.05.09"
+    # TODO: unintended side-effect on, e.g., "2003.05.09"
     # PyPI stats: 77 (~2%) better
     rs = re.sub(r"\b0+(\d+)(?!\d)", r"\1", rs)
 
@@ -313,7 +318,6 @@
     # PyPI stats: ~21 (0.62%) better
     rs = re.sub(r"\.?(pre|preview|-c)(\d+)$", r"c\g<2>", rs)
 
-
     # Tcl/Tk uses "px" for their post release markers
     rs = re.sub(r"p(\d+)$", r".post\1", rs)
 
--- a/kallithea/model/changeset_status.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/model/changeset_status.py	Fri Aug 25 14:32:50 2017 +0200
@@ -165,7 +165,7 @@
             revisions = pull_request.revisions
         cur_statuses = q.all()
 
-        #if statuses exists and last is associated with a closed pull request
+        # if statuses exists and last is associated with a closed pull request
         # we need to check if we can allow this status change
         if (dont_allow_on_closed_pull_request and cur_statuses
             and getattr(cur_statuses[0].pull_request, 'status', '')
@@ -174,7 +174,7 @@
                 'Changing status on closed pull request is not allowed'
             )
 
-        #update all current statuses with older version
+        # update all current statuses with older version
         for st in cur_statuses:
             st.version += 1
 
--- a/kallithea/model/comment.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/model/comment.py	Fri Aug 25 14:32:50 2017 +0200
@@ -67,7 +67,7 @@
         if line_no:
             line = _('on line %s') % line_no
 
-        #changeset
+        # changeset
         if revision:
             notification_type = Notification.TYPE_CHANGESET_COMMENT
             cs = repo.scm_instance.get_changeset(revision)
@@ -91,7 +91,7 @@
             # add changeset author if it's known locally
             cs_author = User.get_from_cs_author(cs.author)
             if not cs_author:
-                #use repo owner if we cannot extract the author correctly
+                # use repo owner if we cannot extract the author correctly
                 # FIXME: just use committer name even if not a user
                 cs_author = repo.owner
             recipients.append(cs_author)
@@ -112,7 +112,7 @@
                 'comment_username': author.username,
                 'threading': threading,
             }
-        #pull request
+        # pull request
         elif pull_request:
             notification_type = Notification.TYPE_PULL_REQUEST_COMMENT
             desc = comment.pull_request.title
@@ -128,7 +128,7 @@
             comment_url = pull_request.url(canonical=True,
                 anchor='comment-%s' % comment.comment_id)
             subj = safe_unicode(
-                h.link_to('Re pull request %(pr_nice_id)s: %(desc)s %(line)s' % \
+                h.link_to('Re pull request %(pr_nice_id)s: %(desc)s %(line)s' %
                           {'desc': desc,
                            'pr_nice_id': comment.pull_request.nice_id(),
                            'line': line},
@@ -139,7 +139,7 @@
             recipients.append(pull_request.owner)
             recipients += pull_request.get_reviewer_users()
 
-            #set some variables for email notification
+            # set some variables for email notification
             email_kwargs = {
                 'pr_title': pull_request.title,
                 'pr_title_short': h.shorter(pull_request.title, 50),
--- a/kallithea/model/db.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/model/db.py	Fri Aug 25 14:32:50 2017 +0200
@@ -457,12 +457,11 @@
     user_created_notifications = relationship('Notification', cascade='all')
     # comments created by this user
     user_comments = relationship('ChangesetComment', cascade='all')
-    #extra emails for this user
+    # extra emails for this user
     user_emails = relationship('UserEmailMap', cascade='all')
-    #extra API keys
+    # extra API keys
     user_api_keys = relationship('UserApiKeys', cascade='all')
 
-
     @hybrid_property
     def email(self):
         return self._email
@@ -478,12 +477,12 @@
 
     @property
     def emails(self):
-        other = UserEmailMap.query().filter(UserEmailMap.user==self).all()
+        other = UserEmailMap.query().filter(UserEmailMap.user == self).all()
         return [self.email] + [x.email for x in other]
 
     @property
     def api_keys(self):
-        other = UserApiKeys.query().filter(UserApiKeys.user==self).all()
+        other = UserApiKeys.query().filter(UserApiKeys.user == self).all()
         return [self.api_key] + [x.api_key for x in other]
 
     @property
@@ -615,7 +614,7 @@
         res = q.scalar()
 
         if fallback and not res:
-            #fallback to additional keys
+            # fallback to additional keys
             _res = UserApiKeys.query().filter_by(api_key=api_key, is_expired=False).first()
             if _res:
                 res = _res.user
@@ -801,6 +800,7 @@
         return u"<%s('user_id:%s=>%s')>" % (self.__class__.__name__,
                                             self.user_id, self.ip_addr)
 
+
 class UserLog(Base, BaseDbModel):
     __tablename__ = 'user_logs'
     __table_args__ = (
@@ -1752,7 +1752,7 @@
         ('hg.extern_activate.auto', _('Automatic activation of external account')),
     ]
 
-    #definition of system default permissions for DEFAULT user
+    # definition of system default permissions for DEFAULT user
     DEFAULT_USER_PERMISSIONS = [
         'repository.read',
         'group.read',
@@ -2051,9 +2051,9 @@
     stat_id = Column(Integer(), primary_key=True)
     repository_id = Column(Integer(), ForeignKey('repositories.repo_id'), nullable=False, unique=True)
     stat_on_revision = Column(Integer(), nullable=False)
-    commit_activity = Column(LargeBinary(1000000), nullable=False)#JSON data
-    commit_activity_combined = Column(LargeBinary(), nullable=False)#JSON data
-    languages = Column(LargeBinary(1000000), nullable=False)#JSON data
+    commit_activity = Column(LargeBinary(1000000), nullable=False) # JSON data
+    commit_activity_combined = Column(LargeBinary(), nullable=False) # JSON data
+    languages = Column(LargeBinary(1000000), nullable=False) # JSON data
 
     repository = relationship('Repository', single_parent=True)
 
@@ -2455,6 +2455,7 @@
         return h.url('pullrequest_show', repo_name=self.other_repo.repo_name,
                      pull_request_id=self.pull_request_id, **kwargs)
 
+
 class PullRequestReviewer(Base, BaseDbModel):
     __tablename__ = 'pull_request_reviewers'
     __table_args__ = (
--- a/kallithea/model/forms.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/model/forms.py	Fri Aug 25 14:32:50 2017 +0200
@@ -90,6 +90,7 @@
 
 def UserForm(edit=False, old_data=None):
     old_data = old_data or {}
+
     class _UserForm(formencode.Schema):
         allow_extra_fields = True
         filter_extra_fields = True
@@ -131,6 +132,7 @@
 def UserGroupForm(edit=False, old_data=None, available_members=None):
     old_data = old_data or {}
     available_members = available_members or []
+
     class _UserGroupForm(formencode.Schema):
         allow_extra_fields = True
         filter_extra_fields = True
@@ -158,6 +160,7 @@
     old_data = old_data or {}
     repo_groups = repo_groups or []
     repo_group_ids = [rg[0] for rg in repo_groups]
+
     class _RepoGroupForm(formencode.Schema):
         allow_extra_fields = True
         filter_extra_fields = False
@@ -170,8 +173,8 @@
         group_copy_permissions = v.StringBoolean(if_missing=False)
 
         if edit:
-            #FIXME: do a special check that we cannot move a group to one of
-            #its children
+            # FIXME: do a special check that we cannot move a group to one of
+            # its children
             pass
 
         parent_group_id = All(v.CanCreateGroup(can_create_in_root),
@@ -219,6 +222,7 @@
         email = v.Email(not_empty=True)
     return _PasswordResetRequestForm
 
+
 def PasswordResetConfirmationForm():
     class _PasswordResetConfirmationForm(formencode.Schema):
         allow_extra_fields = True
@@ -234,12 +238,14 @@
                                                     'password_confirm')]
     return _PasswordResetConfirmationForm
 
+
 def RepoForm(edit=False, old_data=None, supported_backends=BACKENDS.keys(),
              repo_groups=None, landing_revs=None):
     old_data = old_data or {}
     repo_groups = repo_groups or []
     landing_revs = landing_revs or []
     repo_group_ids = [rg[0] for rg in repo_groups]
+
     class _RepoForm(formencode.Schema):
         allow_extra_fields = True
         filter_extra_fields = False
@@ -317,6 +323,7 @@
     repo_groups = repo_groups or []
     landing_revs = landing_revs or []
     repo_group_ids = [rg[0] for rg in repo_groups]
+
     class _RepoForkForm(formencode.Schema):
         allow_extra_fields = True
         filter_extra_fields = False
@@ -466,7 +473,7 @@
                         validator = sv["validator"]
                         if isinstance(validator, LazyFormencode):
                             validator = validator()
-                        #init all lazy validators from formencode.All
+                        # init all lazy validators from formencode.All
                         if isinstance(validator, All):
                             init_validators = []
                             for validator in validator.validators:
--- a/kallithea/model/gist.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/model/gist.py	Fri Aug 25 14:32:50 2017 +0200
@@ -114,7 +114,7 @@
         log.debug('set GIST expiration date to: %s',
                   time_to_datetime(gist_expires)
                    if gist_expires != -1 else 'forever')
-        #create the Database version
+        # create the Database version
         gist = Gist()
         gist.gist_description = description
         gist.gist_access_id = gist_id
@@ -139,7 +139,7 @@
                 raise Exception('Filename cannot be inside a directory')
 
             content = gist_mapping[filename]['content']
-            #TODO: expand support for setting explicit lexers
+            # TODO: expand support for setting explicit lexers
 #             if lexer is None:
 #                 try:
 #                     guess_lexer = pygments.lexers.guess_lexer_for_filename
@@ -153,7 +153,7 @@
         message += 's: ' if len(processed_mapping) > 1 else ': '
         message += ', '.join([x for x in processed_mapping])
 
-        #fake Kallithea Repository object
+        # fake Kallithea Repository object
         fake_repo = AttributeDict(dict(
             repo_name=gist_repo_path,
             scm_instance_no_cache=lambda: repo,
@@ -192,7 +192,7 @@
         else:
             gist_expires = time.time() + (lifetime * 60) if lifetime != -1 else -1
 
-        #calculate operation type based on given data
+        # calculate operation type based on given data
         gist_mapping_op = {}
         for k, v in gist_mapping.items():
             # add, mod, del
@@ -215,7 +215,7 @@
         message += 's: ' if len(gist_mapping) > 1 else ': '
         message += ', '.join([x for x in gist_mapping])
 
-        #fake Kallithea Repository object
+        # fake Kallithea Repository object
         fake_repo = AttributeDict(dict(
             repo_name=gist_repo.path,
             scm_instance_no_cache=lambda: gist_repo,
--- a/kallithea/model/meta.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/model/meta.py	Fri Aug 25 14:32:50 2017 +0200
@@ -38,8 +38,8 @@
 # Engine is injected when model.__init__.init_model() sets meta.Base.metadata.bind
 Base = declarative_base()
 
-#to use cache use this in query
-#.options(FromCache("sqlalchemy_cache_type", "cachekey"))
+# to use cache use this in query:
+#   .options(FromCache("sqlalchemy_cache_type", "cachekey"))
 
 
 # Define naming conventions for foreign keys, primary keys, indexes,
--- a/kallithea/model/notification.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/model/notification.py	Fri Aug 25 14:32:50 2017 +0200
@@ -98,7 +98,7 @@
         if not with_email:
             return notif
 
-        #don't send email to person who created this comment
+        # don't send email to person who created this comment
         rec_objs = set(recipients_objs).difference(set([created_by_obj]))
 
         headers = {}
@@ -108,7 +108,7 @@
 
         # send email with notification to all other participants
         for rec in rec_objs:
-            ## this is passed into template
+            # this is passed into template
             html_kwargs = {
                       'subject': subject,
                       'body': h.render_w_mentions(body, repo_name),
@@ -232,7 +232,7 @@
         Creates a human readable description based on properties
         of notification object
         """
-        #alias
+        # alias
         _n = notification
 
         if show_age:
--- a/kallithea/model/permission.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/model/permission.py	Fri Aug 25 14:32:50 2017 +0200
@@ -116,13 +116,13 @@
                 .all()
             for p in u2p:
                 Session().delete(p)
-            #create fresh set of permissions
+            # create fresh set of permissions
             for def_perm_key in ['default_repo_perm',
                                  'default_group_perm',
                                  'default_user_group_perm',
                                  'default_repo_create',
                                  'create_on_write', # special case for create repos on write access to group
-                                 #'default_repo_group_create', #not implemented yet
+                                 #'default_repo_group_create', # not implemented yet
                                  'default_user_group_create',
                                  'default_fork',
                                  'default_register',
@@ -130,7 +130,7 @@
                 p = _make_new(perm_user, form_result[def_perm_key])
                 Session().add(p)
 
-            #stage 3 update all default permissions for repos if checked
+            # stage 3 update all default permissions for repos if checked
             if form_result['overwrite_default_repo']:
                 _def_name = form_result['default_repo_perm'].split('repository.')[-1]
                 _def = Permission.get_by_key('repository.' + _def_name)
@@ -139,7 +139,7 @@
                                .filter(UserRepoToPerm.user == perm_user) \
                                .all():
 
-                    #don't reset PRIVATE repositories
+                    # don't reset PRIVATE repositories
                     if not r2p.repository.private:
                         r2p.permission = _def
 
--- a/kallithea/model/pull_request.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/model/pull_request.py	Fri Aug 25 14:32:50 2017 +0200
@@ -61,12 +61,12 @@
             mention_recipients = set(mention_recipients) - reviewers
             _assert_valid_reviewers(mention_recipients)
 
-        #members
+        # members
         for reviewer in reviewers:
             prr = PullRequestReviewer(reviewer, pr)
             Session().add(prr)
 
-        #notification to reviewers
+        # notification to reviewers
         pr_url = pr.url(canonical=True)
         threading = ['%s-pr-%s@%s' % (pr.other_repo.repo_name,
                                       pr.pull_request_id,
@@ -265,7 +265,7 @@
             # create a ref under refs/pull/ so that commits don't get garbage-collected
             self.org_repo.scm_instance._repo["refs/pull/%d/head" % pr.pull_request_id] = safe_str(self.org_rev)
 
-        #reset state to under-review
+        # reset state to under-review
         from kallithea.model.changeset_status import ChangesetStatusModel
         from kallithea.model.comment import ChangesetCommentsModel
         comment = ChangesetCommentsModel().create(
--- a/kallithea/model/repo.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/model/repo.py	Fri Aug 25 14:32:50 2017 +0200
@@ -317,13 +317,13 @@
             if 'repo_name' in kwargs:
                 cur_repo.repo_name = cur_repo.get_new_name(kwargs['repo_name'])
 
-            #if private flag is set, reset default permission to NONE
+            # if private flag is set, reset default permission to NONE
             if kwargs.get('repo_private'):
                 EMPTY_PERM = 'repository.none'
                 RepoModel().grant_user_permission(
                     repo=cur_repo, user='default', perm=EMPTY_PERM
                 )
-                #handle extra fields
+                # handle extra fields
             for field in filter(lambda k: k.startswith(RepositoryField.PREFIX),
                                 kwargs):
                 k = RepositoryField.un_prefix_key(field)
@@ -460,7 +460,7 @@
                     repo=repo, user=member, perm=perm
                 )
             else:
-                #check if we have permissions to alter this usergroup's access
+                # check if we have permissions to alter this usergroup's access
                 if not check_perms or HasUserGroupPermissionLevel('read')(member):
                     self.grant_user_group_permission(
                         repo=repo, group_name=member, perm=perm
@@ -472,7 +472,7 @@
                     repo=repo, user=member, perm=perm
                 )
             else:
-                #check if we have permissions to alter this usergroup's access
+                # check if we have permissions to alter this usergroup's access
                 if not check_perms or HasUserGroupPermissionLevel('read')(member):
                     self.grant_user_group_permission(
                         repo=repo, group_name=member, perm=perm
--- a/kallithea/model/repo_group.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/model/repo_group.py	Fri Aug 25 14:32:50 2017 +0200
@@ -125,7 +125,7 @@
             if force_delete:
                 shutil.rmtree(rm_path)
             else:
-                #archive that group`
+                # archive that group
                 _now = datetime.datetime.now()
                 _ms = str(_now.microsecond).rjust(6, '0')
                 _d = 'rm__%s_GROUP_%s' % (_now.strftime('%Y%m%d_%H%M%S_' + _ms),
@@ -254,7 +254,7 @@
                     _set_perm_user(obj, user=member, perm=perm)
                 ## set for user group
                 else:
-                    #check if we have permissions to alter this usergroup's access
+                    # check if we have permissions to alter this usergroup's access
                     if not check_perms or HasUserGroupPermissionLevel('read')(member):
                         _set_perm_group(obj, users_group=member, perm=perm)
             # set new permissions
@@ -262,7 +262,7 @@
                 if member_type == 'user':
                     _set_perm_user(obj, user=member, perm=perm)
                 else:
-                    #check if we have permissions to alter this usergroup's access
+                    # check if we have permissions to alter this usergroup's access
                     if not check_perms or HasUserGroupPermissionLevel('read')(member):
                         _set_perm_group(obj, users_group=member, perm=perm)
             updates.append(obj)
@@ -301,7 +301,7 @@
             # if obj is a Repo fix it's name
             # this can be potentially heavy operation
             for obj in repo_group.recursive_groups_and_repos():
-                #set the value from it's parent
+                # set the value from it's parent
                 obj.enable_locking = repo_group.enable_locking
                 if isinstance(obj, RepoGroup):
                     new_name = obj.get_new_name(obj.name)
--- a/kallithea/model/scm.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/model/scm.py	Fri Aug 25 14:32:50 2017 +0200
@@ -600,7 +600,7 @@
                 imc.remove(filenode)
             elif op == 'mod':
                 if filename != old_filename:
-                    #TODO: handle renames, needs vcs lib changes
+                    # TODO: handle renames, needs vcs lib changes
                     imc.remove(filenode)
                     imc.add(FileNode(filename, content=content))
                 else:
@@ -776,6 +776,7 @@
             else:
                 log.debug('skipping writing hook file')
 
+
 def AvailableRepoGroupChoices(top_perms, repo_group_perm_level, extras=()):
     """Return group_id,string tuples with choices for all the repo groups where
     the user has the necessary permissions.
--- a/kallithea/model/user_group.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/model/user_group.py	Fri Aug 25 14:32:50 2017 +0200
@@ -71,7 +71,7 @@
                     user_group=user_group, user=member, perm=perm
                 )
             else:
-                #check if we have permissions to alter this usergroup's access
+                # check if we have permissions to alter this usergroup's access
                 if HasUserGroupPermissionLevel('read')(member):
                     self.grant_user_group_permission(
                         target_user_group=user_group, user_group=member, perm=perm
@@ -83,7 +83,7 @@
                     user_group=user_group, user=member, perm=perm
                 )
             else:
-                #check if we have permissions to alter this usergroup's access
+                # check if we have permissions to alter this usergroup's access
                 if HasUserGroupPermissionLevel('read')(member):
                     self.grant_user_group_permission(
                         target_user_group=user_group, user_group=member, perm=perm
--- a/kallithea/model/validators.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/model/validators.py	Fri Aug 25 14:32:50 2017 +0200
@@ -68,6 +68,7 @@
 
 def ValidUsername(edit=False, old_data=None):
     old_data = old_data or {}
+
     class _validator(formencode.validators.FancyValidator):
         messages = {
             'username_exists': _('Username "%(username)s" already exists'),
@@ -83,7 +84,7 @@
             if value in ['default', 'new_user']:
                 msg = self.message('system_invalid_username', state, username=value)
                 raise formencode.Invalid(msg, value, state)
-            #check if user is unique
+            # check if user is unique
             old_un = None
             if edit:
                 old_un = User.get(old_data.get('user_id')).username
@@ -126,6 +127,7 @@
 
 def ValidUserGroup(edit=False, old_data=None):
     old_data = old_data or {}
+
     class _validator(formencode.validators.FancyValidator):
         messages = {
             'invalid_group': _('Invalid user group name'),
@@ -142,7 +144,7 @@
                 raise formencode.Invalid(msg, value, state,
                     error_dict=dict(users_group_name=msg)
                 )
-            #check if group is unique
+            # check if group is unique
             old_ugname = None
             if edit:
                 old_id = old_data.get('users_group_id')
@@ -494,7 +496,7 @@
         }
 
         def _to_python(self, value, state):
-            #root location
+            # root location
             if value == -1:
                 return None
             return value
@@ -520,7 +522,7 @@
             # don't need to check permission if he didn't change the value of
             # groups in form box
             if value_changed or new:
-                #parent group need to be existing
+                # parent group need to be existing
                 if gr and forbidden:
                     msg = self.message('permission_denied', state)
                     raise formencode.Invalid(msg, value, state,
@@ -544,7 +546,7 @@
         }
 
         def to_python(self, value, state):
-            #root location
+            # root location
             if value == -1:
                 return None
             return value
@@ -554,7 +556,7 @@
             gr_name = gr.group_name if gr is not None else None # None means ROOT location
 
             if can_create_in_root and gr is None:
-                #we can create in root, we're fine no validations required
+                # we can create in root, we're fine no validations required
                 return
 
             forbidden_in_root = gr is None and not can_create_in_root
@@ -587,7 +589,7 @@
             perms_new = OrderedSet()
             # build a list of permission to update and new permission to create
 
-            #CLEAN OUT ORG VALUE FROM NEW MEMBERS, and group them using
+            # CLEAN OUT ORG VALUE FROM NEW MEMBERS, and group them using
             new_perms_group = defaultdict(dict)
             for k, v in value.copy().iteritems():
                 if k.startswith('perm_new_member'):
@@ -768,11 +770,11 @@
             v = v.strip()
             net = ipaddr.IPNetwork(address=v)
             if isinstance(net, ipaddr.IPv4Network):
-                #if IPv4 doesn't end with a mask, add /32
+                # if IPv4 doesn't end with a mask, add /32
                 if '/' not in value:
                     v += '/32'
             if isinstance(net, ipaddr.IPv6Network):
-                #if IPv6 doesn't end with a mask, add /128
+                # if IPv6 doesn't end with a mask, add /128
                 if '/' not in value:
                     v += '/128'
             return v
@@ -780,7 +782,7 @@
         def validate_python(self, value, state):
             try:
                 addr = value.strip()
-                #this raises an ValueError if address is not IPv4 or IPv6
+                # this raises an ValueError if address is not IPv4 or IPv6
                 ipaddr.IPNetwork(address=addr)
             except ValueError:
                 raise formencode.Invalid(self.message('badFormat', state),
--- a/kallithea/tests/api/api_base.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/api/api_base.py	Fri Aug 25 14:32:50 2017 +0200
@@ -2482,7 +2482,7 @@
     def test_api_get_changeset(self):
         review = fixture.review_changeset(self.REPO, self.TEST_REVISION, "approved")
         id_, params = _build_data(self.apikey, 'get_changeset',
-                                  repoid=self.REPO, raw_id = self.TEST_REVISION)
+                                  repoid=self.REPO, raw_id=self.TEST_REVISION)
         response = api_call(self, params)
         result = json.loads(response.body)["result"]
         assert result["raw_id"] == self.TEST_REVISION
@@ -2491,8 +2491,8 @@
     def test_api_get_changeset_with_reviews(self):
         reviewobjs = fixture.review_changeset(self.REPO, self.TEST_REVISION, "approved")
         id_, params = _build_data(self.apikey, 'get_changeset',
-                                  repoid=self.REPO, raw_id = self.TEST_REVISION,
-                                  with_reviews = True)
+                                  repoid=self.REPO, raw_id=self.TEST_REVISION,
+                                  with_reviews=True)
         response = api_call(self, params)
         result = json.loads(response.body)["result"]
         assert result["raw_id"] == self.TEST_REVISION
@@ -2522,7 +2522,7 @@
         RepoModel().revoke_user_permission(repo=self.REPO, user=self.TEST_USER_LOGIN)
         RepoModel().revoke_user_permission(repo=self.REPO, user="default")
         id_, params = _build_data(self.apikey_regular, 'get_changeset',
-                                  repoid=self.REPO, raw_id = self.TEST_REVISION)
+                                  repoid=self.REPO, raw_id=self.TEST_REVISION)
         response = api_call(self, params)
         expected = u'Access denied to repo %s' % self.REPO
         self._compare_error(id_, expected, given=response.body)
--- a/kallithea/tests/base.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/base.py	Fri Aug 25 14:32:50 2017 +0200
@@ -54,7 +54,7 @@
 # Invoke websetup with the current config file
 # SetupCommand('setup-app').run([config_file])
 
-#SOME GLOBALS FOR TESTS
+## SOME GLOBALS FOR TESTS
 
 TESTS_TMP_PATH = os.environ.get('KALLITHEA_TESTS_TMP_PATH', tempfile.mkdtemp(prefix='kallithea-test-'))
 os.environ['VCS_TEST_ROOT'] = TESTS_TMP_PATH
@@ -106,7 +106,7 @@
 GIT_REMOTE_REPO = os.path.join(TESTS_TMP_PATH, GIT_REPO)
 HG_REMOTE_REPO = os.path.join(TESTS_TMP_PATH, HG_REPO)
 
-#skip ldap tests if LDAP lib is not installed
+# skip ldap tests if LDAP lib is not installed
 ldap_lib_installed = False
 try:
     import ldap
@@ -123,6 +123,7 @@
 except ImportError:
     pam_lib_installed = False
 
+
 def invalidate_all_caches():
     """Invalidate all beaker caches currently configured.
     Useful when manipulating IP permissions in a test and changes need to take
@@ -133,10 +134,12 @@
     for cache in cache_managers.values():
         cache.clear()
 
+
 class NullHandler(logging.Handler):
     def emit(self, record):
         pass
 
+
 class TestController(object):
     """Pytest-style test controller"""
 
--- a/kallithea/tests/conftest.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/conftest.py	Fri Aug 25 14:32:50 2017 +0200
@@ -23,6 +23,7 @@
 
 from tg.util.webtest import test_context
 
+
 def pytest_configure():
     os.environ['TZ'] = 'UTC'
     if not kallithea.is_windows:
@@ -70,10 +71,12 @@
     # set fixed language for form messages, regardless of environment settings
     formencode.api.set_stdtranslation(languages=[])
 
+
 @pytest.fixture
 def create_test_user():
     """Provide users that automatically disappear after test is over."""
     test_user_ids = []
+
     def _create_test_user(user_form):
         user = UserModel().create(user_form)
         test_user_ids.append(user.user_id)
@@ -115,6 +118,7 @@
         Setting.create_or_update(k, v, t)
     session.commit()
 
+
 @pytest.fixture
 def auto_clear_ip_permissions():
     """Fixture that provides nothing but clearing IP permissions upon test
@@ -135,6 +139,7 @@
     # IP permissions are cached, need to invalidate this cache explicitly
     invalidate_all_caches()
 
+
 @pytest.fixture
 def test_context_fixture(app_fixture):
     """
@@ -177,6 +182,7 @@
             auth += '@'
         return '%s://%s%s:%s/%s' % (proto, auth, host, port, repo_name)
 
+
 @pytest.yield_fixture(scope="session")
 def webserver():
     """Start web server while tests are running.
--- a/kallithea/tests/fixture.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/fixture.py	Fri Aug 25 14:32:50 2017 +0200
@@ -257,11 +257,11 @@
             'owner': TEST_USER_ADMIN_LOGIN,
             'gist_type': Gist.GIST_PUBLIC,
             'lifetime': -1,
-            'gist_mapping': {'filename1.txt':{'content':'hello world'},}
+            'gist_mapping': {'filename1.txt': {'content': 'hello world'}}
         }
         form_data.update(kwargs)
         gist = GistModel().create(
-            description=form_data['description'],owner=form_data['owner'],
+            description=form_data['description'], owner=form_data['owner'],
             gist_mapping=form_data['gist_mapping'], gist_type=form_data['gist_type'],
             lifetime=form_data['lifetime']
         )
@@ -376,7 +376,7 @@
     idx_path = config['index_dir']
     data_path = config['cache_dir']
 
-    #clean index and data
+    # clean index and data
     if idx_path and os.path.exists(idx_path):
         log.debug('remove %s', idx_path)
         shutil.rmtree(idx_path)
@@ -385,7 +385,7 @@
         log.debug('remove %s', data_path)
         shutil.rmtree(data_path)
 
-    #CREATE DEFAULT TEST REPOS
+    # CREATE DEFAULT TEST REPOS
     tar = tarfile.open(os.path.join(FIXTURES, 'vcs_test_hg.tar.gz'))
     tar.extractall(os.path.join(TESTS_TMP_PATH, HG_REPO))
     tar.close()
@@ -394,7 +394,7 @@
     tar.extractall(os.path.join(TESTS_TMP_PATH, GIT_REPO))
     tar.close()
 
-    #LOAD VCS test stuff
+    # LOAD VCS test stuff
     from kallithea.tests.vcs import setup_package
     setup_package()
 
--- a/kallithea/tests/functional/test_admin_auth_settings.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/functional/test_admin_auth_settings.py	Fri Aug 25 14:32:50 2017 +0200
@@ -164,7 +164,6 @@
         assert response.form['firstname'].value == 'John'
         assert response.form['lastname'].value == 'Doe'
 
-
     def test_container_auth_login_fallback_header(self):
         self._container_auth_setup(
             auth_container_header='THE_USER_NAME',
--- a/kallithea/tests/functional/test_admin_gists.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/functional/test_admin_gists.py	Fri Aug 25 14:32:50 2017 +0200
@@ -50,7 +50,7 @@
         response = self.app.get(url('gists', private=1))
         # Test response...
 
-        #and privates
+        # and privates
         response.mustcontain('gist: %s' % gist.gist_access_id)
 
     def test_create_missing_description(self):
--- a/kallithea/tests/functional/test_admin_notifications.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/functional/test_admin_notifications.py	Fri Aug 25 14:32:50 2017 +0200
@@ -8,6 +8,7 @@
 
 from tg.util.webtest import test_context
 
+
 class TestNotificationsController(TestController):
     def setup_method(self, method):
         self.remove_all_notifications()
--- a/kallithea/tests/functional/test_admin_permissions.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/functional/test_admin_permissions.py	Fri Aug 25 14:32:50 2017 +0200
@@ -74,7 +74,6 @@
         response.mustcontain(no=['127.0.0.0/24'])
         response.mustcontain(no=['127.0.0.0 - 127.0.0.255'])
 
-
     def test_index_overview(self):
         self.log_user()
         response = self.app.get(url('admin_permissions_perms'))
--- a/kallithea/tests/functional/test_admin_repo_groups.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/functional/test_admin_repo_groups.py	Fri Aug 25 14:32:50 2017 +0200
@@ -7,6 +7,7 @@
 
 fixture = Fixture()
 
+
 class TestRepoGroupsController(TestController):
 
     def test_case_insensitivity(self):
--- a/kallithea/tests/functional/test_admin_repos.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/functional/test_admin_repos.py	Fri Aug 25 14:32:50 2017 +0200
@@ -305,7 +305,7 @@
             Session().commit()
             pytest.fail('no repo %s in filesystem' % repo_name)
 
-        #check if inherited permissiona are applied
+        # check if inherited permissiona are applied
         inherited_perms = UserRepoToPerm.query() \
             .filter(UserRepoToPerm.repository_id == new_repo_id).all()
         assert len(inherited_perms) == 2
@@ -332,7 +332,6 @@
                                                 _authentication_token=self.authentication_token()))
         response.mustcontain('Invalid repository URL')
 
-
     def test_create_remote_repo_wrong_clone_uri_hg_svn(self):
         self.log_user()
         repo_name = self.NEW_REPO
@@ -346,7 +345,6 @@
                                                 _authentication_token=self.authentication_token()))
         response.mustcontain('Invalid repository URL')
 
-
     def test_delete(self):
         self.log_user()
         repo_name = u'vcs_test_new_to_delete_%s' % self.REPO_TYPE
@@ -387,7 +385,7 @@
 
         response.follow()
 
-        #check if repo was deleted from db
+        # check if repo was deleted from db
         deleted_repo = Session().query(Repository) \
             .filter(Repository.repo_name == repo_name).scalar()
 
@@ -437,7 +435,7 @@
         self.checkSessionFlash(response, 'Deleted repository %s' % (repo_name_unicode))
         response.follow()
 
-        #check if repo was deleted from db
+        # check if repo was deleted from db
         deleted_repo = Session().query(Repository) \
             .filter(Repository.repo_name == repo_name_unicode).scalar()
 
@@ -446,7 +444,7 @@
         assert os.path.isdir(os.path.join(Ui.get_by_key('paths', '/').ui_value, repo_name_unicode)) == False
 
     def test_delete_repo_with_group(self):
-        #TODO:
+        # TODO:
         pass
 
     def test_delete_browser_fakeout(self):
@@ -462,7 +460,7 @@
 
     def test_set_private_flag_sets_default_to_none(self):
         self.log_user()
-        #initially repository perm should be read
+        # initially repository perm should be read
         perm = _get_permission_for_user(user='default', repo=self.REPO)
         assert len(perm), 1
         assert perm[0].permission.permission_name == 'repository.read'
@@ -478,7 +476,7 @@
                                msg='Repository %s updated successfully' % (self.REPO))
         assert Repository.get_by_repo_name(self.REPO).private == True
 
-        #now the repo default permission should be None
+        # now the repo default permission should be None
         perm = _get_permission_for_user(user='default', repo=self.REPO)
         assert len(perm), 1
         assert perm[0].permission.permission_name == 'repository.none'
@@ -493,12 +491,12 @@
                                msg='Repository %s updated successfully' % (self.REPO))
         assert Repository.get_by_repo_name(self.REPO).private == False
 
-        #we turn off private now the repo default permission should stay None
+        # we turn off private now the repo default permission should stay None
         perm = _get_permission_for_user(user='default', repo=self.REPO)
         assert len(perm), 1
         assert perm[0].permission.permission_name == 'repository.none'
 
-        #update this permission back
+        # update this permission back
         perm[0].permission = Permission.get_by_key('repository.read')
         Session().commit()
 
--- a/kallithea/tests/functional/test_admin_user_groups.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/functional/test_admin_user_groups.py	Fri Aug 25 14:32:50 2017 +0200
@@ -42,7 +42,7 @@
         self.log_user()
         users_group_name = TEST_USER_GROUP + 'another'
         response = self.app.post(url('users_groups'),
-                                 {'users_group_name':users_group_name,
+                                 {'users_group_name': users_group_name,
                                   'user_group_description': u'DESC',
                                   'active': True,
                                   '_authentication_token': self.authentication_token()})
--- a/kallithea/tests/functional/test_admin_users.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/functional/test_admin_users.py	Fri Aug 25 14:32:50 2017 +0200
@@ -30,6 +30,7 @@
 
 fixture = Fixture()
 
+
 @pytest.fixture
 def user_and_repo_group_fail():
     username = 'repogrouperr'
@@ -44,6 +45,7 @@
         # delete already succeeded in test body
         pass
 
+
 class TestAdminUsersController(TestController):
     test_user_1 = 'testme'
 
@@ -159,14 +161,13 @@
         if name == 'email':
             params['emails'] = [attrs['email']]
         if name == 'extern_type':
-            #cannot update this via form, expected value is original one
+            # cannot update this via form, expected value is original one
             params['extern_type'] = "internal"
         if name == 'extern_name':
-            #cannot update this via form, expected value is original one
+            # cannot update this via form, expected value is original one
             params['extern_name'] = self.test_user_1
-            # special case since this user is not
-                                          # logged in yet his data is not filled
-                                          # so we use creation data
+            # special case since this user is not logged in yet his data is
+            # not filled so we use creation data
 
         params.update({'_authentication_token': self.authentication_token()})
         response = self.app.post(url('update_user', id=usr.user_id), params)
@@ -288,7 +289,7 @@
         uid = user.user_id
 
         try:
-            #User should have None permission on creation repository
+            # User should have None permission on creation repository
             assert UserModel().has_perm(user, perm_none) == False
             assert UserModel().has_perm(user, perm_create) == False
 
@@ -299,7 +300,7 @@
             perm_none = Permission.get_by_key('hg.create.none')
             perm_create = Permission.get_by_key('hg.create.repository')
 
-            #User should have None permission on creation repository
+            # User should have None permission on creation repository
             assert UserModel().has_perm(uid, perm_none) == False
             assert UserModel().has_perm(uid, perm_create) == True
         finally:
@@ -318,7 +319,7 @@
         uid = user.user_id
 
         try:
-            #User should have None permission on creation repository
+            # User should have None permission on creation repository
             assert UserModel().has_perm(user, perm_none) == False
             assert UserModel().has_perm(user, perm_create) == False
 
@@ -328,7 +329,7 @@
             perm_none = Permission.get_by_key('hg.create.none')
             perm_create = Permission.get_by_key('hg.create.repository')
 
-            #User should have None permission on creation repository
+            # User should have None permission on creation repository
             assert UserModel().has_perm(uid, perm_none) == True
             assert UserModel().has_perm(uid, perm_create) == False
         finally:
@@ -347,7 +348,7 @@
         uid = user.user_id
 
         try:
-            #User should have None permission on creation repository
+            # User should have None permission on creation repository
             assert UserModel().has_perm(user, perm_none) == False
             assert UserModel().has_perm(user, perm_fork) == False
 
@@ -358,7 +359,7 @@
             perm_none = Permission.get_by_key('hg.create.none')
             perm_create = Permission.get_by_key('hg.create.repository')
 
-            #User should have None permission on creation repository
+            # User should have None permission on creation repository
             assert UserModel().has_perm(uid, perm_none) == False
             assert UserModel().has_perm(uid, perm_create) == True
         finally:
@@ -377,7 +378,7 @@
         uid = user.user_id
 
         try:
-            #User should have None permission on creation repository
+            # User should have None permission on creation repository
             assert UserModel().has_perm(user, perm_none) == False
             assert UserModel().has_perm(user, perm_fork) == False
 
@@ -387,7 +388,7 @@
             perm_none = Permission.get_by_key('hg.create.none')
             perm_create = Permission.get_by_key('hg.create.repository')
 
-            #User should have None permission on creation repository
+            # User should have None permission on creation repository
             assert UserModel().has_perm(uid, perm_none) == True
             assert UserModel().has_perm(uid, perm_create) == False
         finally:
@@ -491,7 +492,7 @@
         self.checkSessionFlash(response, 'API key successfully created')
         response = response.follow()
 
-        #now delete our key
+        # now delete our key
         keys = UserApiKeys.query().filter(UserApiKeys.user_id == user_id).all()
         assert 1 == len(keys)
 
--- a/kallithea/tests/functional/test_changelog.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/functional/test_changelog.py	Fri Aug 25 14:32:50 2017 +0200
@@ -15,7 +15,7 @@
             """name="7b22a518347bb9bc19679f6af07cd0a61bfe16e7" """
             """type="checkbox" value="1" />"""
         )
-        #rev 640: code garden
+        # rev 640: code garden
         response.mustcontain(
             """<a class="changeset_hash" href="/%s/changeset/0a4e54a4460401d6dbbd6a3604b17cd2b3606b82">r640:0a4e54a44604</a>""" % HG_REPO
         )
@@ -25,7 +25,7 @@
 
     def test_index_pagination_hg(self):
         self.log_user()
-        #pagination
+        # pagination
         self.app.get(url(controller='changelog', action='index',
                                     repo_name=HG_REPO), {'page': 1})
         self.app.get(url(controller='changelog', action='index',
@@ -81,7 +81,7 @@
 
     def test_index_pagination_git(self):
         self.log_user()
-        #pagination
+        # pagination
         self.app.get(url(controller='changelog', action='index',
                                     repo_name=GIT_REPO), {'page': 1})
         self.app.get(url(controller='changelog', action='index',
@@ -112,7 +112,7 @@
         response = self.app.get(url(controller='changelog', action='index',
                                     revision='tip', f_path='/vcs/exceptions.py',
                                     repo_name=HG_REPO))
-        #history commits messages
+        # history commits messages
         response.mustcontain('Added exceptions module, this time for real')
         response.mustcontain('Added not implemented hg backend test case')
         response.mustcontain('Added BaseChangeset class')
@@ -123,7 +123,7 @@
         response = self.app.get(url(controller='changelog', action='index',
                                     revision='tip', f_path='/vcs/exceptions.py',
                                     repo_name=GIT_REPO))
-        #history commits messages
+        # history commits messages
         response.mustcontain('Added exceptions module, this time for real')
         response.mustcontain('Added not implemented hg backend test case')
         response.mustcontain('Added BaseChangeset class')
--- a/kallithea/tests/functional/test_changeset_comments.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/functional/test_changeset_comments.py	Fri Aug 25 14:32:50 2017 +0200
@@ -62,7 +62,7 @@
 
         response = self.app.get(url(controller='changeset', action='index',
                                 repo_name=HG_REPO, revision=rev))
-        #test DB
+        # test DB
         assert ChangesetComment.query().count() == 1
         response.mustcontain(
             '''<div class="comments-number">'''
--- a/kallithea/tests/functional/test_compare.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/functional/test_compare.py	Fri Aug 25 14:32:50 2017 +0200
@@ -6,6 +6,7 @@
 
 fixture = Fixture()
 
+
 def _commit_ref(repo_name, sha, msg):
     return '''<div class="message-firstline"><a class="message-link" href="/%s/changeset/%s">%s</a></div>''' % (repo_name, sha, msg)
 
@@ -30,16 +31,16 @@
                                     repo_description='diff-test',
                                     cur_user=TEST_USER_ADMIN_LOGIN)
         self.r1_id = repo1.repo_id
-        #commit something !
+        # commit something !
         cs0 = fixture.commit_change(repo1.repo_name, filename='file1',
                 content='line1\n', message='commit1', vcs_type='hg',
                 parent=None, newfile=True)
 
-        #fork this repo
+        # fork this repo
         repo2 = fixture.create_fork(u'one', u'one-fork')
         self.r2_id = repo2.repo_id
 
-        #add two extra commit into fork
+        # add two extra commit into fork
         cs1 = fixture.commit_change(repo2.repo_name, filename='file1',
                 content='line1\nline2\n', message='commit2', vcs_type='hg',
                 parent=cs0)
@@ -72,7 +73,7 @@
         response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
         ## files
         response.mustcontain("""<a href="#C--826e8142e6ba">file1</a>""")
-        #swap
+        # swap
         response.mustcontain("""<a class="btn btn-default btn-sm" href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=True"><i class="icon-arrows-cw"></i> Swap</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
 
     def test_compare_forks_on_branch_extra_commits_git(self):
@@ -81,16 +82,16 @@
                                     repo_description='diff-test',
                                     cur_user=TEST_USER_ADMIN_LOGIN)
         self.r1_id = repo1.repo_id
-        #commit something !
+        # commit something !
         cs0 = fixture.commit_change(repo1.repo_name, filename='file1',
                 content='line1\n', message='commit1', vcs_type='git',
                 parent=None, newfile=True)
 
-        #fork this repo
+        # fork this repo
         repo2 = fixture.create_fork(u'one-git', u'one-git-fork')
         self.r2_id = repo2.repo_id
 
-        #add two extra commit into fork
+        # add two extra commit into fork
         cs1 = fixture.commit_change(repo2.repo_name, filename='file1',
                 content='line1\nline2\n', message='commit2', vcs_type='git',
                 parent=cs0)
@@ -123,7 +124,7 @@
         response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
         ## files
         response.mustcontain("""<a href="#C--826e8142e6ba">file1</a>""")
-        #swap
+        # swap
         response.mustcontain("""<a class="btn btn-default btn-sm" href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=True"><i class="icon-arrows-cw"></i> Swap</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
 
     def test_compare_forks_on_branch_extra_commits_origin_has_incoming_hg(self):
@@ -135,21 +136,21 @@
 
         self.r1_id = repo1.repo_id
 
-        #commit something !
+        # commit something !
         cs0 = fixture.commit_change(repo1.repo_name, filename='file1',
                 content='line1\n', message='commit1', vcs_type='hg',
                 parent=None, newfile=True)
 
-        #fork this repo
+        # fork this repo
         repo2 = fixture.create_fork(u'one', u'one-fork')
         self.r2_id = repo2.repo_id
 
-        #now commit something to origin repo
+        # now commit something to origin repo
         cs1_prim = fixture.commit_change(repo1.repo_name, filename='file2',
                 content='line1file2\n', message='commit2', vcs_type='hg',
                 parent=cs0, newfile=True)
 
-        #add two extra commit into fork
+        # add two extra commit into fork
         cs1 = fixture.commit_change(repo2.repo_name, filename='file1',
                 content='line1\nline2\n', message='commit2', vcs_type='hg',
                 parent=cs0)
@@ -182,7 +183,7 @@
         response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
         ## files
         response.mustcontain("""<a href="#C--826e8142e6ba">file1</a>""")
-        #swap
+        # swap
         response.mustcontain("""<a class="btn btn-default btn-sm" href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=True"><i class="icon-arrows-cw"></i> Swap</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
 
     def test_compare_forks_on_branch_extra_commits_origin_has_incoming_git(self):
@@ -194,21 +195,21 @@
 
         self.r1_id = repo1.repo_id
 
-        #commit something !
+        # commit something !
         cs0 = fixture.commit_change(repo1.repo_name, filename='file1',
                 content='line1\n', message='commit1', vcs_type='git',
                 parent=None, newfile=True)
 
-        #fork this repo
+        # fork this repo
         repo2 = fixture.create_fork(u'one-git', u'one-git-fork')
         self.r2_id = repo2.repo_id
 
-        #now commit something to origin repo
+        # now commit something to origin repo
         cs1_prim = fixture.commit_change(repo1.repo_name, filename='file2',
                 content='line1file2\n', message='commit2', vcs_type='git',
                 parent=cs0, newfile=True)
 
-        #add two extra commit into fork
+        # add two extra commit into fork
         cs1 = fixture.commit_change(repo2.repo_name, filename='file1',
                 content='line1\nline2\n', message='commit2', vcs_type='git',
                 parent=cs0)
@@ -241,11 +242,11 @@
         response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
         ## files
         response.mustcontain("""<a href="#C--826e8142e6ba">file1</a>""")
-        #swap
+        # swap
         response.mustcontain("""<a class="btn btn-default btn-sm" href="/%s/compare/branch@%s...branch@%s?other_repo=%s&amp;merge=True"><i class="icon-arrows-cw"></i> Swap</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
 
     def test_compare_cherry_pick_changesets_from_bottom(self):
-
+        pass
 #        repo1:
 #            cs0:
 #            cs1:
@@ -256,7 +257,7 @@
 #            cs3: x
 #            cs4: x
 #            cs5:
-        #make repo1, and cs1+cs2
+        # make repo1, and cs1+cs2
         self.log_user()
 
         repo1 = fixture.create_repo(u'repo1', repo_type='hg',
@@ -264,17 +265,17 @@
                                     cur_user=TEST_USER_ADMIN_LOGIN)
         self.r1_id = repo1.repo_id
 
-        #commit something !
+        # commit something !
         cs0 = fixture.commit_change(repo1.repo_name, filename='file1',
                 content='line1\n', message='commit1', vcs_type='hg',
                 parent=None, newfile=True)
         cs1 = fixture.commit_change(repo1.repo_name, filename='file1',
                 content='line1\nline2\n', message='commit2', vcs_type='hg',
                 parent=cs0)
-        #fork this repo
+        # fork this repo
         repo2 = fixture.create_fork(u'repo1', u'repo1-fork')
         self.r2_id = repo2.repo_id
-        #now make cs3-6
+        # now make cs3-6
         cs2 = fixture.commit_change(repo1.repo_name, filename='file1',
                 content='line1\nline2\nline3\n', message='commit3',
                 vcs_type='hg', parent=cs1)
@@ -313,6 +314,7 @@
         response.mustcontain("""#C--826e8142e6ba">file1</a>""")
 
     def test_compare_cherry_pick_changesets_from_top(self):
+        pass
 #        repo1:
 #            cs0:
 #            cs1:
@@ -324,24 +326,24 @@
 #            cs4: x
 #            cs5: x
 #
-        #make repo1, and cs1+cs2
+        # make repo1, and cs1+cs2
         self.log_user()
         repo1 = fixture.create_repo(u'repo1', repo_type='hg',
                                     repo_description='diff-test',
                                     cur_user=TEST_USER_ADMIN_LOGIN)
         self.r1_id = repo1.repo_id
 
-        #commit something !
+        # commit something !
         cs0 = fixture.commit_change(repo1.repo_name, filename='file1',
                 content='line1\n', message='commit1', vcs_type='hg',
                 parent=None, newfile=True)
         cs1 = fixture.commit_change(repo1.repo_name, filename='file1',
                 content='line1\nline2\n', message='commit2', vcs_type='hg',
                 parent=cs0)
-        #fork this repo
+        # fork this repo
         repo2 = fixture.create_fork(u'repo1', u'repo1-fork')
         self.r2_id = repo2.repo_id
-        #now make cs3-6
+        # now make cs3-6
         cs2 = fixture.commit_change(repo1.repo_name, filename='file1',
                 content='line1\nline2\nline3\n', message='commit3',
                 vcs_type='hg', parent=cs1)
@@ -379,7 +381,7 @@
         response.mustcontain("""#C--826e8142e6ba">file1</a>""")
 
     def test_compare_cherry_pick_changeset_mixed_branches(self):
-        #TODO: write this
+        # TODO: write this
         assert 1
 
     def test_compare_remote_branches_hg(self):
@@ -456,7 +458,7 @@
                 content='line1', message='commit1', vcs_type='hg', newfile=True)
         Session().commit()
         assert repo1.scm_instance.revisions == [cs0.raw_id]
-        #fork the repo1
+        # fork the repo1
         repo2 = fixture.create_repo(u'one-fork', repo_type='hg',
                                     repo_description='diff-test',
                                     cur_user=TEST_USER_ADMIN_LOGIN,
@@ -478,7 +480,7 @@
         cs3 = fixture.commit_change(repo=r2_name, filename='file3-fork',
                 content='file3-line1-from-fork', message='commit3-fork',
                 vcs_type='hg', parent=cs2, newfile=True)
-        #compare !
+        # compare !
         rev1 = 'default'
         rev2 = 'default'
 
@@ -497,7 +499,7 @@
                 content='line1-added-after-fork', message='commit2-parent',
                 vcs_type='hg', parent=None, newfile=True)
 
-        #compare !
+        # compare !
         rev1 = 'default'
         rev2 = 'default'
         response = self.app.get(url('compare_url',
@@ -532,7 +534,7 @@
                 newfile=True)
         Session().commit()
         assert repo1.scm_instance.revisions == [cs0.raw_id]
-        #fork the repo1
+        # fork the repo1
         repo2 = fixture.create_repo(u'one-git-fork', repo_type='git',
                                     repo_description='diff-test',
                                     cur_user=TEST_USER_ADMIN_LOGIN,
@@ -555,7 +557,7 @@
         cs3 = fixture.commit_change(repo=r2_name, filename='file3-fork',
                 content='file3-line1-from-fork', message='commit3-fork',
                 vcs_type='git', parent=cs2, newfile=True)
-        #compare !
+        # compare !
         rev1 = 'master'
         rev2 = 'master'
 
@@ -574,7 +576,7 @@
                 content='line1-added-after-fork', message='commit2-parent',
                 vcs_type='git', parent=None, newfile=True)
 
-        #compare !
+        # compare !
         rev1 = 'master'
         rev2 = 'master'
         response = self.app.get(url('compare_url',
--- a/kallithea/tests/functional/test_compare_local.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/functional/test_compare_local.py	Fri Aug 25 14:32:50 2017 +0200
@@ -100,7 +100,7 @@
 
         response.mustcontain('11 files changed with 94 insertions and 64 deletions')
 
-        #files
+        # files
         response.mustcontain('''<a href="#C--1c5cf9e91c12">docs/api/utils/index.rst</a>''')
         response.mustcontain('''<a href="#C--e3305437df55">test_and_report.sh</a>''')
         response.mustcontain('''<a href="#C--c8e92ef85cd1">.hgignore</a>''')
--- a/kallithea/tests/functional/test_feed.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/functional/test_feed.py	Fri Aug 25 14:32:50 2017 +0200
@@ -7,8 +7,6 @@
         response = self.app.get(url(controller='feed', action='rss',
                                     repo_name=HG_REPO))
 
-
-
         assert response.content_type == "application/rss+xml"
         assert """<rss version="2.0">""" in response
 
--- a/kallithea/tests/functional/test_files.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/functional/test_files.py	Fri Aug 25 14:32:50 2017 +0200
@@ -58,7 +58,7 @@
                 f_path='/')
         )
 
-        #Test response...
+        # Test response...
 
         response.mustcontain('<a class="browser-dir ypjax-link" href="/%s/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/docs"><i class="icon-folder-open"></i><span>docs</span></a>' % HG_REPO)
         response.mustcontain('<a class="browser-dir ypjax-link" href="/%s/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/tests"><i class="icon-folder-open"></i><span>tests</span></a>' % HG_REPO)
--- a/kallithea/tests/functional/test_forks.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/functional/test_forks.py	Fri Aug 25 14:32:50 2017 +0200
@@ -14,6 +14,7 @@
 
 fixture = Fixture()
 
+
 class _BaseTestCase(TestController):
     """
     Write all tests here
@@ -34,7 +35,6 @@
         Session().delete(self.u1)
         Session().commit()
 
-
     def test_index(self):
         self.log_user()
         repo_name = self.REPO
@@ -114,12 +114,12 @@
 
         ## run the check page that triggers the flash message
         response = self.app.get(url('repo_check_home', repo_name=fork_name_full))
-        #test if we have a message that fork is ok
+        # test if we have a message that fork is ok
         self.checkSessionFlash(response,
                 'Forked repository %s as <a href="/%s">%s</a>'
                 % (repo_name, fork_name_full, fork_name_full))
 
-        #test if the fork was created in the database
+        # test if the fork was created in the database
         fork_repo = Session().query(Repository) \
             .filter(Repository.repo_name == fork_name_full).one()
 
@@ -208,12 +208,12 @@
 
         ## run the check page that triggers the flash message
         response = self.app.get(url('repo_check_home', repo_name=fork_name))
-        #test if we have a message that fork is ok
+        # test if we have a message that fork is ok
         self.checkSessionFlash(response,
                 'Forked repository %s as <a href="/%s">%s</a>'
                 % (repo_name, fork_name, fork_name))
 
-        #test if the fork was created in the database
+        # test if the fork was created in the database
         fork_repo = Session().query(Repository) \
             .filter(Repository.repo_name == fork_name).one()
 
--- a/kallithea/tests/functional/test_home.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/functional/test_home.py	Fri Aug 25 14:32:50 2017 +0200
@@ -14,7 +14,7 @@
     def test_index(self):
         self.log_user()
         response = self.app.get(url(controller='home', action='index'))
-        #if global permission is set
+        # if global permission is set
         response.mustcontain('Add Repository')
 
         response.mustcontain('<span class="repotag">git')
--- a/kallithea/tests/functional/test_login.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/functional/test_login.py	Fri Aug 25 14:32:50 2017 +0200
@@ -181,7 +181,7 @@
     ])
     def test_redirection_after_successful_login_preserves_get_args(self, args, args_encoded):
         response = self.app.post(url(controller='login', action='index',
-                                     came_from = url('/_admin/users', **args)),
+                                     came_from=url('/_admin/users', **args)),
                                  {'username': TEST_USER_ADMIN_LOGIN,
                                   'password': TEST_USER_ADMIN_PASS})
         assert response.status == '302 Found'
@@ -510,7 +510,7 @@
 
             new_api_key = ApiKeyModel().create(TEST_USER_ADMIN_LOGIN, u'test')
             Session().commit()
-            #patch the API key and make it expired
+            # patch the API key and make it expired
             new_api_key.expires = 0
             Session().commit()
             self._api_key_test(new_api_key.api_key, status=403)
--- a/kallithea/tests/functional/test_my_account.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/functional/test_my_account.py	Fri Aug 25 14:32:50 2017 +0200
@@ -134,16 +134,16 @@
         if name == 'email':
             params['emails'] = [attrs['email']]
         if name == 'extern_type':
-            #cannot update this via form, expected value is original one
+            # cannot update this via form, expected value is original one
             params['extern_type'] = "internal"
         if name == 'extern_name':
-            #cannot update this via form, expected value is original one
+            # cannot update this via form, expected value is original one
             params['extern_name'] = str(user_id)
         if name == 'active':
-            #my account cannot deactivate account
+            # my account cannot deactivate account
             params['active'] = True
         if name == 'admin':
-            #my account cannot make you an admin !
+            # my account cannot make you an admin !
             params['admin'] = False
 
         params.pop('_authentication_token')
@@ -224,7 +224,7 @@
         self.checkSessionFlash(response, 'API key successfully created')
         response = response.follow()
 
-        #now delete our key
+        # now delete our key
         keys = UserApiKeys.query().all()
         assert 1 == len(keys)
 
@@ -234,7 +234,6 @@
         keys = UserApiKeys.query().all()
         assert 0 == len(keys)
 
-
     def test_my_account_reset_main_api_key(self):
         usr = self.log_user(TEST_USER_REGULAR2_LOGIN, TEST_USER_REGULAR2_PASS)
         user = User.get(usr['user_id'])
--- a/kallithea/tests/functional/test_pullrequests.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/functional/test_pullrequests.py	Fri Aug 25 14:32:50 2017 +0200
@@ -12,6 +12,7 @@
 
 fixture = Fixture()
 
+
 class TestPullrequestsController(TestController):
 
     def test_index(self):
@@ -208,7 +209,6 @@
                                  status=400)
         response.mustcontain('Invalid reviewer &#34;%s&#34; specified' % invalid_user_id)
 
-
     def test_iteration_refs(self):
         # Repo graph excerpt:
         #   o   fb95b340e0d0 webvcs
--- a/kallithea/tests/functional/test_search_indexing.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/functional/test_search_indexing.py	Fri Aug 25 14:32:50 2017 +0200
@@ -10,6 +10,7 @@
 
 fixture = Fixture()
 
+
 def init_indexing_test(repo):
     prev = fixture.commit_change(repo.repo_name,
                                  filename='this_should_be_unique_filename.txt',
@@ -34,6 +35,7 @@
                                  parent=prev,
                                  newfile=True)
 
+
 repos = [
     # reponame,              init func or fork base, groupname
     (u'indexing_test',       init_indexing_test,     None),
@@ -44,10 +46,12 @@
     (u'stopword_test',       init_stopword_test,     None),
 ]
 
+
 # map: name => id
 repoids = {}
 groupids = {}
 
+
 def rebuild_index(full_index):
     with mock.patch('kallithea.lib.indexers.daemon.log.debug',
                     lambda *args, **kwargs: None):
--- a/kallithea/tests/functional/test_summary.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/functional/test_summary.py	Fri Aug 25 14:32:50 2017 +0200
@@ -31,11 +31,11 @@
                                     action='index',
                                     repo_name=HG_REPO))
 
-        #repo type
+        # repo type
         response.mustcontain(
             """<span class="repotag">hg"""
         )
-        #public/private
+        # public/private
         response.mustcontain(
             """<i class="icon-globe">"""
         )
@@ -57,11 +57,11 @@
                                     action='index',
                                     repo_name=GIT_REPO))
 
-        #repo type
+        # repo type
         response.mustcontain(
             """<span class="repotag">git"""
         )
-        #public/private
+        # public/private
         response.mustcontain(
             """<i class="icon-globe">"""
         )
@@ -82,11 +82,11 @@
                                     action='index',
                                     repo_name='_%s' % ID))
 
-        #repo type
+        # repo type
         response.mustcontain(
             """<span class="repotag">hg"""
         )
-        #public/private
+        # public/private
         response.mustcontain(
             """<i class="icon-globe">"""
         )
@@ -111,11 +111,11 @@
                                     action='index',
                                     repo_name='_%s' % ID))
 
-        #repo type
+        # repo type
         response.mustcontain(
             """<span class="repotag">git"""
         )
-        #public/private
+        # public/private
         response.mustcontain(
             """<i class="icon-globe">"""
         )
@@ -127,7 +127,7 @@
 
     def test_index_trending(self):
         self.log_user()
-        #codes stats
+        # codes stats
         self._enable_stats(HG_REPO)
 
         ScmModel().mark_for_invalidation(HG_REPO)
@@ -151,7 +151,7 @@
 
     def test_index_statistics(self):
         self.log_user()
-        #codes stats
+        # codes stats
         self._enable_stats(HG_REPO)
 
         ScmModel().mark_for_invalidation(HG_REPO)
@@ -160,7 +160,7 @@
 
     def test_index_trending_git(self):
         self.log_user()
-        #codes stats
+        # codes stats
         self._enable_stats(GIT_REPO)
 
         ScmModel().mark_for_invalidation(GIT_REPO)
@@ -184,7 +184,7 @@
 
     def test_index_statistics_git(self):
         self.log_user()
-        #codes stats
+        # codes stats
         self._enable_stats(GIT_REPO)
 
         ScmModel().mark_for_invalidation(GIT_REPO)
--- a/kallithea/tests/models/test_changeset_status.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/models/test_changeset_status.py	Fri Aug 25 14:32:50 2017 +0200
@@ -2,11 +2,13 @@
 from kallithea.model.changeset_status import ChangesetStatusModel
 from kallithea.model.db import ChangesetStatus as CS
 
+
 class CSM(object): # ChangesetStatusMock
 
     def __init__(self, status):
         self.status = status
 
+
 class TestChangesetStatusCalculation(TestController):
 
     def setup_method(self, method):
--- a/kallithea/tests/models/test_notifications.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/models/test_notifications.py	Fri Aug 25 14:32:50 2017 +0200
@@ -16,6 +16,7 @@
 
 from tg.util.webtest import test_context
 
+
 class TestNotifications(TestController):
 
     def setup_method(self, method):
@@ -48,6 +49,7 @@
     def test_create_notification(self):
         with test_context(self.app):
             usrs = [self.u1, self.u2]
+
             def send_email(recipients, subject, body='', html_body='', headers=None, author=None):
                 assert recipients == ['u2@example.com']
                 assert subject == 'Test Message'
@@ -137,7 +139,7 @@
             # notification object is still there
             assert Notification.query().all() == [notification]
 
-            #u1 and u2 still have assignments
+            # u1 and u2 still have assignments
             u1notification = UserNotification.query() \
                                 .filter(UserNotification.notification ==
                                         notification) \
--- a/kallithea/tests/models/test_permissions.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/models/test_permissions.py	Fri Aug 25 14:32:50 2017 +0200
@@ -19,7 +19,7 @@
 
     @classmethod
     def setup_class(cls):
-        #recreate default user to get a clean start
+        # recreate default user to get a clean start
         PermissionModel().create_default_permissions(user=User.DEFAULT_USER,
                                                      force=True)
         Session().commit()
@@ -218,7 +218,7 @@
         a1_auth = AuthUser(user_id=self.anon.user_id)
         assert a1_auth.permissions['repositories_groups'] == {u'group1': u'group.read', u'group2': u'group.read'}
 
-        #Change perms to none for both groups
+        # Change perms to none for both groups
         RepoGroupModel().grant_user_permission(repo_group=self.g1,
                                                user=self.anon,
                                                perm='group.none')
@@ -245,14 +245,14 @@
         a1_auth = AuthUser(user_id=self.anon.user_id)
         assert a1_auth.permissions['repositories_groups'] == {u'group1': u'group.none', u'group2': u'group.none'}
 
-        #grant permission for u2 !
+        # grant permission for u2 !
         RepoGroupModel().grant_user_permission(repo_group=self.g1, user=self.u2,
                                                perm='group.read')
         RepoGroupModel().grant_user_permission(repo_group=self.g2, user=self.u2,
                                                perm='group.read')
         Session().commit()
         assert self.u1 != self.u2
-        #u1 and anon should have not change perms while u2 should !
+        # u1 and anon should have not change perms while u2 should !
         u1_auth = AuthUser(user_id=self.u1.user_id)
         assert u1_auth.permissions['repositories_groups'] == {u'group1': u'group.none', u'group2': u'group.none'}
 
@@ -357,7 +357,7 @@
         user_model.revoke_perm(usr, 'hg.fork.none')
         user_model.grant_perm(usr, 'hg.fork.repository')
 
-        #disable global perms on specific user
+        # disable global perms on specific user
         user_model.revoke_perm(self.u1, 'hg.create.repository')
         user_model.grant_perm(self.u1, 'hg.create.none')
         user_model.revoke_perm(self.u1, 'hg.fork.repository')
@@ -384,7 +384,7 @@
         user_model.revoke_perm(usr, 'hg.fork.repository')
         user_model.grant_perm(usr, 'hg.fork.none')
 
-        #enable global perms on specific user
+        # enable global perms on specific user
         user_model.revoke_perm(self.u1, 'hg.create.none')
         user_model.grant_perm(self.u1, 'hg.create.repository')
         user_model.revoke_perm(self.u1, 'hg.fork.none')
@@ -609,15 +609,15 @@
         assert u1_auth.permissions['user_groups'][u'G2'] == u'usergroup.admin'
 
     def test_owner_permissions_doesnot_get_overwritten_by_group(self):
-        #create repo as USER,
+        # create repo as USER,
         self.test_repo = fixture.create_repo(name=u'myownrepo',
                                              repo_type='hg',
                                              cur_user=self.u1)
 
-        #he has permissions of admin as owner
+        # he has permissions of admin as owner
         u1_auth = AuthUser(user_id=self.u1.user_id)
         assert u1_auth.permissions['repositories']['myownrepo'] == 'repository.admin'
-        #set his permission as user group, he should still be admin
+        # set his permission as user group, he should still be admin
         self.ug1 = fixture.create_user_group(u'G1')
         UserGroupModel().add_user_to_group(self.ug1, self.u1)
         RepoModel().grant_user_group_permission(self.test_repo,
@@ -629,15 +629,15 @@
         assert u1_auth.permissions['repositories']['myownrepo'] == 'repository.admin'
 
     def test_owner_permissions_doesnot_get_overwritten_by_others(self):
-        #create repo as USER,
+        # create repo as USER,
         self.test_repo = fixture.create_repo(name=u'myownrepo',
                                              repo_type='hg',
                                              cur_user=self.u1)
 
-        #he has permissions of admin as owner
+        # he has permissions of admin as owner
         u1_auth = AuthUser(user_id=self.u1.user_id)
         assert u1_auth.permissions['repositories']['myownrepo'] == 'repository.admin'
-        #set his permission as user, he should still be admin
+        # set his permission as user, he should still be admin
         RepoModel().grant_user_permission(self.test_repo, user=self.u1,
                                           perm='repository.none')
         Session().commit()
@@ -657,7 +657,7 @@
     def test_set_default_permissions_after_one_is_missing(self):
         PermissionModel().create_default_permissions(user=self.u1)
         self._test_def_perm_equal(user=self.u1)
-        #now we delete one, it should be re-created after another call
+        # now we delete one, it should be re-created after another call
         perms = UserToPerm.query() \
                 .filter(UserToPerm.user == self.u1) \
                 .all()
@@ -666,7 +666,7 @@
 
         self._test_def_perm_equal(user=self.u1, change_factor=-1)
 
-        #create missing one !
+        # create missing one !
         PermissionModel().create_default_permissions(user=self.u1)
         self._test_def_perm_equal(user=self.u1)
 
@@ -687,7 +687,7 @@
         assert old != None
         assert new != None
 
-        #now modify permissions
+        # now modify permissions
         p = UserToPerm.query() \
                 .filter(UserToPerm.user == self.u1) \
                 .filter(UserToPerm.permission == old) \
--- a/kallithea/tests/models/test_repo_groups.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/models/test_repo_groups.py	Fri Aug 25 14:32:50 2017 +0200
@@ -161,7 +161,7 @@
 
         r = fixture.create_repo(u'L1/L2/L3/L3_REPO', repo_group=g3.group_id)
 
-        ##rename L1 all groups should be now changed
+        ## rename L1 all groups should be now changed
         _update_repo_group(g1.group_id, u'L1_NEW')
         Session().commit()
         assert g1.full_path == 'L1_NEW'
@@ -176,7 +176,7 @@
         g4 = fixture.create_repo_group(u'R1_NEW')
 
         r = fixture.create_repo(u'R1/R2/R3/R3_REPO', repo_group=g3.group_id)
-        ##rename L1 all groups should be now changed
+        ## rename L1 all groups should be now changed
         _update_repo_group(g1.group_id, u'R1', parent_id=g4.group_id)
         Session().commit()
         assert g1.full_path == 'R1_NEW/R1'
@@ -192,7 +192,7 @@
 
         r = fixture.create_repo(u'X1/X2/X3/X3_REPO', repo_group=g3.group_id)
 
-        ##rename L1 all groups should be now changed
+        ## rename L1 all groups should be now changed
         _update_repo_group(g1.group_id, u'X1_PRIM', parent_id=g4.group_id)
         Session().commit()
         assert g1.full_path == 'X1_NEW/X1_PRIM'
--- a/kallithea/tests/models/test_repos.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/models/test_repos.py	Fri Aug 25 14:32:50 2017 +0200
@@ -45,7 +45,7 @@
         fork = fixture.create_fork(repo.repo_name, u'test-repo-fork-1')
         Session().commit()
 
-        #fork of fork
+        # fork of fork
         fixture.create_fork(fork.repo_name, u'test-repo-fork-fork-1')
         Session().commit()
 
@@ -63,7 +63,7 @@
         fork = fixture.create_fork(repo.repo_name, u'test-repo-fork-1')
         Session().commit()
 
-        #fork of fork
+        # fork of fork
         fixture.create_fork(fork.repo_name, u'test-repo-fork-fork-1')
         Session().commit()
 
--- a/kallithea/tests/models/test_settings.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/models/test_settings.py	Fri Aug 25 14:32:50 2017 +0200
@@ -4,6 +4,7 @@
 
 name = 'spam-setting-name'
 
+
 def test_passing_list_setting_value_results_in_string_valued_setting():
     assert Setting.get_by_name(name) is None
     setting = Setting.create_or_update(name, ['spam', 'eggs'])
@@ -17,6 +18,7 @@
     finally:
         Session().delete(setting)
 
+
 def test_list_valued_setting_creation_requires_manual_value_formatting():
     assert Setting.get_by_name(name) is None
     # Quirk: need manual formatting of list setting value.
@@ -27,6 +29,7 @@
     finally:
         Session().delete(setting)
 
+
 def test_list_valued_setting_update():
     assert Setting.get_by_name(name) is None
     setting = Setting.create_or_update(name, 'spam', type='list')
--- a/kallithea/tests/models/test_user_permissions_on_repos.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/models/test_user_permissions_on_repos.py	Fri Aug 25 14:32:50 2017 +0200
@@ -1,1 +1,1 @@
-#TODO; write tests when we activate algo for permissions.
+# TODO; write tests when we activate algo for permissions.
--- a/kallithea/tests/models/test_users.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/models/test_users.py	Fri Aug 25 14:32:50 2017 +0200
@@ -4,7 +4,6 @@
 from kallithea.model.db import User, UserGroup, UserGroupMember, UserEmailMap, \
     Permission
 from kallithea.model.user import UserModel
-
 from kallithea.model.meta import Session
 from kallithea.model.user_group import UserGroupModel
 from kallithea.tests.fixture import Fixture
@@ -138,7 +137,7 @@
         Session().commit()
         assert UserModel().has_perm(self.u1, perm) == True
 
-        #revoke
+        # revoke
         UserModel().revoke_perm(self.u1, perm)
         Session().commit()
         assert UserModel().has_perm(self.u1, perm) == False
--- a/kallithea/tests/other/test_libs.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/other/test_libs.py	Fri Aug 25 14:32:50 2017 +0200
@@ -67,6 +67,7 @@
      '%s://example.com:8080' % proto),
 ]
 
+
 class FakeUrlGenerator(object):
 
     def __init__(self, current_url=None, default_route=None, **routes):
@@ -86,6 +87,7 @@
     def current(self, *args, **kwargs):
         return self.current_url % kwargs
 
+
 class TestLibs(TestController):
 
     @parametrize('test_url,expected,expected_creds', TEST_URLS)
--- a/kallithea/tests/other/test_mail.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/other/test_mail.py	Fri Aug 25 14:32:50 2017 +0200
@@ -4,6 +4,7 @@
 from kallithea.tests.base import *
 from kallithea.model.db import User
 
+
 class smtplib_mock(object):
 
     @classmethod
@@ -12,14 +13,17 @@
 
     def ehlo(self):
         pass
+
     def quit(self):
         pass
+
     def sendmail(self, sender, dest, msg):
         smtplib_mock.lastsender = sender
         smtplib_mock.lastdest = dest
         smtplib_mock.lastmsg = msg
         pass
 
+
 @mock.patch('kallithea.lib.rcmail.smtp_mailer.smtplib', smtplib_mock)
 class TestMail(TestController):
 
--- a/kallithea/tests/other/test_validators.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/other/test_validators.py	Fri Aug 25 14:32:50 2017 +0200
@@ -162,7 +162,7 @@
         with pytest.raises(formencode.Invalid):
             validator.to_python({'repo_name': gr.group_name})
 
-        #TODO: write an error case for that ie. create a repo withinh a group
+        # TODO: write an error case for that ie. create a repo withinh a group
 #        self.assertRaises(formencode.Invalid,
 #                          validator.to_python, {'repo_name': 'some',
 #                                                'repo_group': gr.group_id})
@@ -181,7 +181,7 @@
         assert expected == validator.to_python(name)
 
     def test_ValidCloneUri(self):
-            #TODO: write this one
+            # TODO: write this one
             pass
 
     def test_ValidForkType(self):
@@ -191,7 +191,7 @@
                 validator.to_python('git')
 
     def test_ValidPerms(self):
-            #TODO: write this one
+            # TODO: write this one
             pass
 
     def test_ValidSettings(self):
--- a/kallithea/tests/other/test_vcs_operations.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/other/test_vcs_operations.py	Fri Aug 25 14:32:50 2017 +0200
@@ -152,7 +152,7 @@
 
 
 def _check_proper_git_push(stdout, stderr):
-    #WTF Git stderr is output ?!
+    # WTF Git stderr is output ?!
     assert 'fatal' not in stderr
     assert 'rejected' not in stderr
     assert 'Pushing to' in stderr
@@ -164,7 +164,7 @@
 
     @classmethod
     def setup_class(cls):
-        #DISABLE ANONYMOUS ACCESS
+        # DISABLE ANONYMOUS ACCESS
         set_anonymous_access(False)
 
     def setup_method(self, method):
@@ -255,7 +255,7 @@
 
     def test_push_invalidates_cache_hg(self, webserver):
         key = CacheInvalidation.query().filter(CacheInvalidation.cache_key
-                                               ==HG_REPO).scalar()
+                                               == HG_REPO).scalar()
         if not key:
             key = CacheInvalidation(HG_REPO, HG_REPO)
             Session().add(key)
@@ -273,12 +273,12 @@
         stdout, stderr = _add_files_and_push(webserver, 'hg', DEST, files_no=1, clone_url=clone_url)
 
         key = CacheInvalidation.query().filter(CacheInvalidation.cache_key
-                                               ==fork_name).all()
+                                               == fork_name).all()
         assert key == []
 
     def test_push_invalidates_cache_git(self, webserver):
         key = CacheInvalidation.query().filter(CacheInvalidation.cache_key
-                                               ==GIT_REPO).scalar()
+                                               == GIT_REPO).scalar()
         if not key:
             key = CacheInvalidation(GIT_REPO, GIT_REPO)
             Session().add(key)
@@ -298,7 +298,7 @@
         _check_proper_git_push(stdout, stderr)
 
         key = CacheInvalidation.query().filter(CacheInvalidation.cache_key
-                                               ==fork_name).all()
+                                               == fork_name).all()
         assert key == []
 
     def test_push_wrong_credentials_hg(self, webserver):
@@ -352,7 +352,7 @@
         clone_url = webserver.repo_url(HG_REPO)
         stdout, stderr = Command(TESTS_TMP_PATH).execute('hg clone', clone_url, _get_tmp_dir())
 
-        #check if lock was made
+        # check if lock was made
         r = Repository.get_by_repo_name(HG_REPO)
         assert r.locked[0] == User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id
 
@@ -365,15 +365,15 @@
         clone_url = webserver.repo_url(GIT_REPO)
         stdout, stderr = Command(TESTS_TMP_PATH).execute('git clone', clone_url, _get_tmp_dir())
 
-        #check if lock was made
+        # check if lock was made
         r = Repository.get_by_repo_name(GIT_REPO)
         assert r.locked[0] == User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id
 
     def test_clone_after_repo_was_locked_hg(self, webserver):
-        #lock repo
+        # lock repo
         r = Repository.get_by_repo_name(HG_REPO)
         Repository.lock(r, User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id)
-        #pull fails since repo is locked
+        # pull fails since repo is locked
         clone_url = webserver.repo_url(HG_REPO)
         stdout, stderr = Command(TESTS_TMP_PATH).execute('hg clone', clone_url, _get_tmp_dir(), ignoreReturnCode=True)
         msg = ("""abort: HTTP Error 423: Repository `%s` locked by user `%s`"""
@@ -381,22 +381,22 @@
         assert msg in stderr
 
     def test_clone_after_repo_was_locked_git(self, webserver):
-        #lock repo
+        # lock repo
         r = Repository.get_by_repo_name(GIT_REPO)
         Repository.lock(r, User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id)
-        #pull fails since repo is locked
+        # pull fails since repo is locked
         clone_url = webserver.repo_url(GIT_REPO)
         stdout, stderr = Command(TESTS_TMP_PATH).execute('git clone', clone_url, _get_tmp_dir(), ignoreReturnCode=True)
         msg = ("""The requested URL returned error: 423""")
         assert msg in stderr
 
     def test_push_on_locked_repo_by_other_user_hg(self, webserver):
-        #clone some temp
+        # clone some temp
         DEST = _get_tmp_dir()
         clone_url = webserver.repo_url(HG_REPO)
         stdout, stderr = Command(TESTS_TMP_PATH).execute('hg clone', clone_url, DEST)
 
-        #lock repo
+        # lock repo
         r = Repository.get_by_repo_name(HG_REPO)
         # let this user actually push !
         RepoModel().grant_user_permission(repo=r, user=TEST_USER_REGULAR_LOGIN,
@@ -404,7 +404,7 @@
         Session().commit()
         Repository.lock(r, User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id)
 
-        #push fails repo is locked by other user !
+        # push fails repo is locked by other user !
         stdout, stderr = _add_files_and_push(webserver, 'hg', DEST,
                                              username=TEST_USER_REGULAR_LOGIN,
                                              password=TEST_USER_REGULAR_PASS,
@@ -417,12 +417,12 @@
         # Note: Git hooks must be executable on unix. This test will thus fail
         # for example on Linux if /tmp is mounted noexec.
 
-        #clone some temp
+        # clone some temp
         DEST = _get_tmp_dir()
         clone_url = webserver.repo_url(GIT_REPO)
         stdout, stderr = Command(TESTS_TMP_PATH).execute('git clone', clone_url, DEST)
 
-        #lock repo
+        # lock repo
         r = Repository.get_by_repo_name(GIT_REPO)
         # let this user actually push !
         RepoModel().grant_user_permission(repo=r, user=TEST_USER_REGULAR_LOGIN,
@@ -430,7 +430,7 @@
         Session().commit()
         Repository.lock(r, User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id)
 
-        #push fails repo is locked by other user !
+        # push fails repo is locked by other user !
         stdout, stderr = _add_files_and_push(webserver, 'git', DEST,
                                              username=TEST_USER_REGULAR_LOGIN,
                                              password=TEST_USER_REGULAR_PASS,
@@ -438,8 +438,8 @@
         err = 'Repository `%s` locked by user `%s`' % (GIT_REPO, TEST_USER_ADMIN_LOGIN)
         assert err in stderr
 
-        #TODO: fix this somehow later on Git, Git is stupid and even if we throw
-        #back 423 to it, it makes ANOTHER request and we fail there with 405 :/
+        # TODO: fix this somehow later on Git, Git is stupid and even if we throw
+        # back 423 to it, it makes ANOTHER request and we fail there with 405 :/
 
         msg = ("""abort: HTTP Error 423: Repository `%s` locked by user `%s`"""
                 % (GIT_REPO, TEST_USER_ADMIN_LOGIN))
@@ -453,25 +453,25 @@
         r = Repository.get_by_repo_name(fork_name)
         r.enable_locking = True
         Session().commit()
-        #clone some temp
+        # clone some temp
         DEST = _get_tmp_dir()
         clone_url = webserver.repo_url(fork_name)
         stdout, stderr = Command(TESTS_TMP_PATH).execute('hg clone', clone_url, DEST)
 
-        #check for lock repo after clone
+        # check for lock repo after clone
         r = Repository.get_by_repo_name(fork_name)
         uid = User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id
         assert r.locked[0] == uid
 
-        #push is ok and repo is now unlocked
+        # push is ok and repo is now unlocked
         stdout, stderr = _add_files_and_push(webserver, 'hg', DEST, clone_url=clone_url)
         assert str('remote: Released lock on repo `%s`' % fork_name) in stdout
-        #we need to cleanup the Session Here !
+        # we need to cleanup the Session Here !
         Session.remove()
         r = Repository.get_by_repo_name(fork_name)
         assert r.locked == [None, None]
 
-    #TODO: fix me ! somehow during tests hooks don't get called on Git
+    # TODO: fix me ! somehow during tests hooks don't get called on Git
     def test_push_unlocks_repository_git(self, webserver):
         # enable locking
         fork_name = '%s_fork%s' % (GIT_REPO, _RandomNameSequence().next())
@@ -479,21 +479,21 @@
         r = Repository.get_by_repo_name(fork_name)
         r.enable_locking = True
         Session().commit()
-        #clone some temp
+        # clone some temp
         DEST = _get_tmp_dir()
         clone_url = webserver.repo_url(fork_name)
         stdout, stderr = Command(TESTS_TMP_PATH).execute('git clone', clone_url, DEST)
 
-        #check for lock repo after clone
+        # check for lock repo after clone
         r = Repository.get_by_repo_name(fork_name)
         assert r.locked[0] == User.get_by_username(TEST_USER_ADMIN_LOGIN).user_id
 
-        #push is ok and repo is now unlocked
+        # push is ok and repo is now unlocked
         stdout, stderr = _add_files_and_push(webserver, 'git', DEST, clone_url=clone_url)
         _check_proper_git_push(stdout, stderr)
 
         assert ('remote: Released lock on repo `%s`' % fork_name) in stderr
-        #we need to cleanup the Session Here !
+        # we need to cleanup the Session Here !
         Session.remove()
         r = Repository.get_by_repo_name(fork_name)
         assert r.locked == [None, None]
@@ -507,7 +507,7 @@
             stdout, stderr = Command(TESTS_TMP_PATH).execute('hg clone', clone_url, _get_tmp_dir(), ignoreReturnCode=True)
             assert 'abort: HTTP Error 403: Forbidden' in stderr
         finally:
-            #release IP restrictions
+            # release IP restrictions
             for ip in UserIpMap.query():
                 UserIpMap.delete(ip.ip_id)
             Session().commit()
@@ -535,7 +535,7 @@
             # The message apparently changed in Git 1.8.3, so match it loosely.
             assert re.search(r'\b403\b', stderr)
         finally:
-            #release IP restrictions
+            # release IP restrictions
             for ip in UserIpMap.query():
                 UserIpMap.delete(ip.ip_id)
             Session().commit()
--- a/kallithea/tests/performance/test_vcs.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/performance/test_vcs.py	Fri Aug 25 14:32:50 2017 +0200
@@ -13,6 +13,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 import pytest
+
 from kallithea.model.db import Repository
 from kallithea.tests.base import *
 
--- a/kallithea/tests/scripts/manual_test_concurrency.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/scripts/manual_test_concurrency.py	Fri Aug 25 14:32:50 2017 +0200
@@ -132,8 +132,8 @@
 
         form_data = {'repo_name': HG_REPO,
                      'repo_type': 'hg',
-                     'private':False,
-                     'clone_uri': '' }
+                     'private': False,
+                     'clone_uri': ''}
         rm = RepoModel()
         rm.base_path = '/home/hg'
         rm.create(form_data, user)
@@ -182,10 +182,11 @@
         if not no_errors:
             if backend == 'hg':
                 assert """adding file changes""" in stdout, 'no messages about cloning'
-                assert """abort""" not in stderr , 'got error from clone'
+                assert """abort""" not in stderr, 'got error from clone'
             elif backend == 'git':
                 assert """Cloning into""" in stdout, 'no messages about cloning'
 
+
 if __name__ == '__main__':
     try:
         create_test_user(force=False)
--- a/kallithea/tests/scripts/manual_test_crawler.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/scripts/manual_test_crawler.py	Fri Aug 25 14:32:50 2017 +0200
@@ -63,7 +63,7 @@
 BASE_URI += '%s'
 PROJECT_PATH = os.path.join('/', 'home', 'username', 'repos')
 PROJECTS = [
-    #'linux-magx-pbranch',
+    # 'linux-magx-pbranch',
     'CPython',
     'kallithea',
 ]
--- a/kallithea/tests/vcs/__init__.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/vcs/__init__.py	Fri Aug 25 14:32:50 2017 +0200
@@ -61,5 +61,6 @@
     collector()
     unittest.main()
 
+
 #if __name__ == '__main__':
 #    main()
--- a/kallithea/tests/vcs/conf.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/vcs/conf.py	Fri Aug 25 14:32:50 2017 +0200
@@ -83,5 +83,5 @@
 shutil.copy(os.path.join(THIS, 'aconfig'), _dest)
 TEST_USER_CONFIG_FILE = _dest
 
-#overide default configurations with kallithea ones
+# overide default configurations with kallithea ones
 from kallithea.tests.base import *
--- a/kallithea/tests/vcs/test_archives.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/vcs/test_archives.py	Fri Aug 25 14:32:50 2017 +0200
@@ -100,6 +100,7 @@
         with self.assertRaises(VCSError):
             self.tip.fill_archive(prefix='/any')
 
+
 # For each backend create test case class
 for alias in SCM_TESTS:
     attrs = {
--- a/kallithea/tests/vcs/test_changesets.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/vcs/test_changesets.py	Fri Aug 25 14:32:50 2017 +0200
@@ -49,6 +49,7 @@
             'removed': [],
         })
 
+
 class _ChangesetsWithCommitsTestCaseixin(_BackendTestMixin):
     recreate_repo_per_test = True
 
@@ -365,6 +366,7 @@
         self.assertEqual(33188, changeset.get_file_mode('foo/bał'))
         self.assertEqual(33188, changeset.get_file_mode(u'foo/bał'))
 
+
 # For each backend create test case class
 for alias in SCM_TESTS:
     attrs = {
--- a/kallithea/tests/vcs/test_git.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/vcs/test_git.py	Fri Aug 25 14:32:50 2017 +0200
@@ -104,7 +104,7 @@
             create=True, src_url=TEST_GIT_REPO, update_after_clone=True)
         self.assertEqual(len(repo.revisions), len(repo_clone.revisions))
 
-        #check if current workdir was updated
+        # check if current workdir was updated
         fpath = os.path.join(clone_path, 'MANIFEST.in')
         self.assertEqual(True, os.path.isfile(fpath),
             'Repo was cloned and updated but file %s could not be found'
@@ -116,7 +116,7 @@
         repo_clone = GitRepository(clone_path,
             create=True, src_url=TEST_GIT_REPO, update_after_clone=False)
         self.assertEqual(len(repo.revisions), len(repo_clone.revisions))
-        #check if current workdir was *NOT* updated
+        # check if current workdir was *NOT* updated
         fpath = os.path.join(clone_path, 'MANIFEST.in')
         # Make sure it's not bare repo
         self.assertFalse(repo_clone._repo.bare)
@@ -170,10 +170,8 @@
             'e686b958768ee96af8029fe19c6050b1a8dd3b2b'])
         self.assertTrue(subset.issubset(set(self.repo.revisions)))
 
-
-
     def test_slicing(self):
-        #4 1 5 10 95
+        # 4 1 5 10 95
         for sfrom, sto, size in [(0, 4, 4), (1, 2, 1), (10, 15, 5),
                                  (10, 20, 10), (5, 100, 95)]:
             revs = list(self.repo[sfrom:sto])
@@ -181,7 +179,6 @@
             self.assertEqual(revs[0], self.repo.get_changeset(sfrom))
             self.assertEqual(revs[-1], self.repo.get_changeset(sto - 1))
 
-
     def test_branches(self):
         # TODO: Need more tests here
         # Removed (those are 'remotes' branches for cloned repo)
@@ -370,7 +367,6 @@
                 'vcs/backends/hg.py', 854),
             ('6e125e7c890379446e98980d8ed60fba87d0f6d1',
                 'setup.py', 1068),
-
             ('d955cd312c17b02143c04fa1099a352b04368118',
                 'vcs/backends/base.py', 2921),
             ('ca1eb7957a54bce53b12d1a51b13452f95bc7c7e',
@@ -548,7 +544,7 @@
                 self.assertEqual(l1_1, l1_2)
                 l1 = l1_1
                 l2 = files[fname][rev]['changesets']
-                self.assertTrue(l1 == l2 , "The lists of revision for %s@rev %s"
+                self.assertTrue(l1 == l2, "The lists of revision for %s@rev %s"
                                 "from annotation list should match each other, "
                                 "got \n%s \nvs \n%s " % (fname, rev, l1, l2))
 
@@ -766,7 +762,7 @@
 
     def test_similar_paths(self):
         cs = self.repo.get_changeset()
-        paths = lambda *n:[x.path for x in n]
+        paths = lambda *n: [x.path for x in n]
         self.assertEqual(paths(*cs.get_nodes('bot')), ['bot/build', 'bot/templates', 'bot/__init__.py'])
         self.assertEqual(paths(*cs.get_nodes('bot/build')), ['bot/build/migrations', 'bot/build/static', 'bot/build/templates'])
         self.assertEqual(paths(*cs.get_nodes('bot/build/static')), ['bot/build/static/templates'])
--- a/kallithea/tests/vcs/test_hg.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/vcs/test_hg.py	Fri Aug 25 14:32:50 2017 +0200
@@ -28,7 +28,7 @@
         self.assertRaises(RepositoryError, MercurialRepository, wrong_repo_path)
 
     def test_unicode_path_repo(self):
-        self.assertRaises(VCSError,lambda:MercurialRepository(u'iShouldFail'))
+        self.assertRaises(VCSError, lambda: MercurialRepository(u'iShouldFail'))
 
     def test_repo_clone(self):
         self.__check_for_existing_repo()
@@ -47,7 +47,7 @@
             src_url=TEST_HG_REPO, update_after_clone=True)
         self.assertEqual(len(repo.revisions), len(repo_clone.revisions))
 
-        #check if current workdir was updated
+        # check if current workdir was updated
         self.assertEqual(os.path.isfile(os.path.join(TEST_HG_REPO_CLONE \
                                                     + '_w_update',
                                                     'MANIFEST.in')), True,)
@@ -98,7 +98,6 @@
                 ])
         self.assertTrue(subset.issubset(set(self.repo.revisions)))
 
-
         # check if we have the proper order of revisions
         org = ['b986218ba1c9b0d6a259fac9b050b1724ed8e545',
                 '3d8f361e72ab303da48d799ff1ac40d5ac37c67e',
@@ -139,7 +138,7 @@
         self.assertEqual(sliced, itered)
 
     def test_slicing(self):
-        #4 1 5 10 95
+        # 4 1 5 10 95
         for sfrom, sto, size in [(0, 4, 4), (1, 2, 1), (10, 15, 5),
                                  (10, 20, 10), (5, 100, 95)]:
             revs = list(self.repo[sfrom:sto])
@@ -150,7 +149,7 @@
     def test_branches(self):
         # TODO: Need more tests here
 
-        #active branches
+        # active branches
         self.assertTrue('default' in self.repo.branches)
         self.assertTrue('stable' in self.repo.branches)
 
@@ -201,13 +200,13 @@
         self.assertEqual(node.kind, NodeKind.FILE)
 
     def test_not_existing_changeset(self):
-        #rawid
+        # rawid
         self.assertRaises(RepositoryError, self.repo.get_changeset,
             'abcd' * 10)
-        #shortid
+        # shortid
         self.assertRaises(RepositoryError, self.repo.get_changeset,
             'erro' * 4)
-        #numeric
+        # numeric
         self.assertRaises(RepositoryError, self.repo.get_changeset,
             self.repo.count() + 1)
 
@@ -414,7 +413,7 @@
                 self.assertEqual(l1_1, l1_2)
                 l1 = l1_2 = [x[2]().revision for x in cs.get_file_annotate(fname)]
                 l2 = files[fname][rev]['changesets']
-                self.assertTrue(l1 == l2 , "The lists of revision for %s@rev%s"
+                self.assertTrue(l1 == l2, "The lists of revision for %s@rev%s"
                                 "from annotation list should match each other,"
                                 "got \n%s \nvs \n%s " % (fname, rev, l1, l2))
 
@@ -462,7 +461,7 @@
         self.assertEqual(set((node.path for node in chset88.changed)),
             set(['.hgignore']))
         self.assertEqual(set((node.path for node in chset88.removed)), set())
-#
+
         # 85:
         #    added:   2 ['vcs/utils/diffs.py', 'vcs/web/simplevcs/views/diffs.py']
         #    changed: 4 ['vcs/web/simplevcs/models.py', ...]
@@ -536,13 +535,12 @@
         path = 'foo/bar/setup.py'
         self.assertRaises(VCSError, self.repo.get_changeset().get_node, path)
 
-
     def test_archival_file(self):
-        #TODO:
+        # TODO:
         pass
 
     def test_archival_as_generator(self):
-        #TODO:
+        # TODO:
         pass
 
     def test_archival_wrong_kind(self):
@@ -550,10 +548,9 @@
         self.assertRaises(VCSError, tip.fill_archive, kind='error')
 
     def test_archival_empty_prefix(self):
-        #TODO:
+        # TODO:
         pass
 
-
     def test_author_email(self):
         self.assertEqual('marcin@python-blog.com',
                          self.repo.get_changeset('b986218ba1c9').author_email)
--- a/kallithea/tests/vcs/test_nodes.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/vcs/test_nodes.py	Fri Aug 25 14:32:50 2017 +0200
@@ -170,6 +170,7 @@
         self.assertEqual(my_node3.mimetype, 'application/octet-stream')
         self.assertEqual(my_node3.get_mimetype(), ('application/octet-stream', None))
 
+
 class NodeContentTest(unittest.TestCase):
 
     def test_if_binary(self):
--- a/kallithea/tests/vcs/test_tags.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/vcs/test_tags.py	Fri Aug 25 14:32:50 2017 +0200
@@ -46,6 +46,7 @@
         self.repo.tag('11', 'joe')
         self.assertTrue('11' in self.repo.tags)
 
+
 # For each backend create test case class
 for alias in SCM_TESTS:
     attrs = {
--- a/kallithea/tests/vcs/test_utils.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/vcs/test_utils.py	Fri Aug 25 14:32:50 2017 +0200
@@ -43,7 +43,6 @@
         for path, expected in paths_and_results:
             self._test_get_dirs_for_path(path, expected)
 
-
     def test_get_scm(self):
         self.assertEqual(('hg', TEST_HG_REPO), get_scm(TEST_HG_REPO))
         self.assertEqual(('git', TEST_GIT_REPO), get_scm(TEST_GIT_REPO))
@@ -209,13 +208,10 @@
                   ]
 
     def test_author_email(self):
-
         for test_str, result in self.TEST_AUTHORS:
             self.assertEqual(result[1], author_email(test_str))
 
-
     def test_author_name(self):
-
         for test_str, result in self.TEST_AUTHORS:
             self.assertEqual(result[0], author_name(test_str))
 
--- a/kallithea/tests/vcs/test_vcs.py	Fri Aug 25 14:32:31 2017 +0200
+++ b/kallithea/tests/vcs/test_vcs.py	Fri Aug 25 14:32:50 2017 +0200
@@ -1,4 +1,3 @@
-
 import os
 import shutil
 
@@ -9,7 +8,6 @@
 from kallithea.tests.vcs.conf import TEST_HG_REPO, TEST_GIT_REPO, TEST_TMP_PATH
 
 
-
 class VCSTest(unittest.TestCase):
     """
     Tests for main module's methods.
@@ -24,14 +22,14 @@
         path = TEST_HG_REPO
         backend = get_backend(alias)
         repo = backend(safe_str(path))
-        self.assertEqual('hg',repo.alias)
+        self.assertEqual('hg', repo.alias)
 
     def test_alias_detect_git(self):
         alias = 'git'
         path = TEST_GIT_REPO
         backend = get_backend(alias)
         repo = backend(safe_str(path))
-        self.assertEqual('git',repo.alias)
+        self.assertEqual('git', repo.alias)
 
     def test_wrong_alias(self):
         alias = 'wrong_alias'
@@ -64,7 +62,6 @@
         self.assertEqual(repo.__class__, get_repo(safe_str(path)).__class__)
         self.assertEqual(repo.path, get_repo(safe_str(path)).path)
 
-
     def test_get_repo_err(self):
         blank_repo_path = os.path.join(TEST_TMP_PATH, 'blank-error-repo')
         if os.path.isdir(blank_repo_path):