Skip to content

numeric

Classes:

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)
    )

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)
    )

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)
    )