concepts.dsl.dsl_types.ListType#

class ListType[source]#

Bases: TypeBase

Methods

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.

short_str()

Return the short string representation of the type.

Attributes

alias

An optional alias of the type.

is_list_type

Return whether the type is a list 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.

element_type

The element type of the list.

__init__(element_type, alias=None)[source]#

Initialize the type.

Parameters:
  • typename – The name of the type.

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

  • element_type (TypeBase) –

__new__(**kwargs)#
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()#

Return the long string representation of the type.

Return type:

str

short_str()#

Return the short string representation of the type.

Return type:

str

property alias: str | None#

An optional alias of the type.

element_type: TypeBase#

The element type of the list.

property is_list_type#

Return whether the type is a list type.

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.