changeset 8034:ed78b4fbe2a3

cleanup: fix some bad imports reported by pyflakes
author Mads Kiilerich <mads@kiilerich.com>
date Thu, 26 Dec 2019 05:13:25 +0100
parents 1e8b300b0540
children eefb46488667
files kallithea/bin/kallithea_cli_ssh.py kallithea/controllers/admin/defaults.py kallithea/controllers/admin/repo_groups.py kallithea/controllers/admin/user_groups.py kallithea/controllers/admin/users.py kallithea/controllers/changelog.py kallithea/controllers/summary.py kallithea/lib/auth_modules/auth_internal.py kallithea/lib/compat.py kallithea/lib/vcs/backends/git/ssh.py kallithea/lib/vcs/backends/hg/ssh.py kallithea/lib/vcs/backends/ssh.py kallithea/model/repo.py kallithea/tests/vcs/test_hg.py kallithea/tests/vcs/test_inmemchangesets.py kallithea/tests/vcs/test_vcs.py
diffstat 16 files changed, 8 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/bin/kallithea_cli_ssh.py	Wed Dec 25 15:39:33 2019 +0100
+++ b/kallithea/bin/kallithea_cli_ssh.py	Thu Dec 26 05:13:25 2019 +0100
@@ -14,7 +14,6 @@
 
 import logging
 import os
-import re
 import shlex
 import sys
 
--- a/kallithea/controllers/admin/defaults.py	Wed Dec 25 15:39:33 2019 +0100
+++ b/kallithea/controllers/admin/defaults.py	Thu Dec 26 05:13:25 2019 +0100
@@ -31,7 +31,6 @@
 import formencode
 from formencode import htmlfill
 from tg import request
-from tg import tmpl_context as c
 from tg.i18n import ugettext as _
 from webob.exc import HTTPFound
 
--- a/kallithea/controllers/admin/repo_groups.py	Wed Dec 25 15:39:33 2019 +0100
+++ b/kallithea/controllers/admin/repo_groups.py	Thu Dec 26 05:13:25 2019 +0100
@@ -36,7 +36,6 @@
 from tg.i18n import ungettext
 from webob.exc import HTTPForbidden, HTTPFound, HTTPInternalServerError, HTTPNotFound
 
-import kallithea
 from kallithea.config.routing import url
 from kallithea.lib import helpers as h
 from kallithea.lib.auth import HasPermissionAny, HasRepoGroupPermissionLevel, HasRepoGroupPermissionLevelDecorator, LoginRequired
--- a/kallithea/controllers/admin/user_groups.py	Wed Dec 25 15:39:33 2019 +0100
+++ b/kallithea/controllers/admin/user_groups.py	Thu Dec 26 05:13:25 2019 +0100
@@ -37,7 +37,6 @@
 from tg.i18n import ugettext as _
 from webob.exc import HTTPFound, HTTPInternalServerError
 
-import kallithea
 from kallithea.config.routing import url
 from kallithea.lib import helpers as h
 from kallithea.lib.auth import HasPermissionAnyDecorator, HasUserGroupPermissionLevelDecorator, LoginRequired
--- a/kallithea/controllers/admin/users.py	Wed Dec 25 15:39:33 2019 +0100
+++ b/kallithea/controllers/admin/users.py	Thu Dec 26 05:13:25 2019 +0100
@@ -36,7 +36,6 @@
 from tg.i18n import ugettext as _
 from webob.exc import HTTPFound, HTTPNotFound
 
-import kallithea
 from kallithea.config.routing import url
 from kallithea.lib import auth_modules
 from kallithea.lib import helpers as h
--- a/kallithea/controllers/changelog.py	Wed Dec 25 15:39:33 2019 +0100
+++ b/kallithea/controllers/changelog.py	Thu Dec 26 05:13:25 2019 +0100
@@ -39,7 +39,7 @@
 from kallithea.lib.base import BaseRepoController, render
 from kallithea.lib.graphmod import graph_data
 from kallithea.lib.page import Page
-from kallithea.lib.utils2 import safe_int, safe_str
+from kallithea.lib.utils2 import safe_int
 from kallithea.lib.vcs.exceptions import ChangesetDoesNotExistError, ChangesetError, EmptyRepositoryError, NodeDoesNotExistError, RepositoryError
 
 
--- a/kallithea/controllers/summary.py	Wed Dec 25 15:39:33 2019 +0100
+++ b/kallithea/controllers/summary.py	Thu Dec 26 05:13:25 2019 +0100
@@ -46,7 +46,7 @@
 from kallithea.lib.compat import json
 from kallithea.lib.markup_renderer import MarkupRenderer
 from kallithea.lib.page import Page
-from kallithea.lib.utils2 import safe_int, safe_str
+from kallithea.lib.utils2 import safe_int
 from kallithea.lib.vcs.backends.base import EmptyChangeset
 from kallithea.lib.vcs.exceptions import ChangesetError, EmptyRepositoryError, NodeDoesNotExistError
 from kallithea.lib.vcs.nodes import FileNode
--- a/kallithea/lib/auth_modules/auth_internal.py	Wed Dec 25 15:39:33 2019 +0100
+++ b/kallithea/lib/auth_modules/auth_internal.py	Thu Dec 26 05:13:25 2019 +0100
@@ -30,7 +30,6 @@
 
 from kallithea.lib import auth_modules
 from kallithea.lib.compat import formatted_json, hybrid_property
-from kallithea.model.db import User
 
 
 log = logging.getLogger(__name__)
--- a/kallithea/lib/compat.py	Wed Dec 25 15:39:33 2019 +0100
+++ b/kallithea/lib/compat.py	Thu Dec 26 05:13:25 2019 +0100
@@ -29,7 +29,6 @@
 
 import functools
 import os
-import sys
 
 #==============================================================================
 # Hybrid property/method
--- a/kallithea/lib/vcs/backends/git/ssh.py	Wed Dec 25 15:39:33 2019 +0100
+++ b/kallithea/lib/vcs/backends/git/ssh.py	Thu Dec 26 05:13:25 2019 +0100
@@ -17,8 +17,8 @@
 
 from kallithea.lib.hooks import log_pull_action
 from kallithea.lib.utils import make_ui
-from kallithea.lib.utils2 import safe_str, safe_unicode
 from kallithea.lib.vcs.backends.ssh import BaseSshHandler
+from kallithea.lib.vcs.utils import safe_str, safe_unicode
 
 
 log = logging.getLogger(__name__)
--- a/kallithea/lib/vcs/backends/hg/ssh.py	Wed Dec 25 15:39:33 2019 +0100
+++ b/kallithea/lib/vcs/backends/hg/ssh.py	Thu Dec 26 05:13:25 2019 +0100
@@ -18,8 +18,8 @@
 from mercurial.wireprotoserver import sshserver
 
 from kallithea.lib.utils import make_ui
-from kallithea.lib.utils2 import safe_str, safe_unicode
 from kallithea.lib.vcs.backends.ssh import BaseSshHandler
+from kallithea.lib.vcs.utils import safe_str, safe_unicode
 
 
 log = logging.getLogger(__name__)
--- a/kallithea/lib/vcs/backends/ssh.py	Wed Dec 25 15:39:33 2019 +0100
+++ b/kallithea/lib/vcs/backends/ssh.py	Thu Dec 26 05:13:25 2019 +0100
@@ -24,7 +24,8 @@
 import sys
 
 from kallithea.lib.auth import AuthUser, HasPermissionAnyMiddleware
-from kallithea.lib.utils2 import safe_str, set_hook_environment
+from kallithea.lib.utils2 import set_hook_environment
+from kallithea.lib.vcs.utils import safe_str
 from kallithea.model.db import Repository, User, UserSshKeys
 from kallithea.model.meta import Session
 
--- a/kallithea/model/repo.py	Wed Dec 25 15:39:33 2019 +0100
+++ b/kallithea/model/repo.py	Thu Dec 26 05:13:25 2019 +0100
@@ -119,7 +119,6 @@
 
     @classmethod
     def _render_datatable(cls, tmpl, *args, **kwargs):
-        import kallithea
         from tg import tmpl_context as c, request, app_globals
         from tg.i18n import ugettext as _
 
--- a/kallithea/tests/vcs/test_hg.py	Wed Dec 25 15:39:33 2019 +0100
+++ b/kallithea/tests/vcs/test_hg.py	Thu Dec 26 05:13:25 2019 +0100
@@ -3,10 +3,10 @@
 import mock
 import pytest
 
-from kallithea.lib.utils2 import safe_str
 from kallithea.lib.vcs.backends.hg import MercurialChangeset, MercurialRepository
 from kallithea.lib.vcs.exceptions import NodeDoesNotExistError, RepositoryError, VCSError
 from kallithea.lib.vcs.nodes import NodeKind, NodeState
+from kallithea.lib.vcs.utils import safe_str
 from kallithea.tests.vcs.conf import TEST_HG_REPO, TEST_HG_REPO_CLONE, TEST_HG_REPO_PULL, TESTS_TMP_PATH
 
 
--- a/kallithea/tests/vcs/test_inmemchangesets.py	Wed Dec 25 15:39:33 2019 +0100
+++ b/kallithea/tests/vcs/test_inmemchangesets.py	Thu Dec 26 05:13:25 2019 +0100
@@ -7,7 +7,6 @@
 
 import pytest
 
-from kallithea.lib import vcs
 from kallithea.lib.vcs.exceptions import (
     EmptyRepositoryError, NodeAlreadyAddedError, NodeAlreadyChangedError, NodeAlreadyExistsError, NodeAlreadyRemovedError, NodeDoesNotExistError, NodeNotChangedError)
 from kallithea.lib.vcs.nodes import DirNode, FileNode
--- a/kallithea/tests/vcs/test_vcs.py	Wed Dec 25 15:39:33 2019 +0100
+++ b/kallithea/tests/vcs/test_vcs.py	Thu Dec 26 05:13:25 2019 +0100
@@ -3,9 +3,9 @@
 
 import pytest
 
-from kallithea.lib.utils2 import safe_str
 from kallithea.lib.vcs import VCSError, get_backend, get_repo
 from kallithea.lib.vcs.backends.hg import MercurialRepository
+from kallithea.lib.vcs.utils import safe_str
 from kallithea.tests.vcs.conf import TEST_GIT_REPO, TEST_HG_REPO, TESTS_TMP_PATH