Skip to content

Commit 5fa18b1

Browse files
style: fix mypy polars typing issues
1 parent 6c38260 commit 5fa18b1

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

src/dve/pipeline/pipeline.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,8 +640,8 @@ def _get_error_dataframes(self, submission_id: str):
640640
df = pl.DataFrame(errors, schema={key: pl.Utf8() for key in errors[0]}) # type: ignore
641641
df = df.with_columns(
642642
pl.when(pl.col("Status") == pl.lit("error")) # type: ignore
643-
.then(pl.lit("Submission Failure"))
644-
.otherwise(pl.lit("Warning"))
643+
.then(pl.lit("Submission Failure")) # type: ignore
644+
.otherwise(pl.lit("Warning")) # type: ignore
645645
.alias("error_type")
646646
)
647647
df = df.select(

src/dve/reporting/error_report.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from typing import Deque, Dict, List, Tuple, Union
88

99
import polars as pl
10-
from polars import DataFrame, LazyFrame, Utf8, col, count # type: ignore
10+
from polars import DataFrame, LazyFrame, Utf8, col # type: ignore
1111

1212
from dve.core_engine.message import FeedbackMessage
1313
from dve.parser.file_handling.service import open_stream
@@ -98,21 +98,21 @@ def create_error_dataframe(errors: Deque[FeedbackMessage], key_fields):
9898
schema=schema,
9999
)
100100

101-
df = df.with_columns(
102-
pl.when(pl.col("Status") == pl.lit("error"))
103-
.then(pl.lit("Submission Failure"))
104-
.otherwise(pl.lit("Warning"))
101+
df = df.with_columns( # type: ignore
102+
pl.when(pl.col("Status") == pl.lit("error")) # type: ignore
103+
.then(pl.lit("Submission Failure")) # type: ignore
104+
.otherwise(pl.lit("Warning")) # type: ignore
105105
.alias("error_type")
106106
)
107-
df = df.select(
108-
col("Entity").alias("Table"),
109-
col("error_type").alias("Type"),
110-
col("ErrorCode").alias("Error_Code"),
111-
col("ReportingField").alias("Data_Item"),
112-
col("ErrorMessage").alias("Error"),
113-
col("Value"),
114-
col("Key").alias("ID"),
115-
col("Category"),
107+
df = df.select( # type: ignore
108+
col("Entity").alias("Table"), # type: ignore
109+
col("error_type").alias("Type"), # type: ignore
110+
col("ErrorCode").alias("Error_Code"), # type: ignore
111+
col("ReportingField").alias("Data_Item"), # type: ignore
112+
col("ErrorMessage").alias("Error"), # type: ignore
113+
col("Value"), # type: ignore
114+
col("Key").alias("ID"), # type: ignore
115+
col("Category"), # type: ignore
116116
)
117117
return df.sort("Type", descending=False).collect() # type: ignore
118118

@@ -133,23 +133,23 @@ def calculate_aggregates(error_frame: DataFrame) -> DataFrame:
133133
aggregates = (
134134
error_frame.group_by(
135135
[
136-
pl.col("Table"),
137-
pl.col("Type"),
138-
pl.col("Data_Item"),
139-
pl.col("Error_Code"),
140-
pl.col("Category"),
136+
pl.col("Table"), # type: ignore
137+
pl.col("Type"), # type: ignore
138+
pl.col("Data_Item"), # type: ignore
139+
pl.col("Error_Code"), # type: ignore
140+
pl.col("Category"), # type: ignore
141141
]
142142
)
143-
.agg(pl.len())
143+
.agg(pl.len()) # type: ignore
144144
.select( # type: ignore
145-
pl.col("Type"),
146-
pl.col("Table"),
147-
pl.col("Data_Item"),
148-
pl.col("Category"),
149-
pl.col("Error_Code"),
150-
pl.col("len").alias("Count"),
145+
pl.col("Type"), # type: ignore
146+
pl.col("Table"), # type: ignore
147+
pl.col("Data_Item"), # type: ignore
148+
pl.col("Category"), # type: ignore
149+
pl.col("Error_Code"), # type: ignore
150+
pl.col("len").alias("Count"), # type: ignore
151151
)
152-
.sort(pl.col("Type"), pl.col("Count"), descending=[False, True])
152+
.sort(pl.col("Type"), pl.col("Count"), descending=[False, True]) # type: ignore
153153
)
154154
return aggregates
155155

0 commit comments

Comments
 (0)