Skip to content

Commit

Permalink
chore: remove useless check and move checks on Series.{cat, dt, str} …
Browse files Browse the repository at this point in the history
…higher up
  • Loading branch information
AlessandroMiola committed Oct 6, 2024
1 parent 0d34ad8 commit e989b7f
Showing 1 changed file with 67 additions and 67 deletions.
134 changes: 67 additions & 67 deletions utils/check_api_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,72 @@
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

# Expr methods
expr_methods = [
i for i in nw.Expr(lambda: 0).__dir__() if not i[0].isupper() and i[0] != "_"
Expand Down Expand Up @@ -236,77 +302,11 @@
print("Dtype: not documented") # noqa: T201
print(missing) # noqa: T201
ret = 1
if extra := set(documented).difference(dtypes).difference(BASE_DTYPES):
if extra := set(documented).difference(dtypes):
print("Dtype: outdated") # noqa: T201
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

# Check Expr vs Series
expr = [i for i in nw.Expr(lambda: 0).__dir__() if not i[0].isupper() and i[0] != "_"]
series = [
Expand Down

0 comments on commit e989b7f

Please sign in to comment.