Safer noqa handling

"# flake8: noqa" was used in several files. This causes the
entire file to not be checked by flake8. This is unsafe, and
"# noqa" should be used only on those lines that require it.

E712 doesn't honor #noqa, so work around it by assigning True to a
variable.

Change-Id: I1ddd1c4f4230793f0560241e4559095cb4183d71
This commit is contained in:
Brant Knudson 2014-03-27 15:09:21 -05:00
parent d6d40b0e44
commit de2c89cbef
28 changed files with 53 additions and 87 deletions

View File

@ -1,5 +1,3 @@
# flake8: noqa
# Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -14,6 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystone.assignment import controllers
from keystone.assignment.core import *
from keystone.assignment import routers
from keystone.assignment import controllers # noqa
from keystone.assignment.core import * # noqa
from keystone.assignment import routers # noqa

View File

@ -1,5 +1,3 @@
# flake8: noqa
# Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -14,6 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystone.auth import controllers
from keystone.auth.core import *
from keystone.auth import routers
from keystone.auth import controllers # noqa
from keystone.auth.core import * # noqa
from keystone.auth import routers # noqa

View File

@ -1,5 +1,3 @@
# flake8: noqa
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -14,6 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystone.catalog import controllers
from keystone.catalog.core import *
from keystone.catalog import routers
from keystone.catalog import controllers # noqa
from keystone.catalog.core import * # noqa
from keystone.catalog import routers # noqa

View File

@ -251,9 +251,10 @@ class Catalog(catalog.Driver):
'user_id': user_id})
session = sql.get_session()
t = True # variable for singleton for PEP8, E712.
endpoints = (session.query(Endpoint).
options(sql.joinedload(Endpoint.service)).
filter(Endpoint.enabled == True).all()) # flake8: noqa
filter(Endpoint.enabled == t).all())
catalog = {}
@ -282,7 +283,8 @@ class Catalog(catalog.Driver):
'user_id': user_id})
session = sql.get_session()
services = (session.query(Service).filter(Service.enabled == True).
t = True # variable for singleton for PEP8, E712.
services = (session.query(Service).filter(Service.enabled == t).
options(sql.joinedload(Service.endpoints)).
all())

View File

@ -12,4 +12,4 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystone.common.cache.core import * # flake8: noqa
from keystone.common.cache.core import * # noqa

View File

@ -16,8 +16,8 @@
from dogpile.cache import region
from keystone.common.kvs.core import * # flake8: noqa
from keystone.common.kvs.legacy import Base, DictKvs, INMEMDB # flake8: noqa
from keystone.common.kvs.core import * # noqa
from keystone.common.kvs.legacy import Base, DictKvs, INMEMDB # noqa
# NOTE(morganfainberg): Provided backends are registered here in the __init__

View File

@ -1,5 +1,3 @@
# flake8: noqa
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -14,4 +12,4 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystone.common.ldap.core import *
from keystone.common.ldap.core import * # noqa

View File

@ -1,5 +1,3 @@
# flake8: noqa
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -14,4 +12,4 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystone.common.sql.core import *
from keystone.common.sql.core import * # noqa

View File

@ -1,5 +1,3 @@
# flake8: noqa
# Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -14,4 +12,4 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystone.contrib.access.core import *
from keystone.contrib.access.core import * # noqa

View File

@ -1,5 +1,3 @@
# flake8: noqa
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -14,4 +12,4 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystone.contrib.admin_crud.core import *
from keystone.contrib.admin_crud.core import * # noqa

View File

@ -1,5 +1,3 @@
# flake8: noqa
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -14,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystone.contrib.ec2 import controllers
from keystone.contrib.ec2.core import *
from keystone.contrib.ec2.routers import Ec2Extension
from keystone.contrib.ec2.routers import Ec2ExtensionV3
from keystone.contrib.ec2 import controllers # noqa
from keystone.contrib.ec2.core import * # noqa
from keystone.contrib.ec2.routers import Ec2Extension # noqa
from keystone.contrib.ec2.routers import Ec2ExtensionV3 # noqa

View File

@ -1,5 +1,3 @@
# flake8: noqa
# Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -14,4 +12,4 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystone.contrib.endpoint_filter.core import *
from keystone.contrib.endpoint_filter.core import * # noqa

View File

@ -12,4 +12,4 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystone.contrib.federation.core import * # flake8: noqa
from keystone.contrib.federation.core import * # noqa

View File

@ -12,4 +12,4 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystone.contrib.oauth1.core import * # flake8: noqa
from keystone.contrib.oauth1.core import * # noqa

View File

@ -10,4 +10,4 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystone.contrib.revoke.core import * # flake8: noqa
from keystone.contrib.revoke.core import * # noqa

View File

@ -1,5 +1,3 @@
# flake8: noqa
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -14,4 +12,4 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystone.contrib.s3.core import *
from keystone.contrib.s3.core import * # noqa

View File

@ -10,5 +10,5 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystone.contrib.simple_cert.core import * # flake8: noqa
from keystone.contrib.simple_cert.routers import SimpleCertExtension
from keystone.contrib.simple_cert.core import * # noqa
from keystone.contrib.simple_cert.routers import SimpleCertExtension # noqa

View File

@ -1,5 +1,3 @@
# flake8: noqa
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -14,4 +12,4 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystone.contrib.stats.core import *
from keystone.contrib.stats.core import * # noqa

View File

@ -1,5 +1,3 @@
# flake8: noqa
# Copyright 2012 Red Hat, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -14,4 +12,4 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystone.contrib.user_crud.core import *
from keystone.contrib.user_crud.core import * # noqa

View File

@ -1,5 +1,3 @@
# flake8: noqa
# Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -14,6 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystone.credential import controllers
from keystone.credential.core import *
from keystone.credential import routers
from keystone.credential import controllers # noqa
from keystone.credential.core import * # noqa
from keystone.credential import routers # noqa

View File

@ -1,5 +1,3 @@
# flake8: noqa
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -14,6 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystone.identity import controllers
from keystone.identity.core import *
from keystone.identity import routers
from keystone.identity import controllers # noqa
from keystone.identity.core import * # noqa
from keystone.identity import routers # noqa

View File

@ -23,7 +23,7 @@ from keystone.openstack.common.gettextutils import _
# Import assignment sql to ensure that the models defined in there are
# available for the reference from User and Group to Domain.id.
from keystone.assignment.backends import sql as assignment_sql # flake8: noqa
from keystone.assignment.backends import sql as assignment_sql # noqa
class User(sql.ModelBase, sql.DictBase):

View File

@ -1,5 +1,3 @@
# flake8: noqa
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -14,4 +12,4 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystone.middleware.core import *
from keystone.middleware.core import * # noqa

View File

@ -1,5 +1,3 @@
# flake8: noqa
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -14,6 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystone.policy import controllers
from keystone.policy.core import *
from keystone.policy import routers
from keystone.policy import controllers # noqa
from keystone.policy.core import * # noqa
from keystone.policy import routers # noqa

View File

@ -20,4 +20,4 @@ from keystone.openstack.common import gettextutils as _gettextutils
_gettextutils.enable_lazy()
from keystone.tests.core import * # flake8: noqa
from keystone.tests.core import * # noqa

View File

@ -11,4 +11,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from keystone.tests.ksfixtures.cache import Cache # flake8: noqa
from keystone.tests.ksfixtures.cache import Cache # noqa

View File

@ -1,5 +1,3 @@
# flake8: noqa
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -14,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystone.token import controllers
from keystone.token.core import *
from keystone.token import provider
from keystone.token import routers
from keystone.token import controllers # noqa
from keystone.token.core import * # noqa
from keystone.token import provider # noqa
from keystone.token import routers # noqa

View File

@ -1,5 +1,3 @@
# flake8: noqa
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -14,6 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystone.trust import controllers
from keystone.trust.core import *
from keystone.trust import routers
from keystone.trust import controllers # noqa
from keystone.trust.core import * # noqa
from keystone.trust import routers # noqa