8000 fix: make **kwarg passing consistent · googleapis/python-automl@21c3d1c · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Dec 31, 2023. It is now read-only.

Commit 21c3d1c

Browse files
committed
fix: make **kwarg passing consistent
1 parent f63454d commit 21c3d1c

File tree

2 files changed

+101
-37
lines changed

2 files changed

+101
-37
lines changed

UPGRADING.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,56 @@ project_location = f"projects/{project_id}/locations/us-central1"
165165
response = client.list_datasets(parent=project_location, filter="")
166166
```
167167

168+
### Changes to v1beta1 Tables Client
169+
170+
Optional arguments are now keyword-only arguments and *must* be passed by name.
171+
See [PEP 3102](https://www.python.org/dev/peps/pep-3102/).
172+
173+
***Before**
174+
```py
175+
def predict(
176+
self,
177+
inputs,
178+
model=None,
179+
model_name=None,
180+
model_display_name=None,
181+
feature_importance=False,
182+
project=None,
183+
region=None,
184+
**kwargs
185+
):
186+
```
187+
188+
**After**
189+
```py
190+
def predict(
191+
self,
192+
inputs,
193+
*,
194+
model=None,
195+
model_name=None,
196+
model_display_name=None,
197+
feature_importance=False,
198+
project=None,
199+
region=None,
200+
**kwargs,
201+
):
202+
```
203+
204+
**kwargs passed to methods must be either (1) kwargs on the underlying method (`retry`, `timeout`, or `metadata`) or (2) attributes of the request object.
205+
206+
The following call is valid because `filter` is an attribute of `automl_v1beta1.ListDatasetsRequest`.
207+
208+
```py
209+
from google.cloud import automl_v1beta1 as automl
210+
211+
client = automl.TablesClient(project=project_id, region=compute_region)
212+
213+
# List all the datasets available in the region by applying filter.
214+
response = client.list_datasets(filter=filter)
215+
```
216+
217+
168218

169219
## Enums and types
170220

0 commit comments

Comments
 (0)
0