# Path: ndlib/models/compartments/Compartment.py
# class Compartiment(object):
#     """
#     """
# 
#     def __init__(self, *args, **kwargs):
#         self.composed = None
#         if 'composed' in args[0]:
#             if isinstance(args[0]['composed'], Compartiment):
#                 self.composed = args[0]['composed']
# 
#     def execute(self, *args, **kwargs):
#         pass
# 
#     def compose(self, *args, **kwargs):
#         if self.composed is not None:
#             return self.composed.execute(*args, **kwargs)
#         else:
#             return True
# 
# Path: ndlib/models/compartments/enums/NumericalType.py
# class NumericalType(Enum):
#     STATUS = 0
#     ATTRIBUTE = 1


from ndlib.models.compartments.Compartment import Compartiment
from ndlib.models.compartments.enums.NumericalType import NumericalType
import networkx as nx
import numpy as np
import operator
                    if not isinstance(self.value, str):
                        raise ValueError("The value should be a string pointing to an attribute or status when value type is set")
        else:
            raise ValueError("The operator provided '%s' is not valid" % operator)

    def execute(self, node, graph, status, status_map, attributes=None, *args, **kwargs):
        if self.variable_type == NumericalType.STATUS:
            val = status[node][self.variable]
        elif self.variable_type == NumericalType.ATTRIBUTE:
            if attributes:
                val = attributes[node][self.variable]
            else:
                val = nx.get_node_attributes(graph, self.variable)[node]

        testVal = self.value

        if self.value_type == NumericalType.STATUS:
            testVal = status[node][self.value]
        elif self.value_type == NumericalType.ATTRIBUTE:
            if attributes:
                testVal = attributes[node][self.value]
            else:
                testVal = nx.get_node_attributes(graph, self.value)[node]

        p = np.random.random_sample()

        if self.operator == "IN":
            condition = self.__available_operators[self.operator][0](val, testVal[0]) and \
                        self.__available_operators[self.operator][1](val, testVal[1])
        else:

# Path: ndlib/models/compartments/Compartment.py
# class Compartiment(object):
#     """
#     """
# 
#     def __init__(self, *args, **kwargs):
#         self.composed = None
#         if 'composed' in args[0]:
#             if isinstance(args[0]['composed'], Compartiment):
#                 self.composed = args[0]['composed']
# 
#     def execute(self, *args, **kwargs):
#         pass
# 
#     def compose(self, *args, **kwargs):
#         if self.composed is not None:
#             return self.composed.execute(*args, **kwargs)
#         else:
#             return True
# 
# Path: ndlib/models/compartments/enums/NumericalType.py
# class NumericalType(Enum):
#     STATUS = 0
#     ATTRIBUTE = 1


# Path: ndlib/models/compartments/NodeNumericalVariable.py
from ndlib.models.compartments.Compartment import Compartiment
from ndlib.models.compartments.enums.NumericalType import NumericalType
import networkx as nx
import numpy as np
import operator

                    if not isinstance(self.value, str):
                        raise ValueError("The value should be a string pointing to an attribute or status when value type is set")
        else:
            raise ValueError("The operator provided '%s' is not valid" % operator)

    def execute(self, node, graph, status, status_map, attributes=None, *args, **kwargs):
        if self.variable_type == NumericalType.STATUS:
            val = status[node][self.variable]
        elif self.variable_type == NumericalType.ATTRIBUTE:
            if attributes:
                val = attributes[node][self.variable]
            else:
                val = nx.get_node_attributes(graph, self.variable)[node]

        testVal = self.value

        if self.value_type == NumericalType.STATUS:
            testVal = status[node][self.value]
        elif self.value_type == NumericalType.ATTRIBUTE:
            if attributes:
                testVal = attributes[node][self.value]
            else:
                testVal = nx.get_node_attributes(graph, self.value)[node]

        p = np.random.random_sample()

        if self.operator == "IN":
            condition = self.__available_operators[self.operator][0](val, testVal[0]) and \
                        self.__available_operators[self.operator][1](val, testVal[1])
        else:

            condition = self.__available_operators[self.operator](val, testVal)