Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

feat: add type hint for public methods - #445

Closed
HemangChothani wants to merge 5 commits into
googleapis:masterfrom
MaxxleLLC:bigquery_issue_157
Closed

feat: add type hint for public methods#445
HemangChothani wants to merge 5 commits into
googleapis:masterfrom
MaxxleLLC:bigquery_issue_157

Conversation

@HemangChothani

Copy link
Copy Markdown
Contributor

Fixes#157

@HemangChothani
HemangChothani requested review from a team and tswastDecember 22, 2020 08:02
@google-clagoogle-claBot added the cla: yes This human has signed the Contributor License Agreement. label Dec 22, 2020
@product-auto-labelproduct-auto-labelBot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Dec 22, 2020
Comment threadsetup.cfg
google/cloud/bigquery_v2/
output = .pytype/
# Workaround for https://github.com/google/pytype/issues/150
disable = pyi-error No newline at end of file

@HemangChothaniHemangChothaniDec 22, 2020

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is synthtool generated so changes are not allowed here, but for the reference and pass current tests changed the current file.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

google/pytype#150 is marked as closed. Can you provide a little more context as to why this is needed?

@HemangChothani
HemangChothani requested a review from a team as a code ownerDecember 22, 2020 10:23
@HemangChothani
HemangChothani requested review from busunkim96 and removed request for a teamDecember 22, 2020 10:23
@HemangChothaniHemangChothani added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 22, 2020
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 22, 2020
Comment threadgoogle/cloud/bigquery/client.py Outdated
Comment threadgoogle/cloud/bigquery/client.py Outdated

@tswasttswast left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, thanks! A few questions.

from google.cloud.bigquery.table import TableReference
from google.cloud.bigquery.table import RowIterator

# Types needed only for Type Hints

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any reason to keep these in a separate location from the other imports. Let's put them in their respective groups.

max_creation_time=None,
):
project: str = None,
parent_job: Union[_AsyncJob, str] = None,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parent_job is only relevant for queries, so I think we can put QueryJob here and avoid the use of a private type.

table: Union[Table, TableReference, str],
rows: Union[Sequence[Tuple], Sequence[Dict]],
selected_fields: Sequence[SchemaField] = None,
**kwargs: dict,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why dict here and Dict below?

permissions: Sequence[str],
retry: retries.Retry = DEFAULT_RETRY,
timeout: float = None,
):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the system tests, I believe the output for this method id Dict

self.assertEqual(set(response["permissions"]), set(permissions))

@plamut

Copy link
Copy Markdown
Contributor

Bump, just checking the status of this?

Generally speaking, though, type hints would be welcome, even though static type checks have not been added to Kokoro (yet).

@plamutplamut mentioned this pull request Apr 15, 2021
4 tasks
@plamut

plamut commented Apr 15, 2021

Copy link
Copy Markdown
Contributor

Superseded by #613.

(will also address the comments there)

@plamutplamut closed this Apr 15, 2021
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: bigqueryIssues related to the googleapis/python-bigquery API.cla: yesThis human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add type hints to methods

4 participants

@HemangChothani@plamut@tswast@yoshi-kokoro