Commit c384f54e authored by Frank Bessou's avatar Frank Bessou 🍁
Browse files

feat: move Graph type to stmts

parent ee1a035b83af
......@@ -21,9 +21,6 @@ from typing import (
TYPE_CHECKING,
Dict,
Iterator,
List,
Tuple,
Union as Union_,
Optional,
Callable,
Set,
......@@ -38,10 +35,6 @@ from typing_extensions import Protocol
__docformat__ = "restructuredtext en"
# this is a node of the syntax tree
# used, for now, for Select.vargraph
Graph = Union_[Dict[Tuple[str, str], str], Dict[str, List[str]], Dict]
class TranslationFunction(Protocol):
def __call__(self, msg: str, context: Optional[str] = None) -> str:
......
......@@ -34,8 +34,6 @@ from rql.nodes import (
variable_refs,
make_relation,
)
from rql import rqltypes as rt
from rql.base import BaseNode
from typing import (
......@@ -261,7 +259,7 @@ class RQLSTChecker:
def has_unique_value_path(
self, select: "rql.stmts.Select", fromvar: str, tovar: str
) -> bool:
graph: rt.Graph = select.vargraph
graph = select.vargraph
# Argument 1 to "has_path" has incompatible
# type "Union[Dict[str, List[str]], Dict[Tuple[str, str], str], Dict[Any, Any]]";
# expected "Dict[str, List[str]]" [arg-type]
......
......@@ -55,6 +55,11 @@ Solution = Dict[str, str]
SolutionsList = List[Solution]
# this is a node of the syntax tree
# used, for now, for Select.vargraph
Graph = Union_[Dict[Tuple[str, str], str], Dict[str, List[str]], Dict]
def _check_references(
defined: Dict[str, Union_["rql.nodes.Variable", "rql.nodes.ColumnAlias"]],
varrefs: Iterable[Union_["rql.nodes.VariableRef", "rql.base.BaseNode"]],
......@@ -523,7 +528,7 @@ class Select(Statement, nodes.EditableMixIn, ScopeNode):
statement, always child of a UNION root.
"""
vargraph: rt.Graph = {}
vargraph: Graph = {}
parent = None
distinct: bool = False
# limit / offset
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment