Skip to content

Commit

Permalink
docs: apply suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
AlessandroMiola committed Oct 6, 2024
1 parent e989b7f commit d9b361e
Showing 1 changed file with 46 additions and 144 deletions.
190 changes: 46 additions & 144 deletions utils/check_api_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,71 +121,30 @@
print(extra) # noqa: T201
ret = 1

# Series.cat methods
series_cat_methods = [
i
for i in nw.from_native(pl.Series(), series_only=True).cat.__dir__()
if not i[0].isupper() and i[0] != "_"
]
with open("docs/api-reference/series_cat.md") as fd:
content = fd.read()
documented = [
remove_prefix(i, " - ")
for i in content.splitlines()
if i.startswith(" - ") and not i.startswith(" - _")
]
if missing := set(series_cat_methods).difference(documented):
print("Series.cat: not documented") # noqa: T201
print(missing) # noqa: T201
ret = 1
if extra := set(documented).difference(series_cat_methods):
print("Series.cat: outdated") # noqa: T201
print(extra) # noqa: T201
ret = 1

# Series.dt methods
series_dt_methods = [
i
for i in nw.from_native(pl.Series(), series_only=True).dt.__dir__()
if not i[0].isupper() and i[0] != "_"
]
with open("docs/api-reference/series_dt.md") as fd:
content = fd.read()
documented = [
remove_prefix(i, " - ")
for i in content.splitlines()
if i.startswith(" - ") and not i.startswith(" - _")
]
if missing := set(series_dt_methods).difference(documented):
print("Series.dt: not documented") # noqa: T201
print(missing) # noqa: T201
ret = 1
if extra := set(documented).difference(series_dt_methods):
print("Series.dt: outdated") # noqa: T201
print(extra) # noqa: T201
ret = 1

# Series.str methods
series_str_methods = [
i
for i in nw.from_native(pl.Series(), series_only=True).str.__dir__()
if not i[0].isupper() and i[0] != "_"
]
with open("docs/api-reference/series_str.md") as fd:
content = fd.read()
documented = [
remove_prefix(i, " - ")
for i in content.splitlines()
if i.startswith(" - ") and not i.startswith(" - _")
]
if missing := set(series_str_methods).difference(documented):
print("Series.str: not documented") # noqa: T201
print(missing) # noqa: T201
ret = 1
if extra := set(documented).difference(series_str_methods):
print("Series.str: outdated") # noqa: T201
print(extra) # noqa: T201
ret = 1
# Series.{cat, dt, str} methods
for namespace in NAMESPACES.difference({"name"}):
series_methods = [
i
for i in getattr(
nw.from_native(pl.Series(), series_only=True), namespace
).__dir__()
if not i[0].isupper() and i[0] != "_"
]
with open(f"docs/api-reference/series_{namespace}.md") as fd:
content = fd.read()
documented = [
remove_prefix(i, " - ")
for i in content.splitlines()
if i.startswith(" - ") and not i.startswith(" - _")
]
if missing := set(series_methods).difference(documented):
print(f"Series.{namespace}: not documented") # noqa: T201
print(missing) # noqa: T201
ret = 1
if extra := set(documented).difference(series_methods):
print(f"Series.{namespace}: outdated") # noqa: T201
print(extra) # noqa: T201
ret = 1

# Expr methods
expr_methods = [
Expand All @@ -207,85 +166,28 @@
print(extra) # noqa: T201
ret = 1

# Expr.cat methods
expr_cat_methods = [
i for i in nw.Expr(lambda: 0).cat.__dir__() if not i[0].isupper() and i[0] != "_"
]
with open("docs/api-reference/expr_cat.md") as fd:
content = fd.read()
documented = [
remove_prefix(i, " - ")
for i in content.splitlines()
if i.startswith(" - ")
]
if missing := set(expr_cat_methods).difference(documented):
print("Expr.cat: not documented") # noqa: T201
print(missing) # noqa: T201
ret = 1
if extra := set(documented).difference(expr_cat_methods):
print("Expr.cat: outdated") # noqa: T201
print(extra) # noqa: T201
ret = 1

# Expr.dt methods
expr_dt_methods = [
i for i in nw.Expr(lambda: 0).dt.__dir__() if not i[0].isupper() and i[0] != "_"
]
with open("docs/api-reference/expr_dt.md") as fd:
content = fd.read()
documented = [
remove_prefix(i, " - ")
for i in content.splitlines()
if i.startswith(" - ")
]
if missing := set(expr_dt_methods).difference(documented):
print("Expr.dt: not documented") # noqa: T201
print(missing) # noqa: T201
ret = 1
if extra := set(documented).difference(expr_dt_methods):
print("Expr.dt: outdated") # noqa: T201
print(extra) # noqa: T201
ret = 1

# Expr.name methods
expr_name_methods = [
i for i in nw.Expr(lambda: 0).name.__dir__() if not i[0].isupper() and i[0] != "_"
]
with open("docs/api-reference/expr_name.md") as fd:
content = fd.read()
documented = [
remove_prefix(i, " - ")
for i in content.splitlines()
if i.startswith(" - ")
]
if missing := set(expr_name_methods).difference(documented):
print("Expr.name: not documented") # noqa: T201
print(missing) # noqa: T201
ret = 1
if extra := set(documented).difference(expr_name_methods):
print("Expr.name: outdated") # noqa: T201
print(extra) # noqa: T201
ret = 1

# Expr.str methods
expr_str_methods = [
i for i in nw.Expr(lambda: 0).str.__dir__() if not i[0].isupper() and i[0] != "_"
]
with open("docs/api-reference/expr_str.md") as fd:
content = fd.read()
documented = [
remove_prefix(i, " - ")
for i in content.splitlines()
if i.startswith(" - ")
]
if missing := set(expr_str_methods).difference(documented):
print("Expr.str: not documented") # noqa: T201
print(missing) # noqa: T201
ret = 1
if extra := set(documented).difference(expr_str_methods):
print("Expr.str: outdated") # noqa: T201
print(extra) # noqa: T201
ret = 1
# Expr.{cat, dt, name, str} methods
for namespace in NAMESPACES:
expr_methods = [
i
for i in getattr(nw.Expr(lambda: 0), namespace).__dir__()
if not i[0].isupper() and i[0] != "_"
]
with open(f"docs/api-reference/expr_{namespace}.md") as fd:
content = fd.read()
documented = [
remove_prefix(i, " - ")
for i in content.splitlines()
if i.startswith(" - ")
]
if missing := set(expr_methods).difference(documented):
print(f"Expr.{namespace}: not documented") # noqa: T201
print(missing) # noqa: T201
ret = 1
if extra := set(documented).difference(expr_methods):
print(f"Expr.{namespace}: outdated") # noqa: T201
print(extra) # noqa: T201
ret = 1

# DTypes
dtypes = [
Expand Down

0 comments on commit d9b361e

Please sign in to comment.