Skip to content
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

feat: add type hint for public methods #445

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -29,6 +29,7 @@ pip-log.txt
.nox
.cache
.pytest_cache
.pytype


# Mac
Expand Down
12 changes: 6 additions & 6 deletions google/cloud/bigquery/_helpers.py
Expand Up @@ -20,12 +20,12 @@
import re
import six

from google.cloud._helpers import UTC
from google.cloud._helpers import _date_from_iso8601_date
from google.cloud._helpers import _datetime_from_microseconds
from google.cloud._helpers import _RFC3339_MICROS
from google.cloud._helpers import _RFC3339_NO_FRACTION
from google.cloud._helpers import _to_bytes
from google.cloud._helpers import UTC # type: ignore
from google.cloud._helpers import _date_from_iso8601_date # type: ignore
from google.cloud._helpers import _datetime_from_microseconds # type: ignore
from google.cloud._helpers import _RFC3339_MICROS # type: ignore
from google.cloud._helpers import _RFC3339_NO_FRACTION # type: ignore
from google.cloud._helpers import _to_bytes # type: ignore

_RFC3339_MICROS_NO_ZULU = "%Y-%m-%dT%H:%M:%S.%f"
_TIMEONLY_WO_MICROS = "%H:%M:%S"
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/bigquery/_http.py
Expand Up @@ -14,7 +14,7 @@

"""Create / interact with Google BigQuery connections."""

from google.cloud import _http
from google.cloud import _http # type: ignore

from google.cloud.bigquery import __version__

Expand Down
10 changes: 6 additions & 4 deletions google/cloud/bigquery/_pandas_helpers.py
Expand Up @@ -23,13 +23,13 @@
from six.moves import queue

try:
import pandas
import pandas # type: ignore
except ImportError: # pragma: NO COVER
pandas = None

try:
import pyarrow
import pyarrow.parquet
import pyarrow # type: ignore
import pyarrow.parquet # type: ignore
except ImportError: # pragma: NO COVER
pyarrow = None

Expand Down Expand Up @@ -350,6 +350,7 @@ def augment_schema(dataframe, current_bq_schema):
Returns:
Optional[Sequence[google.cloud.bigquery.schema.SchemaField]]
"""
# pytype: disable=attribute-error
augmented_schema = []
unknown_type_fields = []

Expand Down Expand Up @@ -383,6 +384,7 @@ def augment_schema(dataframe, current_bq_schema):
return None

return augmented_schema
# pytype: enable=attribute-error


def dataframe_to_arrow(dataframe, bq_schema):
Expand Down Expand Up @@ -600,7 +602,7 @@ def _download_table_bqstorage(

# Passing a BQ Storage client in implies that the BigQuery Storage library
# is available and can be imported.
from google.cloud import bigquery_storage
from google.cloud import bigquery_storage # type: ignore

if "$" in table.table_id:
raise ValueError(
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/bigquery/_tqdm_helpers.py
Expand Up @@ -19,7 +19,7 @@
import warnings

try:
import tqdm
import tqdm # type: ignore
except ImportError: # pragma: NO COVER
tqdm = None

Expand Down