Skip to content

Commit ea660f4

Browse files
committed
type annotations
1 parent 5ce125f commit ea660f4

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

pandas_gbq/gbq.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,17 @@
77
import time
88
import warnings
99
from datetime import datetime
10+
import typing
11+
from typing import Dict, Optional, Union
1012

1113
import numpy as np
1214

15+
# Only import at module-level at type checking time to avoid circular
16+
# dependencies in the pandas package, which has an optional dependency on
17+
# pandas-gbq.
18+
if typing.TYPE_CHECKING:
19+
import pandas
20+
1321
# Required dependencies, but treat as optional so that _test_google_api_imports
1422
# can provide a better error message.
1523
try:
@@ -380,8 +388,14 @@ def process_http_error(ex):
380388
raise GenericGBQException("Reason: {0}".format(ex))
381389

382390
def download_table(
383-
self, table_id, max_results=None, progress_bar_type=None, dtypes=None
384-
):
391+
self,
392+
table_id: str,
393+
max_results: Optional[int] = None,
394+
progress_bar_type: Optional[str] = None,
395+
dtypes: Dict[
396+
str, Union[str, "pandas.api.extensions.ExtensionDtype", np.dtype]
397+
] = None,
398+
) -> "pandas.DataFrame":
385399
self._start_timer()
386400

387401
try:

0 commit comments

Comments
 (0)