dal.utils package

Submodules

dal.utils.callback module

Copyright (C) Mov.ai - All Rights Reserved Unauthorized copying of this file, via any medium is strictly prohibited Proprietary and confidential

Developers: - Manuel Silva (manuel.silva@mov.ai) - 2020 - Tiago Paulino (tiago@mov.ai) - 2020

class dal.utils.callback.AsyncCallback(_cb_name: str, _node_name: str, _port_name: str, _update: bool = False)

Bases: object

Callback class used to execute user code

Parameters:
  • _cb_name – The name of the callback

  • _node_name – The name of the node instance

  • _port_name – The name of the input port

  • _update – Real time update of the callback code

async execute(msg: Any | None = None) None

Executes the code

Parameters:

msg – Message received in the callback

Returns:

Result from the callback function, if any

set_transitioning()
async start(code, globais)

Executes the code

Parameters:

msg – Message received in the callback

class dal.utils.callback.Callback(_cb_name: str, _node_name: str, _port_name: str, _update: bool = False)

Bases: object

Callback class used by GD_Node to execute code

Parameters:
  • _cb_name – The name of the callback

  • _node_name – The name of the node instance

  • _port_name – The name of the input port

  • _update – Real time update of the callback code

execute(msg: Any | None = None) None

Executes the code

Parameters:

msg – Message received in the callback

classmethod robot() Robot
classmethod scene() GraphicScene
set_transitioning()
start(code, globais)

Executes the code

Parameters:

msg – Message received in the callback

class dal.utils.callback.UserFunctions(_cb_name: str, _node_name: str, _port_name: str, _libraries: list, _message: str, _user='SUPER')

Bases: object

Class that provides functions to the callback execution

globals: Dict[str, Any]
load_classes(_node_name, _port_name, _user)
load_libraries(libraries)
run(cb_name, msg)

Run another callback from a callback

user_print(*args)

Method to redirect the print function into logger

dal.utils.constants module

DAL constants.

dal.utils.constants.REST_SCOPES

Scopes supported via REST API.

dal.utils.constants.SCOPES_TO_TRACK

Scopes for which we update LastUpdate (user and time).

dal.utils.middleware module

dal.utils.redis_mocks module

class dal.utils.redis_mocks.FakeAsyncConnection(reader, writer, *, address, encoding=None, parser=None, loop=None)

Bases: AbcConnection

Basic mock connection that allows subscribing to a channel pattern (psubscribe)

property address

Connection address.

close()

Perform connection(s) close and resources cleanup.

property closed

Flag indicating if connection is closing or already closed.

property db

Current selected DB index.

property encoding

Current set connection codec.

execute(command, *args, encoding=Ellipsis)

Execute redis command.

execute_pubsub(command, *channels)

Execute Redis (p)subscribe/(p)unsubscribe commands.

property in_pubsub

Returns number of subscribed channels.

Can be tested as bool indicating Pub/Sub mode state.

property pubsub_channels

Read-only channels dict.

property pubsub_patterns

Read-only patterns dict.

async wait_closed()

Coroutine waiting until all resources are closed/released/cleaned up.

class dal.utils.redis_mocks.FakeAsyncPool(address, db=None, password=None, encoding=None, *, minsize, maxsize, ssl=None, parser=None, create_connection_timeout=None, connection_cls=None, loop=None)

Bases: ConnectionsPool

dal.utils.redis_mocks.fake_redis(target, recording_dir)

Module contents