concepts.dsl.dsl_types.ConstantType#

class ConstantType[source]#

Bases: ValueType

The ConstantType corresponds to a constant value.

Methods

assignment_type()

Return the value type for assignment.

downcast_compatible(other[, ...])

Check if the type is downcast-compatible with the other type; that is, if this type is a subtype of the other type.

long_str()

Return the long string representation of the type.

set_parent_type(parent_type)

short_str()

Return the short string representation of the type.

unwrap_alias()

Attributes

alias

An optional alias of the type.

base_typename

Return the typename of the base type.

element_type

The element type of the type.

is_batched_list_type

Return whether the type is a multidimensional list type.

is_list_type

Return whether the type is a list type.

is_object_type

Return whether the type is an object type.

is_pyobj_value_type

Return whether the type is a Python object value type.

is_scalar_value_type

is_sequence_type

Return whether the type is a sequence type.

is_tensor_value_type

Return whether the type is a tensor value type.

is_tuple_type

Return whether the type is a tuple type.

is_uniform_sequence_type

is_value_type

Return whether the type is a value type.

is_vector_value_type

is_wrapped_value_type

parent_type

The parent type of the type.

parent_typename

Return the typename of the parent type.

typename

The (full) typename of the type.

__init__(typename, alias=None, parent_type=None)#

Initialize the type.

Parameters:
  • typename (str) – The name of the type.

  • alias (str | None) – The alias of the type.

  • parent_type (TypeBase | None)

__new__(**kwargs)#
assignment_type()#

Return the value type for assignment.

Return type:

TypeBase

downcast_compatible(other, allow_self_list=False, allow_list=False)#

Check if the type is downcast-compatible with the other type; that is, if this type is a subtype of the other type.

Parameters:
  • other (TypeBase) – the other type.

  • allow_self_list (bool) – if True, this type can be a list type derived from the other type.

  • allow_list (bool) – if True, the other type can be a list type derived from the type.

Return type:

bool

long_str()[source]#

Return the long string representation of the type.

Return type:

str

set_parent_type(parent_type)#
Parameters:

parent_type (TypeBase)

short_str()#

Return the short string representation of the type.

Return type:

str

unwrap_alias()#
property alias: str | None#

An optional alias of the type.

property base_typename#

Return the typename of the base type.

property element_type: TypeBase | None#

The element type of the type.

property is_batched_list_type: bool#

Return whether the type is a multidimensional list type.

property is_list_type: bool#

Return whether the type is a list type.

property is_object_type: bool#

Return whether the type is an object type.

property is_pyobj_value_type: bool#

Return whether the type is a Python object value type.

property is_scalar_value_type: bool#
property is_sequence_type: bool#

Return whether the type is a sequence type.

property is_tensor_value_type: bool#

Return whether the type is a tensor value type.

property is_tuple_type: bool#

Return whether the type is a tuple type.

property is_uniform_sequence_type: bool#
property is_value_type#

Return whether the type is a value type.

property is_vector_value_type: bool#
property is_wrapped_value_type: bool#
property parent_type: TypeBase | None#

The parent type of the type.

property parent_typename#

Return the typename of the parent type.

property typename: str#

The (full) typename of the type.