Skip to content

Commit dc54c99

Browse files
committed
Updates with two usage examples
1 parent 07910c5 commit dc54c99

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

scripts/microgenerator/templates/_helpers.py.j2

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,31 @@ def _create_request(
1919

2020
Returns:
2121
An instantiated request object.
22+
23+
Examples:
24+
>>> # Example with project_id provided in path_identifier
25+
>>> request = _create_request(
26+
... request_class=GetDatasetRequest,
27+
... path_identifier="my-project.my-dataset",
28+
... expected_args=["project_id", "dataset_id"]
29+
... )
30+
>>> request.project_id
31+
'my-project'
32+
>>> request.dataset_id
33+
'my-dataset'
34+
35+
>>> # Example with project_id omitted from path_identifier, using default_project_id
36+
>>> request = _create_request(
37+
... request_class=GetDatasetRequest,
38+
... path_identifier="my-dataset",
39+
... expected_args=["project_id", "dataset_id"],
40+
... default_project_id="my-default-project"
41+
... )
42+
>>> request.project_id
43+
'my-default-project'
44+
>>> request.dataset_id
45+
'my-dataset'
46+
2247
"""
2348
# Start of inlined parse_path_to_request_inputs
2449
segments = path_identifier.split(".")

0 commit comments

Comments
 (0)