Skip to content

Commit

Permalink
Blacken checks.py
Browse files Browse the repository at this point in the history
  • Loading branch information
deepyaman authored Jan 8, 2025
1 parent e0f868d commit 4698e40
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions pandera/backends/ibis/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,10 @@ def apply(self, check_obj: IbisData):
"""Apply the check function to a check object."""
if self.check.element_wise:
selector = (
select_column(check_obj.key)
if check_obj.key is not None
else s.all()
select_column(check_obj.key) if check_obj.key is not None else s.all()
)
out = check_obj.table.mutate(
s.across(
selector, self.check_fn, f"{{col}}{CHECK_OUTPUT_SUFFIX}"
)
s.across(selector, self.check_fn, f"{{col}}{CHECK_OUTPUT_SUFFIX}")
).select(selector | s.endswith(CHECK_OUTPUT_SUFFIX))
else:
out = self.check_fn(check_obj)
Expand Down Expand Up @@ -89,13 +85,9 @@ def apply(self, check_obj: IbisData):
def postprocess(self, check_obj, check_output):
"""Postprocesses the result of applying the check function."""
if isinstance(check_output, ir.BooleanScalar):
return self.postprocess_boolean_scalar_output(
check_obj, check_output
)
return self.postprocess_boolean_scalar_output(check_obj, check_output)
elif isinstance(check_output, ir.BooleanColumn):
return self.postprocess_boolean_column_output(
check_obj, check_output
)
return self.postprocess_boolean_column_output(check_obj, check_output)
elif isinstance(check_output, ir.Table):
return self.postprocess_table_output(check_obj, check_output)
raise TypeError( # pragma: no cover
Expand Down Expand Up @@ -140,8 +132,7 @@ def postprocess_table_output(
"""Postprocesses the result of applying the check function."""
passed = check_output[CHECK_OUTPUT_KEY].all()
failure_cases = check_output.filter(~_[CHECK_OUTPUT_KEY]).drop(
s.endswith(f"__{CHECK_OUTPUT_KEY}__")
| select_column(CHECK_OUTPUT_KEY)
s.endswith(f"__{CHECK_OUTPUT_KEY}__") | select_column(CHECK_OUTPUT_KEY)
)

if check_obj.key is not None:
Expand Down

0 comments on commit 4698e40

Please sign in to comment.