Skip to content

Commit

Permalink
chore: fix ruff formatting errors for ibis.expr.types
Browse files Browse the repository at this point in the history
  • Loading branch information
kszucs committed Feb 5, 2024
1 parent ae8fcfc commit a53b513
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 22 deletions.
2 changes: 2 additions & 0 deletions ibis/expr/types/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

# ruff: noqa: I001

from ibis.expr.types.arrays import * # noqa: F403
from ibis.expr.types.binary import * # noqa: F403
from ibis.expr.types.collections import * # noqa: F403
Expand Down
2 changes: 1 addition & 1 deletion ibis/expr/types/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __repr__(self) -> str:
except TranslationError as e:
lines = [
"Translation to backend failed",
f"Error message: {repr(e)}",
f"Error message: {e!r}",
"Expression repr follows:",
self._repr(),
]
Expand Down
40 changes: 23 additions & 17 deletions ibis/expr/types/joins.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
from __future__ import annotations

import functools
from typing import TYPE_CHECKING, Any

from public import public
from typing import Any, Optional, TYPE_CHECKING
from collections.abc import Iterator, Mapping

import ibis
import ibis.expr.operations as ops

from ibis import util
from ibis.expr.types import Table, Value
from ibis.common.deferred import Deferred
from ibis.common.egraph import DisjointSet
from ibis.common.exceptions import (
ExpressionError,
IbisInputError,
InputTypeError,
IntegrityError,
)
from ibis.expr.analysis import flatten_predicates
from ibis.common.exceptions import ExpressionError, IntegrityError
from ibis.expr.rewrites import peel_join_field
from ibis.expr.types.generic import Value
from ibis.expr.types.relations import (
Table,
bind,
dereference_values,
dereference_mapping,
unwrap_aliases,
)
from ibis.expr.operations.relations import JoinKind
from ibis.expr.rewrites import peel_join_field
from ibis.common.egraph import DisjointSet

if TYPE_CHECKING:
from collections.abc import Sequence

from ibis.expr.operations.relations import JoinKind


def disambiguate_fields(
how,
Expand All @@ -36,9 +41,7 @@ def disambiguate_fields(
left_template,
right_template,
):
"""
Resolve name collisions between the left and right tables.
"""
"""Resolve name collisions between the left and right tables."""
collisions = set()
left_template = left_template or "{name}"
right_template = right_template or "{name}"
Expand Down Expand Up @@ -190,6 +193,9 @@ def prepare_predicates(
The right table
predicates
Predicates to bind and dereference, see the possible values above
comparison
The comparison operation to construct if the input is a pair of
expression-like objects
"""
deref_left = dereference_mapping_left(left)
deref_right = dereference_mapping_right(right)
Expand Down Expand Up @@ -266,7 +272,7 @@ def _finish(self) -> Table:
return Table(self.op())

@functools.wraps(Table.join)
def join( # noqa: D102
def join(
self,
right,
predicates: Any,
Expand All @@ -275,8 +281,8 @@ def join( # noqa: D102
lname: str = "",
rname: str = "{name}_right",
):
import pyarrow as pa
import pandas as pd
import pyarrow as pa

# TODO(kszucs): factor out to a helper function
if isinstance(right, (pd.DataFrame, pa.Table)):
Expand Down Expand Up @@ -324,7 +330,7 @@ def join( # noqa: D102
return self.__class__(left, collisions=collisions, equalities=equalities)

@functools.wraps(Table.asof_join)
def asof_join( # noqa: D102
def asof_join(
self: Table,
right: Table,
on,
Expand Down Expand Up @@ -403,7 +409,7 @@ def asof_join( # noqa: D102
return self.__class__(left, collisions=collisions, equalities=equalities)

@functools.wraps(Table.cross_join)
def cross_join( # noqa: D102
def cross_join(
self: Table,
right: Table,
*rest: Table,
Expand All @@ -418,7 +424,7 @@ def cross_join( # noqa: D102
return left

@functools.wraps(Table.select)
def select(self, *args, **kwargs): # noqa: D102
def select(self, *args, **kwargs):
chain = self.op()
values = bind(self, (args, kwargs))
values = unwrap_aliases(values)
Expand Down
2 changes: 1 addition & 1 deletion ibis/expr/types/logical.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def any(self, where: BooleanValue | None = None) -> BooleanValue:
>>> (t.arr == None).any(where=t.arr != None)
False
"""
from ibis.common.deferred import Call, _, Deferred
from ibis.common.deferred import Call, Deferred, _

parents = self.op().relations

Expand Down
3 changes: 0 additions & 3 deletions ibis/expr/types/temporal_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
from public import public

import ibis.common.exceptions as com
import ibis.expr.analysis as an
import ibis.expr.operations as ops
import ibis.expr.types as ir
from ibis.common.deferred import Deferred
from ibis.selectors import Selector
from ibis.expr.types.relations import bind

if TYPE_CHECKING:
Expand Down

0 comments on commit a53b513

Please sign in to comment.