Skip to content

Commit

Permalink
chore: bigquery signatures, doctests, docs, unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud authored and kszucs committed Sep 24, 2024
1 parent 5050d00 commit 660d3aa
Show file tree
Hide file tree
Showing 19 changed files with 29 additions and 410 deletions.
2 changes: 0 additions & 2 deletions docs/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,6 @@ quartodoc:
package: ibis.expr.types.generic
- name: Column
package: ibis.expr.types.generic
- name: Deferred
package: ibis.common.deferred
- name: Scalar
package: ibis.expr.types.generic

Expand Down
4 changes: 2 additions & 2 deletions ibis/backends/sql/compilers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import sqlglot as sg
import sqlglot.expressions as sge
from koerce import Replace
from koerce import Replace # noqa: TCH002
from public import public

import ibis.common.exceptions as com
Expand Down Expand Up @@ -431,7 +431,7 @@ class SQLGlotCompiler(abc.ABC):
# Constructed dynamically in `__init_subclass__` from their respective
# UPPERCASE values to handle inheritance, do not modify directly here.
extra_supported_ops: ClassVar[frozenset[type[ops.Node]]] = frozenset()
lowered_ops: ClassVar[dict[type[ops.Node], pats.Replace]] = {}
lowered_ops: ClassVar[dict[type[ops.Node], Replace]] = {}

def __init__(self) -> None:
self.f = FuncGen(copy=self.__class__.copy_func_args)
Expand Down
2 changes: 1 addition & 1 deletion ibis/backends/sql/compilers/bigquery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def _compile_python_udf(self, udf_node: ops.ScalarUDF) -> sge.Create:
signature = [
sge.ColumnDef(
this=sg.to_identifier(name, quoted=self.quoted),
kind=type_mapper.from_ibis(param.annotation.pattern.dtype),
kind=type_mapper.from_ibis(dt.dtype(param.typehint)),
)
for name, param in udf_node.__signature__.parameters.items()
]
Expand Down
1 change: 0 additions & 1 deletion ibis/common/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import collections.abc
from abc import abstractmethod
from itertools import tee
from typing import TYPE_CHECKING, Any, Generic, TypeVar

from koerce import AbstractMeta
Expand Down
12 changes: 12 additions & 0 deletions ibis/common/deferred.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from __future__ import annotations

from koerce import Deferred, Var


class _Variable(Var):
def __repr__(self):
return self.name


# reserved variable name for the value being matched
_ = Deferred(_Variable("_"))
5 changes: 2 additions & 3 deletions ibis/common/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from __future__ import annotations

import itertools
from abc import abstractmethod
from collections import deque
from collections.abc import Callable, Iterable, Iterator, KeysView, Mapping, Sequence
from typing import TYPE_CHECKING, Any, Optional, TypeVar, Union
Expand Down Expand Up @@ -47,7 +46,7 @@ def _flatten_collections(node: Any) -> Iterator[N]:
>>> from ibis.common.grounds import Concrete
>>> from ibis.common.graph import Node
>>>
>>> class MyNode(Concrete, Node):
>>> class MyNode(Node):
... number: int
... string: str
... children: tuple[Node, ...]
Expand Down Expand Up @@ -95,7 +94,7 @@ def _recursive_lookup(obj: Any, dct: dict) -> Any:
>>> from ibis.common.grounds import Concrete
>>> from ibis.common.graph import Node
>>>
>>> class MyNode(Concrete, Node):
>>> class MyNode(Node):
... number: int
... string: str
... children: tuple[Node, ...]
Expand Down
2 changes: 0 additions & 2 deletions ibis/common/grounds.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from __future__ import annotations

from abc import abstractmethod

from koerce import Annotable, MatchError
from typing_extensions import Self

Expand Down
Loading

0 comments on commit 660d3aa

Please sign in to comment.