|
2 | 2 | from dataclasses import dataclass |
3 | 3 | import itertools |
4 | 4 | import numbers |
5 | | -import time |
6 | 5 | import sys |
7 | | -import os |
8 | | -import traceback |
9 | | -import json |
10 | 6 | import re |
11 | 7 |
|
12 | 8 | from collections import defaultdict |
13 | 9 | import types |
14 | | -import typing |
15 | 10 |
|
16 | 11 | from lark import Lark, Transformer, Tree, Token |
17 | 12 | from lark.exceptions import UnexpectedToken, UnexpectedCharacters |
@@ -260,7 +255,6 @@ def __repr__(self): |
260 | 255 |
|
261 | 256 |
|
262 | 257 | def create_step_entity(entity_tree): |
263 | | - entity = {} |
264 | 258 | t = T(visit_tokens=True).transform(entity_tree) |
265 | 259 |
|
266 | 260 | def get_line_number(t): |
@@ -473,26 +467,3 @@ def by_type(self, type: str) -> list[entity_instance]: |
473 | 467 |
|
474 | 468 | def open(fn) -> file: |
475 | 469 | return file(parse(filename=fn, with_tree=True, with_header=True)) |
476 | | - |
477 | | - |
478 | | -if __name__ == "__main__": |
479 | | - args = [x for x in sys.argv[1:] if not x.startswith("-")] |
480 | | - flags = [x for x in sys.argv[1:] if x.startswith("-")] |
481 | | - |
482 | | - fn = args[0] |
483 | | - start_time = time.time() |
484 | | - |
485 | | - try: |
486 | | - parse(filename=fn, with_progress="--progress" in flags, with_tree=False) |
487 | | - if "--json" not in flags: |
488 | | - print("Valid", file=sys.stderr) |
489 | | - exit(0) |
490 | | - except ValidationError as exc: |
491 | | - if "--json" not in flags: |
492 | | - print(exc, file=sys.stderr) |
493 | | - else: |
494 | | - import sys |
495 | | - import json |
496 | | - |
497 | | - json.dump(exc.asdict(), sys.stdout) |
498 | | - exit(1) |
0 commit comments