-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Modernize expression_lib (#111)
- Loading branch information
1 parent
7a353c3
commit d426148
Showing
9 changed files
with
87 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
example/derive_expression/expression_lib/expression_lib/_typing.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from typing import TYPE_CHECKING, Union | ||
|
||
if TYPE_CHECKING: | ||
import sys | ||
|
||
import polars as pl | ||
|
||
if sys.version_info >= (3, 10): | ||
from typing import TypeAlias | ||
else: | ||
from typing_extensions import TypeAlias | ||
|
||
IntoExprColumn: TypeAlias = Union[pl.Expr, str, pl.Series] |
3 changes: 3 additions & 0 deletions
3
example/derive_expression/expression_lib/expression_lib/_utils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from pathlib import Path | ||
|
||
LIB = Path(__file__).parent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 17 additions & 15 deletions
32
example/derive_expression/expression_lib/expression_lib/dist.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 10 additions & 6 deletions
16
example/derive_expression/expression_lib/expression_lib/panic.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
import polars as pl | ||
from polars.type_aliases import IntoExpr | ||
from polars.plugins import register_plugin_function | ||
|
||
from expression_lib.utils import parse_into_expr | ||
from pathlib import Path | ||
from expression_lib._utils import LIB | ||
|
||
if TYPE_CHECKING: | ||
from expression_lib._typing import IntoExprColumn | ||
|
||
|
||
def panic(expr: IntoExpr) -> pl.Expr: | ||
expr = parse_into_expr(expr) | ||
def panic(expr: IntoExprColumn) -> pl.Expr: | ||
return register_plugin_function( | ||
plugin_path=Path(__file__).parent, | ||
plugin_path=LIB, | ||
args=[expr], | ||
function_name="panic", | ||
) |
48 changes: 0 additions & 48 deletions
48
example/derive_expression/expression_lib/expression_lib/utils.py
This file was deleted.
Oops, something went wrong.