Skip to content

Commit f2bfebf

Browse files
committed
chore: reformat using ruff
1 parent 8e87d53 commit f2bfebf

File tree

148 files changed

+1082
-938
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+1082
-938
lines changed

packages/bigframes/bigframes/_config/auth.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
_cached_project_default: Optional[str] = None
3131

3232

33-
def get_default_credentials_with_project() -> (
34-
tuple[google.auth.credentials.Credentials, Optional[str]]
35-
):
33+
def get_default_credentials_with_project() -> tuple[
34+
google.auth.credentials.Credentials, Optional[str]
35+
]:
3636
global _AUTH_LOCK, _cached_credentials, _cached_project_default
3737

3838
with _AUTH_LOCK:

packages/bigframes/bigframes/bigquery/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
"""This module integrates BigQuery built-in functions for use with DataFrame objects,
1616
such as array functions:
17-
https://cloud.google.com/bigquery/docs/reference/standard-sql/array_functions. """
17+
https://cloud.google.com/bigquery/docs/reference/standard-sql/array_functions."""
1818

1919
import sys
2020

packages/bigframes/bigframes/bigquery/_operations/array.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
https://cloud.google.com/bigquery/docs/reference/standard-sql/array_functions
1818
"""
1919

20-
2120
from __future__ import annotations
2221

2322
import typing

packages/bigframes/bigframes/bigquery/_operations/json.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
https://cloud.google.com/bigquery/docs/reference/standard-sql/json_functions
1919
"""
2020

21-
2221
from __future__ import annotations
2322

2423
import warnings

packages/bigframes/bigframes/bigquery/_operations/ml.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ def create_model(
131131
if session is None:
132132
bpd.read_gbq_query(sql)
133133
session = bpd.get_global_session()
134-
assert (
135-
session is not None
136-
), f"Missing connection to BigQuery. Please report how you encountered this error at {bigframes_vendored.constants.FEEDBACK_LINK}."
134+
assert session is not None, (
135+
f"Missing connection to BigQuery. Please report how you encountered this error at {bigframes_vendored.constants.FEEDBACK_LINK}."
136+
)
137137
else:
138138
session.read_gbq_query(sql)
139139

packages/bigframes/bigframes/bigquery/_operations/obj.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
See bigframes.bigquery.obj for public docs.
1919
"""
2020

21-
2221
from __future__ import annotations
2322

2423
import datetime

packages/bigframes/bigframes/bigquery/_operations/struct.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515

1616
"""This module integrates BigQuery built-in functions for use with DataFrame objects,
1717
such as array functions:
18-
https://cloud.google.com/bigquery/docs/reference/standard-sql/array_functions. """
19-
18+
https://cloud.google.com/bigquery/docs/reference/standard-sql/array_functions."""
2019

2120
from __future__ import annotations
2221

packages/bigframes/bigframes/core/agg_expressions.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ def output_type(self) -> dtypes.ExpressionType:
6060
@abc.abstractmethod
6161
def inputs(
6262
self,
63-
) -> typing.Tuple[expression.Expression, ...]:
64-
...
63+
) -> typing.Tuple[expression.Expression, ...]: ...
6564

6665
@property
6766
def children(self) -> Tuple[expression.Expression, ...]:
@@ -82,8 +81,7 @@ def is_scalar_expr(self) -> bool:
8281
return False
8382

8483
@abc.abstractmethod
85-
def replace_args(self: TExpression, *arg) -> TExpression:
86-
...
84+
def replace_args(self: TExpression, *arg) -> TExpression: ...
8785

8886
def transform_children(
8987
self: TExpression, t: Callable[[expression.Expression], expression.Expression]

packages/bigframes/bigframes/core/bigframe_node.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ def roots(self) -> typing.Set[BigFrameNode]:
142142
# TODO: Store some local data lazily for select, aggregate nodes.
143143
@property
144144
@abc.abstractmethod
145-
def fields(self) -> Sequence[field.Field]:
146-
...
145+
def fields(self) -> Sequence[field.Field]: ...
147146

148147
@property
149148
def ids(self) -> Iterable[identifiers.ColumnId]:
@@ -300,9 +299,9 @@ def iter_nodes_topo(
300299
self: BigFrameNode,
301300
) -> Generator[BigFrameNode, None, None]:
302301
"""Returns nodes in reverse topological order, using Kahn's algorithm."""
303-
child_to_parents: Dict[
304-
BigFrameNode, list[BigFrameNode]
305-
] = collections.defaultdict(list)
302+
child_to_parents: Dict[BigFrameNode, list[BigFrameNode]] = (
303+
collections.defaultdict(list)
304+
)
306305
out_degree: Dict[BigFrameNode, int] = collections.defaultdict(int)
307306

308307
queue: collections.deque["BigFrameNode"] = collections.deque()

packages/bigframes/bigframes/core/blocks.py

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2545,7 +2545,10 @@ def join(
25452545
sort: bool = False,
25462546
block_identity_join: bool = False,
25472547
always_order: bool = False,
2548-
) -> Tuple[Block, Tuple[Mapping[str, str], Mapping[str, str]],]:
2548+
) -> Tuple[
2549+
Block,
2550+
Tuple[Mapping[str, str], Mapping[str, str]],
2551+
]:
25492552
"""
25502553
Join two blocks objects together, and provide mappings between source columns and output columns.
25512554
@@ -2794,7 +2797,9 @@ def _is_monotonic(
27942797
block = block.drop_columns([equal_monotonic_id, strict_monotonic_id])
27952798

27962799
block, monotonic_result_id = block.apply_binary_op(
2797-
last_result_id, last_notna_id, ops.and_op # type: ignore
2800+
last_result_id,
2801+
last_notna_id,
2802+
ops.and_op, # type: ignore
27982803
)
27992804
if last_result_id is not None:
28002805
block = block.drop_columns([last_result_id, last_notna_id])
@@ -2963,7 +2968,12 @@ def is_uniquely_named(self: BlockIndexProperties):
29632968

29642969
def try_new_row_join(
29652970
left: Block, right: Block
2966-
) -> Optional[Tuple[Block, Tuple[Mapping[str, str], Mapping[str, str]],]]:
2971+
) -> Optional[
2972+
Tuple[
2973+
Block,
2974+
Tuple[Mapping[str, str], Mapping[str, str]],
2975+
]
2976+
]:
29672977
join_keys = tuple(
29682978
(left_id, right_id)
29692979
for left_id, right_id in zip(left.index_columns, right.index_columns)
@@ -2994,7 +3004,12 @@ def try_legacy_row_join(
29943004
right: Block,
29953005
*,
29963006
how="left",
2997-
) -> Optional[Tuple[Block, Tuple[Mapping[str, str], Mapping[str, str]],]]:
3007+
) -> Optional[
3008+
Tuple[
3009+
Block,
3010+
Tuple[Mapping[str, str], Mapping[str, str]],
3011+
]
3012+
]:
29983013
"""Joins two blocks that have a common root expression by merging the projections."""
29993014
left_expr = left.expr
30003015
right_expr = right.expr
@@ -3048,7 +3063,10 @@ def try_legacy_row_join(
30483063
def join_with_single_row(
30493064
left: Block,
30503065
single_row_block: Block,
3051-
) -> Tuple[Block, Tuple[Mapping[str, str], Mapping[str, str]],]:
3066+
) -> Tuple[
3067+
Block,
3068+
Tuple[Mapping[str, str], Mapping[str, str]],
3069+
]:
30523070
"""
30533071
Special join case where other is a single row block.
30543072
This property is not validated, caller responsible for not passing multi-row block.
@@ -3083,7 +3101,10 @@ def join_mono_indexed(
30833101
how="left",
30843102
sort: bool = False,
30853103
propogate_order: bool = False,
3086-
) -> Tuple[Block, Tuple[Mapping[str, str], Mapping[str, str]],]:
3104+
) -> Tuple[
3105+
Block,
3106+
Tuple[Mapping[str, str], Mapping[str, str]],
3107+
]:
30873108
left_expr = left.expr
30883109
right_expr = right.expr
30893110

@@ -3130,7 +3151,10 @@ def join_multi_indexed(
31303151
how="left",
31313152
sort: bool = False,
31323153
propogate_order: bool = False,
3133-
) -> Tuple[Block, Tuple[Mapping[str, str], Mapping[str, str]],]:
3154+
) -> Tuple[
3155+
Block,
3156+
Tuple[Mapping[str, str], Mapping[str, str]],
3157+
]:
31343158
if not (left.index.is_uniquely_named() and right.index.is_uniquely_named()):
31353159
raise ValueError("Joins not supported on indices with non-unique level names")
31363160

0 commit comments

Comments
 (0)