From 8ff53b42678faf7fcdd34b53ec05553cefaec7de Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Thu, 25 Jul 2013 19:39:41 -0700 Subject: [PATCH] Fix and Gate on H303 (no wildcard imports) Wildcard imports make reading code unnecessarily confusing because they make it harder to see where a functions comes from. We had two types of wildcard imports in the code. Unneeded ones in test files that are just removed, and some that we actually want which are kept using the '# noqa' comment to tell flake8 to skip specific checks (such as H303) for that line. Change-Id: Id4705011579659fd74a4aaa05ac541e9694c483e --- nova/db/__init__.py | 2 +- nova/ipv6/__init__.py | 2 +- nova/tests/api/__init__.py | 3 --- nova/tests/api/ec2/__init__.py | 3 --- nova/tests/api/openstack/__init__.py | 3 --- nova/tests/api/openstack/compute/__init__.py | 3 --- nova/tests/api/openstack/compute/contrib/__init__.py | 3 --- nova/tests/cells/__init__.py | 3 --- nova/tests/cert/__init__.py | 3 --- nova/tests/compute/__init__.py | 3 --- nova/tests/console/__init__.py | 3 --- nova/tests/consoleauth/__init__.py | 3 --- nova/tests/image/__init__.py | 3 --- nova/tests/integrated/__init__.py | 2 -- nova/tests/network/__init__.py | 1 - nova/tests/scheduler/__init__.py | 3 --- nova/tests/virt/baremetal/__init__.py | 1 - nova/tests/virt/baremetal/db/__init__.py | 1 - nova/virt/baremetal/db/__init__.py | 2 +- smoketests/flags.py | 2 +- tox.ini | 2 +- 21 files changed, 5 insertions(+), 46 deletions(-) diff --git a/nova/db/__init__.py b/nova/db/__init__.py index 054b7ac945a2..8ae248cf9911 100644 --- a/nova/db/__init__.py +++ b/nova/db/__init__.py @@ -20,4 +20,4 @@ DB abstraction for Nova """ -from nova.db.api import * +from nova.db.api import * # noqa diff --git a/nova/ipv6/__init__.py b/nova/ipv6/__init__.py index 7abdae5e4591..711c7ad136ad 100644 --- a/nova/ipv6/__init__.py +++ b/nova/ipv6/__init__.py @@ -14,4 +14,4 @@ # License for the specific language governing permissions and limitations # under the License. -from nova.ipv6.api import * +from nova.ipv6.api import * # noqa diff --git a/nova/tests/api/__init__.py b/nova/tests/api/__init__.py index 4c506c9faadf..4dec227c40fb 100644 --- a/nova/tests/api/__init__.py +++ b/nova/tests/api/__init__.py @@ -14,6 +14,3 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - -# NOTE(vish): this forces the fixtures from tests/__init.py:setup() to work -from nova.tests import * diff --git a/nova/tests/api/ec2/__init__.py b/nova/tests/api/ec2/__init__.py index 4c506c9faadf..4dec227c40fb 100644 --- a/nova/tests/api/ec2/__init__.py +++ b/nova/tests/api/ec2/__init__.py @@ -14,6 +14,3 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - -# NOTE(vish): this forces the fixtures from tests/__init.py:setup() to work -from nova.tests import * diff --git a/nova/tests/api/openstack/__init__.py b/nova/tests/api/openstack/__init__.py index 4c506c9faadf..4dec227c40fb 100644 --- a/nova/tests/api/openstack/__init__.py +++ b/nova/tests/api/openstack/__init__.py @@ -14,6 +14,3 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - -# NOTE(vish): this forces the fixtures from tests/__init.py:setup() to work -from nova.tests import * diff --git a/nova/tests/api/openstack/compute/__init__.py b/nova/tests/api/openstack/compute/__init__.py index 4c506c9faadf..4dec227c40fb 100644 --- a/nova/tests/api/openstack/compute/__init__.py +++ b/nova/tests/api/openstack/compute/__init__.py @@ -14,6 +14,3 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - -# NOTE(vish): this forces the fixtures from tests/__init.py:setup() to work -from nova.tests import * diff --git a/nova/tests/api/openstack/compute/contrib/__init__.py b/nova/tests/api/openstack/compute/contrib/__init__.py index 4c506c9faadf..4dec227c40fb 100644 --- a/nova/tests/api/openstack/compute/contrib/__init__.py +++ b/nova/tests/api/openstack/compute/contrib/__init__.py @@ -14,6 +14,3 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - -# NOTE(vish): this forces the fixtures from tests/__init.py:setup() to work -from nova.tests import * diff --git a/nova/tests/cells/__init__.py b/nova/tests/cells/__init__.py index d1bf725f7825..22dfdf45f9b8 100644 --- a/nova/tests/cells/__init__.py +++ b/nova/tests/cells/__init__.py @@ -14,6 +14,3 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - -# NOTE(vish): this forces the fixtures from tests/__init.py:setup() to work -from nova.tests import * diff --git a/nova/tests/cert/__init__.py b/nova/tests/cert/__init__.py index 4c506c9faadf..4dec227c40fb 100644 --- a/nova/tests/cert/__init__.py +++ b/nova/tests/cert/__init__.py @@ -14,6 +14,3 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - -# NOTE(vish): this forces the fixtures from tests/__init.py:setup() to work -from nova.tests import * diff --git a/nova/tests/compute/__init__.py b/nova/tests/compute/__init__.py index 4c506c9faadf..4dec227c40fb 100644 --- a/nova/tests/compute/__init__.py +++ b/nova/tests/compute/__init__.py @@ -14,6 +14,3 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - -# NOTE(vish): this forces the fixtures from tests/__init.py:setup() to work -from nova.tests import * diff --git a/nova/tests/console/__init__.py b/nova/tests/console/__init__.py index 4c506c9faadf..4dec227c40fb 100644 --- a/nova/tests/console/__init__.py +++ b/nova/tests/console/__init__.py @@ -14,6 +14,3 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - -# NOTE(vish): this forces the fixtures from tests/__init.py:setup() to work -from nova.tests import * diff --git a/nova/tests/consoleauth/__init__.py b/nova/tests/consoleauth/__init__.py index 4c506c9faadf..4dec227c40fb 100644 --- a/nova/tests/consoleauth/__init__.py +++ b/nova/tests/consoleauth/__init__.py @@ -14,6 +14,3 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - -# NOTE(vish): this forces the fixtures from tests/__init.py:setup() to work -from nova.tests import * diff --git a/nova/tests/image/__init__.py b/nova/tests/image/__init__.py index 4c506c9faadf..4dec227c40fb 100644 --- a/nova/tests/image/__init__.py +++ b/nova/tests/image/__init__.py @@ -14,6 +14,3 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - -# NOTE(vish): this forces the fixtures from tests/__init.py:setup() to work -from nova.tests import * diff --git a/nova/tests/integrated/__init__.py b/nova/tests/integrated/__init__.py index 430af875446b..10e0a91d77c8 100644 --- a/nova/tests/integrated/__init__.py +++ b/nova/tests/integrated/__init__.py @@ -18,5 +18,3 @@ :mod:`integrated` -- Tests whole systems, using mock services where needed ================================= """ -# NOTE(vish): this forces the fixtures from tests/__init.py:setup() to work -from nova.tests import * diff --git a/nova/tests/network/__init__.py b/nova/tests/network/__init__.py index 34c7255d3a66..0b3d2db5e9d6 100644 --- a/nova/tests/network/__init__.py +++ b/nova/tests/network/__init__.py @@ -14,4 +14,3 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from nova.tests import * diff --git a/nova/tests/scheduler/__init__.py b/nova/tests/scheduler/__init__.py index 4c506c9faadf..4dec227c40fb 100644 --- a/nova/tests/scheduler/__init__.py +++ b/nova/tests/scheduler/__init__.py @@ -14,6 +14,3 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - -# NOTE(vish): this forces the fixtures from tests/__init.py:setup() to work -from nova.tests import * diff --git a/nova/tests/virt/baremetal/__init__.py b/nova/tests/virt/baremetal/__init__.py index 34b09daac9ac..19071662cca8 100644 --- a/nova/tests/virt/baremetal/__init__.py +++ b/nova/tests/virt/baremetal/__init__.py @@ -12,4 +12,3 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from nova.tests.virt.baremetal import * diff --git a/nova/tests/virt/baremetal/db/__init__.py b/nova/tests/virt/baremetal/db/__init__.py index 0f1f4e8468e0..19071662cca8 100644 --- a/nova/tests/virt/baremetal/db/__init__.py +++ b/nova/tests/virt/baremetal/db/__init__.py @@ -12,4 +12,3 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from nova.tests.virt.baremetal.db import * diff --git a/nova/virt/baremetal/db/__init__.py b/nova/virt/baremetal/db/__init__.py index ad883f505c17..038ec445d315 100644 --- a/nova/virt/baremetal/db/__init__.py +++ b/nova/virt/baremetal/db/__init__.py @@ -13,4 +13,4 @@ # License for the specific language governing permissions and limitations # under the License. -from nova.virt.baremetal.db.api import * +from nova.virt.baremetal.db.api import * # noqa diff --git a/smoketests/flags.py b/smoketests/flags.py index 5f3c8505e534..472e76409015 100644 --- a/smoketests/flags.py +++ b/smoketests/flags.py @@ -22,7 +22,7 @@ where they're used. """ -from gflags import * +from gflags import * # noqa # This keeps pylint from barfing on the imports FLAGS = FLAGS diff --git a/tox.ini b/tox.ini index 4bbc1d03b548..5322b612869d 100644 --- a/tox.ini +++ b/tox.ini @@ -45,7 +45,7 @@ commands = {posargs} # H102 Apache 2.0 license header not found # H501 Do not use locals() for string formatting -ignore = E121,E122,E123,E124,E126,E127,E128,E711,E712,H102,H302,H303,H404,F403,H501,F811,F841,N309 +ignore = E121,E122,E123,E124,E126,E127,E128,E711,E712,H102,H302,H404,F403,H501,F811,F841,N309 exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,*plugins/xenserver*,tools [hacking]