Skip to content

Commit 0e25a3b

Browse files
authored
fix: set @bpd.remote_functions input_types and output_types default to None to allow omitting them when type annotations are present (#729)
1 parent 804e9e3 commit 0e25a3b

File tree

7 files changed

+43
-16
lines changed

7 files changed

+43
-16
lines changed

bigframes/constants.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import datetime
16-
1715
"""Constants used across BigQuery DataFrames.
1816
1917
This module should not depend on any others in the package.
2018
"""
2119

22-
FEEDBACK_LINK = (
23-
"Share your usecase with the BigQuery DataFrames team at the "
24-
"https://bit.ly/bigframes-feedback survey."
25-
)
20+
import datetime
21+
22+
import bigframes_vendored.constants
2623

27-
ABSTRACT_METHOD_ERROR_MESSAGE = f"Abstract method. You have likely encountered a bug. Please share this stacktrace and how you reached it with the BigQuery DataFrames team. {FEEDBACK_LINK}"
24+
FEEDBACK_LINK = bigframes_vendored.constants.FEEDBACK_LINK
25+
ABSTRACT_METHOD_ERROR_MESSAGE = (
26+
bigframes_vendored.constants.ABSTRACT_METHOD_ERROR_MESSAGE
27+
)
2828

2929
DEFAULT_EXPIRATION = datetime.timedelta(days=7)
3030

bigframes/pandas/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -652,8 +652,8 @@ def read_parquet(
652652

653653

654654
def remote_function(
655-
input_types: Union[type, Sequence[type]],
656-
output_type: type,
655+
input_types: Union[None, type, Sequence[type]] = None,
656+
output_type: Optional[type] = None,
657657
dataset: Optional[str] = None,
658658
bigquery_connection: Optional[str] = None,
659659
reuse: bool = True,

bigframes/session/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1549,8 +1549,8 @@ def _ibis_to_temp_table(
15491549

15501550
def remote_function(
15511551
self,
1552-
input_types: Union[type, Sequence[type]],
1553-
output_type: type,
1552+
input_types: Union[None, type, Sequence[type]] = None,
1553+
output_type: Optional[type] = None,
15541554
dataset: Optional[str] = None,
15551555
bigquery_connection: Optional[str] = None,
15561556
reuse: bool = True,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2023 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""Constants used across BigQuery DataFrames and bigframes_vendored.
16+
17+
This module should not depend on any others in the package.
18+
"""
19+
20+
FEEDBACK_LINK = (
21+
"Share your usecase with the BigQuery DataFrames team at the "
22+
"https://bit.ly/bigframes-feedback survey."
23+
)
24+
25+
ABSTRACT_METHOD_ERROR_MESSAGE = (
26+
"Abstract method. You have likely encountered a bug. "
27+
"Please share this stacktrace and how you reached it with the BigQuery DataFrames team. "
28+
f"{FEEDBACK_LINK}"
29+
)

third_party/bigframes_vendored/pandas/core/frame.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@
1313

1414
from typing import Hashable, Iterable, Literal, Mapping, Optional, Sequence, Union
1515

16+
from bigframes_vendored import constants
1617
import bigframes_vendored.pandas.core.generic as generic
1718
import numpy as np
1819
import pandas as pd
1920

20-
from bigframes import constants
21-
2221
# -----------------------------------------------------------------------
2322
# DataFrame class
2423

third_party/bigframes_vendored/pandas/core/generic.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33

44
from typing import Callable, Iterator, Literal, Optional, TYPE_CHECKING
55

6+
import bigframes_vendored.constants as constants
67
from bigframes_vendored.pandas.core import indexing
78
import bigframes_vendored.pandas.core.common as common
89

9-
import bigframes.constants as constants
10-
1110
if TYPE_CHECKING:
1211
from bigframes_vendored.pandas.pandas._typing import T
1312

third_party/bigframes_vendored/pandas/core/indexing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contains code from https://github.com/pandas-dev/pandas/blob/main/pandas/core/indexing.py
22

3-
import bigframes.constants as constants
3+
import bigframes_vendored.constants as constants
44

55

66
class IndexingMixin:

0 commit comments

Comments
 (0)