Skip to content

Commit

Permalink
Remove None from param types and add (Optional).
Browse files Browse the repository at this point in the history
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:
#2580 (review)
  • Loading branch information
tswast committed Oct 21, 2016
1 parent 993adbf commit bc96107
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ def _build_dataframe(time_series_iterable,
:param time_series_iterable:
An iterable (e.g., a query object) yielding time series.
:type label: str or None
:type label: str
:param label:
The label name to use for the dataframe header. This can be the name
(Optional) The label name to use for the dataframe header. This can be the name
of a resource label or metric label (e.g., ``"instance_name"``), or
the string ``"resource_type"``.
Expand Down
32 changes: 16 additions & 16 deletions packages/google-cloud-monitoring/google/cloud/monitoring/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ def query(self,
demonstration purposes and is subject to change. See the
`supported metrics`_.
:type end_time: :class:`datetime.datetime` or None
:param end_time: The end time (inclusive) of the time interval
:type end_time: :class:`datetime.datetime`
:param end_time: (Optional) The end time (inclusive) of the time interval
for which results should be returned, as a datetime object.
The default is the start of the current minute.
Expand Down Expand Up @@ -362,13 +362,13 @@ def list_metric_descriptors(self, filter_string=None, type_prefix=None):
... type_prefix='custom.'):
... print(descriptor.type)
:type filter_string: str or None
:type filter_string: str
:param filter_string:
An optional filter expression describing the metric descriptors
(Optional) An optional filter expression describing the metric descriptors
to be returned. See the `filter documentation`_.
:type type_prefix: str or None
:param type_prefix: An optional prefix constraining the selected
:type type_prefix: str
:param type_prefix: (Optional) An optional prefix constraining the selected
metric types. This adds ``metric.type = starts_with("<prefix>")``
to the filter.
Expand Down Expand Up @@ -408,9 +408,9 @@ def list_resource_descriptors(self, filter_string=None):
>>> for descriptor in client.list_resource_descriptors():
... print(descriptor.type)
:type filter_string: str or None
:type filter_string: str
:param filter_string:
An optional filter expression describing the resource descriptors
(Optional) An optional filter expression describing the resource descriptors
to be returned. See the `filter documentation`_.
:rtype: list of
Expand All @@ -430,21 +430,21 @@ def group(self, group_id=None, display_name=None, parent_id=None,
This will not make an HTTP request; it simply instantiates
a group object owned by this client.
:type group_id: str or None
:param group_id: The ID of the group.
:type group_id: str
:param group_id: (Optional) The ID of the group.
:type display_name: str or None
:type display_name: str
:param display_name:
A user-assigned name for this group, used only for display
(Optional) A user-assigned name for this group, used only for display
purposes.
:type parent_id: str or None
:type parent_id: str
:param parent_id:
The ID of the group's parent, if it has one.
(Optional) The ID of the group's parent, if it has one.
:type filter_string: str or None
:type filter_string: str
:param filter_string:
The filter string used to determine which monitored resources
(Optional) The filter string used to determine which monitored resources
belong to this group.
:type is_cluster: bool
Expand Down
44 changes: 22 additions & 22 deletions packages/google-cloud-monitoring/google/cloud/monitoring/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def _group_id_from_name(path, project=None):
:type path: str
:param path: URI path for a group API request.
:type project: str or None
:param project: The project associated with the request. It is
:type project: str
:param project: (Optional) The project associated with the request. It is
included for validation purposes.
:rtype: str
Expand Down Expand Up @@ -76,20 +76,20 @@ class Group(object):
:type client: :class:`google.cloud.monitoring.client.Client`
:param client: A client for operating on the metric descriptor.
:type group_id: str or None
:param group_id: The ID of the group.
:type group_id: str
:param group_id: (Optional) The ID of the group.
:type display_name: str or None
:type display_name: str
:param display_name:
A user-assigned name for this group, used only for display purposes.
(Optional) A user-assigned name for this group, used only for display purposes.
:type parent_id: str or None
:type parent_id: str
:param parent_id:
The ID of the group's parent, if it has one.
(Optional) The ID of the group's parent, if it has one.
:type filter_string: str or None
:type filter_string: str
:param filter_string:
The filter string used to determine which monitored resources belong to
(Optional) The filter string used to determine which monitored resources belong to
this group.
:type is_cluster: bool
Expand Down Expand Up @@ -296,21 +296,21 @@ def list_members(self, filter_string=None, end_time=None, start_time=None):
... print(member)
:type filter_string: str or None
:type filter_string: str
:param filter_string:
An optional list filter describing the members to be returned. The
(Optional) An optional list filter describing the members to be returned. The
filter may reference the type, labels, and metadata of monitored
resources that comprise the group. See the `filter documentation`_.
:type end_time: :class:`datetime.datetime` or None
:type end_time: :class:`datetime.datetime`
:param end_time:
The end time (inclusive) of the time interval for which results
(Optional) The end time (inclusive) of the time interval for which results
should be returned, as a datetime object. If ``start_time`` is
specified, then this must also be specified.
:type start_time: :class:`datetime.datetime` or None
:type start_time: :class:`datetime.datetime`
:param start_time:
The start time (exclusive) of the time interval for which results
(Optional) The start time (exclusive) of the time interval for which results
should be returned, as a datetime object.
:rtype: list of :class:`~google.cloud.monitoring.resource.Resource`
Expand Down Expand Up @@ -386,19 +386,19 @@ def _list(cls, client, children_of_group=None, ancestors_of_group=None,
:type client: :class:`google.cloud.monitoring.client.Client`
:param client: The client to use.
:type children_of_group: str or None
:type children_of_group: str
:param children_of_group:
Returns groups whose parent_name field contains the group name. If
(Optional) Returns groups whose parent_name field contains the group name. If
no groups have this parent, the results are empty.
:type ancestors_of_group: str or None
:type ancestors_of_group: str
:param ancestors_of_group:
Returns groups that are ancestors of the specified group. If the
(Optional) Returns groups that are ancestors of the specified group. If the
specified group has no immediate parent, the results are empty.
:type descendants_of_group: str or None
:type descendants_of_group: str
:param descendants_of_group:
Returns the descendants of the specified group. This is a superset
(Optional) Returns the descendants of the specified group. This is a superset
of the results returned by the children_of_group filter, and
includes children-of-children, and so forth.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ class MetricDescriptor(object):
:type display_name: str
:param display_name: An optional concise name for the metric.
:type name: str or None
:type name: str
:param name:
The "resource name" of the metric descriptor. For example:
(Optional) The "resource name" of the metric descriptor. For example:
``"projects/<project_id>/metricDescriptors/<type>"``. As
retrieved from the service, this will always be specified.
You can and should omit it when constructing an instance for
Expand Down Expand Up @@ -198,13 +198,13 @@ def _list(cls, client, filter_string=None, type_prefix=None):
:type client: :class:`google.cloud.monitoring.client.Client`
:param client: The client to use.
:type filter_string: str or None
:type filter_string: str
:param filter_string:
An optional filter expression describing the metric descriptors
(Optional) An optional filter expression describing the metric descriptors
to be returned. See the `filter documentation`_.
:type type_prefix: str or None
:param type_prefix: An optional prefix constraining the selected
:type type_prefix: str
:param type_prefix: (Optional) An optional prefix constraining the selected
metric types. This adds ``metric.type = starts_with("<prefix>")``
to the filter.
Expand Down
24 changes: 12 additions & 12 deletions packages/google-cloud-monitoring/google/cloud/monitoring/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ class Query(object):
demonstration purposes and is subject to change. See the
`supported metrics`_.
:type end_time: :class:`datetime.datetime` or None
:param end_time: The end time (inclusive) of the time interval
:type end_time: :class:`datetime.datetime`
:param end_time: (Optional) The end time (inclusive) of the time interval
for which results should be returned, as a datetime object.
The default is the start of the current minute.
Expand Down Expand Up @@ -179,8 +179,8 @@ def select_interval(self, end_time, start_time=None):
:param end_time: The end time (inclusive) of the time interval
for which results should be returned, as a datetime object.
:type start_time: :class:`datetime.datetime` or None
:param start_time: The start time (exclusive) of the time interval
:type start_time: :class:`datetime.datetime`
:param start_time: (Optional) The start time (exclusive) of the time interval
for which results should be returned, as a datetime object.
If not specified, the interval is a point in time.
Expand Down Expand Up @@ -446,9 +446,9 @@ def iter(self, headers_only=False, page_size=None):
:param headers_only:
Whether to omit the point data from the time series objects.
:type page_size: int or None
:type page_size: int
:param page_size:
An optional positive number specifying the maximum number of
(Optional) An optional positive number specifying the maximum number of
points to return per page. This can be used to control how far
the iterator reads ahead.
Expand Down Expand Up @@ -510,11 +510,11 @@ def _build_query_params(self, headers_only=False,
Whether to omit the point data from the
:class:`~google.cloud.monitoring.timeseries.TimeSeries` objects.
:type page_size: int or None
:param page_size: A limit on the number of points to return per page.
:type page_size: int
:param page_size: (Optional) A limit on the number of points to return per page.
:type page_token: str or None
:param page_token: A token to continue the retrieval.
:type page_token: str
:param page_token: (Optional) A token to continue the retrieval.
"""
yield 'filter', self.filter

Expand Down Expand Up @@ -575,8 +575,8 @@ def as_dataframe(self, label=None, labels=None):
dataframe = query.as_dataframe(
labels=['resource_type', 'instance_id'])
:type label: str or None
:param label: The label name to use for the dataframe header.
:type label: str
:param label: (Optional) The label name to use for the dataframe header.
This can be the name of a resource label or metric label
(e.g., ``"instance_name"``), or the string ``"resource_type"``.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ def _list(cls, client, filter_string=None):
:type client: :class:`google.cloud.monitoring.client.Client`
:param client: The client to use.
:type filter_string: str or None
:type filter_string: str
:param filter_string:
An optional filter expression describing the resource descriptors
(Optional) An optional filter expression describing the resource descriptors
to be returned. See the `filter documentation`_.
:rtype: list of :class:`ResourceDescriptor`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ class Point(collections.namedtuple('Point', 'end_time start_time value')):
:type end_time: str
:param end_time: The end time in RFC3339 UTC "Zulu" format.
:type start_time: str or None
:param start_time: An optional start time in RFC3339 UTC "Zulu" format.
:type start_time: str
:param start_time: (Optional) An optional start time in RFC3339 UTC "Zulu" format.
:type value: object
:param value: The metric value. This can be a scalar or a distribution.
Expand Down

0 comments on commit bc96107

Please sign in to comment.