pytrilogy 0.0.3.5__tar.gz → 0.0.3.6__tar.gz
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.
Potentially problematic release.
This version of pytrilogy might be problematic. Click here for more details.
- {pytrilogy-0.0.3.5/pytrilogy.egg-info → pytrilogy-0.0.3.6}/PKG-INFO +1 -1
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6/pytrilogy.egg-info}/PKG-INFO +1 -1
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/tests/test_parse_engine.py +1 -1
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/__init__.py +1 -1
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/models/environment.py +4 -3
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/parsing/parse_engine.py +24 -23
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/LICENSE.md +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/README.md +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/pyproject.toml +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/pytrilogy.egg-info/SOURCES.txt +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/pytrilogy.egg-info/dependency_links.txt +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/pytrilogy.egg-info/entry_points.txt +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/pytrilogy.egg-info/requires.txt +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/pytrilogy.egg-info/top_level.txt +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/setup.cfg +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/setup.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/tests/test_datatypes.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/tests/test_declarations.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/tests/test_derived_concepts.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/tests/test_discovery_nodes.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/tests/test_enums.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/tests/test_environment.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/tests/test_executor.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/tests/test_functions.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/tests/test_imports.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/tests/test_metadata.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/tests/test_models.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/tests/test_multi_join_assignments.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/tests/test_parsing.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/tests/test_partial_handling.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/tests/test_query_processing.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/tests/test_select.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/tests/test_show.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/tests/test_statements.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/tests/test_undefined_concept.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/tests/test_where_clause.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/authoring/__init__.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/compiler.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/constants.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/__init__.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/constants.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/enums.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/env_processor.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/environment_helpers.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/ergonomics.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/exceptions.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/functions.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/graph_models.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/internal.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/models/__init__.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/models/author.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/models/build.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/models/build_environment.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/models/core.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/models/datasource.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/models/execute.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/optimization.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/optimizations/__init__.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/optimizations/base_optimization.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/optimizations/inline_constant.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/optimizations/inline_datasource.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/optimizations/predicate_pushdown.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/__init__.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/concept_strategies_v3.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/graph_utils.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/__init__.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/basic_node.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/common.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/filter_node.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/group_node.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/group_to_node.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/multiselect_node.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/node_merge_node.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/rowset_node.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/select_helpers/__init__.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/select_helpers/datasource_injection.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/select_merge_node.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/select_node.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/synonym_node.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/union_node.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/unnest_node.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/window_node.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/nodes/__init__.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/nodes/base_node.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/nodes/filter_node.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/nodes/group_node.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/nodes/merge_node.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/nodes/select_node_v2.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/nodes/union_node.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/nodes/unnest_node.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/nodes/window_node.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/utility.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/query_processor.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/statements/__init__.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/statements/author.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/statements/build.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/statements/common.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/statements/execute.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/dialect/__init__.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/dialect/base.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/dialect/bigquery.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/dialect/common.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/dialect/config.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/dialect/duckdb.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/dialect/enums.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/dialect/postgres.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/dialect/presto.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/dialect/snowflake.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/dialect/sql_server.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/engine.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/executor.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/hooks/__init__.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/hooks/base_hook.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/hooks/graph_hook.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/hooks/query_debugger.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/metadata/__init__.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/parser.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/parsing/__init__.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/parsing/common.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/parsing/config.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/parsing/exceptions.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/parsing/helpers.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/parsing/render.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/parsing/trilogy.lark +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/py.typed +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/scripts/__init__.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/scripts/trilogy.py +0 -0
- {pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/utility.py +0 -0
|
@@ -426,7 +426,6 @@ class Environment(BaseModel):
|
|
|
426
426
|
from trilogy.parsing.parse_engine import (
|
|
427
427
|
PARSER,
|
|
428
428
|
ParseToObjects,
|
|
429
|
-
gen_cache_lookup,
|
|
430
429
|
)
|
|
431
430
|
|
|
432
431
|
if isinstance(path, str):
|
|
@@ -440,7 +439,8 @@ class Environment(BaseModel):
|
|
|
440
439
|
else:
|
|
441
440
|
target = path
|
|
442
441
|
if not env:
|
|
443
|
-
|
|
442
|
+
import_keys = ["root", alias]
|
|
443
|
+
parse_address = "-".join(import_keys)
|
|
444
444
|
try:
|
|
445
445
|
with open(target, "r", encoding="utf-8") as f:
|
|
446
446
|
text = f.read()
|
|
@@ -454,11 +454,12 @@ class Environment(BaseModel):
|
|
|
454
454
|
),
|
|
455
455
|
parse_address=parse_address,
|
|
456
456
|
token_address=target,
|
|
457
|
+
import_keys=import_keys,
|
|
457
458
|
)
|
|
458
459
|
nparser.set_text(text)
|
|
459
460
|
nparser.environment.concepts.fail_on_missing = False
|
|
460
461
|
nparser.transform(PARSER.parse(text))
|
|
461
|
-
nparser.
|
|
462
|
+
nparser.run_second_parse_pass()
|
|
462
463
|
nparser.environment.concepts.fail_on_missing = True
|
|
463
464
|
|
|
464
465
|
except Exception as e:
|
|
@@ -129,6 +129,8 @@ CONSTANT_TYPES = (int, float, str, bool, list, ListWrapper, MapWrapper)
|
|
|
129
129
|
|
|
130
130
|
SELF_LABEL = "root"
|
|
131
131
|
|
|
132
|
+
MAX_PARSE_DEPTH = 10
|
|
133
|
+
|
|
132
134
|
|
|
133
135
|
@dataclass
|
|
134
136
|
class WholeGrainWrapper:
|
|
@@ -146,13 +148,6 @@ with open(join(dirname(__file__), "trilogy.lark"), "r") as f:
|
|
|
146
148
|
)
|
|
147
149
|
|
|
148
150
|
|
|
149
|
-
def gen_cache_lookup(path: str, alias: str, parent: str) -> str:
|
|
150
|
-
# path is the path of the file
|
|
151
|
-
# alias is what it's being imported under
|
|
152
|
-
# parent is the...direct parnet?
|
|
153
|
-
return path + alias + parent
|
|
154
|
-
|
|
155
|
-
|
|
156
151
|
def parse_concept_reference(
|
|
157
152
|
name: str, environment: Environment, purpose: Optional[Purpose] = None
|
|
158
153
|
) -> Tuple[str, str, str, str | None]:
|
|
@@ -226,6 +221,8 @@ class ParseToObjects(Transformer):
|
|
|
226
221
|
parsed: dict[str, "ParseToObjects"] | None = None,
|
|
227
222
|
tokens: dict[Path | str, ParseTree] | None = None,
|
|
228
223
|
text_lookup: dict[Path | str, str] | None = None,
|
|
224
|
+
environment_lookup: dict[str, Environment] | None = None,
|
|
225
|
+
import_keys: list[str] | None = None,
|
|
229
226
|
):
|
|
230
227
|
Transformer.__init__(self, True)
|
|
231
228
|
self.environment: Environment = environment
|
|
@@ -233,6 +230,7 @@ class ParseToObjects(Transformer):
|
|
|
233
230
|
self.token_address: Path | str = token_address or SELF_LABEL
|
|
234
231
|
self.parsed: dict[str, ParseToObjects] = parsed if parsed is not None else {}
|
|
235
232
|
self.tokens: dict[Path | str, ParseTree] = tokens if tokens is not None else {}
|
|
233
|
+
self.environments: dict[str, Environment] = environment_lookup or {}
|
|
236
234
|
self.text_lookup: dict[Path | str, str] = (
|
|
237
235
|
text_lookup if text_lookup is not None else {}
|
|
238
236
|
)
|
|
@@ -240,6 +238,7 @@ class ParseToObjects(Transformer):
|
|
|
240
238
|
# after initial parsing
|
|
241
239
|
self.parse_pass = ParsePass.INITIAL
|
|
242
240
|
self.function_factory = FunctionFactory(self.environment)
|
|
241
|
+
self.import_keys: list[str] = import_keys or ["root"]
|
|
243
242
|
|
|
244
243
|
def set_text(self, text: str):
|
|
245
244
|
self.text_lookup[self.token_address] = text
|
|
@@ -255,14 +254,14 @@ class ParseToObjects(Transformer):
|
|
|
255
254
|
for _, v in self.parsed.items():
|
|
256
255
|
v.prepare_parse()
|
|
257
256
|
|
|
258
|
-
def
|
|
257
|
+
def run_second_parse_pass(self, force: bool = False):
|
|
259
258
|
if self.token_address not in self.tokens:
|
|
260
259
|
return []
|
|
261
260
|
self.parse_pass = ParsePass.VALIDATION
|
|
262
261
|
for _, v in list(self.parsed.items()):
|
|
263
|
-
if v.parse_pass == ParsePass.VALIDATION
|
|
262
|
+
if v.parse_pass == ParsePass.VALIDATION:
|
|
264
263
|
continue
|
|
265
|
-
v.
|
|
264
|
+
v.run_second_parse_pass()
|
|
266
265
|
reparsed = self.transform(self.tokens[self.token_address])
|
|
267
266
|
self.environment.concepts.undefined = {}
|
|
268
267
|
return reparsed
|
|
@@ -306,11 +305,6 @@ class ParseToObjects(Transformer):
|
|
|
306
305
|
def QUOTED_IDENTIFIER(self, args) -> str:
|
|
307
306
|
return args.value[1:-1]
|
|
308
307
|
|
|
309
|
-
# @v_args(meta=True)
|
|
310
|
-
# def concept_lit(self, meta: Meta, args) -> ConceptRef:
|
|
311
|
-
# address = args[0]
|
|
312
|
-
# return self.environment.concepts.__getitem__(address, meta.line)
|
|
313
|
-
# return ConceptRef(address=address, line_no=meta.line)
|
|
314
308
|
@v_args(meta=True)
|
|
315
309
|
def concept_lit(self, meta: Meta, args) -> ConceptRef:
|
|
316
310
|
address = args[0]
|
|
@@ -402,7 +396,6 @@ class ParseToObjects(Transformer):
|
|
|
402
396
|
if len(concept_list) > 1:
|
|
403
397
|
modifiers += concept_list[:-1]
|
|
404
398
|
concept = concept_list[-1]
|
|
405
|
-
assert not self.environment.concepts.fail_on_missing
|
|
406
399
|
resolved = self.environment.concepts.__getitem__( # type: ignore
|
|
407
400
|
key=concept, line_no=meta.line, file=self.token_address
|
|
408
401
|
)
|
|
@@ -858,8 +851,10 @@ class ParseToObjects(Transformer):
|
|
|
858
851
|
def import_statement(self, args: list[str]) -> ImportStatement:
|
|
859
852
|
if len(args) == 2:
|
|
860
853
|
alias = args[-1]
|
|
854
|
+
cache_key = args[-1]
|
|
861
855
|
else:
|
|
862
856
|
alias = self.environment.namespace
|
|
857
|
+
cache_key = args[0]
|
|
863
858
|
path = args[0].split(".")
|
|
864
859
|
|
|
865
860
|
target = join(self.environment.working_path, *path) + ".preql"
|
|
@@ -867,10 +862,14 @@ class ParseToObjects(Transformer):
|
|
|
867
862
|
# tokens + text are cached by path
|
|
868
863
|
token_lookup = Path(target)
|
|
869
864
|
|
|
870
|
-
#
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
865
|
+
# parser + env has to be cached by prior import path + current key
|
|
866
|
+
key_path = self.import_keys + [cache_key]
|
|
867
|
+
cache_lookup = "-".join(key_path)
|
|
868
|
+
|
|
869
|
+
# we don't iterate past the max parse depth
|
|
870
|
+
if len(key_path) > MAX_PARSE_DEPTH:
|
|
871
|
+
return ImportStatement(alias=alias, path=Path(target))
|
|
872
|
+
|
|
874
873
|
if token_lookup in self.tokens:
|
|
875
874
|
raw_tokens = self.tokens[token_lookup]
|
|
876
875
|
text = self.text_lookup[token_lookup]
|
|
@@ -886,7 +885,7 @@ class ParseToObjects(Transformer):
|
|
|
886
885
|
new_env = nparser.environment
|
|
887
886
|
if nparser.parse_pass != ParsePass.VALIDATION:
|
|
888
887
|
# nparser.transform(raw_tokens)
|
|
889
|
-
nparser.
|
|
888
|
+
nparser.run_second_parse_pass()
|
|
890
889
|
else:
|
|
891
890
|
try:
|
|
892
891
|
new_env = Environment(
|
|
@@ -902,6 +901,7 @@ class ParseToObjects(Transformer):
|
|
|
902
901
|
parsed=self.parsed,
|
|
903
902
|
tokens=self.tokens,
|
|
904
903
|
text_lookup=self.text_lookup,
|
|
904
|
+
import_keys=self.import_keys + [cache_key],
|
|
905
905
|
)
|
|
906
906
|
nparser.transform(raw_tokens)
|
|
907
907
|
self.parsed[cache_lookup] = nparser
|
|
@@ -909,6 +909,7 @@ class ParseToObjects(Transformer):
|
|
|
909
909
|
raise ImportError(
|
|
910
910
|
f"Unable to import file {target}, parsing error: {e}"
|
|
911
911
|
) from e
|
|
912
|
+
|
|
912
913
|
parsed_path = Path(args[0])
|
|
913
914
|
imps = ImportStatement(alias=alias, path=parsed_path)
|
|
914
915
|
|
|
@@ -1621,7 +1622,7 @@ def parse_text(
|
|
|
1621
1622
|
environment = environment or (
|
|
1622
1623
|
Environment(working_path=root) if root else Environment()
|
|
1623
1624
|
)
|
|
1624
|
-
parser = ParseToObjects(environment=environment)
|
|
1625
|
+
parser = ParseToObjects(environment=environment, import_keys=["root"])
|
|
1625
1626
|
|
|
1626
1627
|
try:
|
|
1627
1628
|
parser.set_text(text)
|
|
@@ -1629,7 +1630,7 @@ def parse_text(
|
|
|
1629
1630
|
parser.prepare_parse()
|
|
1630
1631
|
parser.transform(PARSER.parse(text))
|
|
1631
1632
|
# this will reset fail on missing
|
|
1632
|
-
pass_two = parser.
|
|
1633
|
+
pass_two = parser.run_second_parse_pass()
|
|
1633
1634
|
output = [v for v in pass_two if v]
|
|
1634
1635
|
environment.concepts.fail_on_missing = True
|
|
1635
1636
|
except VisitError as e:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/basic_node.py
RENAMED
|
File without changes
|
|
File without changes
|
{pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/filter_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/group_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/group_to_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/multiselect_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/node_merge_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/rowset_node.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/select_merge_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/select_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/synonym_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/union_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/unnest_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.5 → pytrilogy-0.0.3.6}/trilogy/core/processing/node_generators/window_node.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|