diff options
27 files changed, 80 insertions, 140 deletions
diff --git a/cinderclient/apiclient/base.py b/cinderclient/apiclient/base.py index c0bcd24..8caa0bc 100644 --- a/cinderclient/apiclient/base.py +++ b/cinderclient/apiclient/base.py @@ -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): diff --git a/cinderclient/shell.py b/cinderclient/shell.py index f0825d5..0c3fa45 100644 --- a/cinderclient/shell.py +++ b/cinderclient/shell.py @@ -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 _ diff --git a/cinderclient/tests/unit/fake_actions_module.py b/cinderclient/tests/unit/fake_actions_module.py index 07e7d29..a2c4bf7 100644 --- a/cinderclient/tests/unit/fake_actions_module.py +++ b/cinderclient/tests/unit/fake_actions_module.py @@ -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" diff --git a/cinderclient/tests/unit/test_utils.py b/cinderclient/tests/unit/test_utils.py index a9636db..1fb9433 100644 --- a/cinderclient/tests/unit/test_utils.py +++ b/cinderclient/tests/unit/test_utils.py @@ -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' diff --git a/cinderclient/tests/unit/v2/contrib/test_list_extensions.py b/cinderclient/tests/unit/v2/contrib/test_list_extensions.py index 313b6ef..4b6100f 100644 --- a/cinderclient/tests/unit/v2/contrib/test_list_extensions.py +++ b/cinderclient/tests/unit/v2/contrib/test_list_extensions.py @@ -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], diff --git a/cinderclient/tests/unit/v2/fakes.py b/cinderclient/tests/unit/v2/fakes.py index 99a87d0..700bf1e 100644 --- a/cinderclient/tests/unit/v2/fakes.py +++ b/cinderclient/tests/unit/v2/fakes.py @@ -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 @@ -28,9 +27,9 @@ REQUEST_ID = 'req-test-request-id' def _stub_volume(*args, **kwargs): volume = { "migration_status": None, - "attachments": [{u'server_id': u'1234', - u'id': u'3f88836f-adde-4296-9f6b-2c59a0bcda9a', - u'attachment_id': u'5678'}], + "attachments": [{'server_id': '1234', + 'id': '3f88836f-adde-4296-9f6b-2c59a0bcda9a', + 'attachment_id': '5678'}], "links": [ { "href": "http://localhost/v2/fake/volumes/1234", @@ -741,7 +740,7 @@ class FakeHTTPClient(base_client.HTTPClient): return (200, {}, {'volume_type': {'id': 1, 'name': 'test-type-1', 'description': 'test_type-1-desc', - 'extra_specs': {u'key': u'value'}}}) + 'extra_specs': {'key': 'value'}}}) def get_types_2(self, **kw): return (200, {}, {'volume_type': {'id': 2, @@ -1317,9 +1316,9 @@ class FakeHTTPClient(base_client.HTTPClient): 'storage_protocol': 'iSCSI', 'properties': { 'compression': { - u'title': u'Compression', - u'description': u'Enables compression.', - u'type': u'boolean'}, + 'title': 'Compression', + 'description': 'Enables compression.', + 'type': 'boolean'}, } } ) diff --git a/cinderclient/tests/unit/v2/test_capabilities.py b/cinderclient/tests/unit/v2/test_capabilities.py index 01a132d..98d8d71 100644 --- a/cinderclient/tests/unit/v2/test_capabilities.py +++ b/cinderclient/tests/unit/v2/test_capabilities.py @@ -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() diff --git a/cinderclient/tests/unit/v2/test_pools.py b/cinderclient/tests/unit/v2/test_pools.py index 543e316..e909871 100644 --- a/cinderclient/tests/unit/v2/test_pools.py +++ b/cinderclient/tests/unit/v2/test_pools.py @@ -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() diff --git a/cinderclient/tests/unit/v2/test_shell.py b/cinderclient/tests/unit/v2/test_shell.py index f54846e..78ecf74 100644 --- a/cinderclient/tests/unit/v2/test_shell.py +++ b/cinderclient/tests/unit/v2/test_shell.py @@ -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 diff --git a/cinderclient/tests/unit/v2/test_type_access.py b/cinderclient/tests/unit/v2/test_type_access.py index 35a4480..d904c1d 100644 --- a/cinderclient/tests/unit/v2/test_type_access.py +++ b/cinderclient/tests/unit/v2/test_type_access.py @@ -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() diff --git a/cinderclient/tests/unit/v2/test_types.py b/cinderclient/tests/unit/v2/test_types.py index 9ba13a9..cf13723 100644 --- a/cinderclient/tests/unit/v2/test_types.py +++ b/cinderclient/tests/unit/v2/test_types.py @@ -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() diff --git a/cinderclient/tests/unit/v3/fakes.py b/cinderclient/tests/unit/v3/fakes.py index 3fb6a36..7647fb3 100644 --- a/cinderclient/tests/unit/v3/fakes.py +++ b/cinderclient/tests/unit/v3/fakes.py @@ -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': { diff --git a/cinderclient/tests/unit/v3/test_clusters.py b/cinderclient/tests/unit/v3/test_clusters.py index c2045b6..21b560d 100644 --- a/cinderclient/tests/unit/v3/test_clusters.py +++ b/cinderclient/tests/unit/v3/test_clusters.py @@ -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')) diff --git a/cinderclient/tests/unit/v3/test_group_types.py b/cinderclient/tests/unit/v3/test_group_types.py index 5833c3f..2263d0e 100644 --- a/cinderclient/tests/unit/v3/test_group_types.py +++ b/cinderclient/tests/unit/v3/test_group_types.py @@ -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')) diff --git a/cinderclient/tests/unit/v3/test_services.py b/cinderclient/tests/unit/v3/test_services.py index 0715cd3..8af3682 100644 --- a/cinderclient/tests/unit/v3/test_services.py +++ b/cinderclient/tests/unit/v3/test_services.py @@ -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): diff --git a/cinderclient/tests/unit/v3/test_shell.py b/cinderclient/tests/unit/v3/test_shell.py index 82e3943..756f512 100644 --- a/cinderclient/tests/unit/v3/test_shell.py +++ b/cinderclient/tests/unit/v3/test_shell.py @@ -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) diff --git a/cinderclient/v3/messages.py b/cinderclient/v3/messages.py index 2c620c2..93aeefa 100644 --- a/cinderclient/v3/messages.py +++ b/cinderclient/v3/messages.py @@ -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. diff --git a/cinderclient/v3/volume_backups.py b/cinderclient/v3/volume_backups.py index 7dd8560..22d25a3 100644 --- a/cinderclient/v3/volume_backups.py +++ b/cinderclient/v3/volume_backups.py @@ -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) diff --git a/cinderclient/v3/volumes.py b/cinderclient/v3/volumes.py index 974bcfc..8ea3880 100644 --- a/cinderclient/v3/volumes.py +++ b/cinderclient/v3/volumes.py @@ -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} diff --git a/doc/requirements.txt b/doc/requirements.txt index dad0837..2eec3c6 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -3,5 +3,5 @@ # process, which may cause wedges in the gate later. # These are needed for docs generation openstackdocstheme>=2.2.1 # Apache-2.0 -reno>=3.1.0 # Apache-2.0 +reno>=3.2.0 # Apache-2.0 sphinx>=2.0.0,!=2.1.0 # BSD diff --git a/doc/source/conf.py b/doc/source/conf.py index 2868e84..0c5ce55 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -81,8 +81,8 @@ html_theme = 'openstackdocs' # -- Options for manual page output ------------------------------------------ man_pages = [ - ('cli/details', 'cinder', u'Client for OpenStack Block Storage API', - [u'OpenStack Contributors'], 1), + ('cli/details', 'cinder', 'Client for OpenStack Block Storage API', + ['OpenStack Contributors'], 1), ] # -- Options for openstackdocstheme ------------------------------------------- @@ -104,8 +104,8 @@ openstackdocs_pdf_link = True # (source start file, target name, title, author, documentclass # [howto/manual]). latex_documents = [ - ('index', 'doc-python-cinderclient.tex', u'Cinder Client Documentation', - u'Cinder Contributors', 'manual'), + ('index', 'doc-python-cinderclient.tex', 'Cinder Client Documentation', + 'Cinder Contributors', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of diff --git a/lower-constraints.txt b/lower-constraints.txt index 947303a..5533a73 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -1,63 +1,19 @@ -asn1crypto==0.23.0 -attrs==20.3.0 -certifi==2020.6.20 -cffi==1.14.2 -chardet==3.0.4 -cliff==3.4.0 -cmd2==1.3.8 -colorama==0.4.4 -coverage==5.2.1 -cryptography==3.1 +coverage==5.5 ddt==1.4.1 -debtcollector==2.2.0 doc8==0.8.1 -docutils==0.15.2 -dulwich==0.20.6 -extras==1.0.0 -fasteners==0.14.1 +docutils==0.16 fixtures==3.0.0 -future==0.18.2 -idna==2.10 -iso8601==0.1.12 -jsonschema==3.2.0 -keystoneauth1==4.2.1 -linecache2==1.0.0 -mccabe==0.6.0 -monotonic==0.6 -msgpack-python==0.4.0 -netaddr==0.8.0 -netifaces==0.10.9 -oslo.concurrency==4.3.0 -oslo.config==8.3.2 -oslo.context==3.1.1 +keystoneauth1==4.3.1 oslo.i18n==5.0.1 -oslo.log==4.4.0 -oslo.serialization==4.0.1 -oslo.utils==4.7.0 -paramiko==2.7.2 +oslo.serialization==4.1.0 +oslo.utils==4.8.0 pbr==5.5.0 -prettytable==0.7.2 -pyasn1==0.4.8 -pycparser==2.20 -pyinotify==0.9.6 -pyparsing==2.4.7 -pyperclip==1.8.0 -python-dateutil==2.8.1 -python-mimeparse==1.6.0 -python-subunit==1.4.0 -pytz==2020.1 -PyYAML==5.3.1 +PrettyTable==0.7.2 reno==3.2.0 +requests==2.25.1 requests-mock==1.2.0 -requests==2.23.0 -rfc3986==1.4.0 simplejson==3.5.1 -stestr==3.0.1 -stevedore==3.2.2 +stestr==3.1.0 +stevedore==3.3.0 tempest==26.0.0 -testrepository==0.0.18 testtools==2.4.0 -traceback2==1.4.0 -unittest2==1.1.0 -urllib3==1.25.10 -wrapt==1.12.1 diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py index 58ed268..a0a7d09 100644 --- a/releasenotes/source/conf.py +++ b/releasenotes/source/conf.py @@ -55,9 +55,9 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -project = u'Cinder Client Release Notes' +project = 'Cinder Client Release Notes' openstackdocs_auto_name = False -copyright = u'2015, Cinder Developers' +copyright = '2015, Cinder Developers' # Release notes are version independent, no need to set version and release release = '' @@ -201,8 +201,8 @@ latex_elements = { # author, documentclass [howto, manual, or own class]). latex_documents = [ ('index', 'CinderClientReleaseNotes.tex', - u'Cinder Client Release Notes Documentation', - u'Cinder Developers', 'manual'), + 'Cinder Client Release Notes Documentation', + 'Cinder Developers', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -232,8 +232,8 @@ latex_documents = [ # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'cinderclientreleasenotes', - u'Cinder Client Release Notes Documentation', - [u'Cinder Developers'], 1) + 'Cinder Client Release Notes Documentation', + ['Cinder Developers'], 1) ] # If true, show URL addresses after external links. @@ -247,8 +247,8 @@ man_pages = [ # dir menu entry, description, category) texinfo_documents = [ ('index', 'CinderClientReleaseNotes', - u'Cinder Client Release Notes Documentation', - u'Cinder Developers', 'CinderClientReleaseNotes', + 'Cinder Client Release Notes Documentation', + 'Cinder Developers', 'CinderClientReleaseNotes', 'Block Storage Service client.', 'Miscellaneous'), ] diff --git a/requirements.txt b/requirements.txt index 1a5d13d..6f8e90b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,9 +3,9 @@ # process, which may cause wedges in the gate later. pbr>=5.5.0 # Apache-2.0 PrettyTable>=0.7.2 # BSD -keystoneauth1>=4.2.1 # Apache-2.0 +keystoneauth1>=4.3.1 # Apache-2.0 simplejson>=3.5.1 # MIT oslo.i18n>=5.0.1 # Apache-2.0 -oslo.utils>=4.7.0 # Apache-2.0 -requests>=2.23.0 # Apache-2.0 -stevedore>=3.2.2 # Apache-2.0 +oslo.utils>=4.8.0 # Apache-2.0 +requests>=2.25.1 # Apache-2.0 +stevedore>=3.3.0 # Apache-2.0 diff --git a/test-requirements.txt b/test-requirements.txt index c660259..e0d7c93 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,20 +4,14 @@ # Hacking already pins down pep8, pyflakes and flake8 hacking>=4.0.0,<4.1.0 # Apache-2.0 -docutils>=0.15.2 -coverage>=5.2.1 # Apache-2.0 +flake8-import-order # LGPLv3 +docutils>=0.16 +coverage>=5.5 # Apache-2.0 ddt>=1.4.1 # MIT fixtures>=3.0.0 # Apache-2.0/BSD -reno>=3.2.0 # Apache-2.0 requests-mock>=1.2.0 # Apache-2.0 tempest>=26.0.0 # Apache-2.0 testtools>=2.4.0 # MIT -stestr>=3.0.1 # Apache-2.0 -oslo.serialization>=4.0.1 # Apache-2.0 +stestr>=3.1.0 # Apache-2.0 +oslo.serialization>=4.1.0 # Apache-2.0 doc8>=0.8.1 # Apache-2.0 -# -# These are here to enable the resolver to work faster. -# They are not directly used by python-cinderclient. -debtcollector>=2.2.0 -dulwich>=0.20.6 -mccabe>=0.6.0 diff --git a/tools/colorizer.py b/tools/colorizer.py index 2a667b4..cf89535 100755 --- a/tools/colorizer.py +++ b/tools/colorizer.py @@ -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 @@ -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 |