feijoa.utils package#

Submodules#

feijoa.utils.imports module#

class feijoa.utils.imports.ImportWrapper#

Bases: object

Context manager to wrap import messages.

class feijoa.utils.imports.LazyModuleImportProxy(module)#

Bases: module

Class for lazy modules importing.

Parameters

module (str) –

Return type

None

feijoa.utils.imports.import_or_skip(module, reason='')#
Import module or skip test in

pytest framework.

Args:
module:

Python module.

reason:

Reason of skipping.

Raises:

AnyError: If anything bad happens.

feijoa.utils.logging module#

feijoa.utils.logging.init(verbose=False)#

Init logging.

Args:
verbose (bool):

Verbose level (DEBUG) or not (INFO).

Raises:

AnyError: If anything bad happens.

feijoa.utils.misc module#

feijoa.utils.misc.in_notebook()#

Check if module in running in IPython kernel.

Returns:

True if the module is running in IPython kernel, False if in IPython shell or other Python shell.

Raises:

AnyError: If anything bad happens.

feijoa.utils.mixins module#

Different mixins module.

class feijoa.utils.mixins.Observer#

Bases: object

The Observer interface declares the update method, used by subjects.

abstract update(event, subject, *args, **kwargs)#

Receive update from subject.

Args:
event:

Type of event.

subject:

Subject of notification.

Returns:

None

Raises:

AnyError: If anything bad happens.

class feijoa.utils.mixins.Subject#

Bases: object

The Subject interface declares a set of methods for managing subscribers.

abstract attach(observer)#

Attach an observer to the subject.

Parameters

observer (feijoa.utils.mixins.Observer) –

Return type

None

abstract detach(observer)#

Detach an observer from the subject.

Parameters

observer (feijoa.utils.mixins.Observer) –

Return type

None

abstract notify(event, *args, **kwargs)#

Notify all observers about an event.

Return type

None

feijoa.utils.transformers module#

feijoa.utils.transformers.inverse_transform(configuration, search_space)#
Transform dictionary (configuration)

to vector of parameter’s values.

Args:
configuration (dict | Configuration):

Feijoa configuration.

search_space:

Search space instance.

Raises:

AnyError: If anything bad happens.

Parameters

configuration (dict) –

feijoa.utils.transformers.transform(sol, search_space)#

Transform solutions into a dictionary.

Args:
sol (list | numpy.array):

Vector of parameter’s values.

search_space:

Search space instance.

Raises:

AnyError: If anything bad happens.

Module contents#