beancount_ast 0.0.1a5__cp310-abi3-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,88 @@
1
+ from ._ast import (
2
+ Amount,
3
+ Balance,
4
+ Close,
5
+ Comment,
6
+ Commodity,
7
+ CostAmount,
8
+ CostSpec,
9
+ Custom,
10
+ CustomValue,
11
+ Document,
12
+ Event,
13
+ File,
14
+ Headline,
15
+ Raw,
16
+ Include,
17
+ KeyValue,
18
+ KeyValueValue,
19
+ Note,
20
+ NumberExpr,
21
+ Open,
22
+ Option,
23
+ Pad,
24
+ ParseError,
25
+ ParseErrorDetail,
26
+ Plugin,
27
+ PopMeta,
28
+ Posting,
29
+ Price,
30
+ PushMeta,
31
+ Query,
32
+ Span,
33
+ SpannedBinaryOp,
34
+ SpannedBool,
35
+ SpannedKeyValueValue,
36
+ SpannedPriceOperator,
37
+ SpannedStr,
38
+ Tag,
39
+ Transaction,
40
+ parse_file,
41
+ parse_string,
42
+ )
43
+
44
+ from ._directive import Directive
45
+
46
+ __all__ = [
47
+ "Amount",
48
+ "Balance",
49
+ "Close",
50
+ "Comment",
51
+ "Commodity",
52
+ "CostAmount",
53
+ "CostSpec",
54
+ "Custom",
55
+ "CustomValue",
56
+ "Directive",
57
+ "Document",
58
+ "Event",
59
+ "File",
60
+ "Headline",
61
+ "Raw",
62
+ "Include",
63
+ "KeyValue",
64
+ "KeyValueValue",
65
+ "Note",
66
+ "NumberExpr",
67
+ "Open",
68
+ "Option",
69
+ "Pad",
70
+ "ParseError",
71
+ "ParseErrorDetail",
72
+ "Plugin",
73
+ "PopMeta",
74
+ "Posting",
75
+ "Price",
76
+ "PushMeta",
77
+ "Query",
78
+ "Span",
79
+ "SpannedBinaryOp",
80
+ "SpannedBool",
81
+ "SpannedKeyValueValue",
82
+ "SpannedPriceOperator",
83
+ "SpannedStr",
84
+ "Tag",
85
+ "Transaction",
86
+ "parse_file",
87
+ "parse_string",
88
+ ]
beancount_ast/_ast.pyd ADDED
Binary file
beancount_ast/_ast.pyi ADDED
@@ -0,0 +1,586 @@
1
+ import typing
2
+
3
+ from ._directive import Directive
4
+
5
+ __all__ = [
6
+ "Amount",
7
+ "Balance",
8
+ "Close",
9
+ "Comment",
10
+ "Commodity",
11
+ "CostAmount",
12
+ "CostSpec",
13
+ "Custom",
14
+ "CustomValue",
15
+ "Directive",
16
+ "Document",
17
+ "Event",
18
+ "File",
19
+ "Headline",
20
+ "Raw",
21
+ "Include",
22
+ "KeyValue",
23
+ "KeyValueValue",
24
+ "Note",
25
+ "NumberExpr",
26
+ "Open",
27
+ "Option",
28
+ "Pad",
29
+ "ParseError",
30
+ "ParseErrorDetail",
31
+ "Plugin",
32
+ "PopMeta",
33
+ "Posting",
34
+ "Price",
35
+ "PushMeta",
36
+ "Query",
37
+ "Span",
38
+ "SpannedBinaryOp",
39
+ "SpannedBool",
40
+ "SpannedKeyValueValue",
41
+ "SpannedPriceOperator",
42
+ "SpannedStr",
43
+ "Tag",
44
+ "Transaction",
45
+ "parse_file",
46
+ "parse_string",
47
+ ]
48
+
49
+ class ParseError(ValueError):
50
+ errors: list[ParseErrorDetail]
51
+ filename: str
52
+
53
+ @typing.final
54
+ class ParseErrorDetail:
55
+ @property
56
+ def filename(self) -> str: ...
57
+ @property
58
+ def message(self) -> str: ...
59
+ @property
60
+ def span(self) -> Span: ...
61
+ @property
62
+ def start(self) -> int: ...
63
+ @property
64
+ def end(self) -> int: ...
65
+ @property
66
+ def start_line(self) -> int: ...
67
+ @property
68
+ def start_col(self) -> int: ...
69
+ @property
70
+ def end_line(self) -> int: ...
71
+ @property
72
+ def end_col(self) -> int: ...
73
+ @property
74
+ def expected(self) -> list[str]: ...
75
+ @property
76
+ def found(self) -> str | None: ...
77
+
78
+ @typing.final
79
+ class File:
80
+ @property
81
+ def filename(self) -> str: ...
82
+ @property
83
+ def content(self) -> str: ...
84
+ @property
85
+ def directives(self) -> list[Directive]: ...
86
+
87
+ @typing.final
88
+ class Amount:
89
+ @property
90
+ def raw(self) -> SpannedStr: ...
91
+ @property
92
+ def number(self) -> NumberExpr: ...
93
+ @property
94
+ def currency(self) -> SpannedStr | None: ...
95
+ def dump(self) -> str: ...
96
+
97
+ @typing.final
98
+ class Balance(Directive):
99
+ @property
100
+ def span(self) -> Span: ...
101
+ @property
102
+ def file(self) -> File: ...
103
+ @property
104
+ def date(self) -> SpannedStr: ...
105
+ @property
106
+ def account(self) -> SpannedStr: ...
107
+ @property
108
+ def amount(self) -> Amount: ...
109
+ @property
110
+ def tolerance(self) -> SpannedStr | None: ...
111
+ @property
112
+ def comment(self) -> SpannedStr | None: ...
113
+ @property
114
+ def key_values(self) -> list[KeyValue]: ...
115
+ def dump(self) -> str: ...
116
+
117
+ @typing.final
118
+ class Close(Directive):
119
+ @property
120
+ def span(self) -> Span: ...
121
+ @property
122
+ def file(self) -> File: ...
123
+ @property
124
+ def date(self) -> SpannedStr: ...
125
+ @property
126
+ def account(self) -> SpannedStr: ...
127
+ @property
128
+ def comment(self) -> SpannedStr | None: ...
129
+ @property
130
+ def key_values(self) -> list[KeyValue]: ...
131
+ def dump(self) -> str: ...
132
+
133
+ @typing.final
134
+ class Comment(Directive):
135
+ @property
136
+ def span(self) -> Span: ...
137
+ @property
138
+ def file(self) -> File: ...
139
+ @property
140
+ def text(self) -> SpannedStr: ...
141
+ def dump(self) -> str: ...
142
+
143
+ @typing.final
144
+ class Commodity(Directive):
145
+ @property
146
+ def span(self) -> Span: ...
147
+ @property
148
+ def file(self) -> File: ...
149
+ @property
150
+ def date(self) -> SpannedStr: ...
151
+ @property
152
+ def currency(self) -> SpannedStr: ...
153
+ @property
154
+ def comment(self) -> SpannedStr | None: ...
155
+ @property
156
+ def key_values(self) -> list[KeyValue]: ...
157
+ def dump(self) -> str: ...
158
+
159
+ @typing.final
160
+ class CostAmount:
161
+ @property
162
+ def per(self) -> NumberExpr | None: ...
163
+ @property
164
+ def total(self) -> NumberExpr | None: ...
165
+ @property
166
+ def currency(self) -> SpannedStr | None: ...
167
+
168
+ @typing.final
169
+ class CostSpec:
170
+ @property
171
+ def raw(self) -> SpannedStr: ...
172
+ @property
173
+ def amount(self) -> CostAmount | None: ...
174
+ @property
175
+ def date(self) -> SpannedStr | None: ...
176
+ @property
177
+ def label(self) -> SpannedStr | None: ...
178
+ @property
179
+ def merge(self) -> SpannedBool | None: ...
180
+ @property
181
+ def is_total(self) -> SpannedBool: ...
182
+ def dump(self) -> str: ...
183
+
184
+ @typing.final
185
+ class Custom(Directive):
186
+ @property
187
+ def span(self) -> Span: ...
188
+ @property
189
+ def file(self) -> File: ...
190
+ @property
191
+ def date(self) -> SpannedStr: ...
192
+ @property
193
+ def name(self) -> SpannedStr: ...
194
+ @property
195
+ def values(self) -> list[CustomValue]: ...
196
+ @property
197
+ def comment(self) -> SpannedStr | None: ...
198
+ @property
199
+ def key_values(self) -> list[KeyValue]: ...
200
+ def dump(self) -> str: ...
201
+
202
+ @typing.final
203
+ class CustomValue:
204
+ @property
205
+ def raw(self) -> SpannedStr: ...
206
+ @property
207
+ def kind(self) -> str: ...
208
+ @property
209
+ def number(self) -> NumberExpr | None: ...
210
+ @property
211
+ def amount(self) -> Amount | None: ...
212
+ def dump(self) -> str: ...
213
+
214
+ @typing.final
215
+ class Document(Directive):
216
+ @property
217
+ def span(self) -> Span: ...
218
+ @property
219
+ def file(self) -> File: ...
220
+ @property
221
+ def date(self) -> SpannedStr: ...
222
+ @property
223
+ def account(self) -> SpannedStr: ...
224
+ @property
225
+ def filename(self) -> SpannedStr: ...
226
+ @property
227
+ def tags_links(self) -> list[SpannedStr] | None: ...
228
+ @property
229
+ def tags(self) -> list[SpannedStr]: ...
230
+ @property
231
+ def links(self) -> list[SpannedStr]: ...
232
+ @property
233
+ def comment(self) -> SpannedStr | None: ...
234
+ @property
235
+ def key_values(self) -> list[KeyValue]: ...
236
+ def dump(self) -> str: ...
237
+
238
+ @typing.final
239
+ class Event(Directive):
240
+ @property
241
+ def span(self) -> Span: ...
242
+ @property
243
+ def file(self) -> File: ...
244
+ @property
245
+ def date(self) -> SpannedStr: ...
246
+ @property
247
+ def event_type(self) -> SpannedStr: ...
248
+ @property
249
+ def desc(self) -> SpannedStr: ...
250
+ @property
251
+ def comment(self) -> SpannedStr | None: ...
252
+ @property
253
+ def key_values(self) -> list[KeyValue]: ...
254
+ def dump(self) -> str: ...
255
+
256
+ @typing.final
257
+ class Headline(Directive):
258
+ @property
259
+ def span(self) -> Span: ...
260
+ @property
261
+ def file(self) -> File: ...
262
+ @property
263
+ def text(self) -> SpannedStr: ...
264
+ def dump(self) -> str: ...
265
+
266
+ @typing.final
267
+ class Raw(Directive):
268
+ @property
269
+ def span(self) -> Span: ...
270
+ @property
271
+ def file(self) -> File: ...
272
+ @property
273
+ def text(self) -> str: ...
274
+ def dump(self) -> str: ...
275
+
276
+ @typing.final
277
+ class Include(Directive):
278
+ @property
279
+ def span(self) -> Span: ...
280
+ @property
281
+ def file(self) -> File: ...
282
+ @property
283
+ def filename(self) -> SpannedStr: ...
284
+ def dump(self) -> str: ...
285
+
286
+ @typing.final
287
+ class KeyValue:
288
+ @property
289
+ def span(self) -> Span: ...
290
+ @property
291
+ def file(self) -> File: ...
292
+ @property
293
+ def key(self) -> SpannedStr: ...
294
+ @property
295
+ def value(self) -> SpannedKeyValueValue | None: ...
296
+ def dump(self) -> str: ...
297
+
298
+ @typing.final
299
+ class KeyValueValue:
300
+ @property
301
+ def kind(self) -> str: ...
302
+ @property
303
+ def string(self) -> str | None: ...
304
+ @property
305
+ def boolean(self) -> bool | None: ...
306
+
307
+ @typing.final
308
+ @typing.final
309
+ class Note(Directive):
310
+ @property
311
+ def span(self) -> Span: ...
312
+ @property
313
+ def file(self) -> File: ...
314
+ @property
315
+ def date(self) -> SpannedStr: ...
316
+ @property
317
+ def account(self) -> SpannedStr: ...
318
+ @property
319
+ def note(self) -> SpannedStr: ...
320
+ @property
321
+ def comment(self) -> SpannedStr | None: ...
322
+ @property
323
+ def key_values(self) -> list[KeyValue]: ...
324
+ def dump(self) -> str: ...
325
+
326
+ @typing.final
327
+ class NumberExpr:
328
+ @property
329
+ def kind(self) -> str: ...
330
+ @property
331
+ def span(self) -> Span: ...
332
+ @property
333
+ def file(self) -> File: ...
334
+ @property
335
+ def literal(self) -> SpannedStr | None: ...
336
+ @property
337
+ def left(self) -> NumberExpr | None: ...
338
+ @property
339
+ def op(self) -> SpannedBinaryOp | None: ...
340
+ @property
341
+ def right(self) -> NumberExpr | None: ...
342
+ def dump(self) -> str: ...
343
+
344
+ @typing.final
345
+ class Open(Directive):
346
+ @property
347
+ def span(self) -> Span: ...
348
+ @property
349
+ def file(self) -> File: ...
350
+ @property
351
+ def date(self) -> SpannedStr: ...
352
+ @property
353
+ def account(self) -> SpannedStr: ...
354
+ @property
355
+ def currencies(self) -> list[SpannedStr]: ...
356
+ @property
357
+ def opt_booking(self) -> SpannedStr | None: ...
358
+ @property
359
+ def comment(self) -> SpannedStr | None: ...
360
+ @property
361
+ def key_values(self) -> list[KeyValue]: ...
362
+ def dump(self) -> str: ...
363
+
364
+ @typing.final
365
+ class Option(Directive):
366
+ @property
367
+ def span(self) -> Span: ...
368
+ @property
369
+ def file(self) -> File: ...
370
+ @property
371
+ def key(self) -> SpannedStr: ...
372
+ @property
373
+ def value(self) -> SpannedStr: ...
374
+ def dump(self) -> str: ...
375
+
376
+ @typing.final
377
+ class Pad(Directive):
378
+ @property
379
+ def span(self) -> Span: ...
380
+ @property
381
+ def file(self) -> File: ...
382
+ @property
383
+ def date(self) -> SpannedStr: ...
384
+ @property
385
+ def account(self) -> SpannedStr: ...
386
+ @property
387
+ def from_account(self) -> SpannedStr: ...
388
+ @property
389
+ def comment(self) -> SpannedStr | None: ...
390
+ @property
391
+ def key_values(self) -> list[KeyValue]: ...
392
+ def dump(self) -> str: ...
393
+
394
+ @typing.final
395
+ class Plugin(Directive):
396
+ @property
397
+ def span(self) -> Span: ...
398
+ @property
399
+ def file(self) -> File: ...
400
+ @property
401
+ def name(self) -> SpannedStr: ...
402
+ @property
403
+ def config(self) -> SpannedStr | None: ...
404
+ def dump(self) -> str: ...
405
+
406
+ @typing.final
407
+ class PopMeta(Directive):
408
+ @property
409
+ def span(self) -> Span: ...
410
+ @property
411
+ def file(self) -> File: ...
412
+ @property
413
+ def key(self) -> SpannedStr: ...
414
+ def dump(self) -> str: ...
415
+
416
+ @typing.final
417
+ class Posting:
418
+ @property
419
+ def span(self) -> Span: ...
420
+ @property
421
+ def file(self) -> File: ...
422
+ @property
423
+ def opt_flag(self) -> SpannedStr | None: ...
424
+ @property
425
+ def account(self) -> SpannedStr: ...
426
+ @property
427
+ def amount(self) -> Amount | None: ...
428
+ @property
429
+ def cost_spec(self) -> CostSpec | None: ...
430
+ @property
431
+ def price_operator(self) -> SpannedPriceOperator | None: ...
432
+ @property
433
+ def price_annotation(self) -> Amount | None: ...
434
+ @property
435
+ def comment(self) -> SpannedStr | None: ...
436
+ @property
437
+ def key_values(self) -> list[KeyValue]: ...
438
+ def dump(self) -> str: ...
439
+
440
+ @typing.final
441
+ class Price(Directive):
442
+ @property
443
+ def span(self) -> Span: ...
444
+ @property
445
+ def file(self) -> File: ...
446
+ @property
447
+ def date(self) -> SpannedStr: ...
448
+ @property
449
+ def currency(self) -> SpannedStr: ...
450
+ @property
451
+ def amount(self) -> Amount: ...
452
+ @property
453
+ def comment(self) -> SpannedStr | None: ...
454
+ @property
455
+ def key_values(self) -> list[KeyValue]: ...
456
+ def dump(self) -> str: ...
457
+
458
+ @typing.final
459
+ class PushMeta(Directive):
460
+ @property
461
+ def span(self) -> Span: ...
462
+ @property
463
+ def file(self) -> File: ...
464
+ @property
465
+ def key(self) -> SpannedStr: ...
466
+ @property
467
+ def value(self) -> SpannedKeyValueValue | None: ...
468
+ def dump(self) -> str: ...
469
+
470
+ @typing.final
471
+ class Query(Directive):
472
+ @property
473
+ def span(self) -> Span: ...
474
+ @property
475
+ def file(self) -> File: ...
476
+ @property
477
+ def date(self) -> SpannedStr: ...
478
+ @property
479
+ def name(self) -> SpannedStr: ...
480
+ @property
481
+ def query(self) -> SpannedStr: ...
482
+ @property
483
+ def comment(self) -> SpannedStr | None: ...
484
+ @property
485
+ def key_values(self) -> list[KeyValue]: ...
486
+ def dump(self) -> str: ...
487
+
488
+ @typing.final
489
+ class Span:
490
+ @property
491
+ def start(self) -> int: ...
492
+ @property
493
+ def end(self) -> int: ...
494
+
495
+ @typing.final
496
+ class SpannedBinaryOp:
497
+ @property
498
+ def span(self) -> Span: ...
499
+ @property
500
+ def file(self) -> File: ...
501
+ @property
502
+ def content(self) -> str: ...
503
+ def dump(self) -> str: ...
504
+
505
+ @typing.final
506
+ class SpannedBool:
507
+ @property
508
+ def span(self) -> Span: ...
509
+ @property
510
+ def file(self) -> File: ...
511
+ @property
512
+ def content(self) -> bool: ...
513
+ def dump(self) -> str: ...
514
+
515
+ @typing.final
516
+ class SpannedKeyValueValue:
517
+ @property
518
+ def span(self) -> Span: ...
519
+ @property
520
+ def file(self) -> File: ...
521
+ @property
522
+ def content(self) -> KeyValueValue: ...
523
+ def dump(self) -> str: ...
524
+
525
+ @typing.final
526
+ class SpannedPriceOperator:
527
+ @property
528
+ def span(self) -> Span: ...
529
+ @property
530
+ def file(self) -> File: ...
531
+ @property
532
+ def content(self) -> str: ...
533
+ def dump(self) -> str: ...
534
+
535
+ @typing.final
536
+ class SpannedStr:
537
+ @property
538
+ def span(self) -> Span: ...
539
+ @property
540
+ def file(self) -> File: ...
541
+ @property
542
+ def content(self) -> str: ...
543
+ def dump(self) -> str: ...
544
+
545
+ @typing.final
546
+ class Tag(Directive):
547
+ @property
548
+ def span(self) -> Span: ...
549
+ @property
550
+ def file(self) -> File: ...
551
+ @property
552
+ def tag(self) -> SpannedStr: ...
553
+ @property
554
+ def action(self) -> str: ...
555
+ def dump(self) -> str: ...
556
+
557
+ @typing.final
558
+ class Transaction(Directive):
559
+ @property
560
+ def span(self) -> Span: ...
561
+ @property
562
+ def file(self) -> File: ...
563
+ @property
564
+ def date(self) -> SpannedStr: ...
565
+ @property
566
+ def txn(self) -> SpannedStr | None: ...
567
+ @property
568
+ def payee(self) -> SpannedStr | None: ...
569
+ @property
570
+ def narration(self) -> SpannedStr | None: ...
571
+ @property
572
+ def tags_links(self) -> list[SpannedStr] | None: ...
573
+ @property
574
+ def tags(self) -> list[SpannedStr]: ...
575
+ @property
576
+ def links(self) -> list[SpannedStr]: ...
577
+ @property
578
+ def comment(self) -> SpannedStr | None: ...
579
+ @property
580
+ def key_values(self) -> list[KeyValue]: ...
581
+ @property
582
+ def postings(self) -> list[Posting]: ...
583
+ def dump(self) -> str: ...
584
+
585
+ def parse_file(filename: str) -> File: ...
586
+ def parse_string(content: str, filename: str = "<string>") -> File: ...
@@ -0,0 +1,58 @@
1
+ import abc
2
+
3
+ from beancount_ast._ast import (
4
+ Balance,
5
+ Close,
6
+ Comment,
7
+ Commodity,
8
+ Custom,
9
+ Document,
10
+ Event,
11
+ File,
12
+ Headline,
13
+ Include,
14
+ Note,
15
+ Open,
16
+ Option,
17
+ Pad,
18
+ Plugin,
19
+ PopMeta,
20
+ Price,
21
+ PushMeta,
22
+ Query,
23
+ Raw,
24
+ Span,
25
+ Tag,
26
+ Transaction,
27
+ )
28
+
29
+
30
+ class Directive(abc.ABC):
31
+ @property
32
+ def span(self) -> Span: ...
33
+ @property
34
+ def file(self) -> File: ...
35
+ def dump(self) -> str: ...
36
+
37
+
38
+ Directive.register(Open)
39
+ Directive.register(Close)
40
+ Directive.register(Balance)
41
+ Directive.register(Pad)
42
+ Directive.register(Transaction)
43
+ Directive.register(Commodity)
44
+ Directive.register(Price)
45
+ Directive.register(Event)
46
+ Directive.register(Query)
47
+ Directive.register(Note)
48
+ Directive.register(Document)
49
+ Directive.register(Custom)
50
+ Directive.register(Option)
51
+ Directive.register(Include)
52
+ Directive.register(Plugin)
53
+ Directive.register(Tag)
54
+ Directive.register(PushMeta)
55
+ Directive.register(PopMeta)
56
+ Directive.register(Comment)
57
+ Directive.register(Headline)
58
+ Directive.register(Raw)
beancount_ast/py.typed ADDED
File without changes
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.4
2
+ Name: beancount_ast
3
+ Version: 0.0.1a5
4
+ Summary: Parse Beancount content into AST
5
+ Home-Page: https://github.com/trim21/beancount-ast
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
8
+
9
+ # beancount_ast
10
+
11
+ Parse Beancount input into the Rust parser's directive AST from Python.
12
+
13
+ This package intentionally exposes the *parser AST* (directives + spans + raw tokens),
14
+ not Beancount's semantic `beancount.core` directive model.
15
+
16
+ Notes:
17
+ - Classes have a dataclass-like constructor and repr (via `pyderive`).
18
+
@@ -0,0 +1,8 @@
1
+ beancount_ast\__init__.py,sha256=DOJhAg08LjfPThEAEHf0kCYdef78z7K-Ui3_rt3F0hM,1401
2
+ beancount_ast\_ast.pyd,sha256=_OOejY-fZGt19eDYNwnydOqxifMQfvE6SbXyMmGYqao,3151872
3
+ beancount_ast\_ast.pyi,sha256=quYY-Dx_ImN_aoDqGrSJCfHJ5RE6lm_jSbtn7e4srmE,14251
4
+ beancount_ast\_directive.py,sha256=ZyjiZIhIol1NyZq1gXuZf487TGaNyr5Gad0-QqZpnhs,1099
5
+ beancount_ast\py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ beancount_ast-0.0.1a5.dist-info\METADATA,sha256=VGOZdq2n6GE262-usefQCfusGE-4oRZ-ZMNrrs0Pqgo,570
7
+ beancount_ast-0.0.1a5.dist-info\WHEEL,sha256=ZMDDxh9OPoaLQ4P2dJmgI1XsENYSzjzq8fErKKVw5iE,96
8
+ beancount_ast-0.0.1a5.dist-info\RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.11.5)
3
+ Root-Is-Purelib: false
4
+ Tag: cp310-abi3-win_amd64