Fix E402 warnings
E402 module level import not at top of file Change-Id: Ia8425ffe5b1325d00ae482d99b6764fd0fcbf822
This commit is contained in:
parent
11eb4e9d3e
commit
f0f028ca35
@ -30,6 +30,8 @@ import sys
|
|||||||
|
|
||||||
import django
|
import django
|
||||||
|
|
||||||
|
import horizon.version
|
||||||
|
|
||||||
# NOTE(amotoki): Sphinx 1.6.x catches warnings from imported modules.
|
# NOTE(amotoki): Sphinx 1.6.x catches warnings from imported modules.
|
||||||
# Ignore warnings from openstack_dashboard.settings in the doc build.
|
# Ignore warnings from openstack_dashboard.settings in the doc build.
|
||||||
# This can be dropped once Sphinx correctly ignore such warnings.
|
# This can be dropped once Sphinx correctly ignore such warnings.
|
||||||
@ -45,8 +47,6 @@ sys.path.insert(0, ROOT)
|
|||||||
# This is required for ReadTheDocs.org, but isn't a bad idea anyway.
|
# This is required for ReadTheDocs.org, but isn't a bad idea anyway.
|
||||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'openstack_dashboard.settings')
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'openstack_dashboard.settings')
|
||||||
|
|
||||||
import horizon.version
|
|
||||||
|
|
||||||
django.setup()
|
django.setup()
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,6 +42,9 @@ import six
|
|||||||
from django.contrib.staticfiles.testing \
|
from django.contrib.staticfiles.testing \
|
||||||
import StaticLiveServerTestCase as LiveServerTestCase
|
import StaticLiveServerTestCase as LiveServerTestCase
|
||||||
|
|
||||||
|
from horizon import middleware
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -68,8 +71,6 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
from horizon import middleware
|
|
||||||
|
|
||||||
|
|
||||||
# Makes output of failing mox tests much easier to read.
|
# Makes output of failing mox tests much easier to read.
|
||||||
wsgi.WSGIRequest.__repr__ = lambda self: "<class 'django.http.HttpRequest'>"
|
wsgi.WSGIRequest.__repr__ = lambda self: "<class 'django.http.HttpRequest'>"
|
||||||
|
@ -25,13 +25,15 @@ import warnings
|
|||||||
from django.utils.translation import pgettext_lazy
|
from django.utils.translation import pgettext_lazy
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
from horizon.utils.escape import monkeypatch_escape
|
||||||
|
|
||||||
|
from openstack_dashboard import enabled
|
||||||
from openstack_dashboard import exceptions
|
from openstack_dashboard import exceptions
|
||||||
|
from openstack_dashboard.local import enabled as local_enabled
|
||||||
from openstack_dashboard import theme_settings
|
from openstack_dashboard import theme_settings
|
||||||
from openstack_dashboard.utils import config
|
from openstack_dashboard.utils import config
|
||||||
from openstack_dashboard.utils import settings as settings_utils
|
from openstack_dashboard.utils import settings as settings_utils
|
||||||
|
|
||||||
from horizon.utils.escape import monkeypatch_escape
|
|
||||||
|
|
||||||
monkeypatch_escape()
|
monkeypatch_escape()
|
||||||
|
|
||||||
_LOG = logging.getLogger(__name__)
|
_LOG = logging.getLogger(__name__)
|
||||||
@ -461,16 +463,11 @@ if not SECRET_KEY:
|
|||||||
settings_utils.find_static_files(HORIZON_CONFIG, AVAILABLE_THEMES,
|
settings_utils.find_static_files(HORIZON_CONFIG, AVAILABLE_THEMES,
|
||||||
THEME_COLLECTION_DIR, ROOT_PATH)
|
THEME_COLLECTION_DIR, ROOT_PATH)
|
||||||
|
|
||||||
|
|
||||||
# Load the pluggable dashboard settings
|
|
||||||
import openstack_dashboard.enabled
|
|
||||||
import openstack_dashboard.local.enabled
|
|
||||||
|
|
||||||
INSTALLED_APPS = list(INSTALLED_APPS) # Make sure it's mutable
|
INSTALLED_APPS = list(INSTALLED_APPS) # Make sure it's mutable
|
||||||
settings_utils.update_dashboards(
|
settings_utils.update_dashboards(
|
||||||
[
|
[
|
||||||
openstack_dashboard.enabled,
|
enabled,
|
||||||
openstack_dashboard.local.enabled,
|
local_enabled,
|
||||||
],
|
],
|
||||||
HORIZON_CONFIG,
|
HORIZON_CONFIG,
|
||||||
INSTALLED_APPS,
|
INSTALLED_APPS,
|
||||||
|
@ -16,18 +16,19 @@ import tempfile
|
|||||||
import six
|
import six
|
||||||
|
|
||||||
from django.utils.translation import pgettext_lazy
|
from django.utils.translation import pgettext_lazy
|
||||||
from horizon.test.settings import * # noqa: F403,H303
|
|
||||||
from horizon.utils import secret_key
|
|
||||||
from openstack_dashboard import exceptions
|
|
||||||
|
|
||||||
|
from horizon.test.settings import * # noqa: F403,H303
|
||||||
from horizon.utils.escape import monkeypatch_escape
|
from horizon.utils.escape import monkeypatch_escape
|
||||||
|
from horizon.utils import secret_key
|
||||||
|
|
||||||
|
from openstack_dashboard import enabled
|
||||||
|
from openstack_dashboard import exceptions
|
||||||
|
from openstack_dashboard.utils import settings as settings_utils
|
||||||
|
|
||||||
# this is used to protect from client XSS attacks, but it's worth
|
# this is used to protect from client XSS attacks, but it's worth
|
||||||
# enabling in our test setup to find any issues it might cause
|
# enabling in our test setup to find any issues it might cause
|
||||||
monkeypatch_escape()
|
monkeypatch_escape()
|
||||||
|
|
||||||
from openstack_dashboard.utils import settings as settings_utils
|
|
||||||
|
|
||||||
TEST_DIR = os.path.dirname(os.path.abspath(__file__))
|
TEST_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
ROOT_PATH = os.path.abspath(os.path.join(TEST_DIR, ".."))
|
ROOT_PATH = os.path.abspath(os.path.join(TEST_DIR, ".."))
|
||||||
MEDIA_ROOT = os.path.abspath(os.path.join(ROOT_PATH, '..', 'media'))
|
MEDIA_ROOT = os.path.abspath(os.path.join(ROOT_PATH, '..', 'media'))
|
||||||
@ -116,13 +117,10 @@ STATICFILES_DIRS = settings_utils.get_xstatic_dirs(
|
|||||||
settings_utils.BASE_XSTATIC_MODULES, HORIZON_CONFIG
|
settings_utils.BASE_XSTATIC_MODULES, HORIZON_CONFIG
|
||||||
)
|
)
|
||||||
|
|
||||||
# Load the pluggable dashboard settings
|
|
||||||
import openstack_dashboard.enabled
|
|
||||||
|
|
||||||
INSTALLED_APPS = list(INSTALLED_APPS) # Make sure it's mutable
|
INSTALLED_APPS = list(INSTALLED_APPS) # Make sure it's mutable
|
||||||
settings_utils.update_dashboards(
|
settings_utils.update_dashboards(
|
||||||
[
|
[
|
||||||
openstack_dashboard.enabled,
|
enabled,
|
||||||
],
|
],
|
||||||
HORIZON_CONFIG,
|
HORIZON_CONFIG,
|
||||||
INSTALLED_APPS,
|
INSTALLED_APPS,
|
||||||
|
3
tox.ini
3
tox.ini
@ -155,8 +155,7 @@ commands =
|
|||||||
[flake8]
|
[flake8]
|
||||||
filename = *.py,django.wsgi
|
filename = *.py,django.wsgi
|
||||||
exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,panel_template,dash_template,local_settings.py,*/local/*,*/test/test_plugins/*,.ropeproject,node_modules,openstack_dashboard/enabled/*
|
exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,panel_template,dash_template,local_settings.py,*/local/*,*/test/test_plugins/*,.ropeproject,node_modules,openstack_dashboard/enabled/*
|
||||||
# E402 module level import not at top of file
|
ignore =
|
||||||
ignore = E402
|
|
||||||
# Enable the following hacking rules which are disabled by default
|
# Enable the following hacking rules which are disabled by default
|
||||||
# H106 Do not put vim configuration in source files.
|
# H106 Do not put vim configuration in source files.
|
||||||
# H203 Use assertIs(Not)None to check for None.
|
# H203 Use assertIs(Not)None to check for None.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user