From 47cbec7ff5dbad0c467e29648c86d1443e0b3c4e Mon Sep 17 00:00:00 2001 From: ricolin Date: Sun, 15 Nov 2015 21:34:22 +0800 Subject: [PATCH] Enable pep8 H405 tests Enabled H405 multi line docstring summary not separated with an empty line in tox testing. Change-Id: I89d063133154ae343315872b677fa06cc901cf3b --- heatclient/common/environment_format.py | 4 ++-- heatclient/tests/functional/base.py | 2 +- heatclient/tests/functional/test_readonly_heat.py | 1 + heatclient/v1/events.py | 1 + heatclient/v1/resource_types.py | 1 + heatclient/v1/resources.py | 6 +++--- heatclient/v1/services.py | 1 + heatclient/v1/shell.py | 9 ++++----- heatclient/v1/software_configs.py | 1 + heatclient/v1/software_deployments.py | 5 +++-- heatclient/v1/stacks.py | 3 +-- heatclient/v1/template_versions.py | 1 + tox.ini | 2 +- 13 files changed, 21 insertions(+), 16 deletions(-) diff --git a/heatclient/common/environment_format.py b/heatclient/common/environment_format.py index 5c29aad0..c5f3e942 100644 --- a/heatclient/common/environment_format.py +++ b/heatclient/common/environment_format.py @@ -51,8 +51,8 @@ def parse(env_str): def default_for_missing(env): - '''Checks a parsed environment for missing sections. - ''' + """Checks a parsed environment for missing sections.""" + for param in SECTIONS: if param not in env: env[param] = {} diff --git a/heatclient/tests/functional/base.py b/heatclient/tests/functional/base.py index 2f833415..44718cad 100644 --- a/heatclient/tests/functional/base.py +++ b/heatclient/tests/functional/base.py @@ -17,8 +17,8 @@ from tempest_lib.cli import base class ClientTestBase(base.ClientTestBase): """This is a first pass at a simple read only python-heatclient test. - This only exercises client commands that are read only. + This only exercises client commands that are read only. This should test commands: * as a regular user * as a admin user diff --git a/heatclient/tests/functional/test_readonly_heat.py b/heatclient/tests/functional/test_readonly_heat.py index 84fe049f..9ccb477f 100644 --- a/heatclient/tests/functional/test_readonly_heat.py +++ b/heatclient/tests/functional/test_readonly_heat.py @@ -21,6 +21,7 @@ from heatclient.tests.functional import base class SimpleReadOnlyHeatClientTest(base.ClientTestBase): """Basic, read-only tests for Heat CLI client. + Basic smoke test for the heat CLI commands which do not require creating or modifying stacks. """ diff --git a/heatclient/v1/events.py b/heatclient/v1/events.py index d468a123..d3489277 100644 --- a/heatclient/v1/events.py +++ b/heatclient/v1/events.py @@ -43,6 +43,7 @@ class EventManager(stacks.StackChildManager): def list(self, stack_id, resource_name=None, **kwargs): """Get a list of events. + :param stack_id: ID of stack the events belong to :param resource_name: Optional name of resources to filter events by :rtype: list of :class:`Event` diff --git a/heatclient/v1/resource_types.py b/heatclient/v1/resource_types.py index 952cc3c5..75ea22af 100644 --- a/heatclient/v1/resource_types.py +++ b/heatclient/v1/resource_types.py @@ -35,6 +35,7 @@ class ResourceTypeManager(base.BaseManager): def list(self, **kwargs): """Get a list of resource types. + :rtype: list of :class:`ResourceType` """ diff --git a/heatclient/v1/resources.py b/heatclient/v1/resources.py index 8949d270..f063c841 100644 --- a/heatclient/v1/resources.py +++ b/heatclient/v1/resources.py @@ -51,6 +51,7 @@ class ResourceManager(stacks.StackChildManager): def list(self, stack_id, **kwargs): """Get a list of resources. + :rtype: list of :class:`Resource` """ params = {} @@ -112,9 +113,8 @@ class ResourceManager(stacks.StackChildManager): return body def generate_template(self, resource_name): - """DEPRECATED! Use `generate_template` of `ResourceTypeManager` - instead. - """ + """Deprecated in favor of generate_template in ResourceTypeManager.""" + url_str = '/resource_types/%s/template' % ( parse.quote(encodeutils.safe_encode(resource_name), '')) resp = self.client.get(url_str) diff --git a/heatclient/v1/services.py b/heatclient/v1/services.py index 9e77c733..f833585c 100644 --- a/heatclient/v1/services.py +++ b/heatclient/v1/services.py @@ -26,6 +26,7 @@ class ServiceManager(base.BaseManager): def list(self): """Get a list of services. + :rtype: list of :class:`Service` """ url = '/services' diff --git a/heatclient/v1/shell.py b/heatclient/v1/shell.py index 1c84b529..e6bc3be8 100644 --- a/heatclient/v1/shell.py +++ b/heatclient/v1/shell.py @@ -40,8 +40,8 @@ logger = logging.getLogger(__name__) def _authenticated_fetcher(hc): - """A wrapper around the heat client object to fetch a template. - """ + """A wrapper around the heat client object to fetch a template.""" + def _do(*args, **kwargs): if isinstance(hc.http_client, http.SessionClient): method, url = args @@ -1565,9 +1565,8 @@ def _do_stack_show(hc, fields): def _poll_for_events(hc, stack_name, action, poll_period): - """When an action is performed on a stack, continuously poll for its - events and display to user as logs. - """ + """Continuously poll events and logs for performed action on stack.""" + fields = {'stack_id': stack_name} _do_stack_show(hc, fields) marker = None diff --git a/heatclient/v1/software_configs.py b/heatclient/v1/software_configs.py index bc948283..ac7423b5 100644 --- a/heatclient/v1/software_configs.py +++ b/heatclient/v1/software_configs.py @@ -33,6 +33,7 @@ class SoftwareConfigManager(base.BaseManager): def list(self, **kwargs): """Get a list of software configs. + :rtype: list of :class:`SoftwareConfig` """ qparams = {} diff --git a/heatclient/v1/software_deployments.py b/heatclient/v1/software_deployments.py index 494bbce8..21529193 100644 --- a/heatclient/v1/software_deployments.py +++ b/heatclient/v1/software_deployments.py @@ -32,14 +32,15 @@ class SoftwareDeploymentManager(base.BaseManager): def list(self, **kwargs): """Get a list of software deployments. + :rtype: list of :class:`SoftwareDeployment` """ url = '/software_deployments?%s' % parse.urlencode(kwargs) return self._list(url, "software_deployments") def metadata(self, server_id): - """Get a grouped collection of software deployment metadata for a - given server. + """Get a collection of software deployment metadata for given server. + :rtype: list of :class:`SoftwareDeployment` """ url = '/software_deployments/metadata/%s' % parse.quote( diff --git a/heatclient/v1/stacks.py b/heatclient/v1/stacks.py index 28aa83ef..542feaa2 100644 --- a/heatclient/v1/stacks.py +++ b/heatclient/v1/stacks.py @@ -221,8 +221,7 @@ class StackManager(base.BaseManager): return Stack(self, body.get('stack')) def template(self, stack_id): - """Get the template content for a specific stack as a parsed JSON - object. + """Get template content for a specific stack as a parsed JSON object. :param stack_id: Stack ID to get the template for """ diff --git a/heatclient/v1/template_versions.py b/heatclient/v1/template_versions.py index 3ba4c630..0bfc0a1d 100644 --- a/heatclient/v1/template_versions.py +++ b/heatclient/v1/template_versions.py @@ -30,6 +30,7 @@ class TemplateVersionManager(base.BaseManager): def list(self): """Get a list of template versions. + :rtype: list of :class:`TemplateVersion` """ return self._list('/template_versions', 'template_versions') diff --git a/tox.ini b/tox.ini index 312a41aa..230ebfe7 100644 --- a/tox.ini +++ b/tox.ini @@ -42,7 +42,7 @@ commands= downloadcache = ~/cache/pip [flake8] -ignore = E123,E126,E128,E241,E265,E713,H202,H405,H238 +ignore = E123,E126,E128,E241,E265,E713,H202,H238 show-source = True exclude=.venv,.git,.tox,dist,*openstack/common*,*lib/python*,*egg,build max-complexity=20