Skip to content

Documentation for Modelhandler Module

ModelHandler

Bases: ABC

Source code in nebula/core/situationalawareness/discovery/modelhandlers/modelhandler.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
class ModelHandler(ABC):
    @abstractmethod
    def set_config(self, config):
        """
        Configure internal settings for the model handler using the provided configuration.

        Parameters:
            config: A configuration object or dictionary with parameters relevant to model handling.
        """
        pass

    @abstractmethod
    def accept_model(self, model):
        """
        Evaluate and store a received model if it satisfies the required criteria.

        Parameters:
            model: The model object to be processed or stored.

        Returns:
            bool: True if the model is accepted, False otherwise.
        """
        pass

    @abstractmethod
    async def get_model(self, model):
        """
        Asynchronously retrieve or generate the model to be used.

        Parameters:
            model: A reference to the kind of model to be used.

        Returns:
            object: The model instance requested.
        """
        pass

    @abstractmethod
    def pre_process_model(self):
        """
        Perform any necessary preprocessing steps on the model before it is used.

        Returns:
            object: The preprocessed model, ready for further operations.
        """
        pass

accept_model(model) abstractmethod

Evaluate and store a received model if it satisfies the required criteria.

Parameters:

Name Type Description Default
model

The model object to be processed or stored.

required

Returns:

Name Type Description
bool

True if the model is accepted, False otherwise.

Source code in nebula/core/situationalawareness/discovery/modelhandlers/modelhandler.py
15
16
17
18
19
20
21
22
23
24
25
26
@abstractmethod
def accept_model(self, model):
    """
    Evaluate and store a received model if it satisfies the required criteria.

    Parameters:
        model: The model object to be processed or stored.

    Returns:
        bool: True if the model is accepted, False otherwise.
    """
    pass

get_model(model) abstractmethod async

Asynchronously retrieve or generate the model to be used.

Parameters:

Name Type Description Default
model

A reference to the kind of model to be used.

required

Returns:

Name Type Description
object

The model instance requested.

Source code in nebula/core/situationalawareness/discovery/modelhandlers/modelhandler.py
28
29
30
31
32
33
34
35
36
37
38
39
@abstractmethod
async def get_model(self, model):
    """
    Asynchronously retrieve or generate the model to be used.

    Parameters:
        model: A reference to the kind of model to be used.

    Returns:
        object: The model instance requested.
    """
    pass

pre_process_model() abstractmethod

Perform any necessary preprocessing steps on the model before it is used.

Returns:

Name Type Description
object

The preprocessed model, ready for further operations.

Source code in nebula/core/situationalawareness/discovery/modelhandlers/modelhandler.py
41
42
43
44
45
46
47
48
49
@abstractmethod
def pre_process_model(self):
    """
    Perform any necessary preprocessing steps on the model before it is used.

    Returns:
        object: The preprocessed model, ready for further operations.
    """
    pass

set_config(config) abstractmethod

Configure internal settings for the model handler using the provided configuration.

Parameters:

Name Type Description Default
config

A configuration object or dictionary with parameters relevant to model handling.

required
Source code in nebula/core/situationalawareness/discovery/modelhandlers/modelhandler.py
 5
 6
 7
 8
 9
10
11
12
13
@abstractmethod
def set_config(self, config):
    """
    Configure internal settings for the model handler using the provided configuration.

    Parameters:
        config: A configuration object or dictionary with parameters relevant to model handling.
    """
    pass