From 5f85c366021f4599a9580ae68d27f991464045b6 Mon Sep 17 00:00:00 2001 From: Marco Gorelli <33491632+MarcoGorelli@users.noreply.github.com> Date: Sun, 1 Sep 2024 15:28:04 +0100 Subject: [PATCH] docs: Pre-compute plugin_path before defining plugin --- docs/user-guide/expressions/plugins.md | 5 +++-- py-polars/polars/series/plotting.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/user-guide/expressions/plugins.md b/docs/user-guide/expressions/plugins.md index 9e79e5a2e3db..e679b09ee180 100644 --- a/docs/user-guide/expressions/plugins.md +++ b/docs/user-guide/expressions/plugins.md @@ -103,11 +103,12 @@ import polars as pl from polars.plugins import register_plugin_function from polars._typing import IntoExpr +PLUGIN_PATH = Path(__file__).parent def pig_latinnify(expr: IntoExpr) -> pl.Expr: """Pig-latinnify expression.""" return register_plugin_function( - plugin_path=Path(__file__).parent, + plugin_path=PLUGIN_PATH, function_name="pig_latinnify", args=expr, is_elementwise=True, @@ -190,7 +191,7 @@ def append_args( This example shows how arguments other than `Series` can be used. """ return register_plugin_function( - plugin_path=Path(__file__).parent, + plugin_path=PLUGIN_PATH, function_name="append_kwargs", args=expr, kwargs={ diff --git a/py-polars/polars/series/plotting.py b/py-polars/polars/series/plotting.py index c666c5a9b177..cb5c6c93a1e1 100644 --- a/py-polars/polars/series/plotting.py +++ b/py-polars/polars/series/plotting.py @@ -75,7 +75,7 @@ def kde( **kwargs: Unpack[EncodeKwds], ) -> alt.Chart: """ - Draw kernel dentity estimate plot. + Draw kernel density estimate plot. Polars does not implement plotting logic itself but instead defers to `Altair `_.