Skip to content

common

ClockConverter #

A class that converts time to a linear expression.

TODO(hsgwa): Migrate into record.

Summarizable #

Abstract base class that have summary property.

summary() #

Get summary.

Returns:

Type Description
Summary

summary info.

Summary #

Bases: UserDict

Summary info about for value objects and runtime data objects.

__eq__(other) #

Return True to ignore [override].

__hash__() #

Return zero to ignore [override].

__str__() #

Return yaml-format string.

Util #

find_one(condition, items) staticmethod #

Get a single item that matches the condition.

Parameters:

Name Type Description Default
condition Callable[[Any], bool]

condition

required
items Optional[Iterable[Any]]

Items to be searched.

required

Returns:

Type Description
Any

condition matched single item.

Raises:

Type Description
ItemNotFoundError

Failed to find an item that matches the condition.

MultipleItemFoundError

Failed to identify an item that matches the condition.

find_similar_one(target_name, items, key=lambda x: x, th=0.6) staticmethod #

Get a single item that matches the condition.

Parameters:

Name Type Description Default
target_name str

target_name

required
items Collection[Any]

Items to be searched.

required
key Callable[[Any], str]

key

lambda x: x
th float

Similarity judgment threshold. A candidate is mentioned only if it is higher than the threshold.

0.6

Returns:

Type Description
Any

condition matched single item.

Raises:

Type Description
ItemNotFoundError

Failed to find an item that matches the condition.

MultipleItemFoundError

Failed to identify an item that matches the condition.

find_similar_one_multi_keys(target_names, items, keys=lambda x: x, th=0.6) staticmethod #

Get a single item that matches the multi conditions.

Parameters:

Name Type Description Default
target_names Dict[str, str]

target_names

required
items Collection[Any]

Items to be searched.

required
keys Callable[[Any], Dict[str, str]]

key

lambda x: x
th float

Similarity judgment threshold. A candidate is mentioned only if it is higher than the threshold.

0.6

Returns:

Type Description
Any

conditions matched single item.

Raises:

Type Description
ItemNotFoundError

Failed to find an item that matches the conditions.

MultipleItemFoundError

Failed to identify an item that matches the conditions.