tensorbay.utility.common

Common_loads method, EqMixin class.

common_loads() is a common method for loading an object from a dict or a list of dict.

EqMixin is a mixin class to support __eq__() method, which compares all the instance variables.

tensorbay.utility.common.common_loads(object_class: Type[tensorbay.utility.common._T], contents: Any) tensorbay.utility.common._T[source]

A common method for loading an object from a dict or a list of dict.

Parameters
  • object_class – The class of the object to be loaded.

  • contents – The information of the object in a dict or a list of dict.

Returns

The loaded object.

class tensorbay.utility.common.EqMixin[source]

Bases: object

A mixin class to support __eq__() method.

The __eq__() method defined here compares all the instance variables.

tensorbay.utility.common.locked(func: tensorbay.utility.common._CallableWithoutReturnValue) tensorbay.utility.common._CallableWithoutReturnValue[source]

The decorator to add threading lock for methods.

Parameters

func – The method needs to add threading lock.

Returns

The method with theading locked.