Skip to content

Commit 92be769

Browse files
committed
fix mypy
1 parent 283970c commit 92be769

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

bigframes/core/block_transforms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ def rank(
522522
def dropna(
523523
block: blocks.Block,
524524
column_ids: typing.Sequence[str],
525-
how: typing.Literal["all", "any"] = "any",
525+
how: str = "any",
526526
thresh: typing.Optional[int] = None,
527527
subset: Optional[typing.Sequence[str]] = None,
528528
):
@@ -555,10 +555,10 @@ def dropna(
555555
),
556556
predicates,
557557
)
558-
559558
# Filter rows where count >= thresh
560559
predicate = ops.ge_op.as_expr(count_expr, ex.const(thresh))
561560
else:
561+
# Only handle 'how' parameter when thresh is not specified
562562
if how == "any":
563563
predicate = functools.reduce(ops.and_op.as_expr, predicates)
564564
else: # "all"

bigframes/dataframe.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2801,7 +2801,7 @@ def dropna(
28012801
self,
28022802
*,
28032803
axis: int | str = 0,
2804-
how: typing.Literal["all", "any"] = "any",
2804+
how: str = "any",
28052805
thresh: typing.Optional[int] = None,
28062806
subset: typing.Union[None, blocks.Label, Sequence[blocks.Label]] = None,
28072807
inplace: bool = False,
@@ -2811,12 +2811,18 @@ def dropna(
28112811
raise NotImplementedError(
28122812
f"'inplace'=True not supported. {constants.FEEDBACK_LINK}"
28132813
)
2814-
if thresh is not None and how != "any":
2815-
raise TypeError(
2816-
"You cannot set both the how and thresh arguments at the same time."
2817-
)
2818-
if how not in ("any", "all"):
2819-
raise ValueError("'how' must be one of 'any', 'all'")
2814+
2815+
# Check if both thresh and how are explicitly provided
2816+
if thresh is not None:
2817+
# cannot specify both thresh and how parameters
2818+
if how != "any":
2819+
raise TypeError(
2820+
"You cannot set both the how and thresh arguments at the same time."
2821+
)
2822+
else:
2823+
# Only validate 'how' when thresh is not provided
2824+
if how not in ("any", "all"):
2825+
raise ValueError("'how' must be one of 'any', 'all'")
28202826

28212827
axis_n = utils.get_axis_number(axis)
28222828

0 commit comments

Comments
 (0)