From bc96107e77e2de076818f905f449d01da50110f5 Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Fri, 21 Oct 2016 09:51:22 -0700 Subject: [PATCH] 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: https://github.com/GoogleCloudPlatform/google-cloud-python/pull/2580#pullrequestreview-5178193 --- .../google/cloud/monitoring/_dataframe.py | 4 +- .../google/cloud/monitoring/client.py | 32 +++++++------- .../google/cloud/monitoring/group.py | 44 +++++++++---------- .../google/cloud/monitoring/metric.py | 12 ++--- .../google/cloud/monitoring/query.py | 24 +++++----- .../google/cloud/monitoring/resource.py | 4 +- .../google/cloud/monitoring/timeseries.py | 4 +- 7 files changed, 62 insertions(+), 62 deletions(-) diff --git a/packages/google-cloud-monitoring/google/cloud/monitoring/_dataframe.py b/packages/google-cloud-monitoring/google/cloud/monitoring/_dataframe.py index 5c0d89bb6ddb..606de38039e9 100644 --- a/packages/google-cloud-monitoring/google/cloud/monitoring/_dataframe.py +++ b/packages/google-cloud-monitoring/google/cloud/monitoring/_dataframe.py @@ -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"``. diff --git a/packages/google-cloud-monitoring/google/cloud/monitoring/client.py b/packages/google-cloud-monitoring/google/cloud/monitoring/client.py index 7bc3c31bf7d6..a6958b09a075 100644 --- a/packages/google-cloud-monitoring/google/cloud/monitoring/client.py +++ b/packages/google-cloud-monitoring/google/cloud/monitoring/client.py @@ -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. @@ -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("")`` to the filter. @@ -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 @@ -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 diff --git a/packages/google-cloud-monitoring/google/cloud/monitoring/group.py b/packages/google-cloud-monitoring/google/cloud/monitoring/group.py index 7779585301fa..1fb7bf044b92 100644 --- a/packages/google-cloud-monitoring/google/cloud/monitoring/group.py +++ b/packages/google-cloud-monitoring/google/cloud/monitoring/group.py @@ -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 @@ -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 @@ -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` @@ -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. diff --git a/packages/google-cloud-monitoring/google/cloud/monitoring/metric.py b/packages/google-cloud-monitoring/google/cloud/monitoring/metric.py index f2cb5c7522d0..81cd1bb591d7 100644 --- a/packages/google-cloud-monitoring/google/cloud/monitoring/metric.py +++ b/packages/google-cloud-monitoring/google/cloud/monitoring/metric.py @@ -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//metricDescriptors/"``. As retrieved from the service, this will always be specified. 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): :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("")`` to the filter. diff --git a/packages/google-cloud-monitoring/google/cloud/monitoring/query.py b/packages/google-cloud-monitoring/google/cloud/monitoring/query.py index bac9d92d9e34..3513bf09ea01 100644 --- a/packages/google-cloud-monitoring/google/cloud/monitoring/query.py +++ b/packages/google-cloud-monitoring/google/cloud/monitoring/query.py @@ -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. @@ -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. @@ -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. @@ -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 @@ -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"``. diff --git a/packages/google-cloud-monitoring/google/cloud/monitoring/resource.py b/packages/google-cloud-monitoring/google/cloud/monitoring/resource.py index e951006c1cf5..4156d0f30754 100644 --- a/packages/google-cloud-monitoring/google/cloud/monitoring/resource.py +++ b/packages/google-cloud-monitoring/google/cloud/monitoring/resource.py @@ -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` diff --git a/packages/google-cloud-monitoring/google/cloud/monitoring/timeseries.py b/packages/google-cloud-monitoring/google/cloud/monitoring/timeseries.py index b46e5d830265..de67068ab097 100644 --- a/packages/google-cloud-monitoring/google/cloud/monitoring/timeseries.py +++ b/packages/google-cloud-monitoring/google/cloud/monitoring/timeseries.py @@ -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.