Use the more convenient _asdict() function of named tuples.
This commit is contained in:
parent
60e032510d
commit
d0d995b3a4
|
@ -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}
|
|
||||||
|
|
Loading…
Reference in New Issue