Skip to content

Commit

Permalink
Refine comments for cs.by_name() and remove list from subsequent …
Browse files Browse the repository at this point in the history
…`isinstance` check
  • Loading branch information
jrycw committed May 23, 2024
1 parent ab0042e commit 941544e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions great_tables/_tbl_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,7 @@ def _(data: PlDataFrame, expr: Union[list[str], _selector_proxy_], strict: bool
else:
raise TypeError(f"Unsupported selection expr type: {type(expr)}")

# `cs.by_name()` will match all names by default, covering the case where
# `expr` is an empty list.
# `cs.by_name()` will cover the case where `expr` is an empty list.
expr = cs.by_name(expr_str)
if expr_int:
# `cs.by_index()` will raise a `pyo3_runtime.PanicException`. Therefore, it needs to be
Expand All @@ -338,7 +337,7 @@ def _(data: PlDataFrame, expr: Union[list[str], _selector_proxy_], strict: bool
# it inherits from Expr, so we can just use that in a pinch
cls_selector = getattr(cs, "_selector_proxy_", Expr)

if not isinstance(expr, (list, cls_selector)):
if not isinstance(expr, cls_selector):
raise TypeError(f"Unsupported selection expr type: {type(expr)}")

# I don't think there's a way to get the columns w/o running the selection
Expand Down

0 comments on commit 941544e

Please sign in to comment.