From ec2530b975200c98ca93131725e62705f57badfd Mon Sep 17 00:00:00 2001 From: ricolin Date: Sun, 15 Nov 2015 23:16:35 +0800 Subject: [PATCH] Enable pep8 E128 test Enable E128 continuation line under-indented for visual indent Change-Id: If662f729e7aacdd439b38c5e5630d74afefebcc6 --- heatclient/shell.py | 105 ++++++++++++++++----------------- heatclient/tests/unit/fakes.py | 10 ++-- heatclient/v1/shell.py | 100 ++++++++++++++++--------------- tox.ini | 2 +- 4 files changed, 109 insertions(+), 108 deletions(-) diff --git a/heatclient/shell.py b/heatclient/shell.py index b3a3db7d..16353611 100644 --- a/heatclient/shell.py +++ b/heatclient/shell.py @@ -49,19 +49,19 @@ class HeatShell(object): # they should be provided by python-keystoneclient. We will need to # refactor this code once this functionality is avaible in # python-keystoneclient. - parser.add_argument('-k', '--insecure', - default=False, - action='store_true', - help=_('Explicitly allow heatclient to perform ' - '\"insecure SSL\" (https) requests. The server\'s ' - 'certificate will not be verified against any ' - 'certificate authorities. This option should ' - 'be used with caution.')) + parser.add_argument( + '-k', '--insecure', default=False, action='store_true', + help=_('Explicitly allow heatclient to perform ' + '\"insecure SSL\" (https) requests. ' + 'The server\'s certificate will not be verified ' + 'against any certificate authorities. ' + 'This option should be used with caution.')) - parser.add_argument('--os-cert', - help=_('Path of certificate file to use in SSL ' - 'connection. This file can optionally be ' - 'prepended with the private key.')) + parser.add_argument( + '--os-cert', + help=_('Path of certificate file to use in SSL connection. ' + 'This file can optionally be prepended with ' + 'the private key.')) # for backward compatibility only parser.add_argument('--cert-file', @@ -71,8 +71,9 @@ class HeatShell(object): parser.add_argument('--os-key', help=_('Path of client key to use in SSL ' - 'connection. This option is not necessary ' - 'if your key is prepended to your cert file.')) + 'connection. This option is not necessary ' + 'if your key is prepended to your cert ' + 'file.')) parser.add_argument('--key-file', dest='os_key', @@ -84,9 +85,9 @@ class HeatShell(object): dest='os_cacert', default=utils.env('OS_CACERT'), help=_('Path of CA TLS certificate(s) used to ' - 'verify the remote server\'s certificate. ' - 'Without this option glance looks for the ' - 'default system CA certificates.')) + 'verify the remote server\'s certificate. ' + 'Without this option glance looks for the ' + 'default system CA certificates.')) parser.add_argument('--ca-file', dest='os_cacert', @@ -290,7 +291,7 @@ class HeatShell(object): default=utils.env('OS_NO_CLIENT_AUTH'), action='store_true', help=(_("Do not contact keystone for a token. " - "Defaults to %(value)s.") % + "Defaults to %(value)s.") % {'value': 'env[OS_NO_CLIENT_AUTH]'})) parser.add_argument('--heat-url', @@ -334,17 +335,17 @@ class HeatShell(object): self._append_global_identity_args(parser) if osprofiler_profiler: - parser.add_argument('--profile', - metavar='HMAC_KEY', - help=_('HMAC key to use for encrypting ' - 'context data for performance profiling of ' - 'operation. This key should be the value of ' - 'HMAC key configured in osprofiler middleware ' - 'in heat, it is specified in the paste ' - 'configuration (/etc/heat/api-paste.ini). ' - 'Without the key, profiling will not be ' - 'triggered even if osprofiler is enabled ' - 'on server side.')) + parser.add_argument( + '--profile', + metavar='HMAC_KEY', + help=_('HMAC key to use for encrypting context data ' + 'for performance profiling of operation. ' + 'This key should be the value of HMAC key ' + 'configured in osprofiler middleware in heat, ' + 'it is specified in the paste configuration ' + '(/etc/heat/api-paste.ini). Without the key, ' + 'profiling will not be triggered ' + 'even if osprofiler is enabled on server side.')) return parser def get_subcommand_parser(self, version): @@ -546,23 +547,23 @@ class HeatShell(object): return 0 if not args.os_username and not args.os_auth_token: - raise exc.CommandError(_("You must provide a username via" - " either --os-username or env[OS_USERNAME]" - " or a token via --os-auth-token or" - " env[OS_AUTH_TOKEN]")) + raise exc.CommandError(_("You must provide a username via either " + "--os-username or env[OS_USERNAME] " + "or a token via --os-auth-token or " + "env[OS_AUTH_TOKEN]")) if not args.os_password and not args.os_auth_token: - raise exc.CommandError(_("You must provide a password via" - " either --os-password or env[OS_PASSWORD]" - " or a token via --os-auth-token or" - " env[OS_AUTH_TOKEN]")) + raise exc.CommandError(_("You must provide a password via either " + "--os-password or env[OS_PASSWORD] " + "or a token via --os-auth-token or " + "env[OS_AUTH_TOKEN]")) if args.os_no_client_auth: if not args.heat_url: - raise exc.CommandError(_("If you specify --os-no-client-auth" - " you must also specify a Heat API URL" - " via either --heat-url or" - " env[HEAT_URL]")) + raise exc.CommandError(_("If you specify --os-no-client-auth " + "you must also specify a Heat API " + "URL via either --heat-url or " + "env[HEAT_URL]")) else: # Tenant/project name or ID is needed to make keystoneclient # retrieve a service catalog, it's not required if @@ -570,20 +571,18 @@ class HeatShell(object): if not (args.os_tenant_id or args.os_tenant_name or args.os_project_id or args.os_project_name): - raise exc.CommandError(_("You must provide a tenant id via" - " either --os-tenant-id or" - " env[OS_TENANT_ID] or a tenant name" - " via either --os-tenant-name or" - " env[OS_TENANT_NAME] or a project id" - " via either --os-project-id or" - " env[OS_PROJECT_ID] or a project" - " name via either --os-project-name or" - " env[OS_PROJECT_NAME]")) + raise exc.CommandError( + _("You must provide a tenant id via either " + "--os-tenant-id or env[OS_TENANT_ID] or a tenant name " + "via either --os-tenant-name or env[OS_TENANT_NAME] " + "or a project id via either --os-project-id or " + "env[OS_PROJECT_ID] or a project name via " + "either --os-project-name or env[OS_PROJECT_NAME]")) if not args.os_auth_url: - raise exc.CommandError(_("You must provide an auth url via" - " either --os-auth-url or via" - " env[OS_AUTH_URL]")) + raise exc.CommandError(_("You must provide an auth url via " + "either --os-auth-url or via " + "env[OS_AUTH_URL]")) kwargs = { 'insecure': args.insecure, diff --git a/heatclient/tests/unit/fakes.py b/heatclient/tests/unit/fakes.py index fca1ab99..1ffa4b3e 100644 --- a/heatclient/tests/unit/fakes.py +++ b/heatclient/tests/unit/fakes.py @@ -116,11 +116,11 @@ def mock_script_event_list( {"event_time": "2013-12-05T14:14:32", "id": rsrc_eventid2, "links": [{"href": "http://heat.example.com:8004/foo", - "rel": "self"}, - {"href": "http://heat.example.com:8004/foo2", - "rel": "resource"}, - {"href": "http://heat.example.com:8004/foo3", - "rel": "stack"}], + "rel": "self"}, + {"href": "http://heat.example.com:8004/foo2", + "rel": "resource"}, + {"href": "http://heat.example.com:8004/foo3", + "rel": "stack"}], "logical_resource_id": "myDeployment", "physical_resource_id": "bce15ec4-8919-4a02-8a90-680960fb3731", "resource_name": resource_name if resource_name else "testresource", diff --git a/heatclient/v1/shell.py b/heatclient/v1/shell.py index 4c806bd6..4bfa4e9b 100644 --- a/heatclient/v1/shell.py +++ b/heatclient/v1/shell.py @@ -72,8 +72,8 @@ def _authenticated_fetcher(hc): help=_('URL to retrieve template object (e.g. from swift).')) @utils.arg('-c', '--create-timeout', metavar='', type=int, - help=_('Stack creation timeout in minutes.' - ' DEPRECATED use %(arg)s instead.') + help=_('Stack creation timeout in minutes. ' + 'DEPRECATED use %(arg)s instead.') % {'arg': '--timeout'}) @utils.arg('-t', '--timeout', metavar='', type=int, @@ -82,13 +82,13 @@ def _authenticated_fetcher(hc): help=_('Enable rollback on create/update failure.')) @utils.arg('-P', '--parameters', metavar='', help=_('Parameter values used to create the stack. ' - 'This can be specified multiple times, or once with parameters ' - 'separated by a semicolon.'), + 'This can be specified multiple times, or once with ' + 'parameters separated by a semicolon.'), action='append') @utils.arg('-Pf', '--parameter-file', metavar='', help=_('Parameter values from file used to create the stack. ' - 'This can be specified multiple times. Parameter value ' - 'would be the content of the file'), + 'This can be specified multiple times. Parameter value ' + 'would be the content of the file'), action='append') @utils.arg('--poll', metavar='SECONDS', type=int, nargs='?', const=5, help=_('Poll and report events until stack completes. ' @@ -174,8 +174,8 @@ def hooks_to_env(env, arg_hooks, hook): action='append') @utils.arg('-c', '--create-timeout', metavar='', type=int, - help=_('Stack creation timeout in minutes.' - ' DEPRECATED use %(arg)s instead.') + help=_('Stack creation timeout in minutes. ' + 'DEPRECATED use %(arg)s instead.') % {'arg': '--timeout'}) @utils.arg('-t', '--timeout', metavar='', type=int, @@ -185,9 +185,9 @@ def hooks_to_env(env, arg_hooks, hook): @utils.arg('-r', '--enable-rollback', default=False, action="store_true", help=_('Enable rollback on create/update failure.')) @utils.arg('-P', '--parameters', metavar='', - help=_('Parameter values used to create the stack. ' - 'This can be specified multiple times, or once with parameters ' - 'separated by a semicolon.'), + help=_('Parameter values used to create the stack. This can be ' + 'specified multiple times, or once with parameters ' + 'separated by a semicolon.'), action='append') @utils.arg('name', metavar='', help=_('Name of the stack to adopt.')) @@ -239,21 +239,21 @@ def do_stack_adopt(hc, args): @utils.arg('-o', '--template-object', metavar='', help=_('URL to retrieve template object (e.g. from swift)')) @utils.arg('-t', '--timeout', metavar='', type=int, - help=_('Stack creation timeout in minutes. This is only used during' - 'validation in preview.')) + help=_('Stack creation timeout in minutes. This is only used ' + 'during validation in preview.')) @utils.arg('-r', '--enable-rollback', default=False, action="store_true", - help=_('Enable rollback on failure. This option is not used during' - 'preview and exists only for symmetry with %(cmd)s.') + help=_('Enable rollback on failure. This option is not used during ' + 'preview and exists only for symmetry with %(cmd)s.') % {'cmd': 'stack-create'}) @utils.arg('-P', '--parameters', metavar='', help=_('Parameter values used to preview the stack. ' - 'This can be specified multiple times, or once with parameters ' - 'separated by semicolon.'), + 'This can be specified multiple times, or once with ' + 'parameters separated by semicolon.'), action='append') @utils.arg('-Pf', '--parameter-file', metavar='', help=_('Parameter values from file used to create the stack. ' - 'This can be specified multiple times. Parameter value ' - 'would be the content of the file'), + 'This can be specified multiple times. Parameter value ' + 'would be the content of the file'), action='append') @utils.arg('name', metavar='', help=_('Name of the stack to preview.')) @@ -319,8 +319,8 @@ def do_stack_delete(hc, args): @utils.arg('-O', '--output-file', metavar='', help=_('file to output abandon result. ' - 'If the option is specified, the result will be' - ' output into .')) + 'If the option is specified, the result will be ' + 'output into .')) @utils.arg('id', metavar='', help=_('Name or ID of stack to abandon.')) def do_stack_abandon(hc, args): @@ -418,42 +418,44 @@ def do_stack_show(hc, args): help=_('Stack update timeout in minutes.')) @utils.arg('-r', '--enable-rollback', default=False, action="store_true", help=_('DEPRECATED! Use %(arg)s argument instead. ' - 'Enable rollback on stack update failure. ' - 'NOTE: default behavior is now to use the rollback value ' - 'of existing stack.') + 'Enable rollback on stack update failure. ' + 'NOTE: default behavior is now to use the rollback value ' + 'of existing stack.') % {'arg': '--rollback'}) @utils.arg('--rollback', default=None, metavar='', help=_('Set rollback on update failure. ' - 'Values %(true)s set rollback to enabled. ' - 'Values %(false)s set rollback to disabled. ' - 'Default is to use the value of existing stack to be updated.') + 'Values %(true)s set rollback to enabled. ' + 'Values %(false)s set rollback to disabled. ' + 'Default is to use the value of existing stack to be ' + 'updated.') % {'true': strutils.TRUE_STRINGS, 'false': strutils.FALSE_STRINGS}) @utils.arg('-y', '--dry-run', default=False, action="store_true", help='Do not actually perform the stack update, but show what ' 'would be changed') @utils.arg('-P', '--parameters', metavar='', help=_('Parameter values used to create the stack. ' - 'This can be specified multiple times, or once with parameters ' - 'separated by a semicolon.'), + 'This can be specified multiple times, or once with ' + 'parameters separated by a semicolon.'), action='append') @utils.arg('-Pf', '--parameter-file', metavar='', help=_('Parameter values from file used to create the stack. ' - 'This can be specified multiple times. Parameter value ' - 'would be the content of the file'), + 'This can be specified multiple times. Parameter value ' + 'would be the content of the file'), action='append') @utils.arg('-x', '--existing', default=False, action="store_true", help=_('Re-use the template, parameters and environment of the ' - 'current stack. If the template argument is omitted then the ' - 'existing template is used. If no %(env_arg)s is specified then ' - 'the existing environment is used. ' - 'Parameters specified in %(arg)s will patch over the existing ' - 'values in the current stack. Parameters omitted will keep ' - 'the existing values.') + 'current stack. If the template argument is omitted then ' + 'the existing template is used. If no %(env_arg)s is ' + 'specified then the existing environment is used. ' + 'Parameters specified in %(arg)s will patch over the ' + 'existing values in the current stack. Parameters omitted ' + 'will keep the existing values.') % {'arg': '--parameters', 'env_arg': '--environment-file'}) @utils.arg('-c', '--clear-parameter', metavar='', help=_('Remove the parameters from the set of parameters of ' - 'current stack for the %(cmd)s. The default value in the ' - 'template will be used. This can be specified multiple times.') + 'current stack for the %(cmd)s. The default value in the ' + 'template will be used. This can be specified multiple ' + 'times.') % {'cmd': 'stack-update'}, action='append') @utils.arg('id', metavar='', @@ -554,8 +556,8 @@ def do_stack_cancel_update(hc, args): help=_('Include hidden stacks in the stack listing.')) @utils.arg('-f', '--filters', metavar='', help=_('Filter parameters to apply on returned stacks. ' - 'This can be specified multiple times, or once with parameters ' - 'separated by a semicolon.'), + 'This can be specified multiple times, or once with ' + 'parameters separated by a semicolon.'), action='append') @utils.arg('-t', '--tags', metavar='', help=_('Show stacks containing these tags, combine multiple tags ' @@ -716,9 +718,9 @@ def do_output_show(hc, args): @utils.arg('-f', '--filters', metavar='', help=_('Filter parameters to apply on returned resource types. ' - 'This can be specified multiple times, or once with parameters ' - 'separated by a semicolon. It can be any of name, version and ' - 'support_status'), + 'This can be specified multiple times, or once with ' + 'parameters separated by a semicolon. It can be any of ' + 'name, version and support_status'), action='append') def do_resource_type_list(hc, args): '''List the available resource types.''' @@ -1010,8 +1012,8 @@ def do_hook_clear(hc, args): help=_('Name of the resource to filter events by.')) @utils.arg('-f', '--filters', metavar='', help=_('Filter parameters to apply on returned events. ' - 'This can be specified multiple times, or once with parameters ' - 'separated by a semicolon.'), + 'This can be specified multiple times, or once with ' + 'parameters separated by a semicolon.'), action='append') @utils.arg('-l', '--limit', metavar='', help=_('Limit the number of events returned.')) @@ -1176,7 +1178,7 @@ def do_event_show(hc, args): @utils.arg('-f', '--definition-file', metavar='', help=_('Path to JSON/YAML containing map defining ' - ', , and .')) + ', , and .')) @utils.arg('-c', '--config-file', metavar='', help=_('Path to configuration script/data.')) @utils.arg('-g', '--group', metavar='', default='Heat::Ungrouped', @@ -1389,8 +1391,8 @@ def do_deployment_delete(hc, args): config_id = getattr(sd, 'config_id') hc.software_configs.delete(config_id=config_id) except Exception: - print(_('Failed to delete the correlative config' - ' %(config_id)s of deployment %(deploy_id)s') % + print(_('Failed to delete the correlative config ' + '%(config_id)s of deployment %(deploy_id)s') % {'config_id': config_id, 'deploy_id': deploy_id}) if failure_count == len(args.id): diff --git a/tox.ini b/tox.ini index 3c476781..9f3b198f 100644 --- a/tox.ini +++ b/tox.ini @@ -42,7 +42,7 @@ commands= downloadcache = ~/cache/pip [flake8] -ignore = E123,E126,E128 +ignore = E123,E126 show-source = True exclude=.venv,.git,.tox,dist,*openstack/common*,*lib/python*,*egg,build max-complexity=20