Skip to content

Commit

Permalink
move everything not in the api in _internal
Browse files Browse the repository at this point in the history
  • Loading branch information
finn-rudolph committed Oct 4, 2024
1 parent fa918bc commit 781fc9e
Show file tree
Hide file tree
Showing 64 changed files with 168 additions and 154 deletions.
6 changes: 3 additions & 3 deletions src/pydiverse/transform/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from __future__ import annotations

from ._internal.pipe.pipeable import verb
from ._internal.pipe.table import Table
from ._internal.tree.col_expr import ColExpr
from .extended import *
from .extended import __all__ as __extended
from .pipe.pipeable import verb
from .pipe.table import Table
from .tree.col_expr import ColExpr
from .types import *
from .types import __all__ as __types

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
import sqlalchemy as sqa
from sqlalchemy.sql.type_api import TypeEngine as TypeEngine

from pydiverse.transform import ops
from pydiverse.transform.backend import sql
from pydiverse.transform.backend.sql import SqlImpl
from pydiverse.transform.backend.targets import Polars, Target
from pydiverse.transform.tree import dtypes, verbs
from pydiverse.transform.tree.ast import AstNode
from pydiverse.transform.tree.col_expr import Cast, Col, ColFn, LiteralCol
from pydiverse.transform._internal import ops
from pydiverse.transform._internal.backend import sql
from pydiverse.transform._internal.backend.sql import SqlImpl
from pydiverse.transform._internal.backend.targets import Polars, Target
from pydiverse.transform._internal.tree import dtypes, verbs
from pydiverse.transform._internal.tree.ast import AstNode
from pydiverse.transform._internal.tree.col_expr import Cast, Col, ColFn, LiteralCol


class DuckDbImpl(SqlImpl):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
import sqlalchemy as sqa
from sqlalchemy.dialects.mssql import DATETIME2

from pydiverse.transform import ops
from pydiverse.transform.backend import sql
from pydiverse.transform.backend.sql import SqlImpl
from pydiverse.transform.errors import NotSupportedError
from pydiverse.transform.tree import dtypes, verbs
from pydiverse.transform.tree.ast import AstNode
from pydiverse.transform.tree.col_expr import (
from pydiverse.transform._internal import ops
from pydiverse.transform._internal.backend import sql
from pydiverse.transform._internal.backend.sql import SqlImpl
from pydiverse.transform._internal.errors import NotSupportedError
from pydiverse.transform._internal.tree import dtypes, verbs
from pydiverse.transform._internal.tree.ast import AstNode
from pydiverse.transform._internal.tree.col_expr import (
CaseExpr,
Cast,
Col,
Expand All @@ -22,7 +22,7 @@
LiteralCol,
Order,
)
from pydiverse.transform.util.warnings import warn_non_standard
from pydiverse.transform._internal.util.warnings import warn_non_standard


class MsSqlImpl(SqlImpl):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

import polars as pl

from pydiverse.transform import ops
from pydiverse.transform.backend.table_impl import TableImpl
from pydiverse.transform.backend.targets import Polars, Target
from pydiverse.transform.ops.core import Ftype
from pydiverse.transform.tree import dtypes, verbs
from pydiverse.transform.tree.ast import AstNode
from pydiverse.transform.tree.col_expr import (
from pydiverse.transform._internal import ops
from pydiverse.transform._internal.backend.table_impl import TableImpl
from pydiverse.transform._internal.backend.targets import Polars, Target
from pydiverse.transform._internal.ops.core import Ftype
from pydiverse.transform._internal.tree import dtypes, verbs
from pydiverse.transform._internal.tree.ast import AstNode
from pydiverse.transform._internal.tree.col_expr import (
CaseExpr,
Cast,
Col,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import sqlalchemy as sqa

from pydiverse.transform import ops
from pydiverse.transform.backend.sql import SqlImpl
from pydiverse.transform.tree import dtypes
from pydiverse.transform.tree.col_expr import Cast
from pydiverse.transform._internal import ops
from pydiverse.transform._internal.backend.sql import SqlImpl
from pydiverse.transform._internal.tree import dtypes
from pydiverse.transform._internal.tree.col_expr import Cast


class PostgresImpl(SqlImpl):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
import polars as pl
import sqlalchemy as sqa

from pydiverse.transform import ops
from pydiverse.transform.backend.polars import pdt_type_to_polars
from pydiverse.transform.backend.table_impl import TableImpl
from pydiverse.transform.backend.targets import Polars, SqlAlchemy, Target
from pydiverse.transform.errors import SubqueryError
from pydiverse.transform.ops.core import Ftype
from pydiverse.transform.tree import dtypes, verbs
from pydiverse.transform.tree.ast import AstNode
from pydiverse.transform.tree.col_expr import (
from pydiverse.transform._internal import ops
from pydiverse.transform._internal.backend.polars import pdt_type_to_polars
from pydiverse.transform._internal.backend.table_impl import TableImpl
from pydiverse.transform._internal.backend.targets import Polars, SqlAlchemy, Target
from pydiverse.transform._internal.errors import SubqueryError
from pydiverse.transform._internal.ops.core import Ftype
from pydiverse.transform._internal.tree import dtypes, verbs
from pydiverse.transform._internal.tree.ast import AstNode
from pydiverse.transform._internal.tree.col_expr import (
CaseExpr,
Cast,
Col,
Expand All @@ -30,7 +30,7 @@
LiteralCol,
Order,
)
from pydiverse.transform.tree.dtypes import Dtype
from pydiverse.transform._internal.tree.dtypes import Dtype


class SqlImpl(TableImpl):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import sqlalchemy as sqa

from pydiverse.transform import ops
from pydiverse.transform.backend.sql import SqlImpl
from pydiverse.transform.errors import NotSupportedError
from pydiverse.transform.tree import dtypes
from pydiverse.transform.tree.col_expr import Cast
from pydiverse.transform.util.warnings import warn_non_standard
from pydiverse.transform._internal import ops
from pydiverse.transform._internal.backend.sql import SqlImpl
from pydiverse.transform._internal.errors import NotSupportedError
from pydiverse.transform._internal.tree import dtypes
from pydiverse.transform._internal.tree.col_expr import Cast
from pydiverse.transform._internal.util.warnings import warn_non_standard


class SqliteImpl(SqlImpl):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
from collections.abc import Iterable
from typing import TYPE_CHECKING, Any

from pydiverse.transform import ops
from pydiverse.transform.backend.targets import Target
from pydiverse.transform.ops.core import Ftype
from pydiverse.transform.tree.ast import AstNode
from pydiverse.transform.tree.col_expr import (
from pydiverse.transform._internal import ops
from pydiverse.transform._internal.backend.targets import Target
from pydiverse.transform._internal.ops.core import Ftype
from pydiverse.transform._internal.tree.ast import AstNode
from pydiverse.transform._internal.tree.col_expr import (
Col,
)
from pydiverse.transform.tree.dtypes import Dtype
from pydiverse.transform.tree.registry import (
from pydiverse.transform._internal.tree.dtypes import Dtype
from pydiverse.transform._internal.tree.registry import (
OperatorRegistrationContextManager,
OperatorRegistry,
)

if TYPE_CHECKING:
from pydiverse.transform.ops import Operator
from pydiverse.transform._internal.ops import Operator


class TableImpl(AstNode):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from pydiverse.transform.ops.core import Aggregate, Unary
from pydiverse.transform._internal.ops.core import Aggregate, Unary

__all__ = [
"Min",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from pydiverse.transform.tree.registry import OperatorSignature
from pydiverse.transform._internal.tree.registry import OperatorSignature

__all__ = [
"Ftype",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from pydiverse.transform.ops.core import ElementWise, OperatorExtension, Unary
from pydiverse.transform.ops.numeric import Add, RAdd, RSub, Sub
from pydiverse.transform._internal.ops.core import ElementWise, OperatorExtension, Unary
from pydiverse.transform._internal.ops.numeric import Add, RAdd, RSub, Sub

__all__ = [
"DtYear",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from pydiverse.transform.ops.core import ElementWise
from pydiverse.transform._internal.ops.core import ElementWise

__all__ = [
"Greatest",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from pydiverse.transform.ops.core import Binary, ElementWise, Operator, Unary
from pydiverse.transform.tree import dtypes
from pydiverse.transform._internal.ops.core import Binary, ElementWise, Operator, Unary
from pydiverse.transform._internal.tree import dtypes

__all__ = [
"Equal",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from pydiverse.transform.ops.core import Marker
from pydiverse.transform._internal.ops.core import Marker

__all__ = ["NullsFirst", "NullsLast", "Ascending", "Descending"]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from pydiverse.transform.ops.core import Binary, ElementWise, Unary
from pydiverse.transform._internal.ops.core import Binary, ElementWise, Unary

__all__ = [
"Add",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

from pydiverse.transform.ops.core import ElementWise, OperatorExtension, Unary
from pydiverse.transform.ops.logical import Logical
from pydiverse.transform.ops.numeric import Add, RAdd
from pydiverse.transform._internal.ops.core import ElementWise, OperatorExtension, Unary
from pydiverse.transform._internal.ops.logical import Logical
from pydiverse.transform._internal.ops.numeric import Add, RAdd

__all__ = [
"StrAdd",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from pydiverse.transform.ops.core import Nullary, Window
from pydiverse.transform._internal.ops.core import Nullary, Window

__all__ = [
"Shift",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from pydiverse.transform.tree.col_expr import ColName
from pydiverse.transform._internal.tree.col_expr import ColName


class MC(type):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from collections.abc import Iterable
from typing import Any

from pydiverse.transform.tree import dtypes
from pydiverse.transform.tree.col_expr import (
from pydiverse.transform._internal.tree import dtypes
from pydiverse.transform._internal.tree.col_expr import (
ColExpr,
ColFn,
LiteralCol,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

import sqlalchemy as sqa

from pydiverse.transform.backend.table_impl import TableImpl
from pydiverse.transform.pipe.pipeable import Pipeable
from pydiverse.transform.tree.ast import AstNode
from pydiverse.transform.tree.col_expr import Col, ColName
from pydiverse.transform._internal.backend.table_impl import TableImpl
from pydiverse.transform._internal.pipe.pipeable import Pipeable
from pydiverse.transform._internal.tree.ast import AstNode
from pydiverse.transform._internal.tree.col_expr import Col, ColName


class Table:
Expand All @@ -28,7 +28,7 @@ class Table:
def __init__(self, resource, backend=None, *, name: str | None = None):
import polars as pl

from pydiverse.transform.backend import (
from pydiverse.transform._internal.backend import (
PolarsImpl,
SqlAlchemy,
SqlImpl,
Expand Down Expand Up @@ -113,8 +113,8 @@ def __rshift__(self, rhs):
)

def __str__(self):
from pydiverse.transform.backend.targets import Polars
from pydiverse.transform.pipe.verbs import export, get_backend
from pydiverse.transform._internal.backend.targets import Polars
from pydiverse.transform._internal.pipe.verbs import export, get_backend

backend = get_backend(self._ast)
try:
Expand All @@ -139,8 +139,8 @@ def _repr_html_(self) -> str | None:
f" <code>{type(self._ast).__name__}</code> backend</br>"
)
try:
from pydiverse.transform.backend.targets import Polars
from pydiverse.transform.pipe.verbs import export
from pydiverse.transform._internal.backend.targets import Polars
from pydiverse.transform._internal.pipe.verbs import export

# TODO: For lazy backend only show preview (eg. take first 20 rows)
# TODO: also cache the table here for a polars backend. maybe we should call
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@
from collections.abc import Iterable
from typing import Any, Literal

from pydiverse.transform import errors
from pydiverse.transform.backend.table_impl import TableImpl
from pydiverse.transform.backend.targets import Polars, Target
from pydiverse.transform.errors import FunctionTypeError
from pydiverse.transform.ops.core import Ftype
from pydiverse.transform.pipe.pipeable import verb
from pydiverse.transform.pipe.table import Table
from pydiverse.transform.tree import dtypes
from pydiverse.transform.tree.ast import AstNode
from pydiverse.transform.tree.col_expr import (
from pydiverse.transform._internal import errors
from pydiverse.transform._internal.backend.table_impl import TableImpl
from pydiverse.transform._internal.backend.targets import Polars, Target
from pydiverse.transform._internal.errors import FunctionTypeError
from pydiverse.transform._internal.ops.core import Ftype
from pydiverse.transform._internal.pipe.pipeable import verb
from pydiverse.transform._internal.pipe.table import Table
from pydiverse.transform._internal.tree import dtypes
from pydiverse.transform._internal.tree.ast import AstNode
from pydiverse.transform._internal.tree.col_expr import (
Col,
ColExpr,
ColFn,
ColName,
Order,
wrap_literal,
)
from pydiverse.transform.tree.verbs import (
from pydiverse.transform._internal.tree.verbs import (
Alias,
Arrange,
Filter,
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 781fc9e

Please sign in to comment.