Change snippits.py to need less altering when copy and pasted
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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.
- Ngôn ngữ chính
- Jupyter Notebook
- Star
- 8.1k
- Fork
- 6.7k
- Merge trung bình
- 4 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 8
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của GoogleCloudPlatform/python-docs-samples
-
samples
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
GoogleCloudPlatform/python-docs-samples#14609 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
samples
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
GoogleCloudPlatform/python-docs-samples#14610 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
samples
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
GoogleCloudPlatform/python-docs-samples#14611 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
chore(generative_ai) Update model references for generative_ai samplesCó thể làm lại được @XrossFox đã nhận 152 ngày trước và không có pull request nào đang mở. Đang mởsamples
GoogleCloudPlatform/python-docs-samples#14117 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Fix Pipeline dependency issues for geospatial-classification/serving_appCó thể làm lại được @XrossFox đã nhận 164 ngày trước và không có pull request nào đang mở. Đang mởsamples
GoogleCloudPlatform/python-docs-samples#14091 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày