pyln-client/gossmap: more fixes, make mypy happier.

Mainly fixing type annotations, but some real fixes:

1. GossmapHalfchannel.from_str() should be a classmethod.
2. update_channel had weird, unusable default values (fields can't be NULL,
   since we use it below).

[ There was one more occurence where isinstance should be used above
type() == xyz comparison. -- MS ]

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2021-09-08 06:25:21 +09:30
parent ba2bcac530
commit 487facf1f0
2 changed files with 18 additions and 17 deletions

View File

@@ -310,7 +310,7 @@ other types. Since 'msgtype' is almost identical, it inherits from this too.
f.fieldtype.write(io_out, val, otherfields)
def read(self, io_in: BufferedIOBase, otherfields: Dict[str, Any]) -> Optional[Dict[str, Any]]:
vals = {}
vals: Dict[str, Any] = {}
for field in self.fields:
val = field.fieldtype.read(io_in, vals)
if val is None: