# HG changeset patch # User Mads Kiilerich # Date 2019-12-26 05:13:25 # Node ID ed78b4fbe2a38d478235b746b5365f4759bc0c4f # Parent 1e8b300b05403d0cb206b020cf13e77b6d9ee5a9 cleanup: fix some bad imports reported by pyflakes diff --git a/kallithea/bin/kallithea_cli_ssh.py b/kallithea/bin/kallithea_cli_ssh.py --- a/kallithea/bin/kallithea_cli_ssh.py +++ b/kallithea/bin/kallithea_cli_ssh.py @@ -14,7 +14,6 @@ import logging import os -import re import shlex import sys diff --git a/kallithea/controllers/admin/defaults.py b/kallithea/controllers/admin/defaults.py --- a/kallithea/controllers/admin/defaults.py +++ b/kallithea/controllers/admin/defaults.py @@ -31,7 +31,6 @@ import traceback 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 diff --git a/kallithea/controllers/admin/repo_groups.py b/kallithea/controllers/admin/repo_groups.py --- a/kallithea/controllers/admin/repo_groups.py +++ b/kallithea/controllers/admin/repo_groups.py @@ -36,7 +36,6 @@ from tg.i18n import ugettext as _ 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 diff --git a/kallithea/controllers/admin/user_groups.py b/kallithea/controllers/admin/user_groups.py --- a/kallithea/controllers/admin/user_groups.py +++ b/kallithea/controllers/admin/user_groups.py @@ -37,7 +37,6 @@ from tg import tmpl_context as c 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 diff --git a/kallithea/controllers/admin/users.py b/kallithea/controllers/admin/users.py --- a/kallithea/controllers/admin/users.py +++ b/kallithea/controllers/admin/users.py @@ -36,7 +36,6 @@ from tg import tmpl_context as c 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 diff --git a/kallithea/controllers/changelog.py b/kallithea/controllers/changelog.py --- a/kallithea/controllers/changelog.py +++ b/kallithea/controllers/changelog.py @@ -39,7 +39,7 @@ from kallithea.lib.auth import HasRepoPe 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 diff --git a/kallithea/controllers/summary.py b/kallithea/controllers/summary.py --- a/kallithea/controllers/summary.py +++ b/kallithea/controllers/summary.py @@ -46,7 +46,7 @@ from kallithea.lib.celerylib.tasks impor 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 diff --git a/kallithea/lib/auth_modules/auth_internal.py b/kallithea/lib/auth_modules/auth_internal.py --- a/kallithea/lib/auth_modules/auth_internal.py +++ b/kallithea/lib/auth_modules/auth_internal.py @@ -30,7 +30,6 @@ import logging 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__) diff --git a/kallithea/lib/compat.py b/kallithea/lib/compat.py --- a/kallithea/lib/compat.py +++ b/kallithea/lib/compat.py @@ -29,7 +29,6 @@ Original author and date, and relevant c import functools import os -import sys #============================================================================== # Hybrid property/method diff --git a/kallithea/lib/vcs/backends/git/ssh.py b/kallithea/lib/vcs/backends/git/ssh.py --- a/kallithea/lib/vcs/backends/git/ssh.py +++ b/kallithea/lib/vcs/backends/git/ssh.py @@ -17,8 +17,8 @@ import os 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__) diff --git a/kallithea/lib/vcs/backends/hg/ssh.py b/kallithea/lib/vcs/backends/hg/ssh.py --- a/kallithea/lib/vcs/backends/hg/ssh.py +++ b/kallithea/lib/vcs/backends/hg/ssh.py @@ -18,8 +18,8 @@ from mercurial import hg 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__) diff --git a/kallithea/lib/vcs/backends/ssh.py b/kallithea/lib/vcs/backends/ssh.py --- a/kallithea/lib/vcs/backends/ssh.py +++ b/kallithea/lib/vcs/backends/ssh.py @@ -24,7 +24,8 @@ import logging 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 diff --git a/kallithea/model/repo.py b/kallithea/model/repo.py --- a/kallithea/model/repo.py +++ b/kallithea/model/repo.py @@ -119,7 +119,6 @@ class RepoModel(object): @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 _ diff --git a/kallithea/tests/vcs/test_hg.py b/kallithea/tests/vcs/test_hg.py --- a/kallithea/tests/vcs/test_hg.py +++ b/kallithea/tests/vcs/test_hg.py @@ -3,10 +3,10 @@ import os 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 diff --git a/kallithea/tests/vcs/test_inmemchangesets.py b/kallithea/tests/vcs/test_inmemchangesets.py --- a/kallithea/tests/vcs/test_inmemchangesets.py +++ b/kallithea/tests/vcs/test_inmemchangesets.py @@ -7,7 +7,6 @@ import datetime 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 diff --git a/kallithea/tests/vcs/test_vcs.py b/kallithea/tests/vcs/test_vcs.py --- a/kallithea/tests/vcs/test_vcs.py +++ b/kallithea/tests/vcs/test_vcs.py @@ -3,9 +3,9 @@ import shutil 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