Skip to content

temporal

Classes:

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

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