fix linter warnings

This commit is contained in:
Kevin Hester
2024-07-08 09:17:52 -07:00
parent eb45c16f89
commit 043530afca
3 changed files with 11 additions and 5 deletions

View File

@@ -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"""

View File

@@ -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."""

View File

@@ -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]]