97
97
98
98
if TYPE_CHECKING:
99
99
from collections.abc import Collection
100
+ from typing import Any
100
101
101
102
from pointblank._typing import AbsoluteBounds, Tolerance
102
103
@@ -2417,12 +2418,12 @@ class _ValidationInfo:
2417
2418
step_id: str | None = None
2418
2419
sha1: str | None = None
2419
2420
assertion_type: str | None = None
2420
- column: any | None = None
2421
- values: any | list[any] | tuple | None = None
2421
+ column: Any | None = None
2422
+ values: Any | list[any] | tuple | None = None
2422
2423
inclusive: tuple[bool, bool] | None = None
2423
2424
na_pass: bool | None = None
2424
2425
pre: Callable | None = None
2425
- segments: any | None = None
2426
+ segments: Any | None = None
2426
2427
thresholds: Thresholds | None = None
2427
2428
actions: Actions | None = None
2428
2429
label: str | None = None
@@ -6937,7 +6938,7 @@ def col_vals_regex(
6937
6938
6938
6939
def col_vals_expr(
6939
6940
self,
6940
- expr: any ,
6941
+ expr: Any ,
6941
6942
pre: Callable | None = None,
6942
6943
segments: SegmentSpec | None = None,
6943
6944
thresholds: int | float | bool | tuple | dict | Thresholds = None,
@@ -12992,7 +12993,7 @@ def _convert_string_to_datetime(value: str) -> datetime.datetime:
12992
12993
return datetime.datetime.strptime(value, "%Y-%m-%d %H:%M:%S")
12993
12994
12994
12995
12995
- def _string_date_dttm_conversion(value: any ) -> any :
12996
+ def _string_date_dttm_conversion(value: Any ) -> Any :
12996
12997
"""
12997
12998
Convert a string to a date or datetime object if it is in the correct format.
12998
12999
If the value is not a string, it is returned as is.
@@ -13030,9 +13031,9 @@ def _process_brief(
13030
13031
brief: str | None,
13031
13032
step: int,
13032
13033
col: str | list[str] | None,
13033
- values: any | None,
13034
- thresholds: any | None,
13035
- segment: any | None,
13034
+ values: Any | None,
13035
+ thresholds: Any | None,
13036
+ segment: Any | None,
13036
13037
) -> str:
13037
13038
# If there is no brief, return `None`
13038
13039
if brief is None:
@@ -13098,7 +13099,7 @@ def _process_action_str(
13098
13099
action_str: str,
13099
13100
step: int,
13100
13101
col: str | None,
13101
- value: any ,
13102
+ value: Any ,
13102
13103
type: str,
13103
13104
level: str,
13104
13105
time: str,
@@ -13545,7 +13546,7 @@ def _prep_values_text(
13545
13546
return values_str
13546
13547
13547
13548
13548
- def _seg_expr_from_string(data_tbl: any , segments_expr: str) -> tuple[str, str]:
13549
+ def _seg_expr_from_string(data_tbl: Any , segments_expr: str) -> tuple[str, str]:
13549
13550
"""
13550
13551
Obtain the segmentation categories from a table column.
13551
13552
@@ -13637,7 +13638,7 @@ def _seg_expr_from_tuple(segments_expr: tuple) -> list[tuple[str, str]]:
13637
13638
return seg_tuples
13638
13639
13639
13640
13640
- def _apply_segments(data_tbl: any , segments_expr: tuple[str, str]) -> any :
13641
+ def _apply_segments(data_tbl: Any , segments_expr: tuple[str, str]) -> Any :
13641
13642
"""
13642
13643
Apply the segments expression to the data table.
13643
13644
@@ -13821,7 +13822,7 @@ def _process_title_text(title: str | None, tbl_name: str | None, lang: str) -> s
13821
13822
return title_text
13822
13823
13823
13824
13824
- def _transform_tbl_preprocessed(pre: any , seg: any , interrogation_performed: bool) -> list[str]:
13825
+ def _transform_tbl_preprocessed(pre: Any , seg: Any , interrogation_performed: bool) -> list[str]:
13825
13826
# If no interrogation was performed, return a list of empty strings
13826
13827
if not interrogation_performed:
13827
13828
return ["" for _ in range(len(pre))]
@@ -14141,16 +14142,14 @@ def _pre_processing_funcs_to_str(pre: Callable) -> str | list[str]:
14141
14142
14142
14143
14143
14144
def _get_callable_source(fn: Callable) -> str:
14144
- if isinstance(fn, Callable):
14145
- try:
14146
- source_lines, _ = inspect.getsourcelines(fn)
14147
- source = "".join(source_lines).strip()
14148
- # Extract the `pre` argument from the source code
14149
- pre_arg = _extract_pre_argument(source)
14150
- return pre_arg
14151
- except (OSError, TypeError): # pragma: no cover
14152
- return fn.__name__
14153
- return fn
14145
+ try:
14146
+ source_lines, _ = inspect.getsourcelines(fn)
14147
+ source = "".join(source_lines).strip()
14148
+ # Extract the `pre` argument from the source code
14149
+ pre_arg = _extract_pre_argument(source)
14150
+ return pre_arg
14151
+ except (OSError, TypeError): # pragma: no cover
14152
+ return fn.__name__
14154
14153
14155
14154
14156
14155
def _extract_pre_argument(source: str) -> str:
@@ -14176,6 +14175,7 @@ def _create_table_time_html(
14176
14175
if time_start is None:
14177
14176
return ""
14178
14177
14178
+ assert time_end is not None # typing
14179
14179
# Get the time duration (difference between `time_end` and `time_start`) in seconds
14180
14180
time_duration = (time_end - time_start).total_seconds()
14181
14181
@@ -14393,12 +14393,12 @@ def _step_report_row_based(
14393
14393
column: str,
14394
14394
column_position: int,
14395
14395
columns_subset: list[str] | None,
14396
- values: any ,
14396
+ values: Any ,
14397
14397
inclusive: tuple[bool, bool] | None,
14398
14398
n: int,
14399
14399
n_failed: int,
14400
14400
all_passed: bool,
14401
- extract: any ,
14401
+ extract: Any ,
14402
14402
tbl_preview: GT,
14403
14403
header: str,
14404
14404
limit: int | None,
@@ -14425,10 +14425,12 @@ def _step_report_row_based(
14425
14425
elif assertion_type == "col_vals_le":
14426
14426
text = f"{column} ≤ {values}"
14427
14427
elif assertion_type == "col_vals_between":
14428
+ assert inclusive is not None
14428
14429
symbol_left = "≤" if inclusive[0] else "<"
14429
14430
symbol_right = "≤" if inclusive[1] else "<"
14430
14431
text = f"{values[0]} {symbol_left} {column} {symbol_right} {values[1]}"
14431
14432
elif assertion_type == "col_vals_outside":
14433
+ assert inclusive is not None
14432
14434
symbol_left = "<" if inclusive[0] else "≤"
14433
14435
symbol_right = ">" if inclusive[1] else "≥"
14434
14436
text = f"{column} {symbol_left} {values[0]}, {column} {symbol_right} {values[1]}"
@@ -14633,7 +14635,7 @@ def _step_report_rows_distinct(
14633
14635
n: int,
14634
14636
n_failed: int,
14635
14637
all_passed: bool,
14636
- extract: any ,
14638
+ extract: Any ,
14637
14639
tbl_preview: GT,
14638
14640
header: str,
14639
14641
limit: int | None,
@@ -14761,7 +14763,7 @@ def _step_report_rows_distinct(
14761
14763
14762
14764
def _step_report_schema_in_order(
14763
14765
step: int, schema_info: dict, header: str, lang: str, debug_return_df: bool = False
14764
- ) -> GT | any :
14766
+ ) -> GT | Any :
14765
14767
"""
14766
14768
This is the case for schema validation where the schema is supposed to have the same column
14767
14769
order as the target table.
@@ -15100,7 +15102,7 @@ def _step_report_schema_in_order(
15100
15102
15101
15103
def _step_report_schema_any_order(
15102
15104
step: int, schema_info: dict, header: str, lang: str, debug_return_df: bool = False
15103
- ) -> GT | any :
15105
+ ) -> GT | Any :
15104
15106
"""
15105
15107
This is the case for schema validation where the schema is permitted to not have to be in the
15106
15108
same column order as the target table.
0 commit comments