From 941544e4210ec56d009d9c839d756283cda3a5cd Mon Sep 17 00:00:00 2001 From: jrycw Date: Thu, 23 May 2024 14:51:17 +0800 Subject: [PATCH] Refine comments for `cs.by_name()` and remove `list` from subsequent `isinstance` check --- great_tables/_tbl_data.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/great_tables/_tbl_data.py b/great_tables/_tbl_data.py index ce7cf112c..a2566371e 100644 --- a/great_tables/_tbl_data.py +++ b/great_tables/_tbl_data.py @@ -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 @@ -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