duo_ai.utils.global_variables

Attributes

Functions

set_global_variable(key, value)

Set a global variable by key.

get_global_variable(key)

Retrieve the value of a global variable by key.

get_all_global_variables()

Get the dictionary of all global variables.

Module Contents

duo_ai.utils.global_variables.GLOBAL_VARIABLES
duo_ai.utils.global_variables.set_global_variable(key, value)[source]

Set a global variable by key.

Parameters:
  • key (str) – The key for the global variable.

  • value (Any) – The value to set for the global variable.

Return type:

None

Examples

>>> set_global_variable('device', 'cuda')
duo_ai.utils.global_variables.get_global_variable(key)[source]

Retrieve the value of a global variable by key.

Parameters:

key (str) – The key for the global variable.

Returns:

The value of the global variable, or None if not set.

Return type:

Any or None

Examples

>>> get_global_variable('device')
'cuda'
duo_ai.utils.global_variables.get_all_global_variables()[source]

Get the dictionary of all global variables.

Returns:

Dictionary of all global variables.

Return type:

dict

Examples

>>> get_all_global_variables()
{'device': 'cuda', 'seed': 42}