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

Commit 1612d13

Browse files
committed
Remove None from param types and add (Optional).
This runs a script to remove None from the types for parameters, and added (Optional) to the description. Does not pass lint due to some too-long lines. I will clean those up manually. See: googleapis/google-cloud-python#2580 (review)
1 parent 9984543 commit 1612d13

File tree

7 files changed

+62
-62
lines changed

7 files changed

+62
-62
lines changed

google/cloud/monitoring/_dataframe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ def _build_dataframe(time_series_iterable,
3434
:param time_series_iterable:
3535
An iterable (e.g., a query object) yielding time series.
3636
37-
:type label: str or None
37+
:type label: str
3838
:param label:
39-
The label name to use for the dataframe header. This can be the name
39+
(Optional) The label name to use for the dataframe header. This can be the name
4040
of a resource label or metric label (e.g., ``"instance_name"``), or
4141
the string ``"resource_type"``.
4242

google/cloud/monitoring/client.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ def query(self,
8888
demonstration purposes and is subject to change. See the
8989
`supported metrics`_.
9090
91-
:type end_time: :class:`datetime.datetime` or None
92-
:param end_time: The end time (inclusive) of the time interval
91+
:type end_time: :class:`datetime.datetime`
92+
:param end_time: (Optional) The end time (inclusive) of the time interval
9393
for which results should be returned, as a datetime object.
9494
The default is the start of the current minute.
9595
@@ -362,13 +362,13 @@ def list_metric_descriptors(self, filter_string=None, type_prefix=None):
362362
... type_prefix='custom.'):
363363
... print(descriptor.type)
364364
365-
:type filter_string: str or None
365+
:type filter_string: str
366366
:param filter_string:
367-
An optional filter expression describing the metric descriptors
367+
(Optional) An optional filter expression describing the metric descriptors
368368
to be returned. See the `filter documentation`_.
369369
370-
:type type_prefix: str or None
371-
:param type_prefix: An optional prefix constraining the selected
370+
:type type_prefix: str
371+
:param type_prefix: (Optional) An optional prefix constraining the selected
372372
metric types. This adds ``metric.type = starts_with("<prefix>")``
373373
to the filter.
374374
@@ -408,9 +408,9 @@ def list_resource_descriptors(self, filter_string=None):
408408
>>> for descriptor in client.list_resource_descriptors():
409409
... print(descriptor.type)
410410
411-
:type filter_string: str or None
411+
:type filter_string: str
412412
:param filter_string:
413-
An optional filter expression describing the resource descriptors
413+
(Optional) An optional filter expression describing the resource descriptors
414414
to be returned. See the `filter documentation`_.
415415
416416
:rtype: list of
@@ -430,21 +430,21 @@ def group(self, group_id=None, display_name=None, parent_id=None,
430430
This will not make an HTTP request; it simply instantiates
431431
a group object owned by this client.
432432
433-
:type group_id: str or None
434-
:param group_id: The ID of the group.
433+
:type group_id: str
434+
:param group_id: (Optional) The ID of the group.
435435
436-
:type display_name: str or None
436+
:type display_name: str
437437
:param display_name:
438-
A user-assigned name for this group, used only for display
438+
(Optional) A user-assigned name for this group, used only for display
439439
purposes.
440440
441-
:type parent_id: str or None
441+
:type parent_id: str
442442
:param parent_id:
443-
The ID of the group's parent, if it has one.
443+
(Optional) The ID of the group's parent, if it has one.
444444
445-
:type filter_string: str or None
445+
:type filter_string: str
446446
:param filter_string:
447-
The filter string used to determine which monitored resources
447+
(Optional) The filter string used to determine which monitored resources
448448
belong to this group.
449449
450450
:type is_cluster: bool

google/cloud/monitoring/group.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ def _group_id_from_name(path, project=None):
4141
:type path: str
4242
:param path: URI path for a group API request.
4343
44-
:type project: str or None
45-
:param project: The project associated with the request. It is
44+
:type project: str
45+
:param project: (Optional) The project associated with the request. It is
4646
included for validation purposes.
4747
4848
:rtype: str
@@ -76,20 +76,20 @@ class Group(object):
7676
:type client: :class:`google.cloud.monitoring.client.Client`
7777
:param client: A client for operating on the metric descriptor.
7878
79-
:type group_id: str or None
80-
:param group_id: The ID of the group.
79+
:type group_id: str
80+
:param group_id: (Optional) The ID of the group.
8181
82-
:type display_name: str or None
82+
:type display_name: str
8383
:param display_name:
84-
A user-assigned name for this group, used only for display purposes.
84+
(Optional) A user-assigned name for this group, used only for display purposes.
8585
86-
:type parent_id: str or None
86+
:type parent_id: str
8787
:param parent_id:
88-
The ID of the group's parent, if it has one.
88+
(Optional) The ID of the group's parent, if it has one.
8989
90-
:type filter_string: str or None
90+
:type filter_string: str
9191
:param filter_string:
92-
The filter string used to determine which monitored resources belong to
92+
(Optional) The filter string used to determine which monitored resources belong to
9393
this group.
9494
9595
:type is_cluster: bool
@@ -296,21 +296,21 @@ def list_members(self, filter_string=None, end_time=None, start_time=None):
296296
... print(member)
297297
298298
299-
:type filter_string: str or None
299+
:type filter_string: str
300300
:param filter_string:
301-
An optional list filter describing the members to be returned. The
301+
(Optional) An optional list filter describing the members to be returned. The
302302
filter may reference the type, labels, and metadata of monitored
303303
resources that comprise the group. See the `filter documentation`_.
304304
305-
:type end_time: :class:`datetime.datetime` or None
305+
:type end_time: :class:`datetime.datetime`
306306
:param end_time:
307-
The end time (inclusive) of the time interval for which results
307+
(Optional) The end time (inclusive) of the time interval for which results
308308
should be returned, as a datetime object. If ``start_time`` is
309309
specified, then this must also be specified.
310310
311-
:type start_time: :class:`datetime.datetime` or None
311+
:type start_time: :class:`datetime.datetime`
312312
:param start_time:
313-
The start time (exclusive) of the time interval for which results
313+
(Optional) The start time (exclusive) of the time interval for which results
314314
should be returned, as a datetime object.
315315
316316
:rtype: list of :class:`~google.cloud.monitoring.resource.Resource`
@@ -386,19 +386,19 @@ def _list(cls, client, children_of_group=None, ancestors_of_group=None,
386386
:type client: :class:`google.cloud.monitoring.client.Client`
387387
:param client: The client to use.
388388
389-
:type children_of_group: str or None
389+
:type children_of_group: str
390390
:param children_of_group:
391-
Returns groups whose parent_name field contains the group name. If
391+
(Optional) Returns groups whose parent_name field contains the group name. If
392392
no groups have this parent, the results are empty.
393393
394-
:type ancestors_of_group: str or None
394+
:type ancestors_of_group: str
395395
:param ancestors_of_group:
396-
Returns groups that are ancestors of the specified group. If the
396+
(Optional) Returns groups that are ancestors of the specified group. If the
397397
specified group has no immediate parent, the results are empty.
398398
399-
:type descendants_of_group: str or None
399+
:type descendants_of_group: str
400400
:param descendants_of_group:
401-
Returns the descendants of the specified group. This is a superset
401+
(Optional) Returns the descendants of the specified group. This is a superset
402402
of the results returned by the children_of_group filter, and
403403
includes children-of-children, and so forth.
404404

google/cloud/monitoring/metric.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ class MetricDescriptor(object):
102102
:type display_name: str
103103
:param display_name: An optional concise name for the metric.
104104
105-
:type name: str or None
105+
:type name: str
106106
:param name:
107-
The "resource name" of the metric descriptor. For example:
107+
(Optional) The "resource name" of the metric descriptor. For example:
108108
``"projects/<project_id>/metricDescriptors/<type>"``. As
109109
retrieved from the service, this will always be specified.
110110
You can and should omit it when constructing an instance for
@@ -198,13 +198,13 @@ def _list(cls, client, filter_string=None, type_prefix=None):
198198
:type client: :class:`google.cloud.monitoring.client.Client`
199199
:param client: The client to use.
200200
201-
:type filter_string: str or None
201+
:type filter_string: str
202202
:param filter_string:
203-
An optional filter expression describing the metric descriptors
203+
(Optional) An optional filter expression describing the metric descriptors
204204
to be returned. See the `filter documentation`_.
205205
206-
:type type_prefix: str or None
207-
:param type_prefix: An optional prefix constraining the selected
206+
:type type_prefix: str
207+
:param type_prefix: (Optional) An optional prefix constraining the selected
208208
metric types. This adds ``metric.type = starts_with("<prefix>")``
209209
to the filter.
210210

google/cloud/monitoring/query.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ class Query(object):
8686
demonstration purposes and is subject to change. See the
8787
`supported metrics`_.
8888
89-
:type end_time: :class:`datetime.datetime` or None
90-
:param end_time: The end time (inclusive) of the time interval
89+
:type end_time: :class:`datetime.datetime`
90+
:param end_time: (Optional) The end time (inclusive) of the time interval
9191
for which results should be returned, as a datetime object.
9292
The default is the start of the current minute.
9393
@@ -179,8 +179,8 @@ def select_interval(self, end_time, start_time=None):
179179
:param end_time: The end time (inclusive) of the time interval
180180
for which results should be returned, as a datetime object.
181181
182-
:type start_time: :class:`datetime.datetime` or None
183-
:param start_time: The start time (exclusive) of the time interval
182+
:type start_time: :class:`datetime.datetime`
183+
:param start_time: (Optional) The start time (exclusive) of the time interval
184184
for which results should be returned, as a datetime object.
185185
If not specified, the interval is a point in time.
186186
@@ -446,9 +446,9 @@ def iter(self, headers_only=False, page_size=None):
446446
:param headers_only:
447447
Whether to omit the point data from the time series objects.
448448
449-
:type page_size: int or None
449+
:type page_size: int
450450
:param page_size:
451-
An optional positive number specifying the maximum number of
451+
(Optional) An optional positive number specifying the maximum number of
452452
points to return per page. This can be used to control how far
453453
the iterator reads ahead.
454454
@@ -510,11 +510,11 @@ def _build_query_params(self, headers_only=False,
510510
Whether to omit the point data from the
511511
:class:`~google.cloud.monitoring.timeseries.TimeSeries` objects.
512512
513-
:type page_size: int or None
514-
:param page_size: A limit on the number of points to return per page.
513+
:type page_size: int
514+
:param page_size: (Optional) A limit on the number of points to return per page.
515515
516-
:type page_token: str or None
517-
:param page_token: A token to continue the retrieval.
516+
:type page_token: str
517+
:param page_token: (Optional) A token to continue the retrieval.
518518
"""
519519
yield 'filter', self.filter
520520

@@ -575,8 +575,8 @@ def as_dataframe(self, label=None, labels=None):
575575
dataframe = query.as_dataframe(
576576
labels=['resource_type', 'instance_id'])
577577
578-
:type label: str or None
579-
:param label: The label name to use for the dataframe header.
578+
:type label: str
579+
:param label: (Optional) The label name to use for the dataframe header.
580580
This can be the name of a resource label or metric label
581581
(e.g., ``"instance_name"``), or the string ``"resource_type"``.
582582

google/cloud/monitoring/resource.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ def _list(cls, client, filter_string=None):
8888
:type client: :class:`google.cloud.monitoring.client.Client`
8989
:param client: The client to use.
9090
91-
:type filter_string: str or None
91+
:type filter_string: str
9292
:param filter_string:
93-
An optional filter expression describing the resource descriptors
93+
(Optional) An optional filter expression describing the resource descriptors
9494
to be returned. See the `filter documentation`_.
9595
9696
:rtype: list of :class:`ResourceDescriptor`

google/cloud/monitoring/timeseries.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ class Point(collections.namedtuple('Point', 'end_time start_time value')):
179179
:type end_time: str
180180
:param end_time: The end time in RFC3339 UTC "Zulu" format.
181181
182-
:type start_time: str or None
183-
:param start_time: An optional start time in RFC3339 UTC "Zulu" format.
182+
:type start_time: str
183+
:param start_time: (Optional) An optional start time in RFC3339 UTC "Zulu" format.
184184
185185
:type value: object
186186
:param value: The metric value. This can be a scalar or a distribution.

0 commit comments

Comments
 (0)