diff --git a/doc/source/conf.py b/doc/source/conf.py index 0500d482d..6ee314555 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # OpenStack Command Line Client documentation build configuration file, created # by sphinx-quickstart on Wed May 16 12:05:58 2012. diff --git a/doc/source/contributor/command-errors.rst b/doc/source/contributor/command-errors.rst index c4adb7d19..453ae3a6e 100644 --- a/doc/source/contributor/command-errors.rst +++ b/doc/source/contributor/command-errors.rst @@ -45,7 +45,7 @@ raised that includes the name of the file that was attempted to be opened. public_key = parsed_args.public_key if public_key: try: - with io.open( + with open( os.path.expanduser(parsed_args.public_key), "rb" ) as p: diff --git a/openstackclient/api/api.py b/openstackclient/api/api.py index f02c87dcc..15dcdf32f 100644 --- a/openstackclient/api/api.py +++ b/openstackclient/api/api.py @@ -21,7 +21,7 @@ from openstackclient.i18n import _ -class KeystoneSession(object): +class KeystoneSession: """Wrapper for the Keystone Session Restore some requests.session.Session compatibility; @@ -40,7 +40,7 @@ def __init__(self, session=None, endpoint=None, **kwargs): requests on this API. """ - super(KeystoneSession, self).__init__() + super().__init__() # a requests.Session-style interface self.session = session @@ -95,7 +95,7 @@ def __init__( requests on this API. """ - super(BaseAPI, self).__init__(session=session, endpoint=endpoint) + super().__init__(session=session, endpoint=endpoint) self.service_type = service_type @@ -303,7 +303,7 @@ def find( """ try: - ret = self._request('GET', "/%s/%s" % (path, value)).json() + ret = self._request('GET', f"/{path}/{value}").json() except ks_exceptions.NotFound: kwargs = {attr: value} try: diff --git a/openstackclient/api/compute_v2.py b/openstackclient/api/compute_v2.py index aa0554b17..1ad572b13 100644 --- a/openstackclient/api/compute_v2.py +++ b/openstackclient/api/compute_v2.py @@ -30,7 +30,7 @@ class APIv2(api.BaseAPI): """Compute v2 API""" def __init__(self, **kwargs): - super(APIv2, self).__init__(**kwargs) + super().__init__(**kwargs) # Overrides @@ -76,7 +76,7 @@ def find( """ try: - ret = self._request('GET', "/%s/%s" % (path, value)).json() + ret = self._request('GET', f"/{path}/{value}").json() if isinstance(ret, dict): # strip off the enclosing dict key = list(ret.keys())[0] @@ -136,7 +136,7 @@ def floating_ip_add( return self._request( "POST", - "/%s/%s/action" % (url, server['id']), + "/{}/{}/action".format(url, server['id']), json={'addFloatingIp': body}, ) @@ -180,7 +180,7 @@ def floating_ip_delete( url = "/os-floating-ips" if floating_ip_id is not None: - return self.delete('/%s/%s' % (url, floating_ip_id)) + return self.delete(f'/{url}/{floating_ip_id}') return None @@ -248,7 +248,7 @@ def floating_ip_remove( return self._request( "POST", - "/%s/%s/action" % (url, server['id']), + "/{}/{}/action".format(url, server['id']), json={'removeFloatingIp': body}, ) @@ -316,7 +316,7 @@ def host_set( else: return self._request( "PUT", - "/%s/%s" % (url, host), + f"/{url}/{host}", json=params, ).json() @@ -398,7 +398,7 @@ def network_delete( value=network, )['id'] if network is not None: - return self.delete('/%s/%s' % (url, network)) + return self.delete(f'/{url}/{network}') return None @@ -487,7 +487,7 @@ def security_group_delete( value=security_group, )['id'] if security_group is not None: - return self.delete('/%s/%s' % (url, security_group)) + return self.delete(f'/{url}/{security_group}') return None @@ -535,7 +535,7 @@ def security_group_list( params = {} if search_opts is not None: - params = dict((k, v) for (k, v) in search_opts.items() if v) + params = {k: v for (k, v) in search_opts.items() if v} if limit: params['limit'] = limit if marker: @@ -549,7 +549,7 @@ def security_group_set( security_group=None, # name=None, # description=None, - **params + **params, ): """Update a security group @@ -579,7 +579,7 @@ def security_group_set( security_group[k] = v return self._request( "PUT", - "/%s/%s" % (url, security_group['id']), + "/{}/{}".format(url, security_group['id']), json={'security_group': security_group}, ).json()['security_group'] return None @@ -648,6 +648,6 @@ def security_group_rule_delete( url = "/os-security-group-rules" if security_group_rule_id is not None: - return self.delete('/%s/%s' % (url, security_group_rule_id)) + return self.delete(f'/{url}/{security_group_rule_id}') return None diff --git a/openstackclient/api/image_v1.py b/openstackclient/api/image_v1.py index 1bd15069b..a8b61aca9 100644 --- a/openstackclient/api/image_v1.py +++ b/openstackclient/api/image_v1.py @@ -22,7 +22,7 @@ class APIv1(api.BaseAPI): _endpoint_suffix = '/v1' def __init__(self, endpoint=None, **kwargs): - super(APIv1, self).__init__(endpoint=endpoint, **kwargs) + super().__init__(endpoint=endpoint, **kwargs) self.endpoint = self.endpoint.rstrip('/') self._munge_url() diff --git a/openstackclient/api/object_store_v1.py b/openstackclient/api/object_store_v1.py index ac40cf6c5..bc49ac850 100644 --- a/openstackclient/api/object_store_v1.py +++ b/openstackclient/api/object_store_v1.py @@ -13,7 +13,6 @@ """Object Store v1 API Library""" -import io import logging import os import sys @@ -33,7 +32,7 @@ class APIv1(api.BaseAPI): """Object Store v1 API""" def __init__(self, **kwargs): - super(APIv1, self).__init__(**kwargs) + super().__init__(**kwargs) def container_create( self, container=None, public=False, storage_policy=None @@ -257,11 +256,11 @@ def object_create( # object's name in the container. object_name_str = name if name else object - full_url = "%s/%s" % ( + full_url = "{}/{}".format( urllib.parse.quote(container), urllib.parse.quote(object_name_str), ) - with io.open(object, 'rb') as f: + with open(object, 'rb') as f: response = self.create( full_url, method='PUT', diff --git a/openstackclient/common/availability_zone.py b/openstackclient/common/availability_zone.py index 5d62ecd12..acc661a8d 100644 --- a/openstackclient/common/availability_zone.py +++ b/openstackclient/common/availability_zone.py @@ -47,7 +47,7 @@ def _xform_compute_availability_zone(az, include_extra): for svc, state in services.items(): info = copy.deepcopy(host_info) info['service_name'] = svc - info['service_status'] = '%s %s %s' % ( + info['service_status'] = '{} {} {}'.format( 'enabled' if state['active'] else 'disabled', ':-)' if state['available'] else 'XXX', state['updated_at'], diff --git a/openstackclient/common/clientmanager.py b/openstackclient/common/clientmanager.py index 35c79247f..8a67dc0c0 100644 --- a/openstackclient/common/clientmanager.py +++ b/openstackclient/common/clientmanager.py @@ -51,7 +51,7 @@ def __init__( api_version=None, pw_func=None, ): - super(ClientManager, self).__init__( + super().__init__( cli_options=cli_options, api_version=api_version, pw_func=pw_func, @@ -94,7 +94,7 @@ def setup_auth(self): except TypeError as e: self._fallback_load_auth_plugin(e) - return super(ClientManager, self).setup_auth() + return super().setup_auth() def _fallback_load_auth_plugin(self, e): # NOTES(RuiChen): Hack to avoid auth plugins choking on data they don't @@ -170,7 +170,9 @@ def get_plugin_modules(group): module = importlib.import_module(module_name) except Exception as err: sys.stderr.write( - "WARNING: Failed to import plugin %s: %s.\n" % (ep.name, err) + "WARNING: Failed to import plugin {}: {}.\n".format( + ep.name, err + ) ) continue diff --git a/openstackclient/common/configuration.py b/openstackclient/common/configuration.py index 4aa690a56..418f7fdd0 100644 --- a/openstackclient/common/configuration.py +++ b/openstackclient/common/configuration.py @@ -27,7 +27,7 @@ class ShowConfiguration(command.ShowOne): auth_required = False def get_parser(self, prog_name): - parser = super(ShowConfiguration, self).get_parser(prog_name) + parser = super().get_parser(prog_name) mask_group = parser.add_mutually_exclusive_group() mask_group.add_argument( "--mask", diff --git a/openstackclient/common/extension.py b/openstackclient/common/extension.py index f00bacaa9..ad7b1a934 100644 --- a/openstackclient/common/extension.py +++ b/openstackclient/common/extension.py @@ -148,7 +148,7 @@ class ShowExtension(command.ShowOne): _description = _("Show API extension") def get_parser(self, prog_name): - parser = super(ShowExtension, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'extension', metavar='', diff --git a/openstackclient/common/limits.py b/openstackclient/common/limits.py index 7353b3505..7050d2fd0 100644 --- a/openstackclient/common/limits.py +++ b/openstackclient/common/limits.py @@ -28,7 +28,7 @@ class ShowLimits(command.Lister): _description = _("Show compute and block storage limits") def get_parser(self, prog_name): - parser = super(ShowLimits, self).get_parser(prog_name) + parser = super().get_parser(prog_name) type_group = parser.add_mutually_exclusive_group(required=True) type_group.add_argument( "--absolute", diff --git a/openstackclient/common/module.py b/openstackclient/common/module.py index 585fdf823..e9102561e 100644 --- a/openstackclient/common/module.py +++ b/openstackclient/common/module.py @@ -29,7 +29,7 @@ class ListCommand(command.Lister): auth_required = False def get_parser(self, prog_name): - parser = super(ListCommand, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--group', metavar='', @@ -72,7 +72,7 @@ class ListModule(command.ShowOne): auth_required = False def get_parser(self, prog_name): - parser = super(ListModule, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--all', action='store_true', diff --git a/openstackclient/common/progressbar.py b/openstackclient/common/progressbar.py index 98747ea12..2852bb250 100644 --- a/openstackclient/common/progressbar.py +++ b/openstackclient/common/progressbar.py @@ -16,7 +16,7 @@ import sys -class _ProgressBarBase(object): +class _ProgressBarBase: """A progress bar provider for a wrapped object. Base abstract class used by specific class wrapper to show @@ -39,7 +39,7 @@ def _display_progress_bar(self, size_read): self._percent += size_read / self._totalsize # Output something like this: [==========> ] 49% sys.stdout.write( - '\r[{0:<30}] {1:.0%}'.format( + '\r[{:<30}] {:.0%}'.format( '=' * int(round(self._percent * 29)) + '>', self._percent ) ) diff --git a/openstackclient/common/project_cleanup.py b/openstackclient/common/project_cleanup.py index fdd5b3b7f..2ac156cba 100644 --- a/openstackclient/common/project_cleanup.py +++ b/openstackclient/common/project_cleanup.py @@ -46,7 +46,7 @@ class ProjectCleanup(command.Command): _description = _("Clean resources associated with a project") def get_parser(self, prog_name): - parser = super(ProjectCleanup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) action_group = parser.add_mutually_exclusive_group() action_group.add_argument( '--dry-run', diff --git a/openstackclient/common/quota.py b/openstackclient/common/quota.py index 409fea6c3..78688dfa8 100644 --- a/openstackclient/common/quota.py +++ b/openstackclient/common/quota.py @@ -383,7 +383,7 @@ def take_action(self, parsed_args): and ex.http_status <= 499 ): # Project not found, move on to next one - LOG.warning("Project %s not found: %s" % (p, ex)) + LOG.warning(f"Project {p} not found: {ex}") continue else: raise @@ -446,7 +446,7 @@ def take_action(self, parsed_args): except Exception as ex: if type(ex).__name__ == 'NotFound': # Project not found, move on to next one - LOG.warning("Project %s not found: %s" % (p, ex)) + LOG.warning(f"Project {p} not found: {ex}") continue else: raise @@ -500,7 +500,7 @@ def take_action(self, parsed_args): except Exception as ex: if type(ex).__name__ == 'NotFound': # Project not found, move on to next one - LOG.warning("Project %s not found: %s" % (p, ex)) + LOG.warning(f"Project {p} not found: {ex}") continue else: raise @@ -590,7 +590,7 @@ def _build_options_list(self): return rets def get_parser(self, prog_name): - parser = super(SetQuota, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'project', metavar='', diff --git a/openstackclient/common/versions.py b/openstackclient/common/versions.py index b7ebf02eb..662233875 100644 --- a/openstackclient/common/versions.py +++ b/openstackclient/common/versions.py @@ -23,7 +23,7 @@ class ShowVersions(command.Lister): _description = _("Show available versions of services") def get_parser(self, prog_name): - parser = super(ShowVersions, self).get_parser(prog_name) + parser = super().get_parser(prog_name) interface_group = parser.add_mutually_exclusive_group() interface_group.add_argument( "--all-interfaces", diff --git a/openstackclient/compute/v2/agent.py b/openstackclient/compute/v2/agent.py index 9b07df6e1..809c20f98 100644 --- a/openstackclient/compute/v2/agent.py +++ b/openstackclient/compute/v2/agent.py @@ -36,7 +36,7 @@ class CreateAgent(command.ShowOne): """ def get_parser(self, prog_name): - parser = super(CreateAgent, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument("os", metavar="", help=_("Type of OS")) parser.add_argument( "architecture", @@ -77,7 +77,7 @@ class DeleteAgent(command.Command): """ def get_parser(self, prog_name): - parser = super(DeleteAgent, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "id", metavar="", nargs='+', help=_("ID of agent(s) to delete") ) @@ -114,7 +114,7 @@ class ListAgent(command.Lister): """ def get_parser(self, prog_name): - parser = super(ListAgent, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "--hypervisor", metavar="", @@ -155,7 +155,7 @@ class SetAgent(command.Command): """ def get_parser(self, prog_name): - parser = super(SetAgent, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument("id", metavar="", help=_("ID of the agent")) parser.add_argument( "--agent-version", diff --git a/openstackclient/compute/v2/aggregate.py b/openstackclient/compute/v2/aggregate.py index 49b58d179..967eec02c 100644 --- a/openstackclient/compute/v2/aggregate.py +++ b/openstackclient/compute/v2/aggregate.py @@ -55,7 +55,7 @@ class AddAggregateHost(command.ShowOne): _description = _("Add host to aggregate") def get_parser(self, prog_name): - parser = super(AddAggregateHost, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'aggregate', metavar='', @@ -88,7 +88,7 @@ class CreateAggregate(command.ShowOne): _description = _("Create a new aggregate") def get_parser(self, prog_name): - parser = super(CreateAggregate, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "name", metavar="", help=_("New aggregate name") ) @@ -136,7 +136,7 @@ class DeleteAggregate(command.Command): _description = _("Delete existing aggregate(s)") def get_parser(self, prog_name): - parser = super(DeleteAggregate, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'aggregate', metavar='', @@ -178,7 +178,7 @@ class ListAggregate(command.Lister): _description = _("List all aggregates") def get_parser(self, prog_name): - parser = super(ListAggregate, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--long', action='store_true', @@ -232,7 +232,7 @@ class RemoveAggregateHost(command.ShowOne): _description = _("Remove host from aggregate") def get_parser(self, prog_name): - parser = super(RemoveAggregateHost, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'aggregate', metavar='', @@ -265,7 +265,7 @@ class SetAggregate(command.Command): _description = _("Set aggregate properties") def get_parser(self, prog_name): - parser = super(SetAggregate, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'aggregate', metavar='', @@ -337,7 +337,7 @@ class ShowAggregate(command.ShowOne): _description = _("Display aggregate details") def get_parser(self, prog_name): - parser = super(ShowAggregate, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'aggregate', metavar='', @@ -366,7 +366,7 @@ class UnsetAggregate(command.Command): _description = _("Unset aggregate properties") def get_parser(self, prog_name): - parser = super(UnsetAggregate, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "aggregate", metavar="", @@ -403,7 +403,7 @@ class CacheImageForAggregate(command.Command): # not be anything to return. def get_parser(self, prog_name): - parser = super(CacheImageForAggregate, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'aggregate', metavar='', diff --git a/openstackclient/compute/v2/console.py b/openstackclient/compute/v2/console.py index bd6d5584e..3059cb100 100644 --- a/openstackclient/compute/v2/console.py +++ b/openstackclient/compute/v2/console.py @@ -36,7 +36,7 @@ class ShowConsoleLog(command.Command): _description = _("Show server's console output") def get_parser(self, prog_name): - parser = super(ShowConsoleLog, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -78,7 +78,7 @@ class ShowConsoleURL(command.ShowOne): _description = _("Show server's remote console URL") def get_parser(self, prog_name): - parser = super(ShowConsoleURL, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', diff --git a/openstackclient/compute/v2/flavor.py b/openstackclient/compute/v2/flavor.py index aa8c010f1..e4df62885 100644 --- a/openstackclient/compute/v2/flavor.py +++ b/openstackclient/compute/v2/flavor.py @@ -58,7 +58,7 @@ class CreateFlavor(command.ShowOne): _description = _("Create new flavor") def get_parser(self, prog_name): - parser = super(CreateFlavor, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "name", metavar="", help=_("New flavor name") ) @@ -214,7 +214,7 @@ class DeleteFlavor(command.Command): _description = _("Delete flavor(s)") def get_parser(self, prog_name): - parser = super(DeleteFlavor, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "flavor", metavar="", @@ -253,7 +253,7 @@ class ListFlavor(command.Lister): _description = _("List flavors") def get_parser(self, prog_name): - parser = super(ListFlavor, self).get_parser(prog_name) + parser = super().get_parser(prog_name) public_group = parser.add_mutually_exclusive_group() public_group.add_argument( "--public", @@ -375,7 +375,7 @@ class SetFlavor(command.Command): _description = _("Set flavor properties") def get_parser(self, prog_name): - parser = super(SetFlavor, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "flavor", metavar="", @@ -491,7 +491,7 @@ class ShowFlavor(command.ShowOne): _description = _("Display flavor details") def get_parser(self, prog_name): - parser = super(ShowFlavor, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "flavor", metavar="", @@ -540,7 +540,7 @@ class UnsetFlavor(command.Command): _description = _("Unset flavor properties") def get_parser(self, prog_name): - parser = super(UnsetFlavor, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "flavor", metavar="", diff --git a/openstackclient/compute/v2/host.py b/openstackclient/compute/v2/host.py index a5946d1d4..20925682d 100644 --- a/openstackclient/compute/v2/host.py +++ b/openstackclient/compute/v2/host.py @@ -65,7 +65,7 @@ class SetHost(command.Command): _description = _("Set host properties") def get_parser(self, prog_name): - parser = super(SetHost, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "host", metavar="", help=_("Host to modify (name only)") ) diff --git a/openstackclient/compute/v2/keypair.py b/openstackclient/compute/v2/keypair.py index 5d7815b26..8e4389953 100644 --- a/openstackclient/compute/v2/keypair.py +++ b/openstackclient/compute/v2/keypair.py @@ -16,7 +16,6 @@ """Keypair action implementations""" import collections -import io import logging import os @@ -77,7 +76,7 @@ class CreateKeypair(command.ShowOne): _description = _("Create new public or private key for server ssh access") def get_parser(self, prog_name): - parser = super(CreateKeypair, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar='', help=_("New public or private key name") ) @@ -130,9 +129,9 @@ def take_action(self, parsed_args): if parsed_args.public_key: generated_keypair = None try: - with io.open(os.path.expanduser(parsed_args.public_key)) as p: + with open(os.path.expanduser(parsed_args.public_key)) as p: public_key = p.read() - except IOError as e: + except OSError as e: msg = _("Key file %(public_key)s not found: %(exception)s") raise exceptions.CommandError( msg @@ -150,11 +149,11 @@ def take_action(self, parsed_args): # If user have us a file, save private key into specified file if parsed_args.private_key: try: - with io.open( + with open( os.path.expanduser(parsed_args.private_key), 'w+' ) as p: p.write(generated_keypair.private_key) - except IOError as e: + except OSError as e: msg = _( "Key file %(private_key)s can not be saved: " "%(exception)s" @@ -212,7 +211,7 @@ class DeleteKeypair(command.Command): _description = _("Delete public or private key(s)") def get_parser(self, prog_name): - parser = super(DeleteKeypair, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar='', @@ -388,7 +387,7 @@ class ShowKeypair(command.ShowOne): _description = _("Display key details") def get_parser(self, prog_name): - parser = super(ShowKeypair, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar='', diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py index 1d97c349c..32aaf77f6 100644 --- a/openstackclient/compute/v2/server.py +++ b/openstackclient/compute/v2/server.py @@ -17,7 +17,6 @@ import argparse import getpass -import io import json import logging import os @@ -233,7 +232,7 @@ def _prep_server_detail(compute_client, image_client, server, refresh=True): image_id = image_info.get('id', '') try: image = image_client.get_image(image_id) - info['image'] = "%s (%s)" % (image.name, image_id) + info['image'] = f"{image.name} ({image_id})" except Exception: info['image'] = image_id else: @@ -251,7 +250,7 @@ def _prep_server_detail(compute_client, image_client, server, refresh=True): flavor_id = flavor_info.get('id', '') try: flavor = utils.find_resource(compute_client.flavors, flavor_id) - info['flavor'] = "%s (%s)" % (flavor.name, flavor_id) + info['flavor'] = f"{flavor.name} ({flavor_id})" except Exception: info['flavor'] = flavor_id else: # microversion >= 2.47 @@ -358,7 +357,7 @@ class AddFixedIP(command.ShowOne): _description = _("Add fixed IP address to server") def get_parser(self, prog_name): - parser = super(AddFixedIP, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "server", metavar="", @@ -551,7 +550,7 @@ class AddPort(command.Command): _description = _("Add port to server") def get_parser(self, prog_name): - parser = super(AddPort, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "server", metavar="", @@ -605,7 +604,7 @@ class AddNetwork(command.Command): _description = _("Add network to server") def get_parser(self, prog_name): - parser = super(AddNetwork, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "server", metavar="", @@ -660,7 +659,7 @@ class AddServerSecurityGroup(command.Command): _description = _("Add security group to server") def get_parser(self, prog_name): - parser = super(AddServerSecurityGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -696,7 +695,7 @@ class AddServerVolume(command.ShowOne): ) def get_parser(self, prog_name): - parser = super(AddServerVolume, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -1050,7 +1049,7 @@ class CreateServer(command.ShowOne): _description = _("Create a new server") def get_parser(self, prog_name): - parser = super(CreateServer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server_name', metavar='', @@ -1519,7 +1518,7 @@ def _match_image(image_api, wanted_properties): img_dict_items.extend(list(img.properties.items())) for key, value in img_dict_items: try: - set([key, value]) + {key, value} except TypeError: if key != 'properties': LOG.debug( @@ -1595,8 +1594,8 @@ def _match_image(image_api, wanted_properties): for f in parsed_args.file: dst, src = f.split('=', 1) try: - files[dst] = io.open(src, 'rb') - except IOError as e: + files[dst] = open(src, 'rb') + except OSError as e: msg = _("Can't open '%(source)s': %(exception)s") raise exceptions.CommandError( msg % {'source': src, 'exception': e} @@ -1617,8 +1616,8 @@ def _match_image(image_api, wanted_properties): userdata = None if parsed_args.user_data: try: - userdata = io.open(parsed_args.user_data) - except IOError as e: + userdata = open(parsed_args.user_data) + except OSError as e: msg = _("Can't open '%(data)s': %(exception)s") raise exceptions.CommandError( msg % {'data': parsed_args.user_data, 'exception': e} @@ -2065,7 +2064,7 @@ class CreateServerDump(command.Command): """ def get_parser(self, prog_name): - parser = super(CreateServerDump, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -2085,7 +2084,7 @@ class DeleteServer(command.Command): _description = _("Delete server(s)") def get_parser(self, prog_name): - parser = super(DeleteServer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -2190,7 +2189,7 @@ class ListServer(command.Lister): _description = _("List servers") def get_parser(self, prog_name): - parser = super(ListServer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--reservation-id', metavar='', @@ -2876,11 +2875,11 @@ def take_action(self, parsed_args): # present on microversion 2.47 or later and 'flavor' won't be # present if there are infra failures if parsed_args.name_lookup_one_by_one or flavor_id: - for f_id in set( + for f_id in { s.flavor['id'] for s in data if s.flavor and s.flavor.get('id') - ): + }: try: flavors[f_id] = compute_client.find_flavor( f_id, ignore_missing=False @@ -2988,7 +2987,7 @@ class LockServer(command.Command): ) def get_parser(self, prog_name): - parser = super(LockServer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -3052,7 +3051,7 @@ class MigrateServer(command.Command): ) def get_parser(self, prog_name): - parser = super(MigrateServer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -3226,7 +3225,7 @@ class PauseServer(command.Command): _description = _("Pause server(s)") def get_parser(self, prog_name): - parser = super(PauseServer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -3309,7 +3308,7 @@ class RebuildServer(command.ShowOne): _description = _("Rebuild server") def get_parser(self, prog_name): - parser = super(RebuildServer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -3564,8 +3563,8 @@ def _show_progress(progress): raise exceptions.CommandError(msg) try: - userdata = io.open(parsed_args.user_data) - except IOError as e: + userdata = open(parsed_args.user_data) + except OSError as e: msg = _("Can't open '%(data)s': %(exception)s") raise exceptions.CommandError( msg % {'data': parsed_args.user_data, 'exception': e} @@ -3700,7 +3699,7 @@ class EvacuateServer(command.ShowOne): ) def get_parser(self, prog_name): - parser = super(EvacuateServer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -3807,7 +3806,7 @@ class RemoveFixedIP(command.Command): _description = _("Remove fixed IP address from server") def get_parser(self, prog_name): - parser = super(RemoveFixedIP, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "server", metavar="", @@ -3869,7 +3868,7 @@ class RemovePort(command.Command): _description = _("Remove port from server") def get_parser(self, prog_name): - parser = super(RemovePort, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "server", metavar="", @@ -3908,7 +3907,7 @@ class RemoveNetwork(command.Command): _description = _("Remove all ports of a network from server") def get_parser(self, prog_name): - parser = super(RemoveNetwork, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "server", metavar="", @@ -3948,7 +3947,7 @@ class RemoveServerSecurityGroup(command.Command): _description = _("Remove security group from server") def get_parser(self, prog_name): - parser = super(RemoveServerSecurityGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -3984,7 +3983,7 @@ class RemoveServerVolume(command.Command): ) def get_parser(self, prog_name): - parser = super(RemoveServerVolume, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -4026,7 +4025,7 @@ class RescueServer(command.Command): ) def get_parser(self, prog_name): - parser = super(RescueServer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -4078,7 +4077,7 @@ class ResizeServer(command.Command): ) def get_parser(self, prog_name): - parser = super(ResizeServer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) phase_group = parser.add_mutually_exclusive_group() parser.add_argument( 'server', @@ -4176,7 +4175,7 @@ class ResizeConfirm(command.Command): ) def get_parser(self, prog_name): - parser = super(ResizeConfirm, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -4225,7 +4224,7 @@ class ResizeRevert(command.Command): ) def get_parser(self, prog_name): - parser = super(ResizeRevert, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -4269,7 +4268,7 @@ class RestoreServer(command.Command): _description = _("Restore server(s)") def get_parser(self, prog_name): - parser = super(RestoreServer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -4292,7 +4291,7 @@ class ResumeServer(command.Command): _description = _("Resume server(s)") def get_parser(self, prog_name): - parser = super(ResumeServer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -4315,7 +4314,7 @@ class SetServer(command.Command): _description = _("Set server properties") def get_parser(self, prog_name): - parser = super(SetServer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -4589,7 +4588,7 @@ class ShowServer(command.ShowOne): ) def get_parser(self, prog_name): - parser = super(ShowServer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -4657,7 +4656,7 @@ class SshServer(command.Command): _description = _("SSH to server") def get_parser(self, prog_name): - parser = super(SshServer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -4809,7 +4808,7 @@ def take_action(self, parsed_args): ) cmd = ' '.join(['ssh', ip_address] + args) - LOG.debug("ssh command: {cmd}".format(cmd=cmd)) + LOG.debug(f"ssh command: {cmd}") # we intentionally pass through user-provided arguments and run this in # the user's shell os.system(cmd) # nosec: B605 @@ -4899,7 +4898,7 @@ class SuspendServer(command.Command): _description = _("Suspend server(s)") def get_parser(self, prog_name): - parser = super(SuspendServer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -4945,7 +4944,7 @@ class UnpauseServer(command.Command): _description = _("Unpause server(s)") def get_parser(self, prog_name): - parser = super(UnpauseServer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -4968,7 +4967,7 @@ class UnrescueServer(command.Command): _description = _("Restore server from rescue mode") def get_parser(self, prog_name): - parser = super(UnrescueServer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -4988,7 +4987,7 @@ class UnsetServer(command.Command): _description = _("Unset server properties and tags") def get_parser(self, prog_name): - parser = super(UnsetServer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', diff --git a/openstackclient/compute/v2/server_backup.py b/openstackclient/compute/v2/server_backup.py index ae2154756..59bd5540e 100644 --- a/openstackclient/compute/v2/server_backup.py +++ b/openstackclient/compute/v2/server_backup.py @@ -33,7 +33,7 @@ class CreateServerBackup(command.ShowOne): } def get_parser(self, prog_name): - parser = super(CreateServerBackup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', diff --git a/openstackclient/compute/v2/server_group.py b/openstackclient/compute/v2/server_group.py index 046057600..c4fe666e1 100644 --- a/openstackclient/compute/v2/server_group.py +++ b/openstackclient/compute/v2/server_group.py @@ -56,7 +56,7 @@ class CreateServerGroup(command.ShowOne): _description = _("Create a new server group.") def get_parser(self, prog_name): - parser = super(CreateServerGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar='', @@ -143,7 +143,7 @@ class DeleteServerGroup(command.Command): _description = _("Delete existing server group(s).") def get_parser(self, prog_name): - parser = super(DeleteServerGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server_group', metavar='', @@ -178,7 +178,7 @@ class ListServerGroup(command.Lister): _description = _("List all server groups.") def get_parser(self, prog_name): - parser = super(ListServerGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--all-projects', action='store_true', @@ -255,7 +255,7 @@ class ShowServerGroup(command.ShowOne): _description = _("Display server group details.") def get_parser(self, prog_name): - parser = super(ShowServerGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server_group', metavar='', diff --git a/openstackclient/compute/v2/server_image.py b/openstackclient/compute/v2/server_image.py index ec4b7b23e..12b45b285 100644 --- a/openstackclient/compute/v2/server_image.py +++ b/openstackclient/compute/v2/server_image.py @@ -38,7 +38,7 @@ class CreateServerImage(command.ShowOne): } def get_parser(self, prog_name): - parser = super(CreateServerImage, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', diff --git a/openstackclient/compute/v2/server_migration.py b/openstackclient/compute/v2/server_migration.py index 18aaf407b..18299156a 100644 --- a/openstackclient/compute/v2/server_migration.py +++ b/openstackclient/compute/v2/server_migration.py @@ -28,7 +28,7 @@ class ListMigration(command.Lister): _description = _("""List server migrations""") def get_parser(self, prog_name): - parser = super(ListMigration, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--server', metavar='', @@ -381,7 +381,7 @@ class AbortMigration(command.Command): """ def get_parser(self, prog_name): - parser = super(AbortMigration, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', @@ -448,7 +448,7 @@ class ForceCompleteMigration(command.Command): """ def get_parser(self, prog_name): - parser = super(ForceCompleteMigration, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'server', metavar='', diff --git a/openstackclient/compute/v2/service.py b/openstackclient/compute/v2/service.py index 1cf59ab00..d6e522d03 100644 --- a/openstackclient/compute/v2/service.py +++ b/openstackclient/compute/v2/service.py @@ -32,7 +32,7 @@ class DeleteService(command.Command): _description = _("Delete compute service(s)") def get_parser(self, prog_name): - parser = super(DeleteService, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "service", metavar="", @@ -85,7 +85,7 @@ class ListService(command.Lister): ) def get_parser(self, prog_name): - parser = super(ListService, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "--host", metavar="", @@ -147,7 +147,7 @@ class SetService(command.Command): _description = _("Set compute service properties") def get_parser(self, prog_name): - parser = super(SetService, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument("host", metavar="", help=_("Name of host")) parser.add_argument( "service", diff --git a/openstackclient/compute/v2/usage.py b/openstackclient/compute/v2/usage.py index 0d62bc6a0..84118b9d9 100644 --- a/openstackclient/compute/v2/usage.py +++ b/openstackclient/compute/v2/usage.py @@ -109,7 +109,7 @@ class ListUsage(command.Lister): _description = _("List resource usage per project") def get_parser(self, prog_name): - parser = super(ListUsage, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "--start", metavar="", @@ -210,7 +210,7 @@ class ShowUsage(command.ShowOne): _description = _("Show resource usage for a single project") def get_parser(self, prog_name): - parser = super(ShowUsage, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "--project", metavar="", diff --git a/openstackclient/identity/v2_0/catalog.py b/openstackclient/identity/v2_0/catalog.py index bea97cce5..ccac5d04b 100644 --- a/openstackclient/identity/v2_0/catalog.py +++ b/openstackclient/identity/v2_0/catalog.py @@ -39,7 +39,7 @@ def human_readable(self): for endpoint_type in ['publicURL', 'internalURL', 'adminURL']: url = ep.get(endpoint_type) if url: - ret += " %s: %s\n" % (endpoint_type, url) + ret += f" {endpoint_type}: {url}\n" return ret @@ -75,7 +75,7 @@ class ShowCatalog(command.ShowOne): _description = _("Display service catalog details") def get_parser(self, prog_name): - parser = super(ShowCatalog, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'service', metavar='', diff --git a/openstackclient/identity/v2_0/ec2creds.py b/openstackclient/identity/v2_0/ec2creds.py index 94d683303..6970f46dc 100644 --- a/openstackclient/identity/v2_0/ec2creds.py +++ b/openstackclient/identity/v2_0/ec2creds.py @@ -32,7 +32,7 @@ class CreateEC2Creds(command.ShowOne): _description = _("Create EC2 credentials") def get_parser(self, prog_name): - parser = super(CreateEC2Creds, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--project', metavar='', @@ -86,7 +86,7 @@ class DeleteEC2Creds(command.Command): _description = _("Delete EC2 credentials") def get_parser(self, prog_name): - parser = super(DeleteEC2Creds, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'access_keys', metavar='', @@ -138,7 +138,7 @@ class ListEC2Creds(command.Lister): _description = _("List EC2 credentials") def get_parser(self, prog_name): - parser = super(ListEC2Creds, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--user', metavar='', @@ -179,7 +179,7 @@ class ShowEC2Creds(command.ShowOne): _description = _("Display EC2 credentials details") def get_parser(self, prog_name): - parser = super(ShowEC2Creds, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'access_key', metavar='', diff --git a/openstackclient/identity/v2_0/endpoint.py b/openstackclient/identity/v2_0/endpoint.py index 2b9970a6a..ca11164b6 100644 --- a/openstackclient/identity/v2_0/endpoint.py +++ b/openstackclient/identity/v2_0/endpoint.py @@ -32,7 +32,7 @@ class CreateEndpoint(command.ShowOne): _description = _("Create new endpoint") def get_parser(self, prog_name): - parser = super(CreateEndpoint, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'service', metavar='', @@ -83,7 +83,7 @@ class DeleteEndpoint(command.Command): _description = _("Delete endpoint(s)") def get_parser(self, prog_name): - parser = super(DeleteEndpoint, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'endpoints', metavar='', @@ -121,7 +121,7 @@ class ListEndpoint(command.Lister): _description = _("List endpoints") def get_parser(self, prog_name): - parser = super(ListEndpoint, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--long', action='store_true', @@ -167,7 +167,7 @@ class ShowEndpoint(command.ShowOne): _description = _("Display endpoint details") def get_parser(self, prog_name): - parser = super(ShowEndpoint, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'endpoint_or_service', metavar='', diff --git a/openstackclient/identity/v2_0/project.py b/openstackclient/identity/v2_0/project.py index e2f378db7..160755523 100644 --- a/openstackclient/identity/v2_0/project.py +++ b/openstackclient/identity/v2_0/project.py @@ -34,7 +34,7 @@ class CreateProject(command.ShowOne): _description = _("Create new project") def get_parser(self, prog_name): - parser = super(CreateProject, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar='', @@ -108,7 +108,7 @@ class DeleteProject(command.Command): _description = _("Delete project(s)") def get_parser(self, prog_name): - parser = super(DeleteProject, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'projects', metavar='', @@ -150,7 +150,7 @@ class ListProject(command.Lister): _description = _("List projects") def get_parser(self, prog_name): - parser = super(ListProject, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--long', action='store_true', @@ -193,7 +193,7 @@ class SetProject(command.Command): _description = _("Set project properties") def get_parser(self, prog_name): - parser = super(SetProject, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'project', metavar='', @@ -264,7 +264,7 @@ class ShowProject(command.ShowOne): _description = _("Display project details") def get_parser(self, prog_name): - parser = super(ShowProject, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'project', metavar='', @@ -322,7 +322,7 @@ class UnsetProject(command.Command): _description = _("Unset project properties") def get_parser(self, prog_name): - parser = super(UnsetProject, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'project', metavar='', diff --git a/openstackclient/identity/v2_0/role.py b/openstackclient/identity/v2_0/role.py index 931957bd5..971c61a7f 100644 --- a/openstackclient/identity/v2_0/role.py +++ b/openstackclient/identity/v2_0/role.py @@ -32,7 +32,7 @@ class AddRole(command.ShowOne): _description = _("Add role to project:user") def get_parser(self, prog_name): - parser = super(AddRole, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'role', metavar='', @@ -75,7 +75,7 @@ class CreateRole(command.ShowOne): _description = _("Create new role") def get_parser(self, prog_name): - parser = super(CreateRole, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'role_name', metavar='', @@ -111,7 +111,7 @@ class DeleteRole(command.Command): _description = _("Delete role(s)") def get_parser(self, prog_name): - parser = super(DeleteRole, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'roles', metavar='', @@ -176,7 +176,7 @@ class RemoveRole(command.Command): _description = _("Remove role from project : user") def get_parser(self, prog_name): - parser = super(RemoveRole, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'role', metavar='', @@ -211,7 +211,7 @@ class ShowRole(command.ShowOne): _description = _("Display role details") def get_parser(self, prog_name): - parser = super(ShowRole, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'role', metavar='', diff --git a/openstackclient/identity/v2_0/role_assignment.py b/openstackclient/identity/v2_0/role_assignment.py index c3d492e27..6610bab94 100644 --- a/openstackclient/identity/v2_0/role_assignment.py +++ b/openstackclient/identity/v2_0/role_assignment.py @@ -24,7 +24,7 @@ class ListRoleAssignment(command.Lister): _description = _("List role assignments") def get_parser(self, prog_name): - parser = super(ListRoleAssignment, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--user', metavar='', diff --git a/openstackclient/identity/v2_0/service.py b/openstackclient/identity/v2_0/service.py index 15203e694..362dc4515 100644 --- a/openstackclient/identity/v2_0/service.py +++ b/openstackclient/identity/v2_0/service.py @@ -32,7 +32,7 @@ class CreateService(command.ShowOne): _description = _("Create new service") def get_parser(self, prog_name): - parser = super(CreateService, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'type', metavar='', @@ -71,7 +71,7 @@ class DeleteService(command.Command): _description = _("Delete service(s)") def get_parser(self, prog_name): - parser = super(DeleteService, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'services', metavar='', @@ -110,7 +110,7 @@ class ListService(command.Lister): _description = _("List services") def get_parser(self, prog_name): - parser = super(ListService, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--long', action='store_true', @@ -135,7 +135,7 @@ class ShowService(command.ShowOne): _description = _("Display service details") def get_parser(self, prog_name): - parser = super(ShowService, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'service', metavar='', diff --git a/openstackclient/identity/v2_0/token.py b/openstackclient/identity/v2_0/token.py index 8759df8d9..fe9436d8b 100644 --- a/openstackclient/identity/v2_0/token.py +++ b/openstackclient/identity/v2_0/token.py @@ -28,7 +28,7 @@ class IssueToken(command.ShowOne): required_scope = False def get_parser(self, prog_name): - parser = super(IssueToken, self).get_parser(prog_name) + parser = super().get_parser(prog_name) return parser def take_action(self, parsed_args): @@ -56,7 +56,7 @@ class RevokeToken(command.Command): _description = _("Revoke existing token") def get_parser(self, prog_name): - parser = super(RevokeToken, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'token', metavar='', diff --git a/openstackclient/identity/v2_0/user.py b/openstackclient/identity/v2_0/user.py index 10d2f18c3..745a48d11 100644 --- a/openstackclient/identity/v2_0/user.py +++ b/openstackclient/identity/v2_0/user.py @@ -42,7 +42,7 @@ class takes project_cache as the second argument. """ def __init__(self, value, project_cache=None): - super(ProjectColumn, self).__init__(value) + super().__init__(value) self.project_cache = project_cache or {} def human_readable(self): @@ -59,7 +59,7 @@ class CreateUser(command.ShowOne): _description = _("Create new user") def get_parser(self, prog_name): - parser = super(CreateUser, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar='', @@ -162,7 +162,7 @@ class DeleteUser(command.Command): _description = _("Delete user(s)") def get_parser(self, prog_name): - parser = super(DeleteUser, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'users', metavar='', @@ -205,7 +205,7 @@ class ListUser(command.Lister): _description = _("List users") def get_parser(self, prog_name): - parser = super(ListUser, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--project', metavar='', @@ -294,7 +294,7 @@ class SetUser(command.Command): _description = _("Set user properties") def get_parser(self, prog_name): - parser = super(SetUser, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'user', metavar='', @@ -392,7 +392,7 @@ class ShowUser(command.ShowOne): _description = _("Display user details") def get_parser(self, prog_name): - parser = super(ShowUser, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'user', metavar='', diff --git a/openstackclient/identity/v3/access_rule.py b/openstackclient/identity/v3/access_rule.py index b9a66e9a5..655ad14b1 100644 --- a/openstackclient/identity/v3/access_rule.py +++ b/openstackclient/identity/v3/access_rule.py @@ -32,7 +32,7 @@ class DeleteAccessRule(command.Command): _description = _("Delete access rule(s)") def get_parser(self, prog_name): - parser = super(DeleteAccessRule, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'access_rule', metavar='', @@ -73,7 +73,7 @@ class ListAccessRule(command.Lister): _description = _("List access rules") def get_parser(self, prog_name): - parser = super(ListAccessRule, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--user', metavar='', @@ -110,7 +110,7 @@ class ShowAccessRule(command.ShowOne): _description = _("Display access rule details") def get_parser(self, prog_name): - parser = super(ShowAccessRule, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'access_rule', metavar='', diff --git a/openstackclient/identity/v3/application_credential.py b/openstackclient/identity/v3/application_credential.py index c75de3a46..cffab9927 100644 --- a/openstackclient/identity/v3/application_credential.py +++ b/openstackclient/identity/v3/application_credential.py @@ -34,7 +34,7 @@ class CreateApplicationCredential(command.ShowOne): _description = _("Create new application credential") def get_parser(self, prog_name): - parser = super(CreateApplicationCredential, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar='', @@ -137,7 +137,7 @@ def take_action(self, parsed_args): try: with open(parsed_args.access_rules) as f: access_rules = json.load(f) - except IOError: + except OSError: msg = _( "Access rules is not valid JSON string or file does" " not exist." @@ -171,7 +171,7 @@ class DeleteApplicationCredential(command.Command): _description = _("Delete application credentials(s)") def get_parser(self, prog_name): - parser = super(DeleteApplicationCredential, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'application_credential', metavar='', @@ -213,7 +213,7 @@ class ListApplicationCredential(command.Lister): _description = _("List application credentials") def get_parser(self, prog_name): - parser = super(ListApplicationCredential, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--user', metavar='', @@ -250,7 +250,7 @@ class ShowApplicationCredential(command.ShowOne): _description = _("Display application credential details") def get_parser(self, prog_name): - parser = super(ShowApplicationCredential, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'application_credential', metavar='', diff --git a/openstackclient/identity/v3/catalog.py b/openstackclient/identity/v3/catalog.py index a5c2ee47f..a161461ce 100644 --- a/openstackclient/identity/v3/catalog.py +++ b/openstackclient/identity/v3/catalog.py @@ -34,7 +34,7 @@ def human_readable(self): for ep in self._value: region = ep.get('region_id') or ep.get('region') or '' ret += region + '\n' - ret += " %s: %s\n" % (ep['interface'], ep['url']) + ret += " {}: {}\n".format(ep['interface'], ep['url']) return ret @@ -70,7 +70,7 @@ class ShowCatalog(command.ShowOne): _description = _("Display service catalog details") def get_parser(self, prog_name): - parser = super(ShowCatalog, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'service', metavar='', diff --git a/openstackclient/identity/v3/consumer.py b/openstackclient/identity/v3/consumer.py index c40c98868..924b5726d 100644 --- a/openstackclient/identity/v3/consumer.py +++ b/openstackclient/identity/v3/consumer.py @@ -31,7 +31,7 @@ class CreateConsumer(command.ShowOne): _description = _("Create new consumer") def get_parser(self, prog_name): - parser = super(CreateConsumer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--description', metavar='', @@ -52,7 +52,7 @@ class DeleteConsumer(command.Command): _description = _("Delete consumer(s)") def get_parser(self, prog_name): - parser = super(DeleteConsumer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'consumer', metavar='', @@ -111,7 +111,7 @@ class SetConsumer(command.Command): _description = _("Set consumer properties") def get_parser(self, prog_name): - parser = super(SetConsumer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'consumer', metavar='', @@ -142,7 +142,7 @@ class ShowConsumer(command.ShowOne): _description = _("Display consumer details") def get_parser(self, prog_name): - parser = super(ShowConsumer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'consumer', metavar='', diff --git a/openstackclient/identity/v3/credential.py b/openstackclient/identity/v3/credential.py index 80b65befa..1b0d52517 100644 --- a/openstackclient/identity/v3/credential.py +++ b/openstackclient/identity/v3/credential.py @@ -32,7 +32,7 @@ class CreateCredential(command.ShowOne): _description = _("Create new credential") def get_parser(self, prog_name): - parser = super(CreateCredential, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'user', metavar='', @@ -85,7 +85,7 @@ class DeleteCredential(command.Command): _description = _("Delete credential(s)") def get_parser(self, prog_name): - parser = super(DeleteCredential, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'credential', metavar='', @@ -122,7 +122,7 @@ class ListCredential(command.Lister): _description = _("List credentials") def get_parser(self, prog_name): - parser = super(ListCredential, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--user', metavar='', @@ -171,7 +171,7 @@ class SetCredential(command.Command): _description = _("Set credential properties") def get_parser(self, prog_name): - parser = super(SetCredential, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'credential', metavar='', @@ -232,7 +232,7 @@ class ShowCredential(command.ShowOne): _description = _("Display credential details") def get_parser(self, prog_name): - parser = super(ShowCredential, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'credential', metavar='', diff --git a/openstackclient/identity/v3/domain.py b/openstackclient/identity/v3/domain.py index 1fcf245c8..aaa270830 100644 --- a/openstackclient/identity/v3/domain.py +++ b/openstackclient/identity/v3/domain.py @@ -33,7 +33,7 @@ class CreateDomain(command.ShowOne): _description = _("Create new domain") def get_parser(self, prog_name): - parser = super(CreateDomain, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar='', @@ -96,7 +96,7 @@ class DeleteDomain(command.Command): _description = _("Delete domain(s)") def get_parser(self, prog_name): - parser = super(DeleteDomain, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'domain', metavar='', @@ -135,7 +135,7 @@ class ListDomain(command.Lister): _description = _("List domains") def get_parser(self, prog_name): - parser = super(ListDomain, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--name', metavar='', @@ -175,7 +175,7 @@ class SetDomain(command.Command): _description = _("Set domain properties") def get_parser(self, prog_name): - parser = super(SetDomain, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'domain', metavar='', @@ -232,7 +232,7 @@ class ShowDomain(command.ShowOne): _description = _("Display domain details") def get_parser(self, prog_name): - parser = super(ShowDomain, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'domain', metavar='', diff --git a/openstackclient/identity/v3/ec2creds.py b/openstackclient/identity/v3/ec2creds.py index 49bedc746..a9fbe1ae4 100644 --- a/openstackclient/identity/v3/ec2creds.py +++ b/openstackclient/identity/v3/ec2creds.py @@ -60,7 +60,7 @@ class CreateEC2Creds(command.ShowOne): _description = _("Create EC2 credentials") def get_parser(self, prog_name): - parser = super(CreateEC2Creds, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--project', metavar='', @@ -122,7 +122,7 @@ class DeleteEC2Creds(command.Command): _description = _("Delete EC2 credentials") def get_parser(self, prog_name): - parser = super(DeleteEC2Creds, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'access_key', metavar='', @@ -166,7 +166,7 @@ class ListEC2Creds(command.Lister): _description = _("List EC2 credentials") def get_parser(self, prog_name): - parser = super(ListEC2Creds, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--user', metavar='', @@ -200,7 +200,7 @@ class ShowEC2Creds(command.ShowOne): _description = _("Display EC2 credentials details") def get_parser(self, prog_name): - parser = super(ShowEC2Creds, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'access_key', metavar='', diff --git a/openstackclient/identity/v3/endpoint.py b/openstackclient/identity/v3/endpoint.py index 7d954ce12..6e77bdf87 100644 --- a/openstackclient/identity/v3/endpoint.py +++ b/openstackclient/identity/v3/endpoint.py @@ -39,7 +39,7 @@ class AddProjectToEndpoint(command.Command): _description = _("Associate a project to an endpoint") def get_parser(self, prog_name): - parser = super(AddProjectToEndpoint, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'endpoint', metavar='', @@ -75,7 +75,7 @@ class CreateEndpoint(command.ShowOne): _description = _("Create new endpoint") def get_parser(self, prog_name): - parser = super(CreateEndpoint, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'service', metavar='', @@ -137,7 +137,7 @@ class DeleteEndpoint(command.Command): _description = _("Delete endpoint(s)") def get_parser(self, prog_name): - parser = super(DeleteEndpoint, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'endpoint', metavar='', @@ -177,7 +177,7 @@ class ListEndpoint(command.Lister): _description = _("List endpoints") def get_parser(self, prog_name): - parser = super(ListEndpoint, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--service', metavar='', @@ -285,7 +285,7 @@ class RemoveProjectFromEndpoint(command.Command): _description = _("Dissociate a project from an endpoint") def get_parser(self, prog_name): - parser = super(RemoveProjectFromEndpoint, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'endpoint', metavar='', @@ -321,7 +321,7 @@ class SetEndpoint(command.Command): _description = _("Set endpoint properties") def get_parser(self, prog_name): - parser = super(SetEndpoint, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'endpoint', metavar='', @@ -393,7 +393,7 @@ class ShowEndpoint(command.ShowOne): _description = _("Display endpoint details") def get_parser(self, prog_name): - parser = super(ShowEndpoint, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'endpoint', metavar='', diff --git a/openstackclient/identity/v3/endpoint_group.py b/openstackclient/identity/v3/endpoint_group.py index 1d3e5ddde..b5c2631f0 100644 --- a/openstackclient/identity/v3/endpoint_group.py +++ b/openstackclient/identity/v3/endpoint_group.py @@ -27,7 +27,7 @@ LOG = logging.getLogger(__name__) -class _FiltersReader(object): +class _FiltersReader: _description = _("Helper class capable of reading filters from files") def _read_filters(self, path): @@ -63,7 +63,7 @@ class AddProjectToEndpointGroup(command.Command): _description = _("Add a project to an endpoint group") def get_parser(self, prog_name): - parser = super(AddProjectToEndpointGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'endpointgroup', metavar='', @@ -97,7 +97,7 @@ class CreateEndpointGroup(command.ShowOne, _FiltersReader): _description = _("Create new endpoint group") def get_parser(self, prog_name): - parser = super(CreateEndpointGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar='', @@ -137,7 +137,7 @@ class DeleteEndpointGroup(command.Command): _description = _("Delete endpoint group(s)") def get_parser(self, prog_name): - parser = super(DeleteEndpointGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'endpointgroup', metavar='', @@ -177,7 +177,7 @@ class ListEndpointGroup(command.Lister): _description = _("List endpoint groups") def get_parser(self, prog_name): - parser = super(ListEndpointGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) list_group = parser.add_mutually_exclusive_group() list_group.add_argument( '--endpointgroup', @@ -242,9 +242,7 @@ class RemoveProjectFromEndpointGroup(command.Command): _description = _("Remove project from endpoint group") def get_parser(self, prog_name): - parser = super(RemoveProjectFromEndpointGroup, self).get_parser( - prog_name - ) + parser = super().get_parser(prog_name) parser.add_argument( 'endpointgroup', metavar='', @@ -278,7 +276,7 @@ class SetEndpointGroup(command.Command, _FiltersReader): _description = _("Set endpoint group properties") def get_parser(self, prog_name): - parser = super(SetEndpointGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'endpointgroup', metavar='', @@ -324,7 +322,7 @@ class ShowEndpointGroup(command.ShowOne): _description = _("Display endpoint group details") def get_parser(self, prog_name): - parser = super(ShowEndpointGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'endpointgroup', metavar='', diff --git a/openstackclient/identity/v3/federation_protocol.py b/openstackclient/identity/v3/federation_protocol.py index ae62390df..4e980860d 100644 --- a/openstackclient/identity/v3/federation_protocol.py +++ b/openstackclient/identity/v3/federation_protocol.py @@ -30,7 +30,7 @@ class CreateProtocol(command.ShowOne): _description = _("Create new federation protocol") def get_parser(self, prog_name): - parser = super(CreateProtocol, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'federation_protocol', metavar='', @@ -79,7 +79,7 @@ class DeleteProtocol(command.Command): _description = _("Delete federation protocol(s)") def get_parser(self, prog_name): - parser = super(DeleteProtocol, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'federation_protocol', metavar='', @@ -129,7 +129,7 @@ class ListProtocols(command.Lister): _description = _("List federation protocols") def get_parser(self, prog_name): - parser = super(ListProtocols, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--identity-provider', metavar='', @@ -158,7 +158,7 @@ class SetProtocol(command.Command): _description = _("Set federation protocol properties") def get_parser(self, prog_name): - parser = super(SetProtocol, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'federation_protocol', metavar='', @@ -202,7 +202,7 @@ class ShowProtocol(command.ShowOne): _description = _("Display federation protocol details") def get_parser(self, prog_name): - parser = super(ShowProtocol, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'federation_protocol', metavar='', diff --git a/openstackclient/identity/v3/group.py b/openstackclient/identity/v3/group.py index 65eb261a1..d9c3b93b8 100644 --- a/openstackclient/identity/v3/group.py +++ b/openstackclient/identity/v3/group.py @@ -33,7 +33,7 @@ class AddUserToGroup(command.Command): _description = _("Add user to group") def get_parser(self, prog_name): - parser = super(AddUserToGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'group', metavar='', @@ -93,7 +93,7 @@ class CheckUserInGroup(command.Command): _description = _("Check user membership in group") def get_parser(self, prog_name): - parser = super(CheckUserInGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'group', metavar='', @@ -141,7 +141,7 @@ class CreateGroup(command.ShowOne): _description = _("Create new group") def get_parser(self, prog_name): - parser = super(CreateGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar='', @@ -194,7 +194,7 @@ class DeleteGroup(command.Command): _description = _("Delete group(s)") def get_parser(self, prog_name): - parser = super(DeleteGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'groups', metavar='', @@ -241,7 +241,7 @@ class ListGroup(command.Lister): _description = _("List groups") def get_parser(self, prog_name): - parser = super(ListGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--domain', metavar='', @@ -304,7 +304,7 @@ class RemoveUserFromGroup(command.Command): _description = _("Remove user from group") def get_parser(self, prog_name): - parser = super(RemoveUserFromGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'group', metavar='', @@ -364,7 +364,7 @@ class SetGroup(command.Command): _description = _("Set group properties") def get_parser(self, prog_name): - parser = super(SetGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'group', metavar='', @@ -405,7 +405,7 @@ class ShowGroup(command.ShowOne): _description = _("Display group details") def get_parser(self, prog_name): - parser = super(ShowGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'group', metavar='', diff --git a/openstackclient/identity/v3/identity_provider.py b/openstackclient/identity/v3/identity_provider.py index 230f81985..5e0c8f7c9 100644 --- a/openstackclient/identity/v3/identity_provider.py +++ b/openstackclient/identity/v3/identity_provider.py @@ -31,7 +31,7 @@ class CreateIdentityProvider(command.ShowOne): _description = _("Create new identity provider") def get_parser(self, prog_name): - parser = super(CreateIdentityProvider, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'identity_provider_id', metavar='', @@ -146,7 +146,7 @@ class DeleteIdentityProvider(command.Command): _description = _("Delete identity provider(s)") def get_parser(self, prog_name): - parser = super(DeleteIdentityProvider, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'identity_provider', metavar='', @@ -184,7 +184,7 @@ class ListIdentityProvider(command.Lister): _description = _("List identity providers") def get_parser(self, prog_name): - parser = super(ListIdentityProvider, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--id', metavar='', @@ -226,7 +226,7 @@ class SetIdentityProvider(command.Command): _description = _("Set identity provider properties") def get_parser(self, prog_name): - parser = super(SetIdentityProvider, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'identity_provider', metavar='', @@ -326,7 +326,7 @@ class ShowIdentityProvider(command.ShowOne): _description = _("Display identity provider details") def get_parser(self, prog_name): - parser = super(ShowIdentityProvider, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'identity_provider', metavar='', diff --git a/openstackclient/identity/v3/implied_role.py b/openstackclient/identity/v3/implied_role.py index 9d26ccd3f..3958896b0 100644 --- a/openstackclient/identity/v3/implied_role.py +++ b/openstackclient/identity/v3/implied_role.py @@ -51,7 +51,7 @@ class CreateImpliedRole(command.ShowOne): _description = _("Creates an association between prior and implied roles") def get_parser(self, prog_name): - parser = super(CreateImpliedRole, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'role', metavar='', @@ -81,7 +81,7 @@ class DeleteImpliedRole(command.Command): _description = _("Deletes an association between prior and implied roles") def get_parser(self, prog_name): - parser = super(DeleteImpliedRole, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'role', metavar='', @@ -113,7 +113,7 @@ class ListImpliedRole(command.Lister): ] def get_parser(self, prog_name): - parser = super(ListImpliedRole, self).get_parser(prog_name) + parser = super().get_parser(prog_name) return parser def take_action(self, parsed_args): diff --git a/openstackclient/identity/v3/limit.py b/openstackclient/identity/v3/limit.py index 1610b68d6..59cc1398c 100644 --- a/openstackclient/identity/v3/limit.py +++ b/openstackclient/identity/v3/limit.py @@ -29,7 +29,7 @@ class CreateLimit(command.ShowOne): _description = _("Create a limit") def get_parser(self, prog_name): - parser = super(CreateLimit, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--description', metavar='', @@ -108,7 +108,7 @@ class ListLimit(command.Lister): _description = _("List limits") def get_parser(self, prog_name): - parser = super(ListLimit, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--service', metavar='', @@ -190,7 +190,7 @@ class ShowLimit(command.ShowOne): _description = _("Display limit details") def get_parser(self, prog_name): - parser = super(ShowLimit, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'limit_id', metavar='', @@ -209,7 +209,7 @@ class SetLimit(command.ShowOne): _description = _("Update information about a limit") def get_parser(self, prog_name): - parser = super(SetLimit, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'limit_id', metavar='', @@ -247,7 +247,7 @@ class DeleteLimit(command.Command): _description = _("Delete a limit") def get_parser(self, prog_name): - parser = super(DeleteLimit, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'limit_id', metavar='', diff --git a/openstackclient/identity/v3/mapping.py b/openstackclient/identity/v3/mapping.py index ea5e7d70a..ff8f2aa31 100644 --- a/openstackclient/identity/v3/mapping.py +++ b/openstackclient/identity/v3/mapping.py @@ -28,7 +28,7 @@ LOG = logging.getLogger(__name__) -class _RulesReader(object): +class _RulesReader: _description = _("Helper class capable of reading rules from files") def _read_rules(self, path): @@ -101,7 +101,7 @@ class CreateMapping(command.ShowOne, _RulesReader): _description = _("Create new mapping") def get_parser(self, prog_name): - parser = super(CreateMapping, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'mapping', metavar='', @@ -134,7 +134,7 @@ class DeleteMapping(command.Command): _description = _("Delete mapping(s)") def get_parser(self, prog_name): - parser = super(DeleteMapping, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'mapping', metavar='', @@ -185,7 +185,7 @@ class SetMapping(command.Command, _RulesReader): _description = _("Set mapping properties") def get_parser(self, prog_name): - parser = super(SetMapping, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'mapping', metavar='', @@ -218,7 +218,7 @@ class ShowMapping(command.ShowOne): _description = _("Display mapping details") def get_parser(self, prog_name): - parser = super(ShowMapping, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'mapping', metavar='', diff --git a/openstackclient/identity/v3/policy.py b/openstackclient/identity/v3/policy.py index c6642768b..51428e8c9 100644 --- a/openstackclient/identity/v3/policy.py +++ b/openstackclient/identity/v3/policy.py @@ -31,7 +31,7 @@ class CreatePolicy(command.ShowOne): _description = _("Create new policy") def get_parser(self, prog_name): - parser = super(CreatePolicy, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--type', metavar='', @@ -65,7 +65,7 @@ class DeletePolicy(command.Command): _description = _("Delete policy(s)") def get_parser(self, prog_name): - parser = super(DeletePolicy, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'policy', metavar='', @@ -105,7 +105,7 @@ class ListPolicy(command.Lister): _description = _("List policies") def get_parser(self, prog_name): - parser = super(ListPolicy, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--long', action='store_true', @@ -139,7 +139,7 @@ class SetPolicy(command.Command): _description = _("Set policy properties") def get_parser(self, prog_name): - parser = super(SetPolicy, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'policy', metavar='', @@ -177,7 +177,7 @@ class ShowPolicy(command.ShowOne): _description = _("Display policy details") def get_parser(self, prog_name): - parser = super(ShowPolicy, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'policy', metavar='', diff --git a/openstackclient/identity/v3/project.py b/openstackclient/identity/v3/project.py index 6ff264aea..d66fd6121 100644 --- a/openstackclient/identity/v3/project.py +++ b/openstackclient/identity/v3/project.py @@ -34,7 +34,7 @@ class CreateProject(command.ShowOne): _description = _("Create new project") def get_parser(self, prog_name): - parser = super(CreateProject, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar='', @@ -146,7 +146,7 @@ class DeleteProject(command.Command): _description = _("Delete project(s)") def get_parser(self, prog_name): - parser = super(DeleteProject, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'projects', metavar='', @@ -200,7 +200,7 @@ class ListProject(command.Lister): _description = _("List projects") def get_parser(self, prog_name): - parser = super(ListProject, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--domain', metavar='', @@ -314,7 +314,7 @@ class SetProject(command.Command): _description = _("Set project properties") def get_parser(self, prog_name): - parser = super(SetProject, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'project', metavar='', @@ -389,7 +389,7 @@ class ShowProject(command.ShowOne): _description = _("Display project details") def get_parser(self, prog_name): - parser = super(ShowProject, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'project', metavar='', diff --git a/openstackclient/identity/v3/region.py b/openstackclient/identity/v3/region.py index 21a80b94f..ba8c02cf2 100644 --- a/openstackclient/identity/v3/region.py +++ b/openstackclient/identity/v3/region.py @@ -29,7 +29,7 @@ class CreateRegion(command.ShowOne): _description = _("Create new region") def get_parser(self, prog_name): - parser = super(CreateRegion, self).get_parser(prog_name) + parser = super().get_parser(prog_name) # NOTE(stevemar): The API supports an optional region ID, but that # seems like poor UX, we will only support user-defined IDs. parser.add_argument( @@ -68,7 +68,7 @@ class DeleteRegion(command.Command): _description = _("Delete region(s)") def get_parser(self, prog_name): - parser = super(DeleteRegion, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'region', metavar='', @@ -106,7 +106,7 @@ class ListRegion(command.Lister): _description = _("List regions") def get_parser(self, prog_name): - parser = super(ListRegion, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--parent-region', metavar='', @@ -142,7 +142,7 @@ class SetRegion(command.Command): _description = _("Set region properties") def get_parser(self, prog_name): - parser = super(SetRegion, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'region', metavar='', @@ -176,7 +176,7 @@ class ShowRegion(command.ShowOne): _description = _("Display region details") def get_parser(self, prog_name): - parser = super(ShowRegion, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'region', metavar='', diff --git a/openstackclient/identity/v3/registered_limit.py b/openstackclient/identity/v3/registered_limit.py index 251eb2dbe..f71ef1f5a 100644 --- a/openstackclient/identity/v3/registered_limit.py +++ b/openstackclient/identity/v3/registered_limit.py @@ -29,7 +29,7 @@ class CreateRegisteredLimit(command.ShowOne): _description = _("Create a registered limit") def get_parser(self, prog_name): - parser = super(CreateRegisteredLimit, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--description', metavar='', @@ -98,7 +98,7 @@ class DeleteRegisteredLimit(command.Command): _description = _("Delete a registered limit") def get_parser(self, prog_name): - parser = super(DeleteRegisteredLimit, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'registered_limit_id', metavar='', @@ -140,7 +140,7 @@ class ListRegisteredLimit(command.Lister): _description = _("List registered limits") def get_parser(self, prog_name): - parser = super(ListRegisteredLimit, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--service', metavar='', @@ -207,7 +207,7 @@ class SetRegisteredLimit(command.ShowOne): _description = _("Update information about a registered limit") def get_parser(self, prog_name): - parser = super(SetRegisteredLimit, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'registered_limit_id', metavar='', @@ -298,7 +298,7 @@ class ShowRegisteredLimit(command.ShowOne): _description = _("Display registered limit details") def get_parser(self, prog_name): - parser = super(ShowRegisteredLimit, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'registered_limit_id', metavar='', diff --git a/openstackclient/identity/v3/role.py b/openstackclient/identity/v3/role.py index 4c4358851..c43f38994 100644 --- a/openstackclient/identity/v3/role.py +++ b/openstackclient/identity/v3/role.py @@ -134,7 +134,7 @@ class AddRole(command.Command): ) def get_parser(self, prog_name): - parser = super(AddRole, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'role', metavar='', @@ -179,7 +179,7 @@ class CreateRole(command.ShowOne): _description = _("Create new role") def get_parser(self, prog_name): - parser = super(CreateRole, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar='', @@ -241,7 +241,7 @@ class DeleteRole(command.Command): _description = _("Delete role(s)") def get_parser(self, prog_name): - parser = super(DeleteRole, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'roles', metavar='', @@ -293,7 +293,7 @@ class ListRole(command.Lister): _description = _("List roles") def get_parser(self, prog_name): - parser = super(ListRole, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--domain', metavar='', @@ -336,7 +336,7 @@ class RemoveRole(command.Command): ) def get_parser(self, prog_name): - parser = super(RemoveRole, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'role', metavar='', @@ -383,7 +383,7 @@ class SetRole(command.Command): _description = _("Set role properties") def get_parser(self, prog_name): - parser = super(SetRole, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'role', metavar='', @@ -433,7 +433,7 @@ class ShowRole(command.ShowOne): _description = _("Display role details") def get_parser(self, prog_name): - parser = super(ShowRole, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'role', metavar='', diff --git a/openstackclient/identity/v3/role_assignment.py b/openstackclient/identity/v3/role_assignment.py index 0be6aafb6..81de1535f 100644 --- a/openstackclient/identity/v3/role_assignment.py +++ b/openstackclient/identity/v3/role_assignment.py @@ -24,7 +24,7 @@ class ListRoleAssignment(command.Lister): _description = _("List role assignments") def get_parser(self, prog_name): - parser = super(ListRoleAssignment, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--effective', action="store_true", diff --git a/openstackclient/identity/v3/service.py b/openstackclient/identity/v3/service.py index fde1799c1..fd2c1df84 100644 --- a/openstackclient/identity/v3/service.py +++ b/openstackclient/identity/v3/service.py @@ -32,7 +32,7 @@ class CreateService(command.ShowOne): _description = _("Create new service") def get_parser(self, prog_name): - parser = super(CreateService, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'type', metavar='', @@ -83,7 +83,7 @@ class DeleteService(command.Command): _description = _("Delete service(s)") def get_parser(self, prog_name): - parser = super(DeleteService, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'service', metavar='', @@ -121,7 +121,7 @@ class ListService(command.Lister): _description = _("List services") def get_parser(self, prog_name): - parser = super(ListService, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--long', action='store_true', @@ -146,7 +146,7 @@ class SetService(command.Command): _description = _("Set service properties") def get_parser(self, prog_name): - parser = super(SetService, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'service', metavar='', @@ -203,7 +203,7 @@ class ShowService(command.ShowOne): _description = _("Display service details") def get_parser(self, prog_name): - parser = super(ShowService, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'service', metavar='', diff --git a/openstackclient/identity/v3/service_provider.py b/openstackclient/identity/v3/service_provider.py index e5af74926..79869ee60 100644 --- a/openstackclient/identity/v3/service_provider.py +++ b/openstackclient/identity/v3/service_provider.py @@ -29,7 +29,7 @@ class CreateServiceProvider(command.ShowOne): _description = _("Create new service provider") def get_parser(self, prog_name): - parser = super(CreateServiceProvider, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'service_provider_id', metavar='', @@ -94,7 +94,7 @@ class DeleteServiceProvider(command.Command): _description = _("Delete service provider(s)") def get_parser(self, prog_name): - parser = super(DeleteServiceProvider, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'service_provider', metavar='', @@ -153,7 +153,7 @@ class SetServiceProvider(command.Command): _description = _("Set service provider properties") def get_parser(self, prog_name): - parser = super(SetServiceProvider, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'service_provider', metavar='', @@ -213,7 +213,7 @@ class ShowServiceProvider(command.ShowOne): _description = _("Display service provider details") def get_parser(self, prog_name): - parser = super(ShowServiceProvider, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'service_provider', metavar='', diff --git a/openstackclient/identity/v3/token.py b/openstackclient/identity/v3/token.py index c11de358a..8f2dc0940 100644 --- a/openstackclient/identity/v3/token.py +++ b/openstackclient/identity/v3/token.py @@ -27,7 +27,7 @@ class AuthorizeRequestToken(command.ShowOne): _description = _("Authorize a request token") def get_parser(self, prog_name): - parser = super(AuthorizeRequestToken, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--request-key', metavar='', @@ -70,7 +70,7 @@ class CreateAccessToken(command.ShowOne): _description = _("Create an access token") def get_parser(self, prog_name): - parser = super(CreateAccessToken, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--consumer-key', metavar='', @@ -119,7 +119,7 @@ class CreateRequestToken(command.ShowOne): _description = _("Create a request token") def get_parser(self, prog_name): - parser = super(CreateRequestToken, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--consumer-key', metavar='', @@ -178,7 +178,7 @@ class IssueToken(command.ShowOne): required_scope = False def get_parser(self, prog_name): - parser = super(IssueToken, self).get_parser(prog_name) + parser = super().get_parser(prog_name) return parser def take_action(self, parsed_args): @@ -214,7 +214,7 @@ class RevokeToken(command.Command): _description = _("Revoke existing token") def get_parser(self, prog_name): - parser = super(RevokeToken, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'token', metavar='', diff --git a/openstackclient/identity/v3/trust.py b/openstackclient/identity/v3/trust.py index f2899d594..33fee4a90 100644 --- a/openstackclient/identity/v3/trust.py +++ b/openstackclient/identity/v3/trust.py @@ -32,7 +32,7 @@ class CreateTrust(command.ShowOne): _description = _("Create new trust") def get_parser(self, prog_name): - parser = super(CreateTrust, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'trustor', metavar='', @@ -150,7 +150,7 @@ class DeleteTrust(command.Command): _description = _("Delete trust(s)") def get_parser(self, prog_name): - parser = super(DeleteTrust, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'trust', metavar='', @@ -300,7 +300,7 @@ class ShowTrust(command.ShowOne): _description = _("Display trust details") def get_parser(self, prog_name): - parser = super(ShowTrust, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'trust', metavar='', diff --git a/openstackclient/identity/v3/user.py b/openstackclient/identity/v3/user.py index 365240674..38b9a0ab0 100644 --- a/openstackclient/identity/v3/user.py +++ b/openstackclient/identity/v3/user.py @@ -188,7 +188,7 @@ class CreateUser(command.ShowOne): _description = _("Create new user") def get_parser(self, prog_name): - parser = super(CreateUser, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar='', @@ -308,7 +308,7 @@ class DeleteUser(command.Command): _description = _("Delete user(s)") def get_parser(self, prog_name): - parser = super(DeleteUser, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'users', metavar='', @@ -368,7 +368,7 @@ class ListUser(command.Lister): _description = _("List users") def get_parser(self, prog_name): - parser = super(ListUser, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--domain', metavar='', @@ -488,7 +488,7 @@ class SetUser(command.Command): _description = _("Set user properties") def get_parser(self, prog_name): - parser = super(SetUser, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'user', metavar='', @@ -621,7 +621,7 @@ class SetPasswordUser(command.Command): required_scope = False def get_parser(self, prog_name): - parser = super(SetPasswordUser, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--password', metavar='', @@ -686,7 +686,7 @@ class ShowUser(command.ShowOne): _description = _("Display user details") def get_parser(self, prog_name): - parser = super(ShowUser, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'user', metavar='', diff --git a/openstackclient/image/v1/image.py b/openstackclient/image/v1/image.py index 10f997cd1..ecbb2050b 100644 --- a/openstackclient/image/v1/image.py +++ b/openstackclient/image/v1/image.py @@ -16,7 +16,6 @@ """Image V1 Action Implementations""" import argparse -import io import logging import os import sys @@ -110,7 +109,7 @@ class CreateImage(command.ShowOne): _description = _("Create/upload an image") def get_parser(self, prog_name): - parser = super(CreateImage, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "name", metavar="", @@ -320,7 +319,7 @@ def take_action(self, parsed_args): elif parsed_args.file: # Send an open file handle to glanceclient so it will # do a chunked transfer - kwargs["data"] = io.open(parsed_args.file, "rb") + kwargs["data"] = open(parsed_args.file, "rb") else: # Read file from stdin if not sys.stdin.isatty(): @@ -363,7 +362,7 @@ class DeleteImage(command.Command): _description = _("Delete image(s)") def get_parser(self, prog_name): - parser = super(DeleteImage, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "images", metavar="", @@ -403,7 +402,7 @@ class ListImage(command.Lister): _description = _("List available images") def get_parser(self, prog_name): - parser = super(ListImage, self).get_parser(prog_name) + parser = super().get_parser(prog_name) public_group = parser.add_mutually_exclusive_group() public_group.add_argument( "--public", @@ -534,7 +533,7 @@ class SaveImage(command.Command): _description = _("Save an image locally") def get_parser(self, prog_name): - parser = super(SaveImage, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "--file", metavar="", @@ -564,7 +563,7 @@ class SetImage(command.Command): _description = _("Set image properties") def get_parser(self, prog_name): - parser = super(SetImage, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "image", metavar="", @@ -771,7 +770,7 @@ def take_action(self, parsed_args): elif parsed_args.file: # Send an open file handle to glanceclient so it will # do a chunked transfer - kwargs["data"] = io.open(parsed_args.file, "rb") + kwargs["data"] = open(parsed_args.file, "rb") else: # Read file from stdin if sys.stdin.isatty() is not True: @@ -809,7 +808,7 @@ class ShowImage(command.ShowOne): _description = _("Display image details") def get_parser(self, prog_name): - parser = super(ShowImage, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "--human-readable", default=False, diff --git a/openstackclient/image/v2/task.py b/openstackclient/image/v2/task.py index 924eaaf13..1b7170f63 100644 --- a/openstackclient/image/v2/task.py +++ b/openstackclient/image/v2/task.py @@ -64,7 +64,7 @@ class ShowTask(command.ShowOne): _description = _('Display task details') def get_parser(self, prog_name): - parser = super(ShowTask, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'task', diff --git a/openstackclient/network/common.py b/openstackclient/network/common.py index 63c845cde..0dc291c92 100644 --- a/openstackclient/network/common.py +++ b/openstackclient/network/common.py @@ -132,7 +132,7 @@ def split_help(network_help, compute_help): def get_parser(self, prog_name): LOG.debug('get_parser(%s)', prog_name) - parser = super(NetDetectionMixin, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser = self.update_parser_common(parser) LOG.debug('common parser: %s', parser) if self.is_neutron or self.is_docs_build: @@ -318,7 +318,7 @@ def _parse_extra_properties(self, extra_properties): return result def get_parser(self, prog_name): - parser = super(NeutronCommandWithExtraArgs, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--extra-property', metavar='type=,name=,' diff --git a/openstackclient/network/utils.py b/openstackclient/network/utils.py index 85a4f5ac1..9cb3e1a36 100644 --- a/openstackclient/network/utils.py +++ b/openstackclient/network/utils.py @@ -27,7 +27,7 @@ def transform_compute_security_group_rule(sg_rule): elif from_port is None and to_port is None: port_range = {'port_range': ""} else: - port_range = {'port_range': "%s:%s" % (from_port, to_port)} + port_range = {'port_range': f"{from_port}:{to_port}"} info.update(port_range) if 'cidr' in info['ip_range']: info['ip_range'] = info['ip_range']['cidr'] @@ -76,7 +76,7 @@ def str2dict(strdict): msg = _("missing value for key '%s'") raise exceptions.CommandError(msg % kv) else: - kvlist[i - 1] = "%s;%s" % (kvlist[i - 1], kv) + kvlist[i - 1] = f"{kvlist[i - 1]};{kv}" for kv in kvlist: key, sep, value = kv.partition(':') result[key] = value diff --git a/openstackclient/network/v2/address_group.py b/openstackclient/network/v2/address_group.py index 7c7371840..fee3d143c 100644 --- a/openstackclient/network/v2/address_group.py +++ b/openstackclient/network/v2/address_group.py @@ -61,7 +61,7 @@ class CreateAddressGroup(command.ShowOne, common.NeutronCommandWithExtraArgs): _description = _("Create a new Address Group") def get_parser(self, prog_name): - parser = super(CreateAddressGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar="", help=_("New address group name") ) @@ -108,7 +108,7 @@ class DeleteAddressGroup(command.Command): _description = _("Delete address group(s)") def get_parser(self, prog_name): - parser = super(DeleteAddressGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'address_group', metavar="", @@ -148,7 +148,7 @@ class ListAddressGroup(command.Lister): _description = _("List address groups") def get_parser(self, prog_name): - parser = super(ListAddressGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--name', @@ -213,7 +213,7 @@ class SetAddressGroup(common.NeutronCommandWithExtraArgs): _description = _("Set address group properties") def get_parser(self, prog_name): - parser = super(SetAddressGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'address_group', metavar="", @@ -265,7 +265,7 @@ class ShowAddressGroup(command.ShowOne): _description = _("Display address group details") def get_parser(self, prog_name): - parser = super(ShowAddressGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'address_group', metavar="", @@ -289,7 +289,7 @@ class UnsetAddressGroup(command.Command): _description = _("Unset address group properties") def get_parser(self, prog_name): - parser = super(UnsetAddressGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'address_group', metavar="", diff --git a/openstackclient/network/v2/address_scope.py b/openstackclient/network/v2/address_scope.py index f6f9c6d35..f28215462 100644 --- a/openstackclient/network/v2/address_scope.py +++ b/openstackclient/network/v2/address_scope.py @@ -62,7 +62,7 @@ class CreateAddressScope(command.ShowOne, common.NeutronCommandWithExtraArgs): _description = _("Create a new Address Scope") def get_parser(self, prog_name): - parser = super(CreateAddressScope, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar="", help=_("New address scope name") ) @@ -113,7 +113,7 @@ class DeleteAddressScope(command.Command): _description = _("Delete address scope(s)") def get_parser(self, prog_name): - parser = super(DeleteAddressScope, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'address_scope', metavar="", @@ -155,7 +155,7 @@ class ListAddressScope(command.Lister): _description = _("List address scopes") def get_parser(self, prog_name): - parser = super(ListAddressScope, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--name', @@ -249,7 +249,7 @@ class SetAddressScope(common.NeutronCommandWithExtraArgs): _description = _("Set address scope properties") def get_parser(self, prog_name): - parser = super(SetAddressScope, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'address_scope', metavar="", @@ -294,7 +294,7 @@ class ShowAddressScope(command.ShowOne): _description = _("Display address scope details") def get_parser(self, prog_name): - parser = super(ShowAddressScope, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'address_scope', metavar="", diff --git a/openstackclient/network/v2/floating_ip.py b/openstackclient/network/v2/floating_ip.py index f878a3897..fef7b7d27 100644 --- a/openstackclient/network/v2/floating_ip.py +++ b/openstackclient/network/v2/floating_ip.py @@ -440,7 +440,7 @@ class SetFloatingIP(common.NeutronCommandWithExtraArgs): _description = _("Set floating IP Properties") def get_parser(self, prog_name): - parser = super(SetFloatingIP, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'floating_ip', metavar='', @@ -548,7 +548,7 @@ class UnsetFloatingIP(common.NeutronCommandWithExtraArgs): _description = _("Unset floating IP Properties") def get_parser(self, prog_name): - parser = super(UnsetFloatingIP, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'floating_ip', metavar='', diff --git a/openstackclient/network/v2/floating_ip_port_forwarding.py b/openstackclient/network/v2/floating_ip_port_forwarding.py index 324708ae3..e4a9aa511 100644 --- a/openstackclient/network/v2/floating_ip_port_forwarding.py +++ b/openstackclient/network/v2/floating_ip_port_forwarding.py @@ -98,9 +98,7 @@ class CreateFloatingIPPortForwarding( _description = _("Create floating IP port forwarding") def get_parser(self, prog_name): - parser = super(CreateFloatingIPPortForwarding, self).get_parser( - prog_name - ) + parser = super().get_parser(prog_name) parser.add_argument( '--internal-ip-address', required=True, @@ -201,9 +199,7 @@ class DeleteFloatingIPPortForwarding(command.Command): _description = _("Delete floating IP port forwarding") def get_parser(self, prog_name): - parser = super(DeleteFloatingIPPortForwarding, self).get_parser( - prog_name - ) + parser = super().get_parser(prog_name) parser.add_argument( 'floating_ip', metavar='', @@ -256,9 +252,7 @@ class ListFloatingIPPortForwarding(command.Lister): _description = _("List floating IP port forwarding") def get_parser(self, prog_name): - parser = super(ListFloatingIPPortForwarding, self).get_parser( - prog_name - ) + parser = super().get_parser(prog_name) parser.add_argument( 'floating_ip', metavar='', @@ -358,7 +352,7 @@ class SetFloatingIPPortForwarding(common.NeutronCommandWithExtraArgs): _description = _("Set floating IP Port Forwarding Properties") def get_parser(self, prog_name): - parser = super(SetFloatingIPPortForwarding, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'floating_ip', metavar='', @@ -458,9 +452,7 @@ class ShowFloatingIPPortForwarding(command.ShowOne): _description = _("Display floating IP Port Forwarding details") def get_parser(self, prog_name): - parser = super(ShowFloatingIPPortForwarding, self).get_parser( - prog_name - ) + parser = super().get_parser(prog_name) parser.add_argument( 'floating_ip', metavar='', diff --git a/openstackclient/network/v2/ip_availability.py b/openstackclient/network/v2/ip_availability.py index 49b0c07cd..30b6a0e49 100644 --- a/openstackclient/network/v2/ip_availability.py +++ b/openstackclient/network/v2/ip_availability.py @@ -39,7 +39,7 @@ class ListIPAvailability(command.Lister): _description = _("List IP availability for network") def get_parser(self, prog_name): - parser = super(ListIPAvailability, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--ip-version', type=int, @@ -105,7 +105,7 @@ class ShowIPAvailability(command.ShowOne): _description = _("Show network IP availability details") def get_parser(self, prog_name): - parser = super(ShowIPAvailability, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'network', metavar="", diff --git a/openstackclient/network/v2/l3_conntrack_helper.py b/openstackclient/network/v2/l3_conntrack_helper.py index f55a46133..598ced997 100644 --- a/openstackclient/network/v2/l3_conntrack_helper.py +++ b/openstackclient/network/v2/l3_conntrack_helper.py @@ -49,7 +49,7 @@ class CreateConntrackHelper(command.ShowOne): _description = _("Create a new L3 conntrack helper") def get_parser(self, prog_name): - parser = super(CreateConntrackHelper, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'router', metavar='', @@ -95,7 +95,7 @@ class DeleteConntrackHelper(command.Command): _description = _("Delete L3 conntrack helper") def get_parser(self, prog_name): - parser = super(DeleteConntrackHelper, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'router', metavar='', @@ -143,7 +143,7 @@ class ListConntrackHelper(command.Lister): _description = _("List L3 conntrack helpers") def get_parser(self, prog_name): - parser = super(ListConntrackHelper, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'router', metavar='', @@ -206,7 +206,7 @@ class SetConntrackHelper(command.Command): _description = _("Set L3 conntrack helper properties") def get_parser(self, prog_name): - parser = super(SetConntrackHelper, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'router', metavar='', @@ -253,7 +253,7 @@ class ShowConntrackHelper(command.ShowOne): _description = _("Display L3 conntrack helper details") def get_parser(self, prog_name): - parser = super(ShowConntrackHelper, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'router', metavar='', diff --git a/openstackclient/network/v2/network.py b/openstackclient/network/v2/network.py index 10409cade..86883b35f 100644 --- a/openstackclient/network/v2/network.py +++ b/openstackclient/network/v2/network.py @@ -694,7 +694,7 @@ class SetNetwork(common.NeutronCommandWithExtraArgs): _description = _("Set network properties") def get_parser(self, prog_name): - parser = super(SetNetwork, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'network', metavar="", @@ -838,7 +838,7 @@ class UnsetNetwork(common.NeutronUnsetCommandWithExtraArgs): _description = _("Unset network properties") def get_parser(self, prog_name): - parser = super(UnsetNetwork, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'network', metavar="", diff --git a/openstackclient/network/v2/network_agent.py b/openstackclient/network/v2/network_agent.py index 085e6cfff..d31bd3f56 100644 --- a/openstackclient/network/v2/network_agent.py +++ b/openstackclient/network/v2/network_agent.py @@ -60,7 +60,7 @@ class AddNetworkToAgent(command.Command): _description = _("Add network to an agent") def get_parser(self, prog_name): - parser = super(AddNetworkToAgent, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--dhcp', action='store_true', @@ -99,7 +99,7 @@ class AddRouterToAgent(command.Command): _description = _("Add router to an agent") def get_parser(self, prog_name): - parser = super(AddRouterToAgent, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--l3', action='store_true', help=_('Add router to an L3 agent') ) @@ -128,7 +128,7 @@ class DeleteNetworkAgent(command.Command): _description = _("Delete network agent(s)") def get_parser(self, prog_name): - parser = super(DeleteNetworkAgent, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'network_agent', metavar="", @@ -168,7 +168,7 @@ class ListNetworkAgent(command.Lister): _description = _("List network agents") def get_parser(self, prog_name): - parser = super(ListNetworkAgent, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--agent-type', metavar='', @@ -293,7 +293,7 @@ class RemoveNetworkFromAgent(command.Command): _description = _("Remove network from an agent.") def get_parser(self, prog_name): - parser = super(RemoveNetworkFromAgent, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--dhcp', action='store_true', @@ -331,7 +331,7 @@ class RemoveRouterFromAgent(command.Command): _description = _("Remove router from an agent") def get_parser(self, prog_name): - parser = super(RemoveRouterFromAgent, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--l3', action='store_true', @@ -364,7 +364,7 @@ class SetNetworkAgent(command.Command): _description = _("Set network agent properties") def get_parser(self, prog_name): - parser = super(SetNetworkAgent, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'network_agent', metavar="", @@ -403,7 +403,7 @@ class ShowNetworkAgent(command.ShowOne): _description = _("Display network agent details") def get_parser(self, prog_name): - parser = super(ShowNetworkAgent, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'network_agent', metavar="", diff --git a/openstackclient/network/v2/network_auto_allocated_topology.py b/openstackclient/network/v2/network_auto_allocated_topology.py index b2d0fe1d8..9f382eacf 100644 --- a/openstackclient/network/v2/network_auto_allocated_topology.py +++ b/openstackclient/network/v2/network_auto_allocated_topology.py @@ -65,7 +65,7 @@ class CreateAutoAllocatedTopology(command.ShowOne): _description = _("Create the auto allocated topology for project") def get_parser(self, prog_name): - parser = super(CreateAutoAllocatedTopology, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--project', metavar='', @@ -126,7 +126,7 @@ class DeleteAutoAllocatedTopology(command.Command): _description = _("Delete auto allocated topology for project") def get_parser(self, prog_name): - parser = super(DeleteAutoAllocatedTopology, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--project', metavar='', diff --git a/openstackclient/network/v2/network_flavor.py b/openstackclient/network/v2/network_flavor.py index 2f308bed4..8bc526201 100644 --- a/openstackclient/network/v2/network_flavor.py +++ b/openstackclient/network/v2/network_flavor.py @@ -63,7 +63,7 @@ class AddNetworkFlavorToProfile(command.Command): _description = _("Add a service profile to a network flavor") def get_parser(self, prog_name): - parser = super(AddNetworkFlavorToProfile, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'flavor', metavar="", help=_("Network flavor (name or ID)") ) @@ -93,7 +93,7 @@ class CreateNetworkFlavor(command.ShowOne, common.NeutronCommandWithExtraArgs): _description = _("Create new network flavor") def get_parser(self, prog_name): - parser = super(CreateNetworkFlavor, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar="", help=_("Name for the flavor") ) @@ -146,7 +146,7 @@ class DeleteNetworkFlavor(command.Command): _description = _("Delete network flavors") def get_parser(self, prog_name): - parser = super(DeleteNetworkFlavor, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'flavor', @@ -214,9 +214,7 @@ class RemoveNetworkFlavorFromProfile(command.Command): _description = _("Remove service profile from network flavor") def get_parser(self, prog_name): - parser = super(RemoveNetworkFlavorFromProfile, self).get_parser( - prog_name - ) + parser = super().get_parser(prog_name) parser.add_argument( 'flavor', metavar="", help=_("Network flavor (name or ID)") ) @@ -246,7 +244,7 @@ class SetNetworkFlavor(common.NeutronCommandWithExtraArgs): _description = _("Set network flavor properties") def get_parser(self, prog_name): - parser = super(SetNetworkFlavor, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'flavor', metavar="", @@ -290,7 +288,7 @@ class ShowNetworkFlavor(command.ShowOne): _description = _("Display network flavor details") def get_parser(self, prog_name): - parser = super(ShowNetworkFlavor, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'flavor', metavar='', diff --git a/openstackclient/network/v2/network_flavor_profile.py b/openstackclient/network/v2/network_flavor_profile.py index c063d5dd3..1fb5a8011 100644 --- a/openstackclient/network/v2/network_flavor_profile.py +++ b/openstackclient/network/v2/network_flavor_profile.py @@ -67,7 +67,7 @@ class CreateNetworkFlavorProfile( _description = _("Create new network flavor profile") def get_parser(self, prog_name): - parser = super(CreateNetworkFlavorProfile, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--project', metavar="", @@ -129,7 +129,7 @@ class DeleteNetworkFlavorProfile(command.Command): _description = _("Delete network flavor profile") def get_parser(self, prog_name): - parser = super(DeleteNetworkFlavorProfile, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'flavor_profile', @@ -206,7 +206,7 @@ class SetNetworkFlavorProfile(common.NeutronCommandWithExtraArgs): _description = _("Set network flavor profile properties") def get_parser(self, prog_name): - parser = super(SetNetworkFlavorProfile, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'flavor_profile', metavar="", @@ -263,7 +263,7 @@ class ShowNetworkFlavorProfile(command.ShowOne): _description = _("Display network flavor profile details") def get_parser(self, prog_name): - parser = super(ShowNetworkFlavorProfile, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'flavor_profile', metavar='', diff --git a/openstackclient/network/v2/network_meter.py b/openstackclient/network/v2/network_meter.py index d39bc31f4..5a6a8f2f2 100644 --- a/openstackclient/network/v2/network_meter.py +++ b/openstackclient/network/v2/network_meter.py @@ -65,7 +65,7 @@ class CreateMeter(command.ShowOne, common.NeutronCommandWithExtraArgs): _description = _("Create network meter") def get_parser(self, prog_name): - parser = super(CreateMeter, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--description', @@ -118,7 +118,7 @@ class DeleteMeter(command.Command): _description = _("Delete network meter") def get_parser(self, prog_name): - parser = super(DeleteMeter, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'meter', @@ -187,7 +187,7 @@ class ShowMeter(command.ShowOne): _description = _("Show network meter") def get_parser(self, prog_name): - parser = super(ShowMeter, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'meter', metavar='', help=_('Meter to display (name or ID)') ) diff --git a/openstackclient/network/v2/network_meter_rule.py b/openstackclient/network/v2/network_meter_rule.py index 4e513e342..ea1bea269 100644 --- a/openstackclient/network/v2/network_meter_rule.py +++ b/openstackclient/network/v2/network_meter_rule.py @@ -69,7 +69,7 @@ class CreateMeterRule(command.ShowOne, common.NeutronCommandWithExtraArgs): _description = _("Create a new meter rule") def get_parser(self, prog_name): - parser = super(CreateMeterRule, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--project', @@ -146,7 +146,7 @@ class DeleteMeterRule(command.Command): _description = _("Delete meter rule(s)") def get_parser(self, prog_name): - parser = super(DeleteMeterRule, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'meter_rule_id', @@ -222,7 +222,7 @@ class ShowMeterRule(command.ShowOne): _description = _("Display meter rules details") def get_parser(self, prog_name): - parser = super(ShowMeterRule, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'meter_rule_id', metavar='', diff --git a/openstackclient/network/v2/network_qos_policy.py b/openstackclient/network/v2/network_qos_policy.py index ca0f87119..5023ea988 100644 --- a/openstackclient/network/v2/network_qos_policy.py +++ b/openstackclient/network/v2/network_qos_policy.py @@ -85,7 +85,7 @@ class CreateNetworkQosPolicy( _description = _("Create a QoS policy") def get_parser(self, prog_name): - parser = super(CreateNetworkQosPolicy, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar='', help=_("Name of QoS policy to create") ) @@ -144,7 +144,7 @@ class DeleteNetworkQosPolicy(command.Command): _description = _("Delete Qos Policy(s)") def get_parser(self, prog_name): - parser = super(DeleteNetworkQosPolicy, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'policy', metavar="", @@ -185,7 +185,7 @@ class ListNetworkQosPolicy(command.Lister): _description = _("List QoS policies") def get_parser(self, prog_name): - parser = super(ListNetworkQosPolicy, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--project', metavar='', @@ -244,7 +244,7 @@ class SetNetworkQosPolicy(common.NeutronCommandWithExtraArgs): _description = _("Set QoS policy properties") def get_parser(self, prog_name): - parser = super(SetNetworkQosPolicy, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'policy', metavar="", @@ -296,7 +296,7 @@ class ShowNetworkQosPolicy(command.ShowOne): _description = _("Display QoS policy details") def get_parser(self, prog_name): - parser = super(ShowNetworkQosPolicy, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'policy', metavar="", diff --git a/openstackclient/network/v2/network_qos_rule.py b/openstackclient/network/v2/network_qos_rule.py index a6529c8b8..70f4d2843 100644 --- a/openstackclient/network/v2/network_qos_rule.py +++ b/openstackclient/network/v2/network_qos_rule.py @@ -159,10 +159,10 @@ def _get_item_properties(item, fields): def _rule_action_call(client, action, rule_type): rule_type = rule_type.replace('-', '_') - func_name = '%(action)s_qos_%(rule_type)s_rule' % { - 'action': action, - 'rule_type': rule_type, - } + func_name = '{action}_qos_{rule_type}_rule'.format( + action=action, + rule_type=rule_type, + ) return getattr(client, func_name) @@ -243,7 +243,7 @@ class CreateNetworkQosRule( _description = _("Create new Network QoS rule") def get_parser(self, prog_name): - parser = super(CreateNetworkQosRule, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'qos_policy', metavar='', @@ -289,7 +289,7 @@ class DeleteNetworkQosRule(command.Command): _description = _("Delete Network QoS rule") def get_parser(self, prog_name): - parser = super(DeleteNetworkQosRule, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'qos_policy', metavar='', @@ -326,7 +326,7 @@ class ListNetworkQosRule(command.Lister): _description = _("List Network QoS rules") def get_parser(self, prog_name): - parser = super(ListNetworkQosRule, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'qos_policy', metavar='', @@ -372,7 +372,7 @@ class SetNetworkQosRule(common.NeutronCommandWithExtraArgs): _description = _("Set Network QoS rule properties") def get_parser(self, prog_name): - parser = super(SetNetworkQosRule, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'qos_policy', metavar='', @@ -418,7 +418,7 @@ class ShowNetworkQosRule(command.ShowOne): _description = _("Display Network QoS rule details") def get_parser(self, prog_name): - parser = super(ShowNetworkQosRule, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'qos_policy', metavar='', diff --git a/openstackclient/network/v2/network_qos_rule_type.py b/openstackclient/network/v2/network_qos_rule_type.py index 24702070b..fd4da84af 100644 --- a/openstackclient/network/v2/network_qos_rule_type.py +++ b/openstackclient/network/v2/network_qos_rule_type.py @@ -83,7 +83,7 @@ class ShowNetworkQosRuleType(command.ShowOne): _description = _("Show details about supported QoS rule type") def get_parser(self, prog_name): - parser = super(ShowNetworkQosRuleType, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'rule_type', metavar="", diff --git a/openstackclient/network/v2/network_rbac.py b/openstackclient/network/v2/network_rbac.py index cb28ea3b2..e3e5aff19 100644 --- a/openstackclient/network/v2/network_rbac.py +++ b/openstackclient/network/v2/network_rbac.py @@ -96,7 +96,7 @@ class CreateNetworkRBAC(command.ShowOne, common.NeutronCommandWithExtraArgs): _description = _("Create network RBAC policy") def get_parser(self, prog_name): - parser = super(CreateNetworkRBAC, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'rbac_object', metavar="", @@ -182,7 +182,7 @@ class DeleteNetworkRBAC(command.Command): _description = _("Delete network RBAC policy(s)") def get_parser(self, prog_name): - parser = super(DeleteNetworkRBAC, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'rbac_policy', metavar="", @@ -221,7 +221,7 @@ class ListNetworkRBAC(command.Lister): _description = _("List network RBAC policies") def get_parser(self, prog_name): - parser = super(ListNetworkRBAC, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--type', metavar='', @@ -315,7 +315,7 @@ class SetNetworkRBAC(common.NeutronCommandWithExtraArgs): _description = _("Set network RBAC policy properties") def get_parser(self, prog_name): - parser = super(SetNetworkRBAC, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'rbac_policy', metavar="", @@ -364,7 +364,7 @@ class ShowNetworkRBAC(command.ShowOne): _description = _("Display network RBAC policy details") def get_parser(self, prog_name): - parser = super(ShowNetworkRBAC, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'rbac_policy', metavar="", diff --git a/openstackclient/network/v2/network_segment.py b/openstackclient/network/v2/network_segment.py index a17f37c03..740952315 100644 --- a/openstackclient/network/v2/network_segment.py +++ b/openstackclient/network/v2/network_segment.py @@ -39,7 +39,7 @@ class CreateNetworkSegment( _description = _("Create new network segment") def get_parser(self, prog_name): - parser = super(CreateNetworkSegment, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar='', help=_('New network segment name') ) @@ -109,7 +109,7 @@ class DeleteNetworkSegment(command.Command): _description = _("Delete network segment(s)") def get_parser(self, prog_name): - parser = super(DeleteNetworkSegment, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'network_segment', metavar='', @@ -150,7 +150,7 @@ class ListNetworkSegment(command.Lister): _description = _("List network segments") def get_parser(self, prog_name): - parser = super(ListNetworkSegment, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--long', action='store_true', @@ -213,7 +213,7 @@ class SetNetworkSegment(common.NeutronCommandWithExtraArgs): _description = _("Set network segment properties") def get_parser(self, prog_name): - parser = super(SetNetworkSegment, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'network_segment', metavar='', @@ -251,7 +251,7 @@ class ShowNetworkSegment(command.ShowOne): _description = _("Display network segment details") def get_parser(self, prog_name): - parser = super(ShowNetworkSegment, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'network_segment', metavar='', diff --git a/openstackclient/network/v2/network_segment_range.py b/openstackclient/network/v2/network_segment_range.py index 59957617b..aa0509969 100644 --- a/openstackclient/network/v2/network_segment_range.py +++ b/openstackclient/network/v2/network_segment_range.py @@ -44,9 +44,7 @@ def _get_ranges(item): for a, b in itertools.groupby(enumerate(item), lambda xy: xy[1] - xy[0]): b = list(b) yield ( - "%s-%s" % (b[0][1], b[-1][1]) - if b[0][1] != b[-1][1] - else str(b[0][1]) + f"{b[0][1]}-{b[-1][1]}" if b[0][1] != b[-1][1] else str(b[0][1]) ) @@ -100,7 +98,7 @@ class CreateNetworkSegmentRange( _description = _("Create new network segment range") def get_parser(self, prog_name): - parser = super(CreateNetworkSegmentRange, self).get_parser(prog_name) + parser = super().get_parser(prog_name) shared_group = parser.add_mutually_exclusive_group() shared_group.add_argument( "--private", @@ -256,7 +254,7 @@ class DeleteNetworkSegmentRange(command.Command): _description = _("Delete network segment range(s)") def get_parser(self, prog_name): - parser = super(DeleteNetworkSegmentRange, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'network_segment_range', metavar='', @@ -309,7 +307,7 @@ class ListNetworkSegmentRange(command.Lister): _description = _("List network segment ranges") def get_parser(self, prog_name): - parser = super(ListNetworkSegmentRange, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--long', action='store_true', @@ -425,7 +423,7 @@ class SetNetworkSegmentRange(common.NeutronCommandWithExtraArgs): _description = _("Set network segment range properties") def get_parser(self, prog_name): - parser = super(SetNetworkSegmentRange, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'network_segment_range', metavar='', @@ -490,7 +488,7 @@ class ShowNetworkSegmentRange(command.ShowOne): _description = _("Display network segment range details") def get_parser(self, prog_name): - parser = super(ShowNetworkSegmentRange, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'network_segment_range', metavar='', diff --git a/openstackclient/network/v2/network_trunk.py b/openstackclient/network/v2/network_trunk.py index 6050ba657..2b00d03ec 100644 --- a/openstackclient/network/v2/network_trunk.py +++ b/openstackclient/network/v2/network_trunk.py @@ -43,7 +43,7 @@ class CreateNetworkTrunk(command.ShowOne): """Create a network trunk for a given project""" def get_parser(self, prog_name): - parser = super(CreateNetworkTrunk, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar='', help=_("Name of the trunk to create") ) @@ -100,7 +100,7 @@ class DeleteNetworkTrunk(command.Command): """Delete a given network trunk""" def get_parser(self, prog_name): - parser = super(DeleteNetworkTrunk, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'trunk', metavar="", @@ -138,7 +138,7 @@ class ListNetworkTrunk(command.Lister): """List all network trunks""" def get_parser(self, prog_name): - parser = super(ListNetworkTrunk, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--long', action='store_true', @@ -177,7 +177,7 @@ class SetNetworkTrunk(command.Command): """Set network trunk properties""" def get_parser(self, prog_name): - parser = super(SetNetworkTrunk, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'trunk', metavar="", help=_("Trunk to modify (name or ID)") ) @@ -242,7 +242,7 @@ class ShowNetworkTrunk(command.ShowOne): """Show information of a given network trunk""" def get_parser(self, prog_name): - parser = super(ShowNetworkTrunk, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'trunk', metavar="", help=_("Trunk to display (name or ID)") ) @@ -263,7 +263,7 @@ class ListNetworkSubport(command.Lister): """List all subports for a given network trunk""" def get_parser(self, prog_name): - parser = super(ListNetworkSubport, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--trunk', required=True, @@ -294,7 +294,7 @@ class UnsetNetworkTrunk(command.Command): """Unset subports from a given network trunk""" def get_parser(self, prog_name): - parser = super(UnsetNetworkTrunk, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'trunk', metavar="", diff --git a/openstackclient/network/v2/port.py b/openstackclient/network/v2/port.py index 0e5fe7605..95e9f5a8a 100644 --- a/openstackclient/network/v2/port.py +++ b/openstackclient/network/v2/port.py @@ -444,7 +444,7 @@ class CreatePort(command.ShowOne, common.NeutronCommandWithExtraArgs): _description = _("Create a new port") def get_parser(self, prog_name): - parser = super(CreatePort, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--network', @@ -681,7 +681,7 @@ class DeletePort(command.Command): _description = _("Delete port(s)") def get_parser(self, prog_name): - parser = super(DeletePort, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'port', metavar="", @@ -723,7 +723,7 @@ class ListPort(command.Lister): _description = _("List ports") def get_parser(self, prog_name): - parser = super(ListPort, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--device-owner', metavar='', @@ -896,7 +896,7 @@ class SetPort(common.NeutronCommandWithExtraArgs): _description = _("Set port properties") def get_parser(self, prog_name): - parser = super(SetPort, self).get_parser(prog_name) + parser = super().get_parser(prog_name) _add_updatable_args(parser) admin_group = parser.add_mutually_exclusive_group() admin_group.add_argument( @@ -1135,7 +1135,7 @@ class ShowPort(command.ShowOne): _description = _("Display port details") def get_parser(self, prog_name): - parser = super(ShowPort, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'port', metavar="", help=_("Port to display (name or ID)") ) @@ -1155,7 +1155,7 @@ class UnsetPort(common.NeutronUnsetCommandWithExtraArgs): _description = _("Unset port properties") def get_parser(self, prog_name): - parser = super(UnsetPort, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--fixed-ip', metavar='subnet=,ip-address=', diff --git a/openstackclient/network/v2/router.py b/openstackclient/network/v2/router.py index e72d3e2f5..7bf730727 100644 --- a/openstackclient/network/v2/router.py +++ b/openstackclient/network/v2/router.py @@ -301,7 +301,7 @@ class AddPortToRouter(command.Command): _description = _("Add a port to a router") def get_parser(self, prog_name): - parser = super(AddPortToRouter, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'router', metavar='', @@ -325,7 +325,7 @@ class AddSubnetToRouter(command.Command): _description = _("Add a subnet to a router") def get_parser(self, prog_name): - parser = super(AddSubnetToRouter, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'router', metavar='', @@ -351,7 +351,7 @@ class AddExtraRoutesToRouter(command.ShowOne): _description = _("Add extra static routes to a router's routing table.") def get_parser(self, prog_name): - parser = super(AddExtraRoutesToRouter, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'router', metavar='', @@ -402,7 +402,7 @@ class RemoveExtraRoutesFromRouter(command.ShowOne): ) def get_parser(self, prog_name): - parser = super(RemoveExtraRoutesFromRouter, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'router', metavar='', @@ -453,7 +453,7 @@ class CreateRouter(command.ShowOne, common.NeutronCommandWithExtraArgs): _description = _("Create a new router") def get_parser(self, prog_name): - parser = super(CreateRouter, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar='', help=_("New router name") ) @@ -627,7 +627,7 @@ class DeleteRouter(command.Command): _description = _("Delete router(s)") def get_parser(self, prog_name): - parser = super(DeleteRouter, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'router', metavar="", @@ -669,7 +669,7 @@ class ListRouter(command.Lister): _description = _("List routers") def get_parser(self, prog_name): - parser = super(ListRouter, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--name', metavar='', @@ -813,7 +813,7 @@ class RemovePortFromRouter(command.Command): _description = _("Remove a port from a router") def get_parser(self, prog_name): - parser = super(RemovePortFromRouter, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'router', metavar='', @@ -839,7 +839,7 @@ class RemoveSubnetFromRouter(command.Command): _description = _("Remove a subnet from a router") def get_parser(self, prog_name): - parser = super(RemoveSubnetFromRouter, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'router', metavar='', @@ -869,7 +869,7 @@ class SetRouter(common.NeutronCommandWithExtraArgs): _description = _("Set router properties") def get_parser(self, prog_name): - parser = super(SetRouter, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'router', metavar="", @@ -1103,7 +1103,7 @@ class ShowRouter(command.ShowOne): _description = _("Display router details") def get_parser(self, prog_name): - parser = super(ShowRouter, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'router', metavar="", @@ -1139,7 +1139,7 @@ class UnsetRouter(common.NeutronUnsetCommandWithExtraArgs): _description = _("Unset router properties") def get_parser(self, prog_name): - parser = super(UnsetRouter, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--route', metavar='destination=,gateway=', diff --git a/openstackclient/network/v2/security_group.py b/openstackclient/network/v2/security_group.py index 6de9cad30..90b09cae8 100644 --- a/openstackclient/network/v2/security_group.py +++ b/openstackclient/network/v2/security_group.py @@ -434,7 +434,7 @@ class UnsetSecurityGroup(command.Command): _description = _("Unset security group properties") def get_parser(self, prog_name): - parser = super(UnsetSecurityGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'group', metavar="", diff --git a/openstackclient/network/v2/subnet.py b/openstackclient/network/v2/subnet.py index a9af74bba..3d172adb1 100644 --- a/openstackclient/network/v2/subnet.py +++ b/openstackclient/network/v2/subnet.py @@ -46,7 +46,7 @@ def _update_arguments(obj_list, parsed_args_list, option): class AllocationPoolsColumn(cliff_columns.FormattableColumn): def human_readable(self): pool_formatted = [ - '%s-%s' % (pool.get('start', ''), pool.get('end', '')) + '{}-{}'.format(pool.get('start', ''), pool.get('end', '')) for pool in self._value ] return ','.join(pool_formatted) @@ -292,7 +292,7 @@ class CreateSubnet(command.ShowOne, common.NeutronCommandWithExtraArgs): _description = _("Create a subnet") def get_parser(self, prog_name): - parser = super(CreateSubnet, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar='', help=_("New subnet name") ) @@ -436,7 +436,7 @@ class DeleteSubnet(command.Command): _description = _("Delete subnet(s)") def get_parser(self, prog_name): - parser = super(DeleteSubnet, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'subnet', metavar="", @@ -478,7 +478,7 @@ class ListSubnet(command.Lister): _description = _("List subnets") def get_parser(self, prog_name): - parser = super(ListSubnet, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--long', action='store_true', @@ -651,7 +651,7 @@ class SetSubnet(common.NeutronCommandWithExtraArgs): _description = _("Set subnet properties") def get_parser(self, prog_name): - parser = super(SetSubnet, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'subnet', metavar="", @@ -744,7 +744,7 @@ class ShowSubnet(command.ShowOne): _description = _("Display subnet details") def get_parser(self, prog_name): - parser = super(ShowSubnet, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'subnet', metavar="", @@ -765,7 +765,7 @@ class UnsetSubnet(common.NeutronUnsetCommandWithExtraArgs): _description = _("Unset subnet properties") def get_parser(self, prog_name): - parser = super(UnsetSubnet, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--allocation-pool', metavar='start=,end=', diff --git a/openstackclient/network/v2/subnet_pool.py b/openstackclient/network/v2/subnet_pool.py index 833fe3257..c6d92a6b4 100644 --- a/openstackclient/network/v2/subnet_pool.py +++ b/openstackclient/network/v2/subnet_pool.py @@ -155,7 +155,7 @@ class CreateSubnetPool(command.ShowOne, common.NeutronCommandWithExtraArgs): _description = _("Create subnet pool") def get_parser(self, prog_name): - parser = super(CreateSubnetPool, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar='', help=_("Name of the new subnet pool") ) @@ -226,7 +226,7 @@ class DeleteSubnetPool(command.Command): _description = _("Delete subnet pool(s)") def get_parser(self, prog_name): - parser = super(DeleteSubnetPool, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'subnet_pool', metavar='', @@ -267,7 +267,7 @@ class ListSubnetPool(command.Lister): _description = _("List subnet pools") def get_parser(self, prog_name): - parser = super(ListSubnetPool, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--long', action='store_true', @@ -393,7 +393,7 @@ class SetSubnetPool(common.NeutronCommandWithExtraArgs): _description = _("Set subnet pool properties") def get_parser(self, prog_name): - parser = super(SetSubnetPool, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'subnet_pool', metavar='', @@ -464,7 +464,7 @@ class ShowSubnetPool(command.ShowOne): _description = _("Display subnet pool details") def get_parser(self, prog_name): - parser = super(ShowSubnetPool, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'subnet_pool', metavar='', @@ -486,7 +486,7 @@ class UnsetSubnetPool(command.Command): _description = _("Unset subnet pool properties") def get_parser(self, prog_name): - parser = super(UnsetSubnetPool, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'subnet_pool', metavar="", diff --git a/openstackclient/object/v1/account.py b/openstackclient/object/v1/account.py index ef3a47f79..686fdcc62 100644 --- a/openstackclient/object/v1/account.py +++ b/openstackclient/object/v1/account.py @@ -24,7 +24,7 @@ class SetAccount(command.Command): _description = _("Set account properties") def get_parser(self, prog_name): - parser = super(SetAccount, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "--property", metavar="", @@ -59,7 +59,7 @@ class UnsetAccount(command.Command): _description = _("Unset account properties") def get_parser(self, prog_name): - parser = super(UnsetAccount, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--property', metavar='', diff --git a/openstackclient/object/v1/container.py b/openstackclient/object/v1/container.py index 25108e2c6..c4d0e42b9 100644 --- a/openstackclient/object/v1/container.py +++ b/openstackclient/object/v1/container.py @@ -32,7 +32,7 @@ class CreateContainer(command.Lister): _description = _("Create new container") def get_parser(self, prog_name): - parser = super(CreateContainer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--public', action='store_true', @@ -85,7 +85,7 @@ class DeleteContainer(command.Command): _description = _("Delete container") def get_parser(self, prog_name): - parser = super(DeleteContainer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--recursive', '-r', @@ -121,7 +121,7 @@ class ListContainer(command.Lister): _description = _("List containers") def get_parser(self, prog_name): - parser = super(ListContainer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "--prefix", metavar="", @@ -184,7 +184,7 @@ class SaveContainer(command.Command): _description = _("Save container contents locally") def get_parser(self, prog_name): - parser = super(SaveContainer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'container', metavar='', @@ -202,7 +202,7 @@ class SetContainer(command.Command): _description = _("Set container properties") def get_parser(self, prog_name): - parser = super(SetContainer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'container', metavar='', @@ -231,7 +231,7 @@ class ShowContainer(command.ShowOne): _description = _("Display container details") def get_parser(self, prog_name): - parser = super(ShowContainer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'container', metavar='', @@ -253,7 +253,7 @@ class UnsetContainer(command.Command): _description = _("Unset container properties") def get_parser(self, prog_name): - parser = super(UnsetContainer, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'container', metavar='', diff --git a/openstackclient/object/v1/object.py b/openstackclient/object/v1/object.py index 24cebb3b8..4edb31493 100644 --- a/openstackclient/object/v1/object.py +++ b/openstackclient/object/v1/object.py @@ -34,7 +34,7 @@ class CreateObject(command.Lister): _description = _("Upload object to container") def get_parser(self, prog_name): - parser = super(CreateObject, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'container', metavar='', @@ -99,7 +99,7 @@ class DeleteObject(command.Command): _description = _("Delete object from container") def get_parser(self, prog_name): - parser = super(DeleteObject, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'container', metavar='', @@ -125,7 +125,7 @@ class ListObject(command.Lister): _description = _("List objects") def get_parser(self, prog_name): - parser = super(ListObject, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "container", metavar="", @@ -208,7 +208,7 @@ class SaveObject(command.Command): _description = _("Save object locally") def get_parser(self, prog_name): - parser = super(SaveObject, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "--file", metavar="", @@ -241,7 +241,7 @@ class SetObject(command.Command): _description = _("Set object properties") def get_parser(self, prog_name): - parser = super(SetObject, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'container', metavar='', @@ -276,7 +276,7 @@ class ShowObject(command.ShowOne): _description = _("Display object details") def get_parser(self, prog_name): - parser = super(ShowObject, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'container', metavar='', @@ -304,7 +304,7 @@ class UnsetObject(command.Command): _description = _("Unset object properties") def get_parser(self, prog_name): - parser = super(UnsetObject, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'container', metavar='', diff --git a/openstackclient/shell.py b/openstackclient/shell.py index 68ebf8a47..5c64cb7cb 100644 --- a/openstackclient/shell.py +++ b/openstackclient/shell.py @@ -32,7 +32,7 @@ class OpenStackShell(shell.OpenStackShell): def __init__(self): - super(OpenStackShell, self).__init__( + super().__init__( description=__doc__.strip(), version=openstackclient.__version__, command_manager=commandmanager.CommandManager('openstack.cli'), @@ -49,15 +49,13 @@ def __init__(self): warnings.filterwarnings('ignore', module='openstack') def build_option_parser(self, description, version): - parser = super(OpenStackShell, self).build_option_parser( - description, version - ) + parser = super().build_option_parser(description, version) parser = clientmanager.build_plugin_option_parser(parser) parser = auth.build_auth_plugins_option_parser(parser) return parser def _final_defaults(self): - super(OpenStackShell, self)._final_defaults() + super()._final_defaults() # Set the default plugin to admin_token if endpoint and token are given if self.options.endpoint and self.options.token: @@ -132,7 +130,7 @@ def _load_commands(self): self.command_manager.add_command_group('openstack.extension') def initialize_app(self, argv): - super(OpenStackShell, self).initialize_app(argv) + super().initialize_app(argv) # Re-create the client_manager with our subclass self.client_manager = clientmanager.ClientManager( diff --git a/openstackclient/tests/functional/base.py b/openstackclient/tests/functional/base.py index 42fee80dc..2539c56fc 100644 --- a/openstackclient/tests/functional/base.py +++ b/openstackclient/tests/functional/base.py @@ -137,7 +137,7 @@ def get_openstack_configuration_value(cls, configuration): @classmethod def get_opts(cls, fields, output_format='value'): - return ' -f {0} {1}'.format( + return ' -f {} {}'.format( output_format, ' '.join(['-c ' + it for it in fields]) ) diff --git a/openstackclient/tests/functional/common/test_extension.py b/openstackclient/tests/functional/common/test_extension.py index 8784c55b1..c65f52db5 100644 --- a/openstackclient/tests/functional/common/test_extension.py +++ b/openstackclient/tests/functional/common/test_extension.py @@ -23,7 +23,7 @@ class ExtensionTests(base.TestCase): @classmethod def setUpClass(cls): - super(ExtensionTests, cls).setUpClass() + super().setUpClass() cls.haz_network = cls.is_service_enabled('network') def test_extension_list_compute(self): diff --git a/openstackclient/tests/functional/common/test_help.py b/openstackclient/tests/functional/common/test_help.py index 0df3b5bec..f1aea8ee9 100644 --- a/openstackclient/tests/functional/common/test_help.py +++ b/openstackclient/tests/functional/common/test_help.py @@ -60,12 +60,12 @@ def test_server_commands_main_help(self): """Check server commands in main help message.""" raw_output = self.openstack('help') for command, description in self.SERVER_COMMANDS: - msg = 'Command: %s not found in help output:\n%s' % ( + msg = 'Command: {} not found in help output:\n{}'.format( command, raw_output, ) self.assertIn(command, raw_output, msg) - msg = 'Description: %s not found in help output:\n%s' % ( + msg = 'Description: {} not found in help output:\n{}'.format( description, raw_output, ) diff --git a/openstackclient/tests/functional/common/test_quota.py b/openstackclient/tests/functional/common/test_quota.py index be147c77f..0ee27c84e 100644 --- a/openstackclient/tests/functional/common/test_quota.py +++ b/openstackclient/tests/functional/common/test_quota.py @@ -187,7 +187,7 @@ def test_quota_set_class(self): self.assertTrue(cmd_output["snapshots"] >= 0) def _restore_quota_limit(self, resource, limit, project): - self.openstack('quota set --%s %s %s' % (resource, limit, project)) + self.openstack(f'quota set --{resource} {limit} {project}') def test_quota_network_set_with_no_force(self): if not self.haz_network: diff --git a/openstackclient/tests/functional/compute/v2/common.py b/openstackclient/tests/functional/compute/v2/common.py index 885dc1d91..ef59d458a 100644 --- a/openstackclient/tests/functional/compute/v2/common.py +++ b/openstackclient/tests/functional/compute/v2/common.py @@ -28,7 +28,7 @@ class ComputeTestCase(base.TestCase): def setUp(self): """Select common resources""" - super(ComputeTestCase, self).setUp() + super().setUp() self.flavor_name = self.get_flavor() self.image_name = self.get_image() self.network_arg = self.get_network() @@ -129,7 +129,7 @@ def wait_for_status( ) status = cmd_output['status'] if status == expected_status: - print('Server {} now has status {}'.format(name, status)) + print(f'Server {name} now has status {status}') break print( 'Server {}: Waiting for {}, current status: {}'.format( diff --git a/openstackclient/tests/functional/compute/v2/test_flavor.py b/openstackclient/tests/functional/compute/v2/test_flavor.py index 227e21d5e..4a0ff4883 100644 --- a/openstackclient/tests/functional/compute/v2/test_flavor.py +++ b/openstackclient/tests/functional/compute/v2/test_flavor.py @@ -22,7 +22,7 @@ class FlavorTests(base.TestCase): @classmethod def setUpClass(cls): - super(FlavorTests, cls).setUpClass() + super().setUpClass() # Make a project cmd_output = cls.openstack( "project create --enable " + cls.PROJECT_NAME, @@ -36,7 +36,7 @@ def tearDownClass(cls): raw_output = cls.openstack("project delete " + cls.PROJECT_NAME) cls.assertOutput('', raw_output) finally: - super(FlavorTests, cls).tearDownClass() + super().tearDownClass() def test_flavor_delete(self): """Test create w/project, delete multiple""" diff --git a/openstackclient/tests/functional/compute/v2/test_keypair.py b/openstackclient/tests/functional/compute/v2/test_keypair.py index 148e9451a..ebc78abda 100644 --- a/openstackclient/tests/functional/compute/v2/test_keypair.py +++ b/openstackclient/tests/functional/compute/v2/test_keypair.py @@ -57,7 +57,7 @@ class KeypairTests(KeypairBase): def setUp(self): """Create keypair with randomized name for tests.""" - super(KeypairTests, self).setUp() + super().setUp() self.KPName = data_utils.rand_name('TestKeyPair') self.keypair = self.keypair_create(self.KPName) diff --git a/openstackclient/tests/functional/compute/v2/test_server.py b/openstackclient/tests/functional/compute/v2/test_server.py index d04fe31d6..e465acc4a 100644 --- a/openstackclient/tests/functional/compute/v2/test_server.py +++ b/openstackclient/tests/functional/compute/v2/test_server.py @@ -211,7 +211,7 @@ def test_server_set(self): flavor['name'], ) self.assertEqual( - '%s (%s)' % (flavor['name'], flavor['id']), + '{} ({})'.format(flavor['name'], flavor['id']), cmd_output["flavor"], ) image = self.openstack( @@ -223,7 +223,7 @@ def test_server_set(self): image['name'], ) self.assertEqual( - '%s (%s)' % (image['name'], image['id']), + '{} ({})'.format(image['name'], image['id']), cmd_output["image"], ) diff --git a/openstackclient/tests/functional/compute/v2/test_server_event.py b/openstackclient/tests/functional/compute/v2/test_server_event.py index c7ead8144..790aec69d 100644 --- a/openstackclient/tests/functional/compute/v2/test_server_event.py +++ b/openstackclient/tests/functional/compute/v2/test_server_event.py @@ -20,7 +20,7 @@ class ServerEventTests(common.ComputeTestCase): """Functional tests for server event""" def setUp(self): - super(ServerEventTests, self).setUp() + super().setUp() # NOTE(dtroyer): As long as these tests are read-only we can get away # with using the same server instance for all of them. diff --git a/openstackclient/tests/functional/identity/v2/common.py b/openstackclient/tests/functional/identity/v2/common.py index 9d3601eb3..a78f3b031 100644 --- a/openstackclient/tests/functional/identity/v2/common.py +++ b/openstackclient/tests/functional/identity/v2/common.py @@ -59,7 +59,7 @@ class IdentityTests(base.TestCase): @classmethod def setUpClass(cls): - super(IdentityTests, cls).setUpClass() + super().setUpClass() # create dummy project cls.project_name = data_utils.rand_name('TestProject') cls.project_description = data_utils.rand_name('description') @@ -90,10 +90,10 @@ def tearDownClass(cls): 'project delete %s' % cls.project_name ) finally: - super(IdentityTests, cls).tearDownClass() + super().tearDownClass() def setUp(self): - super(IdentityTests, self).setUp() + super().setUp() # prepare v2 env ver_fixture = fixtures.EnvironmentVariable( 'OS_IDENTITY_API_VERSION', '2.0' diff --git a/openstackclient/tests/functional/identity/v3/common.py b/openstackclient/tests/functional/identity/v3/common.py index b3d55e654..8607c0573 100644 --- a/openstackclient/tests/functional/identity/v3/common.py +++ b/openstackclient/tests/functional/identity/v3/common.py @@ -140,7 +140,7 @@ class IdentityTests(base.TestCase): @classmethod def setUpClass(cls): - super(IdentityTests, cls).setUpClass() + super().setUpClass() # create dummy domain cls.domain_name = data_utils.rand_name('TestDomain') cls.domain_description = data_utils.rand_name('description') @@ -188,10 +188,10 @@ def tearDownClass(cls): 'domain delete %s' % cls.domain_name ) finally: - super(IdentityTests, cls).tearDownClass() + super().tearDownClass() def setUp(self): - super(IdentityTests, self).setUp() + super().setUp() # prepare v3 env ver_fixture = fixtures.EnvironmentVariable( 'OS_IDENTITY_API_VERSION', '3' diff --git a/openstackclient/tests/functional/identity/v3/test_application_credential.py b/openstackclient/tests/functional/identity/v3/test_application_credential.py index dbec1cb24..22f2b90bb 100644 --- a/openstackclient/tests/functional/identity/v3/test_application_credential.py +++ b/openstackclient/tests/functional/identity/v3/test_application_credential.py @@ -39,12 +39,10 @@ class ApplicationCredentialTests(common.IdentityTests): def test_application_credential_create(self): name = data_utils.rand_name('name') - raw_output = self.openstack( - 'application credential create %(name)s' % {'name': name} - ) + raw_output = self.openstack(f'application credential create {name}') self.addCleanup( self.openstack, - 'application credential delete %(name)s' % {'name': name}, + f'application credential delete {name}', ) items = self.parse_show(raw_output) self.assert_show_fields(items, self.APPLICATION_CREDENTIAL_FIELDS) @@ -145,16 +143,14 @@ def test_application_credential_create_with_options(self): ) self.addCleanup( self.openstack, - 'application credential delete %(name)s' % {'name': name}, + f'application credential delete {name}', ) items = self.parse_show(raw_output) self.assert_show_fields(items, self.APPLICATION_CREDENTIAL_FIELDS) def test_application_credential_delete(self): name = data_utils.rand_name('name') - self.openstack( - 'application credential create %(name)s' % {'name': name} - ) + self.openstack(f'application credential create {name}') raw_output = self.openstack( 'application credential delete ' '%(name)s' % {'name': name} ) @@ -169,12 +165,10 @@ def test_application_credential_list(self): def test_application_credential_show(self): name = data_utils.rand_name('name') - raw_output = self.openstack( - 'application credential create %(name)s' % {'name': name} - ) + raw_output = self.openstack(f'application credential create {name}') self.addCleanup( self.openstack, - 'application credential delete %(name)s' % {'name': name}, + f'application credential delete {name}', ) raw_output = self.openstack( 'application credential show ' '%(name)s' % {'name': name} diff --git a/openstackclient/tests/functional/identity/v3/test_domain.py b/openstackclient/tests/functional/identity/v3/test_domain.py index bf5020ca6..08e0e0790 100644 --- a/openstackclient/tests/functional/identity/v3/test_domain.py +++ b/openstackclient/tests/functional/identity/v3/test_domain.py @@ -50,9 +50,7 @@ def test_domain_multi_delete(self): self.assertEqual(0, len(raw_output)) raw_output = self.openstack('domain set --disable %s' % domain_2) self.assertEqual(0, len(raw_output)) - raw_output = self.openstack( - 'domain delete %s %s' % (domain_1, domain_2) - ) + raw_output = self.openstack(f'domain delete {domain_1} {domain_2}') self.assertEqual(0, len(raw_output)) def test_domain_delete_failure(self): diff --git a/openstackclient/tests/functional/identity/v3/test_endpoint.py b/openstackclient/tests/functional/identity/v3/test_endpoint.py index 53f2bd22b..1fff6abeb 100644 --- a/openstackclient/tests/functional/identity/v3/test_endpoint.py +++ b/openstackclient/tests/functional/identity/v3/test_endpoint.py @@ -30,7 +30,7 @@ def test_endpoint_multi_delete(self): endpoint_1 = self._create_dummy_endpoint(add_clean_up=False) endpoint_2 = self._create_dummy_endpoint(add_clean_up=False) raw_output = self.openstack( - 'endpoint delete %s %s' % (endpoint_1, endpoint_2) + f'endpoint delete {endpoint_1} {endpoint_2}' ) self.assertEqual(0, len(raw_output)) diff --git a/openstackclient/tests/functional/identity/v3/test_idp.py b/openstackclient/tests/functional/identity/v3/test_idp.py index b359da7cd..05f3ee84e 100644 --- a/openstackclient/tests/functional/identity/v3/test_idp.py +++ b/openstackclient/tests/functional/identity/v3/test_idp.py @@ -32,7 +32,7 @@ def test_idp_multi_delete(self): idp_1 = self._create_dummy_idp(add_clean_up=False) idp_2 = self._create_dummy_idp(add_clean_up=False) raw_output = self.openstack( - 'identity provider delete %s %s' % (idp_1, idp_2) + f'identity provider delete {idp_1} {idp_2}' ) self.assertEqual(0, len(raw_output)) diff --git a/openstackclient/tests/functional/identity/v3/test_region.py b/openstackclient/tests/functional/identity/v3/test_region.py index bc014737d..48ca83781 100644 --- a/openstackclient/tests/functional/identity/v3/test_region.py +++ b/openstackclient/tests/functional/identity/v3/test_region.py @@ -29,9 +29,7 @@ def test_region_delete(self): def test_region_multi_delete(self): region_1 = self._create_dummy_region(add_clean_up=False) region_2 = self._create_dummy_region(add_clean_up=False) - raw_output = self.openstack( - 'region delete %s %s' % (region_1, region_2) - ) + raw_output = self.openstack(f'region delete {region_1} {region_2}') self.assertEqual(0, len(raw_output)) def test_region_list(self): diff --git a/openstackclient/tests/functional/identity/v3/test_role.py b/openstackclient/tests/functional/identity/v3/test_role.py index 2d5a15e47..9a1aa648f 100644 --- a/openstackclient/tests/functional/identity/v3/test_role.py +++ b/openstackclient/tests/functional/identity/v3/test_role.py @@ -55,7 +55,7 @@ def test_role_set(self): role_name = self._create_dummy_role() new_role_name = data_utils.rand_name('NewTestRole') raw_output = self.openstack( - 'role set --name %s %s' % (new_role_name, role_name) + f'role set --name {new_role_name} {role_name}' ) self.assertEqual(0, len(raw_output)) raw_output = self.openstack('role show %s' % new_role_name) @@ -66,7 +66,7 @@ def test_role_set_description(self): role_name = self._create_dummy_role() description = data_utils.rand_name("NewDescription") raw_output = self.openstack( - 'role set --description %s %s' % (description, role_name) + f'role set --description {description} {role_name}' ) self.assertEqual(0, len(raw_output)) raw_output = self.openstack('role show %s' % role_name) diff --git a/openstackclient/tests/functional/identity/v3/test_service.py b/openstackclient/tests/functional/identity/v3/test_service.py index 5d59b65e9..98fa349d1 100644 --- a/openstackclient/tests/functional/identity/v3/test_service.py +++ b/openstackclient/tests/functional/identity/v3/test_service.py @@ -27,9 +27,7 @@ def test_service_delete(self): def test_service_multi_delete(self): service_1 = self._create_dummy_service(add_clean_up=False) service_2 = self._create_dummy_service(add_clean_up=False) - raw_output = self.openstack( - 'service delete %s %s' % (service_1, service_2) - ) + raw_output = self.openstack(f'service delete {service_1} {service_2}') self.assertEqual(0, len(raw_output)) def test_service_list(self): diff --git a/openstackclient/tests/functional/identity/v3/test_service_provider.py b/openstackclient/tests/functional/identity/v3/test_service_provider.py index d6750595d..b7ab14bc4 100644 --- a/openstackclient/tests/functional/identity/v3/test_service_provider.py +++ b/openstackclient/tests/functional/identity/v3/test_service_provider.py @@ -31,9 +31,7 @@ def test_sp_delete(self): def test_sp_multi_delete(self): sp1 = self._create_dummy_sp(add_clean_up=False) sp2 = self._create_dummy_sp(add_clean_up=False) - raw_output = self.openstack( - 'service provider delete %s %s' % (sp1, sp2) - ) + raw_output = self.openstack(f'service provider delete {sp1} {sp2}') self.assertEqual(0, len(raw_output)) def test_sp_show(self): diff --git a/openstackclient/tests/functional/image/base.py b/openstackclient/tests/functional/image/base.py index 4b2ab64b7..d948f8155 100644 --- a/openstackclient/tests/functional/image/base.py +++ b/openstackclient/tests/functional/image/base.py @@ -18,7 +18,7 @@ class BaseImageTests(base.TestCase): @classmethod def setUpClass(cls): - super(BaseImageTests, cls).setUpClass() + super().setUpClass() # TODO(dtroyer): maybe do image API discovery here to determine # what is available, it isn't in the service catalog cls.haz_v1_api = False diff --git a/openstackclient/tests/functional/image/v2/test_image.py b/openstackclient/tests/functional/image/v2/test_image.py index 9d7f570ab..93251ea53 100644 --- a/openstackclient/tests/functional/image/v2/test_image.py +++ b/openstackclient/tests/functional/image/v2/test_image.py @@ -21,7 +21,7 @@ class ImageTests(base.BaseImageTests): """Functional tests for Image commands""" def setUp(self): - super(ImageTests, self).setUp() + super().setUp() ver_fixture = fixtures.EnvironmentVariable('OS_IMAGE_API_VERSION', '2') self.useFixture(ver_fixture) diff --git a/openstackclient/tests/functional/image/v2/test_info.py b/openstackclient/tests/functional/image/v2/test_info.py index a04e0cb56..c601ea082 100644 --- a/openstackclient/tests/functional/image/v2/test_info.py +++ b/openstackclient/tests/functional/image/v2/test_info.py @@ -20,7 +20,7 @@ class InfoTests(base.BaseImageTests): """Functional tests for Info commands""" def setUp(self): - super(InfoTests, self).setUp() + super().setUp() def tearDown(self): super().tearDown() diff --git a/openstackclient/tests/functional/network/v2/common.py b/openstackclient/tests/functional/network/v2/common.py index eecfff468..f7c7212a1 100644 --- a/openstackclient/tests/functional/network/v2/common.py +++ b/openstackclient/tests/functional/network/v2/common.py @@ -91,27 +91,25 @@ def _list_tag_check(self, project_id, expected): def _create_resource_for_tag_test(self, name, args): return self.openstack( - '{} create {} {}'.format(self.base_command, args, name), + f'{self.base_command} create {args} {name}', parse_output=True, ) def _create_resource_and_tag_check(self, args, expected): name = uuid.uuid4().hex cmd_output = self._create_resource_for_tag_test(name, args) - self.addCleanup( - self.openstack, '{} delete {}'.format(self.base_command, name) - ) + self.addCleanup(self.openstack, f'{self.base_command} delete {name}') self.assertIsNotNone(cmd_output["id"]) self.assertEqual(set(expected), set(cmd_output['tags'])) return name def _set_resource_and_tag_check(self, command, name, args, expected): cmd_output = self.openstack( - '{} {} {} {}'.format(self.base_command, command, args, name) + f'{self.base_command} {command} {args} {name}' ) self.assertFalse(cmd_output) cmd_output = self.openstack( - '{} show {}'.format(self.base_command, name), + f'{self.base_command} show {name}', parse_output=True, ) self.assertEqual(set(expected), set(cmd_output['tags'])) diff --git a/openstackclient/tests/functional/network/v2/test_network.py b/openstackclient/tests/functional/network/v2/test_network.py index fde34c278..8dbe883b6 100644 --- a/openstackclient/tests/functional/network/v2/test_network.py +++ b/openstackclient/tests/functional/network/v2/test_network.py @@ -192,7 +192,7 @@ def test_network_delete_network(self): cmd_output["description"], ) - del_output = self.openstack('network delete %s %s' % (name1, name2)) + del_output = self.openstack(f'network delete {name1} {name2}') self.assertOutput('', del_output) def test_network_list(self): @@ -237,7 +237,7 @@ def test_network_list(self): else: network_options = '--subnet 4.5.6.7/28 ' cmd_output = self.openstack( - 'network create --share %s%s' % (network_options, name2), + f'network create --share {network_options}{name2}', parse_output=True, ) self.addCleanup(self.openstack, 'network delete ' + name2) @@ -353,7 +353,9 @@ def test_network_dhcp_agent(self): # Add Agent to Network self.openstack( - 'network agent add network --dhcp %s %s' % (agent_id, network_id) + 'network agent add network --dhcp {} {}'.format( + agent_id, network_id + ) ) # Test network list --agent diff --git a/openstackclient/tests/functional/network/v2/test_network_agent.py b/openstackclient/tests/functional/network/v2/test_network_agent.py index c9a2ee121..bbe168aee 100644 --- a/openstackclient/tests/functional/network/v2/test_network_agent.py +++ b/openstackclient/tests/functional/network/v2/test_network_agent.py @@ -123,7 +123,9 @@ def test_network_dhcp_agent_list(self): # Add Agent to Network self.openstack( - 'network agent add network --dhcp %s %s' % (agent_id, network_id) + 'network agent add network --dhcp {} {}'.format( + agent_id, network_id + ) ) # Test network agent list --network @@ -169,9 +171,7 @@ def test_network_agent_list_routers(self): agent_id = cmd_output[0]['ID'] # Add router to agent - self.openstack( - 'network agent add router --l3 %s %s' % (agent_id, router_id) - ) + self.openstack(f'network agent add router --l3 {agent_id} {router_id}') # Test router list --agent cmd_output = self.openstack( @@ -184,7 +184,9 @@ def test_network_agent_list_routers(self): # Remove router from agent self.openstack( - 'network agent remove router --l3 %s %s' % (agent_id, router_id) + 'network agent remove router --l3 {} {}'.format( + agent_id, router_id + ) ) cmd_output = self.openstack( 'network agent list --router %s' % router_id, diff --git a/openstackclient/tests/functional/network/v2/test_network_qos_rule.py b/openstackclient/tests/functional/network/v2/test_network_qos_rule.py index 0e16a5035..8db484e2e 100644 --- a/openstackclient/tests/functional/network/v2/test_network_qos_rule.py +++ b/openstackclient/tests/functional/network/v2/test_network_qos_rule.py @@ -69,7 +69,7 @@ def test_qos_rule_create_delete(self): parse_output=True, ) raw_output = self.openstack( - 'network qos rule delete %s %s' % (policy_name, rule['id']) + 'network qos rule delete {} {}'.format(policy_name, rule['id']) ) self.assertEqual('', raw_output) @@ -144,7 +144,7 @@ def test_qos_rule_create_delete(self): parse_output=True, ) raw_output = self.openstack( - 'network qos rule delete %s %s' % (policy_name, rule['id']) + 'network qos rule delete {} {}'.format(policy_name, rule['id']) ) self.assertEqual('', raw_output) @@ -217,7 +217,7 @@ def test_qos_rule_create_delete(self): parse_output=True, ) raw_output = self.openstack( - 'network qos rule delete %s %s' % (policy_name, rule['id']) + 'network qos rule delete {} {}'.format(policy_name, rule['id']) ) self.assertEqual('', raw_output) @@ -292,7 +292,7 @@ def test_qos_rule_create_delete(self): parse_output=True, ) raw_output = self.openstack( - 'network qos rule delete %s %s' % (policy_name, rule['id']) + 'network qos rule delete {} {}'.format(policy_name, rule['id']) ) self.assertEqual('', raw_output) diff --git a/openstackclient/tests/functional/network/v2/test_port.py b/openstackclient/tests/functional/network/v2/test_port.py index 700c8dfd4..0ba377341 100644 --- a/openstackclient/tests/functional/network/v2/test_port.py +++ b/openstackclient/tests/functional/network/v2/test_port.py @@ -47,7 +47,7 @@ def tearDownClass(cls): def test_port_delete(self): """Test create, delete multiple""" json_output = self.openstack( - 'port create --network %s %s' % (self.NETWORK_NAME, self.NAME), + f'port create --network {self.NETWORK_NAME} {self.NAME}', parse_output=True, ) id1 = json_output.get('id') @@ -56,7 +56,9 @@ def test_port_delete(self): self.assertEqual(self.NAME, json_output.get('name')) json_output = self.openstack( - 'port create --network %s %sx' % (self.NETWORK_NAME, self.NAME), + 'port create --network {} {}x'.format( + self.NETWORK_NAME, self.NAME + ), parse_output=True, ) id2 = json_output.get('id') @@ -65,13 +67,13 @@ def test_port_delete(self): self.assertEqual(self.NAME + 'x', json_output.get('name')) # Clean up after ourselves - raw_output = self.openstack('port delete %s %s' % (id1, id2)) + raw_output = self.openstack(f'port delete {id1} {id2}') self.assertOutput('', raw_output) def test_port_list(self): """Test create defaults, list, delete""" json_output = self.openstack( - 'port create --network %s %s' % (self.NETWORK_NAME, self.NAME), + f'port create --network {self.NETWORK_NAME} {self.NAME}', parse_output=True, ) id1 = json_output.get('id') @@ -82,7 +84,9 @@ def test_port_list(self): self.assertEqual(self.NAME, json_output.get('name')) json_output = self.openstack( - 'port create --network %s %sx' % (self.NETWORK_NAME, self.NAME), + 'port create --network {} {}x'.format( + self.NETWORK_NAME, self.NAME + ), parse_output=True, ) id2 = json_output.get('id') @@ -169,7 +173,7 @@ def test_port_set(self): self.assertIsNotNone(json_output.get('mac_address')) raw_output = self.openstack( - 'port unset --security-group %s %s' % (sg_id, id1) + f'port unset --security-group {sg_id} {id1}' ) self.assertOutput('', raw_output) @@ -247,7 +251,7 @@ def test_port_set_sg(self): ) raw_output = self.openstack( - 'port unset --security-group %s %s' % (sg_id1, id1) + f'port unset --security-group {sg_id1} {id1}' ) self.assertOutput('', raw_output) diff --git a/openstackclient/tests/functional/network/v2/test_router.py b/openstackclient/tests/functional/network/v2/test_router.py index 4f7c4c4a5..bd4261ac7 100644 --- a/openstackclient/tests/functional/network/v2/test_router.py +++ b/openstackclient/tests/functional/network/v2/test_router.py @@ -287,10 +287,10 @@ def test_router_add_remove_route(self): self.openstack('router create %s' % router_name) self.addCleanup(self.openstack, 'router delete %s' % router_name) - self.openstack('router add subnet %s %s' % (router_name, subnet_name)) + self.openstack(f'router add subnet {router_name} {subnet_name}') self.addCleanup( self.openstack, - 'router remove subnet %s %s' % (router_name, subnet_name), + f'router remove subnet {router_name} {subnet_name}', ) out1 = ( diff --git a/openstackclient/tests/functional/object/v1/common.py b/openstackclient/tests/functional/object/v1/common.py index b01334302..036731da5 100644 --- a/openstackclient/tests/functional/object/v1/common.py +++ b/openstackclient/tests/functional/object/v1/common.py @@ -18,5 +18,5 @@ class ObjectStoreTests(base.TestCase): @classmethod def setUpClass(cls): - super(ObjectStoreTests, cls).setUpClass() + super().setUpClass() cls.haz_object_store = cls.is_service_enabled('object-store') diff --git a/openstackclient/tests/functional/object/v1/test_container.py b/openstackclient/tests/functional/object/v1/test_container.py index 22adbf6f6..6480fb907 100644 --- a/openstackclient/tests/functional/object/v1/test_container.py +++ b/openstackclient/tests/functional/object/v1/test_container.py @@ -23,7 +23,7 @@ class ContainerTests(common.ObjectStoreTests): @classmethod def setUpClass(cls): - super(ContainerTests, cls).setUpClass() + super().setUpClass() if cls.haz_object_store: opts = cls.get_opts(['container']) raw_output = cls.openstack('container create ' + cls.NAME + opts) @@ -36,10 +36,10 @@ def tearDownClass(cls): raw_output = cls.openstack('container delete ' + cls.NAME) cls.assertOutput('', raw_output) finally: - super(ContainerTests, cls).tearDownClass() + super().tearDownClass() def setUp(self): - super(ContainerTests, self).setUp() + super().setUp() # Skip tests if no object-store is present if not self.haz_object_store: self.skipTest("No object-store service present") diff --git a/openstackclient/tests/functional/object/v1/test_object.py b/openstackclient/tests/functional/object/v1/test_object.py index f8940f77a..73044de9d 100644 --- a/openstackclient/tests/functional/object/v1/test_object.py +++ b/openstackclient/tests/functional/object/v1/test_object.py @@ -27,7 +27,7 @@ class ObjectTests(common.ObjectStoreTests): CONTAINER_NAME = uuid.uuid4().hex def setUp(self): - super(ObjectTests, self).setUp() + super().setUp() # Skip tests if no object-store is present if not self.haz_object_store: self.skipTest("No object-store service present") @@ -54,7 +54,7 @@ def _test_object(self, object_file): # TODO(stevemar): Assert returned fields raw_output = self.openstack( - 'object create %s %s' % (self.CONTAINER_NAME, object_file) + f'object create {self.CONTAINER_NAME} {object_file}' ) items = self.parse_listing(raw_output) self.assert_show_fields(items, OBJECT_FIELDS) @@ -63,9 +63,7 @@ def _test_object(self, object_file): items = self.parse_listing(raw_output) self.assert_table_structure(items, BASIC_LIST_HEADERS) - self.openstack( - 'object save %s %s' % (self.CONTAINER_NAME, object_file) - ) + self.openstack(f'object save {self.CONTAINER_NAME} {object_file}') # TODO(stevemar): Assert returned fields tmp_file = 'tmp.txt' @@ -77,23 +75,21 @@ def _test_object(self, object_file): # TODO(stevemar): Assert returned fields raw_output = self.openstack( - 'object save %s %s --file -' % (self.CONTAINER_NAME, object_file) + 'object save {} {} --file -'.format( + self.CONTAINER_NAME, object_file + ) ) self.assertEqual(raw_output, 'test content') - self.openstack( - 'object show %s %s' % (self.CONTAINER_NAME, object_file) - ) + self.openstack(f'object show {self.CONTAINER_NAME} {object_file}') # TODO(stevemar): Assert returned fields raw_output = self.openstack( - 'object delete %s %s' % (self.CONTAINER_NAME, object_file) + f'object delete {self.CONTAINER_NAME} {object_file}' ) self.assertEqual(0, len(raw_output)) - self.openstack( - 'object create %s %s' % (self.CONTAINER_NAME, object_file) - ) + self.openstack(f'object create {self.CONTAINER_NAME} {object_file}') raw_output = self.openstack( 'container delete -r %s' % self.CONTAINER_NAME ) diff --git a/openstackclient/tests/functional/volume/base.py b/openstackclient/tests/functional/volume/base.py index f15a31451..ab05642eb 100644 --- a/openstackclient/tests/functional/volume/base.py +++ b/openstackclient/tests/functional/volume/base.py @@ -70,7 +70,7 @@ def wait_for_delete( result = cls.openstack(check_type + ' list', parse_output=True) names = [x[name_field] for x in result] if check_name not in names: - print('{} {} is now deleted'.format(check_type, check_name)) + print(f'{check_type} {check_name} is now deleted') return print( 'Checking {} {} Waiting for deleted'.format( diff --git a/openstackclient/tests/functional/volume/v1/test_service.py b/openstackclient/tests/functional/volume/v1/test_service.py index 0f510a8a7..8d058c26f 100644 --- a/openstackclient/tests/functional/volume/v1/test_service.py +++ b/openstackclient/tests/functional/volume/v1/test_service.py @@ -20,7 +20,7 @@ def test_volume_service_list(self): cmd_output = self.openstack('volume service list', parse_output=True) # Get the nonredundant services and hosts - services = list(set([x['Binary'] for x in cmd_output])) + services = list({x['Binary'] for x in cmd_output}) # Test volume service list --service cmd_output = self.openstack( diff --git a/openstackclient/tests/functional/volume/v1/test_snapshot.py b/openstackclient/tests/functional/volume/v1/test_snapshot.py index 52877d5a4..1acd014a6 100644 --- a/openstackclient/tests/functional/volume/v1/test_snapshot.py +++ b/openstackclient/tests/functional/volume/v1/test_snapshot.py @@ -22,7 +22,7 @@ class VolumeSnapshotTests(common.BaseVolumeTests): @classmethod def setUpClass(cls): - super(VolumeSnapshotTests, cls).setUpClass() + super().setUpClass() # create a volume for all tests to create snapshot cmd_output = cls.openstack( 'volume create ' + '--size 1 ' + cls.VOLLY, @@ -38,7 +38,7 @@ def tearDownClass(cls): raw_output = cls.openstack('volume delete --force ' + cls.VOLLY) cls.assertOutput('', raw_output) finally: - super(VolumeSnapshotTests, cls).tearDownClass() + super().tearDownClass() def test_volume_snapshot_delete(self): """Test create, delete multiple""" diff --git a/openstackclient/tests/functional/volume/v1/test_transfer_request.py b/openstackclient/tests/functional/volume/v1/test_transfer_request.py index 37aa4ca22..68fe6666f 100644 --- a/openstackclient/tests/functional/volume/v1/test_transfer_request.py +++ b/openstackclient/tests/functional/volume/v1/test_transfer_request.py @@ -23,7 +23,7 @@ class TransferRequestTests(common.BaseVolumeTests): @classmethod def setUpClass(cls): - super(TransferRequestTests, cls).setUpClass() + super().setUpClass() cmd_output = cls.openstack( 'volume create --size 1 ' + cls.VOLUME_NAME, parse_output=True, @@ -40,7 +40,7 @@ def tearDownClass(cls): ) cls.assertOutput('', raw_output_volume) finally: - super(TransferRequestTests, cls).tearDownClass() + super().tearDownClass() def test_volume_transfer_request_accept(self): volume_name = uuid.uuid4().hex diff --git a/openstackclient/tests/functional/volume/v1/test_volume_type.py b/openstackclient/tests/functional/volume/v1/test_volume_type.py index 6448af6e4..97c8b66c1 100644 --- a/openstackclient/tests/functional/volume/v1/test_volume_type.py +++ b/openstackclient/tests/functional/volume/v1/test_volume_type.py @@ -110,7 +110,7 @@ def test_multi_delete(self): time.sleep(5) self.openstack('volume type create %s' % vol_type2) time.sleep(5) - cmd = 'volume type delete %s %s' % (vol_type1, vol_type2) + cmd = f'volume type delete {vol_type1} {vol_type2}' raw_output = self.openstack(cmd) self.assertOutput('', raw_output) diff --git a/openstackclient/tests/functional/volume/v2/test_service.py b/openstackclient/tests/functional/volume/v2/test_service.py index 1101affcd..cca32f962 100644 --- a/openstackclient/tests/functional/volume/v2/test_service.py +++ b/openstackclient/tests/functional/volume/v2/test_service.py @@ -20,8 +20,8 @@ def test_volume_service_list(self): cmd_output = self.openstack('volume service list', parse_output=True) # Get the nonredundant services and hosts - services = list(set([x['Binary'] for x in cmd_output])) - hosts = list(set([x['Host'] for x in cmd_output])) + services = list({x['Binary'] for x in cmd_output}) + hosts = list({x['Host'] for x in cmd_output}) # Test volume service list --service cmd_output = self.openstack( diff --git a/openstackclient/tests/functional/volume/v2/test_volume_backup.py b/openstackclient/tests/functional/volume/v2/test_volume_backup.py index e6f7dec9f..6bd37f4dc 100644 --- a/openstackclient/tests/functional/volume/v2/test_volume_backup.py +++ b/openstackclient/tests/functional/volume/v2/test_volume_backup.py @@ -19,7 +19,7 @@ class VolumeBackupTests(common.BaseVolumeTests): """Functional tests for volume backups.""" def setUp(self): - super(VolumeBackupTests, self).setUp() + super().setUp() self.backup_enabled = False serv_list = self.openstack('volume service list', parse_output=True) for service in serv_list: @@ -48,7 +48,7 @@ def test_volume_backup_restore(self): # restore the backup backup_restored = self.openstack( - 'volume backup restore %s %s' % (backup['id'], vol_id), + 'volume backup restore {} {}'.format(backup['id'], vol_id), parse_output=True, ) self.assertEqual(backup_restored['backup_id'], backup['id']) diff --git a/openstackclient/tests/functional/volume/v2/test_volume_snapshot.py b/openstackclient/tests/functional/volume/v2/test_volume_snapshot.py index 7aefdf297..e5daded1b 100644 --- a/openstackclient/tests/functional/volume/v2/test_volume_snapshot.py +++ b/openstackclient/tests/functional/volume/v2/test_volume_snapshot.py @@ -22,7 +22,7 @@ class VolumeSnapshotTests(common.BaseVolumeTests): @classmethod def setUpClass(cls): - super(VolumeSnapshotTests, cls).setUpClass() + super().setUpClass() # create a volume for all tests to create snapshot cmd_output = cls.openstack( 'volume create ' + '--size 1 ' + cls.VOLLY, @@ -38,7 +38,7 @@ def tearDownClass(cls): raw_output = cls.openstack('volume delete --force ' + cls.VOLLY) cls.assertOutput('', raw_output) finally: - super(VolumeSnapshotTests, cls).tearDownClass() + super().tearDownClass() def test_volume_snapshot_delete(self): """Test create, delete multiple""" diff --git a/openstackclient/tests/functional/volume/v2/test_volume_type.py b/openstackclient/tests/functional/volume/v2/test_volume_type.py index b9bbcfc34..bdbced00f 100644 --- a/openstackclient/tests/functional/volume/v2/test_volume_type.py +++ b/openstackclient/tests/functional/volume/v2/test_volume_type.py @@ -129,7 +129,7 @@ def test_multi_delete(self): time.sleep(5) self.openstack('volume type create %s' % vol_type2) time.sleep(5) - cmd = 'volume type delete %s %s' % (vol_type1, vol_type2) + cmd = f'volume type delete {vol_type1} {vol_type2}' raw_output = self.openstack(cmd) self.assertOutput('', raw_output) diff --git a/openstackclient/tests/functional/volume/v3/test_volume_snapshot.py b/openstackclient/tests/functional/volume/v3/test_volume_snapshot.py index b9e86a93b..2c9b72ba1 100644 --- a/openstackclient/tests/functional/volume/v3/test_volume_snapshot.py +++ b/openstackclient/tests/functional/volume/v3/test_volume_snapshot.py @@ -22,7 +22,7 @@ class VolumeSnapshotTests(common.BaseVolumeTests): @classmethod def setUpClass(cls): - super(VolumeSnapshotTests, cls).setUpClass() + super().setUpClass() # create a volume for all tests to create snapshot cmd_output = cls.openstack( 'volume create ' + '--size 1 ' + cls.VOLLY, @@ -38,7 +38,7 @@ def tearDownClass(cls): raw_output = cls.openstack('volume delete --force ' + cls.VOLLY) cls.assertOutput('', raw_output) finally: - super(VolumeSnapshotTests, cls).tearDownClass() + super().tearDownClass() def test_volume_snapshot_delete(self): """Test create, delete multiple""" diff --git a/openstackclient/tests/functional/volume/v3/test_volume_type.py b/openstackclient/tests/functional/volume/v3/test_volume_type.py index 4edb3416f..78f9e4063 100644 --- a/openstackclient/tests/functional/volume/v3/test_volume_type.py +++ b/openstackclient/tests/functional/volume/v3/test_volume_type.py @@ -129,7 +129,7 @@ def test_multi_delete(self): time.sleep(5) self.openstack('volume type create %s' % vol_type2) time.sleep(5) - cmd = 'volume type delete %s %s' % (vol_type1, vol_type2) + cmd = f'volume type delete {vol_type1} {vol_type2}' raw_output = self.openstack(cmd) self.assertOutput('', raw_output) diff --git a/openstackclient/tests/unit/api/fakes.py b/openstackclient/tests/unit/api/fakes.py index 5db722423..192bd69d5 100644 --- a/openstackclient/tests/unit/api/fakes.py +++ b/openstackclient/tests/unit/api/fakes.py @@ -50,6 +50,6 @@ class TestSession(utils.TestCase): BASE_URL = 'https://api.example.com:1234/vX' def setUp(self): - super(TestSession, self).setUp() + super().setUp() self.sess = session.Session() self.requests_mock = self.useFixture(fixture.Fixture()) diff --git a/openstackclient/tests/unit/api/test_api.py b/openstackclient/tests/unit/api/test_api.py index 597fa1074..f930260b1 100644 --- a/openstackclient/tests/unit/api/test_api.py +++ b/openstackclient/tests/unit/api/test_api.py @@ -21,7 +21,7 @@ class TestKeystoneSession(api_fakes.TestSession): def setUp(self): - super(TestKeystoneSession, self).setUp() + super().setUp() self.api = api.KeystoneSession( session=self.sess, endpoint=self.BASE_URL, @@ -40,7 +40,7 @@ def test_session_request(self): class TestBaseAPI(api_fakes.TestSession): def setUp(self): - super(TestBaseAPI, self).setUp() + super().setUp() self.api = api.BaseAPI( session=self.sess, endpoint=self.BASE_URL, diff --git a/openstackclient/tests/unit/api/test_compute_v2.py b/openstackclient/tests/unit/api/test_compute_v2.py index 1ed164ac0..3856a7700 100644 --- a/openstackclient/tests/unit/api/test_compute_v2.py +++ b/openstackclient/tests/unit/api/test_compute_v2.py @@ -27,7 +27,7 @@ class TestComputeAPIv2(utils.TestCase): def setUp(self): - super(TestComputeAPIv2, self).setUp() + super().setUp() sess = session.Session() self.api = compute.APIv2(session=sess, endpoint=FAKE_URL) self.requests_mock = self.useFixture(fixture.Fixture()) diff --git a/openstackclient/tests/unit/api/test_image_v1.py b/openstackclient/tests/unit/api/test_image_v1.py index 74899ad42..4d0ac53ea 100644 --- a/openstackclient/tests/unit/api/test_image_v1.py +++ b/openstackclient/tests/unit/api/test_image_v1.py @@ -26,7 +26,7 @@ class TestImageAPIv1(utils.TestCase): def setUp(self): - super(TestImageAPIv1, self).setUp() + super().setUp() sess = session.Session() self.api = image_v1.APIv1(session=sess, endpoint=FAKE_URL) diff --git a/openstackclient/tests/unit/api/test_image_v2.py b/openstackclient/tests/unit/api/test_image_v2.py index 0de71acb0..a4cb606d8 100644 --- a/openstackclient/tests/unit/api/test_image_v2.py +++ b/openstackclient/tests/unit/api/test_image_v2.py @@ -26,7 +26,7 @@ class TestImageAPIv2(utils.TestCase): def setUp(self): - super(TestImageAPIv2, self).setUp() + super().setUp() sess = session.Session() self.api = image_v2.APIv2(session=sess, endpoint=FAKE_URL) diff --git a/openstackclient/tests/unit/api/test_object_store_v1.py b/openstackclient/tests/unit/api/test_object_store_v1.py index e516d3de3..39bc26a61 100644 --- a/openstackclient/tests/unit/api/test_object_store_v1.py +++ b/openstackclient/tests/unit/api/test_object_store_v1.py @@ -52,7 +52,7 @@ class TestObjectAPIv1(utils.TestCase): def setUp(self): - super(TestObjectAPIv1, self).setUp() + super().setUp() sess = session.Session() self.api = object_store.APIv1(session=sess, endpoint=FAKE_URL) self.requests_mock = self.useFixture(fixture.Fixture()) @@ -60,7 +60,7 @@ def setUp(self): class TestContainer(TestObjectAPIv1): def setUp(self): - super(TestContainer, self).setUp() + super().setUp() def test_container_create(self): headers = { @@ -181,9 +181,9 @@ def test_container_show(self): class TestObject(TestObjectAPIv1): def setUp(self): - super(TestObject, self).setUp() + super().setUp() - @mock.patch('openstackclient.api.object_store_v1.io.open') + @mock.patch('openstackclient.api.object_store_v1.open') def base_object_create(self, file_contents, mock_open): mock_open.read.return_value = file_contents diff --git a/openstackclient/tests/unit/common/test_logs.py b/openstackclient/tests/unit/common/test_logs.py index 4cabd60b2..234ba427e 100644 --- a/openstackclient/tests/unit/common/test_logs.py +++ b/openstackclient/tests/unit/common/test_logs.py @@ -80,7 +80,7 @@ def test_nothing(self): ) def test_options(self): - class Opts(object): + class Opts: cloud = 'cloudy' os_project_name = 'projecty' username = 'usernamey' @@ -111,7 +111,7 @@ def test_config(self): class TestLogConfigurator(utils.TestCase): def setUp(self): - super(TestLogConfigurator, self).setUp() + super().setUp() self.options = mock.Mock() self.options.verbose_level = 1 self.options.log_file = None diff --git a/openstackclient/tests/unit/common/test_module.py b/openstackclient/tests/unit/common/test_module.py index 18ac7c20b..68255a04e 100644 --- a/openstackclient/tests/unit/common/test_module.py +++ b/openstackclient/tests/unit/common/test_module.py @@ -53,7 +53,7 @@ class TestCommandList(utils.TestCommand): def setUp(self): - super(TestCommandList, self).setUp() + super().setUp() self.app.command_manager = mock.Mock() self.app.command_manager.get_command_groups.return_value = [ @@ -126,7 +126,7 @@ def test_command_list_with_group(self): ) class TestModuleList(utils.TestCommand): def setUp(self): - super(TestModuleList, self).setUp() + super().setUp() # Get the command object to test self.cmd = osc_module.ListModule(self.app, None) diff --git a/openstackclient/tests/unit/common/test_project_cleanup.py b/openstackclient/tests/unit/common/test_project_cleanup.py index df6ac1732..019d6cf15 100644 --- a/openstackclient/tests/unit/common/test_project_cleanup.py +++ b/openstackclient/tests/unit/common/test_project_cleanup.py @@ -22,7 +22,7 @@ class TestProjectCleanup(test_utils.TestCommand): project = identity_fakes.FakeProject.create_one_project() def setUp(self): - super(TestProjectCleanup, self).setUp() + super().setUp() self.cmd = project_cleanup.ProjectCleanup(self.app, None) self.project_cleanup_mock = mock.Mock() diff --git a/openstackclient/tests/unit/common/test_quota.py b/openstackclient/tests/unit/common/test_quota.py index d99508abe..7edddbb19 100644 --- a/openstackclient/tests/unit/common/test_quota.py +++ b/openstackclient/tests/unit/common/test_quota.py @@ -40,7 +40,7 @@ def get_keys(self): class TestQuota(compute_fakes.TestComputev2): def setUp(self): - super(TestQuota, self).setUp() + super().setUp() # Set up common projects self.projects = identity_fakes_v3.FakeProject.create_projects(count=2) @@ -109,7 +109,7 @@ class TestQuotaList(TestQuota): ) def setUp(self): - super(TestQuotaList, self).setUp() + super().setUp() # Work with multiple projects in this class self.projects_mock.get.side_effect = self.projects @@ -629,7 +629,7 @@ def test_quota_list_volume_by_project(self): class TestQuotaSet(TestQuota): def setUp(self): - super(TestQuotaSet, self).setUp() + super().setUp() self.compute_quotas_mock.update.return_value = FakeQuotaResource( None, diff --git a/openstackclient/tests/unit/compute/v2/fakes.py b/openstackclient/tests/unit/compute/v2/fakes.py index f8a816b6a..6c201db46 100644 --- a/openstackclient/tests/unit/compute/v2/fakes.py +++ b/openstackclient/tests/unit/compute/v2/fakes.py @@ -81,7 +81,7 @@ QUOTA_data = tuple(QUOTA[x] for x in sorted(QUOTA)) -class FakeComputev2Client(object): +class FakeComputev2Client: def __init__(self, **kwargs): self.agents = mock.Mock() self.agents.resource_class = fakes.FakeResource(None, {}) @@ -1210,7 +1210,7 @@ def create_one_comp_detailed_quota(attrs=None): return quota -class FakeLimits(object): +class FakeLimits: """Fake limits""" def __init__(self, absolute_attrs=None, rate_attrs=None): @@ -1310,7 +1310,7 @@ def rate_limits(self): return reference_data -class FakeAbsoluteLimit(object): +class FakeAbsoluteLimit: """Data model that represents an absolute limit""" def __init__(self, name, value): @@ -1318,7 +1318,7 @@ def __init__(self, name, value): self.value = value -class FakeRateLimit(object): +class FakeRateLimit: """Data model that represents a flattened view of a single rate limit""" def __init__(self, verb, uri, value, remain, unit, next_available): diff --git a/openstackclient/tests/unit/compute/v2/test_agent.py b/openstackclient/tests/unit/compute/v2/test_agent.py index dc3ba6730..3969e9d8f 100644 --- a/openstackclient/tests/unit/compute/v2/test_agent.py +++ b/openstackclient/tests/unit/compute/v2/test_agent.py @@ -49,7 +49,7 @@ class TestAgent(compute_fakes.TestComputev2): ) def setUp(self): - super(TestAgent, self).setUp() + super().setUp() self.agents_mock = self.compute_client.agents self.agents_mock.reset_mock() @@ -57,7 +57,7 @@ def setUp(self): class TestAgentCreate(TestAgent): def setUp(self): - super(TestAgentCreate, self).setUp() + super().setUp() self.agents_mock.create.return_value = self.fake_agent self.cmd = agent.CreateAgent(self.app, None) @@ -99,7 +99,7 @@ class TestAgentDelete(TestAgent): fake_agents = compute_fakes.create_agents(count=2) def setUp(self): - super(TestAgentDelete, self).setUp() + super().setUp() self.agents_mock.get.return_value = self.fake_agents self.cmd = agent.DeleteAgent(self.app, None) @@ -198,7 +198,7 @@ class TestAgentList(TestAgent): ) def setUp(self): - super(TestAgentList, self).setUp() + super().setUp() self.agents_mock.list.return_value = self.agents self.cmd = agent.ListAgent(self.app, None) @@ -231,7 +231,7 @@ def test_agent_list_with_hypervisor(self): class TestAgentSet(TestAgent): def setUp(self): - super(TestAgentSet, self).setUp() + super().setUp() self.agents_mock.update.return_value = self.fake_agent self.agents_mock.list.return_value = [self.fake_agent] diff --git a/openstackclient/tests/unit/compute/v2/test_aggregate.py b/openstackclient/tests/unit/compute/v2/test_aggregate.py index 13a643720..a6709f708 100644 --- a/openstackclient/tests/unit/compute/v2/test_aggregate.py +++ b/openstackclient/tests/unit/compute/v2/test_aggregate.py @@ -58,7 +58,7 @@ class TestAggregate(compute_fakes.TestComputev2): class TestAggregateAddHost(TestAggregate): def setUp(self): - super(TestAggregateAddHost, self).setUp() + super().setUp() self.compute_sdk_client.find_aggregate.return_value = self.fake_ag self.compute_sdk_client.add_host_to_aggregate.return_value = ( @@ -89,7 +89,7 @@ def test_aggregate_add_host(self): class TestAggregateCreate(TestAggregate): def setUp(self): - super(TestAggregateCreate, self).setUp() + super().setUp() self.compute_sdk_client.create_aggregate.return_value = self.fake_ag self.compute_sdk_client.set_aggregate_metadata.return_value = ( @@ -159,7 +159,7 @@ class TestAggregateDelete(TestAggregate): fake_ags = compute_fakes.create_aggregates(count=2) def setUp(self): - super(TestAggregateDelete, self).setUp() + super().setUp() self.compute_sdk_client.find_aggregate = compute_fakes.get_aggregates( self.fake_ags @@ -267,7 +267,7 @@ class TestAggregateList(TestAggregate): ) def setUp(self): - super(TestAggregateList, self).setUp() + super().setUp() self.compute_sdk_client.aggregates.return_value = [self.fake_ag] self.cmd = aggregate.ListAggregate(self.app, None) @@ -295,7 +295,7 @@ def test_aggregate_list_with_long(self): class TestAggregateRemoveHost(TestAggregate): def setUp(self): - super(TestAggregateRemoveHost, self).setUp() + super().setUp() self.compute_sdk_client.find_aggregate.return_value = self.fake_ag self.compute_sdk_client.remove_host_from_aggregate.return_value = ( @@ -326,7 +326,7 @@ def test_aggregate_remove_host(self): class TestAggregateSet(TestAggregate): def setUp(self): - super(TestAggregateSet, self).setUp() + super().setUp() self.compute_sdk_client.find_aggregate.return_value = self.fake_ag self.cmd = aggregate.SetAggregate(self.app, None) @@ -513,7 +513,7 @@ class TestAggregateShow(TestAggregate): ) def setUp(self): - super(TestAggregateShow, self).setUp() + super().setUp() self.compute_sdk_client.find_aggregate.return_value = self.fake_ag self.cmd = aggregate.ShowAggregate(self.app, None) @@ -537,7 +537,7 @@ def test_aggregate_show(self): class TestAggregateUnset(TestAggregate): def setUp(self): - super(TestAggregateUnset, self).setUp() + super().setUp() self.compute_sdk_client.find_aggregate.return_value = self.fake_ag self.cmd = aggregate.UnsetAggregate(self.app, None) @@ -598,7 +598,7 @@ class TestAggregateCacheImage(TestAggregate): images = image_fakes.create_images(count=2) def setUp(self): - super(TestAggregateCacheImage, self).setUp() + super().setUp() self.compute_sdk_client.find_aggregate.return_value = self.fake_ag self.find_image_mock = mock.Mock(side_effect=self.images) diff --git a/openstackclient/tests/unit/compute/v2/test_console.py b/openstackclient/tests/unit/compute/v2/test_console.py index c04f55cb0..ed64e0538 100644 --- a/openstackclient/tests/unit/compute/v2/test_console.py +++ b/openstackclient/tests/unit/compute/v2/test_console.py @@ -24,7 +24,7 @@ class TestConsoleLog(compute_fakes.TestComputev2): _server = compute_fakes.create_one_server() def setUp(self): - super(TestConsoleLog, self).setUp() + super().setUp() self.compute_sdk_client.find_server.return_value = self._server @@ -80,7 +80,7 @@ class TestConsoleUrlShow(compute_fakes.TestComputev2): _server = compute_fakes.create_one_server() def setUp(self): - super(TestConsoleUrlShow, self).setUp() + super().setUp() self.compute_sdk_client.find_server.return_value = self._server fake_console_data = { 'url': 'http://localhost', diff --git a/openstackclient/tests/unit/compute/v2/test_flavor.py b/openstackclient/tests/unit/compute/v2/test_flavor.py index 5312d7051..a6e302c1f 100644 --- a/openstackclient/tests/unit/compute/v2/test_flavor.py +++ b/openstackclient/tests/unit/compute/v2/test_flavor.py @@ -28,7 +28,7 @@ class TestFlavor(compute_fakes.TestComputev2): def setUp(self): - super(TestFlavor, self).setUp() + super().setUp() self.projects_mock = self.identity_client.projects self.projects_mock.reset_mock() @@ -83,7 +83,7 @@ class TestFlavorCreate(TestFlavor): ) def setUp(self): - super(TestFlavorCreate, self).setUp() + super().setUp() # Return a project self.projects_mock.get.return_value = self.project @@ -403,7 +403,7 @@ class TestFlavorDelete(TestFlavor): flavors = compute_fakes.create_flavors(count=2) def setUp(self): - super(TestFlavorDelete, self).setUp() + super().setUp() self.compute_sdk_client.delete_flavor.return_value = None @@ -513,7 +513,7 @@ class TestFlavorList(TestFlavor): ) def setUp(self): - super(TestFlavorList, self).setUp() + super().setUp() self.api_mock = mock.Mock() self.api_mock.side_effect = [ @@ -756,7 +756,7 @@ class TestFlavorSet(TestFlavor): project = identity_fakes.FakeProject.create_one_project() def setUp(self): - super(TestFlavorSet, self).setUp() + super().setUp() self.compute_sdk_client.find_flavor.return_value = self.flavor # Return a project @@ -1006,7 +1006,7 @@ class TestFlavorShow(TestFlavor): ) def setUp(self): - super(TestFlavorShow, self).setUp() + super().setUp() # Return value of _find_resource() self.compute_sdk_client.find_flavor.return_value = self.flavor @@ -1093,7 +1093,7 @@ class TestFlavorUnset(TestFlavor): project = identity_fakes.FakeProject.create_one_project() def setUp(self): - super(TestFlavorUnset, self).setUp() + super().setUp() self.compute_sdk_client.find_flavor.return_value = self.flavor # Return a project diff --git a/openstackclient/tests/unit/compute/v2/test_host.py b/openstackclient/tests/unit/compute/v2/test_host.py index 8a899ea2b..0ad83289c 100644 --- a/openstackclient/tests/unit/compute/v2/test_host.py +++ b/openstackclient/tests/unit/compute/v2/test_host.py @@ -26,7 +26,7 @@ class TestHostList(compute_fakes.TestComputev2): _host = compute_fakes.create_one_host() def setUp(self): - super(TestHostList, self).setUp() + super().setUp() self.compute_sdk_client.get.return_value = fakes.FakeResponse( data={'hosts': [self._host]} @@ -83,7 +83,7 @@ def test_host_list_with_option(self, h_mock): @mock.patch('openstackclient.api.compute_v2.APIv2.host_set') class TestHostSet(compute_fakes.TestComputev2): def setUp(self): - super(TestHostSet, self).setUp() + super().setUp() self.host = compute_fakes.create_one_host() @@ -135,7 +135,7 @@ class TestHostShow(compute_fakes.TestComputev2): _host = compute_fakes.create_one_host() def setUp(self): - super(TestHostShow, self).setUp() + super().setUp() output_data = { "resource": { diff --git a/openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py b/openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py index bb755310a..5a4e3c52f 100644 --- a/openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py +++ b/openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py @@ -21,7 +21,7 @@ class TestHypervisorStats(compute_fakes.TestComputev2): def setUp(self): - super(TestHypervisorStats, self).setUp() + super().setUp() self.compute_sdk_client.get = mock.Mock() @@ -65,7 +65,7 @@ class TestHypervisorStatsShow(TestHypervisorStats): _stats = create_one_hypervisor_stats() def setUp(self): - super(TestHypervisorStatsShow, self).setUp() + super().setUp() self.compute_sdk_client.get.return_value = fakes.FakeResponse( data={'hypervisor_statistics': self._stats} diff --git a/openstackclient/tests/unit/compute/v2/test_keypair.py b/openstackclient/tests/unit/compute/v2/test_keypair.py index d944c216f..b7d46aebe 100644 --- a/openstackclient/tests/unit/compute/v2/test_keypair.py +++ b/openstackclient/tests/unit/compute/v2/test_keypair.py @@ -29,7 +29,7 @@ class TestKeypair(compute_fakes.TestComputev2): def setUp(self): - super(TestKeypair, self).setUp() + super().setUp() # Initialize the user mock self.users_mock = self.identity_client.users @@ -118,7 +118,9 @@ def test_keypair_create_public_key(self): parsed_args = self.check_parser(self.cmd, arglist, verifylist) - with mock.patch('io.open') as mock_open: + with mock.patch( + 'openstackclient.compute.v2.keypair.open' + ) as mock_open: mock_open.return_value = mock.MagicMock() m_file = mock_open.return_value.__enter__.return_value m_file.read.return_value = 'dummy' @@ -152,7 +154,9 @@ def test_keypair_create_private_key(self, mock_generate): parsed_args = self.check_parser(self.cmd, arglist, verifylist) - with mock.patch('io.open') as mock_open: + with mock.patch( + 'openstackclient.compute.v2.keypair.open' + ) as mock_open: mock_open.return_value = mock.MagicMock() m_file = mock_open.return_value.__enter__.return_value @@ -199,7 +203,9 @@ def test_keypair_create_with_key_type(self, sm_mock): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - with mock.patch('io.open') as mock_open: + with mock.patch( + 'openstackclient.compute.v2.keypair.open' + ) as mock_open: mock_open.return_value = mock.MagicMock() m_file = mock_open.return_value.__enter__.return_value m_file.read.return_value = 'dummy' @@ -231,7 +237,9 @@ def test_keypair_create_with_key_type_pre_v22(self, sm_mock): ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) - with mock.patch('io.open') as mock_open: + with mock.patch( + 'openstackclient.compute.v2.keypair.open' + ) as mock_open: mock_open.return_value = mock.MagicMock() m_file = mock_open.return_value.__enter__.return_value m_file.read.return_value = 'dummy' diff --git a/openstackclient/tests/unit/compute/v2/test_server.py b/openstackclient/tests/unit/compute/v2/test_server.py index 9be771cde..89b0bddea 100644 --- a/openstackclient/tests/unit/compute/v2/test_server.py +++ b/openstackclient/tests/unit/compute/v2/test_server.py @@ -63,7 +63,7 @@ def test_human_readable(self): class TestServer(compute_fakes.TestComputev2): def setUp(self): - super(TestServer, self).setUp() + super().setUp() # Get a shortcut to the compute client ServerManager Mock self.servers_mock = self.compute_client.servers @@ -452,7 +452,7 @@ def test_server_add_fixed_ip_with_fixed_ip_with_tag(self, sm_mock): @mock.patch('openstackclient.api.compute_v2.APIv2.floating_ip_add') class TestServerAddFloatingIPCompute(compute_fakes.TestComputev2): def setUp(self): - super(TestServerAddFloatingIPCompute, self).setUp() + super().setUp() self.app.client_manager.network_endpoint_enabled = False @@ -721,7 +721,7 @@ def test_server_add_floating_ip_with_fixed_ip_no_port_found(self): class TestServerAddPort(TestServer): def setUp(self): - super(TestServerAddPort, self).setUp() + super().setUp() # Get the command object to test self.cmd = server.AddPort(self.app, None) @@ -814,7 +814,7 @@ def test_server_add_port_with_tag_pre_v249(self, sm_mock): class TestServerVolume(TestServer): def setUp(self): - super(TestServerVolume, self).setUp() + super().setUp() self.methods = { 'create_volume_attachment': None, @@ -838,7 +838,7 @@ def setUp(self): class TestServerAddVolume(TestServerVolume): def setUp(self): - super(TestServerAddVolume, self).setUp() + super().setUp() # Get the command object to test self.cmd = server.AddServerVolume(self.app, None) @@ -1142,7 +1142,7 @@ def test_server_add_volume_with_disable_and_enable_delete_on_termination( class TestServerRemoveVolume(TestServerVolume): def setUp(self): - super(TestServerRemoveVolume, self).setUp() + super().setUp() # Get the command object to test self.cmd = server.RemoveServerVolume(self.app, None) @@ -1172,7 +1172,7 @@ def test_server_remove_volume(self): class TestServerAddNetwork(TestServer): def setUp(self): - super(TestServerAddNetwork, self).setUp() + super().setUp() # Get the command object to test self.cmd = server.AddNetwork(self.app, None) @@ -1268,7 +1268,7 @@ def test_server_add_network_with_tag_pre_v249(self, sm_mock): @mock.patch('openstackclient.api.compute_v2.APIv2.security_group_find') class TestServerAddSecurityGroup(TestServer): def setUp(self): - super(TestServerAddSecurityGroup, self).setUp() + super().setUp() self.security_group = compute_fakes.create_one_security_group() @@ -1331,7 +1331,7 @@ def datalist(self): return datalist def setUp(self): - super(TestServerCreate, self).setUp() + super().setUp() attrs = { 'networks': {}, @@ -2360,7 +2360,7 @@ def test_server_create_with_wait_fails(self, mock_wait_for_status): self.new_server.name, self.image, self.flavor, **kwargs ) - @mock.patch('openstackclient.compute.v2.server.io.open') + @mock.patch('openstackclient.compute.v2.server.open') def test_server_create_userdata(self, mock_open): mock_file = mock.Mock(name='File') mock_open.return_value = mock_file @@ -4454,7 +4454,7 @@ def test_server_create_with_trusted_image_cert_boot_from_volume(self): class TestServerDelete(TestServer): def setUp(self): - super(TestServerDelete, self).setUp() + super().setUp() self.servers_mock.delete.return_value = None self.servers_mock.force_delete.return_value = None @@ -4650,7 +4650,7 @@ class _TestServerList(TestServer): ) def setUp(self): - super(_TestServerList, self).setUp() + super().setUp() # Default params of the core function of the command in the case of no # commandline option specified. @@ -4677,7 +4677,7 @@ def setUp(self): 'status': 'ACTIVE', 'OS-EXT-STS:task_state': 'None', 'OS-EXT-STS:power_state': 0x01, # Running - 'networks': {u'public': [u'10.20.30.40', u'2001:db8::5']}, + 'networks': {'public': ['10.20.30.40', '2001:db8::5']}, 'OS-EXT-AZ:availability_zone': 'availability-zone-xxx', 'OS-EXT-SRV-ATTR:host': 'host-name-xxx', 'Metadata': format_columns.DictColumn({}), @@ -4702,7 +4702,7 @@ def setUp(self): class TestServerList(_TestServerList): def setUp(self): - super(TestServerList, self).setUp() + super().setUp() Image = collections.namedtuple('Image', 'id name') self.image_client.images.return_value = [ @@ -5367,7 +5367,7 @@ class TestServerListV273(_TestServerList): ) def setUp(self): - super(TestServerListV273, self).setUp() + super().setUp() # The fake servers' attributes. Use the original attributes names in # nova, not the ones printed by "server list" command. @@ -5658,7 +5658,7 @@ def test_server_lock_with_reason_pre_v273(self, sm_mock): class TestServerMigrate(TestServer): def setUp(self): - super(TestServerMigrate, self).setUp() + super().setUp() methods = { 'migrate': None, @@ -6138,7 +6138,7 @@ def test_server_pause_multi_servers(self): class TestServerRebuild(TestServer): def setUp(self): - super(TestServerRebuild, self).setUp() + super().setUp() # Return value for utils.find_resource for image self.image = image_fakes.create_one_image() @@ -6566,7 +6566,7 @@ def test_rebuild_with_keypair_name_and_unset(self): verifylist, ) - @mock.patch('openstackclient.compute.v2.server.io.open') + @mock.patch('openstackclient.compute.v2.server.open') def test_rebuild_with_user_data(self, mock_open): self.compute_client.api_version = api_versions.APIVersion('2.57') @@ -6878,7 +6878,7 @@ def test_rebuild_with_reimage_boot_volume_pre_v293(self): class TestEvacuateServer(TestServer): def setUp(self): - super(TestEvacuateServer, self).setUp() + super().setUp() # Return value for utils.find_resource for image self.image = image_fakes.create_one_image() @@ -7035,7 +7035,7 @@ def test_evacuate_with_wait_ok(self, mock_wait_for_status): class TestServerRemoveFixedIP(TestServer): def setUp(self): - super(TestServerRemoveFixedIP, self).setUp() + super().setUp() # Get the command object to test self.cmd = server.RemoveFixedIP(self.app, None) @@ -7066,7 +7066,7 @@ def test_server_remove_fixed_ip(self): class TestServerRescue(TestServer): def setUp(self): - super(TestServerRescue, self).setUp() + super().setUp() # Return value for utils.find_resource for image self.image = image_fakes.create_one_image() @@ -7155,7 +7155,7 @@ def test_rescue_with_current_image_and_password(self): @mock.patch('openstackclient.api.compute_v2.APIv2.floating_ip_remove') class TestServerRemoveFloatingIPCompute(compute_fakes.TestComputev2): def setUp(self): - super(TestServerRemoveFloatingIPCompute, self).setUp() + super().setUp() self.app.client_manager.network_endpoint_enabled = False @@ -7223,7 +7223,7 @@ def test_server_remove_floating_ip_default(self): class TestServerRemovePort(TestServer): def setUp(self): - super(TestServerRemovePort, self).setUp() + super().setUp() # Get the command object to test self.cmd = server.RemovePort(self.app, None) @@ -7271,7 +7271,7 @@ def test_server_remove_port_no_neutron(self): class TestServerRemoveNetwork(TestServer): def setUp(self): - super(TestServerRemoveNetwork, self).setUp() + super().setUp() # Get the command object to test self.cmd = server.RemoveNetwork(self.app, None) @@ -7330,7 +7330,7 @@ def test_server_remove_network_no_neutron(self): @mock.patch('openstackclient.api.compute_v2.APIv2.security_group_find') class TestServerRemoveSecurityGroup(TestServer): def setUp(self): - super(TestServerRemoveSecurityGroup, self).setUp() + super().setUp() self.security_group = compute_fakes.create_one_security_group() @@ -7369,7 +7369,7 @@ def test_server_remove_security_group(self, sg_find_mock): class TestServerResize(TestServer): def setUp(self): - super(TestServerResize, self).setUp() + super().setUp() self.server = compute_fakes.create_one_server() @@ -7568,7 +7568,7 @@ def test_server_resize_with_wait_fails(self, mock_wait_for_status): class TestServerResizeConfirm(TestServer): def setUp(self): - super(TestServerResizeConfirm, self).setUp() + super().setUp() methods = { 'confirm_resize': None, @@ -7672,7 +7672,7 @@ def test_migration_confirm(self): class TestServerResizeRevert(TestServer): def setUp(self): - super(TestServerResizeRevert, self).setUp() + super().setUp() methods = { 'revert_resize': None, @@ -7804,7 +7804,7 @@ def test_server_resume_multi_servers(self): class TestServerSet(TestServer): def setUp(self): - super(TestServerSet, self).setUp() + super().setUp() self.attrs = { 'api_version': None, @@ -8205,7 +8205,7 @@ def test_shelve_offload(self, mock_wait_for_status): class TestServerShow(TestServer): def setUp(self): - super(TestServerShow, self).setUp() + super().setUp() self.image = image_fakes.create_one_image() self.flavor = compute_fakes.create_one_flavor() @@ -8610,7 +8610,7 @@ def test_server_unpause_multi_servers(self): class TestServerUnset(TestServer): def setUp(self): - super(TestServerUnset, self).setUp() + super().setUp() self.fake_server = self.setup_servers_mock(1)[0] @@ -9062,11 +9062,11 @@ def test_prep_server_detail(self, find_resource): _image = image_fakes.create_one_image() _flavor = compute_fakes.create_one_flavor() server_info = { - 'image': {u'id': _image.id}, - 'flavor': {u'id': _flavor.id}, - 'tenant_id': u'tenant-id-xxx', - 'addresses': {u'public': [u'10.20.30.40', u'2001:db8::f']}, - 'links': u'http://xxx.yyy.com', + 'image': {'id': _image.id}, + 'flavor': {'id': _flavor.id}, + 'tenant_id': 'tenant-id-xxx', + 'addresses': {'public': ['10.20.30.40', '2001:db8::f']}, + 'links': 'http://xxx.yyy.com', 'properties': '', 'volumes_attached': [{"id": "6344fe9d-ef20-45b2-91a6"}], } @@ -9078,8 +9078,8 @@ def test_prep_server_detail(self, find_resource): info = { 'id': _server.id, 'name': _server.name, - 'image': '%s (%s)' % (_image.name, _image.id), - 'flavor': '%s (%s)' % (_flavor.name, _flavor.id), + 'image': f'{_image.name} ({_image.id})', + 'flavor': f'{_flavor.name} ({_flavor.id})', 'OS-EXT-STS:power_state': server.PowerStateColumn( getattr(_server, 'OS-EXT-STS:power_state') ), diff --git a/openstackclient/tests/unit/compute/v2/test_server_backup.py b/openstackclient/tests/unit/compute/v2/test_server_backup.py index a72f96f16..9d5269ddb 100644 --- a/openstackclient/tests/unit/compute/v2/test_server_backup.py +++ b/openstackclient/tests/unit/compute/v2/test_server_backup.py @@ -64,7 +64,7 @@ def image_data(self, image): return datalist def setUp(self): - super(TestServerBackupCreate, self).setUp() + super().setUp() # Get the command object to test self.cmd = server_backup.CreateServerBackup(self.app, None) diff --git a/openstackclient/tests/unit/compute/v2/test_server_event.py b/openstackclient/tests/unit/compute/v2/test_server_event.py index ce9345bb0..5f76e2adf 100644 --- a/openstackclient/tests/unit/compute/v2/test_server_event.py +++ b/openstackclient/tests/unit/compute/v2/test_server_event.py @@ -27,7 +27,7 @@ class TestServerEvent(compute_fakes.TestComputev2): fake_server = compute_fakes.create_one_server() def setUp(self): - super(TestServerEvent, self).setUp() + super().setUp() patcher = mock.patch.object( sdk_utils, 'supports_microversion', return_value=True diff --git a/openstackclient/tests/unit/compute/v2/test_service.py b/openstackclient/tests/unit/compute/v2/test_service.py index d658b1507..efb8c28b9 100644 --- a/openstackclient/tests/unit/compute/v2/test_service.py +++ b/openstackclient/tests/unit/compute/v2/test_service.py @@ -26,7 +26,7 @@ class TestServiceDelete(compute_fakes.TestComputev2): services = compute_fakes.create_services(count=2) def setUp(self): - super(TestServiceDelete, self).setUp() + super().setUp() self.compute_sdk_client.delete_service.return_value = None @@ -123,7 +123,7 @@ class TestServiceList(compute_fakes.TestComputev2): data_long = [data[0] + (service.disabled_reason,)] def setUp(self): - super(TestServiceList, self).setUp() + super().setUp() self.compute_sdk_client.services.return_value = [self.service] @@ -225,7 +225,7 @@ def test_service_list_with_long_option_2_11(self, sm_mock): class TestServiceSet(compute_fakes.TestComputev2): def setUp(self): - super(TestServiceSet, self).setUp() + super().setUp() self.service = compute_fakes.create_one_service() diff --git a/openstackclient/tests/unit/compute/v2/test_usage.py b/openstackclient/tests/unit/compute/v2/test_usage.py index e47c044ae..2efd25b54 100644 --- a/openstackclient/tests/unit/compute/v2/test_usage.py +++ b/openstackclient/tests/unit/compute/v2/test_usage.py @@ -21,7 +21,7 @@ class TestUsage(compute_fakes.TestComputev2): def setUp(self): - super(TestUsage, self).setUp() + super().setUp() self.projects_mock = self.identity_client.projects self.projects_mock.reset_mock() @@ -53,7 +53,7 @@ class TestUsageList(TestUsage): ] def setUp(self): - super(TestUsageList, self).setUp() + super().setUp() self.compute_sdk_client.usages.return_value = self.usages @@ -144,7 +144,7 @@ class TestUsageShow(TestUsage): ) def setUp(self): - super(TestUsageShow, self).setUp() + super().setUp() self.compute_sdk_client.get_usage.return_value = self.usage diff --git a/openstackclient/tests/unit/fakes.py b/openstackclient/tests/unit/fakes.py index e450e6296..cc42b1750 100644 --- a/openstackclient/tests/unit/fakes.py +++ b/openstackclient/tests/unit/fakes.py @@ -47,7 +47,7 @@ TEST_VERSIONS = fixture.DiscoveryList(href=AUTH_URL) -class FakeStdout(object): +class FakeStdout: def __init__(self): self.content = [] @@ -61,7 +61,7 @@ def make_string(self): return result -class FakeLog(object): +class FakeLog: def __init__(self): self.messages = {} @@ -81,7 +81,7 @@ def critical(self, msg): self.messages['critical'] = msg -class FakeApp(object): +class FakeApp: def __init__(self, _stdout, _log): self.stdout = _stdout self.client_manager = None @@ -92,18 +92,18 @@ def __init__(self, _stdout, _log): self.log = _log -class FakeOptions(object): +class FakeOptions: def __init__(self, **kwargs): self.os_beta_command = False -class FakeClient(object): +class FakeClient: def __init__(self, **kwargs): self.endpoint = kwargs['endpoint'] self.token = kwargs['token'] -class FakeClientManager(object): +class FakeClientManager: _api_version = { 'image': '2', } @@ -158,7 +158,7 @@ def is_volume_endpoint_enabled(self, client): return self.volume_endpoint_enabled -class FakeModule(object): +class FakeModule: def __init__(self, name, version): self.name = name self.__version__ = version @@ -167,7 +167,7 @@ def __init__(self, name, version): self.version.__version__ = version -class FakeResource(object): +class FakeResource: def __init__(self, manager=None, info=None, loaded=False, methods=None): """Set attributes and methods for a resource. @@ -210,8 +210,8 @@ def __repr__(self): reprkeys = sorted( k for k in self.__dict__.keys() if k[0] != '_' and k != 'manager' ) - info = ", ".join("%s=%s" % (k, getattr(self, k)) for k in reprkeys) - return "<%s %s>" % (self.__class__.__name__, info) + info = ", ".join(f"{k}={getattr(self, k)}" for k in reprkeys) + return f"<{self.__class__.__name__} {info}>" def keys(self): return self._info.keys() @@ -237,7 +237,7 @@ class FakeResponse(requests.Response): def __init__( self, headers=None, status_code=200, data=None, encoding=None ): - super(FakeResponse, self).__init__() + super().__init__() headers = headers or {} diff --git a/openstackclient/tests/unit/identity/v2_0/fakes.py b/openstackclient/tests/unit/identity/v2_0/fakes.py index b9364e7f0..e07b02626 100644 --- a/openstackclient/tests/unit/identity/v2_0/fakes.py +++ b/openstackclient/tests/unit/identity/v2_0/fakes.py @@ -155,7 +155,7 @@ def fake_auth_ref(fake_token, fake_service=None): return auth_ref -class FakeIdentityv2Client(object): +class FakeIdentityv2Client: def __init__(self, **kwargs): self.roles = mock.Mock() self.roles.resource_class = fakes.FakeResource(None, {}) @@ -210,7 +210,7 @@ class TestIdentityv2( ): ... -class FakeExtension(object): +class FakeExtension: """Fake one or more extension.""" @staticmethod @@ -249,7 +249,7 @@ def create_one_extension(attrs=None): return extension -class FakeCatalog(object): +class FakeCatalog: """Fake one or more catalog.""" @staticmethod @@ -299,7 +299,7 @@ def create_catalog(attrs=None): return catalog -class FakeProject(object): +class FakeProject: """Fake one or more project.""" @staticmethod @@ -346,7 +346,7 @@ def create_projects(attrs=None, count=2): return projects -class FakeEndpoint(object): +class FakeEndpoint: """Fake one or more endpoint.""" @staticmethod @@ -397,7 +397,7 @@ def create_endpoints(attrs=None, count=2): return endpoints -class FakeService(object): +class FakeService: """Fake one or more service.""" @staticmethod @@ -444,7 +444,7 @@ def create_services(attrs=None, count=2): return services -class FakeRole(object): +class FakeRole: """Fake one or more role.""" @staticmethod @@ -487,7 +487,7 @@ def create_roles(attrs=None, count=2): return roles -class FakeUser(object): +class FakeUser: """Fake one or more user.""" @staticmethod diff --git a/openstackclient/tests/unit/identity/v2_0/test_catalog.py b/openstackclient/tests/unit/identity/v2_0/test_catalog.py index c420d33c3..63b3d475d 100644 --- a/openstackclient/tests/unit/identity/v2_0/test_catalog.py +++ b/openstackclient/tests/unit/identity/v2_0/test_catalog.py @@ -22,7 +22,7 @@ class TestCatalog(utils.TestCommand): service_catalog = identity_fakes.FakeCatalog.create_catalog() def setUp(self): - super(TestCatalog, self).setUp() + super().setUp() self.sc_mock = mock.Mock() self.sc_mock.service_catalog.catalog.return_value = [ @@ -43,7 +43,7 @@ class TestCatalogList(TestCatalog): ) def setUp(self): - super(TestCatalogList, self).setUp() + super().setUp() # Get the command object to test self.cmd = catalog.ListCatalog(self.app, None) @@ -126,7 +126,7 @@ def test_catalog_list_with_endpoint_url(self): class TestCatalogShow(TestCatalog): def setUp(self): - super(TestCatalogShow, self).setUp() + super().setUp() # Get the command object to test self.cmd = catalog.ShowCatalog(self.app, None) diff --git a/openstackclient/tests/unit/identity/v2_0/test_endpoint.py b/openstackclient/tests/unit/identity/v2_0/test_endpoint.py index 84ed6c9a4..0bc82bc7e 100644 --- a/openstackclient/tests/unit/identity/v2_0/test_endpoint.py +++ b/openstackclient/tests/unit/identity/v2_0/test_endpoint.py @@ -24,7 +24,7 @@ class TestEndpoint(identity_fakes.TestIdentityv2): fake_endpoint = identity_fakes.FakeEndpoint.create_one_endpoint(attr) def setUp(self): - super(TestEndpoint, self).setUp() + super().setUp() # Get a shortcut to the EndpointManager Mock self.endpoints_mock = self.identity_client.endpoints @@ -37,7 +37,7 @@ def setUp(self): class TestEndpointCreate(TestEndpoint): def setUp(self): - super(TestEndpointCreate, self).setUp() + super().setUp() self.endpoints_mock.create.return_value = self.fake_endpoint @@ -109,7 +109,7 @@ def test_endpoint_create(self): class TestEndpointDelete(TestEndpoint): def setUp(self): - super(TestEndpointDelete, self).setUp() + super().setUp() self.endpoints_mock.get.return_value = self.fake_endpoint self.endpoints_mock.delete.return_value = None @@ -136,7 +136,7 @@ def test_endpoint_delete_no_options(self): class TestEndpointList(TestEndpoint): def setUp(self): - super(TestEndpointList, self).setUp() + super().setUp() self.endpoints_mock.list.return_value = [self.fake_endpoint] @@ -211,7 +211,7 @@ def test_endpoint_list_long(self): class TestEndpointShow(TestEndpoint): def setUp(self): - super(TestEndpointShow, self).setUp() + super().setUp() self.endpoints_mock.list.return_value = [self.fake_endpoint] diff --git a/openstackclient/tests/unit/identity/v2_0/test_project.py b/openstackclient/tests/unit/identity/v2_0/test_project.py index cfd826337..9b203b22b 100644 --- a/openstackclient/tests/unit/identity/v2_0/test_project.py +++ b/openstackclient/tests/unit/identity/v2_0/test_project.py @@ -56,7 +56,7 @@ class TestProject(identity_fakes.TestIdentityv2): ) def setUp(self): - super(TestProject, self).setUp() + super().setUp() # Get a shortcut to the TenantManager Mock self.projects_mock = self.identity_client.tenants @@ -65,7 +65,7 @@ def setUp(self): class TestProjectCreate(TestProject): def setUp(self): - super(TestProjectCreate, self).setUp() + super().setUp() self.projects_mock.create.return_value = self.fake_project @@ -289,7 +289,7 @@ def test_project_create_or_show_not_exists(self): class TestProjectDelete(TestProject): def setUp(self): - super(TestProjectDelete, self).setUp() + super().setUp() # This is the return value for utils.find_resource() self.projects_mock.get.return_value = self.fake_project @@ -341,7 +341,7 @@ def test_delete_multi_projects_with_exception(self, find_mock): class TestProjectList(TestProject): def setUp(self): - super(TestProjectList, self).setUp() + super().setUp() self.projects_mock.list.return_value = [self.fake_project] @@ -431,7 +431,7 @@ def test_project_list_sort(self): class TestProjectSet(TestProject): def setUp(self): - super(TestProjectSet, self).setUp() + super().setUp() self.projects_mock.get.return_value = self.fake_project self.projects_mock.update.return_value = self.fake_project @@ -613,7 +613,7 @@ class TestProjectShow(TestProject): fake_proj_show = identity_fakes.FakeProject.create_one_project() def setUp(self): - super(TestProjectShow, self).setUp() + super().setUp() self.projects_mock.get.return_value = self.fake_proj_show @@ -654,7 +654,7 @@ class TestProjectUnset(TestProject): fake_proj = identity_fakes.FakeProject.create_one_project(attr) def setUp(self): - super(TestProjectUnset, self).setUp() + super().setUp() self.projects_mock.get.return_value = self.fake_proj diff --git a/openstackclient/tests/unit/identity/v2_0/test_role.py b/openstackclient/tests/unit/identity/v2_0/test_role.py index 6556c6d7d..830653b0f 100644 --- a/openstackclient/tests/unit/identity/v2_0/test_role.py +++ b/openstackclient/tests/unit/identity/v2_0/test_role.py @@ -40,7 +40,7 @@ class TestRole(identity_fakes.TestIdentityv2): fake_user = identity_fakes.FakeUser.create_one_user(attr) def setUp(self): - super(TestRole, self).setUp() + super().setUp() # Get a shortcut to the TenantManager Mock self.projects_mock = self.identity_client.tenants @@ -64,7 +64,7 @@ def setUp(self): class TestRoleAdd(TestRole): def setUp(self): - super(TestRoleAdd, self).setUp() + super().setUp() self.projects_mock.get.return_value = self.fake_project @@ -121,7 +121,7 @@ class TestRoleCreate(TestRole): ) def setUp(self): - super(TestRoleCreate, self).setUp() + super().setUp() self.roles_mock.create.return_value = self.fake_role_c @@ -212,7 +212,7 @@ def test_role_create_or_show_not_exists(self): class TestRoleDelete(TestRole): def setUp(self): - super(TestRoleDelete, self).setUp() + super().setUp() self.roles_mock.get.return_value = self.fake_role self.roles_mock.delete.return_value = None @@ -263,7 +263,7 @@ def test_delete_multi_roles_with_exception(self, find_mock): class TestRoleList(TestRole): def setUp(self): - super(TestRoleList, self).setUp() + super().setUp() self.roles_mock.list.return_value = [self.fake_role] @@ -295,7 +295,7 @@ def test_role_list(self): class TestRoleRemove(TestRole): def setUp(self): - super(TestRoleRemove, self).setUp() + super().setUp() self.projects_mock.get.return_value = self.fake_project @@ -335,7 +335,7 @@ def test_role_remove(self): class TestRoleShow(TestRole): def setUp(self): - super(TestRoleShow, self).setUp() + super().setUp() self.roles_mock.get.return_value = self.fake_role diff --git a/openstackclient/tests/unit/identity/v2_0/test_role_assignment.py b/openstackclient/tests/unit/identity/v2_0/test_role_assignment.py index 9cc7d5e75..a06c270f0 100644 --- a/openstackclient/tests/unit/identity/v2_0/test_role_assignment.py +++ b/openstackclient/tests/unit/identity/v2_0/test_role_assignment.py @@ -23,7 +23,7 @@ class TestRoleAssignment(identity_fakes.TestIdentityv2): def setUp(self): - super(TestRoleAssignment, self).setUp() + super().setUp() class TestRoleAssignmentList(TestRoleAssignment): diff --git a/openstackclient/tests/unit/identity/v2_0/test_service.py b/openstackclient/tests/unit/identity/v2_0/test_service.py index b5ec353f9..22e7b837a 100644 --- a/openstackclient/tests/unit/identity/v2_0/test_service.py +++ b/openstackclient/tests/unit/identity/v2_0/test_service.py @@ -24,7 +24,7 @@ class TestService(identity_fakes.TestIdentityv2): fake_service = identity_fakes.FakeService.create_one_service() def setUp(self): - super(TestService, self).setUp() + super().setUp() # Get a shortcut to the ServiceManager Mock self.services_mock = self.identity_client.services @@ -47,7 +47,7 @@ class TestServiceCreate(TestService): ) def setUp(self): - super(TestServiceCreate, self).setUp() + super().setUp() self.services_mock.create.return_value = self.fake_service_c @@ -141,7 +141,7 @@ def test_service_create_description(self): class TestServiceDelete(TestService): def setUp(self): - super(TestServiceDelete, self).setUp() + super().setUp() self.services_mock.get.side_effect = identity_exc.NotFound(None) self.services_mock.find.return_value = self.fake_service @@ -169,7 +169,7 @@ def test_service_delete_no_options(self): class TestServiceList(TestService): def setUp(self): - super(TestServiceList, self).setUp() + super().setUp() self.services_mock.list.return_value = [self.fake_service] @@ -232,7 +232,7 @@ class TestServiceShow(TestService): fake_service_s = identity_fakes.FakeService.create_one_service() def setUp(self): - super(TestServiceShow, self).setUp() + super().setUp() self.services_mock.get.side_effect = identity_exc.NotFound(None) self.services_mock.find.return_value = self.fake_service_s diff --git a/openstackclient/tests/unit/identity/v2_0/test_token.py b/openstackclient/tests/unit/identity/v2_0/test_token.py index 56e59f4ad..1e90104d9 100644 --- a/openstackclient/tests/unit/identity/v2_0/test_token.py +++ b/openstackclient/tests/unit/identity/v2_0/test_token.py @@ -24,7 +24,7 @@ class TestToken(identity_fakes.TestIdentityv2): fake_project = identity_fakes.FakeProject.create_one_project() def setUp(self): - super(TestToken, self).setUp() + super().setUp() # Get a shortcut to the Auth Ref Mock self.ar_mock = mock.PropertyMock() @@ -33,7 +33,7 @@ def setUp(self): class TestTokenIssue(TestToken): def setUp(self): - super(TestTokenIssue, self).setUp() + super().setUp() self.cmd = token.IssueToken(self.app, None) @@ -95,7 +95,7 @@ class TestTokenRevoke(TestToken): TOKEN = 'fob' def setUp(self): - super(TestTokenRevoke, self).setUp() + super().setUp() self.tokens_mock = self.identity_client.tokens self.tokens_mock.reset_mock() self.tokens_mock.delete.return_value = True diff --git a/openstackclient/tests/unit/identity/v2_0/test_user.py b/openstackclient/tests/unit/identity/v2_0/test_user.py index 3355e4cb5..725a82180 100644 --- a/openstackclient/tests/unit/identity/v2_0/test_user.py +++ b/openstackclient/tests/unit/identity/v2_0/test_user.py @@ -31,7 +31,7 @@ class TestUser(identity_fakes.TestIdentityv2): fake_user = identity_fakes.FakeUser.create_one_user(attr) def setUp(self): - super(TestUser, self).setUp() + super().setUp() # Get a shortcut to the TenantManager Mock self.projects_mock = self.identity_client.tenants @@ -65,7 +65,7 @@ class TestUserCreate(TestUser): ) def setUp(self): - super(TestUserCreate, self).setUp() + super().setUp() self.projects_mock.get.return_value = self.fake_project_c @@ -363,7 +363,7 @@ def test_user_create_or_show_not_exists(self): class TestUserDelete(TestUser): def setUp(self): - super(TestUserDelete, self).setUp() + super().setUp() # This is the return value for utils.find_resource() self.users_mock.get.return_value = self.fake_user @@ -432,7 +432,7 @@ class TestUserList(TestUser): ) def setUp(self): - super(TestUserList, self).setUp() + super().setUp() self.projects_mock.get.return_value = self.fake_project_l self.projects_mock.list.return_value = [self.fake_project_l] @@ -513,7 +513,7 @@ def test_user_list_long(self): class TestUserSet(TestUser): def setUp(self): - super(TestUserSet, self).setUp() + super().setUp() self.projects_mock.get.return_value = self.fake_project self.users_mock.get.return_value = self.fake_user @@ -755,7 +755,7 @@ def test_user_set_disable(self): class TestUserShow(TestUser): def setUp(self): - super(TestUserShow, self).setUp() + super().setUp() self.users_mock.get.return_value = self.fake_user diff --git a/openstackclient/tests/unit/identity/v3/fakes.py b/openstackclient/tests/unit/identity/v3/fakes.py index b56762497..ad5ceb284 100644 --- a/openstackclient/tests/unit/identity/v3/fakes.py +++ b/openstackclient/tests/unit/identity/v3/fakes.py @@ -565,7 +565,7 @@ def fake_auth_ref(fake_token, fake_service=None): return auth_ref -class FakeAuth(object): +class FakeAuth: def __init__(self, auth_method_class=None): self._auth_method_class = auth_method_class @@ -573,12 +573,12 @@ def get_token(self, *args, **kwargs): return token_id -class FakeSession(object): +class FakeSession: def __init__(self, **kwargs): self.auth = FakeAuth() -class FakeIdentityv3Client(object): +class FakeIdentityv3Client: def __init__(self, **kwargs): self.domains = mock.Mock() self.domains.resource_class = fakes.FakeResource(None, {}) @@ -633,7 +633,7 @@ def __init__(self, **kwargs): self.limits.resource_class = fakes.FakeResource(None, {}) -class FakeFederationManager(object): +class FakeFederationManager: def __init__(self, **kwargs): self.identity_providers = mock.Mock() self.identity_providers.resource_class = fakes.FakeResource(None, {}) @@ -651,13 +651,13 @@ def __init__(self, **kwargs): class FakeFederatedClient(FakeIdentityv3Client): def __init__(self, **kwargs): - super(FakeFederatedClient, self).__init__(**kwargs) + super().__init__(**kwargs) self.federation = FakeFederationManager() class FakeOAuth1Client(FakeIdentityv3Client): def __init__(self, **kwargs): - super(FakeOAuth1Client, self).__init__(**kwargs) + super().__init__(**kwargs) self.access_tokens = mock.Mock() self.access_tokens.resource_class = fakes.FakeResource(None, {}) @@ -696,7 +696,7 @@ class TestIdentityv3( # We don't use FakeClientMixin since we want a different fake legacy client class TestFederatedIdentity(utils.TestCommand): def setUp(self): - super(TestFederatedIdentity, self).setUp() + super().setUp() self.app.client_manager.identity = FakeFederatedClient( endpoint=fakes.AUTH_URL, token=fakes.AUTH_TOKEN @@ -716,7 +716,7 @@ def setUp(self): # We don't use FakeClientMixin since we want a different fake legacy client class TestOAuth1(utils.TestCommand): def setUp(self): - super(TestOAuth1, self).setUp() + super().setUp() self.app.client_manager.identity = FakeOAuth1Client( endpoint=fakes.AUTH_URL, token=fakes.AUTH_TOKEN @@ -733,7 +733,7 @@ def setUp(self): ) -class FakeProject(object): +class FakeProject: """Fake one or more project.""" @staticmethod @@ -785,7 +785,7 @@ def create_projects(attrs=None, count=2): return projects -class FakeDomain(object): +class FakeDomain: """Fake one or more domain.""" @staticmethod @@ -817,7 +817,7 @@ def create_one_domain(attrs=None): return domain -class FakeCredential(object): +class FakeCredential: """Fake one or more credential.""" @staticmethod @@ -887,7 +887,7 @@ def get_credentials(credentials=None, count=2): return mock.Mock(side_effect=credentials) -class FakeUser(object): +class FakeUser: """Fake one or more user.""" @staticmethod @@ -956,7 +956,7 @@ def get_users(users=None, count=2): return mock.Mock(side_effect=users) -class FakeGroup(object): +class FakeGroup: """Fake one or more group.""" @staticmethod @@ -1023,7 +1023,7 @@ def get_groups(groups=None, count=2): return mock.Mock(side_effect=groups) -class FakeEndpoint(object): +class FakeEndpoint: """Fake one or more endpoint.""" @staticmethod @@ -1080,7 +1080,7 @@ def create_one_endpoint_filter(attrs=None): return endpoint_filter -class FakeEndpointGroup(object): +class FakeEndpointGroup: """Fake one or more endpoint group.""" @staticmethod @@ -1140,7 +1140,7 @@ def create_one_endpointgroup_filter(attrs=None): return endpointgroup_filter -class FakeService(object): +class FakeService: """Fake one or more service.""" @staticmethod @@ -1172,7 +1172,7 @@ def create_one_service(attrs=None): return service -class FakeRoleAssignment(object): +class FakeRoleAssignment: """Fake one or more role assignment.""" @staticmethod @@ -1202,7 +1202,7 @@ def create_one_role_assignment(attrs=None): return role_assignment -class FakeImpliedRoleResponse(object): +class FakeImpliedRoleResponse: """Fake one or more role assignment.""" def __init__(self, prior_role, implied_roles): diff --git a/openstackclient/tests/unit/identity/v3/test_access_rule.py b/openstackclient/tests/unit/identity/v3/test_access_rule.py index b6ef20be7..5367c1987 100644 --- a/openstackclient/tests/unit/identity/v3/test_access_rule.py +++ b/openstackclient/tests/unit/identity/v3/test_access_rule.py @@ -25,7 +25,7 @@ class TestAccessRule(identity_fakes.TestIdentityv3): def setUp(self): - super(TestAccessRule, self).setUp() + super().setUp() identity_manager = self.identity_client self.access_rules_mock = identity_manager.access_rules @@ -36,7 +36,7 @@ def setUp(self): class TestAccessRuleDelete(TestAccessRule): def setUp(self): - super(TestAccessRuleDelete, self).setUp() + super().setUp() # This is the return value for utils.find_resource() self.access_rules_mock.get.return_value = fakes.FakeResource( @@ -98,7 +98,7 @@ def test_delete_multi_access_rules_with_exception(self): class TestAccessRuleList(TestAccessRule): def setUp(self): - super(TestAccessRuleList, self).setUp() + super().setUp() self.access_rules_mock.list.return_value = [ fakes.FakeResource( @@ -135,7 +135,7 @@ def test_access_rule_list(self): class TestAccessRuleShow(TestAccessRule): def setUp(self): - super(TestAccessRuleShow, self).setUp() + super().setUp() self.access_rules_mock.get.return_value = fakes.FakeResource( None, diff --git a/openstackclient/tests/unit/identity/v3/test_application_credential.py b/openstackclient/tests/unit/identity/v3/test_application_credential.py index 129b62cad..d9c3531dd 100644 --- a/openstackclient/tests/unit/identity/v3/test_application_credential.py +++ b/openstackclient/tests/unit/identity/v3/test_application_credential.py @@ -27,7 +27,7 @@ class TestApplicationCredential(identity_fakes.TestIdentityv3): def setUp(self): - super(TestApplicationCredential, self).setUp() + super().setUp() identity_manager = self.identity_client self.app_creds_mock = identity_manager.application_credentials @@ -38,7 +38,7 @@ def setUp(self): class TestApplicationCredentialCreate(TestApplicationCredential): def setUp(self): - super(TestApplicationCredentialCreate, self).setUp() + super().setUp() self.roles_mock.get.return_value = fakes.FakeResource( None, @@ -296,7 +296,7 @@ def test_application_credential_create_with_access_rules_file( class TestApplicationCredentialDelete(TestApplicationCredential): def setUp(self): - super(TestApplicationCredentialDelete, self).setUp() + super().setUp() # This is the return value for utils.find_resource() self.app_creds_mock.get.return_value = fakes.FakeResource( @@ -361,7 +361,7 @@ def test_delete_multi_app_creds_with_exception(self, find_mock): class TestApplicationCredentialList(TestApplicationCredential): def setUp(self): - super(TestApplicationCredentialList, self).setUp() + super().setUp() self.app_creds_mock.list.return_value = [ fakes.FakeResource( @@ -404,7 +404,7 @@ def test_application_credential_list(self): class TestApplicationCredentialShow(TestApplicationCredential): def setUp(self): - super(TestApplicationCredentialShow, self).setUp() + super().setUp() self.app_creds_mock.get.return_value = fakes.FakeResource( None, diff --git a/openstackclient/tests/unit/identity/v3/test_catalog.py b/openstackclient/tests/unit/identity/v3/test_catalog.py index a157859e7..ed2db3b4d 100644 --- a/openstackclient/tests/unit/identity/v3/test_catalog.py +++ b/openstackclient/tests/unit/identity/v3/test_catalog.py @@ -47,7 +47,7 @@ class TestCatalog(utils.TestCommand): } def setUp(self): - super(TestCatalog, self).setUp() + super().setUp() self.sc_mock = mock.Mock() self.sc_mock.service_catalog.catalog.return_value = [ @@ -62,7 +62,7 @@ def setUp(self): class TestCatalogList(TestCatalog): def setUp(self): - super(TestCatalogList, self).setUp() + super().setUp() # Get the command object to test self.cmd = catalog.ListCatalog(self.app, None) @@ -100,7 +100,7 @@ def test_catalog_list(self): class TestCatalogShow(TestCatalog): def setUp(self): - super(TestCatalogShow, self).setUp() + super().setUp() # Get the command object to test self.cmd = catalog.ShowCatalog(self.app, None) diff --git a/openstackclient/tests/unit/identity/v3/test_consumer.py b/openstackclient/tests/unit/identity/v3/test_consumer.py index 8067965ae..94b81dd94 100644 --- a/openstackclient/tests/unit/identity/v3/test_consumer.py +++ b/openstackclient/tests/unit/identity/v3/test_consumer.py @@ -19,14 +19,14 @@ class TestOAuth1(identity_fakes.TestOAuth1): def setUp(self): - super(TestOAuth1, self).setUp() + super().setUp() self.consumers_mock = self.identity_client.oauth1.consumers self.consumers_mock.reset_mock() class TestConsumerCreate(TestOAuth1): def setUp(self): - super(TestConsumerCreate, self).setUp() + super().setUp() self.consumers_mock.create.return_value = fakes.FakeResource( None, @@ -63,7 +63,7 @@ def test_create_consumer(self): class TestConsumerDelete(TestOAuth1): def setUp(self): - super(TestConsumerDelete, self).setUp() + super().setUp() # This is the return value for utils.find_resource() self.consumers_mock.get.return_value = fakes.FakeResource( @@ -94,7 +94,7 @@ def test_delete_consumer(self): class TestConsumerList(TestOAuth1): def setUp(self): - super(TestConsumerList, self).setUp() + super().setUp() self.consumers_mock.get.return_value = fakes.FakeResource( None, @@ -136,7 +136,7 @@ def test_consumer_list(self): class TestConsumerSet(TestOAuth1): def setUp(self): - super(TestConsumerSet, self).setUp() + super().setUp() self.consumers_mock.get.return_value = fakes.FakeResource( None, @@ -179,7 +179,7 @@ def test_consumer_update(self): class TestConsumerShow(TestOAuth1): def setUp(self): - super(TestConsumerShow, self).setUp() + super().setUp() consumer_no_secret = copy.deepcopy(identity_fakes.OAUTH_CONSUMER) del consumer_no_secret['secret'] diff --git a/openstackclient/tests/unit/identity/v3/test_credential.py b/openstackclient/tests/unit/identity/v3/test_credential.py index 47af5053b..794f40b05 100644 --- a/openstackclient/tests/unit/identity/v3/test_credential.py +++ b/openstackclient/tests/unit/identity/v3/test_credential.py @@ -22,7 +22,7 @@ class TestCredential(identity_fakes.TestIdentityv3): def setUp(self): - super(TestCredential, self).setUp() + super().setUp() # Get a shortcut to the CredentialManager Mock self.credentials_mock = self.identity_client.credentials @@ -49,7 +49,7 @@ class TestCredentialCreate(TestCredential): ) def setUp(self): - super(TestCredentialCreate, self).setUp() + super().setUp() self.credential = identity_fakes.FakeCredential.create_one_credential( attrs={'user_id': self.user.id, 'project_id': self.project.id} @@ -126,7 +126,7 @@ class TestCredentialDelete(TestCredential): credentials = identity_fakes.FakeCredential.create_credentials(count=2) def setUp(self): - super(TestCredentialDelete, self).setUp() + super().setUp() self.credentials_mock.delete.return_value = None @@ -206,7 +206,7 @@ class TestCredentialList(TestCredential): ) def setUp(self): - super(TestCredentialList, self).setUp() + super().setUp() self.user = identity_fakes.FakeUser.create_one_user() self.users_mock.get.return_value = self.user @@ -257,7 +257,7 @@ class TestCredentialSet(TestCredential): credential = identity_fakes.FakeCredential.create_one_credential() def setUp(self): - super(TestCredentialSet, self).setUp() + super().setUp() self.cmd = credential.SetCredential(self.app, None) def test_credential_set_no_options(self): @@ -353,7 +353,7 @@ class TestCredentialShow(TestCredential): ) def setUp(self): - super(TestCredentialShow, self).setUp() + super().setUp() self.credential = identity_fakes.FakeCredential.create_one_credential() self.credentials_mock.get.return_value = self.credential diff --git a/openstackclient/tests/unit/identity/v3/test_domain.py b/openstackclient/tests/unit/identity/v3/test_domain.py index 76e784827..fe3f655e4 100644 --- a/openstackclient/tests/unit/identity/v3/test_domain.py +++ b/openstackclient/tests/unit/identity/v3/test_domain.py @@ -16,7 +16,7 @@ class TestDomain(identity_fakes.TestIdentityv3): def setUp(self): - super(TestDomain, self).setUp() + super().setUp() # Get a shortcut to the DomainManager Mock self.domains_mock = self.identity_client.domains @@ -27,7 +27,7 @@ class TestDomainCreate(TestDomain): columns = ('description', 'enabled', 'id', 'name', 'tags') def setUp(self): - super(TestDomainCreate, self).setUp() + super().setUp() self.domain = identity_fakes.FakeDomain.create_one_domain() self.domains_mock.create.return_value = self.domain @@ -214,7 +214,7 @@ class TestDomainDelete(TestDomain): domain = identity_fakes.FakeDomain.create_one_domain() def setUp(self): - super(TestDomainDelete, self).setUp() + super().setUp() # This is the return value for utils.find_resource() self.domains_mock.get.return_value = self.domain @@ -244,7 +244,7 @@ class TestDomainList(TestDomain): domain = identity_fakes.FakeDomain.create_one_domain() def setUp(self): - super(TestDomainList, self).setUp() + super().setUp() self.domains_mock.list.return_value = [self.domain] @@ -329,7 +329,7 @@ class TestDomainSet(TestDomain): domain = identity_fakes.FakeDomain.create_one_domain() def setUp(self): - super(TestDomainSet, self).setUp() + super().setUp() self.domains_mock.get.return_value = self.domain @@ -478,7 +478,7 @@ def test_domain_set_no_immutable_option(self): class TestDomainShow(TestDomain): def setUp(self): - super(TestDomainShow, self).setUp() + super().setUp() self.domain = identity_fakes.FakeDomain.create_one_domain() self.domains_mock.get.return_value = self.domain diff --git a/openstackclient/tests/unit/identity/v3/test_endpoint.py b/openstackclient/tests/unit/identity/v3/test_endpoint.py index 02c125eb9..1dafe48e4 100644 --- a/openstackclient/tests/unit/identity/v3/test_endpoint.py +++ b/openstackclient/tests/unit/identity/v3/test_endpoint.py @@ -16,7 +16,7 @@ class TestEndpoint(identity_fakes.TestIdentityv3): def setUp(self): - super(TestEndpoint, self).setUp() + super().setUp() # Get a shortcut to the EndpointManager Mock self.endpoints_mock = self.identity_client.endpoints @@ -52,7 +52,7 @@ class TestEndpointCreate(TestEndpoint): ) def setUp(self): - super(TestEndpointCreate, self).setUp() + super().setUp() self.endpoint = identity_fakes.FakeEndpoint.create_one_endpoint( attrs={'service_id': self.service.id} @@ -247,7 +247,7 @@ class TestEndpointDelete(TestEndpoint): endpoint = identity_fakes.FakeEndpoint.create_one_endpoint() def setUp(self): - super(TestEndpointDelete, self).setUp() + super().setUp() # This is the return value for utils.find_resource(endpoint) self.endpoints_mock.get.return_value = self.endpoint @@ -290,7 +290,7 @@ class TestEndpointList(TestEndpoint): ) def setUp(self): - super(TestEndpointList, self).setUp() + super().setUp() self.endpoints_mock.list.return_value = [self.endpoint] @@ -477,7 +477,7 @@ class TestEndpointSet(TestEndpoint): ) def setUp(self): - super(TestEndpointSet, self).setUp() + super().setUp() # This is the return value for utils.find_resource(endpoint) self.endpoints_mock.get.return_value = self.endpoint @@ -659,7 +659,7 @@ class TestEndpointShow(TestEndpoint): ) def setUp(self): - super(TestEndpointShow, self).setUp() + super().setUp() self.endpoints_mock.get.return_value = self.endpoint @@ -785,7 +785,7 @@ class TestAddProjectToEndpoint(TestEndpoint): ) def setUp(self): - super(TestAddProjectToEndpoint, self).setUp() + super().setUp() # This is the return value for utils.find_resource() self.endpoints_mock.get.return_value = self.endpoint @@ -844,7 +844,7 @@ class TestRemoveProjectEndpoint(TestEndpoint): ) def setUp(self): - super(TestRemoveProjectEndpoint, self).setUp() + super().setUp() # This is the return value for utils.find_resource() self.endpoints_mock.get.return_value = self.endpoint diff --git a/openstackclient/tests/unit/identity/v3/test_endpoint_group.py b/openstackclient/tests/unit/identity/v3/test_endpoint_group.py index 00208b48a..e739a7d92 100644 --- a/openstackclient/tests/unit/identity/v3/test_endpoint_group.py +++ b/openstackclient/tests/unit/identity/v3/test_endpoint_group.py @@ -19,7 +19,7 @@ class TestEndpointGroup(identity_fakes.TestIdentityv3): def setUp(self): - super(TestEndpointGroup, self).setUp() + super().setUp() # Get a shortcut to the EndpointManager Mock self.endpoint_groups_mock = self.identity_client.endpoint_groups @@ -49,7 +49,7 @@ class TestEndpointGroupCreate(TestEndpointGroup): ) def setUp(self): - super(TestEndpointGroupCreate, self).setUp() + super().setUp() self.endpoint_group = ( identity_fakes.FakeEndpointGroup.create_one_endpointgroup( @@ -110,7 +110,7 @@ class TestEndpointGroupDelete(TestEndpointGroup): ) def setUp(self): - super(TestEndpointGroupDelete, self).setUp() + super().setUp() # This is the return value for utils.find_resource(endpoint) self.endpoint_groups_mock.get.return_value = self.endpoint_group @@ -150,7 +150,7 @@ class TestEndpointGroupList(TestEndpointGroup): ) def setUp(self): - super(TestEndpointGroupList, self).setUp() + super().setUp() self.endpoint_groups_mock.list.return_value = [self.endpoint_group] self.endpoint_groups_mock.get.return_value = self.endpoint_group @@ -256,7 +256,7 @@ class TestEndpointGroupSet(TestEndpointGroup): ) def setUp(self): - super(TestEndpointGroupSet, self).setUp() + super().setUp() # This is the return value for utils.find_resource(endpoint) self.endpoint_groups_mock.get.return_value = self.endpoint_group @@ -371,7 +371,7 @@ class TestAddProjectToEndpointGroup(TestEndpointGroup): ) def setUp(self): - super(TestAddProjectToEndpointGroup, self).setUp() + super().setUp() # This is the return value for utils.find_resource() self.endpoint_groups_mock.get.return_value = self.endpoint_group @@ -432,7 +432,7 @@ class TestRemoveProjectEndpointGroup(TestEndpointGroup): ) def setUp(self): - super(TestRemoveProjectEndpointGroup, self).setUp() + super().setUp() # This is the return value for utils.find_resource() self.endpoint_groups_mock.get.return_value = self.endpoint_group diff --git a/openstackclient/tests/unit/identity/v3/test_group.py b/openstackclient/tests/unit/identity/v3/test_group.py index 646a43203..04e5a9cf9 100644 --- a/openstackclient/tests/unit/identity/v3/test_group.py +++ b/openstackclient/tests/unit/identity/v3/test_group.py @@ -24,7 +24,7 @@ class TestGroup(identity_fakes.TestIdentityv3): def setUp(self): - super(TestGroup, self).setUp() + super().setUp() # Get a shortcut to the DomainManager Mock self.domains_mock = self.identity_client.domains @@ -44,7 +44,7 @@ class TestGroupAddUser(TestGroup): users = identity_fakes.FakeUser.create_users(count=2) def setUp(self): - super(TestGroupAddUser, self).setUp() + super().setUp() self.groups_mock.get.return_value = self._group self.users_mock.get = identity_fakes.FakeUser.get_users(self.users) @@ -123,7 +123,7 @@ class TestGroupCheckUser(TestGroup): user = identity_fakes.FakeUser.create_one_user() def setUp(self): - super(TestGroupCheckUser, self).setUp() + super().setUp() self.groups_mock.get.return_value = self.group self.users_mock.get.return_value = self.user @@ -179,7 +179,7 @@ class TestGroupCreate(TestGroup): ) def setUp(self): - super(TestGroupCreate, self).setUp() + super().setUp() self.group = identity_fakes.FakeGroup.create_one_group( attrs={'domain_id': self.domain.id} ) @@ -263,7 +263,7 @@ class TestGroupDelete(TestGroup): ) def setUp(self): - super(TestGroupDelete, self).setUp() + super().setUp() self.groups_mock.get = identity_fakes.FakeGroup.get_groups(self.groups) self.groups_mock.delete.return_value = None @@ -368,7 +368,7 @@ class TestGroupList(TestGroup): ) def setUp(self): - super(TestGroupList, self).setUp() + super().setUp() self.groups_mock.get.return_value = self.group self.groups_mock.list.return_value = [self.group] @@ -496,7 +496,7 @@ class TestGroupRemoveUser(TestGroup): users = identity_fakes.FakeUser.create_users(count=2) def setUp(self): - super(TestGroupRemoveUser, self).setUp() + super().setUp() self.groups_mock.get.return_value = self._group self.users_mock.get = identity_fakes.FakeUser.get_users(self.users) @@ -577,7 +577,7 @@ class TestGroupSet(TestGroup): ) def setUp(self): - super(TestGroupSet, self).setUp() + super().setUp() self.groups_mock.get.return_value = self.group self.domains_mock.get.return_value = self.domain @@ -657,7 +657,7 @@ class TestGroupShow(TestGroup): ) def setUp(self): - super(TestGroupShow, self).setUp() + super().setUp() self.group = identity_fakes.FakeGroup.create_one_group( attrs={'domain_id': self.domain.id} ) diff --git a/openstackclient/tests/unit/identity/v3/test_identity_provider.py b/openstackclient/tests/unit/identity/v3/test_identity_provider.py index 4426e096e..20e7f497a 100644 --- a/openstackclient/tests/unit/identity/v3/test_identity_provider.py +++ b/openstackclient/tests/unit/identity/v3/test_identity_provider.py @@ -25,7 +25,7 @@ class TestIdentityProvider(identity_fakes.TestFederatedIdentity): def setUp(self): - super(TestIdentityProvider, self).setUp() + super().setUp() # Identity Provider mocks federation_lib = self.identity_client.federation @@ -59,7 +59,7 @@ class TestIdentityProviderCreate(TestIdentityProvider): ) def setUp(self): - super(TestIdentityProviderCreate, self).setUp() + super().setUp() copied_idp = copy.deepcopy(identity_fakes.IDENTITY_PROVIDER) resource = fakes.FakeResource(None, copied_idp, loaded=True) @@ -401,7 +401,7 @@ def test_create_identity_provider_authttl_not_int(self): class TestIdentityProviderDelete(TestIdentityProvider): def setUp(self): - super(TestIdentityProviderDelete, self).setUp() + super().setUp() # This is the return value for utils.find_resource() self.identity_providers_mock.get.return_value = fakes.FakeResource( @@ -432,7 +432,7 @@ def test_delete_identity_provider(self): class TestIdentityProviderList(TestIdentityProvider): def setUp(self): - super(TestIdentityProviderList, self).setUp() + super().setUp() self.identity_providers_mock.get.return_value = fakes.FakeResource( None, @@ -540,7 +540,7 @@ class TestIdentityProviderSet(TestIdentityProvider): ) def setUp(self): - super(TestIdentityProviderSet, self).setUp() + super().setUp() self.cmd = identity_provider.SetIdentityProvider(self.app, None) def test_identity_provider_set_description(self): @@ -838,7 +838,7 @@ def test_identity_provider_set_authttl_not_int(self): class TestIdentityProviderShow(TestIdentityProvider): def setUp(self): - super(TestIdentityProviderShow, self).setUp() + super().setUp() ret = fakes.FakeResource( None, diff --git a/openstackclient/tests/unit/identity/v3/test_implied_role.py b/openstackclient/tests/unit/identity/v3/test_implied_role.py index 7b53de5eb..f6bc6063f 100644 --- a/openstackclient/tests/unit/identity/v3/test_implied_role.py +++ b/openstackclient/tests/unit/identity/v3/test_implied_role.py @@ -22,7 +22,7 @@ class TestRole(identity_fakes.TestIdentityv3): def setUp(self): - super(TestRole, self).setUp() + super().setUp() identity_client = self.identity_client @@ -56,7 +56,7 @@ def _is_inheritance_testcase(self): class TestImpliedRoleCreate(TestRole): def setUp(self): - super(TestImpliedRoleCreate, self).setUp() + super().setUp() self.roles_mock.list.return_value = [ fakes.FakeResource( @@ -116,7 +116,7 @@ def test_implied_role_create(self): class TestImpliedRoleDelete(TestRole): def setUp(self): - super(TestImpliedRoleDelete, self).setUp() + super().setUp() self.roles_mock.list.return_value = [ fakes.FakeResource( @@ -163,7 +163,7 @@ def test_implied_role_delete(self): class TestImpliedRoleList(TestRole): def setUp(self): - super(TestImpliedRoleList, self).setUp() + super().setUp() self.inference_rules_mock.list_inference_roles.return_value = ( identity_fakes.FakeImpliedRoleResponse.create_list() diff --git a/openstackclient/tests/unit/identity/v3/test_limit.py b/openstackclient/tests/unit/identity/v3/test_limit.py index 1fb660b1a..ef0fa4b1e 100644 --- a/openstackclient/tests/unit/identity/v3/test_limit.py +++ b/openstackclient/tests/unit/identity/v3/test_limit.py @@ -22,7 +22,7 @@ class TestLimit(identity_fakes.TestIdentityv3): def setUp(self): - super(TestLimit, self).setUp() + super().setUp() identity_manager = self.identity_client @@ -40,7 +40,7 @@ def setUp(self): class TestLimitCreate(TestLimit): def setUp(self): - super(TestLimitCreate, self).setUp() + super().setUp() self.service = fakes.FakeResource( None, copy.deepcopy(identity_fakes.SERVICE), loaded=True @@ -181,7 +181,7 @@ def test_limit_create_with_options(self): class TestLimitDelete(TestLimit): def setUp(self): - super(TestLimitDelete, self).setUp() + super().setUp() self.cmd = limit.DeleteLimit(self.app, None) def test_limit_delete(self): @@ -213,7 +213,7 @@ def test_limit_delete_with_exception(self): class TestLimitShow(TestLimit): def setUp(self): - super(TestLimitShow, self).setUp() + super().setUp() self.limit_mock.get.return_value = fakes.FakeResource( None, copy.deepcopy(identity_fakes.LIMIT), loaded=True @@ -254,7 +254,7 @@ def test_limit_show(self): class TestLimitSet(TestLimit): def setUp(self): - super(TestLimitSet, self).setUp() + super().setUp() self.cmd = limit.SetLimit(self.app, None) def test_limit_set_description(self): @@ -355,7 +355,7 @@ def test_limit_set_resource_limit(self): class TestLimitList(TestLimit): def setUp(self): - super(TestLimitList, self).setUp() + super().setUp() self.limit_mock.list.return_value = [ fakes.FakeResource( diff --git a/openstackclient/tests/unit/identity/v3/test_mappings.py b/openstackclient/tests/unit/identity/v3/test_mappings.py index 50386609e..60a89dd61 100644 --- a/openstackclient/tests/unit/identity/v3/test_mappings.py +++ b/openstackclient/tests/unit/identity/v3/test_mappings.py @@ -24,7 +24,7 @@ class TestMapping(identity_fakes.TestFederatedIdentity): def setUp(self): - super(TestMapping, self).setUp() + super().setUp() federation_lib = self.identity_client.federation self.mapping_mock = federation_lib.mappings @@ -33,7 +33,7 @@ def setUp(self): class TestMappingCreate(TestMapping): def setUp(self): - super(TestMappingCreate, self).setUp() + super().setUp() self.mapping_mock.create.return_value = fakes.FakeResource( None, copy.deepcopy(identity_fakes.MAPPING_RESPONSE), loaded=True ) @@ -75,7 +75,7 @@ def test_create_mapping(self): class TestMappingDelete(TestMapping): def setUp(self): - super(TestMappingDelete, self).setUp() + super().setUp() self.mapping_mock.get.return_value = fakes.FakeResource( None, copy.deepcopy(identity_fakes.MAPPING_RESPONSE), loaded=True ) @@ -96,7 +96,7 @@ def test_delete_mapping(self): class TestMappingList(TestMapping): def setUp(self): - super(TestMappingList, self).setUp() + super().setUp() self.mapping_mock.get.return_value = fakes.FakeResource( None, {'id': identity_fakes.mapping_id}, loaded=True ) @@ -141,7 +141,7 @@ def test_mapping_list(self): class TestMappingSet(TestMapping): def setUp(self): - super(TestMappingSet, self).setUp() + super().setUp() self.mapping_mock.get.return_value = fakes.FakeResource( None, copy.deepcopy(identity_fakes.MAPPING_RESPONSE), loaded=True @@ -201,7 +201,7 @@ def test_set_rules_wrong_file_path(self): class TestMappingShow(TestMapping): def setUp(self): - super(TestMappingShow, self).setUp() + super().setUp() self.mapping_mock.get.return_value = fakes.FakeResource( None, copy.deepcopy(identity_fakes.MAPPING_RESPONSE), loaded=True diff --git a/openstackclient/tests/unit/identity/v3/test_oauth.py b/openstackclient/tests/unit/identity/v3/test_oauth.py index 020a00232..576f8b20e 100644 --- a/openstackclient/tests/unit/identity/v3/test_oauth.py +++ b/openstackclient/tests/unit/identity/v3/test_oauth.py @@ -19,7 +19,7 @@ class TestOAuth1(identity_fakes.TestOAuth1): def setUp(self): - super(TestOAuth1, self).setUp() + super().setUp() identity_client = self.identity_client self.access_tokens_mock = identity_client.oauth1.access_tokens self.access_tokens_mock.reset_mock() @@ -33,7 +33,7 @@ def setUp(self): class TestAccessTokenCreate(TestOAuth1): def setUp(self): - super(TestAccessTokenCreate, self).setUp() + super().setUp() self.access_tokens_mock.create.return_value = fakes.FakeResource( None, @@ -87,7 +87,7 @@ def test_create_access_tokens(self): class TestRequestTokenAuthorize(TestOAuth1): def setUp(self): - super(TestRequestTokenAuthorize, self).setUp() + super().setUp() self.roles_mock.get.return_value = fakes.FakeResource( None, @@ -127,7 +127,7 @@ def test_authorize_request_tokens(self): class TestRequestTokenCreate(TestOAuth1): def setUp(self): - super(TestRequestTokenCreate, self).setUp() + super().setUp() self.request_tokens_mock.create.return_value = fakes.FakeResource( None, diff --git a/openstackclient/tests/unit/identity/v3/test_project.py b/openstackclient/tests/unit/identity/v3/test_project.py index ffef854e9..9b7fc8cea 100644 --- a/openstackclient/tests/unit/identity/v3/test_project.py +++ b/openstackclient/tests/unit/identity/v3/test_project.py @@ -26,7 +26,7 @@ class TestProject(identity_fakes.TestIdentityv3): def setUp(self): - super(TestProject, self).setUp() + super().setUp() # Get a shortcut to the DomainManager Mock self.domains_mock = self.identity_client.domains @@ -52,7 +52,7 @@ class TestProjectCreate(TestProject): ) def setUp(self): - super(TestProjectCreate, self).setUp() + super().setUp() self.project = identity_fakes.FakeProject.create_one_project( attrs={'domain_id': self.domain.id} @@ -676,7 +676,7 @@ class TestProjectDelete(TestProject): project = identity_fakes.FakeProject.create_one_project() def setUp(self): - super(TestProjectDelete, self).setUp() + super().setUp() # This is the return value for utils.find_resource() self.projects_mock.get.return_value = self.project @@ -759,7 +759,7 @@ class TestProjectList(TestProject): ) def setUp(self): - super(TestProjectList, self).setUp() + super().setUp() self.projects_mock.list.return_value = [self.project] @@ -951,7 +951,7 @@ class TestProjectSet(TestProject): ) def setUp(self): - super(TestProjectSet, self).setUp() + super().setUp() self.domains_mock.get.return_value = self.domain @@ -1130,7 +1130,7 @@ def test_project_set_tags(self): # Set expected values. new tag is added to original tags for update. kwargs = { 'name': 'qwerty', - 'tags': sorted(set(['tag1', 'tag2', 'tag3', 'foo'])), + 'tags': sorted({'tag1', 'tag2', 'tag3', 'foo'}), } # ProjectManager.update(project, name=, domain=, description=, # enabled=, **kwargs) @@ -1155,7 +1155,7 @@ def test_project_remove_tags(self): result = self.cmd.take_action(parsed_args) - kwargs = {'tags': list(set(['tag3']))} + kwargs = {'tags': list({'tag3'})} self.projects_mock.update.assert_called_with(self.project.id, **kwargs) self.assertIsNone(result) @@ -1214,7 +1214,7 @@ class TestProjectShow(TestProject): domain = identity_fakes.FakeDomain.create_one_domain() def setUp(self): - super(TestProjectShow, self).setUp() + super().setUp() self.project = identity_fakes.FakeProject.create_one_project( attrs={'domain_id': self.domain.id} diff --git a/openstackclient/tests/unit/identity/v3/test_protocol.py b/openstackclient/tests/unit/identity/v3/test_protocol.py index d40f916e5..c85699685 100644 --- a/openstackclient/tests/unit/identity/v3/test_protocol.py +++ b/openstackclient/tests/unit/identity/v3/test_protocol.py @@ -21,7 +21,7 @@ class TestProtocol(identity_fakes.TestFederatedIdentity): def setUp(self): - super(TestProtocol, self).setUp() + super().setUp() federation_lib = self.identity_client.federation self.protocols_mock = federation_lib.protocols @@ -30,7 +30,7 @@ def setUp(self): class TestProtocolCreate(TestProtocol): def setUp(self): - super(TestProtocolCreate, self).setUp() + super().setUp() proto = copy.deepcopy(identity_fakes.PROTOCOL_OUTPUT) resource = fakes.FakeResource(None, proto, loaded=True) @@ -72,7 +72,7 @@ def test_create_protocol(self): class TestProtocolDelete(TestProtocol): def setUp(self): - super(TestProtocolDelete, self).setUp() + super().setUp() # This is the return value for utils.find_resource() self.protocols_mock.get.return_value = fakes.FakeResource( @@ -106,7 +106,7 @@ def test_delete_identity_provider(self): class TestProtocolList(TestProtocol): def setUp(self): - super(TestProtocolList, self).setUp() + super().setUp() self.protocols_mock.get.return_value = fakes.FakeResource( None, identity_fakes.PROTOCOL_ID_MAPPING, loaded=True @@ -132,7 +132,7 @@ def test_list_protocols(self): class TestProtocolSet(TestProtocol): def setUp(self): - super(TestProtocolSet, self).setUp() + super().setUp() self.protocols_mock.get.return_value = fakes.FakeResource( None, identity_fakes.PROTOCOL_OUTPUT, loaded=True ) @@ -178,7 +178,7 @@ def test_set_new_mapping(self): class TestProtocolShow(TestProtocol): def setUp(self): - super(TestProtocolShow, self).setUp() + super().setUp() self.protocols_mock.get.return_value = fakes.FakeResource( None, identity_fakes.PROTOCOL_OUTPUT, loaded=False ) diff --git a/openstackclient/tests/unit/identity/v3/test_region.py b/openstackclient/tests/unit/identity/v3/test_region.py index be28f9448..9b66c3ce9 100644 --- a/openstackclient/tests/unit/identity/v3/test_region.py +++ b/openstackclient/tests/unit/identity/v3/test_region.py @@ -20,7 +20,7 @@ class TestRegion(identity_fakes.TestIdentityv3): def setUp(self): - super(TestRegion, self).setUp() + super().setUp() # Get a shortcut to the RegionManager Mock self.regions_mock = self.identity_client.regions @@ -40,7 +40,7 @@ class TestRegionCreate(TestRegion): ) def setUp(self): - super(TestRegionCreate, self).setUp() + super().setUp() self.regions_mock.create.return_value = fakes.FakeResource( None, @@ -134,7 +134,7 @@ def test_region_create_parent_region_id(self): class TestRegionDelete(TestRegion): def setUp(self): - super(TestRegionDelete, self).setUp() + super().setUp() self.regions_mock.delete.return_value = None @@ -173,7 +173,7 @@ class TestRegionList(TestRegion): ) def setUp(self): - super(TestRegionList, self).setUp() + super().setUp() self.regions_mock.list.return_value = [ fakes.FakeResource( @@ -224,7 +224,7 @@ def test_region_list_parent_region_id(self): class TestRegionSet(TestRegion): def setUp(self): - super(TestRegionSet, self).setUp() + super().setUp() self.regions_mock.update.return_value = fakes.FakeResource( None, @@ -301,7 +301,7 @@ def test_region_set_parent_region_id(self): class TestRegionShow(TestRegion): def setUp(self): - super(TestRegionShow, self).setUp() + super().setUp() self.regions_mock.get.return_value = fakes.FakeResource( None, diff --git a/openstackclient/tests/unit/identity/v3/test_registered_limit.py b/openstackclient/tests/unit/identity/v3/test_registered_limit.py index 2f51b9772..792096cde 100644 --- a/openstackclient/tests/unit/identity/v3/test_registered_limit.py +++ b/openstackclient/tests/unit/identity/v3/test_registered_limit.py @@ -22,7 +22,7 @@ class TestRegisteredLimit(identity_fakes.TestIdentityv3): def setUp(self): - super(TestRegisteredLimit, self).setUp() + super().setUp() self.registered_limit_mock = self.identity_client.registered_limits @@ -35,7 +35,7 @@ def setUp(self): class TestRegisteredLimitCreate(TestRegisteredLimit): def setUp(self): - super(TestRegisteredLimitCreate, self).setUp() + super().setUp() self.service = fakes.FakeResource( None, copy.deepcopy(identity_fakes.SERVICE), loaded=True @@ -159,7 +159,7 @@ def test_registered_limit_create_with_options(self): class TestRegisteredLimitDelete(TestRegisteredLimit): def setUp(self): - super(TestRegisteredLimitDelete, self).setUp() + super().setUp() self.cmd = registered_limit.DeleteRegisteredLimit(self.app, None) @@ -198,7 +198,7 @@ def test_registered_limit_delete_with_exception(self): class TestRegisteredLimitShow(TestRegisteredLimit): def setUp(self): - super(TestRegisteredLimitShow, self).setUp() + super().setUp() self.registered_limit_mock.get.return_value = fakes.FakeResource( None, copy.deepcopy(identity_fakes.REGISTERED_LIMIT), loaded=True @@ -241,7 +241,7 @@ def test_registered_limit_show(self): class TestRegisteredLimitSet(TestRegisteredLimit): def setUp(self): - super(TestRegisteredLimitSet, self).setUp() + super().setUp() self.cmd = registered_limit.SetRegisteredLimit(self.app, None) def test_registered_limit_set_description(self): @@ -489,7 +489,7 @@ def test_registered_limit_set_region(self): class TestRegisteredLimitList(TestRegisteredLimit): def setUp(self): - super(TestRegisteredLimitList, self).setUp() + super().setUp() self.registered_limit_mock.get.return_value = fakes.FakeResource( None, copy.deepcopy(identity_fakes.REGISTERED_LIMIT), loaded=True diff --git a/openstackclient/tests/unit/identity/v3/test_role.py b/openstackclient/tests/unit/identity/v3/test_role.py index 6d9a2ff09..09b7536e3 100644 --- a/openstackclient/tests/unit/identity/v3/test_role.py +++ b/openstackclient/tests/unit/identity/v3/test_role.py @@ -27,7 +27,7 @@ class TestRole(identity_fakes.TestIdentityv3): def setUp(self): - super(TestRole, self).setUp() + super().setUp() # Get a shortcut to the UserManager Mock self.users_mock = self.identity_client.users @@ -60,7 +60,7 @@ def _is_inheritance_testcase(self): class TestRoleAdd(TestRole): def setUp(self): - super(TestRoleAdd, self).setUp() + super().setUp() self.users_mock.get.return_value = fakes.FakeResource( None, @@ -371,7 +371,7 @@ class TestRoleAddInherited(TestRoleAdd, TestRoleInherited): class TestRoleCreate(TestRole): def setUp(self): - super(TestRoleCreate, self).setUp() + super().setUp() self.domains_mock.get.return_value = fakes.FakeResource( None, @@ -592,7 +592,7 @@ def test_role_create_with_no_immutable_option(self): class TestRoleDelete(TestRole): def setUp(self): - super(TestRoleDelete, self).setUp() + super().setUp() self.roles_mock.get.return_value = fakes.FakeResource( None, @@ -691,7 +691,7 @@ class TestRoleList(TestRole): ) def setUp(self): - super(TestRoleList, self).setUp() + super().setUp() self.roles_mock.list.return_value = [ fakes.FakeResource( @@ -766,7 +766,7 @@ def test_role_list_domain_role(self): class TestRoleRemove(TestRole): def setUp(self): - super(TestRoleRemove, self).setUp() + super().setUp() self.users_mock.get.return_value = fakes.FakeResource( None, @@ -1316,7 +1316,7 @@ def test_role_remove_with_error(self): class TestRoleSet(TestRole): def setUp(self): - super(TestRoleSet, self).setUp() + super().setUp() self.roles_mock.get.return_value = fakes.FakeResource( None, @@ -1491,7 +1491,7 @@ def test_role_set_with_no_immutable(self): class TestRoleShow(TestRole): def setUp(self): - super(TestRoleShow, self).setUp() + super().setUp() self.roles_mock.get.return_value = fakes.FakeResource( None, diff --git a/openstackclient/tests/unit/identity/v3/test_role_assignment.py b/openstackclient/tests/unit/identity/v3/test_role_assignment.py index afc7ac5b7..fa793bc82 100644 --- a/openstackclient/tests/unit/identity/v3/test_role_assignment.py +++ b/openstackclient/tests/unit/identity/v3/test_role_assignment.py @@ -21,7 +21,7 @@ class TestRoleAssignment(identity_fakes.TestIdentityv3): def setUp(self): - super(TestRoleAssignment, self).setUp() + super().setUp() class TestRoleAssignmentList(TestRoleAssignment): diff --git a/openstackclient/tests/unit/identity/v3/test_service.py b/openstackclient/tests/unit/identity/v3/test_service.py index 36669d7d5..8993c8f84 100644 --- a/openstackclient/tests/unit/identity/v3/test_service.py +++ b/openstackclient/tests/unit/identity/v3/test_service.py @@ -22,7 +22,7 @@ class TestService(identity_fakes.TestIdentityv3): def setUp(self): - super(TestService, self).setUp() + super().setUp() # Get a shortcut to the ServiceManager Mock self.services_mock = self.identity_client.services @@ -39,7 +39,7 @@ class TestServiceCreate(TestService): ) def setUp(self): - super(TestServiceCreate, self).setUp() + super().setUp() self.service = identity_fakes.FakeService.create_one_service() self.datalist = ( @@ -181,7 +181,7 @@ class TestServiceDelete(TestService): service = identity_fakes.FakeService.create_one_service() def setUp(self): - super(TestServiceDelete, self).setUp() + super().setUp() self.services_mock.get.side_effect = identity_exc.NotFound(None) self.services_mock.find.return_value = self.service @@ -211,7 +211,7 @@ class TestServiceList(TestService): service = identity_fakes.FakeService.create_one_service() def setUp(self): - super(TestServiceList, self).setUp() + super().setUp() self.services_mock.list.return_value = [self.service] @@ -275,7 +275,7 @@ class TestServiceSet(TestService): service = identity_fakes.FakeService.create_one_service() def setUp(self): - super(TestServiceSet, self).setUp() + super().setUp() self.services_mock.get.side_effect = identity_exc.NotFound(None) self.services_mock.find.return_value = self.service @@ -435,7 +435,7 @@ class TestServiceShow(TestService): service = identity_fakes.FakeService.create_one_service() def setUp(self): - super(TestServiceShow, self).setUp() + super().setUp() self.services_mock.get.side_effect = identity_exc.NotFound(None) self.services_mock.find.return_value = self.service diff --git a/openstackclient/tests/unit/identity/v3/test_service_provider.py b/openstackclient/tests/unit/identity/v3/test_service_provider.py index 8954c2a26..23402d948 100644 --- a/openstackclient/tests/unit/identity/v3/test_service_provider.py +++ b/openstackclient/tests/unit/identity/v3/test_service_provider.py @@ -21,7 +21,7 @@ class TestServiceProvider(service_fakes.TestFederatedIdentity): def setUp(self): - super(TestServiceProvider, self).setUp() + super().setUp() federation_lib = self.identity_client.federation self.service_providers_mock = federation_lib.service_providers @@ -45,7 +45,7 @@ class TestServiceProviderCreate(TestServiceProvider): ) def setUp(self): - super(TestServiceProviderCreate, self).setUp() + super().setUp() copied_sp = copy.deepcopy(service_fakes.SERVICE_PROVIDER) resource = fakes.FakeResource(None, copied_sp, loaded=True) @@ -166,7 +166,7 @@ def test_create_service_provider_disabled(self): class TestServiceProviderDelete(TestServiceProvider): def setUp(self): - super(TestServiceProviderDelete, self).setUp() + super().setUp() # This is the return value for utils.find_resource() self.service_providers_mock.get.return_value = fakes.FakeResource( @@ -197,7 +197,7 @@ def test_delete_service_provider(self): class TestServiceProviderList(TestServiceProvider): def setUp(self): - super(TestServiceProviderList, self).setUp() + super().setUp() self.service_providers_mock.get.return_value = fakes.FakeResource( None, @@ -257,7 +257,7 @@ class TestServiceProviderSet(TestServiceProvider): ) def setUp(self): - super(TestServiceProviderSet, self).setUp() + super().setUp() self.cmd = service_provider.SetServiceProvider(self.app, None) def test_service_provider_disable(self): @@ -365,7 +365,7 @@ def prepare(self): class TestServiceProviderShow(TestServiceProvider): def setUp(self): - super(TestServiceProviderShow, self).setUp() + super().setUp() ret = fakes.FakeResource( None, diff --git a/openstackclient/tests/unit/identity/v3/test_token.py b/openstackclient/tests/unit/identity/v3/test_token.py index ba1a026c8..96375ea35 100644 --- a/openstackclient/tests/unit/identity/v3/test_token.py +++ b/openstackclient/tests/unit/identity/v3/test_token.py @@ -21,7 +21,7 @@ class TestToken(identity_fakes.TestIdentityv3): def setUp(self): - super(TestToken, self).setUp() + super().setUp() # Get a shortcut to the Auth Ref Mock self.ar_mock = mock.PropertyMock() @@ -30,7 +30,7 @@ def setUp(self): class TestTokenIssue(TestToken): def setUp(self): - super(TestTokenIssue, self).setUp() + super().setUp() self.cmd = token.IssueToken(self.app, None) @@ -118,7 +118,7 @@ class TestTokenRevoke(TestToken): TOKEN = 'fob' def setUp(self): - super(TestTokenRevoke, self).setUp() + super().setUp() self.tokens_mock = self.identity_client.tokens self.tokens_mock.reset_mock() self.tokens_mock.revoke_token.return_value = True diff --git a/openstackclient/tests/unit/identity/v3/test_trust.py b/openstackclient/tests/unit/identity/v3/test_trust.py index 6ca90721e..fb7ac9b0c 100644 --- a/openstackclient/tests/unit/identity/v3/test_trust.py +++ b/openstackclient/tests/unit/identity/v3/test_trust.py @@ -24,7 +24,7 @@ class TestTrust(identity_fakes.TestIdentityv3): def setUp(self): - super(TestTrust, self).setUp() + super().setUp() self.trusts_mock = self.identity_client.trusts self.trusts_mock.reset_mock() @@ -38,7 +38,7 @@ def setUp(self): class TestTrustCreate(TestTrust): def setUp(self): - super(TestTrustCreate, self).setUp() + super().setUp() self.projects_mock.get.return_value = fakes.FakeResource( None, @@ -127,7 +127,7 @@ def test_trust_create_basic(self): class TestTrustDelete(TestTrust): def setUp(self): - super(TestTrustDelete, self).setUp() + super().setUp() # This is the return value for utils.find_resource() self.trusts_mock.get.return_value = fakes.FakeResource( @@ -186,7 +186,7 @@ def test_delete_multi_trusts_with_exception(self, find_mock): class TestTrustList(TestTrust): def setUp(self): - super(TestTrustList, self).setUp() + super().setUp() self.trusts_mock.list.return_value = [ fakes.FakeResource( @@ -363,7 +363,7 @@ def test_trust_list_trustor(self): class TestTrustShow(TestTrust): def setUp(self): - super(TestTrustShow, self).setUp() + super().setUp() self.trusts_mock.get.return_value = fakes.FakeResource( None, diff --git a/openstackclient/tests/unit/identity/v3/test_unscoped_saml.py b/openstackclient/tests/unit/identity/v3/test_unscoped_saml.py index 882dd0862..40b199101 100644 --- a/openstackclient/tests/unit/identity/v3/test_unscoped_saml.py +++ b/openstackclient/tests/unit/identity/v3/test_unscoped_saml.py @@ -19,7 +19,7 @@ class TestUnscopedSAML(identity_fakes.TestFederatedIdentity): def setUp(self): - super(TestUnscopedSAML, self).setUp() + super().setUp() federation_lib = self.identity_client.federation self.projects_mock = federation_lib.projects @@ -30,7 +30,7 @@ def setUp(self): class TestDomainList(TestUnscopedSAML): def setUp(self): - super(TestDomainList, self).setUp() + super().setUp() self.domains_mock.list.return_value = [ fakes.FakeResource( @@ -70,7 +70,7 @@ def test_accessible_domains_list(self): class TestProjectList(TestUnscopedSAML): def setUp(self): - super(TestProjectList, self).setUp() + super().setUp() self.projects_mock.list.return_value = [ fakes.FakeResource( diff --git a/openstackclient/tests/unit/identity/v3/test_user.py b/openstackclient/tests/unit/identity/v3/test_user.py index 63d847191..19c1a6dcc 100644 --- a/openstackclient/tests/unit/identity/v3/test_user.py +++ b/openstackclient/tests/unit/identity/v3/test_user.py @@ -918,7 +918,7 @@ class TestUserList(identity_fakes.TestIdentityv3): ) def setUp(self): - super(TestUserList, self).setUp() + super().setUp() self.identity_sdk_client.find_user.return_value = self.user self.identity_sdk_client.users.return_value = [self.user] @@ -1088,7 +1088,7 @@ class TestUserSet(identity_fakes.TestIdentityv3): ) def setUp(self): - super(TestUserSet, self).setUp() + super().setUp() self.identity_sdk_client.find_project.return_value = self.project self.identity_sdk_client.find_user.return_value = self.user @@ -1731,7 +1731,7 @@ def test_user_set_with_multiple_options(self): class TestUserSetPassword(identity_fakes.TestIdentityv3): def setUp(self): - super(TestUserSetPassword, self).setUp() + super().setUp() self.cmd = user.SetPasswordUser(self.app, None) @staticmethod @@ -1803,7 +1803,7 @@ class TestUserShow(identity_fakes.TestIdentityv3): user = sdk_fakes.generate_fake_resource(_user.User) def setUp(self): - super(TestUserShow, self).setUp() + super().setUp() self.identity_sdk_client.find_user.return_value = self.user diff --git a/openstackclient/tests/unit/image/v1/test_image.py b/openstackclient/tests/unit/image/v1/test_image.py index bf62d10c2..971e969c7 100644 --- a/openstackclient/tests/unit/image/v1/test_image.py +++ b/openstackclient/tests/unit/image/v1/test_image.py @@ -52,7 +52,7 @@ class TestImageCreate(image_fakes.TestImagev1): ) def setUp(self): - super(TestImageCreate, self).setUp() + super().setUp() self.image_client.create_image = mock.Mock(return_value=self.new_image) self.image_client.find_image = mock.Mock(return_value=self.new_image) @@ -145,7 +145,7 @@ def test_image_reserve_options(self, raw_input): self.assertEqual(self.columns, columns) self.assertCountEqual(self.data, data) - @mock.patch('openstackclient.image.v1.image.io.open', name='Open') + @mock.patch('openstackclient.image.v1.image.open', name='Open') def test_image_create_file(self, mock_open): mock_file = mock.Mock(name='File') mock_open.return_value = mock_file @@ -209,7 +209,7 @@ class TestImageDelete(image_fakes.TestImagev1): _image = image_fakes.create_one_image() def setUp(self): - super(TestImageDelete, self).setUp() + super().setUp() # This is the return value for utils.find_resource() self.image_client.find_image = mock.Mock(return_value=self._image) @@ -259,7 +259,7 @@ class TestImageList(image_fakes.TestImagev1): image_info = copy.deepcopy(info) def setUp(self): - super(TestImageList, self).setUp() + super().setUp() self.image_client.images = mock.Mock() self.image_client.images.side_effect = [ @@ -438,7 +438,7 @@ class TestImageSet(image_fakes.TestImagev1): _image = image_fakes.create_one_image() def setUp(self): - super(TestImageSet, self).setUp() + super().setUp() # This is the return value for utils.find_resource() self.image_client.find_image = mock.Mock(return_value=self._image) @@ -710,7 +710,7 @@ class TestImageShow(image_fakes.TestImagev1): ) def setUp(self): - super(TestImageShow, self).setUp() + super().setUp() self.image_client.find_image = mock.Mock(return_value=self._image) diff --git a/openstackclient/tests/unit/integ/base.py b/openstackclient/tests/unit/integ/base.py index 5bef20b4c..cecf122b2 100644 --- a/openstackclient/tests/unit/integ/base.py +++ b/openstackclient/tests/unit/integ/base.py @@ -119,6 +119,6 @@ def make_v3_token(req_mock): class TestInteg(utils.TestCase): def setUp(self): - super(TestInteg, self).setUp() + super().setUp() self.requests_mock = self.useFixture(fixture.Fixture()) diff --git a/openstackclient/tests/unit/integ/cli/test_project.py b/openstackclient/tests/unit/integ/cli/test_project.py index abea0bf43..b536a764d 100644 --- a/openstackclient/tests/unit/integ/cli/test_project.py +++ b/openstackclient/tests/unit/integ/cli/test_project.py @@ -21,7 +21,7 @@ class TestIntegV2ProjectID(test_base.TestInteg): def setUp(self): - super(TestIntegV2ProjectID, self).setUp() + super().setUp() env = { "OS_AUTH_URL": test_base.V2_AUTH_URL, "OS_PROJECT_ID": test_shell.DEFAULT_PROJECT_ID, @@ -78,7 +78,7 @@ def test_project_id_arg(self): class TestIntegV2ProjectName(test_base.TestInteg): def setUp(self): - super(TestIntegV2ProjectName, self).setUp() + super().setUp() env = { "OS_AUTH_URL": test_base.V2_AUTH_URL, "OS_PROJECT_NAME": test_shell.DEFAULT_PROJECT_NAME, @@ -135,7 +135,7 @@ def test_project_name_arg(self): class TestIntegV3ProjectID(test_base.TestInteg): def setUp(self): - super(TestIntegV3ProjectID, self).setUp() + super().setUp() env = { "OS_AUTH_URL": test_base.V3_AUTH_URL, "OS_PROJECT_ID": test_shell.DEFAULT_PROJECT_NAME, @@ -190,7 +190,7 @@ def test_project_id_arg(self): class TestIntegV3ProjectName(test_base.TestInteg): def setUp(self): - super(TestIntegV3ProjectName, self).setUp() + super().setUp() env = { "OS_AUTH_URL": test_base.V3_AUTH_URL, "OS_PROJECT_NAME": test_shell.DEFAULT_PROJECT_NAME, diff --git a/openstackclient/tests/unit/integ/cli/test_shell.py b/openstackclient/tests/unit/integ/cli/test_shell.py index 6951c2afc..0a3a8ad43 100644 --- a/openstackclient/tests/unit/integ/cli/test_shell.py +++ b/openstackclient/tests/unit/integ/cli/test_shell.py @@ -23,7 +23,7 @@ class TestIntegShellCliNoAuth(test_base.TestInteg): def setUp(self): - super(TestIntegShellCliNoAuth, self).setUp() + super().setUp() env = {} self.useFixture(osc_lib_utils.EnvFixture(copy.deepcopy(env))) @@ -67,7 +67,7 @@ def test_shell_args_cacert_insecure(self): class TestIntegShellCliV2(test_base.TestInteg): def setUp(self): - super(TestIntegShellCliV2, self).setUp() + super().setUp() env = { "OS_AUTH_URL": test_base.V2_AUTH_URL, "OS_PROJECT_NAME": test_shell.DEFAULT_PROJECT_NAME, @@ -154,7 +154,7 @@ def test_shell_args_cacert_insecure(self): class TestIntegShellCliV2Ignore(test_base.TestInteg): def setUp(self): - super(TestIntegShellCliV2Ignore, self).setUp() + super().setUp() env = { "OS_AUTH_URL": test_base.V2_AUTH_URL, "OS_PROJECT_NAME": test_shell.DEFAULT_PROJECT_NAME, @@ -200,7 +200,7 @@ def test_shell_args_ignore_v3(self): class TestIntegShellCliV3(test_base.TestInteg): def setUp(self): - super(TestIntegShellCliV3, self).setUp() + super().setUp() env = { "OS_AUTH_URL": test_base.V3_AUTH_URL, "OS_PROJECT_DOMAIN_ID": test_shell.DEFAULT_PROJECT_DOMAIN_ID, @@ -290,7 +290,7 @@ def test_shell_args_cacert_insecure(self): class TestIntegShellCliV3Prompt(test_base.TestInteg): def setUp(self): - super(TestIntegShellCliV3Prompt, self).setUp() + super().setUp() env = { "OS_AUTH_URL": test_base.V3_AUTH_URL, "OS_PROJECT_DOMAIN_ID": test_shell.DEFAULT_PROJECT_DOMAIN_ID, @@ -339,7 +339,7 @@ class TestIntegShellCliPrecedence(test_base.TestInteg): """ def setUp(self): - super(TestIntegShellCliPrecedence, self).setUp() + super().setUp() env = { "OS_AUTH_URL": test_base.V3_AUTH_URL, "OS_PROJECT_DOMAIN_ID": test_shell.DEFAULT_PROJECT_DOMAIN_ID, @@ -412,7 +412,7 @@ class TestIntegShellCliPrecedenceOCC(test_base.TestInteg): """ def setUp(self): - super(TestIntegShellCliPrecedenceOCC, self).setUp() + super().setUp() env = { "OS_CLOUD": "megacloud", "OS_AUTH_URL": test_base.V3_AUTH_URL, diff --git a/openstackclient/tests/unit/network/test_common.py b/openstackclient/tests/unit/network/test_common.py index 6bdbadef7..c1ad9b28d 100644 --- a/openstackclient/tests/unit/network/test_common.py +++ b/openstackclient/tests/unit/network/test_common.py @@ -102,9 +102,7 @@ class FakeCreateNeutronCommandWithExtraArgs( common.NeutronCommandWithExtraArgs ): def get_parser(self, prog_name): - parser = super(FakeCreateNeutronCommandWithExtraArgs, self).get_parser( - prog_name - ) + parser = super().get_parser(prog_name) parser.add_argument( '--known-attribute', ) @@ -164,19 +162,19 @@ def test_take_action_compute(self): class TestNetworkAndComputeCommand(TestNetworkAndCompute): def setUp(self): - super(TestNetworkAndComputeCommand, self).setUp() + super().setUp() self.cmd = FakeNetworkAndComputeCommand(self.app, None) class TestNetworkAndComputeLister(TestNetworkAndCompute): def setUp(self): - super(TestNetworkAndComputeLister, self).setUp() + super().setUp() self.cmd = FakeNetworkAndComputeLister(self.app, None) class TestNetworkAndComputeShowOne(TestNetworkAndCompute): def setUp(self): - super(TestNetworkAndComputeShowOne, self).setUp() + super().setUp() self.cmd = FakeNetworkAndComputeShowOne(self.app, None) def test_take_action_with_http_exception(self): @@ -202,7 +200,7 @@ def test_take_action_with_http_exception(self): class TestNeutronCommandWithExtraArgs(utils.TestCommand): def setUp(self): - super(TestNeutronCommandWithExtraArgs, self).setUp() + super().setUp() # Create client mocks. Note that we intentionally do not use specced # mocks since we want to test fake methods. diff --git a/openstackclient/tests/unit/network/v2/fakes.py b/openstackclient/tests/unit/network/v2/fakes.py index 538878e77..4874bf856 100644 --- a/openstackclient/tests/unit/network/v2/fakes.py +++ b/openstackclient/tests/unit/network/v2/fakes.py @@ -133,7 +133,7 @@ def create_one_extension(attrs=None): return extension -class FakeNetworkQosPolicy(object): +class FakeNetworkQosPolicy: """Fake one or more QoS policies.""" @staticmethod @@ -213,7 +213,7 @@ def get_qos_policies(qos_policies=None, count=2): return mock.Mock(side_effect=qos_policies) -class FakeNetworkSecGroup(object): +class FakeNetworkSecGroup: """Fake one security group.""" @staticmethod @@ -244,7 +244,7 @@ def create_one_security_group(attrs=None): return security_group -class FakeNetworkQosRule(object): +class FakeNetworkQosRule: """Fake one or more Network QoS rules.""" @staticmethod @@ -325,7 +325,7 @@ def get_qos_rules(qos_rules=None, count=2): return mock.Mock(side_effect=qos_rules) -class FakeNetworkQosRuleType(object): +class FakeNetworkQosRuleType: """Fake one or more Network QoS rule types.""" @staticmethod @@ -372,7 +372,7 @@ def create_qos_rule_types(attrs=None, count=2): return qos_rule_types -class FakeRouter(object): +class FakeRouter: """Fake one or more routers.""" @staticmethod @@ -456,7 +456,7 @@ def get_routers(routers=None, count=2): return mock.Mock(side_effect=routers) -class FakeSecurityGroup(object): +class FakeSecurityGroup: """Fake one or more security groups.""" @staticmethod @@ -530,7 +530,7 @@ def get_security_groups(security_groups=None, count=2): return mock.Mock(side_effect=security_groups) -class FakeSecurityGroupRule(object): +class FakeSecurityGroupRule: """Fake one or more security group rules.""" @staticmethod @@ -612,7 +612,7 @@ def get_security_group_rules(security_group_rules=None, count=2): return mock.Mock(side_effect=security_group_rules) -class FakeSubnet(object): +class FakeSubnet: """Fake one or more subnets.""" @staticmethod @@ -700,7 +700,7 @@ def get_subnets(subnets=None, count=2): return mock.Mock(side_effect=subnets) -class FakeFloatingIP(object): +class FakeFloatingIP: """Fake one or more floating ip.""" @staticmethod @@ -777,7 +777,7 @@ def get_floating_ips(floating_ips=None, count=2): return mock.Mock(side_effect=floating_ips) -class FakeNetworkMeter(object): +class FakeNetworkMeter: """Fake network meter""" @staticmethod @@ -819,7 +819,7 @@ def get_meter(meter=None, count=2): return mock.Mock(side_effect=meter) -class FakeNetworkMeterRule(object): +class FakeNetworkMeterRule: """Fake metering rule""" @staticmethod @@ -864,7 +864,7 @@ def get_meter_rule(meter_rule=None, count=2): return mock.Mock(side_effect=meter_rule) -class FakeSubnetPool(object): +class FakeSubnetPool: """Fake one or more subnet pools.""" @staticmethod @@ -951,7 +951,7 @@ def get_subnet_pools(subnet_pools=None, count=2): return mock.Mock(side_effect=subnet_pools) -class FakeNetworkServiceProvider(object): +class FakeNetworkServiceProvider: """Fake Network Service Providers""" @staticmethod @@ -989,7 +989,7 @@ def create_network_service_providers(attrs=None, count=2): return service_providers -class FakeQuota(object): +class FakeQuota: """Fake quota""" @staticmethod @@ -1065,7 +1065,7 @@ def create_one_net_detailed_quota(attrs=None): return quota -class FakeFloatingIPPortForwarding(object): +class FakeFloatingIPPortForwarding: """Fake one or more Port forwarding""" @staticmethod @@ -1169,7 +1169,7 @@ def get_port_forwardings(port_forwardings=None, count=2, use_range=False): return mock.Mock(side_effect=port_forwardings) -class FakeL3ConntrackHelper(object): +class FakeL3ConntrackHelper: """Fake one or more L3 conntrack helper""" @staticmethod diff --git a/openstackclient/tests/unit/network/v2/test_address_group.py b/openstackclient/tests/unit/network/v2/test_address_group.py index f2e8fb0d5..411d19923 100644 --- a/openstackclient/tests/unit/network/v2/test_address_group.py +++ b/openstackclient/tests/unit/network/v2/test_address_group.py @@ -24,7 +24,7 @@ class TestAddressGroup(network_fakes.TestNetworkV2): def setUp(self): - super(TestAddressGroup, self).setUp() + super().setUp() # Get a shortcut to the ProjectManager Mock self.projects_mock = self.identity_client.projects @@ -57,7 +57,7 @@ class TestCreateAddressGroup(TestAddressGroup): ) def setUp(self): - super(TestCreateAddressGroup, self).setUp() + super().setUp() self.network_client.create_address_group = mock.Mock( return_value=self.new_address_group ) @@ -144,7 +144,7 @@ class TestDeleteAddressGroup(TestAddressGroup): _address_groups = network_fakes.create_address_groups(count=2) def setUp(self): - super(TestDeleteAddressGroup, self).setUp() + super().setUp() self.network_client.delete_address_group = mock.Mock(return_value=None) self.network_client.find_address_group = ( network_fakes.get_address_groups( @@ -250,7 +250,7 @@ class TestListAddressGroup(TestAddressGroup): ) def setUp(self): - super(TestListAddressGroup, self).setUp() + super().setUp() self.network_client.address_groups = mock.Mock( return_value=self.address_groups ) @@ -332,7 +332,7 @@ class TestSetAddressGroup(TestAddressGroup): _address_group = network_fakes.create_one_address_group() def setUp(self): - super(TestSetAddressGroup, self).setUp() + super().setUp() self.network_client.update_address_group = mock.Mock(return_value=None) self.network_client.find_address_group = mock.Mock( return_value=self._address_group @@ -441,7 +441,7 @@ class TestShowAddressGroup(TestAddressGroup): ) def setUp(self): - super(TestShowAddressGroup, self).setUp() + super().setUp() self.network_client.find_address_group = mock.Mock( return_value=self._address_group ) @@ -485,7 +485,7 @@ class TestUnsetAddressGroup(TestAddressGroup): _address_group = network_fakes.create_one_address_group() def setUp(self): - super(TestUnsetAddressGroup, self).setUp() + super().setUp() self.network_client.find_address_group = mock.Mock( return_value=self._address_group ) diff --git a/openstackclient/tests/unit/network/v2/test_address_scope.py b/openstackclient/tests/unit/network/v2/test_address_scope.py index 308ee2343..c3eb83d06 100644 --- a/openstackclient/tests/unit/network/v2/test_address_scope.py +++ b/openstackclient/tests/unit/network/v2/test_address_scope.py @@ -24,7 +24,7 @@ class TestAddressScope(network_fakes.TestNetworkV2): def setUp(self): - super(TestAddressScope, self).setUp() + super().setUp() # Get a shortcut to the ProjectManager Mock self.projects_mock = self.identity_client.projects @@ -51,7 +51,7 @@ class TestCreateAddressScope(TestAddressScope): ) def setUp(self): - super(TestCreateAddressScope, self).setUp() + super().setUp() self.network_client.create_address_scope = mock.Mock( return_value=self.new_address_scope ) @@ -159,7 +159,7 @@ class TestDeleteAddressScope(TestAddressScope): _address_scopes = network_fakes.create_address_scopes(count=2) def setUp(self): - super(TestDeleteAddressScope, self).setUp() + super().setUp() self.network_client.delete_address_scope = mock.Mock(return_value=None) self.network_client.find_address_scope = ( network_fakes.get_address_scopes( @@ -266,7 +266,7 @@ class TestListAddressScope(TestAddressScope): ) def setUp(self): - super(TestListAddressScope, self).setUp() + super().setUp() self.network_client.address_scopes = mock.Mock( return_value=self.address_scopes ) @@ -397,7 +397,7 @@ class TestSetAddressScope(TestAddressScope): _address_scope = network_fakes.create_one_address_scope() def setUp(self): - super(TestSetAddressScope, self).setUp() + super().setUp() self.network_client.update_address_scope = mock.Mock(return_value=None) self.network_client.find_address_scope = mock.Mock( return_value=self._address_scope @@ -487,7 +487,7 @@ class TestShowAddressScope(TestAddressScope): ) def setUp(self): - super(TestShowAddressScope, self).setUp() + super().setUp() self.network_client.find_address_scope = mock.Mock( return_value=self._address_scope ) diff --git a/openstackclient/tests/unit/network/v2/test_default_security_group_rule.py b/openstackclient/tests/unit/network/v2/test_default_security_group_rule.py index 1d8e22c13..f1e9e28cc 100644 --- a/openstackclient/tests/unit/network/v2/test_default_security_group_rule.py +++ b/openstackclient/tests/unit/network/v2/test_default_security_group_rule.py @@ -30,7 +30,7 @@ class TestDefaultSecurityGroupRule(network_fakes.TestNetworkV2): def setUp(self): - super(TestDefaultSecurityGroupRule, self).setUp() + super().setUp() self.app.client_manager.sdk_connection = mock.Mock() self.app.client_manager.sdk_connection.network = mock.Mock( @@ -101,7 +101,7 @@ def _setup_default_security_group_rule(self, attrs=None): ) def setUp(self): - super(TestCreateDefaultSecurityGroupRule, self).setUp() + super().setUp() # Get the command object to test self.cmd = default_security_group_rule.CreateDefaultSecurityGroupRule( @@ -842,7 +842,7 @@ class TestDeleteDefaultSecurityGroupRule(TestDefaultSecurityGroupRule): ) def setUp(self): - super(TestDeleteDefaultSecurityGroupRule, self).setUp() + super().setUp() self.sdk_client.delete_default_security_group_rule.return_value = None @@ -977,7 +977,7 @@ class TestListDefaultSecurityGroupRule(TestDefaultSecurityGroupRule): ) def setUp(self): - super(TestListDefaultSecurityGroupRule, self).setUp() + super().setUp() self.sdk_client.default_security_group_rules.return_value = ( self._default_sg_rules @@ -1099,7 +1099,7 @@ class TestShowDefaultSecurityGroupRule(TestDefaultSecurityGroupRule): ) def setUp(self): - super(TestShowDefaultSecurityGroupRule, self).setUp() + super().setUp() self.sdk_client.find_default_security_group_rule.return_value = ( self._default_sg_rule diff --git a/openstackclient/tests/unit/network/v2/test_floating_ip_compute.py b/openstackclient/tests/unit/network/v2/test_floating_ip_compute.py index ed6ec12dc..b7ca58751 100644 --- a/openstackclient/tests/unit/network/v2/test_floating_ip_compute.py +++ b/openstackclient/tests/unit/network/v2/test_floating_ip_compute.py @@ -46,7 +46,7 @@ class TestCreateFloatingIPCompute(compute_fakes.TestComputev2): ) def setUp(self): - super(TestCreateFloatingIPCompute, self).setUp() + super().setUp() self.app.client_manager.network_endpoint_enabled = False @@ -90,7 +90,7 @@ class TestDeleteFloatingIPCompute(compute_fakes.TestComputev2): _floating_ips = compute_fakes.create_floating_ips(count=2) def setUp(self): - super(TestDeleteFloatingIPCompute, self).setUp() + super().setUp() self.app.client_manager.network_endpoint_enabled = False @@ -186,7 +186,7 @@ class TestListFloatingIPCompute(compute_fakes.TestComputev2): ) def setUp(self): - super(TestListFloatingIPCompute, self).setUp() + super().setUp() self.app.client_manager.network_endpoint_enabled = False @@ -228,7 +228,7 @@ class TestShowFloatingIPCompute(compute_fakes.TestComputev2): ) def setUp(self): - super(TestShowFloatingIPCompute, self).setUp() + super().setUp() self.app.client_manager.network_endpoint_enabled = False diff --git a/openstackclient/tests/unit/network/v2/test_floating_ip_network.py b/openstackclient/tests/unit/network/v2/test_floating_ip_network.py index 0cdd8f3ae..34ca21ecd 100644 --- a/openstackclient/tests/unit/network/v2/test_floating_ip_network.py +++ b/openstackclient/tests/unit/network/v2/test_floating_ip_network.py @@ -24,7 +24,7 @@ class TestFloatingIPNetwork(network_fakes.TestNetworkV2): def setUp(self): - super(TestFloatingIPNetwork, self).setUp() + super().setUp() # Get a shortcut to the ProjectManager Mock self.projects_mock = self.identity_client.projects @@ -81,7 +81,7 @@ class TestCreateFloatingIPNetwork(TestFloatingIPNetwork): ) def setUp(self): - super(TestCreateFloatingIPNetwork, self).setUp() + super().setUp() self.network_client.create_ip = mock.Mock( return_value=self.floating_ip @@ -301,7 +301,7 @@ class TestDeleteFloatingIPNetwork(TestFloatingIPNetwork): floating_ips = network_fakes.FakeFloatingIP.create_floating_ips(count=2) def setUp(self): - super(TestDeleteFloatingIPNetwork, self).setUp() + super().setUp() self.network_client.delete_ip = mock.Mock(return_value=None) @@ -467,7 +467,7 @@ class TestListFloatingIPNetwork(TestFloatingIPNetwork): ) def setUp(self): - super(TestListFloatingIPNetwork, self).setUp() + super().setUp() self.network_client.ips = mock.Mock(return_value=self.floating_ips) self.network_client.find_network = mock.Mock( @@ -742,7 +742,7 @@ class TestShowFloatingIPNetwork(TestFloatingIPNetwork): ) def setUp(self): - super(TestShowFloatingIPNetwork, self).setUp() + super().setUp() self.network_client.find_ip = mock.Mock(return_value=self.floating_ip) @@ -784,7 +784,7 @@ class TestSetFloatingIP(TestFloatingIPNetwork): ) def setUp(self): - super(TestSetFloatingIP, self).setUp() + super().setUp() self.network_client.find_ip = mock.Mock(return_value=self.floating_ip) self.network_client.find_port = mock.Mock(return_value=self.port) self.network_client.update_ip = mock.Mock(return_value=None) @@ -1035,7 +1035,7 @@ class TestUnsetFloatingIP(TestFloatingIPNetwork): ) def setUp(self): - super(TestUnsetFloatingIP, self).setUp() + super().setUp() self.network_client.find_ip = mock.Mock(return_value=self.floating_ip) self.network_client.update_ip = mock.Mock(return_value=None) self.network_client.set_tags = mock.Mock(return_value=None) diff --git a/openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py b/openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py index cc07d5e69..29084c15b 100644 --- a/openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py +++ b/openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py @@ -32,7 +32,7 @@ class TestListFloatingIPPoolCompute(compute_fakes.TestComputev2): data.append((pool['name'],)) def setUp(self): - super(TestListFloatingIPPoolCompute, self).setUp() + super().setUp() self.app.client_manager.network_endpoint_enabled = False diff --git a/openstackclient/tests/unit/network/v2/test_floating_ip_pool_network.py b/openstackclient/tests/unit/network/v2/test_floating_ip_pool_network.py index 5fe53e34d..fee8f4390 100644 --- a/openstackclient/tests/unit/network/v2/test_floating_ip_pool_network.py +++ b/openstackclient/tests/unit/network/v2/test_floating_ip_pool_network.py @@ -19,12 +19,12 @@ class TestFloatingIPPoolNetwork(network_fakes.TestNetworkV2): def setUp(self): - super(TestFloatingIPPoolNetwork, self).setUp() + super().setUp() class TestListFloatingIPPoolNetwork(TestFloatingIPPoolNetwork): def setUp(self): - super(TestListFloatingIPPoolNetwork, self).setUp() + super().setUp() # Get the command object to test self.cmd = floating_ip_pool.ListFloatingIPPool(self.app, None) diff --git a/openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py b/openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py index b4560f7b3..6c0e163ce 100644 --- a/openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py +++ b/openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py @@ -26,7 +26,7 @@ class TestFloatingIPPortForwarding(network_fakes.TestNetworkV2): def setUp(self): - super(TestFloatingIPPortForwarding, self).setUp() + super().setUp() self.floating_ip = ( network_fakes.FakeFloatingIP.create_one_floating_ip() @@ -38,7 +38,7 @@ def setUp(self): class TestCreateFloatingIPPortForwarding(TestFloatingIPPortForwarding): def setUp(self): - super(TestCreateFloatingIPPortForwarding, self).setUp() + super().setUp() self.new_port_forwarding = network_fakes.FakeFloatingIPPortForwarding.create_one_port_forwarding( # noqa: E501 attrs={ 'internal_port_id': self.port.id, @@ -342,7 +342,7 @@ def test_create_all_options(self): class TestDeleteFloatingIPPortForwarding(TestFloatingIPPortForwarding): def setUp(self): - super(TestDeleteFloatingIPPortForwarding, self).setUp() + super().setUp() self._port_forwarding = ( network_fakes.FakeFloatingIPPortForwarding.create_port_forwardings( count=2, @@ -465,7 +465,7 @@ class TestListFloatingIPPortForwarding(TestFloatingIPPortForwarding): ) def setUp(self): - super(TestListFloatingIPPortForwarding, self).setUp() + super().setUp() self.port_forwardings = ( network_fakes.FakeFloatingIPPortForwarding.create_port_forwardings( count=3, @@ -551,7 +551,7 @@ def test_port_forwarding_list_all_options(self): class TestSetFloatingIPPortForwarding(TestFloatingIPPortForwarding): # The Port Forwarding to set. def setUp(self): - super(TestSetFloatingIPPortForwarding, self).setUp() + super().setUp() self._port_forwarding = network_fakes.FakeFloatingIPPortForwarding.create_one_port_forwarding( # noqa: E501 attrs={ 'floatingip_id': self.floating_ip.id, @@ -672,7 +672,7 @@ class TestShowFloatingIPPortForwarding(TestFloatingIPPortForwarding): ) def setUp(self): - super(TestShowFloatingIPPortForwarding, self).setUp() + super().setUp() self._port_forwarding = network_fakes.FakeFloatingIPPortForwarding.create_one_port_forwarding( # noqa: E501 attrs={ 'floatingip_id': self.floating_ip.id, diff --git a/openstackclient/tests/unit/network/v2/test_ip_availability.py b/openstackclient/tests/unit/network/v2/test_ip_availability.py index 0175f3546..4224d1266 100644 --- a/openstackclient/tests/unit/network/v2/test_ip_availability.py +++ b/openstackclient/tests/unit/network/v2/test_ip_availability.py @@ -23,7 +23,7 @@ class TestIPAvailability(network_fakes.TestNetworkV2): def setUp(self): - super(TestIPAvailability, self).setUp() + super().setUp() # Get a shortcut to the ProjectManager Mock self.projects_mock = self.identity_client.projects @@ -52,7 +52,7 @@ class TestListIPAvailability(TestIPAvailability): ) def setUp(self): - super(TestListIPAvailability, self).setUp() + super().setUp() self.cmd = ip_availability.ListIPAvailability(self.app, None) self.network_client.network_ip_availabilities = mock.Mock( @@ -132,7 +132,7 @@ class TestShowIPAvailability(TestIPAvailability): ) def setUp(self): - super(TestShowIPAvailability, self).setUp() + super().setUp() self.network_client.find_network_ip_availability = mock.Mock( return_value=self._ip_availability diff --git a/openstackclient/tests/unit/network/v2/test_l3_conntrack_helper.py b/openstackclient/tests/unit/network/v2/test_l3_conntrack_helper.py index 1f3d34e69..c7aadf0bf 100644 --- a/openstackclient/tests/unit/network/v2/test_l3_conntrack_helper.py +++ b/openstackclient/tests/unit/network/v2/test_l3_conntrack_helper.py @@ -22,7 +22,7 @@ class TestConntrackHelper(network_fakes.TestNetworkV2): def setUp(self): - super(TestConntrackHelper, self).setUp() + super().setUp() self.router = network_fakes.FakeRouter.create_one_router() self.network_client.find_router = mock.Mock(return_value=self.router) @@ -30,7 +30,7 @@ def setUp(self): class TestCreateL3ConntrackHelper(TestConntrackHelper): def setUp(self): - super(TestCreateL3ConntrackHelper, self).setUp() + super().setUp() attrs = {'router_id': self.router.id} self.ct_helper = ( network_fakes.FakeL3ConntrackHelper.create_one_l3_conntrack_helper( @@ -112,7 +112,7 @@ def test_create_wrong_options(self): class TestDeleteL3ConntrackHelper(TestConntrackHelper): def setUp(self): - super(TestDeleteL3ConntrackHelper, self).setUp() + super().setUp() attrs = {'router_id': self.router.id} self.ct_helper = ( network_fakes.FakeL3ConntrackHelper.create_one_l3_conntrack_helper( @@ -156,7 +156,7 @@ def test_delete_error(self): class TestListL3ConntrackHelper(TestConntrackHelper): def setUp(self): - super(TestListL3ConntrackHelper, self).setUp() + super().setUp() attrs = {'router_id': self.router.id} ct_helpers = ( network_fakes.FakeL3ConntrackHelper.create_l3_conntrack_helpers( @@ -209,7 +209,7 @@ def test_conntrack_helpers_list(self): class TestSetL3ConntrackHelper(TestConntrackHelper): def setUp(self): - super(TestSetL3ConntrackHelper, self).setUp() + super().setUp() attrs = {'router_id': self.router.id} self.ct_helper = ( network_fakes.FakeL3ConntrackHelper.create_one_l3_conntrack_helper( @@ -265,7 +265,7 @@ def test_set_port(self): class TestShowL3ConntrackHelper(TestConntrackHelper): def setUp(self): - super(TestShowL3ConntrackHelper, self).setUp() + super().setUp() attrs = {'router_id': self.router.id} self.ct_helper = ( network_fakes.FakeL3ConntrackHelper.create_one_l3_conntrack_helper( diff --git a/openstackclient/tests/unit/network/v2/test_ndp_proxy.py b/openstackclient/tests/unit/network/v2/test_ndp_proxy.py index ef7549a00..bcbc0ae7d 100644 --- a/openstackclient/tests/unit/network/v2/test_ndp_proxy.py +++ b/openstackclient/tests/unit/network/v2/test_ndp_proxy.py @@ -24,7 +24,7 @@ class TestNDPProxy(network_fakes.TestNetworkV2): def setUp(self): - super(TestNDPProxy, self).setUp() + super().setUp() # Get a shortcut to the ProjectManager Mock self.projects_mock = self.identity_client.projects # Get a shortcut to the DomainManager Mock @@ -40,7 +40,7 @@ def setUp(self): class TestCreateNDPProxy(TestNDPProxy): def setUp(self): - super(TestCreateNDPProxy, self).setUp() + super().setUp() attrs = {'router_id': self.router.id, 'port_id': self.port.id} self.ndp_proxy = network_fakes.create_one_ndp_proxy(attrs) self.columns = ( @@ -125,7 +125,7 @@ def test_create_all_options(self): class TestDeleteNDPProxy(TestNDPProxy): def setUp(self): - super(TestDeleteNDPProxy, self).setUp() + super().setUp() attrs = {'router_id': self.router.id, 'port_id': self.port.id} self.ndp_proxies = network_fakes.create_ndp_proxies(attrs) self.ndp_proxy = self.ndp_proxies[0] @@ -183,7 +183,7 @@ def test_multi_ndp_proxies_delete(self): class TestListNDPProxy(TestNDPProxy): def setUp(self): - super(TestListNDPProxy, self).setUp() + super().setUp() attrs = {'router_id': self.router.id, 'port_id': self.port.id} ndp_proxies = network_fakes.create_ndp_proxies(attrs, count=3) self.columns = ( @@ -339,7 +339,7 @@ def test_ndp_proxy_list_project_domain(self): class TestSetNDPProxy(TestNDPProxy): def setUp(self): - super(TestSetNDPProxy, self).setUp() + super().setUp() attrs = {'router_id': self.router.id, 'port_id': self.port.id} self.ndp_proxy = network_fakes.create_one_ndp_proxy(attrs) self.network_client.update_ndp_proxy = mock.Mock(return_value=None) @@ -407,7 +407,7 @@ def test_set_description(self): class TestShowNDPProxy(TestNDPProxy): def setUp(self): - super(TestShowNDPProxy, self).setUp() + super().setUp() attrs = {'router_id': self.router.id, 'port_id': self.port.id} self.ndp_proxy = network_fakes.create_one_ndp_proxy(attrs) diff --git a/openstackclient/tests/unit/network/v2/test_network.py b/openstackclient/tests/unit/network/v2/test_network.py index fd67da7ba..33fe5be3a 100644 --- a/openstackclient/tests/unit/network/v2/test_network.py +++ b/openstackclient/tests/unit/network/v2/test_network.py @@ -29,7 +29,7 @@ # class TestNetwork(network_fakes.TestNetworkV2): def setUp(self): - super(TestNetwork, self).setUp() + super().setUp() # Get a shortcut to the ProjectManager Mock self.projects_mock = self.identity_client.projects @@ -112,7 +112,7 @@ class TestCreateNetworkIdentityV3(TestNetwork): ) def setUp(self): - super(TestCreateNetworkIdentityV3, self).setUp() + super().setUp() self.network_client.create_network = mock.Mock( return_value=self._network @@ -381,7 +381,7 @@ class TestCreateNetworkIdentityV2( ) def setUp(self): - super(TestCreateNetworkIdentityV2, self).setUp() + super().setUp() self.network_client.create_network = mock.Mock( return_value=self._network @@ -453,7 +453,7 @@ def test_create_with_domain_identityv2(self): class TestDeleteNetwork(TestNetwork): def setUp(self): - super(TestDeleteNetwork, self).setUp() + super().setUp() # The networks to delete self._networks = network_fakes.create_networks(count=3) @@ -591,7 +591,7 @@ class TestListNetwork(TestNetwork): ) def setUp(self): - super(TestListNetwork, self).setUp() + super().setUp() # Get the command object to test self.cmd = network.ListNetwork(self.app, None) @@ -949,7 +949,7 @@ class TestSetNetwork(TestNetwork): ) def setUp(self): - super(TestSetNetwork, self).setUp() + super().setUp() self.network_client.update_network = mock.Mock(return_value=None) self.network_client.set_tags = mock.Mock(return_value=None) @@ -1198,7 +1198,7 @@ class TestShowNetwork(TestNetwork): ) def setUp(self): - super(TestShowNetwork, self).setUp() + super().setUp() self.network_client.find_network = mock.Mock( return_value=self._network @@ -1246,7 +1246,7 @@ class TestUnsetNetwork(TestNetwork): ) def setUp(self): - super(TestUnsetNetwork, self).setUp() + super().setUp() self.network_client.update_network = mock.Mock(return_value=None) self.network_client.set_tags = mock.Mock(return_value=None) diff --git a/openstackclient/tests/unit/network/v2/test_network_agent.py b/openstackclient/tests/unit/network/v2/test_network_agent.py index 97748eeaf..15bacae58 100644 --- a/openstackclient/tests/unit/network/v2/test_network_agent.py +++ b/openstackclient/tests/unit/network/v2/test_network_agent.py @@ -24,7 +24,7 @@ class TestNetworkAgent(network_fakes.TestNetworkV2): def setUp(self): - super(TestNetworkAgent, self).setUp() + super().setUp() class TestAddNetworkToAgent(TestNetworkAgent): @@ -32,7 +32,7 @@ class TestAddNetworkToAgent(TestNetworkAgent): agent = network_fakes.create_one_network_agent() def setUp(self): - super(TestAddNetworkToAgent, self).setUp() + super().setUp() self.network_client.get_agent = mock.Mock(return_value=self.agent) self.network_client.find_network = mock.Mock(return_value=self.net) @@ -74,7 +74,7 @@ class TestAddRouterAgent(TestNetworkAgent): _agent = network_fakes.create_one_network_agent() def setUp(self): - super(TestAddRouterAgent, self).setUp() + super().setUp() self.network_client.get_agent = mock.Mock(return_value=self._agent) self.network_client.find_router = mock.Mock(return_value=self._router) @@ -119,7 +119,7 @@ class TestDeleteNetworkAgent(TestNetworkAgent): network_agents = network_fakes.create_network_agents(count=2) def setUp(self): - super(TestDeleteNetworkAgent, self).setUp() + super().setUp() self.network_client.delete_agent = mock.Mock(return_value=None) # Get the command object to test @@ -218,7 +218,7 @@ class TestListNetworkAgent(TestNetworkAgent): ) def setUp(self): - super(TestListNetworkAgent, self).setUp() + super().setUp() self.network_client.agents = mock.Mock( return_value=self.network_agents ) @@ -369,7 +369,7 @@ class TestRemoveNetworkFromAgent(TestNetworkAgent): agent = network_fakes.create_one_network_agent() def setUp(self): - super(TestRemoveNetworkFromAgent, self).setUp() + super().setUp() self.network_client.get_agent = mock.Mock(return_value=self.agent) self.network_client.find_network = mock.Mock(return_value=self.net) @@ -426,7 +426,7 @@ class TestRemoveRouterAgent(TestNetworkAgent): _agent = network_fakes.create_one_network_agent() def setUp(self): - super(TestRemoveRouterAgent, self).setUp() + super().setUp() self.network_client.get_agent = mock.Mock(return_value=self._agent) self.network_client.find_router = mock.Mock(return_value=self._router) @@ -471,7 +471,7 @@ class TestSetNetworkAgent(TestNetworkAgent): _network_agent = network_fakes.create_one_network_agent() def setUp(self): - super(TestSetNetworkAgent, self).setUp() + super().setUp() self.network_client.update_agent = mock.Mock(return_value=None) self.network_client.get_agent = mock.Mock( return_value=self._network_agent @@ -587,7 +587,7 @@ class TestShowNetworkAgent(TestNetworkAgent): ) def setUp(self): - super(TestShowNetworkAgent, self).setUp() + super().setUp() self.network_client.get_agent = mock.Mock( return_value=self._network_agent ) diff --git a/openstackclient/tests/unit/network/v2/test_network_auto_allocated_topology.py b/openstackclient/tests/unit/network/v2/test_network_auto_allocated_topology.py index 76305869b..20c645bd4 100644 --- a/openstackclient/tests/unit/network/v2/test_network_auto_allocated_topology.py +++ b/openstackclient/tests/unit/network/v2/test_network_auto_allocated_topology.py @@ -22,7 +22,7 @@ class TestAutoAllocatedTopology(network_fakes.TestNetworkV2): def setUp(self): - super(TestAutoAllocatedTopology, self).setUp() + super().setUp() self.projects_mock = self.identity_client.projects @@ -45,7 +45,7 @@ class TestCreateAutoAllocatedTopology(TestAutoAllocatedTopology): ) def setUp(self): - super(TestCreateAutoAllocatedTopology, self).setUp() + super().setUp() self.cmd = network_auto_allocated_topology.CreateAutoAllocatedTopology( self.app, None @@ -150,7 +150,7 @@ class TestValidateAutoAllocatedTopology(TestAutoAllocatedTopology): ) def setUp(self): - super(TestValidateAutoAllocatedTopology, self).setUp() + super().setUp() self.cmd = network_auto_allocated_topology.CreateAutoAllocatedTopology( self.app, None @@ -223,7 +223,7 @@ class TestDeleteAutoAllocatedTopology(TestAutoAllocatedTopology): ) def setUp(self): - super(TestDeleteAutoAllocatedTopology, self).setUp() + super().setUp() self.cmd = network_auto_allocated_topology.DeleteAutoAllocatedTopology( self.app, None diff --git a/openstackclient/tests/unit/network/v2/test_network_compute.py b/openstackclient/tests/unit/network/v2/test_network_compute.py index ebe37243a..651bf72a5 100644 --- a/openstackclient/tests/unit/network/v2/test_network_compute.py +++ b/openstackclient/tests/unit/network/v2/test_network_compute.py @@ -101,7 +101,7 @@ class TestCreateNetworkCompute(compute_fakes.TestComputev2): ) def setUp(self): - super(TestCreateNetworkCompute, self).setUp() + super().setUp() self.app.client_manager.network_endpoint_enabled = False @@ -168,7 +168,7 @@ def test_network_create_default_options(self, net_mock): @mock.patch('openstackclient.api.compute_v2.APIv2.network_delete') class TestDeleteNetworkCompute(compute_fakes.TestComputev2): def setUp(self): - super(TestDeleteNetworkCompute, self).setUp() + super().setUp() self.app.client_manager.network_endpoint_enabled = False @@ -267,7 +267,7 @@ class TestListNetworkCompute(compute_fakes.TestComputev2): ) def setUp(self): - super(TestListNetworkCompute, self).setUp() + super().setUp() self.app.client_manager.network_endpoint_enabled = False @@ -366,7 +366,7 @@ class TestShowNetworkCompute(compute_fakes.TestComputev2): ) def setUp(self): - super(TestShowNetworkCompute, self).setUp() + super().setUp() self.app.client_manager.network_endpoint_enabled = False diff --git a/openstackclient/tests/unit/network/v2/test_network_flavor.py b/openstackclient/tests/unit/network/v2/test_network_flavor.py index a7973dd54..cfbe1f7b0 100644 --- a/openstackclient/tests/unit/network/v2/test_network_flavor.py +++ b/openstackclient/tests/unit/network/v2/test_network_flavor.py @@ -26,7 +26,7 @@ class TestNetworkFlavor(network_fakes.TestNetworkV2): def setUp(self): - super(TestNetworkFlavor, self).setUp() + super().setUp() # Get a shortcut to the ProjectManager Mock self.projects_mock = self.identity_client.projects @@ -39,7 +39,7 @@ class TestAddNetworkFlavorToProfile(TestNetworkFlavor): service_profile = network_fakes.create_one_service_profile() def setUp(self): - super(TestAddNetworkFlavorToProfile, self).setUp() + super().setUp() self.network_client.find_flavor = mock.Mock( return_value=self.network_flavor @@ -101,7 +101,7 @@ class TestCreateNetworkFlavor(TestNetworkFlavor): ) def setUp(self): - super(TestCreateNetworkFlavor, self).setUp() + super().setUp() self.network_client.create_flavor = mock.Mock( return_value=self.new_network_flavor ) @@ -217,7 +217,7 @@ class TestDeleteNetworkFlavor(TestNetworkFlavor): _network_flavors = network_fakes.create_flavor(count=2) def setUp(self): - super(TestDeleteNetworkFlavor, self).setUp() + super().setUp() self.network_client.delete_flavor = mock.Mock(return_value=None) self.network_client.find_flavor = network_fakes.get_flavor( network_flavors=self._network_flavors @@ -322,7 +322,7 @@ class TestListNetworkFlavor(TestNetworkFlavor): ) def setUp(self): - super(TestListNetworkFlavor, self).setUp() + super().setUp() self.network_client.flavors = mock.Mock( return_value=self._network_flavors ) @@ -347,7 +347,7 @@ class TestRemoveNetworkFlavorFromProfile(TestNetworkFlavor): service_profile = network_fakes.create_one_service_profile() def setUp(self): - super(TestRemoveNetworkFlavorFromProfile, self).setUp() + super().setUp() self.network_client.find_flavor = mock.Mock( return_value=self.network_flavor ) @@ -411,7 +411,7 @@ class TestShowNetworkFlavor(TestNetworkFlavor): ) def setUp(self): - super(TestShowNetworkFlavor, self).setUp() + super().setUp() self.network_client.find_flavor = mock.Mock( return_value=self.new_network_flavor ) @@ -455,7 +455,7 @@ class TestSetNetworkFlavor(TestNetworkFlavor): new_network_flavor = network_fakes.create_one_network_flavor() def setUp(self): - super(TestSetNetworkFlavor, self).setUp() + super().setUp() self.network_client.update_flavor = mock.Mock(return_value=None) self.network_client.find_flavor = mock.Mock( return_value=self.new_network_flavor diff --git a/openstackclient/tests/unit/network/v2/test_network_flavor_profile.py b/openstackclient/tests/unit/network/v2/test_network_flavor_profile.py index a54045aa6..44cc4f493 100644 --- a/openstackclient/tests/unit/network/v2/test_network_flavor_profile.py +++ b/openstackclient/tests/unit/network/v2/test_network_flavor_profile.py @@ -21,7 +21,7 @@ class TestFlavorProfile(network_fakes.TestNetworkV2): def setUp(self): - super(TestFlavorProfile, self).setUp() + super().setUp() # Get the ProjectManager Mock self.projects_mock = self.identity_client.projects @@ -53,7 +53,7 @@ class TestCreateFlavorProfile(TestFlavorProfile): ) def setUp(self): - super(TestCreateFlavorProfile, self).setUp() + super().setUp() self.network_client.create_service_profile = mock.Mock( return_value=self.new_flavor_profile ) @@ -227,7 +227,7 @@ class TestDeleteFlavorProfile(TestFlavorProfile): _network_flavor_profiles = network_fakes.create_service_profile(count=2) def setUp(self): - super(TestDeleteFlavorProfile, self).setUp() + super().setUp() self.network_client.delete_service_profile = mock.Mock( return_value=None ) @@ -346,7 +346,7 @@ class TestListFlavorProfile(TestFlavorProfile): ) def setUp(self): - super(TestListFlavorProfile, self).setUp() + super().setUp() self.network_client.service_profiles = mock.Mock( return_value=self._network_flavor_profiles ) @@ -389,7 +389,7 @@ class TestShowFlavorProfile(TestFlavorProfile): ) def setUp(self): - super(TestShowFlavorProfile, self).setUp() + super().setUp() self.network_client.find_service_profile = mock.Mock( return_value=self.network_flavor_profile ) @@ -422,7 +422,7 @@ class TestSetFlavorProfile(TestFlavorProfile): network_flavor_profile = network_fakes.create_one_service_profile() def setUp(self): - super(TestSetFlavorProfile, self).setUp() + super().setUp() self.network_client.update_service_profile = mock.Mock( return_value=None ) diff --git a/openstackclient/tests/unit/network/v2/test_network_meter.py b/openstackclient/tests/unit/network/v2/test_network_meter.py index af0513678..a92035d6d 100644 --- a/openstackclient/tests/unit/network/v2/test_network_meter.py +++ b/openstackclient/tests/unit/network/v2/test_network_meter.py @@ -26,7 +26,7 @@ class TestMeter(network_fakes.TestNetworkV2): def setUp(self): - super(TestMeter, self).setUp() + super().setUp() self.projects_mock = self.identity_client.projects self.domains_mock = self.identity_client.domains @@ -54,7 +54,7 @@ class TestCreateMeter(TestMeter): ) def setUp(self): - super(TestCreateMeter, self).setUp() + super().setUp() self.network_client.create_metering_label = mock.Mock( return_value=self.new_meter ) @@ -128,7 +128,7 @@ def test_create_all_options(self): class TestDeleteMeter(TestMeter): def setUp(self): - super(TestDeleteMeter, self).setUp() + super().setUp() self.meter_list = network_fakes.FakeNetworkMeter.create_meter(count=2) @@ -238,7 +238,7 @@ class TestListMeter(TestMeter): ) def setUp(self): - super(TestListMeter, self).setUp() + super().setUp() self.network_client.metering_labels = mock.Mock( return_value=self.meter_list @@ -278,7 +278,7 @@ class TestShowMeter(TestMeter): ) def setUp(self): - super(TestShowMeter, self).setUp() + super().setUp() self.cmd = network_meter.ShowMeter(self.app, None) diff --git a/openstackclient/tests/unit/network/v2/test_network_meter_rule.py b/openstackclient/tests/unit/network/v2/test_network_meter_rule.py index 8ee020809..e90ed05f3 100644 --- a/openstackclient/tests/unit/network/v2/test_network_meter_rule.py +++ b/openstackclient/tests/unit/network/v2/test_network_meter_rule.py @@ -26,7 +26,7 @@ class TestMeterRule(network_fakes.TestNetworkV2): def setUp(self): - super(TestMeterRule, self).setUp() + super().setUp() self.projects_mock = self.identity_client.projects self.domains_mock = self.identity_client.domains @@ -60,7 +60,7 @@ class TestCreateMeterRule(TestMeterRule): ) def setUp(self): - super(TestCreateMeterRule, self).setUp() + super().setUp() fake_meter = network_fakes.FakeNetworkMeter.create_one_meter( {'id': self.new_rule.metering_label_id} ) @@ -142,7 +142,7 @@ def test_create_all_options(self): class TestDeleteMeterRule(TestMeterRule): def setUp(self): - super(TestDeleteMeterRule, self).setUp() + super().setUp() self.rule_list = network_fakes.FakeNetworkMeterRule.create_meter_rule( count=2 ) @@ -260,7 +260,7 @@ class TestListMeterRule(TestMeterRule): ) def setUp(self): - super(TestListMeterRule, self).setUp() + super().setUp() self.network_client.metering_label_rules = mock.Mock( return_value=self.rule_list @@ -307,7 +307,7 @@ class TestShowMeterRule(TestMeterRule): ) def setUp(self): - super(TestShowMeterRule, self).setUp() + super().setUp() self.cmd = network_meter_rule.ShowMeterRule(self.app, None) diff --git a/openstackclient/tests/unit/network/v2/test_network_qos_policy.py b/openstackclient/tests/unit/network/v2/test_network_qos_policy.py index 8129ff202..0a7cbb980 100644 --- a/openstackclient/tests/unit/network/v2/test_network_qos_policy.py +++ b/openstackclient/tests/unit/network/v2/test_network_qos_policy.py @@ -26,7 +26,7 @@ class TestQosPolicy(network_fakes.TestNetworkV2): def setUp(self): - super(TestQosPolicy, self).setUp() + super().setUp() # Get a shortcut to the ProjectManager Mock self.projects_mock = self.app.client_manager.identity.projects @@ -61,7 +61,7 @@ class TestCreateNetworkQosPolicy(TestQosPolicy): ) def setUp(self): - super(TestCreateNetworkQosPolicy, self).setUp() + super().setUp() self.network_client.create_qos_policy = mock.Mock( return_value=self.new_qos_policy ) @@ -163,7 +163,7 @@ class TestDeleteNetworkQosPolicy(TestQosPolicy): ) def setUp(self): - super(TestDeleteNetworkQosPolicy, self).setUp() + super().setUp() self.network_client.delete_qos_policy = mock.Mock(return_value=None) self.network_client.find_qos_policy = ( network_fakes.FakeNetworkQosPolicy.get_qos_policies( @@ -268,7 +268,7 @@ class TestListNetworkQosPolicy(TestQosPolicy): ) def setUp(self): - super(TestListNetworkQosPolicy, self).setUp() + super().setUp() self.network_client.qos_policies = mock.Mock( return_value=self.qos_policies ) @@ -348,7 +348,7 @@ class TestSetNetworkQosPolicy(TestQosPolicy): _qos_policy = network_fakes.FakeNetworkQosPolicy.create_one_qos_policy() def setUp(self): - super(TestSetNetworkQosPolicy, self).setUp() + super().setUp() self.network_client.update_qos_policy = mock.Mock(return_value=None) self.network_client.find_qos_policy = mock.Mock( return_value=self._qos_policy @@ -449,7 +449,7 @@ class TestShowNetworkQosPolicy(TestQosPolicy): ) def setUp(self): - super(TestShowNetworkQosPolicy, self).setUp() + super().setUp() self.network_client.find_qos_policy = mock.Mock( return_value=self._qos_policy ) diff --git a/openstackclient/tests/unit/network/v2/test_network_qos_rule.py b/openstackclient/tests/unit/network/v2/test_network_qos_rule.py index 8ecf4fa8b..1f6fe093e 100644 --- a/openstackclient/tests/unit/network/v2/test_network_qos_rule.py +++ b/openstackclient/tests/unit/network/v2/test_network_qos_rule.py @@ -53,7 +53,7 @@ class TestNetworkQosRule(network_fakes.TestNetworkV2): def setUp(self): - super(TestNetworkQosRule, self).setUp() + super().setUp() self.qos_policy = ( network_fakes.FakeNetworkQosPolicy.create_one_qos_policy() ) @@ -67,7 +67,7 @@ def test_check_type_parameters(self): pass def setUp(self): - super(TestCreateNetworkQosRuleMinimumBandwidth, self).setUp() + super().setUp() attrs = { 'qos_policy_id': self.qos_policy.id, 'type': RULE_TYPE_MINIMUM_BANDWIDTH, @@ -174,7 +174,7 @@ def test_check_type_parameters(self): pass def setUp(self): - super(TestCreateNetworkQosRuleMinimumPacketRate, self).setUp() + super().setUp() attrs = { 'qos_policy_id': self.qos_policy.id, 'type': RULE_TYPE_MINIMUM_PACKET_RATE, @@ -281,7 +281,7 @@ def test_check_type_parameters(self): pass def setUp(self): - super(TestCreateNetworkQosRuleDSCPMarking, self).setUp() + super().setUp() attrs = { 'qos_policy_id': self.qos_policy.id, 'type': RULE_TYPE_DSCP_MARKING, @@ -379,7 +379,7 @@ def test_check_type_parameters(self): pass def setUp(self): - super(TestCreateNetworkQosRuleBandwidtLimit, self).setUp() + super().setUp() attrs = { 'qos_policy_id': self.qos_policy.id, 'type': RULE_TYPE_BANDWIDTH_LIMIT, @@ -540,7 +540,7 @@ def test_create_wrong_options(self): class TestDeleteNetworkQosRuleMinimumBandwidth(TestNetworkQosRule): def setUp(self): - super(TestDeleteNetworkQosRuleMinimumBandwidth, self).setUp() + super().setUp() attrs = { 'qos_policy_id': self.qos_policy.id, 'type': RULE_TYPE_MINIMUM_BANDWIDTH, @@ -598,16 +598,16 @@ def test_qos_policy_delete_error(self): parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.cmd.take_action(parsed_args) except exceptions.CommandError as e: - msg = 'Failed to delete Network QoS rule ID "%(rule)s": %(e)s' % { - 'rule': self.new_rule.id, - 'e': 'Error message', - } + msg = 'Failed to delete Network QoS rule ID "{rule}": {e}'.format( + rule=self.new_rule.id, + e='Error message', + ) self.assertEqual(msg, str(e)) class TestDeleteNetworkQosRuleMinimumPacketRate(TestNetworkQosRule): def setUp(self): - super(TestDeleteNetworkQosRuleMinimumPacketRate, self).setUp() + super().setUp() attrs = { 'qos_policy_id': self.qos_policy.id, 'type': RULE_TYPE_MINIMUM_PACKET_RATE, @@ -665,16 +665,16 @@ def test_qos_policy_delete_error(self): parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.cmd.take_action(parsed_args) except exceptions.CommandError as e: - msg = 'Failed to delete Network QoS rule ID "%(rule)s": %(e)s' % { - 'rule': self.new_rule.id, - 'e': 'Error message', - } + msg = 'Failed to delete Network QoS rule ID "{rule}": {e}'.format( + rule=self.new_rule.id, + e='Error message', + ) self.assertEqual(msg, str(e)) class TestDeleteNetworkQosRuleDSCPMarking(TestNetworkQosRule): def setUp(self): - super(TestDeleteNetworkQosRuleDSCPMarking, self).setUp() + super().setUp() attrs = { 'qos_policy_id': self.qos_policy.id, 'type': RULE_TYPE_DSCP_MARKING, @@ -732,16 +732,16 @@ def test_qos_policy_delete_error(self): parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.cmd.take_action(parsed_args) except exceptions.CommandError as e: - msg = 'Failed to delete Network QoS rule ID "%(rule)s": %(e)s' % { - 'rule': self.new_rule.id, - 'e': 'Error message', - } + msg = 'Failed to delete Network QoS rule ID "{rule}": {e}'.format( + rule=self.new_rule.id, + e='Error message', + ) self.assertEqual(msg, str(e)) class TestDeleteNetworkQosRuleBandwidthLimit(TestNetworkQosRule): def setUp(self): - super(TestDeleteNetworkQosRuleBandwidthLimit, self).setUp() + super().setUp() attrs = { 'qos_policy_id': self.qos_policy.id, 'type': RULE_TYPE_BANDWIDTH_LIMIT, @@ -799,16 +799,16 @@ def test_qos_policy_delete_error(self): parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.cmd.take_action(parsed_args) except exceptions.CommandError as e: - msg = 'Failed to delete Network QoS rule ID "%(rule)s": %(e)s' % { - 'rule': self.new_rule.id, - 'e': 'Error message', - } + msg = 'Failed to delete Network QoS rule ID "{rule}": {e}'.format( + rule=self.new_rule.id, + e='Error message', + ) self.assertEqual(msg, str(e)) class TestSetNetworkQosRuleMinimumBandwidth(TestNetworkQosRule): def setUp(self): - super(TestSetNetworkQosRuleMinimumBandwidth, self).setUp() + super().setUp() attrs = { 'qos_policy_id': self.qos_policy.id, 'type': RULE_TYPE_MINIMUM_BANDWIDTH, @@ -912,7 +912,7 @@ def test_set_wrong_options(self): class TestSetNetworkQosRuleMinimumPacketRate(TestNetworkQosRule): def setUp(self): - super(TestSetNetworkQosRuleMinimumPacketRate, self).setUp() + super().setUp() attrs = { 'qos_policy_id': self.qos_policy.id, 'type': RULE_TYPE_MINIMUM_PACKET_RATE, @@ -1016,7 +1016,7 @@ def test_set_wrong_options(self): class TestSetNetworkQosRuleDSCPMarking(TestNetworkQosRule): def setUp(self): - super(TestSetNetworkQosRuleDSCPMarking, self).setUp() + super().setUp() attrs = { 'qos_policy_id': self.qos_policy.id, 'type': RULE_TYPE_DSCP_MARKING, @@ -1120,7 +1120,7 @@ def test_set_wrong_options(self): class TestSetNetworkQosRuleBandwidthLimit(TestNetworkQosRule): def setUp(self): - super(TestSetNetworkQosRuleBandwidthLimit, self).setUp() + super().setUp() attrs = { 'qos_policy_id': self.qos_policy.id, 'type': RULE_TYPE_BANDWIDTH_LIMIT, @@ -1297,7 +1297,7 @@ def test_set_wrong_options(self): class TestListNetworkQosRule(TestNetworkQosRule): def setUp(self): - super(TestListNetworkQosRule, self).setUp() + super().setUp() attrs = { 'qos_policy_id': self.qos_policy.id, 'type': RULE_TYPE_MINIMUM_BANDWIDTH, @@ -1387,7 +1387,7 @@ def test_qos_rule_list(self): class TestShowNetworkQosRuleMinimumBandwidth(TestNetworkQosRule): def setUp(self): - super(TestShowNetworkQosRuleMinimumBandwidth, self).setUp() + super().setUp() attrs = { 'qos_policy_id': self.qos_policy.id, 'type': RULE_TYPE_MINIMUM_BANDWIDTH, @@ -1455,7 +1455,7 @@ def test_show_all_options(self): class TestShowNetworkQosRuleMinimumPacketRate(TestNetworkQosRule): def setUp(self): - super(TestShowNetworkQosRuleMinimumPacketRate, self).setUp() + super().setUp() attrs = { 'qos_policy_id': self.qos_policy.id, 'type': RULE_TYPE_MINIMUM_PACKET_RATE, @@ -1523,7 +1523,7 @@ def test_show_all_options(self): class TestShowNetworkQosDSCPMarking(TestNetworkQosRule): def setUp(self): - super(TestShowNetworkQosDSCPMarking, self).setUp() + super().setUp() attrs = { 'qos_policy_id': self.qos_policy.id, 'type': RULE_TYPE_DSCP_MARKING, @@ -1589,7 +1589,7 @@ def test_show_all_options(self): class TestShowNetworkQosBandwidthLimit(TestNetworkQosRule): def setUp(self): - super(TestShowNetworkQosBandwidthLimit, self).setUp() + super().setUp() attrs = { 'qos_policy_id': self.qos_policy.id, 'type': RULE_TYPE_BANDWIDTH_LIMIT, diff --git a/openstackclient/tests/unit/network/v2/test_network_qos_rule_type.py b/openstackclient/tests/unit/network/v2/test_network_qos_rule_type.py index c42a00af7..4838df2e8 100644 --- a/openstackclient/tests/unit/network/v2/test_network_qos_rule_type.py +++ b/openstackclient/tests/unit/network/v2/test_network_qos_rule_type.py @@ -22,7 +22,7 @@ class TestNetworkQosRuleType(network_fakes.TestNetworkV2): def setUp(self): - super(TestNetworkQosRuleType, self).setUp() + super().setUp() class TestShowNetworkQosRuleType(TestNetworkQosRuleType): @@ -35,7 +35,7 @@ class TestShowNetworkQosRuleType(TestNetworkQosRuleType): data = [qos_rule_type.drivers, qos_rule_type.type] def setUp(self): - super(TestShowNetworkQosRuleType, self).setUp() + super().setUp() self.network_client.get_qos_rule_type = mock.Mock( return_value=self.qos_rule_type ) @@ -85,7 +85,7 @@ class TestListNetworkQosRuleType(TestNetworkQosRuleType): data.append((qos_rule_type.type,)) def setUp(self): - super(TestListNetworkQosRuleType, self).setUp() + super().setUp() self.network_client.qos_rule_types = mock.Mock( return_value=self.qos_rule_types ) diff --git a/openstackclient/tests/unit/network/v2/test_network_rbac.py b/openstackclient/tests/unit/network/v2/test_network_rbac.py index e40c1df41..c13b72bb4 100644 --- a/openstackclient/tests/unit/network/v2/test_network_rbac.py +++ b/openstackclient/tests/unit/network/v2/test_network_rbac.py @@ -25,7 +25,7 @@ class TestNetworkRBAC(network_fakes.TestNetworkV2): def setUp(self): - super(TestNetworkRBAC, self).setUp() + super().setUp() # Get a shortcut to the ProjectManager Mock self.projects_mock = self.identity_client.projects @@ -67,7 +67,7 @@ class TestCreateNetworkRBAC(TestNetworkRBAC): ] def setUp(self): - super(TestCreateNetworkRBAC, self).setUp() + super().setUp() # Get the command object to test self.cmd = network_rbac.CreateNetworkRBAC(self.app, None) @@ -342,7 +342,7 @@ class TestDeleteNetworkRBAC(TestNetworkRBAC): rbac_policies = network_fakes.create_network_rbacs(count=2) def setUp(self): - super(TestDeleteNetworkRBAC, self).setUp() + super().setUp() self.network_client.delete_rbac_policy = mock.Mock(return_value=None) self.network_client.find_rbac_policy = network_fakes.get_network_rbacs( rbac_policies=self.rbac_policies @@ -457,7 +457,7 @@ class TestListNetworkRABC(TestNetworkRBAC): ) def setUp(self): - super(TestListNetworkRABC, self).setUp() + super().setUp() # Get the command object to test self.cmd = network_rbac.ListNetworkRBAC(self.app, None) @@ -559,7 +559,7 @@ class TestSetNetworkRBAC(TestNetworkRBAC): ) def setUp(self): - super(TestSetNetworkRBAC, self).setUp() + super().setUp() # Get the command object to test self.cmd = network_rbac.SetNetworkRBAC(self.app, None) @@ -634,7 +634,7 @@ class TestShowNetworkRBAC(TestNetworkRBAC): ] def setUp(self): - super(TestShowNetworkRBAC, self).setUp() + super().setUp() # Get the command object to test self.cmd = network_rbac.ShowNetworkRBAC(self.app, None) diff --git a/openstackclient/tests/unit/network/v2/test_network_segment.py b/openstackclient/tests/unit/network/v2/test_network_segment.py index 38342a2c3..936a20aef 100644 --- a/openstackclient/tests/unit/network/v2/test_network_segment.py +++ b/openstackclient/tests/unit/network/v2/test_network_segment.py @@ -23,7 +23,7 @@ class TestNetworkSegment(network_fakes.TestNetworkV2): def setUp(self): - super(TestNetworkSegment, self).setUp() + super().setUp() class TestCreateNetworkSegment(TestNetworkSegment): @@ -56,7 +56,7 @@ class TestCreateNetworkSegment(TestNetworkSegment): ) def setUp(self): - super(TestCreateNetworkSegment, self).setUp() + super().setUp() self.network_client.create_segment = mock.Mock( return_value=self._network_segment @@ -170,7 +170,7 @@ class TestDeleteNetworkSegment(TestNetworkSegment): _network_segments = network_fakes.create_network_segments() def setUp(self): - super(TestDeleteNetworkSegment, self).setUp() + super().setUp() self.network_client.delete_segment = mock.Mock(return_value=None) self.network_client.find_segment = mock.Mock( @@ -286,7 +286,7 @@ class TestListNetworkSegment(TestNetworkSegment): ) def setUp(self): - super(TestListNetworkSegment, self).setUp() + super().setUp() # Get the command object to test self.cmd = network_segment.ListNetworkSegment(self.app, None) @@ -350,7 +350,7 @@ class TestSetNetworkSegment(TestNetworkSegment): _network_segment = network_fakes.create_one_network_segment() def setUp(self): - super(TestSetNetworkSegment, self).setUp() + super().setUp() self.network_client.find_segment = mock.Mock( return_value=self._network_segment @@ -430,7 +430,7 @@ class TestShowNetworkSegment(TestNetworkSegment): ) def setUp(self): - super(TestShowNetworkSegment, self).setUp() + super().setUp() self.network_client.find_segment = mock.Mock( return_value=self._network_segment diff --git a/openstackclient/tests/unit/network/v2/test_network_segment_range.py b/openstackclient/tests/unit/network/v2/test_network_segment_range.py index e33d4d592..d5e406f39 100644 --- a/openstackclient/tests/unit/network/v2/test_network_segment_range.py +++ b/openstackclient/tests/unit/network/v2/test_network_segment_range.py @@ -40,7 +40,7 @@ def test__get_ranges(self): class TestNetworkSegmentRange(network_fakes.TestNetworkV2): def setUp(self): - super(TestNetworkSegmentRange, self).setUp() + super().setUp() class TestCreateNetworkSegmentRange(TestNetworkSegmentRange): @@ -76,7 +76,7 @@ class TestCreateNetworkSegmentRange(TestNetworkSegmentRange): ) def setUp(self): - super(TestCreateNetworkSegmentRange, self).setUp() + super().setUp() self.network_client.create_network_segment_range = mock.Mock( return_value=self._network_segment_range @@ -349,7 +349,7 @@ class TestDeleteNetworkSegmentRange(TestNetworkSegmentRange): _network_segment_ranges = network_fakes.create_network_segment_ranges() def setUp(self): - super(TestDeleteNetworkSegmentRange, self).setUp() + super().setUp() self.network_client.delete_network_segment_range = mock.Mock( return_value=None @@ -491,7 +491,7 @@ class TestListNetworkSegmentRange(TestNetworkSegmentRange): ) def setUp(self): - super(TestListNetworkSegmentRange, self).setUp() + super().setUp() self.network_client.network_segment_ranges = mock.Mock( return_value=self._network_segment_ranges @@ -565,7 +565,7 @@ class TestSetNetworkSegmentRange(TestNetworkSegmentRange): ) def setUp(self): - super(TestSetNetworkSegmentRange, self).setUp() + super().setUp() self.network_client.find_network_segment_range = mock.Mock( return_value=self._network_segment_range @@ -660,7 +660,7 @@ class TestShowNetworkSegmentRange(TestNetworkSegmentRange): ) def setUp(self): - super(TestShowNetworkSegmentRange, self).setUp() + super().setUp() self.network_client.find_network_segment_range = mock.Mock( return_value=self._network_segment_range diff --git a/openstackclient/tests/unit/network/v2/test_network_service_provider.py b/openstackclient/tests/unit/network/v2/test_network_service_provider.py index c08064fe7..9f61bce59 100644 --- a/openstackclient/tests/unit/network/v2/test_network_service_provider.py +++ b/openstackclient/tests/unit/network/v2/test_network_service_provider.py @@ -23,7 +23,7 @@ class TestNetworkServiceProvider(fakes.TestNetworkV2): def setUp(self): - super(TestNetworkServiceProvider, self).setUp() + super().setUp() class TestListNetworkServiceProvider(TestNetworkServiceProvider): @@ -51,7 +51,7 @@ class TestListNetworkServiceProvider(TestNetworkServiceProvider): ) def setUp(self): - super(TestListNetworkServiceProvider, self).setUp() + super().setUp() self.network_client.service_providers = mock.Mock( return_value=self.provider_list ) diff --git a/openstackclient/tests/unit/network/v2/test_network_trunk.py b/openstackclient/tests/unit/network/v2/test_network_trunk.py index 47952d988..153d7f995 100644 --- a/openstackclient/tests/unit/network/v2/test_network_trunk.py +++ b/openstackclient/tests/unit/network/v2/test_network_trunk.py @@ -233,7 +233,7 @@ def test_create_network_trunk_subports_without_optional_keys(self): '--parent-port', self.new_trunk.port_id, '--subport', - 'port=%(port)s' % {'port': subport['port_id']}, + 'port={port}'.format(port=subport['port_id']), self.new_trunk.name, ] verifylist = [ @@ -712,7 +712,7 @@ def test_set_network_trunk_subports_without_optional_keys(self): subport.pop('segmentation_id') arglist = [ '--subport', - 'port=%(port)s' % {'port': subport['port_id']}, + 'port={port}'.format(port=subport['port_id']), self._trunk['name'], ] verifylist = [ diff --git a/openstackclient/tests/unit/network/v2/test_port.py b/openstackclient/tests/unit/network/v2/test_port.py index 5a331635f..d47f86615 100644 --- a/openstackclient/tests/unit/network/v2/test_port.py +++ b/openstackclient/tests/unit/network/v2/test_port.py @@ -30,7 +30,7 @@ class TestPort(network_fakes.TestNetworkV2): def setUp(self): - super(TestPort, self).setUp() + super().setUp() # Get a shortcut to the ProjectManager Mock self.projects_mock = self.identity_client.projects @@ -127,7 +127,7 @@ class TestCreatePort(TestPort): columns, data = TestPort._get_common_cols_data(_port) def setUp(self): - super(TestCreatePort, self).setUp() + super().setUp() self.network_client.create_port = mock.Mock(return_value=self._port) self.network_client.set_tags = mock.Mock(return_value=None) @@ -1118,7 +1118,7 @@ class TestDeletePort(TestPort): _ports = network_fakes.create_ports(count=2) def setUp(self): - super(TestDeletePort, self).setUp() + super().setUp() self.network_client.delete_port = mock.Mock(return_value=None) self.network_client.find_port = network_fakes.get_ports( @@ -1240,7 +1240,7 @@ class TestListPort(TestPort): ) def setUp(self): - super(TestListPort, self).setUp() + super().setUp() self.network_client.ports = mock.Mock(return_value=self._ports) fake_router = network_fakes.FakeRouter.create_one_router( @@ -1490,7 +1490,7 @@ def test_port_list_fixed_ip_opts(self): ip_address = self._ports[0].fixed_ips[0]['ip_address'] arglist = [ '--fixed-ip', - "subnet=%s,ip-address=%s" % (subnet_id, ip_address), + f"subnet={subnet_id},ip-address={ip_address}", ] verifylist = [ ('fixed_ip', [{'subnet': subnet_id, 'ip-address': ip_address}]) @@ -1720,7 +1720,7 @@ class TestSetPort(TestPort): _port = network_fakes.create_one_port({'tags': ['green', 'red']}) def setUp(self): - super(TestSetPort, self).setUp() + super().setUp() self.fake_subnet = network_fakes.FakeSubnet.create_one_subnet() self.network_client.find_subnet = mock.Mock( return_value=self.fake_subnet @@ -2507,7 +2507,7 @@ class TestShowPort(TestPort): columns, data = TestPort._get_common_cols_data(_port) def setUp(self): - super(TestShowPort, self).setUp() + super().setUp() self.network_client.find_port = mock.Mock(return_value=self._port) @@ -2547,7 +2547,7 @@ def test_show_all_options(self): class TestUnsetPort(TestPort): def setUp(self): - super(TestUnsetPort, self).setUp() + super().setUp() self._testport = network_fakes.create_one_port( { 'fixed_ips': [ diff --git a/openstackclient/tests/unit/network/v2/test_router.py b/openstackclient/tests/unit/network/v2/test_router.py index 6e645996f..8f8704b90 100644 --- a/openstackclient/tests/unit/network/v2/test_router.py +++ b/openstackclient/tests/unit/network/v2/test_router.py @@ -25,7 +25,7 @@ class TestRouter(network_fakes.TestNetworkV2): def setUp(self): - super(TestRouter, self).setUp() + super().setUp() self.projects_mock = self.identity_client.projects @@ -39,7 +39,7 @@ class TestAddPortToRouter(TestRouter): ) def setUp(self): - super(TestAddPortToRouter, self).setUp() + super().setUp() self.network_client.find_router = mock.Mock(return_value=self._router) self.network_client.find_port = mock.Mock(return_value=self._port) @@ -89,7 +89,7 @@ class TestAddSubnetToRouter(TestRouter): ) def setUp(self): - super(TestAddSubnetToRouter, self).setUp() + super().setUp() self.network_client.find_router = mock.Mock(return_value=self._router) self.network_client.find_subnet = mock.Mock(return_value=self._subnet) @@ -164,7 +164,7 @@ class TestCreateRouter(TestRouter): ) def setUp(self): - super(TestCreateRouter, self).setUp() + super().setUp() self.network_client.create_router = mock.Mock( return_value=self.new_router @@ -484,7 +484,7 @@ class TestDeleteRouter(TestRouter): _routers = network_fakes.FakeRouter.create_routers(count=2) def setUp(self): - super(TestDeleteRouter, self).setUp() + super().setUp() self.network_client.delete_router = mock.Mock(return_value=None) @@ -642,7 +642,7 @@ class TestListRouter(TestRouter): ) def setUp(self): - super(TestListRouter, self).setUp() + super().setUp() # Get the command object to test self.cmd = router.ListRouter(self.app, None) @@ -905,7 +905,7 @@ class TestRemovePortFromRouter(TestRouter): ) def setUp(self): - super(TestRemovePortFromRouter, self).setUp() + super().setUp() self.network_client.find_router = mock.Mock(return_value=self._router) self.network_client.find_port = mock.Mock(return_value=self._port) @@ -952,7 +952,7 @@ class TestRemoveSubnetFromRouter(TestRouter): ) def setUp(self): - super(TestRemoveSubnetFromRouter, self).setUp() + super().setUp() self.network_client.find_router = mock.Mock(return_value=self._router) self.network_client.find_subnet = mock.Mock(return_value=self._subnet) @@ -993,7 +993,7 @@ class TestAddExtraRoutesToRouter(TestRouter): _router = network_fakes.FakeRouter.create_one_router() def setUp(self): - super(TestAddExtraRoutesToRouter, self).setUp() + super().setUp() self.network_client.add_extra_routes_to_router = mock.Mock( return_value=self._router ) @@ -1082,7 +1082,7 @@ class TestRemoveExtraRoutesFromRouter(TestRouter): _router = network_fakes.FakeRouter.create_one_router() def setUp(self): - super(TestRemoveExtraRoutesFromRouter, self).setUp() + super().setUp() self.network_client.remove_extra_routes_from_router = mock.Mock( return_value=self._router ) @@ -1180,7 +1180,7 @@ class TestSetRouter(TestRouter): _extensions = {'fake': network_fakes.create_one_extension()} def setUp(self): - super(TestSetRouter, self).setUp() + super().setUp() self.network_client.update_router = mock.Mock(return_value=None) self.network_client.set_tags = mock.Mock(return_value=None) self.network_client.find_router = mock.Mock(return_value=self._router) @@ -1710,7 +1710,7 @@ class TestShowRouter(TestRouter): ) def setUp(self): - super(TestShowRouter, self).setUp() + super().setUp() self.network_client.find_router = mock.Mock(return_value=self._router) self.network_client.ports = mock.Mock(return_value=[self._port]) @@ -1793,7 +1793,7 @@ def test_show_no_extra_route_extension(self): class TestUnsetRouter(TestRouter): def setUp(self): - super(TestUnsetRouter, self).setUp() + super().setUp() self.fake_network = network_fakes.create_one_network() self.fake_qos_policy = ( network_fakes.FakeNetworkQosPolicy.create_one_qos_policy() @@ -2138,9 +2138,9 @@ def test_create_multiple_gateways(self): "--external-gateway", self._second_network.id, '--fixed-ip', - 'subnet={},ip-address=10.0.1.1'.format(self._subnet.id), + f'subnet={self._subnet.id},ip-address=10.0.1.1', '--fixed-ip', - 'subnet={},ip-address=10.0.1.2'.format(self._subnet.id), + f'subnet={self._subnet.id},ip-address=10.0.1.2', ] verifylist = [ ('name', self._router.name), @@ -2242,9 +2242,9 @@ def test_update_multiple_gateways(self): "--external-gateway", self._second_network.id, '--fixed-ip', - 'subnet={},ip-address=10.0.1.1'.format(self._subnet.id), + f'subnet={self._subnet.id},ip-address=10.0.1.1', '--fixed-ip', - 'subnet={},ip-address=10.0.1.2'.format(self._subnet.id), + f'subnet={self._subnet.id},ip-address=10.0.1.2', "--no-qos-policy", ] verifylist = [ @@ -2327,7 +2327,7 @@ def test_add_gateway_network_fixed_ip(self): self._router.name, self._network.id, '--fixed-ip', - 'subnet={},ip-address=10.0.1.1'.format(self._subnet.id), + f'subnet={self._subnet.id},ip-address=10.0.1.1', ] verifylist = [ ('router', self._router.name), @@ -2360,9 +2360,9 @@ def test_add_gateway_network_multiple_fixed_ips(self): self._router.name, self._network.id, '--fixed-ip', - 'subnet={},ip-address=10.0.1.1'.format(self._subnet.id), + f'subnet={self._subnet.id},ip-address=10.0.1.1', '--fixed-ip', - 'subnet={},ip-address=10.0.1.2'.format(self._subnet.id), + f'subnet={self._subnet.id},ip-address=10.0.1.2', ] verifylist = [ ('router', self._router.name), @@ -2453,7 +2453,7 @@ def test_remove_gateway_network_fixed_ip(self): self._router.name, self._network.id, '--fixed-ip', - 'subnet={},ip-address=10.0.1.1'.format(self._subnet.id), + f'subnet={self._subnet.id},ip-address=10.0.1.1', ] verifylist = [ ('router', self._router.name), @@ -2486,9 +2486,9 @@ def test_remove_gateway_network_multiple_fixed_ips(self): self._router.name, self._network.id, '--fixed-ip', - 'subnet={},ip-address=10.0.1.1'.format(self._subnet.id), + f'subnet={self._subnet.id},ip-address=10.0.1.1', '--fixed-ip', - 'subnet={},ip-address=10.0.1.2'.format(self._subnet.id), + f'subnet={self._subnet.id},ip-address=10.0.1.2', ] verifylist = [ ('router', self._router.name), diff --git a/openstackclient/tests/unit/network/v2/test_security_group_compute.py b/openstackclient/tests/unit/network/v2/test_security_group_compute.py index f9ea640ff..806878810 100644 --- a/openstackclient/tests/unit/network/v2/test_security_group_compute.py +++ b/openstackclient/tests/unit/network/v2/test_security_group_compute.py @@ -47,7 +47,7 @@ class TestCreateSecurityGroupCompute(compute_fakes.TestComputev2): ) def setUp(self): - super(TestCreateSecurityGroupCompute, self).setUp() + super().setUp() self.app.client_manager.network_endpoint_enabled = False @@ -107,7 +107,7 @@ class TestDeleteSecurityGroupCompute(compute_fakes.TestComputev2): _security_groups = compute_fakes.create_security_groups() def setUp(self): - super(TestDeleteSecurityGroupCompute, self).setUp() + super().setUp() self.app.client_manager.network_endpoint_enabled = False @@ -221,7 +221,7 @@ class TestListSecurityGroupCompute(compute_fakes.TestComputev2): ) def setUp(self): - super(TestListSecurityGroupCompute, self).setUp() + super().setUp() self.app.client_manager.network_endpoint_enabled = False @@ -267,7 +267,7 @@ class TestSetSecurityGroupCompute(compute_fakes.TestComputev2): _security_group = compute_fakes.create_one_security_group() def setUp(self): - super(TestSetSecurityGroupCompute, self).setUp() + super().setUp() self.app.client_manager.network_endpoint_enabled = False @@ -355,7 +355,7 @@ class TestShowSecurityGroupCompute(compute_fakes.TestComputev2): ) def setUp(self): - super(TestShowSecurityGroupCompute, self).setUp() + super().setUp() self.app.client_manager.network_endpoint_enabled = False diff --git a/openstackclient/tests/unit/network/v2/test_security_group_network.py b/openstackclient/tests/unit/network/v2/test_security_group_network.py index 927a05df7..9619b2963 100644 --- a/openstackclient/tests/unit/network/v2/test_security_group_network.py +++ b/openstackclient/tests/unit/network/v2/test_security_group_network.py @@ -24,7 +24,7 @@ class TestSecurityGroupNetwork(network_fakes.TestNetworkV2): def setUp(self): - super(TestSecurityGroupNetwork, self).setUp() + super().setUp() # Get a shortcut to the ProjectManager Mock self.projects_mock = self.identity_client.projects @@ -61,7 +61,7 @@ class TestCreateSecurityGroupNetwork(TestSecurityGroupNetwork): ) def setUp(self): - super(TestCreateSecurityGroupNetwork, self).setUp() + super().setUp() self.network_client.create_security_group = mock.Mock( return_value=self._security_group @@ -177,7 +177,7 @@ class TestDeleteSecurityGroupNetwork(TestSecurityGroupNetwork): _security_groups = network_fakes.FakeSecurityGroup.create_security_groups() def setUp(self): - super(TestDeleteSecurityGroupNetwork, self).setUp() + super().setUp() self.network_client.delete_security_group = mock.Mock( return_value=None @@ -289,7 +289,7 @@ class TestListSecurityGroupNetwork(TestSecurityGroupNetwork): ) def setUp(self): - super(TestListSecurityGroupNetwork, self).setUp() + super().setUp() self.network_client.security_groups = mock.Mock( return_value=self._security_groups @@ -419,7 +419,7 @@ class TestSetSecurityGroupNetwork(TestSecurityGroupNetwork): ) def setUp(self): - super(TestSetSecurityGroupNetwork, self).setUp() + super().setUp() self.network_client.update_security_group = mock.Mock( return_value=None @@ -549,7 +549,7 @@ class TestShowSecurityGroupNetwork(TestSecurityGroupNetwork): ) def setUp(self): - super(TestShowSecurityGroupNetwork, self).setUp() + super().setUp() self.network_client.find_security_group = mock.Mock( return_value=self._security_group @@ -590,7 +590,7 @@ class TestUnsetSecurityGroupNetwork(TestSecurityGroupNetwork): ) def setUp(self): - super(TestUnsetSecurityGroupNetwork, self).setUp() + super().setUp() self.network_client.update_security_group = mock.Mock( return_value=None diff --git a/openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py b/openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py index 22291a4b2..cc780d54a 100644 --- a/openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py +++ b/openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py @@ -47,7 +47,7 @@ def _setup_security_group_rule(self, attrs=None): return expected_columns, expected_data def setUp(self): - super(TestCreateSecurityGroupRuleCompute, self).setUp() + super().setUp() self.app.client_manager.network_endpoint_enabled = False @@ -302,7 +302,7 @@ class TestDeleteSecurityGroupRuleCompute(compute_fakes.TestComputev2): _security_group_rules = compute_fakes.create_security_group_rules(count=2) def setUp(self): - super(TestDeleteSecurityGroupRuleCompute, self).setUp() + super().setUp() self.app.client_manager.network_endpoint_enabled = False @@ -428,7 +428,7 @@ class TestListSecurityGroupRuleCompute(compute_fakes.TestComputev2): expected_data_no_group.append(expected_rule_no_group) def setUp(self): - super(TestListSecurityGroupRuleCompute, self).setUp() + super().setUp() self.app.client_manager.network_endpoint_enabled = False @@ -510,7 +510,7 @@ class TestShowSecurityGroupRuleCompute(compute_fakes.TestComputev2): ) def setUp(self): - super(TestShowSecurityGroupRuleCompute, self).setUp() + super().setUp() self.app.client_manager.network_endpoint_enabled = False diff --git a/openstackclient/tests/unit/network/v2/test_security_group_rule_network.py b/openstackclient/tests/unit/network/v2/test_security_group_rule_network.py index fb9e0799c..c9018db5c 100644 --- a/openstackclient/tests/unit/network/v2/test_security_group_rule_network.py +++ b/openstackclient/tests/unit/network/v2/test_security_group_rule_network.py @@ -25,7 +25,7 @@ class TestSecurityGroupRuleNetwork(network_fakes.TestNetworkV2): def setUp(self): - super(TestSecurityGroupRuleNetwork, self).setUp() + super().setUp() # Get a shortcut to the ProjectManager Mock self.projects_mock = self.identity_client.projects @@ -89,7 +89,7 @@ def _setup_security_group_rule(self, attrs=None): ) def setUp(self): - super(TestCreateSecurityGroupRuleNetwork, self).setUp() + super().setUp() self.network_client.find_security_group = mock.Mock( return_value=self._security_group @@ -970,7 +970,7 @@ class TestDeleteSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork): ) def setUp(self): - super(TestDeleteSecurityGroupRuleNetwork, self).setUp() + super().setUp() self.network_client.delete_security_group_rule = mock.Mock( return_value=None @@ -1142,7 +1142,7 @@ class TestListSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork): ) def setUp(self): - super(TestListSecurityGroupRuleNetwork, self).setUp() + super().setUp() self.network_client.find_security_group = mock.Mock( return_value=self._security_group @@ -1299,7 +1299,7 @@ class TestShowSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork): ) def setUp(self): - super(TestShowSecurityGroupRuleNetwork, self).setUp() + super().setUp() self.network_client.find_security_group_rule = mock.Mock( return_value=self._security_group_rule diff --git a/openstackclient/tests/unit/network/v2/test_subnet.py b/openstackclient/tests/unit/network/v2/test_subnet.py index abe90a003..8b8207411 100644 --- a/openstackclient/tests/unit/network/v2/test_subnet.py +++ b/openstackclient/tests/unit/network/v2/test_subnet.py @@ -25,7 +25,7 @@ class TestSubnet(network_fakes.TestNetworkV2): def setUp(self): - super(TestSubnet, self).setUp() + super().setUp() # Get a shortcut to the ProjectManager Mock self.projects_mock = self.identity_client.projects @@ -257,7 +257,7 @@ def _init_subnet_variables(self): def setUp(self): self._init_subnet_variables() - super(TestCreateSubnet, self).setUp() + super().setUp() # Get the command object to test self.cmd = subnet_v2.CreateSubnet(self.app, None) @@ -719,7 +719,7 @@ class TestDeleteSubnet(TestSubnet): _subnets = network_fakes.FakeSubnet.create_subnets(count=2) def setUp(self): - super(TestDeleteSubnet, self).setUp() + super().setUp() self.network_client.delete_subnet = mock.Mock(return_value=None) @@ -850,7 +850,7 @@ class TestListSubnet(TestSubnet): ) def setUp(self): - super(TestListSubnet, self).setUp() + super().setUp() # Get the command object to test self.cmd = subnet_v2.ListSubnet(self.app, None) @@ -1181,7 +1181,7 @@ class TestSetSubnet(TestSubnet): ) def setUp(self): - super(TestSetSubnet, self).setUp() + super().setUp() self.network_client.update_subnet = mock.Mock(return_value=None) self.network_client.set_tags = mock.Mock(return_value=None) self.network_client.find_subnet = mock.Mock(return_value=self._subnet) @@ -1509,7 +1509,7 @@ class TestShowSubnet(TestSubnet): ) def setUp(self): - super(TestShowSubnet, self).setUp() + super().setUp() # Get the command object to test self.cmd = subnet_v2.ShowSubnet(self.app, None) @@ -1551,7 +1551,7 @@ def test_show_all_options(self): class TestUnsetSubnet(TestSubnet): def setUp(self): - super(TestUnsetSubnet, self).setUp() + super().setUp() # Add three dns_nameserver entries so we can verify ordering self._testsubnet = network_fakes.FakeSubnet.create_one_subnet( { diff --git a/openstackclient/tests/unit/network/v2/test_subnet_pool.py b/openstackclient/tests/unit/network/v2/test_subnet_pool.py index 1221a9a75..214bfdce5 100644 --- a/openstackclient/tests/unit/network/v2/test_subnet_pool.py +++ b/openstackclient/tests/unit/network/v2/test_subnet_pool.py @@ -24,7 +24,7 @@ class TestSubnetPool(network_fakes.TestNetworkV2): def setUp(self): - super(TestSubnetPool, self).setUp() + super().setUp() # Get a shortcut to the ProjectManager Mock self.projects_mock = self.identity_client.projects @@ -74,7 +74,7 @@ class TestCreateSubnetPool(TestSubnetPool): ) def setUp(self): - super(TestCreateSubnetPool, self).setUp() + super().setUp() self.network_client.create_subnet_pool = mock.Mock( return_value=self._subnet_pool @@ -385,7 +385,7 @@ class TestDeleteSubnetPool(TestSubnetPool): _subnet_pools = network_fakes.FakeSubnetPool.create_subnet_pools(count=2) def setUp(self): - super(TestDeleteSubnetPool, self).setUp() + super().setUp() self.network_client.delete_subnet_pool = mock.Mock(return_value=None) @@ -509,7 +509,7 @@ class TestListSubnetPool(TestSubnetPool): ) def setUp(self): - super(TestListSubnetPool, self).setUp() + super().setUp() # Get the command object to test self.cmd = subnet_pool.ListSubnetPool(self.app, None) @@ -732,7 +732,7 @@ class TestSetSubnetPool(TestSubnetPool): _address_scope = network_fakes.create_one_address_scope() def setUp(self): - super(TestSetSubnetPool, self).setUp() + super().setUp() self.network_client.update_subnet_pool = mock.Mock(return_value=None) self.network_client.set_tags = mock.Mock(return_value=None) @@ -1077,7 +1077,7 @@ class TestShowSubnetPool(TestSubnetPool): ) def setUp(self): - super(TestShowSubnetPool, self).setUp() + super().setUp() self.network_client.find_subnet_pool = mock.Mock( return_value=self._subnet_pool @@ -1118,7 +1118,7 @@ def test_show_all_options(self): class TestUnsetSubnetPool(TestSubnetPool): def setUp(self): - super(TestUnsetSubnetPool, self).setUp() + super().setUp() self._subnetpool = network_fakes.FakeSubnetPool.create_one_subnet_pool( {'tags': ['green', 'red']} ) diff --git a/openstackclient/tests/unit/object/v1/fakes.py b/openstackclient/tests/unit/object/v1/fakes.py index 29873a35a..eedccdc0e 100644 --- a/openstackclient/tests/unit/object/v1/fakes.py +++ b/openstackclient/tests/unit/object/v1/fakes.py @@ -82,7 +82,7 @@ class TestObjectv1(utils.TestCommand): def setUp(self): - super(TestObjectv1, self).setUp() + super().setUp() self.app.client_manager.session = session.Session() self.app.client_manager.object_store = object_store.APIv1( diff --git a/openstackclient/tests/unit/object/v1/test_container.py b/openstackclient/tests/unit/object/v1/test_container.py index ee7a41c73..9143df9c9 100644 --- a/openstackclient/tests/unit/object/v1/test_container.py +++ b/openstackclient/tests/unit/object/v1/test_container.py @@ -25,7 +25,7 @@ AUTH_URL = "http://0.0.0.0" -class FakeClient(object): +class FakeClient: def __init__(self, endpoint=None, **kwargs): self.endpoint = AUTH_URL self.token = AUTH_TOKEN @@ -35,7 +35,7 @@ class TestContainer(object_fakes.TestObjectv1): columns = ('Name',) def setUp(self): - super(TestContainer, self).setUp() + super().setUp() self.app.client_manager.object_store = object_store.APIv1( session=mock.Mock(), service_type="object-store", @@ -48,7 +48,7 @@ def setUp(self): @mock.patch('openstackclient.api.object_store_v1.APIv1.container_delete') class TestContainerDelete(TestContainer): def setUp(self): - super(TestContainerDelete, self).setUp() + super().setUp() # Get the command object to test self.cmd = container.DeleteContainer(self.app, None) @@ -132,7 +132,7 @@ def test_r_delete(self, c_mock, o_list_mock, o_delete_mock): @mock.patch('openstackclient.api.object_store_v1.APIv1.container_list') class TestContainerList(TestContainer): def setUp(self): - super(TestContainerList, self).setUp() + super().setUp() # Get the command object to test self.cmd = container.ListContainer(self.app, None) @@ -345,7 +345,7 @@ def test_object_list_containers_all(self, c_mock): @mock.patch('openstackclient.api.object_store_v1.APIv1.container_show') class TestContainerShow(TestContainer): def setUp(self): - super(TestContainerShow, self).setUp() + super().setUp() # Get the command object to test self.cmd = container.ShowContainer(self.app, None) diff --git a/openstackclient/tests/unit/object/v1/test_container_all.py b/openstackclient/tests/unit/object/v1/test_container_all.py index ede3150ca..0a795dd86 100644 --- a/openstackclient/tests/unit/object/v1/test_container_all.py +++ b/openstackclient/tests/unit/object/v1/test_container_all.py @@ -21,7 +21,7 @@ class TestContainerAll(object_fakes.TestObjectv1): def setUp(self): - super(TestContainerAll, self).setUp() + super().setUp() self.requests_mock = self.useFixture(fixture.Fixture()) @@ -34,7 +34,7 @@ class TestContainerCreate(TestContainerAll): ) def setUp(self): - super(TestContainerCreate, self).setUp() + super().setUp() # Get the command object to test self.cmd = container_cmds.CreateContainer(self.app, None) @@ -182,7 +182,7 @@ def test_object_create_container_more(self): class TestContainerDelete(TestContainerAll): def setUp(self): - super(TestContainerDelete, self).setUp() + super().setUp() # Get the command object to test self.cmd = container_cmds.DeleteContainer(self.app, None) @@ -242,7 +242,7 @@ class TestContainerList(TestContainerAll): columns = ('Name',) def setUp(self): - super(TestContainerList, self).setUp() + super().setUp() # Get the command object to test self.cmd = container_cmds.ListContainer(self.app, None) @@ -309,7 +309,7 @@ def test_object_list_containers_prefix(self): class TestContainerSave(TestContainerAll): def setUp(self): - super(TestContainerSave, self).setUp() + super().setUp() # Get the command object to test self.cmd = container_cmds.SaveContainer(self.app, None) @@ -357,7 +357,7 @@ def setUp(self): class TestContainerShow(TestContainerAll): def setUp(self): - super(TestContainerShow, self).setUp() + super().setUp() # Get the command object to test self.cmd = container_cmds.ShowContainer(self.app, None) diff --git a/openstackclient/tests/unit/object/v1/test_object.py b/openstackclient/tests/unit/object/v1/test_object.py index 020b16314..665a71d14 100644 --- a/openstackclient/tests/unit/object/v1/test_object.py +++ b/openstackclient/tests/unit/object/v1/test_object.py @@ -27,7 +27,7 @@ class TestObject(object_fakes.TestObjectv1): def setUp(self): - super(TestObject, self).setUp() + super().setUp() self.app.client_manager.object_store = object_store.APIv1( session=mock.Mock(), service_type="object-store", @@ -41,7 +41,7 @@ class TestObjectList(TestObject): datalist = ((object_fakes.object_name_2,),) def setUp(self): - super(TestObjectList, self).setUp() + super().setUp() # Get the command object to test self.cmd = obj.ListObject(self.app, None) @@ -323,7 +323,7 @@ def test_object_list_objects_all(self, o_mock): @mock.patch('openstackclient.api.object_store_v1.APIv1.object_show') class TestObjectShow(TestObject): def setUp(self): - super(TestObjectShow, self).setUp() + super().setUp() # Get the command object to test self.cmd = obj.ShowObject(self.app, None) diff --git a/openstackclient/tests/unit/object/v1/test_object_all.py b/openstackclient/tests/unit/object/v1/test_object_all.py index d425373b2..484ac1b91 100644 --- a/openstackclient/tests/unit/object/v1/test_object_all.py +++ b/openstackclient/tests/unit/object/v1/test_object_all.py @@ -24,14 +24,14 @@ class TestObjectAll(object_fakes.TestObjectv1): def setUp(self): - super(TestObjectAll, self).setUp() + super().setUp() self.requests_mock = self.useFixture(fixture.Fixture()) class TestObjectCreate(TestObjectAll): def setUp(self): - super(TestObjectCreate, self).setUp() + super().setUp() # Get the command object to test self.cmd = object_cmds.CreateObject(self.app, None) @@ -65,7 +65,7 @@ class TestObjectList(TestObjectAll): columns = ('Name',) def setUp(self): - super(TestObjectList, self).setUp() + super().setUp() # Get the command object to test self.cmd = object_cmds.ListObject(self.app, None) @@ -140,7 +140,7 @@ def test_object_list_objects_prefix(self): class TestObjectShow(TestObjectAll): def setUp(self): - super(TestObjectShow, self).setUp() + super().setUp() # Get the command object to test self.cmd = object_cmds.ShowObject(self.app, None) @@ -208,7 +208,7 @@ def test_object_show(self): class TestObjectSave(TestObjectAll): def setUp(self): - super(TestObjectSave, self).setUp() + super().setUp() # Get the command object to test self.cmd = object_cmds.SaveObject(self.app, None) diff --git a/openstackclient/tests/unit/test_shell.py b/openstackclient/tests/unit/test_shell.py index 5d4bc6a83..fd95fce61 100644 --- a/openstackclient/tests/unit/test_shell.py +++ b/openstackclient/tests/unit/test_shell.py @@ -142,7 +142,7 @@ class TestShell(osc_lib_test_utils.TestShell): shell_class_name = "openstackclient.shell.OpenStackShell" def setUp(self): - super(TestShell, self).setUp() + super().setUp() # TODO(dtroyer): remove this once the shell_class_patch patch is # released in osc-lib mod_str, _sep, class_str = self.shell_class_name.rpartition('.') @@ -228,7 +228,7 @@ def _assert_cli(self, cmd_options, default_args): class TestShellOptions(TestShell): def setUp(self): - super(TestShellOptions, self).setUp() + super().setUp() self.useFixture(osc_lib_test_utils.EnvFixture()) def _test_options_init_app(self, test_opts): @@ -290,7 +290,7 @@ def _test_env_get_one_cloud(self, test_opts): class TestShellTokenAuthEnv(TestShell): def setUp(self): - super(TestShellTokenAuthEnv, self).setUp() + super().setUp() env = { "OS_TOKEN": DEFAULT_TOKEN, "OS_AUTH_URL": DEFAULT_AUTH_URL, @@ -333,7 +333,7 @@ def test_empty_auth(self): class TestShellTokenEndpointAuthEnv(TestShell): def setUp(self): - super(TestShellTokenEndpointAuthEnv, self).setUp() + super().setUp() env = { "OS_TOKEN": DEFAULT_TOKEN, "OS_ENDPOINT": DEFAULT_SERVICE_URL, @@ -376,7 +376,7 @@ def test_empty_auth(self): class TestShellCli(TestShell): def setUp(self): - super(TestShellCli, self).setUp() + super().setUp() env = { "OS_COMPUTE_API_VERSION": DEFAULT_COMPUTE_API_VERSION, "OS_IDENTITY_API_VERSION": DEFAULT_IDENTITY_API_VERSION, diff --git a/openstackclient/tests/unit/utils.py b/openstackclient/tests/unit/utils.py index daba426ec..df7341f0f 100644 --- a/openstackclient/tests/unit/utils.py +++ b/openstackclient/tests/unit/utils.py @@ -67,7 +67,7 @@ class TestCommand(TestCase): """Test cliff command classes""" def setUp(self): - super(TestCommand, self).setUp() + super().setUp() # Build up a fake app self.fake_stdout = fakes.FakeStdout() self.fake_log = fakes.FakeLog() diff --git a/openstackclient/tests/unit/volume/test_find_resource.py b/openstackclient/tests/unit/volume/test_find_resource.py index e1514b015..df087dd5d 100644 --- a/openstackclient/tests/unit/volume/test_find_resource.py +++ b/openstackclient/tests/unit/volume/test_find_resource.py @@ -37,7 +37,7 @@ class TestFindResourceVolumes(test_utils.TestCase): def setUp(self): - super(TestFindResourceVolumes, self).setUp() + super().setUp() api = mock.Mock() api.client = mock.Mock() api.client.get = mock.Mock() @@ -62,7 +62,7 @@ def test_not_find(self): class TestFindResourceVolumeSnapshots(test_utils.TestCase): def setUp(self): - super(TestFindResourceVolumeSnapshots, self).setUp() + super().setUp() api = mock.Mock() api.client = mock.Mock() api.client.get = mock.Mock() diff --git a/openstackclient/tests/unit/volume/v1/test_volume.py b/openstackclient/tests/unit/volume/v1/test_volume.py index 6e3a5cdd8..0f0d532dd 100644 --- a/openstackclient/tests/unit/volume/v1/test_volume.py +++ b/openstackclient/tests/unit/volume/v1/test_volume.py @@ -1425,7 +1425,8 @@ def test_attachments_column_without_server_cache(self): col = volume.AttachmentsColumn(_volume.attachments, {}) self.assertEqual( - 'Attached to %s on %s ' % (server_id, device), col.human_readable() + f'Attached to {server_id} on {device} ', + col.human_readable(), ) self.assertEqual(_volume.attachments, col.machine_readable()) @@ -1440,7 +1441,7 @@ def test_attachments_column_with_server_cache(self): col = volume.AttachmentsColumn(_volume.attachments, server_cache) self.assertEqual( - 'Attached to %s on %s ' % ('fake-server-name', device), + 'Attached to {} on {} '.format('fake-server-name', device), col.human_readable(), ) self.assertEqual(_volume.attachments, col.machine_readable()) diff --git a/openstackclient/tests/unit/volume/v2/fakes.py b/openstackclient/tests/unit/volume/v2/fakes.py index 00e7618c7..975a6a717 100644 --- a/openstackclient/tests/unit/volume/v2/fakes.py +++ b/openstackclient/tests/unit/volume/v2/fakes.py @@ -1085,7 +1085,7 @@ def create_one_detailed_quota(attrs=None): return quota -class FakeLimits(object): +class FakeLimits: """Fake limits""" def __init__(self, absolute_attrs=None): @@ -1176,7 +1176,7 @@ def rate_limits(self): return reference_data -class FakeAbsoluteLimit(object): +class FakeAbsoluteLimit: """Data model that represents an absolute limit.""" def __init__(self, name, value): @@ -1184,7 +1184,7 @@ def __init__(self, name, value): self.value = value -class FakeRateLimit(object): +class FakeRateLimit: """Data model that represents a flattened view of a single rate limit.""" def __init__(self, verb, uri, value, remain, unit, next_available): diff --git a/openstackclient/tests/unit/volume/v2/test_consistency_group_snapshot.py b/openstackclient/tests/unit/volume/v2/test_consistency_group_snapshot.py index 6580ac1f7..5a5b9c005 100644 --- a/openstackclient/tests/unit/volume/v2/test_consistency_group_snapshot.py +++ b/openstackclient/tests/unit/volume/v2/test_consistency_group_snapshot.py @@ -20,7 +20,7 @@ class TestConsistencyGroupSnapshot(volume_fakes.TestVolume): def setUp(self): - super(TestConsistencyGroupSnapshot, self).setUp() + super().setUp() # Get a shortcut to the TransferManager Mock self.cgsnapshots_mock = self.volume_client.cgsnapshots @@ -53,7 +53,7 @@ class TestConsistencyGroupSnapshotCreate(TestConsistencyGroupSnapshot): ) def setUp(self): - super(TestConsistencyGroupSnapshotCreate, self).setUp() + super().setUp() self.cgsnapshots_mock.create.return_value = ( self._consistency_group_snapshot ) @@ -126,7 +126,7 @@ class TestConsistencyGroupSnapshotDelete(TestConsistencyGroupSnapshot): ) def setUp(self): - super(TestConsistencyGroupSnapshotDelete, self).setUp() + super().setUp() self.cgsnapshots_mock.get = ( volume_fakes.get_consistency_group_snapshots( @@ -217,7 +217,7 @@ class TestConsistencyGroupSnapshotList(TestConsistencyGroupSnapshot): ) def setUp(self): - super(TestConsistencyGroupSnapshotList, self).setUp() + super().setUp() self.cgsnapshots_mock.list.return_value = ( self.consistency_group_snapshots @@ -332,7 +332,7 @@ class TestConsistencyGroupSnapshotShow(TestConsistencyGroupSnapshot): ) def setUp(self): - super(TestConsistencyGroupSnapshotShow, self).setUp() + super().setUp() self.cgsnapshots_mock.get.return_value = ( self._consistency_group_snapshot diff --git a/openstackclient/tests/unit/volume/v2/test_qos_specs.py b/openstackclient/tests/unit/volume/v2/test_qos_specs.py index 950012416..50c7419f1 100644 --- a/openstackclient/tests/unit/volume/v2/test_qos_specs.py +++ b/openstackclient/tests/unit/volume/v2/test_qos_specs.py @@ -27,7 +27,7 @@ class TestQos(volume_fakes.TestVolume): def setUp(self): - super(TestQos, self).setUp() + super().setUp() self.qos_mock = self.volume_client.qos_specs self.qos_mock.reset_mock() @@ -41,7 +41,7 @@ class TestQosAssociate(TestQos): qos_spec = volume_fakes.create_one_qos() def setUp(self): - super(TestQosAssociate, self).setUp() + super().setUp() self.qos_mock.get.return_value = self.qos_spec self.types_mock.get.return_value = self.volume_type @@ -68,7 +68,7 @@ class TestQosCreate(TestQos): columns = ('consumer', 'id', 'name', 'properties') def setUp(self): - super(TestQosCreate, self).setUp() + super().setUp() self.new_qos_spec = volume_fakes.create_one_qos() self.qos_mock.create.return_value = self.new_qos_spec @@ -158,7 +158,7 @@ class TestQosDelete(TestQos): qos_specs = volume_fakes.create_qoses(count=2) def setUp(self): - super(TestQosDelete, self).setUp() + super().setUp() self.qos_mock.get = volume_fakes.get_qoses(self.qos_specs) # Get the command object to test @@ -238,7 +238,7 @@ class TestQosDisassociate(TestQos): qos_spec = volume_fakes.create_one_qos() def setUp(self): - super(TestQosDisassociate, self).setUp() + super().setUp() self.qos_mock.get.return_value = self.qos_spec self.types_mock.get.return_value = self.volume_type @@ -302,7 +302,7 @@ class TestQosList(TestQos): ) def setUp(self): - super(TestQosList, self).setUp() + super().setUp() self.qos_mock.list.return_value = self.qos_specs self.qos_mock.get_associations.return_value = [self.qos_association] @@ -354,7 +354,7 @@ class TestQosSet(TestQos): qos_spec = volume_fakes.create_one_qos() def setUp(self): - super(TestQosSet, self).setUp() + super().setUp() self.qos_mock.get.return_value = self.qos_spec # Get the command object to test @@ -403,7 +403,7 @@ class TestQosShow(TestQos): ) def setUp(self): - super(TestQosShow, self).setUp() + super().setUp() self.qos_mock.get.return_value = self.qos_spec self.qos_mock.get_associations.return_value = [self.qos_association] @@ -428,7 +428,7 @@ class TestQosUnset(TestQos): qos_spec = volume_fakes.create_one_qos() def setUp(self): - super(TestQosUnset, self).setUp() + super().setUp() self.qos_mock.get.return_value = self.qos_spec # Get the command object to test diff --git a/openstackclient/tests/unit/volume/v2/test_volume.py b/openstackclient/tests/unit/volume/v2/test_volume.py index 130bf7003..0176994b6 100644 --- a/openstackclient/tests/unit/volume/v2/test_volume.py +++ b/openstackclient/tests/unit/volume/v2/test_volume.py @@ -1825,7 +1825,8 @@ def test_attachments_column_without_server_cache(self): col = volume.AttachmentsColumn(_volume.attachments, {}) self.assertEqual( - 'Attached to %s on %s ' % (server_id, device), col.human_readable() + f'Attached to {server_id} on {device} ', + col.human_readable(), ) self.assertEqual(_volume.attachments, col.machine_readable()) @@ -1840,7 +1841,7 @@ def test_attachments_column_with_server_cache(self): col = volume.AttachmentsColumn(_volume.attachments, server_cache) self.assertEqual( - 'Attached to %s on %s ' % ('fake-server-name', device), + 'Attached to {} on {} '.format('fake-server-name', device), col.human_readable(), ) self.assertEqual(_volume.attachments, col.machine_readable()) diff --git a/openstackclient/volume/v1/qos_specs.py b/openstackclient/volume/v1/qos_specs.py index 830d5d827..74938392e 100644 --- a/openstackclient/volume/v1/qos_specs.py +++ b/openstackclient/volume/v1/qos_specs.py @@ -33,7 +33,7 @@ class AssociateQos(command.Command): _description = _("Associate a QoS specification to a volume type") def get_parser(self, prog_name): - parser = super(AssociateQos, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'qos_spec', metavar='', @@ -62,7 +62,7 @@ class CreateQos(command.ShowOne): _description = _("Create new QoS specification") def get_parser(self, prog_name): - parser = super(CreateQos, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar='', @@ -116,7 +116,7 @@ class DeleteQos(command.Command): _description = _("Delete QoS specification") def get_parser(self, prog_name): - parser = super(DeleteQos, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'qos_specs', metavar='', @@ -162,7 +162,7 @@ class DisassociateQos(command.Command): _description = _("Disassociate a QoS specification from a volume type") def get_parser(self, prog_name): - parser = super(DisassociateQos, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'qos_spec', metavar='', @@ -249,7 +249,7 @@ class SetQos(command.Command): _description = _("Set QoS specification properties") def get_parser(self, prog_name): - parser = super(SetQos, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'qos_spec', metavar='', @@ -311,7 +311,7 @@ class ShowQos(command.ShowOne): _description = _("Display QoS specification details") def get_parser(self, prog_name): - parser = super(ShowQos, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'qos_spec', metavar='', @@ -348,7 +348,7 @@ class UnsetQos(command.Command): _description = _("Unset QoS specification properties") def get_parser(self, prog_name): - parser = super(UnsetQos, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'qos_spec', metavar='', diff --git a/openstackclient/volume/v1/service.py b/openstackclient/volume/v1/service.py index fb5869d51..2a33fc0b9 100644 --- a/openstackclient/volume/v1/service.py +++ b/openstackclient/volume/v1/service.py @@ -25,7 +25,7 @@ class ListService(command.Lister): _description = _("List service command") def get_parser(self, prog_name): - parser = super(ListService, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "--host", metavar="", @@ -86,7 +86,7 @@ class SetService(command.Command): _description = _("Set volume service properties") def get_parser(self, prog_name): - parser = super(SetService, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument("host", metavar="", help=_("Name of host")) parser.add_argument( "service", diff --git a/openstackclient/volume/v1/volume.py b/openstackclient/volume/v1/volume.py index 0248642b0..3f1eea16b 100644 --- a/openstackclient/volume/v1/volume.py +++ b/openstackclient/volume/v1/volume.py @@ -45,7 +45,7 @@ class takes server_cache as the second argument. """ def __init__(self, value, server_cache=None): - super(AttachmentsColumn, self).__init__(value) + super().__init__(value) self._server_cache = server_cache or {} def human_readable(self): @@ -60,7 +60,7 @@ def human_readable(self): if server in self._server_cache.keys(): server = self._server_cache[server].name device = attachment['device'] - msg += 'Attached to %s on %s ' % (server, device) + msg += f'Attached to {server} on {device} ' return msg @@ -83,7 +83,7 @@ class CreateVolume(command.ShowOne): _description = _("Create new volume") def get_parser(self, prog_name): - parser = super(CreateVolume, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar='', @@ -298,7 +298,7 @@ class DeleteVolume(command.Command): _description = _("Delete volume(s)") def get_parser(self, prog_name): - parser = super(DeleteVolume, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'volumes', metavar='', @@ -350,7 +350,7 @@ class ListVolume(command.Lister): _description = _("List volumes") def get_parser(self, prog_name): - parser = super(ListVolume, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--name', metavar='', @@ -466,7 +466,7 @@ class MigrateVolume(command.Command): _description = _("Migrate volume to a new host") def get_parser(self, prog_name): - parser = super(MigrateVolume, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'volume', metavar="", @@ -504,7 +504,7 @@ class SetVolume(command.Command): _description = _("Set volume properties") def get_parser(self, prog_name): - parser = super(SetVolume, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'volume', metavar='', @@ -663,7 +663,7 @@ class ShowVolume(command.ShowOne): _description = _("Show volume details") def get_parser(self, prog_name): - parser = super(ShowVolume, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'volume', metavar='', @@ -706,7 +706,7 @@ class UnsetVolume(command.Command): _description = _("Unset volume properties") def get_parser(self, prog_name): - parser = super(UnsetVolume, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'volume', metavar='', diff --git a/openstackclient/volume/v1/volume_backup.py b/openstackclient/volume/v1/volume_backup.py index c90dec195..99d583809 100644 --- a/openstackclient/volume/v1/volume_backup.py +++ b/openstackclient/volume/v1/volume_backup.py @@ -42,7 +42,7 @@ class takes volume_cache as the second argument. """ def __init__(self, value, volume_cache=None): - super(VolumeIdColumn, self).__init__(value) + super().__init__(value) self._volume_cache = volume_cache or {} def human_readable(self): @@ -61,7 +61,7 @@ class CreateVolumeBackup(command.ShowOne): _description = _("Create new volume backup") def get_parser(self, prog_name): - parser = super(CreateVolumeBackup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'volume', metavar='', @@ -105,7 +105,7 @@ class DeleteVolumeBackup(command.Command): _description = _("Delete volume backup(s)") def get_parser(self, prog_name): - parser = super(DeleteVolumeBackup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'backups', metavar='', @@ -145,7 +145,7 @@ class ListVolumeBackup(command.Lister): _description = _("List volume backups") def get_parser(self, prog_name): - parser = super(ListVolumeBackup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--long', action='store_true', @@ -254,7 +254,7 @@ class RestoreVolumeBackup(command.Command): _description = _("Restore volume backup") def get_parser(self, prog_name): - parser = super(RestoreVolumeBackup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'backup', metavar='', @@ -287,7 +287,7 @@ class ShowVolumeBackup(command.ShowOne): _description = _("Display volume backup details") def get_parser(self, prog_name): - parser = super(ShowVolumeBackup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'backup', metavar='', diff --git a/openstackclient/volume/v1/volume_snapshot.py b/openstackclient/volume/v1/volume_snapshot.py index fd4bb774a..18d8c3d62 100644 --- a/openstackclient/volume/v1/volume_snapshot.py +++ b/openstackclient/volume/v1/volume_snapshot.py @@ -44,7 +44,7 @@ class takes volume_cache as the second argument. """ def __init__(self, value, volume_cache=None): - super(VolumeIdColumn, self).__init__(value) + super().__init__(value) self._volume_cache = volume_cache or {} def human_readable(self): @@ -63,7 +63,7 @@ class CreateVolumeSnapshot(command.ShowOne): _description = _("Create new volume snapshot") def get_parser(self, prog_name): - parser = super(CreateVolumeSnapshot, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'snapshot_name', metavar='', @@ -122,7 +122,7 @@ class DeleteVolumeSnapshot(command.Command): _description = _("Delete volume snapshot(s)") def get_parser(self, prog_name): - parser = super(DeleteVolumeSnapshot, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'snapshots', metavar='', @@ -163,7 +163,7 @@ class ListVolumeSnapshot(command.Lister): _description = _("List volume snapshots") def get_parser(self, prog_name): - parser = super(ListVolumeSnapshot, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--all-projects', action='store_true', @@ -283,7 +283,7 @@ class SetVolumeSnapshot(command.Command): _description = _("Set volume snapshot properties") def get_parser(self, prog_name): - parser = super(SetVolumeSnapshot, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'snapshot', metavar='', @@ -374,7 +374,7 @@ class ShowVolumeSnapshot(command.ShowOne): _description = _("Display volume snapshot details") def get_parser(self, prog_name): - parser = super(ShowVolumeSnapshot, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'snapshot', metavar='', @@ -403,7 +403,7 @@ class UnsetVolumeSnapshot(command.Command): _description = _("Unset volume snapshot properties") def get_parser(self, prog_name): - parser = super(UnsetVolumeSnapshot, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'snapshot', metavar='', diff --git a/openstackclient/volume/v1/volume_transfer_request.py b/openstackclient/volume/v1/volume_transfer_request.py index a1b8c0c4e..d82584dc7 100644 --- a/openstackclient/volume/v1/volume_transfer_request.py +++ b/openstackclient/volume/v1/volume_transfer_request.py @@ -30,7 +30,7 @@ class AcceptTransferRequest(command.ShowOne): _description = _("Accept volume transfer request.") def get_parser(self, prog_name): - parser = super(AcceptTransferRequest, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'transfer_request', metavar="", @@ -72,7 +72,7 @@ class CreateTransferRequest(command.ShowOne): _description = _("Create volume transfer request.") def get_parser(self, prog_name): - parser = super(CreateTransferRequest, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--name', metavar="", @@ -104,7 +104,7 @@ class DeleteTransferRequest(command.Command): _description = _("Delete volume transfer request(s).") def get_parser(self, prog_name): - parser = super(DeleteTransferRequest, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'transfer_request', metavar="", @@ -147,7 +147,7 @@ class ListTransferRequest(command.Lister): _description = _("Lists all volume transfer requests.") def get_parser(self, prog_name): - parser = super(ListTransferRequest, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--all-projects', dest='all_projects', @@ -181,7 +181,7 @@ class ShowTransferRequest(command.ShowOne): _description = _("Show volume transfer request details.") def get_parser(self, prog_name): - parser = super(ShowTransferRequest, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'transfer_request', metavar="", diff --git a/openstackclient/volume/v1/volume_type.py b/openstackclient/volume/v1/volume_type.py index 38fd82971..fed0a601f 100644 --- a/openstackclient/volume/v1/volume_type.py +++ b/openstackclient/volume/v1/volume_type.py @@ -43,7 +43,7 @@ class takes encryption_data as the second argument. """ def __init__(self, value, encryption_data=None): - super(EncryptionInfoColumn, self).__init__(value) + super().__init__(value) self._encryption_data = encryption_data or {} def _get_encryption_info(self): @@ -88,7 +88,7 @@ class CreateVolumeType(command.ShowOne): _description = _("Create new volume type") def get_parser(self, prog_name): - parser = super(CreateVolumeType, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar='', @@ -191,7 +191,7 @@ class DeleteVolumeType(command.Command): _description = _("Delete volume type(s)") def get_parser(self, prog_name): - parser = super(DeleteVolumeType, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'volume_types', metavar='', @@ -233,7 +233,7 @@ class ListVolumeType(command.Lister): _description = _("List volume types") def get_parser(self, prog_name): - parser = super(ListVolumeType, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--long', action='store_true', @@ -306,7 +306,7 @@ class SetVolumeType(command.Command): _description = _("Set volume type properties") def get_parser(self, prog_name): - parser = super(SetVolumeType, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'volume_type', metavar='', @@ -411,7 +411,7 @@ class ShowVolumeType(command.ShowOne): _description = _("Display volume type details") def get_parser(self, prog_name): - parser = super(ShowVolumeType, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "volume_type", metavar="", @@ -462,7 +462,7 @@ class UnsetVolumeType(command.Command): _description = _("Unset volume type properties") def get_parser(self, prog_name): - parser = super(UnsetVolumeType, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'volume_type', metavar='', diff --git a/openstackclient/volume/v2/backup_record.py b/openstackclient/volume/v2/backup_record.py index be4b9c692..98f7c7171 100644 --- a/openstackclient/volume/v2/backup_record.py +++ b/openstackclient/volume/v2/backup_record.py @@ -34,7 +34,7 @@ class ExportBackupRecord(command.ShowOne): ) def get_parser(self, prog_name): - parser = super(ExportBackupRecord, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "backup", metavar="", @@ -65,7 +65,7 @@ class ImportBackupRecord(command.ShowOne): ) def get_parser(self, prog_name): - parser = super(ImportBackupRecord, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "backup_service", metavar="", diff --git a/openstackclient/volume/v2/consistency_group.py b/openstackclient/volume/v2/consistency_group.py index 3b4d88033..ee17acc53 100644 --- a/openstackclient/volume/v2/consistency_group.py +++ b/openstackclient/volume/v2/consistency_group.py @@ -52,7 +52,7 @@ class AddVolumeToConsistencyGroup(command.Command): _description = _("Add volume(s) to consistency group") def get_parser(self, prog_name): - parser = super(AddVolumeToConsistencyGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'consistency_group', metavar="", @@ -94,7 +94,7 @@ class CreateConsistencyGroup(command.ShowOne): _description = _("Create new consistency group.") def get_parser(self, prog_name): - parser = super(CreateConsistencyGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "name", metavar="", @@ -196,7 +196,7 @@ class DeleteConsistencyGroup(command.Command): _description = _("Delete consistency group(s).") def get_parser(self, prog_name): - parser = super(DeleteConsistencyGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'consistency_groups', metavar='', @@ -246,7 +246,7 @@ class ListConsistencyGroup(command.Lister): _description = _("List consistency groups.") def get_parser(self, prog_name): - parser = super(ListConsistencyGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--all-projects', action="store_true", @@ -297,9 +297,7 @@ class RemoveVolumeFromConsistencyGroup(command.Command): _description = _("Remove volume(s) from consistency group") def get_parser(self, prog_name): - parser = super(RemoveVolumeFromConsistencyGroup, self).get_parser( - prog_name - ) + parser = super().get_parser(prog_name) parser.add_argument( 'consistency_group', metavar="", @@ -341,7 +339,7 @@ class SetConsistencyGroup(command.Command): _description = _("Set consistency group properties") def get_parser(self, prog_name): - parser = super(SetConsistencyGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'consistency_group', metavar='', @@ -379,7 +377,7 @@ class ShowConsistencyGroup(command.ShowOne): _description = _("Display consistency group details.") def get_parser(self, prog_name): - parser = super(ShowConsistencyGroup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "consistency_group", metavar="", diff --git a/openstackclient/volume/v2/consistency_group_snapshot.py b/openstackclient/volume/v2/consistency_group_snapshot.py index fe3c569f2..220d4f7f0 100644 --- a/openstackclient/volume/v2/consistency_group_snapshot.py +++ b/openstackclient/volume/v2/consistency_group_snapshot.py @@ -30,9 +30,7 @@ class CreateConsistencyGroupSnapshot(command.ShowOne): _description = _("Create new consistency group snapshot.") def get_parser(self, prog_name): - parser = super(CreateConsistencyGroupSnapshot, self).get_parser( - prog_name - ) + parser = super().get_parser(prog_name) parser.add_argument( "snapshot_name", metavar="", @@ -77,9 +75,7 @@ class DeleteConsistencyGroupSnapshot(command.Command): _description = _("Delete consistency group snapshot(s).") def get_parser(self, prog_name): - parser = super(DeleteConsistencyGroupSnapshot, self).get_parser( - prog_name - ) + parser = super().get_parser(prog_name) parser.add_argument( "consistency_group_snapshot", metavar="", @@ -122,9 +118,7 @@ class ListConsistencyGroupSnapshot(command.Lister): _description = _("List consistency group snapshots.") def get_parser(self, prog_name): - parser = super(ListConsistencyGroupSnapshot, self).get_parser( - prog_name - ) + parser = super().get_parser(prog_name) parser.add_argument( '--all-projects', action="store_true", @@ -202,9 +196,7 @@ class ShowConsistencyGroupSnapshot(command.ShowOne): _description = _("Display consistency group snapshot details") def get_parser(self, prog_name): - parser = super(ShowConsistencyGroupSnapshot, self).get_parser( - prog_name - ) + parser = super().get_parser(prog_name) parser.add_argument( "consistency_group_snapshot", metavar="", diff --git a/openstackclient/volume/v2/qos_specs.py b/openstackclient/volume/v2/qos_specs.py index 0454ecae8..fa6cec494 100644 --- a/openstackclient/volume/v2/qos_specs.py +++ b/openstackclient/volume/v2/qos_specs.py @@ -33,7 +33,7 @@ class AssociateQos(command.Command): _description = _("Associate a QoS specification to a volume type") def get_parser(self, prog_name): - parser = super(AssociateQos, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'qos_spec', metavar='', @@ -62,7 +62,7 @@ class CreateQos(command.ShowOne): _description = _("Create new QoS specification") def get_parser(self, prog_name): - parser = super(CreateQos, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'name', metavar='', @@ -117,7 +117,7 @@ class DeleteQos(command.Command): _description = _("Delete QoS specification") def get_parser(self, prog_name): - parser = super(DeleteQos, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'qos_specs', metavar='', @@ -163,7 +163,7 @@ class DisassociateQos(command.Command): _description = _("Disassociate a QoS specification from a volume type") def get_parser(self, prog_name): - parser = super(DisassociateQos, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'qos_spec', metavar='', @@ -251,7 +251,7 @@ class SetQos(command.Command): _description = _("Set QoS specification properties") def get_parser(self, prog_name): - parser = super(SetQos, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'qos_spec', metavar='', @@ -313,7 +313,7 @@ class ShowQos(command.ShowOne): _description = _("Display QoS specification details") def get_parser(self, prog_name): - parser = super(ShowQos, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'qos_spec', metavar='', @@ -350,7 +350,7 @@ class UnsetQos(command.Command): _description = _("Unset QoS specification properties") def get_parser(self, prog_name): - parser = super(UnsetQos, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'qos_spec', metavar='', diff --git a/openstackclient/volume/v2/service.py b/openstackclient/volume/v2/service.py index fb5869d51..2a33fc0b9 100644 --- a/openstackclient/volume/v2/service.py +++ b/openstackclient/volume/v2/service.py @@ -25,7 +25,7 @@ class ListService(command.Lister): _description = _("List service command") def get_parser(self, prog_name): - parser = super(ListService, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "--host", metavar="", @@ -86,7 +86,7 @@ class SetService(command.Command): _description = _("Set volume service properties") def get_parser(self, prog_name): - parser = super(SetService, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument("host", metavar="", help=_("Name of host")) parser.add_argument( "service", diff --git a/openstackclient/volume/v2/volume.py b/openstackclient/volume/v2/volume.py index 98f4a5cab..623a943b5 100644 --- a/openstackclient/volume/v2/volume.py +++ b/openstackclient/volume/v2/volume.py @@ -69,7 +69,7 @@ class takes server_cache as the second argument. """ def __init__(self, value, server_cache=None): - super(AttachmentsColumn, self).__init__(value) + super().__init__(value) self._server_cache = server_cache or {} def human_readable(self): @@ -84,7 +84,7 @@ def human_readable(self): if server in self._server_cache.keys(): server = self._server_cache[server].name device = attachment['device'] - msg += 'Attached to %s on %s ' % (server, device) + msg += f'Attached to {server} on {device} ' return msg @@ -360,7 +360,7 @@ class DeleteVolume(command.Command): _description = _("Delete volume(s)") def get_parser(self, prog_name): - parser = super(DeleteVolume, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "volumes", metavar="", @@ -422,7 +422,7 @@ class ListVolume(command.Lister): _description = _("List volumes") def get_parser(self, prog_name): - parser = super(ListVolume, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--project', metavar='', @@ -566,7 +566,7 @@ class MigrateVolume(command.Command): _description = _("Migrate volume to a new host") def get_parser(self, prog_name): - parser = super(MigrateVolume, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'volume', metavar="", @@ -614,7 +614,7 @@ class SetVolume(command.Command): _description = _("Set volume properties") def get_parser(self, prog_name): - parser = super(SetVolume, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'volume', metavar='', @@ -920,7 +920,7 @@ class ShowVolume(command.ShowOne): _description = _("Display volume details") def get_parser(self, prog_name): - parser = super(ShowVolume, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'volume', metavar="", @@ -953,7 +953,7 @@ class UnsetVolume(command.Command): _description = _("Unset volume properties") def get_parser(self, prog_name): - parser = super(UnsetVolume, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'volume', metavar='', diff --git a/openstackclient/volume/v2/volume_backend.py b/openstackclient/volume/v2/volume_backend.py index a0125032c..2fbbed64a 100644 --- a/openstackclient/volume/v2/volume_backend.py +++ b/openstackclient/volume/v2/volume_backend.py @@ -25,7 +25,7 @@ class ShowCapability(command.Lister): _description = _("Show capability command") def get_parser(self, prog_name): - parser = super(ShowCapability, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "host", metavar="", @@ -72,7 +72,7 @@ class ListPool(command.Lister): _description = _("List pool command") def get_parser(self, prog_name): - parser = super(ListPool, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "--long", action="store_true", diff --git a/openstackclient/volume/v2/volume_backup.py b/openstackclient/volume/v2/volume_backup.py index 4454d17b0..7eed05a1d 100644 --- a/openstackclient/volume/v2/volume_backup.py +++ b/openstackclient/volume/v2/volume_backup.py @@ -44,7 +44,7 @@ class takes volume_cache as the second argument. """ def __init__(self, value, volume_cache=None): - super(VolumeIdColumn, self).__init__(value) + super().__init__(value) self._volume_cache = volume_cache or {} def human_readable(self): @@ -184,7 +184,7 @@ class DeleteVolumeBackup(command.Command): _description = _("Delete volume backup(s)") def get_parser(self, prog_name): - parser = super(DeleteVolumeBackup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "backups", metavar="", @@ -236,7 +236,7 @@ class ListVolumeBackup(command.Lister): _description = _("List volume backups") def get_parser(self, prog_name): - parser = super(ListVolumeBackup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "--long", action="store_true", @@ -381,7 +381,7 @@ class RestoreVolumeBackup(command.ShowOne): _description = _("Restore volume backup") def get_parser(self, prog_name): - parser = super(RestoreVolumeBackup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "backup", metavar="", @@ -633,7 +633,7 @@ class ShowVolumeBackup(command.ShowOne): _description = _("Display volume backup details") def get_parser(self, prog_name): - parser = super(ShowVolumeBackup, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "backup", metavar="", diff --git a/openstackclient/volume/v2/volume_host.py b/openstackclient/volume/v2/volume_host.py index df93c0590..2b0df0aa2 100644 --- a/openstackclient/volume/v2/volume_host.py +++ b/openstackclient/volume/v2/volume_host.py @@ -23,7 +23,7 @@ class FailoverVolumeHost(command.Command): _description = _("Failover volume host to different backend") def get_parser(self, prog_name): - parser = super(FailoverVolumeHost, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "host", metavar="", help=_("Name of volume host") ) @@ -49,7 +49,7 @@ class SetVolumeHost(command.Command): _description = _("Set volume host properties") def get_parser(self, prog_name): - parser = super(SetVolumeHost, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "host", metavar="", help=_("Name of volume host") ) diff --git a/openstackclient/volume/v2/volume_snapshot.py b/openstackclient/volume/v2/volume_snapshot.py index 93560f53c..3398f502a 100644 --- a/openstackclient/volume/v2/volume_snapshot.py +++ b/openstackclient/volume/v2/volume_snapshot.py @@ -45,7 +45,7 @@ class takes volume_cache as the second argument. """ def __init__(self, value, volume_cache=None): - super(VolumeIdColumn, self).__init__(value) + super().__init__(value) self._volume_cache = volume_cache or {} def human_readable(self): @@ -64,7 +64,7 @@ class CreateVolumeSnapshot(command.ShowOne): _description = _("Create new volume snapshot") def get_parser(self, prog_name): - parser = super(CreateVolumeSnapshot, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "snapshot_name", metavar="", @@ -159,7 +159,7 @@ class DeleteVolumeSnapshot(command.Command): _description = _("Delete volume snapshot(s)") def get_parser(self, prog_name): - parser = super(DeleteVolumeSnapshot, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "snapshots", metavar="", @@ -210,7 +210,7 @@ class ListVolumeSnapshot(command.Lister): _description = _("List volume snapshots") def get_parser(self, prog_name): - parser = super(ListVolumeSnapshot, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--all-projects', action='store_true', @@ -346,7 +346,7 @@ class SetVolumeSnapshot(command.Command): _description = _("Set volume snapshot properties") def get_parser(self, prog_name): - parser = super(SetVolumeSnapshot, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'snapshot', metavar='', @@ -461,7 +461,7 @@ class ShowVolumeSnapshot(command.ShowOne): _description = _("Display volume snapshot details") def get_parser(self, prog_name): - parser = super(ShowVolumeSnapshot, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "snapshot", metavar="", @@ -488,7 +488,7 @@ class UnsetVolumeSnapshot(command.Command): _description = _("Unset volume snapshot properties") def get_parser(self, prog_name): - parser = super(UnsetVolumeSnapshot, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'snapshot', metavar='', diff --git a/openstackclient/volume/v2/volume_transfer_request.py b/openstackclient/volume/v2/volume_transfer_request.py index e25770e30..d531efc6b 100644 --- a/openstackclient/volume/v2/volume_transfer_request.py +++ b/openstackclient/volume/v2/volume_transfer_request.py @@ -31,7 +31,7 @@ class AcceptTransferRequest(command.ShowOne): _description = _("Accept volume transfer request.") def get_parser(self, prog_name): - parser = super(AcceptTransferRequest, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'transfer_request', metavar="", @@ -70,7 +70,7 @@ class CreateTransferRequest(command.ShowOne): _description = _("Create volume transfer request.") def get_parser(self, prog_name): - parser = super(CreateTransferRequest, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--name', metavar="", @@ -137,7 +137,7 @@ class DeleteTransferRequest(command.Command): _description = _("Delete volume transfer request(s).") def get_parser(self, prog_name): - parser = super(DeleteTransferRequest, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'transfer_request', metavar="", @@ -180,7 +180,7 @@ class ListTransferRequest(command.Lister): _description = _("Lists all volume transfer requests.") def get_parser(self, prog_name): - parser = super(ListTransferRequest, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--all-projects', dest='all_projects', @@ -214,7 +214,7 @@ class ShowTransferRequest(command.ShowOne): _description = _("Show volume transfer request details.") def get_parser(self, prog_name): - parser = super(ShowTransferRequest, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'transfer_request', metavar="", diff --git a/openstackclient/volume/v2/volume_type.py b/openstackclient/volume/v2/volume_type.py index 00821178c..c472a3c28 100644 --- a/openstackclient/volume/v2/volume_type.py +++ b/openstackclient/volume/v2/volume_type.py @@ -44,7 +44,7 @@ class takes encryption_data as the second argument. """ def __init__(self, value, encryption_data=None): - super(EncryptionInfoColumn, self).__init__(value) + super().__init__(value) self._encryption_data = encryption_data or {} def _get_encryption_info(self): @@ -110,7 +110,7 @@ class CreateVolumeType(command.ShowOne): _description = _("Create new volume type") def get_parser(self, prog_name): - parser = super(CreateVolumeType, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "name", metavar="", @@ -331,7 +331,7 @@ class DeleteVolumeType(command.Command): _description = _("Delete volume type(s)") def get_parser(self, prog_name): - parser = super(DeleteVolumeType, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "volume_types", metavar="", @@ -373,7 +373,7 @@ class ListVolumeType(command.Lister): _description = _("List volume types") def get_parser(self, prog_name): - parser = super(ListVolumeType, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( '--long', action='store_true', @@ -565,7 +565,7 @@ class SetVolumeType(command.Command): _description = _("Set volume type properties") def get_parser(self, prog_name): - parser = super(SetVolumeType, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'volume_type', metavar='', @@ -804,7 +804,7 @@ class ShowVolumeType(command.ShowOne): _description = _("Display volume type details") def get_parser(self, prog_name): - parser = super(ShowVolumeType, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( "volume_type", metavar="", @@ -875,7 +875,7 @@ class UnsetVolumeType(command.Command): _description = _("Unset volume type properties") def get_parser(self, prog_name): - parser = super(UnsetVolumeType, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'volume_type', metavar='', diff --git a/openstackclient/volume/v3/volume_message.py b/openstackclient/volume/v3/volume_message.py index 071a10d45..0fc724a58 100644 --- a/openstackclient/volume/v3/volume_message.py +++ b/openstackclient/volume/v3/volume_message.py @@ -133,7 +133,7 @@ class ShowMessage(command.ShowOne): _description = _('Show a volume failure message') def get_parser(self, prog_name): - parser = super(ShowMessage, self).get_parser(prog_name) + parser = super().get_parser(prog_name) parser.add_argument( 'message_id', metavar='', diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py index 2ad39ab62..fa48392f2 100644 --- a/releasenotes/source/conf.py +++ b/releasenotes/source/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at