GeezerVison is showing github.com — fix: annotate optional integer parameters with optional type (#1487) · kiraksi/python-bigquery@a190aaa
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: google/cloud/bigquery/_http.py -12Lines changed: 0 additions & 12 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 14 | 14 |
| 15 | 15 | """Create / interact with Google BigQuery connections.""" | 16 | 16 |
| 17 | | -import os | 18 | | -import pkg_resources | 19 | | - | 20 | 17 | from google.cloud import _http # type: ignore # pytype: disable=import-error | 21 | 18 | from google.cloud.bigquery import __version__ | 22 | 19 |
| 23 | 20 |
| 24 | | -# TODO: Increase the minimum version of google-cloud-core to 1.6.0 | 25 | | -# and remove this logic. See: | 26 | | -# https://github.com/googleapis/python-bigquery/issues/509 | 27 | | -if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE") == "true": # pragma: NO COVER | 28 | | - release = pkg_resources.get_distribution("google-cloud-core").parsed_version | 29 | | - if release < pkg_resources.parse_version("1.6.0"): | 30 | | - raise ImportError("google-cloud-core >= 1.6.0 is required to use mTLS feature") | 31 | | - | 32 | | - | 33 | 21 | class Connection(_http.JSONConnection): | 34 | 22 | """A connection to Google BigQuery via the JSON REST API. | 35 | 23 |
| |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/bigquery/client.py +21-21Lines changed: 21 additions & 21 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -329,11 +329,11 @@ def get_service_account_email( | 329 | 329 |
| 330 | 330 | def list_projects( | 331 | 331 | self, | 332 | | - max_results: int = None, | | 332 | + max_results: Optional[int] = None, | 333 | 333 | page_token: str = None, | 334 | 334 | retry: retries.Retry = DEFAULT_RETRY, | 335 | 335 | timeout: TimeoutType = DEFAULT_TIMEOUT, | 336 | | - page_size: int = None, | | 336 | + page_size: Optional[int] = None, | 337 | 337 | ) -> page_iterator.Iterator: | 338 | 338 | """List projects for the project associated with this client. | 339 | 339 |
| @@ -395,11 +395,11 @@ def list_datasets( | 395 | 395 | project: str = None, | 396 | 396 | include_all: bool = False, | 397 | 397 | filter: str = None, | 398 | | - max_results: int = None, | | 398 | + max_results: Optional[int] = None, | 399 | 399 | page_token: str = None, | 400 | 400 | retry: retries.Retry = DEFAULT_RETRY, | 401 | 401 | timeout: TimeoutType = DEFAULT_TIMEOUT, | 402 | | - page_size: int = None, | | 402 | + page_size: Optional[int] = None, | 403 | 403 | ) -> page_iterator.Iterator: | 404 | 404 | """List datasets for the project associated with this client. | 405 | 405 |
| @@ -1324,11 +1324,11 @@ def update_table( | 1324 | 1324 | def list_models( | 1325 | 1325 | self, | 1326 | 1326 | dataset: Union[Dataset, DatasetReference, DatasetListItem, str], | 1327 | | - max_results: int = None, | | 1327 | + max_results: Optional[int] = None, | 1328 | 1328 | page_token: str = None, | 1329 | 1329 | retry: retries.Retry = DEFAULT_RETRY, | 1330 | 1330 | timeout: TimeoutType = DEFAULT_TIMEOUT, | 1331 | | - page_size: int = None, | | 1331 | + page_size: Optional[int] = None, | 1332 | 1332 | ) -> page_iterator.Iterator: | 1333 | 1333 | """[Beta] List models in the dataset. | 1334 | 1334 |
| @@ -1401,11 +1401,11 @@ def api_request(*args, **kwargs): | 1401 | 1401 | def list_routines( | 1402 | 1402 | self, | 1403 | 1403 | dataset: Union[Dataset, DatasetReference, DatasetListItem, str], | 1404 | | - max_results: int = None, | | 1404 | + max_results: Optional[int] = None, | 1405 | 1405 | page_token: str = None, | 1406 | 1406 | retry: retries.Retry = DEFAULT_RETRY, | 1407 | 1407 | timeout: TimeoutType = DEFAULT_TIMEOUT, | 1408 | | - page_size: int = None, | | 1408 | + page_size: Optional[int] = None, | 1409 | 1409 | ) -> page_iterator.Iterator: | 1410 | 1410 | """[Beta] List routines in the dataset. | 1411 | 1411 |
| @@ -1478,11 +1478,11 @@ def api_request(*args, **kwargs): | 1478 | 1478 | def list_tables( | 1479 | 1479 | self, | 1480 | 1480 | dataset: Union[Dataset, DatasetReference, DatasetListItem, str], | 1481 | | - max_results: int = None, | | 1481 | + max_results: Optional[int] = None, | 1482 | 1482 | page_token: str = None, | 1483 | 1483 | retry: retries.Retry = DEFAULT_RETRY, | 1484 | 1484 | timeout: TimeoutType = DEFAULT_TIMEOUT, | 1485 | | - page_size: int = None, | | 1485 | + page_size: Optional[int] = None, | 1486 | 1486 | ) -> page_iterator.Iterator: | 1487 | 1487 | """List tables in the dataset. | 1488 | 1488 |
| @@ -1838,7 +1838,7 @@ def _get_query_results( | 1838 | 1838 | job_id: str, | 1839 | 1839 | retry: retries.Retry, | 1840 | 1840 | project: str = None, | 1841 | | - timeout_ms: int = None, | | 1841 | + timeout_ms: Optional[int] = None, | 1842 | 1842 | location: str = None, | 1843 | 1843 | timeout: TimeoutType = DEFAULT_TIMEOUT, | 1844 | 1844 | ) -> _QueryResults: | @@ -2163,15 +2163,15 @@ def list_jobs( | 2163 | 2163 | self, | 2164 | 2164 | project: str = None, | 2165 | 2165 | parent_job: Optional[Union[QueryJob, str]] = None, | 2166 | | - max_results: int = None, | | 2166 | + max_results: Optional[int] = None, | 2167 | 2167 | page_token: str = None, | 2168 | 2168 | all_users: bool = None, | 2169 | 2169 | state_filter: str = None, | 2170 | 2170 | retry: retries.Retry = DEFAULT_RETRY, | 2171 | 2171 | timeout: TimeoutType = DEFAULT_TIMEOUT, | 2172 | 2172 | min_creation_time: datetime.datetime = None, | 2173 | 2173 | max_creation_time: datetime.datetime = None, | 2174 | | - page_size: int = None, | | 2174 | + page_size: Optional[int] = None, | 2175 | 2175 | ) -> page_iterator.Iterator: | 2176 | 2176 | """List jobs for the project associated with this client. | 2177 | 2177 |
| @@ -2361,7 +2361,7 @@ def load_table_from_file( | 2361 | 2361 | file_obj: IO[bytes], | 2362 | 2362 | destination: Union[Table, TableReference, TableListItem, str], | 2363 | 2363 | rewind: bool = False, | 2364 | | - size: int = None, | | 2364 | + size: Optional[int] = None, | 2365 | 2365 | num_retries: int = _DEFAULT_NUM_RETRIES, | 2366 | 2366 | job_id: str = None, | 2367 | 2367 | job_id_prefix: str = None, | @@ -3729,10 +3729,10 @@ def list_rows( | 3729 | 3729 | self, | 3730 | 3730 | table: Union[Table, TableListItem, TableReference, str], | 3731 | 3731 | selected_fields: Sequence[SchemaField] = None, | 3732 | | - max_results: int = None, | | 3732 | + max_results: Optional[int] = None, | 3733 | 3733 | page_token: str = None, | 3734 | | - start_index: int = None, | 3735 | | - page_size: int = None, | | 3734 | + start_index: Optional[int] = None, | | 3735 | + page_size: Optional[int] = None, | 3736 | 3736 | retry: retries.Retry = DEFAULT_RETRY, | 3737 | 3737 | timeout: TimeoutType = DEFAULT_TIMEOUT, | 3738 | 3738 | ) -> RowIterator: | @@ -3840,11 +3840,11 @@ def _list_rows_from_query_results( | 3840 | 3840 | location: str, | 3841 | 3841 | project: str, | 3842 | 3842 | schema: SchemaField, | 3843 | | - total_rows: int = None, | | 3843 | + total_rows: Optional[int] = None, | 3844 | 3844 | destination: Union[Table, TableReference, TableListItem, str] = None, | 3845 | | - max_results: int = None, | 3846 | | - start_index: int = None, | 3847 | | - page_size: int = None, | | 3845 | + max_results: Optional[int] = None, | | 3846 | + start_index: Optional[int] = None, | | 3847 | + page_size: Optional[int] = None, | 3848 | 3848 | retry: retries.Retry = DEFAULT_RETRY, | 3849 | 3849 | timeout: TimeoutType = DEFAULT_TIMEOUT, | 3850 | 3850 | ) -> RowIterator: | |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/bigquery/job/query.py +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1381,11 +1381,11 @@ def _done_or_raise(self, retry=DEFAULT_RETRY, timeout=None): | 1381 | 1381 |
| 1382 | 1382 | def result( # type: ignore # (complaints about the overloaded signature) | 1383 | 1383 | self, | 1384 | | - page_size: int = None, | 1385 | | - max_results: int = None, | | 1384 | + page_size: Optional[int] = None, | | 1385 | + max_results: Optional[int] = None, | 1386 | 1386 | retry: "retries.Retry" = DEFAULT_RETRY, | 1387 | 1387 | timeout: float = None, | 1388 | | - start_index: int = None, | | 1388 | + start_index: Optional[int] = None, | 1389 | 1389 | job_retry: "retries.Retry" = DEFAULT_JOB_RETRY, | 1390 | 1390 | ) -> Union["RowIterator", _EmptyRowIterator]: | 1391 | 1391 | """Start the job and wait for it to complete and get the result. | |
Collapse file Copy file name to clipboardExpand all lines: setup.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 39 | 39 | # NOTE: Maintainers, please do not require google-cloud-core>=2.x.x | 40 | 40 | # Until this issue is closed | 41 | 41 | # https://github.com/googleapis/google-cloud-python/issues/10566 | 42 | | - "google-cloud-core >= 1.4.1, <3.0.0dev", | | 42 | + "google-cloud-core >= 1.6.0, <3.0.0dev", | 43 | 43 | "google-resumable-media >= 0.6.0, < 3.0dev", | 44 | 44 | "packaging >= 20.0.0", | 45 | 45 | "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", # For the legacy proto-based types. | |
Collapse file Copy file name to clipboardExpand all lines: testing/constraints-3.7.txt +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -9,7 +9,7 @@ db-dtypes==0.3.0 | 9 | 9 | geopandas==0.9.0 | 10 | 10 | google-api-core==1.31.5 | 11 | 11 | google-cloud-bigquery-storage==2.0.0 | 12 | | -google-cloud-core==1.4.1 | | 12 | +google-cloud-core==1.6.0 | 13 | 13 | google-resumable-media==0.6.0 | 14 | 14 | grpcio==1.47.0 | 15 | 15 | ipywidgets==7.7.1 | |
|