Not a constant

This commit is contained in:
Salvo 'LtWorf' Tomaselli 2020-06-14 22:34:27 +02:00
parent aa6568bac2
commit 4ab01c9e47
No known key found for this signature in database
GPG Key ID: B3A7CF0C801886CF

View File

@ -72,7 +72,7 @@ def duplicated_select(n: parser.Node) -> Tuple[parser.Node, int]:
in and in and
''' '''
changes = 0 changes = 0
while isinstance(n, parser.UNARY) and n.name == SELECTION and isinstance(n.child, parser.UNARY) and n.child.name == SELECTION: while isinstance(n, parser.Unary) and n.name == SELECTION and isinstance(n.child, parser.Unary) and n.child.name == SELECTION:
changes += 1 changes += 1
prop = n.prop prop = n.prop
@ -147,7 +147,7 @@ def down_to_unions_subtractions_intersections(n: parser.Node) -> Tuple[parser.No
''' '''
changes = 0 changes = 0
_o = (UNION, DIFFERENCE, INTERSECTION) _o = (UNION, DIFFERENCE, INTERSECTION)
if isinstance(n, parser.UNARY) and n.name == SELECTION and n.child.name in _o: if isinstance(n, parser.Unary) and n.name == SELECTION and n.child.name in _o:
l = parser.Unary(SELECTION, n.prop, n.child.left) l = parser.Unary(SELECTION, n.prop, n.child.left)
r = parser.Unary(SELECTION, n.prop, n.child.right) r = parser.Unary(SELECTION, n.prop, n.child.right)
@ -170,7 +170,7 @@ def duplicated_projection(n: parser.Node) -> Tuple[parser.Node, int]:
def selection_inside_projection(n: parser.Node) -> Tuple[parser.Node, int]: def selection_inside_projection(n: parser.Node) -> Tuple[parser.Node, int]:
'''This function locates things like σ j (π k(R)) and '''This function locates things like σ j (π k(R)) and
converts them into π k(σ j (R))''' converts them into π k(σ j (R))'''
if isinstance(n, parser.UNARY) and n.name == SELECTION and n.child.name == PROJECTION: if isinstance(n, parser.Unary) and n.name == SELECTION and n.child.name == PROJECTION:
child = parser.Unary( child = parser.Unary(
SELECTION, SELECTION,
n.prop, n.prop,
@ -338,7 +338,7 @@ def swap_rename_select(n: parser.Node) -> int:
Renaming the attributes used in the Renaming the attributes used in the
selection, so the operation is still valid.''' selection, so the operation is still valid.'''
if isinstance(n, parser.UNARY) and n.name == SELECTION and n.child.name == RENAME: if isinstance(n, parser.Unary) and n.name == SELECTION and n.child.name == RENAME:
# This is an inverse mapping for the rename # This is an inverse mapping for the rename
renames = {v: k for k, v in n.child.get_rename_prop().items()} renames = {v: k for k, v in n.child.get_rename_prop().items()}
@ -438,7 +438,7 @@ def selection_and_product(n: parser.Node, rels: Dict[str, Relation]) -> parser.N
σ l (σ j (R) * σ i (Q)). Where j contains only attributes belonging to R, σ l (σ j (R) * σ i (Q)). Where j contains only attributes belonging to R,
i contains attributes belonging to Q and l contains attributes belonging to both''' i contains attributes belonging to Q and l contains attributes belonging to both'''
if isinstance(n, parser.UNARY) and n.name == SELECTION and n.child.name in (PRODUCT, JOIN): if isinstance(n, parser.Unary) and n.name == SELECTION and n.child.name in (PRODUCT, JOIN):
l_attr = n.child.left.result_format(rels) l_attr = n.child.left.result_format(rels)
r_attr = n.child.right.result_format(rels) r_attr = n.child.right.result_format(rels)