Use the more convenient _asdict() function of named tuples.

This commit is contained in:
CaitSith2 2021-03-05 11:05:57 -08:00
parent 60e032510d
commit d0d995b3a4
1 changed files with 2 additions and 8 deletions

View File

@ -1509,11 +1509,7 @@ class PlandoItem(NamedTuple):
self.warn(warning) self.warn(warning)
def to_dict(self): def to_dict(self):
return {"item": self.item, return self._asdict()
"location": self.location,
"world": self.world,
"from_pool": self.from_pool,
"force": self.force}
class PlandoConnection(NamedTuple): class PlandoConnection(NamedTuple):
@ -1522,6 +1518,4 @@ class PlandoConnection(NamedTuple):
direction: str # entrance, exit or both direction: str # entrance, exit or both
def to_dict(self): def to_dict(self):
return {"entrance": self.entrance, return self._asdict()
"exit": self.exit,
"direction": self.direction}