GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( c99b2a...e15e8a )
by P.R.
02:51
created

SimpleNode.get_node_by_name()   A

Complexity

Conditions 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 7
ccs 0
cts 2
cp 0
crap 2
rs 9.4285
1
"""
2
Enarksh
3
4
Copyright 2013-2016 Set Based IT Consultancy
5
6
Licence MIT
7
"""
8
from enarksh.XmlReader.Node.Node import Node
9
10
11
class SimpleNode(Node):
0 ignored issues
show
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Bug introduced by
The method _store_self which was declared abstract in the super-class Node
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
12
    # ------------------------------------------------------------------------------------------------------------------
13
    def get_node_by_name(self, node_name):
14
        """
15
        Raise an exception. A simple node does not have child nodes.
16
17
        :param str node_name: The name of the child node.
18
        """
19
        raise ValueError("Can not find child node '{}'".format(node_name))
20
21
    # ------------------------------------------------------------------------------------------------------------------
22
    def get_resource_by_name(self, resource_name):
23
        """
24
        Returns a resource of the node.
25
26
        :param str resource_name: The name of the resource.
27
28
        :rtype: mixed
29
        """
30
        if self._parent_node:
31
            return self._parent_node.get_resource_by_name(resource_name)
32
33
        return None
34
35
    # ------------------------------------------------------------------------------------------------------------------
36
    def set_levels(self, recursion_level=0):
37
        """
38
        Sets the recursion level (i.e. the number of parent nodes) of the child nodes of this node.
39
40
        :param int recursion_level: The recursion level of this node.
41
        """
42
        self._recursion_level = recursion_level
43
        self._dependency_level = self.get_dependency_level()
44
45
46
# ----------------------------------------------------------------------------------------------------------------------
47