3838
3939
4040class Selector (Immutable ):
41- def to_selector (self ) -> RootSelector :
41+ def to_selector_ir (self ) -> RootSelector :
4242 from narwhals ._plan .expressions .expr import RootSelector
4343
4444 return RootSelector (selector = self )
@@ -248,14 +248,14 @@ def matches_column(self, name: str, dtype: DType) -> bool:
248248
249249
250250def all () -> expr .Selector :
251- return All ().to_selector ().to_narwhals ()
251+ return All ().to_selector_ir ().to_narwhals ()
252252
253253
254254def array (
255255 inner : expr .Selector | None = None , * , size : int | None = None
256256) -> expr .Selector :
257257 s_ir = inner ._ir if inner is not None else None
258- return Array (inner = s_ir , size = size ).to_selector ().to_narwhals ()
258+ return Array (inner = s_ir , size = size ).to_selector_ir ().to_narwhals ()
259259
260260
261261def by_dtype (* dtypes : OneOrIterable [DType | type [DType ]]) -> expr .Selector :
@@ -267,15 +267,15 @@ def by_name(*names: OneOrIterable[str]) -> expr.Selector:
267267 sel = ByName .from_name (names [0 ])
268268 else :
269269 sel = ByName .from_names (* names )
270- return sel .to_selector ().to_narwhals ()
270+ return sel .to_selector_ir ().to_narwhals ()
271271
272272
273273def boolean () -> expr .Selector :
274- return Boolean ().to_selector ().to_narwhals ()
274+ return Boolean ().to_selector_ir ().to_narwhals ()
275275
276276
277277def categorical () -> expr .Selector :
278- return Categorical ().to_selector ().to_narwhals ()
278+ return Categorical ().to_selector_ir ().to_narwhals ()
279279
280280
281281def datetime (
@@ -284,38 +284,38 @@ def datetime(
284284) -> expr .Selector :
285285 return (
286286 Datetime .from_time_unit_and_time_zone (time_unit , time_zone )
287- .to_selector ()
287+ .to_selector_ir ()
288288 .to_narwhals ()
289289 )
290290
291291
292292def list (inner : expr .Selector | None = None ) -> expr .Selector :
293293 s_ir = inner ._ir if inner is not None else None
294- return List (inner = s_ir ).to_selector ().to_narwhals ()
294+ return List (inner = s_ir ).to_selector_ir ().to_narwhals ()
295295
296296
297297def duration (time_unit : OneOrIterable [TimeUnit ] | None = None ) -> expr .Selector :
298- return Duration .from_time_unit (time_unit ).to_selector ().to_narwhals ()
298+ return Duration .from_time_unit (time_unit ).to_selector_ir ().to_narwhals ()
299299
300300
301301def enum () -> expr .Selector :
302- return Enum ().to_selector ().to_narwhals ()
302+ return Enum ().to_selector_ir ().to_narwhals ()
303303
304304
305305def matches (pattern : str ) -> expr .Selector :
306- return Matches .from_string (pattern ).to_selector ().to_narwhals ()
306+ return Matches .from_string (pattern ).to_selector_ir ().to_narwhals ()
307307
308308
309309def numeric () -> expr .Selector :
310- return Numeric ().to_selector ().to_narwhals ()
310+ return Numeric ().to_selector_ir ().to_narwhals ()
311311
312312
313313def string () -> expr .Selector :
314- return String ().to_selector ().to_narwhals ()
314+ return String ().to_selector_ir ().to_narwhals ()
315315
316316
317317def struct () -> expr .Selector :
318- return Struct ().to_selector ().to_narwhals ()
318+ return Struct ().to_selector_ir ().to_narwhals ()
319319
320320
321321_HASH_SENSITIVE_TO_SELECTOR : Mapping [type [DType ], Callable [[], expr .Selector ]] = {
@@ -343,7 +343,7 @@ def _from_dtypes(*by_dtypes: OneOrIterable[DType | type[DType]]) -> expr.Selecto
343343 else :
344344 dtypes .append (dtype ) # type: ignore[arg-type]
345345 if dtypes :
346- dtype_selector = ByDType (dtypes = frozenset (dtypes )).to_selector ().to_narwhals ()
346+ dtype_selector = ByDType (dtypes = frozenset (dtypes )).to_selector_ir ().to_narwhals ()
347347 selectors .appendleft (dtype_selector )
348348 it = iter (selectors )
349349 return reduce (operator .or_ , it , next (it ))
0 commit comments