Skip to content

Commit

Permalink
Keep existing plugin utils for now
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed Feb 29, 2024
1 parent 1c0d71a commit e2944ab
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/user-guide/expressions/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ expression in batches. Whereas for other operations this would not be allowed, t
# expression_lib/__init__.py
import polars as pl
from polars.type_aliases import IntoExpr
from polars._utils.udfs import _get_shared_lib_location
from polars.utils.udfs import _get_shared_lib_location

from expression_lib.utils import parse_into_expr

Expand Down
15 changes: 1 addition & 14 deletions py-polars/polars/_utils/udfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -977,17 +977,4 @@ def warn_on_inefficient_map(
)


def is_shared_lib(file: str) -> bool:
return file.endswith((".so", ".dll", ".pyd"))


def _get_shared_lib_location(main_file: Any) -> str:
import os

directory = os.path.dirname(main_file) # noqa: PTH120
return os.path.join( # noqa: PTH118
directory, next(filter(is_shared_lib, os.listdir(directory)))
)


__all__ = ["BytecodeParser", "warn_on_inefficient_map", "_get_shared_lib_location"]
__all__ = ["BytecodeParser", "warn_on_inefficient_map"]
Empty file.
15 changes: 15 additions & 0 deletions py-polars/polars/utils/udfs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import os
from typing import Any

__all__ = ["_get_shared_lib_location"]


def _get_shared_lib_location(main_file: Any) -> str:
directory = os.path.dirname(main_file) # noqa: PTH120
return os.path.join( # noqa: PTH118
directory, next(filter(_is_shared_lib, os.listdir(directory)))
)


def _is_shared_lib(file: str) -> bool:
return file.endswith((".so", ".dll", ".pyd"))

0 comments on commit e2944ab

Please sign in to comment.