Use None instead o a special string

This commit is contained in:
Salvo 'LtWorf' Tomaselli 2020-08-23 11:16:12 +02:00
parent 33a2a21617
commit 4c101526e6
No known key found for this signature in database
GPG Key ID: B3A7CF0C801886CF

View File

@ -276,9 +276,7 @@ class Relation(NamedTuple):
def outer_right(self, other: 'Relation') -> 'Relation': def outer_right(self, other: 'Relation') -> 'Relation':
''' '''
Outer right join. Considers self as left and param as right. If the Outer right join. Considers self as left and param as right. If the
tuple has no corrispondence, empy attributes are filled with a "---" tuple has no corrispondence, empy attributes are filled with a None.
string. This is due to the fact that the None token would cause
problems when saving and reloading the relation.
Just like natural join, it works considering shared attributes. Just like natural join, it works considering shared attributes.
''' '''
return other.outer_left(self) return other.outer_left(self)
@ -287,7 +285,6 @@ class Relation(NamedTuple):
''' '''
See documentation for outer_right See documentation for outer_right
''' '''
shared = self.header.intersection(other.header) shared = self.header.intersection(other.header)
# Creating the header with all the fields, done like that because order is # Creating the header with all the fields, done like that because order is
@ -319,7 +316,7 @@ class Relation(NamedTuple):
added = True added = True
# If it didn't partecipate, adds it # If it didn't partecipate, adds it
if not added: if not added:
item = chain(i, repeat('---', len(noid))) #FIXME item = chain(i, repeat(None, len(noid))) #FIXME
content.append(tuple(item)) content.append(tuple(item))
return Relation(header, frozenset(content)) return Relation(header, frozenset(content))