Skip to content

chore: upgrade black and pre-commit #1967

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Generated by synthtool. DO NOT EDIT!
[flake8]
ignore = E203, E231, E266, E501, W503
ignore = E203, E231, E266, E501, W503, E704
exclude =
# Exclude generated code.
**/proto/**
Expand Down
14 changes: 7 additions & 7 deletions .github/header-checker-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"allowedLicenses": ["Apache-2.0", "MIT", "BSD-3"],
"ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt", "**/__init__.py", "samples/**/constraints.txt", "samples/**/constraints-test.txt"],
"sourceFileExtensions": [
"ts",
"js",
"java",
"sh",
"Dockerfile",
"yaml",
"ts",
"js",
"java",
"sh",
"Dockerfile",
"yaml",
"py",
"html",
"txt"
]
}
}
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -28,11 +28,11 @@ repos:
- id: isort
name: isort (python)
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 25.1.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 7.1.2
rev: 7.3.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ harassment or threats to anyone's safety, we may take action without notice.

This Code of Conduct is adapted from the Contributor Covenant, version 1.4,
available at
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
2 changes: 1 addition & 1 deletion OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ [email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
2 changes: 1 addition & 1 deletion bigframes/bigquery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

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

from bigframes.bigquery._operations.approx_agg import approx_top_count
from bigframes.bigquery._operations.array import (
Expand Down
2 changes: 1 addition & 1 deletion bigframes/bigquery/_operations/struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

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


from __future__ import annotations
Expand Down
8 changes: 5 additions & 3 deletions bigframes/core/array_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,11 @@ def prepare_join_names(
) -> Tuple[bigframes.core.nodes.BigFrameNode, dict[str, str]]:
if set(other.node.ids) & set(self.node.ids):
r_mapping = { # Rename conflicting names
rcol.name: rcol.name
if (rcol.name not in self.column_ids)
else bigframes.core.guid.generate_guid()
rcol.name: (
rcol.name
if (rcol.name not in self.column_ids)
else bigframes.core.guid.generate_guid()
)
for rcol in other.node.ids
}
return (
Expand Down
9 changes: 4 additions & 5 deletions bigframes/core/bigframe_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@ def roots(self) -> typing.Set[BigFrameNode]:
# TODO: Store some local data lazily for select, aggregate nodes.
@property
@abc.abstractmethod
def fields(self) -> Sequence[field.Field]:
...
def fields(self) -> Sequence[field.Field]: ...

@property
def ids(self) -> Iterable[identifiers.ColumnId]:
Expand Down Expand Up @@ -322,9 +321,9 @@ def iter_nodes_topo(self: BigFrameNode) -> Generator[BigFrameNode, None, None]:
[node for node in self.unique_nodes() if not node.child_nodes]
)

child_to_parents: Dict[
BigFrameNode, Set[BigFrameNode]
] = collections.defaultdict(set)
child_to_parents: Dict[BigFrameNode, Set[BigFrameNode]] = (
collections.defaultdict(set)
)
for parent, child in self.edges():
child_to_parents[child].add(parent)

Expand Down
28 changes: 16 additions & 12 deletions bigframes/core/block_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,11 @@ def value_counts(
[
ordering.OrderingExpression(
ex.deref(count_id),
direction=ordering.OrderingDirection.ASC
if ascending
else ordering.OrderingDirection.DESC,
direction=(
ordering.OrderingDirection.ASC
if ascending
else ordering.OrderingDirection.DESC
),
)
]
)
Expand Down Expand Up @@ -435,22 +437,24 @@ def rank(
window_ordering = (
ordering.OrderingExpression(
ex.deref(col),
ordering.OrderingDirection.ASC
if ascending
else ordering.OrderingDirection.DESC,
(
ordering.OrderingDirection.ASC
if ascending
else ordering.OrderingDirection.DESC
),
na_last=(na_option in ["bottom", "keep"]),
),
)
# Count_op ignores nulls, so if na_option is "top" or "bottom", we instead count the nullity columns, where nulls have been mapped to bools
block, rownum_id = block.apply_window_op(
col if na_option == "keep" else nullity_col_id,
agg_ops.dense_rank_op if method == "dense" else agg_ops.count_op,
window_spec=windows.unbound(
grouping_keys=grouping_cols, ordering=window_ordering
)
if method == "dense"
else windows.rows(
end=0, ordering=window_ordering, grouping_keys=grouping_cols
window_spec=(
windows.unbound(grouping_keys=grouping_cols, ordering=window_ordering)
if method == "dense"
else windows.rows(
end=0, ordering=window_ordering, grouping_keys=grouping_cols
)
),
skip_reproject_unsafe=(col != columns[-1]),
)
Expand Down
Loading
Loading