From f585152407c52ae280e4c28dde5351fc0a6e4a07 Mon Sep 17 00:00:00 2001 From: Kun Huang Date: Wed, 24 Jul 2013 16:27:01 +0800 Subject: [PATCH] remove 'import *' usage (or mark is #noqa) This is talked in bug #1188533, and in current codes, there are several places here: horizon/forms/__init__.py:18:from django.forms import * mark '# noqa' openstack_dashboard/settings.py:182: from local.local_settings import * openstack_dashboard/test/settings.py:5:from horizon.test.settings import * mark '# noqa' openstack_dashboard/dashboards/project/instances/workflows/__init__.py:1:from create_instance import * openstack_dashboard/dashboards/project/instances/workflows/__init__.py:2:from update_instance import * openstack_dashboard/dashboards/project/instances/workflows/__init__.py:3:from resize_instance import * fix it openstack_dashboard/dashboards/project/images_and_snapshots/urls.py:21:from django.conf.urls.defaults import * fix it fixes bug # 1188533 Change-Id: Id671280903f8452a78f81f1240d92297de7a89a8 --- .mailmap | 1 + horizon/forms/__init__.py | 2 +- .../dashboards/project/images_and_snapshots/urls.py | 4 +++- .../dashboards/project/instances/workflows/__init__.py | 10 +++++++--- openstack_dashboard/settings.py | 2 +- openstack_dashboard/test/settings.py | 2 +- tox.ini | 3 +-- 7 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.mailmap b/.mailmap index 771ab6560..f59873d1b 100644 --- a/.mailmap +++ b/.mailmap @@ -9,3 +9,4 @@ Zhongyue Luo Joe Gordon +Kun Huang diff --git a/horizon/forms/__init__.py b/horizon/forms/__init__.py index 611d59b79..4df93321b 100644 --- a/horizon/forms/__init__.py +++ b/horizon/forms/__init__.py @@ -15,7 +15,7 @@ # under the License. # FIXME(gabriel): Legacy imports for API compatibility. -from django.forms import * +from django.forms import * # noqa from django.forms import widgets # Convenience imports for public API components. diff --git a/openstack_dashboard/dashboards/project/images_and_snapshots/urls.py b/openstack_dashboard/dashboards/project/images_and_snapshots/urls.py index bb0704c54..2e2b4cd65 100644 --- a/openstack_dashboard/dashboards/project/images_and_snapshots/urls.py +++ b/openstack_dashboard/dashboards/project/images_and_snapshots/urls.py @@ -18,7 +18,9 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import * +from django.conf.urls.defaults import include +from django.conf.urls.defaults import patterns +from django.conf.urls.defaults import url from openstack_dashboard.dashboards.project.images_and_snapshots.images \ import urls as image_urls diff --git a/openstack_dashboard/dashboards/project/instances/workflows/__init__.py b/openstack_dashboard/dashboards/project/instances/workflows/__init__.py index 1525d9646..2c19082f8 100644 --- a/openstack_dashboard/dashboards/project/instances/workflows/__init__.py +++ b/openstack_dashboard/dashboards/project/instances/workflows/__init__.py @@ -1,3 +1,7 @@ -from create_instance import * -from update_instance import * -from resize_instance import * +from create_instance import LaunchInstance +from resize_instance import ResizeInstance +from update_instance import UpdateInstance + +assert LaunchInstance +assert UpdateInstance +assert ResizeInstance diff --git a/openstack_dashboard/settings.py b/openstack_dashboard/settings.py index 9613f5892..b05cd98c5 100644 --- a/openstack_dashboard/settings.py +++ b/openstack_dashboard/settings.py @@ -179,7 +179,7 @@ OPENSTACK_KEYSTONE_DEFAULT_ROLE = 'Member' DEFAULT_EXCEPTION_REPORTER_FILTER = 'horizon.exceptions.HorizonReporterFilter' try: - from local.local_settings import * + from local.local_settings import * # noqa except ImportError: logging.warning("No local_settings file found.") diff --git a/openstack_dashboard/test/settings.py b/openstack_dashboard/test/settings.py index c89b2b35b..dfcaa22c7 100644 --- a/openstack_dashboard/test/settings.py +++ b/openstack_dashboard/test/settings.py @@ -2,7 +2,7 @@ import os from django.utils.translation import ugettext_lazy as _ -from horizon.test.settings import * +from horizon.test.settings import * # noqa from horizon.utils.secret_key import generate_or_read_from_file from openstack_dashboard.exceptions import NOT_FOUND diff --git a/tox.ini b/tox.ini index b31c67d3a..e413e8d41 100644 --- a/tox.ini +++ b/tox.ini @@ -40,8 +40,7 @@ exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,p # F999 syntax error in doctest # H201 no 'except:' at least use 'except Exception:' # H302 import only modules.'from optparse import make_option' does not import a module -# H303 No wildcard (*) import. # H4xx docstrings # H701 empty localization string # H702 Formatting operation should be outside of localization method call -ignore = E121,E126,E127,E128,F403,F999,H201,H302,H303,H4,H701,H702 +ignore = E121,E126,E127,E128,F403,F999,H201,H302,H4,H701,H702