Skip to content

Commit

Permalink
docs: compare series vs expr namespace methods in `check_api_referenc…
Browse files Browse the repository at this point in the history
…e.py` (#1150)

* docs: restore same order in docs between Expr.str and Series.str methods

* docs: apply suggestion
  • Loading branch information
AlessandroMiola authored Oct 7, 2024
1 parent 0bcb9a9 commit f2b7a40
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/api-reference/expr_str.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
- ends_with
- head
- len_chars
- slice
- replace
- replace_all
- slice
- starts_with
- strip_chars
- tail
Expand Down
2 changes: 1 addition & 1 deletion docs/api-reference/series_str.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
- slice
- starts_with
- strip_chars
- tail
- to_datetime
- to_lowercase
- to_uppercase
- tail
show_source: false
show_bases: false
28 changes: 25 additions & 3 deletions utils/check_api_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,36 @@
for i in nw.from_native(pl.Series(), series_only=True).__dir__()
if not i[0].isupper() and i[0] != "_"
]

if missing := set(expr).difference(series).difference(EXPR_ONLY_METHODS):
print("In expr but not in series") # noqa: T201
print("In Expr but not in Series") # noqa: T201
print(missing) # noqa: T201
ret = 1
if extra := set(series).difference(expr).difference(SERIES_ONLY_METHODS):
print("in series but not in expr") # noqa: T201
print("In Series but not in Expr") # noqa: T201
print(extra) # noqa: T201
ret = 1

# Check Expr vs Series internal methods
for namespace in NAMESPACES.difference({"name"}):
expr_internal = [
i
for i in getattr(nw.Expr(lambda: 0), namespace).__dir__()
if not i[0].isupper() and i[0] != "_"
]
series_internal = [
i
for i in getattr(
nw.from_native(pl.Series(), series_only=True), namespace
).__dir__()
if not i[0].isupper() and i[0] != "_"
]
if missing := set(expr_internal).difference(series_internal):
print(f"In Expr.{namespace} but not in Series.{namespace}") # noqa: T201
print(missing) # noqa: T201
ret = 1
if extra := set(series_internal).difference(expr_internal):
print(f"In Series.{namespace} but not in Expr.{namespace}") # noqa: T201
print(extra) # noqa: T201
ret = 1

sys.exit(ret)

0 comments on commit f2b7a40

Please sign in to comment.