Merge "Add flake8-import-order extension"
This commit is contained in:
commit
e87be61edb
@ -16,9 +16,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
Base utilities to build API operation managers and objects on top of.
|
||||
"""
|
||||
"""Base utilities to build API operation managers and objects on top of."""
|
||||
|
||||
# E1102: %s is not callable
|
||||
# pylint: disable=E1102
|
||||
@ -26,13 +24,13 @@ Base utilities to build API operation managers and objects on top of.
|
||||
import abc
|
||||
import copy
|
||||
|
||||
from oslo_utils import encodeutils
|
||||
from oslo_utils import strutils
|
||||
from requests import Response
|
||||
|
||||
|
||||
from cinderclient.apiclient import exceptions
|
||||
from cinderclient import utils
|
||||
from oslo_utils import encodeutils
|
||||
from oslo_utils import strutils
|
||||
|
||||
|
||||
def getid(obj):
|
||||
|
@ -22,6 +22,7 @@ import collections
|
||||
import getpass
|
||||
import logging
|
||||
import sys
|
||||
from urllib import parse as urlparse
|
||||
|
||||
from keystoneauth1 import discover
|
||||
from keystoneauth1 import exceptions
|
||||
@ -31,7 +32,6 @@ from keystoneauth1 import loading
|
||||
from keystoneauth1 import session
|
||||
from oslo_utils import importutils
|
||||
import requests
|
||||
from urllib import parse as urlparse
|
||||
|
||||
import cinderclient
|
||||
from cinderclient._i18n import _
|
||||
|
@ -26,8 +26,8 @@ def do_fake_action():
|
||||
return "fake_action 3.0 to 3.1"
|
||||
|
||||
|
||||
@api_versions.wraps("3.2", "3.3") # noqa: F811
|
||||
def do_fake_action(): # noqa
|
||||
@api_versions.wraps("3.2", "3.3")
|
||||
def do_fake_action(): # noqa: F811
|
||||
return "fake_action 3.2 to 3.3"
|
||||
|
||||
|
||||
|
@ -70,8 +70,8 @@ class FakeManagerWithApi(base.Manager):
|
||||
def return_api_version(self):
|
||||
return '3.1'
|
||||
|
||||
@api_versions.wraps('3.2') # noqa: F811
|
||||
def return_api_version(self): # noqa
|
||||
@api_versions.wraps('3.2')
|
||||
def return_api_version(self): # noqa: F811
|
||||
return '3.2'
|
||||
|
||||
|
||||
|
@ -15,11 +15,9 @@
|
||||
# under the License.
|
||||
|
||||
from cinderclient import extension
|
||||
from cinderclient.v2.contrib import list_extensions
|
||||
|
||||
from cinderclient.tests.unit import utils
|
||||
from cinderclient.tests.unit.v2 import fakes
|
||||
|
||||
from cinderclient.v2.contrib import list_extensions
|
||||
|
||||
extensions = [
|
||||
extension.Extension(list_extensions.__name__.split(".")[-1],
|
||||
|
@ -13,7 +13,6 @@
|
||||
# limitations under the License.
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from urllib import parse as urlparse
|
||||
|
||||
from cinderclient import client as base_client
|
||||
|
@ -13,10 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from cinderclient.v2.capabilities import Capabilities
|
||||
|
||||
from cinderclient.tests.unit import utils
|
||||
from cinderclient.tests.unit.v2 import fakes
|
||||
from cinderclient.v2.capabilities import Capabilities
|
||||
|
||||
cs = fakes.FakeClient()
|
||||
|
||||
|
@ -13,10 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from cinderclient.v2.pools import Pool
|
||||
|
||||
from cinderclient.tests.unit import utils
|
||||
from cinderclient.tests.unit.v2 import fakes
|
||||
from cinderclient.v2.pools import Pool
|
||||
|
||||
cs = fakes.FakeClient()
|
||||
|
||||
|
@ -14,11 +14,11 @@
|
||||
# under the License.
|
||||
|
||||
from unittest import mock
|
||||
from urllib import parse
|
||||
|
||||
import ddt
|
||||
import fixtures
|
||||
from requests_mock.contrib import fixture as requests_mock_fixture
|
||||
from urllib import parse
|
||||
|
||||
from cinderclient import client
|
||||
from cinderclient import exceptions
|
||||
|
@ -14,10 +14,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from cinderclient.v2 import volume_type_access
|
||||
|
||||
from cinderclient.tests.unit import utils
|
||||
from cinderclient.tests.unit.v2 import fakes
|
||||
from cinderclient.v2 import volume_type_access
|
||||
|
||||
cs = fakes.FakeClient()
|
||||
|
||||
|
@ -14,10 +14,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from cinderclient.v2 import volume_types
|
||||
|
||||
from cinderclient.tests.unit import utils
|
||||
from cinderclient.tests.unit.v2 import fakes
|
||||
from cinderclient.v2 import volume_types
|
||||
|
||||
cs = fakes.FakeClient()
|
||||
|
||||
|
@ -14,10 +14,9 @@
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from cinderclient.v3 import client
|
||||
|
||||
from cinderclient.tests.unit import fakes
|
||||
from cinderclient.tests.unit.v2 import fakes as fake_v2
|
||||
from cinderclient.v3 import client
|
||||
|
||||
|
||||
fake_attachment = {'attachment': {
|
||||
|
@ -13,12 +13,12 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import ddt
|
||||
|
||||
from cinderclient import api_versions
|
||||
from cinderclient import exceptions as exc
|
||||
from cinderclient.tests.unit import utils
|
||||
from cinderclient.tests.unit.v3 import fakes
|
||||
import ddt
|
||||
|
||||
|
||||
cs = fakes.FakeClient(api_version=api_versions.APIVersion('3.7'))
|
||||
|
||||
|
@ -16,10 +16,9 @@
|
||||
|
||||
from cinderclient import api_versions
|
||||
from cinderclient import exceptions as exc
|
||||
from cinderclient.v3 import group_types
|
||||
|
||||
from cinderclient.tests.unit import utils
|
||||
from cinderclient.tests.unit.v3 import fakes
|
||||
from cinderclient.v3 import group_types
|
||||
|
||||
cs = fakes.FakeClient(api_version=api_versions.APIVersion('3.11'))
|
||||
pre_cs = fakes.FakeClient(api_version=api_versions.APIVersion('3.10'))
|
||||
|
@ -14,10 +14,9 @@
|
||||
# under the License.
|
||||
|
||||
from cinderclient import api_versions
|
||||
from cinderclient.v3 import services
|
||||
|
||||
from cinderclient.tests.unit import utils
|
||||
from cinderclient.tests.unit.v3 import fakes
|
||||
from cinderclient.v3 import services
|
||||
|
||||
|
||||
class ServicesTest(utils.TestCase):
|
||||
|
@ -51,15 +51,14 @@ from cinderclient import base
|
||||
from cinderclient import client
|
||||
from cinderclient import exceptions
|
||||
from cinderclient import shell
|
||||
from cinderclient.tests.unit.fixture_data import keystone_client
|
||||
from cinderclient.tests.unit import utils
|
||||
from cinderclient.tests.unit.v3 import fakes
|
||||
from cinderclient import utils as cinderclient_utils
|
||||
from cinderclient.v3 import attachments
|
||||
from cinderclient.v3 import volume_snapshots
|
||||
from cinderclient.v3 import volumes
|
||||
|
||||
from cinderclient.tests.unit.fixture_data import keystone_client
|
||||
from cinderclient.tests.unit import utils
|
||||
from cinderclient.tests.unit.v3 import fakes
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
@mock.patch.object(client, 'Client', fakes.FakeClient)
|
||||
|
@ -51,8 +51,9 @@ class MessageManager(base.ManagerWithFind):
|
||||
url = self._build_list_url(resource_type, detailed=False)
|
||||
return self._list(url, resource_type)
|
||||
|
||||
@api_versions.wraps('3.5') # noqa: F811
|
||||
def list(self, search_opts=None, marker=None, limit=None, sort=None): # noqa
|
||||
@api_versions.wraps('3.5')
|
||||
def list(self, search_opts=None, marker=None, limit=None, # noqa: F811
|
||||
sort=None):
|
||||
"""Lists all messages.
|
||||
|
||||
:param search_opts: Search options to filter out volumes.
|
||||
|
@ -60,8 +60,8 @@ class VolumeBackupManager(volume_backups.VolumeBackupManager):
|
||||
return self._create_backup(volume_id, container, name, description,
|
||||
incremental, force, snapshot_id)
|
||||
|
||||
@api_versions.wraps("3.43") # noqa: F811
|
||||
def create(self, volume_id, container=None, # noqa
|
||||
@api_versions.wraps("3.43")
|
||||
def create(self, volume_id, container=None, # noqa: F811
|
||||
name=None, description=None,
|
||||
incremental=False, force=False,
|
||||
snapshot_id=None,
|
||||
@ -84,10 +84,10 @@ class VolumeBackupManager(volume_backups.VolumeBackupManager):
|
||||
return self._create_backup(volume_id, container, name, description,
|
||||
incremental, force, snapshot_id, metadata)
|
||||
|
||||
@api_versions.wraps("3.51") # noqa: F811
|
||||
def create(self, volume_id, container=None, name=None, description=None, # noqa
|
||||
incremental=False, force=False, snapshot_id=None, metadata=None,
|
||||
availability_zone=None):
|
||||
@api_versions.wraps("3.51")
|
||||
def create(self, volume_id, container=None, name=None, # noqa: F811
|
||||
description=None, incremental=False, force=False,
|
||||
snapshot_id=None, metadata=None, availability_zone=None):
|
||||
return self._create_backup(volume_id, container, name, description,
|
||||
incremental, force, snapshot_id, metadata,
|
||||
availability_zone)
|
||||
|
@ -159,8 +159,8 @@ class VolumeManager(volumes.VolumeManager):
|
||||
|
||||
return common_base.ListWithMeta([], response_list)
|
||||
|
||||
@api_versions.wraps("3.15") # noqa: F811
|
||||
def delete_metadata(self, volume, keys): # noqa
|
||||
@api_versions.wraps("3.15")
|
||||
def delete_metadata(self, volume, keys): # noqa: F811
|
||||
"""Delete specified keys from volumes metadata.
|
||||
|
||||
:param volume: The :class:`Volume`.
|
||||
@ -190,9 +190,9 @@ class VolumeManager(volumes.VolumeManager):
|
||||
'container_format': container_format,
|
||||
'disk_format': disk_format})
|
||||
|
||||
@api_versions.wraps("3.1") # noqa: F811
|
||||
def upload_to_image(self, volume, force, image_name, container_format, # noqa
|
||||
disk_format, visibility, protected):
|
||||
@api_versions.wraps("3.1")
|
||||
def upload_to_image(self, volume, force, image_name, # noqa: F811
|
||||
container_format, disk_format, visibility, protected):
|
||||
"""Upload volume to image service as image.
|
||||
:param volume: The :class:`Volume` to upload.
|
||||
"""
|
||||
@ -264,8 +264,8 @@ class VolumeManager(volumes.VolumeManager):
|
||||
|
||||
return self._get('/scheduler-stats/get_pools%s' % query_string, None)
|
||||
|
||||
@api_versions.wraps("3.33") # noqa: F811
|
||||
def get_pools(self, detail, search_opts): # noqa
|
||||
@api_versions.wraps("3.33")
|
||||
def get_pools(self, detail, search_opts): # noqa: F811
|
||||
"""Show pool information for backends."""
|
||||
# pylint: disable=function-redefined
|
||||
options = {'detail': detail}
|
||||
|
@ -4,6 +4,8 @@
|
||||
# Hacking already pins down pep8, pyflakes and flake8
|
||||
|
||||
hacking>=4.0.0,<4.1.0 # Apache-2.0
|
||||
flake8-import-order # LGPLv3
|
||||
|
||||
docutils>=0.15.2
|
||||
coverage>=5.2.1 # Apache-2.0
|
||||
ddt>=1.4.1 # MIT
|
||||
|
@ -42,10 +42,10 @@
|
||||
"""Display a subunit stream through a colorized unittest test runner."""
|
||||
|
||||
import heapq
|
||||
import subunit
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
import subunit
|
||||
import testtools
|
||||
|
||||
|
||||
|
4
tox.ini
4
tox.ini
@ -109,7 +109,9 @@ commands = {[testenv:functional]commands}
|
||||
[flake8]
|
||||
show-source = True
|
||||
ignore = H404,H405,E122,E123,E128,E251,W504
|
||||
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
|
||||
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build
|
||||
application-import-names = cinderclient
|
||||
import-order-style = pep8
|
||||
|
||||
[doc8]
|
||||
ignore-path=.tox,*.egg-info,doc/src/api,doc/source/drivers.rst,doc/build,.eggs/*/EGG-INFO/*.txt,doc/source/configuration/tables,./*.txt,releasenotes/build,doc/source/cli/details.rst
|
||||
|
Loading…
Reference in New Issue
Block a user