Fix pep8 errors

There are some PEP8 errors that are not caught by our gate because of
the pep8 package version installed by hacking.

This patch fixes E402, W503, and F999 erors from our codebase.

Change-Id: I0b86730b1493f161645a87c3daa91ec3d774d3b1
This commit is contained in:
Gorka Eguileor 2017-03-08 17:50:27 +01:00
parent 3b60eba9aa
commit c022b73faf
5 changed files with 28 additions and 32 deletions

View File

@ -12,11 +12,12 @@
# License for the specific language governing permissions and limitations
# under the License.
__all__ = ['__version__']
import pbr.version
__all__ = ['__version__']
version_info = pbr.version.VersionInfo('python-cinderclient')
# We have a circular import problem when we first run python setup.py sdist
# It's harmless, so deflect it.

View File

@ -34,20 +34,18 @@ from keystoneauth1 import access
from keystoneauth1 import adapter
from keystoneauth1.identity import base
from keystoneauth1 import discover
from oslo_utils import encodeutils
from oslo_utils import importutils
from oslo_utils import strutils
osprofiler_web = importutils.try_import("osprofiler.web") # noqa
import requests
import six.moves.urllib.parse as urlparse
from cinderclient import api_versions
from cinderclient import exceptions
import cinderclient.extension
from cinderclient._i18n import _
from cinderclient._i18n import _LW
from oslo_utils import encodeutils
from oslo_utils import importutils
from oslo_utils import strutils
osprofiler_web = importutils.try_import("osprofiler.web")
import six.moves.urllib.parse as urlparse
try:
from eventlet import sleep

View File

@ -25,29 +25,28 @@ import getpass
import logging
import sys
import requests
import six
from cinderclient import api_versions
from cinderclient import client
from cinderclient import exceptions as exc
from cinderclient import utils
import cinderclient.auth_plugin
from cinderclient._i18n import _
from keystoneauth1 import discover
from keystoneauth1 import loading
from keystoneauth1 import session
from keystoneauth1.identity import v2 as v2_auth
from keystoneauth1.identity import v3 as v3_auth
from keystoneauth1.exceptions import DiscoveryFailure
import six.moves.urllib.parse as urlparse
from oslo_utils import encodeutils
from oslo_utils import importutils
osprofiler_profiler = importutils.try_import("osprofiler.profiler") # noqa
import requests
import six
import six.moves.urllib.parse as urlparse
osprofiler_profiler = importutils.try_import("osprofiler.profiler")
from cinderclient import api_versions
from cinderclient import client
from cinderclient import exceptions as exc
from cinderclient import _i18n
from cinderclient._i18n import _
from cinderclient import utils
import cinderclient.auth_plugin
# Enable i18n lazy translation
_i18n.enable_lazy()
@ -819,10 +818,9 @@ class OpenStackCinderShell(object):
username = self.options.os_username
password = self.options.os_password
tenant_id = (self.options.os_tenant_id
or self.options.os_project_id)
tenant_name = (self.options.os_tenant_name
or self.options.os_project_name)
tenant_id = self.options.os_tenant_id or self.options.os_project_id
tenant_name = (self.options.os_tenant_name or
self.options.os_project_name)
return v2_auth.Password(
v2_auth_url,
@ -839,8 +837,8 @@ class OpenStackCinderShell(object):
user_domain_id = self.options.os_user_domain_id
password = self.options.os_password
project_id = self.options.os_project_id or self.options.os_tenant_id
project_name = (self.options.os_project_name
or self.options.os_tenant_name)
project_name = (self.options.os_project_name or
self.options.os_tenant_name)
project_domain_name = self.options.os_project_domain_name
project_domain_id = self.options.os_project_domain_id

View File

@ -34,8 +34,8 @@ def credentials():
username = os.environ.get('OS_USERNAME')
password = os.environ.get('OS_PASSWORD')
tenant_name = (os.environ.get('OS_TENANT_NAME')
or os.environ.get('OS_PROJECT_NAME'))
tenant_name = (os.environ.get('OS_TENANT_NAME') or
os.environ.get('OS_PROJECT_NAME'))
auth_url = os.environ.get('OS_AUTH_URL')
config = six.moves.configparser.RawConfigParser()

View File

@ -25,14 +25,13 @@ from cinderclient.v1 import client
def _stub_volume(**kwargs):
volume = {
'id': '1234',
'id': '00000000-0000-0000-0000-000000000000',
'display_name': None,
'display_description': None,
"attachments": [],
"bootable": "false",
"availability_zone": "cinder",
"created_at": "2012-08-27T00:00:00.000000",
"id": '00000000-0000-0000-0000-000000000000',
"metadata": {},
"size": 1,
"snapshot_id": None,