tensorbay.utility.name

Name related tools.

class tensorbay.utility.name.NameMixin(name, description='')[source]

Bases: tensorbay.utility.attr.AttrsMixin, tensorbay.utility.repr.ReprMixin

A mixin class for instance which has immutable name and mutable description.

Parameters
  • name (str) – Name of the class.

  • description (str) – Description of the class.

Return type

None

name

Name of the class.

class tensorbay.utility.name.NameList(values=())[source]

Bases: tensorbay.utility.user.UserSequence[tensorbay.utility.name._T]

NameList is a list of named elements, supports searching the element by its name.

keys()[source]

Get all element names.

Returns

A tuple containing all elements names.

Return type

Tuple[str, …]

append(value)[source]

Append element to the end of the NameList.

Parameters

value (tensorbay.utility.name._T) – Element to be appended to the NameList.

Raises

KeyError – When the name of the appending object already exists in the NameList.

Return type

None

class tensorbay.utility.name.SortedNameList[source]

Bases: tensorbay.utility.user.UserSequence[tensorbay.utility.name._T]

SortedNameList is a sorted sequence which contains element with name.

It is maintained in sorted order according to the ‘name’ attr of the element.

add(value)[source]

Store element in name sorted list.

Parameters

value (tensorbay.utility.name._T) – The element needs to be added to the list.

Raises

KeyError – If the name of the added value exists in the list.

Return type

None

keys()[source]

Get all element names.

Returns

A tuple containing all elements names.

Return type

Tuple[str, …]