minos.common.pools

Classes

MinosPool

MinosPool class.

Pool

Base class for Pool implementations in minos

PoolFactory

Exceptions

PoolException

Exception to be raised when some problem related with a pool happens.

class PoolFactory[source]

Bases: PoolFactory, InjectableMixin

__init__(config, default_classes=None, *args, **kwargs)[source]
Parameters
get_pool(type_, identifier=None, **kwargs)[source]

Get a pool from the factory.

Parameters
  • type – The type of the pool.

  • identifier (Optional[str]) – An optional key that identifies the pool.

  • kwargs – Additional named arguments.

  • type_ (str) –

Returns

A Pool instance.

Return type

Pool

property already_destroyed: bool

Already Destroy getter.

Returns

A boolean value.

property already_setup: bool

Already Setup getter.

Returns

A boolean value.

async destroy()

Destroy miscellaneous repository things.

Returns

This method does not return anything.

Return type

None

classmethod from_config(config=None, **kwargs)

Build a new instance from config.

Parameters
  • config (Optional[Union[Config, Path]]) – Config instance. If None is provided, default config is chosen.

  • kwargs – Additional named arguments.

Returns

A instance of the called class.

Return type

S

classmethod get_injectable_name()

Get the injectable name.

Returns

A str value.

Return type

str

async setup()

Setup miscellaneous repository things.

Returns

This method does not return anything.

Return type

None

class Pool[source]

Bases: SetupMixin, _PoolBase, Generic[P], ABC

Base class for Pool implementations in minos

__init__(*args, already_setup=True, **kwargs)[source]
Parameters

already_setup (bool) –

acquire(*args, **kwargs)[source]

Acquire a new instance wrapped on an asynchronous context manager.

Parameters
  • args – Additional positional arguments.

  • kwargs – Additional named arguments.

Returns

An asynchronous context manager.

Return type

AsyncContextManager[P]

property already_destroyed: bool

Already Destroy getter.

Returns

A boolean value.

property already_setup: bool

Already Setup getter.

Returns

A boolean value.

async close(timeout=None)
Parameters

timeout (Optional[Union[int, float]]) –

Return type

None

async destroy()

Destroy miscellaneous repository things.

Returns

This method does not return anything.

Return type

None

classmethod from_config(config=None, **kwargs)

Build a new instance from config.

Parameters
  • config (Optional[Union[Config, Path]]) – Config instance. If None is provided, default config is chosen.

  • kwargs – Additional named arguments.

Returns

A instance of the called class.

Return type

S

async setup()

Setup miscellaneous repository things.

Returns

This method does not return anything.

Return type

None

class MinosPool[source]

Bases: Pool, Generic[P], ABC

MinosPool class.

__init__(*args, **kwargs)[source]
acquire(*args, **kwargs)

Acquire a new instance wrapped on an asynchronous context manager.

Parameters
  • args – Additional positional arguments.

  • kwargs – Additional named arguments.

Returns

An asynchronous context manager.

Return type

AsyncContextManager[P]

property already_destroyed: bool

Already Destroy getter.

Returns

A boolean value.

property already_setup: bool

Already Setup getter.

Returns

A boolean value.

async close(timeout=None)
Parameters

timeout (Optional[Union[int, float]]) –

Return type

None

async destroy()

Destroy miscellaneous repository things.

Returns

This method does not return anything.

Return type

None

classmethod from_config(config=None, **kwargs)

Build a new instance from config.

Parameters
  • config (Optional[Union[Config, Path]]) – Config instance. If None is provided, default config is chosen.

  • kwargs – Additional named arguments.

Returns

A instance of the called class.

Return type

S

async setup()

Setup miscellaneous repository things.

Returns

This method does not return anything.

Return type

None

exception PoolException[source]

Bases: MinosException

Exception to be raised when some problem related with a pool happens.

__init__(error_message)
Parameters

error_message (str) –

__new__(**kwargs)
args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.