Skip to content

array

Provide internal nodes for the Arrow C++ backed one-dimensional array runtime.

Classes:

ArrayInt32ArrayLength

ArrayInt32ArrayLength(values: list[AST])

Bases: DataType

Build an int32 array using the ASTx-compatible array runtime, then return its length. attributes: values: type: list[astx.AST] type_: type: astx.Int32

Methods:

Source code in packages/astx/src/astx/array.py
34
35
36
37
38
39
40
41
42
43
def __init__(self, values: list[astx.AST]) -> None:
    """
    title: Initialize ArrayInt32ArrayLength.
    parameters:
      values:
        type: list[astx.AST]
    """
    super().__init__()
    self.values = values
    self.type_ = astx.Int32()

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/array.py
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
def get_struct(self, simplified: bool = False) -> astx.base.ReprStruct:
    """
    title: Return the structured representation of the array helper.
    parameters:
      simplified:
        type: bool
    returns:
      type: astx.base.ReprStruct
    """
    value = cast(
        astx.base.ReprStruct,
        [item.get_struct(simplified) for item in self.values],
    )
    return self._prepare_struct(
        "ArrayInt32ArrayLength",
        value,
        simplified,
    )

to_json

to_json(simplified: bool = False) -> str
Source code in packages/astx/src/astx/base.py
400
401
402
403
404
405
406
407
408
409
def to_json(self, simplified: bool = False) -> str:
    """
    title: Return an json string that represents the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: str
    """
    return json.dumps(self.get_struct(simplified=simplified), indent=2)

to_yaml

to_yaml(simplified: bool = False) -> str
Source code in packages/astx/src/astx/base.py
387
388
389
390
391
392
393
394
395
396
397
398
def to_yaml(self, simplified: bool = False) -> str:
    """
    title: Return an yaml string that represents the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: str
    """
    return str(
        yaml.dump(self.get_struct(simplified=simplified), sort_keys=False)
    )