diff --git a/meshtastic/mesh_interface.py b/meshtastic/mesh_interface.py index a51309d..89709da 100644 --- a/meshtastic/mesh_interface.py +++ b/meshtastic/mesh_interface.py @@ -214,7 +214,7 @@ class MeshInterface: # pylint: disable=R0902 return infos def showNodes( - self, includeSelf: bool = True, file=sys.stdout + self, includeSelf: bool = True ) -> str: # pylint: disable=W0613 """Show table summary of nodes in mesh""" diff --git a/meshtastic/slog/arrow.py b/meshtastic/slog/arrow.py index d656bea..0a53fe8 100644 --- a/meshtastic/slog/arrow.py +++ b/meshtastic/slog/arrow.py @@ -2,6 +2,7 @@ import logging import os +from typing import Optional import pyarrow as pa from pyarrow import feather @@ -19,8 +20,8 @@ class ArrowWriter: """ self.sink = pa.OSFile(file_name, "wb") # type: ignore self.new_rows: list[dict] = [] - self.schema: pa.Schema | None = None # haven't yet learned the schema - self.writer: pa.RecordBatchFileWriter | None = None + self.schema: Optional[pa.Schema] = None # haven't yet learned the schema + self.writer: Optional[pa.RecordBatchStreamWriter] = None def close(self): """Close the stream and writes the file as needed.""" diff --git a/meshtastic/slog/slog.py b/meshtastic/slog/slog.py index 7cbea09..6452763 100644 --- a/meshtastic/slog/slog.py +++ b/meshtastic/slog/slog.py @@ -129,7 +129,10 @@ class StructuredLogger: if self.include_raw: all_fields.append(("raw", pa.string())) - self.writer.set_schema(pa.schema(all_fields)) + # pass in our name->type tuples a pa.fields + self.writer.set_schema( + pa.schema(map(lambda x: pa.field(x[0], x[1]), all_fields)) + ) self.raw_file: Optional[ io.TextIOWrapper @@ -182,7 +185,9 @@ class StructuredLogger: if r: di = r.named if last_is_str: - di[last_field[0]] = di[last_field[0]].strip() # remove the trailing space we added + di[last_field[0]] = di[ + last_field[0] + ].strip() # remove the trailing space we added if di[last_field[0]] == "": # If the last field is an empty string, remove it del di[last_field[0]]