Change snippits.py to need less altering when copy and pasted
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
This issue has not been assessed yet.
Description
Just opened this because in the PR default comment it asked to create an issue before creating a PR.
In short, it would just be nice to have less typing needed when copying a snippet.
def get_monitored_resource_descriptor(
project_id: str, resource_type_name: str
) -> monitored_resource_pb2.MonitoredResourceDescriptor:
"""Prints monitored resource description by type
Args:
project_id: Google Cloud project id
resource_type_name: a monitored resource type
Returns:
An object that describes the monitored resource
"""
# [START monitoring_get_resource]
from google.cloud import monitoring_v3
client = monitoring_v3.MetricServiceClient()
resource_path = (
f"projects/{project_id}/monitoredResourceDescriptors/{resource_type_name}"
)
descriptor = client.get_monitored_resource_descriptor(name=resource_path)
pprint.pprint(descriptor)
# [END monitoring_get_resource]
return descriptor
to
def get_monitored_resource_descriptor(
project_id: str, resource_type_name: str
) -> monitored_resource_pb2.MonitoredResourceDescriptor:
"""Prints monitored resource description by type
Args:
project_id: Google Cloud project id
resource_type_name: a monitored resource type
Returns:
An object that describes the monitored resource
"""
# [START monitoring_get_resource]
import time
from google.cloud import monitoring_v3
project_id = 'MY_PROJECT_ID'
client = monitoring_v3.MetricServiceClient()
resource_path = (
f"projects/{project_id}/monitoredResourceDescriptors/{resource_type_name}"
)
descriptor = client.get_monitored_resource_descriptor(name=resource_path)
pprint.pprint(descriptor)
# [END monitoring_get_resource]
return descriptor
Super minor but wanted to see if anyone else felt the same way.
- Dominant language
- Jupyter Notebook
- Stars
- 8.1k
- Forks
- 6.7k
- Avg merge
- 4d 4h
- Merged PRs (30d)
- 8
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from GoogleCloudPlatform/python-docs-samples
-
samples
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
GoogleCloudPlatform/python-docs-samples#14609 ·
Maintainers usually reply within 1 day
-
samples
Difficulty 1/5 Under an hour Newbie friendliness 92/100
GoogleCloudPlatform/python-docs-samples#14610 ·
Maintainers usually reply within 1 day
-
samples
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
GoogleCloudPlatform/python-docs-samples#14611 ·
Maintainers usually reply within 1 day
-
chore(generative_ai) Update model references for generative_ai samplesMay be free again @XrossFox claimed this 152 days ago, and no pull request is open. Opensamples
GoogleCloudPlatform/python-docs-samples#14117 · 1 assignee ·
Maintainers usually reply within 1 day
-
Fix Pipeline dependency issues for geospatial-classification/serving_appMay be free again @XrossFox claimed this 164 days ago, and no pull request is open. Opensamples
GoogleCloudPlatform/python-docs-samples#14091 · 1 assignee ·
Maintainers usually reply within 1 day