Check instance once

master
Salvo 'LtWorf' Tomaselli 2020-06-27 15:47:55 +07:00
parent 79610ab8f5
commit 9f171fa393
No known key found for this signature in database
GPG Key ID: B3A7CF0C801886CF
1 changed files with 25 additions and 22 deletions

@ -147,14 +147,18 @@ class Node:
if isinstance(self, Variable): #FIXME this is ugly if isinstance(self, Variable): #FIXME this is ugly
return list(rels[self.name].header) return list(rels[self.name].header)
elif isinstance(self, Binary) and self.name in (DIFFERENCE, UNION, INTERSECTION): elif isinstance(self, Binary):
if self.name in (DIFFERENCE, UNION, INTERSECTION):
return self.left.result_format(rels) return self.left.result_format(rels)
elif isinstance(self, Binary) and self.name == DIVISION: elif self.name == DIVISION:
return list(set(self.left.result_format(rels)) - set(self.right.result_format(rels))) return list(set(self.left.result_format(rels)) - set(self.right.result_format(rels)))
elif self.name == PROJECTION:
return self.get_projection_prop()
elif self.name == PRODUCT: elif self.name == PRODUCT:
return self.left.result_format(rels) + self.right.result_format(rels) return self.left.result_format(rels) + self.right.result_format(rels)
elif self.name in (JOIN, JOIN_LEFT, JOIN_RIGHT, JOIN_FULL):
return list(set(self.left.result_format(rels)).union(set(self.right.result_format(rels))))
elif isinstance(self, Unary):
if self.name == PROJECTION:
return self.get_projection_prop()
elif self.name == SELECTION: elif self.name == SELECTION:
return self.child.result_format(rels) return self.child.result_format(rels)
elif self.name == RENAME: elif self.name == RENAME:
@ -168,8 +172,7 @@ class Node:
if _fields[i] in _vars: if _fields[i] in _vars:
_fields[i] = _vars[_fields[i]] _fields[i] = _vars[_fields[i]]
return _fields return _fields
elif self.name in (JOIN, JOIN_LEFT, JOIN_RIGHT, JOIN_FULL):
return list(set(self.left.result_format(rels)).union(set(self.right.result_format(rels))))
raise ValueError('What kind of alien object is this?') raise ValueError('What kind of alien object is this?')
def __eq__(self, other): #FIXME def __eq__(self, other): #FIXME