Skip to content

literals

Modules:

Classes:

Literal

Literal(*args, **kwargs)

Bases: DataTypeOps

Methods:

Source code in packages/astx/src/astx/literals/base.py
45
46
47
def __init__(self, *args, **kwargs) -> None:  # type: ignore
    super().__init__(*args, **kwargs)
    self.ref = uuid4().hex

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/base.py
58
59
60
61
62
63
64
65
66
67
68
69
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST representation for the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"Literal[{self.type_}]: {self.value}"
    value = self.value
    return self._prepare_struct(key, 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)
    )

LiteralBoolean

LiteralBoolean(
    value: bool, loc: SourceLocation = NO_SOURCE_LOCATION
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/boolean.py
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
def __init__(
    self, value: bool, loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
    """
    title: Initialize LiteralBoolean.
    parameters:
      value:
        type: bool
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.value = value
    self.type_ = Boolean()
    self.loc = loc

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/base.py
58
59
60
61
62
63
64
65
66
67
68
69
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST representation for the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"Literal[{self.type_}]: {self.value}"
    value = self.value
    return self._prepare_struct(key, 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)
    )

LiteralComplex

LiteralComplex(
    real: float,
    imag: float,
    loc: SourceLocation = NO_SOURCE_LOCATION,
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/numeric.py
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
def __init__(
    self,
    real: float,
    imag: float,
    loc: SourceLocation = NO_SOURCE_LOCATION,
) -> None:
    """
    title: Initialize a generic complex number.
    parameters:
      real:
        type: float
      imag:
        type: float
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.value = real, imag

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/numeric.py
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST representation for the complex literal.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"{self.__class__.__name__}: {self.value}"
    value: ReprStruct = {
        "real": self.value[0],
        "imag": self.value[1],
    }
    return self._prepare_struct(key, 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)
    )

LiteralComplex32

LiteralComplex32(
    real: float,
    imag: float,
    loc: SourceLocation = NO_SOURCE_LOCATION,
)

Bases: LiteralComplex

Methods:

Source code in packages/astx/src/astx/literals/numeric.py
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
def __init__(
    self,
    real: float,
    imag: float,
    loc: SourceLocation = NO_SOURCE_LOCATION,
) -> None:
    """
    title: Initialize LiteralComplex32.
    parameters:
      real:
        type: float
      imag:
        type: float
      loc:
        type: SourceLocation
    """
    super().__init__(real, imag, loc)
    self.type_ = Complex32()

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/numeric.py
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST representation for the complex literal.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"{self.__class__.__name__}: {self.value}"
    value: ReprStruct = {
        "real": self.value[0],
        "imag": self.value[1],
    }
    return self._prepare_struct(key, 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)
    )

LiteralComplex64

LiteralComplex64(
    real: float,
    imag: float,
    loc: SourceLocation = NO_SOURCE_LOCATION,
)

Bases: LiteralComplex

Methods:

Source code in packages/astx/src/astx/literals/numeric.py
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
def __init__(
    self,
    real: float,
    imag: float,
    loc: SourceLocation = NO_SOURCE_LOCATION,
) -> None:
    """
    title: Initialize LiteralComplex64.
    parameters:
      real:
        type: float
      imag:
        type: float
      loc:
        type: SourceLocation
    """
    super().__init__(real, imag, loc)
    self.type_ = Complex64()

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/numeric.py
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST representation for the complex literal.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"{self.__class__.__name__}: {self.value}"
    value: ReprStruct = {
        "real": self.value[0],
        "imag": self.value[1],
    }
    return self._prepare_struct(key, 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)
    )

LiteralDate

LiteralDate(
    value: str, loc: SourceLocation = NO_SOURCE_LOCATION
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/temporal.py
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
def __init__(
    self, value: str, loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
    """
    title: Initialize LiteralDate.
    parameters:
      value:
        type: str
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.value = value
    self.type_ = Date()
    self.loc = loc

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/temporal.py
66
67
68
69
70
71
72
73
74
75
76
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the structure of the LiteralDate object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"LiteralDate: {self.value}"
    return self._prepare_struct(key, self.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)
    )

LiteralDateTime

LiteralDateTime(
    value: str, loc: SourceLocation = NO_SOURCE_LOCATION
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/temporal.py
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
def __init__(
    self, value: str, loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
    """
    title: Initialize LiteralDateTime.
    parameters:
      value:
        type: str
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.value = value
    self.type_ = DateTime()
    self.loc = loc

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/temporal.py
231
232
233
234
235
236
237
238
239
240
241
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the structure of the LiteralDateTime object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"LiteralDateTime: {self.value}"
    return self._prepare_struct(key, self.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)
    )

LiteralDict

LiteralDict(
    elements: dict[Literal, Literal],
    loc: SourceLocation = NO_SOURCE_LOCATION,
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/collections.py
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
def __init__(
    self,
    elements: dict[Literal, Literal],
    loc: SourceLocation = NO_SOURCE_LOCATION,
) -> None:
    """
    title: Initialize LiteralDict.
    parameters:
      elements:
        type: dict[Literal, Literal]
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.elements = dict(elements)
    key_types = {type(k.type_) for k in elements.keys()}
    value_types = {type(v.type_) for v in elements.values()}
    self.type_ = DictType(
        key_types.pop()() if len(key_types) == 1 else Int32(),
        value_types.pop()() if len(value_types) == 1 else Int32(),
    )
    self.loc = loc

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/base.py
58
59
60
61
62
63
64
65
66
67
68
69
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST representation for the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"Literal[{self.type_}]: {self.value}"
    value = self.value
    return self._prepare_struct(key, 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)
    )

LiteralFloat16

LiteralFloat16(
    value: float, loc: SourceLocation = NO_SOURCE_LOCATION
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/numeric.py
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
def __init__(
    self, value: float, loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
    """
    title: Initialize LiteralFloat16.
    parameters:
      value:
        type: float
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.value = value
    self.type_ = Float16()
    self.loc = loc

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/base.py
58
59
60
61
62
63
64
65
66
67
68
69
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST representation for the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"Literal[{self.type_}]: {self.value}"
    value = self.value
    return self._prepare_struct(key, 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)
    )

LiteralFloat32

LiteralFloat32(
    value: float, loc: SourceLocation = NO_SOURCE_LOCATION
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/numeric.py
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
def __init__(
    self, value: float, loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
    """
    title: Initialize LiteralFloat32.
    parameters:
      value:
        type: float
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.value = value
    self.type_ = Float32()
    self.loc = loc

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/base.py
58
59
60
61
62
63
64
65
66
67
68
69
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST representation for the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"Literal[{self.type_}]: {self.value}"
    value = self.value
    return self._prepare_struct(key, 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)
    )

LiteralFloat64

LiteralFloat64(
    value: float, loc: SourceLocation = NO_SOURCE_LOCATION
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/numeric.py
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
def __init__(
    self, value: float, loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
    """
    title: Initialize LiteralFloat64.
    parameters:
      value:
        type: float
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.value = value
    self.type_ = Float64()
    self.loc = loc

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/base.py
58
59
60
61
62
63
64
65
66
67
68
69
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST representation for the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"Literal[{self.type_}]: {self.value}"
    value = self.value
    return self._prepare_struct(key, 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)
    )

LiteralInt128

LiteralInt128(
    value: int, loc: SourceLocation = NO_SOURCE_LOCATION
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/numeric.py
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
def __init__(
    self, value: int, loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
    """
    title: Initialize LiteralInt128.
    parameters:
      value:
        type: int
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.value = value
    self.type_ = Int128()
    self.loc = loc

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/base.py
58
59
60
61
62
63
64
65
66
67
68
69
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST representation for the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"Literal[{self.type_}]: {self.value}"
    value = self.value
    return self._prepare_struct(key, 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)
    )

LiteralInt16

LiteralInt16(
    value: int, loc: SourceLocation = NO_SOURCE_LOCATION
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/numeric.py
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
def __init__(
    self, value: int, loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
    """
    title: Initialize LiteralInt16.
    parameters:
      value:
        type: int
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.value = value
    self.type_ = Int16()
    self.loc = loc

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/base.py
58
59
60
61
62
63
64
65
66
67
68
69
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST representation for the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"Literal[{self.type_}]: {self.value}"
    value = self.value
    return self._prepare_struct(key, 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)
    )

LiteralInt32

LiteralInt32(
    value: int, loc: SourceLocation = NO_SOURCE_LOCATION
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/numeric.py
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
def __init__(
    self, value: int, loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
    """
    title: Initialize LiteralInt32.
    parameters:
      value:
        type: int
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.value = value
    self.type_ = Int32()
    self.loc = loc

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/base.py
58
59
60
61
62
63
64
65
66
67
68
69
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST representation for the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"Literal[{self.type_}]: {self.value}"
    value = self.value
    return self._prepare_struct(key, 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)
    )

LiteralInt64

LiteralInt64(
    value: int, loc: SourceLocation = NO_SOURCE_LOCATION
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/numeric.py
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
def __init__(
    self, value: int, loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
    """
    title: Initialize LiteralInt64.
    parameters:
      value:
        type: int
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.value = value
    self.type_ = Int64()
    self.loc = loc

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/base.py
58
59
60
61
62
63
64
65
66
67
68
69
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST representation for the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"Literal[{self.type_}]: {self.value}"
    value = self.value
    return self._prepare_struct(key, 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)
    )

LiteralInt8

LiteralInt8(
    value: int, loc: SourceLocation = NO_SOURCE_LOCATION
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/numeric.py
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
def __init__(
    self, value: int, loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
    """
    title: Initialize LiteralInt8.
    parameters:
      value:
        type: int
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.value = value
    self.type_ = Int8()
    self.loc = loc

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/base.py
58
59
60
61
62
63
64
65
66
67
68
69
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST representation for the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"Literal[{self.type_}]: {self.value}"
    value = self.value
    return self._prepare_struct(key, 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)
    )

LiteralList

LiteralList(
    elements: list[Literal],
    loc: SourceLocation = NO_SOURCE_LOCATION,
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/collections.py
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
def __init__(
    self, elements: list[Literal], loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
    """
    title: Initialize LiteralList.
    parameters:
      elements:
        type: list[Literal]
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.elements = list(elements)  # Ensure correct type
    unique_types = {type(elem.type_) for elem in elements}
    self.type_ = ListType([t() for t in unique_types])
    self.loc = loc

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/base.py
58
59
60
61
62
63
64
65
66
67
68
69
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST representation for the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"Literal[{self.type_}]: {self.value}"
    value = self.value
    return self._prepare_struct(key, 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)
    )

LiteralNone

LiteralNone(loc: SourceLocation = NO_SOURCE_LOCATION)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/base.py
 94
 95
 96
 97
 98
 99
100
101
102
103
def __init__(self, loc: SourceLocation = NO_SOURCE_LOCATION) -> None:
    """
    title: Initialize LiteralNone.
    parameters:
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.value = None
    self.type_ = NoneType()

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/base.py
58
59
60
61
62
63
64
65
66
67
68
69
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST representation for the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"Literal[{self.type_}]: {self.value}"
    value = self.value
    return self._prepare_struct(key, 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)
    )

LiteralSet

LiteralSet(
    elements: set[Literal],
    loc: SourceLocation = NO_SOURCE_LOCATION,
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/collections.py
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
def __init__(
    self, elements: set[Literal], loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
    """
    title: Initialize LiteralSet.
    parameters:
      elements:
        type: set[Literal]
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.elements = set(elements)
    unique_types = {type(elem.type_) for elem in elements}
    self.type_ = SetType(
        unique_types.pop()() if len(unique_types) == 1 else Int32()
    )
    self.loc = loc

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/base.py
58
59
60
61
62
63
64
65
66
67
68
69
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST representation for the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"Literal[{self.type_}]: {self.value}"
    value = self.value
    return self._prepare_struct(key, 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)
    )

LiteralString

LiteralString(
    value: str, loc: SourceLocation = NO_SOURCE_LOCATION
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/string.py
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
def __init__(
    self, value: str, loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
    """
    title: Initialize LiteralString.
    parameters:
      value:
        type: str
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.value = value
    self.type_ = String()
    self.loc = loc

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/string.py
62
63
64
65
66
67
68
69
70
71
72
73
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST structure of the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"LiteralString: {self.value}"
    value = self.value
    return self._prepare_struct(key, 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)
    )

LiteralTime

LiteralTime(
    value: str, loc: SourceLocation = NO_SOURCE_LOCATION
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/temporal.py
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
def __init__(
    self, value: str, loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
    """
    title: Initialize LiteralTime.
    parameters:
      value:
        type: str
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.value = value
    self.type_ = Time()
    self.loc = loc

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/temporal.py
121
122
123
124
125
126
127
128
129
130
131
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the structure of the LiteralTime object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"LiteralTime: {self.value}"
    return self._prepare_struct(key, self.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)
    )

LiteralTimestamp

LiteralTimestamp(
    value: str, loc: SourceLocation = NO_SOURCE_LOCATION
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/temporal.py
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
def __init__(
    self, value: str, loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
    """
    title: Initialize LiteralTimestamp.
    parameters:
      value:
        type: str
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.value = value
    self.type_ = Timestamp()
    self.loc = loc

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/temporal.py
176
177
178
179
180
181
182
183
184
185
186
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the structure of the LiteralTimestamp object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"LiteralTimestamp: {self.value}"
    return self._prepare_struct(key, self.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)
    )

LiteralTuple

LiteralTuple(
    elements: tuple[Literal, ...],
    loc: SourceLocation = NO_SOURCE_LOCATION,
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/collections.py
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
def __init__(
    self,
    elements: tuple[Literal, ...],
    loc: SourceLocation = NO_SOURCE_LOCATION,
) -> None:
    """
    title: Initialize LiteralTuple.
    parameters:
      elements:
        type: tuple[Literal, Ellipsis]
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.elements = elements
    self.type_ = TupleType([elem.type_ for elem in elements])
    self.loc = loc

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/base.py
58
59
60
61
62
63
64
65
66
67
68
69
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST representation for the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"Literal[{self.type_}]: {self.value}"
    value = self.value
    return self._prepare_struct(key, 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)
    )

LiteralUInt128

LiteralUInt128(
    value: int, loc: SourceLocation = NO_SOURCE_LOCATION
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/numeric.py
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
def __init__(
    self, value: int, loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
    """
    title: Initialize LiteralUInt128.
    parameters:
      value:
        type: int
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.value = value
    self.type_ = UInt128()
    self.loc = loc

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/base.py
58
59
60
61
62
63
64
65
66
67
68
69
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST representation for the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"Literal[{self.type_}]: {self.value}"
    value = self.value
    return self._prepare_struct(key, 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)
    )

LiteralUInt16

LiteralUInt16(
    value: int, loc: SourceLocation = NO_SOURCE_LOCATION
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/numeric.py
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
def __init__(
    self, value: int, loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
    """
    title: Initialize LiteralUInt16.
    parameters:
      value:
        type: int
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.value = value
    self.type_ = UInt16()
    self.loc = loc

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/base.py
58
59
60
61
62
63
64
65
66
67
68
69
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST representation for the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"Literal[{self.type_}]: {self.value}"
    value = self.value
    return self._prepare_struct(key, 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)
    )

LiteralUInt32

LiteralUInt32(
    value: int, loc: SourceLocation = NO_SOURCE_LOCATION
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/numeric.py
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
def __init__(
    self, value: int, loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
    """
    title: Initialize LiteralUInt32.
    parameters:
      value:
        type: int
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.value = value
    self.type_ = UInt32()
    self.loc = loc

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/base.py
58
59
60
61
62
63
64
65
66
67
68
69
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST representation for the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"Literal[{self.type_}]: {self.value}"
    value = self.value
    return self._prepare_struct(key, 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)
    )

LiteralUInt64

LiteralUInt64(
    value: int, loc: SourceLocation = NO_SOURCE_LOCATION
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/numeric.py
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
def __init__(
    self, value: int, loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
    """
    title: Initialize LiteralUInt64.
    parameters:
      value:
        type: int
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.value = value
    self.type_ = UInt64()
    self.loc = loc

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/base.py
58
59
60
61
62
63
64
65
66
67
68
69
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST representation for the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"Literal[{self.type_}]: {self.value}"
    value = self.value
    return self._prepare_struct(key, 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)
    )

LiteralUInt8

LiteralUInt8(
    value: int, loc: SourceLocation = NO_SOURCE_LOCATION
)

Bases: Literal

Methods:

Source code in packages/astx/src/astx/literals/numeric.py
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
def __init__(
    self, value: int, loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
    """
    title: Initialize LiteralUInt8.
    parameters:
      value:
        type: int
      loc:
        type: SourceLocation
    """
    super().__init__(loc)
    self.value = value
    self.type_ = UInt8()
    self.loc = loc

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/base.py
58
59
60
61
62
63
64
65
66
67
68
69
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the AST representation for the object.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"Literal[{self.type_}]: {self.value}"
    value = self.value
    return self._prepare_struct(key, 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)
    )

LiteralUTF8Char

LiteralUTF8Char(
    value: str, loc: SourceLocation = NO_SOURCE_LOCATION
)

Bases: LiteralString

Methods:

Source code in packages/astx/src/astx/literals/string.py
142
143
144
145
146
def __init__(
    self, value: str, loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
    super().__init__(value=value, loc=loc)
    self.type_ = UTF8Char()

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/string.py
156
157
158
159
160
161
162
163
164
165
166
167
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the structure of the object in a simplified.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"LiteralUTF8Char: {self.value}"
    value = self.value
    return self._prepare_struct(key, 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)
    )

LiteralUTF8String

LiteralUTF8String(
    value: str, loc: SourceLocation = NO_SOURCE_LOCATION
)

Bases: LiteralString

Methods:

Source code in packages/astx/src/astx/literals/string.py
95
96
97
98
99
def __init__(
    self, value: str, loc: SourceLocation = NO_SOURCE_LOCATION
) -> None:
    super().__init__(value=value, loc=loc)
    self.type_ = UTF8String()

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in packages/astx/src/astx/literals/string.py
109
110
111
112
113
114
115
116
117
118
119
120
def get_struct(self, simplified: bool = False) -> ReprStruct:
    """
    title: Return the structure of the object in a simplified.
    parameters:
      simplified:
        type: bool
    returns:
      type: ReprStruct
    """
    key = f"LiteralUTF8String: {self.value}"
    value = self.value
    return self._prepare_struct(key, 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)
    )