Skip to content

Commit 07c6fbd

Browse files
committed
[DOP-4041] Fix mypy errors
1 parent 50bac42 commit 07c6fbd

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

onetl/core/db_reader/db_reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ def validate_hwm_column(cls, values: dict) -> dict:
393393
"Otherwise DBReader cannot determine HWM type for this column",
394394
)
395395

396-
values["hwm_column"] = Column(name=hwm_column)
396+
values["hwm_column"] = Column(name=hwm_column) # type: ignore
397397
values["hwm_expression"] = hwm_expression
398398

399399
return values

onetl/core/db_reader/strategy_helper.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,21 +202,24 @@ def save(self, df: DataFrame) -> DataFrame:
202202
self.strategy.update_hwm(max_hwm_value)
203203
return df
204204

205-
def get_boundaries(self) -> Tuple[Optional[Statement], Optional[Statement]]:
206-
start_from: Optional[Statement] = None
207-
end_at: Optional[Statement] = None
205+
def get_boundaries(self) -> tuple[Statement | None, Statement | None]:
206+
start_from: Statement | None = None
207+
end_at: Statement | None = None
208+
hwm: ColumnHWM | None = self.strategy.hwm # type: ignore
209+
210+
if hwm is None:
211+
return None, None
208212

209-
# `self.strategy.hwm is not None` is need only to handle mypy warnings
210-
if self.strategy.current_value is not None and self.strategy.hwm is not None:
213+
if self.strategy.current_value is not None:
211214
start_from = Statement(
212-
expression=self.hwm_expression or self.strategy.hwm.name,
215+
expression=self.hwm_expression or hwm.name,
213216
operator=self.strategy.current_value_comparator,
214217
value=self.strategy.current_value,
215218
)
216219

217-
if self.strategy.next_value is not None and self.strategy.hwm is not None:
220+
if self.strategy.next_value is not None:
218221
end_at = Statement(
219-
expression=self.hwm_expression or self.strategy.hwm.name,
222+
expression=self.hwm_expression or hwm.name,
220223
operator=self.strategy.next_value_comparator,
221224
value=self.strategy.next_value,
222225
)

0 commit comments

Comments
 (0)