Skip to content

Commit f9e4435

Browse files
authored
test: fix mypy failures to unblock presubmit tests (#852)
The presubmit and continuous tests have started failing due to mypy. This change finds the failure points and puts in workarounds. Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://togithub.com/googleapis/python-bigquery-dataframes/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes #<issue_number_goes_here> 🦕
1 parent 01d6bbb commit f9e4435

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

bigframes/session/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -650,15 +650,17 @@ def _read_gbq_query(
650650

651651
index_cols = _to_index_cols(index_col)
652652

653-
filters = list(filters)
654-
if len(filters) != 0 or max_results is not None:
653+
filters_copy1, filters_copy2 = itertools.tee(filters)
654+
has_filters = len(list(filters_copy1)) != 0
655+
filters = typing.cast(third_party_pandas_gbq.FiltersType, filters_copy2)
656+
if has_filters or max_results is not None:
655657
# TODO(b/338111344): If we are running a query anyway, we might as
656658
# well generate ROW_NUMBER() at the same time.
657659
all_columns = itertools.chain(index_cols, columns) if columns else ()
658660
query = bf_io_bigquery.to_query(
659661
query,
660662
all_columns,
661-
bf_io_bigquery.compile_filters(filters) if filters else None,
663+
bf_io_bigquery.compile_filters(filters) if has_filters else None,
662664
max_results=max_results,
663665
# We're executing the query, so we don't need time travel for
664666
# determinism.
@@ -768,7 +770,7 @@ def _read_gbq_table(
768770
)
769771

770772
columns = list(columns)
771-
filters = list(filters)
773+
filters = typing.cast(list, list(filters))
772774

773775
# ---------------------------------
774776
# Fetch table metadata and validate

third_party/bigframes_vendored/pandas/core/series.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3521,7 +3521,7 @@ def mask(self, cond, other):
35213521
"""
35223522
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
35233523

3524-
def clip(self):
3524+
def clip(self, lower, upper):
35253525
"""Trim values at input threshold(s).
35263526
35273527
Assigns values outside boundary to boundary values. Thresholds can be

0 commit comments

Comments
 (0)