Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8a0b9e0
test: Add failing tests
dangotbanned Sep 12, 2025
f80a83c
feat: Everything but the method name working
dangotbanned Sep 12, 2025
fbbe1b1
refactor: Remove no-longer-required `_version`
dangotbanned Sep 12, 2025
3009d8e
feat: Add `_accessor` class var
dangotbanned Sep 12, 2025
c926ca8
refactor: Do the same thing as pandas_like
dangotbanned Sep 12, 2025
ccdd735
feat: prefix method name
dangotbanned Sep 12, 2025
4b79c04
Merge branch 'main' into @requires-on-accessors
dangotbanned Sep 13, 2025
4a87646
refactor: `NamespaceAccessor` typing/protocol changes
dangotbanned Sep 14, 2025
6cc8ed0
refactor: `@requires` runtime changes
dangotbanned Sep 14, 2025
6854043
revert "refactor: `@requires` runtime changes"
dangotbanned Sep 15, 2025
cfea56b
revert "refactor: `NamespaceAccessor` typing/protocol changes"
dangotbanned Sep 15, 2025
7b271eb
refactor: try a different way
dangotbanned Sep 15, 2025
456545f
Merge branch 'main' into @requires-on-accessors
dangotbanned Sep 16, 2025
00af1a4
use it for PolarsExpr.str.zfill
FBruzzesi Sep 17, 2025
88e9e9f
change check in is_namespace_accessor
FBruzzesi Sep 17, 2025
a52beb2
chore(typing): Narrow what can be passed to `is_namespace_accessor`
dangotbanned Sep 17, 2025
72a6e0f
refactor: Make super private
dangotbanned Sep 17, 2025
32a211b
chore: make the runtime check safer
dangotbanned Sep 17, 2025
02c4984
perf: Move optimization into `_hasattr_static`
dangotbanned Sep 17, 2025
7906b15
docs: Leave a trail for "why so strict dude?"
dangotbanned Sep 17, 2025
75da19e
Merge branch 'main' into @requires-on-accessors
FBruzzesi Sep 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions narwhals/_polars/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,17 +401,11 @@ class PolarsExprDateTimeNamespace(
class PolarsExprStringNamespace(
PolarsExprNamespace, PolarsStringNamespace[PolarsExpr, pl.Expr]
):
@requires.backend_version((0, 20, 5))
def zfill(self, width: int) -> PolarsExpr:
backend_version = self.compliant._backend_version
native_result = self.native.str.zfill(width)

if backend_version < (0, 20, 5): # pragma: no cover
# Reason:
# `TypeError: argument 'length': 'Expr' object cannot be interpreted as an integer`
# in `native_expr.str.slice(1, length)`
msg = "`zfill` is only available in 'polars>=0.20.5', found version '0.20.4'."
raise NotImplementedError(msg)

if backend_version <= (1, 30, 0):
length = self.native.str.len_chars()
less_than_width = length < width
Expand Down