ARIA-62 Apply pylint on extensions
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/0af9e638 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/0af9e638 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/0af9e638 Branch: refs/heads/ARIA-208-Missing-back-refrences-for-models Commit: 0af9e638b7c75eea6eac39374b7176f9dc2c645a Parents: eae44d0 Author: Ran Ziv <r...@gigaspaces.com> Authored: Wed May 10 12:08:01 2017 +0300 Committer: Ran Ziv <r...@gigaspaces.com> Committed: Wed May 10 12:08:01 2017 +0300 ---------------------------------------------------------------------- aria/.pylintrc | 2 +- .../aria_extension_tosca/simple_nfv_v1_0/presenter.py | 2 +- .../aria_extension_tosca/simple_v1_0/assignments.py | 2 +- extensions/aria_extension_tosca/simple_v1_0/functions.py | 8 ++++---- .../aria_extension_tosca/simple_v1_0/modeling/__init__.py | 10 ++++++---- extensions/aria_extension_tosca/simple_v1_0/presenter.py | 2 +- tests/.pylintrc | 2 +- tox.ini | 2 +- 8 files changed, 16 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0af9e638/aria/.pylintrc ---------------------------------------------------------------------- diff --git a/aria/.pylintrc b/aria/.pylintrc index 7da8c56..4d77556 100644 --- a/aria/.pylintrc +++ b/aria/.pylintrc @@ -360,7 +360,7 @@ max-locals=20 max-returns=10 # Maximum number of branch for function / method body -max-branches=12 +max-branches=15 # Maximum number of statements in function / method body max-statements=50 http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0af9e638/extensions/aria_extension_tosca/simple_nfv_v1_0/presenter.py ---------------------------------------------------------------------- diff --git a/extensions/aria_extension_tosca/simple_nfv_v1_0/presenter.py b/extensions/aria_extension_tosca/simple_nfv_v1_0/presenter.py index 0ce918e..cd07f42 100644 --- a/extensions/aria_extension_tosca/simple_nfv_v1_0/presenter.py +++ b/extensions/aria_extension_tosca/simple_nfv_v1_0/presenter.py @@ -19,7 +19,7 @@ from aria.utils.caching import cachedmethod from ..simple_v1_0 import ToscaSimplePresenter1_0 -class ToscaSimpleNfvPresenter1_0(ToscaSimplePresenter1_0): # pylint: disable=invalid-name +class ToscaSimpleNfvPresenter1_0(ToscaSimplePresenter1_0): # pylint: disable=invalid-name,abstract-method """ ARIA presenter for the `TOSCA Simple Profile for NFV v1.0 csd03 <http://docs.oasis-open.org /tosca/tosca-nfv/v1.0/csd03/tosca-nfv-v1.0-csd03.html>`__. http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0af9e638/extensions/aria_extension_tosca/simple_v1_0/assignments.py ---------------------------------------------------------------------- diff --git a/extensions/aria_extension_tosca/simple_v1_0/assignments.py b/extensions/aria_extension_tosca/simple_v1_0/assignments.py index 6e36ba8..9a2179a 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/assignments.py +++ b/extensions/aria_extension_tosca/simple_v1_0/assignments.py @@ -94,7 +94,7 @@ class OperationAssignment(ExtensiblePresentation): if operation_definition is not None: if operation_definition._extensions: extensions.update(operation_definition._extensions) - + extensions = {} update_inherited_extensions(extensions, self._container._get_type(context)) if self._container._extensions: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0af9e638/extensions/aria_extension_tosca/simple_v1_0/functions.py ---------------------------------------------------------------------- diff --git a/extensions/aria_extension_tosca/simple_v1_0/functions.py b/extensions/aria_extension_tosca/simple_v1_0/functions.py index 405aa8f..2f77420 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/functions.py +++ b/extensions/aria_extension_tosca/simple_v1_0/functions.py @@ -176,7 +176,7 @@ class GetProperty(Function): for modelable_entity in modelable_entities: properties = None - + if hasattr(modelable_entity, 'requirement_templates') \ and modelable_entity.requirement_templates \ and (req_or_cap_name in [v.name for v in modelable_entity.requirement_templates]): @@ -185,7 +185,7 @@ class GetProperty(Function): # First argument refers to a requirement # TODO: should follow to matched capability in other node... raise CannotEvaluateFunctionException() - break + # break nested_property_name_or_index = self.nested_property_name_or_index[1:] elif hasattr(modelable_entity, 'capability_templates') \ and modelable_entity.capability_templates \ @@ -254,7 +254,7 @@ class GetAttribute(Function): # Operation # -@dsl_specification('4.6.1', 'tosca-simple-1.0') +@dsl_specification('4.6.1', 'tosca-simple-1.0') # pylint: disable=abstract-method class GetOperationOutput(Function): """ The :code:`get_operation_output` function is used to retrieve the values of variables exposed / @@ -334,7 +334,7 @@ class GetNodesOfType(Function): # Artifact # -@dsl_specification('4.8.1', 'tosca-simple-1.0') +@dsl_specification('4.8.1', 'tosca-simple-1.0') # pylint: disable=abstract-method class GetArtifact(Function): """ The :code:`get_artifact` function is used to retrieve artifact location between modelable http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0af9e638/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py ---------------------------------------------------------------------- diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py index 9576260..3bda7e2 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py +++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py @@ -16,9 +16,11 @@ """ Creates ARIA service template models based on the TOSCA presentation. -Relies on many helper methods in the presentation classes. +Relies on many helper methods in the presentation classes. """ +#pylint: disable=unsubscriptable-object + import os import re from types import FunctionType @@ -155,7 +157,7 @@ def create_node_template_model(context, service_template, node_template): node_type = service_template.node_types.get_descendant(node_type._name) model = NodeTemplate(name=node_template._name, type=node_type) - + model.default_instances = 1 model.min_instances = 0 @@ -367,7 +369,7 @@ def create_operation_template_model(context, service_template, operation): model.description = operation.description.value implementation = operation.implementation - if implementation is not None: + if implementation is not None: primary = implementation.primary parse_implementation_string(context, service_template, operation, model, primary) relationship_edge = operation._get_extensions(context).get('relationship_edge') @@ -376,7 +378,7 @@ def create_operation_template_model(context, service_template, operation): model.relationship_edge = False elif relationship_edge == 'target': model.relationship_edge = True - + dependencies = implementation.dependencies if dependencies: for dependency in dependencies: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0af9e638/extensions/aria_extension_tosca/simple_v1_0/presenter.py ---------------------------------------------------------------------- diff --git a/extensions/aria_extension_tosca/simple_v1_0/presenter.py b/extensions/aria_extension_tosca/simple_v1_0/presenter.py index 96cc763..c88decd 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/presenter.py +++ b/extensions/aria_extension_tosca/simple_v1_0/presenter.py @@ -22,7 +22,7 @@ from .functions import (Concat, Token, GetInput, GetProperty, GetAttribute, GetO from .modeling import create_service_template_model from .templates import ServiceTemplate -class ToscaSimplePresenter1_0(Presenter): # pylint: disable=invalid-name +class ToscaSimplePresenter1_0(Presenter): # pylint: disable=invalid-name,abstract-method """ ARIA presenter for the `TOSCA Simple Profile v1.0 cos01 <http://docs.oasis-open.org/tosca /TOSCA-Simple-Profile-YAML/v1.0/cos01/TOSCA-Simple-Profile-YAML-v1.0-cos01.html>`__. http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0af9e638/tests/.pylintrc ---------------------------------------------------------------------- diff --git a/tests/.pylintrc b/tests/.pylintrc index 9795bfc..0352dd3 100644 --- a/tests/.pylintrc +++ b/tests/.pylintrc @@ -360,7 +360,7 @@ max-locals=30 max-returns=10 # Maximum number of branch for function / method body -max-branches=12 +max-branches=15 # Maximum number of statements in function / method body max-statements=50 http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0af9e638/tox.ini ---------------------------------------------------------------------- diff --git a/tox.ini b/tox.ini index f4e9871..6ab97cb 100644 --- a/tox.ini +++ b/tox.ini @@ -49,7 +49,7 @@ commands=pytest tests/end2end --cov-report term-missing --cov aria commands=pytest tests --ignore=tests/end2end --cov-report term-missing --cov aria [testenv:pylint_code] -commands=pylint --rcfile=aria/.pylintrc --disable=fixme,missing-docstring aria +commands=pylint --rcfile=aria/.pylintrc --disable=fixme,missing-docstring aria extensions/aria_extension_tosca/ [testenv:pylint_tests] commands=pylint --rcfile=tests/.pylintrc --disable=fixme,missing-docstring tests