movai_core_shared.common package

Submodules

movai_core_shared.common.time module

movai_core_shared.common.time.current_time_string() str

Returns the current time as a string in the format: d/m/Y at H:M:S :returns: a string reporesenting current time. :rtype: str

movai_core_shared.common.time.current_timestamp_float() float

Returns the current time as a float.

Returns:

a float represnt current time.

Return type:

float

movai_core_shared.common.time.current_timestamp_int() int

Returns current time as an int.

Returns:

An int representing current time.

Return type:

int

movai_core_shared.common.time.delta_time_float(delta: timedelta) float

returns a future time in timestamp format.

Parameters:

expiration_delta (timedelta) – the time delta from now.

Returns:

an float representing the time delta.

Return type:

float

movai_core_shared.common.time.delta_time_int(delta: timedelta) int

returns a future time in timestamp format.

Parameters:

expiration_delta (timedelta) – the time delta from now.

Returns:

an int representing the time delta.

Return type:

int

movai_core_shared.common.time.validate_time(value: int | str) int

Validate if value is timestamp or datetime

Parameters:

value (int|str) – The datetime to validate

Raises:

ValueError – In case value isn’t a time format.

Returns:

a timestamp value.

Return type:

int

movai_core_shared.common.time.validate_timestamp(timestamp: int) int

Validates a timestamp is in correct format.

Parameters:

timestamp (int) – The timestamp to validate

Raises:

TimeError – In case the timestamp is in the wrong format.

Returns:

The validated timestamp.

Return type:

int

movai_core_shared.common.utils module

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

Usage:

Holds various general functions related to robot configuration.

Developers: - Erez Zomer (erez@mov.ai) - 2022

movai_core_shared.common.utils.create_principal_name(domain_name: str, account_name: str) str

build principal name -> “account_name@domain_name

Args: domain_name (str): the name of the domain which the user belongs to. account_name (str): the account name of the user.

Returns:

the name in the form account_name@domain_name

Return type:

(str)

movai_core_shared.common.utils.get_ip_address() str

Returns the host(container) ip address.

Returns:

The ip address of the host.

Return type:

str

movai_core_shared.common.utils.is_enterprise() bool

Check the existence of the movai_core_enterprise package.

Returns:

True if import succeeds, False otherwise.

Return type:

bool

movai_core_shared.common.utils.is_manager() bool

Identify if this robot is the manager host machine.

Returns:

true if the fuction runs on a manager host machine, false otherwise.

Return type:

bool

async movai_core_shared.common.utils.run_blocking_code(executor, blocking_func, *args)

runs a blocking code in another thread to free the main loop for other tasks.

Parameters:
  • executor (_type_) – A thread or process to execute the code.

  • blocking_func (_type_) – The fucntion to execute.

Returns:

The results from the blocking_func

Return type:

Any

Module contents