Skip to content

Commit 525975c

Browse files
authored
Merge pull request #2584 from tswast/nonetype-to-optional
Remove None & NoneType from parameter types in docstrings.
2 parents 8ad13b5 + 75990c8 commit 525975c

File tree

3 files changed

+65
-50
lines changed

3 files changed

+65
-50
lines changed

packages/google-cloud-dns/google/cloud/dns/changes.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,10 @@ def delete_record_set(self, record_set):
169169
def _require_client(self, client):
170170
"""Check client or verify over-ride.
171171
172-
:type client: :class:`google.cloud.dns.client.Client` or ``NoneType``
173-
:param client: the client to use. If not passed, falls back to the
174-
``client`` stored on the current zone.
172+
:type client: :class:`google.cloud.dns.client.Client`
173+
:param client:
174+
(Optional) the client to use. If not passed, falls back to the
175+
``client`` stored on the current zone.
175176
176177
:rtype: :class:`google.cloud.dns.client.Client`
177178
:returns: The client passed in or the currently bound client.
@@ -207,9 +208,10 @@ def create(self, client=None):
207208
See:
208209
https://cloud.google.com/dns/api/v1/changes/create
209210
210-
:type client: :class:`google.cloud.dns.client.Client` or ``NoneType``
211-
:param client: the client to use. If not passed, falls back to the
212-
``client`` stored on the current zone.
211+
:type client: :class:`google.cloud.dns.client.Client`
212+
:param client:
213+
(Optional) the client to use. If not passed, falls back to the
214+
``client`` stored on the current zone.
213215
"""
214216
if len(self.additions) == 0 and len(self.deletions) == 0:
215217
raise ValueError("No record sets added or deleted")
@@ -226,9 +228,10 @@ def exists(self, client=None):
226228
See
227229
https://cloud.google.com/dns/api/v1/changes/get
228230
229-
:type client: :class:`google.cloud.dns.client.Client` or ``NoneType``
230-
:param client: the client to use. If not passed, falls back to the
231-
``client`` stored on the current zone.
231+
:type client: :class:`google.cloud.dns.client.Client`
232+
:param client:
233+
(Optional) the client to use. If not passed, falls back to the
234+
``client`` stored on the current zone.
232235
233236
:rtype: bool
234237
:returns: Boolean indicating existence of the changes.
@@ -248,9 +251,10 @@ def reload(self, client=None):
248251
See
249252
https://cloud.google.com/dns/api/v1/changes/get
250253
251-
:type client: :class:`google.cloud.dns.client.Client` or ``NoneType``
252-
:param client: the client to use. If not passed, falls back to the
253-
``client`` stored on the current zone.
254+
:type client: :class:`google.cloud.dns.client.Client`
255+
:param client:
256+
(Optional) the client to use. If not passed, falls back to the
257+
``client`` stored on the current zone.
254258
"""
255259
client = self._require_client(client)
256260

packages/google-cloud-dns/google/cloud/dns/client.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,15 @@ def zone(self, name, dns_name=None, description=None):
9191
:type name: str
9292
:param name: Name of the zone.
9393
94-
:type dns_name: str or :class:`NoneType`
95-
:param dns_name: DNS name of the zone. If not passed, then calls
96-
to :meth:`zone.create` will fail.
97-
98-
:type description: str or :class:`NoneType`
99-
:param description: the description for the zone. If not passed,
100-
defaults to the value of 'dns_name'.
94+
:type dns_name: str
95+
:param dns_name:
96+
(Optional) DNS name of the zone. If not passed, then calls to
97+
:meth:`zone.create` will fail.
98+
99+
:type description: str
100+
:param description:
101+
(Optional) the description for the zone. If not passed, defaults
102+
to the value of 'dns_name'.
101103
102104
:rtype: :class:`google.cloud.dns.zone.ManagedZone`
103105
:returns: a new ``ManagedZone`` instance.

packages/google-cloud-dns/google/cloud/dns/zone.py

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,19 @@ class ManagedZone(object):
3232
:type name: str
3333
:param name: the name of the zone
3434
35-
:type dns_name: str or :class:`NoneType`
36-
:param dns_name: the DNS name of the zone. If not passed, then calls
37-
to :meth:`create` will fail.
35+
:type dns_name: str
36+
:param dns_name:
37+
(Optional) the DNS name of the zone. If not passed, then calls to
38+
:meth:`create` will fail.
3839
3940
:type client: :class:`google.cloud.dns.client.Client`
4041
:param client: A client which holds credentials and project configuration
4142
for the zone (which requires a project).
4243
43-
:type description: str or :class:`NoneType`
44-
:param description: the description for the zone. If not passed, defaults
45-
to the value of 'dns_name'.
44+
:type description: str
45+
:param description:
46+
(Optional) the description for the zone. If not passed, defaults to
47+
the value of 'dns_name'.
4648
"""
4749

4850
def __init__(self, name, dns_name=None, client=None, description=None):
@@ -135,8 +137,8 @@ def description(self):
135137
def description(self, value):
136138
"""Update description of the zone.
137139
138-
:type value: str, or ``NoneType``
139-
:param value: new description
140+
:type value: str
141+
:param value: (Optional) new description
140142
141143
:raises: ValueError for invalid value types.
142144
"""
@@ -162,8 +164,8 @@ def name_server_set(self):
162164
def name_server_set(self, value):
163165
"""Update named set of DNS name servers.
164166
165-
:type value: str, or ``NoneType``
166-
:param value: new title
167+
:type value: str
168+
:param value: (Optional) new title
167169
168170
:raises: ValueError for invalid value types.
169171
"""
@@ -202,9 +204,10 @@ def changes(self):
202204
def _require_client(self, client):
203205
"""Check client or verify over-ride.
204206
205-
:type client: :class:`google.cloud.dns.client.Client` or ``NoneType``
206-
:param client: the client to use. If not passed, falls back to the
207-
``client`` stored on the current zone.
207+
:type client: :class:`google.cloud.dns.client.Client`
208+
:param client:
209+
(Optional) the client to use. If not passed, falls back to the
210+
``client`` stored on the current zone.
208211
209212
:rtype: :class:`google.cloud.dns.client.Client`
210213
:returns: The client passed in or the currently bound client.
@@ -250,9 +253,10 @@ def create(self, client=None):
250253
See:
251254
https://cloud.google.com/dns/api/v1/managedZones/create
252255
253-
:type client: :class:`google.cloud.dns.client.Client` or ``NoneType``
254-
:param client: the client to use. If not passed, falls back to the
255-
``client`` stored on the current zone.
256+
:type client: :class:`google.cloud.dns.client.Client`
257+
:param client:
258+
(Optional) the client to use. If not passed, falls back to the
259+
``client`` stored on the current zone.
256260
"""
257261
client = self._require_client(client)
258262
path = '/projects/%s/managedZones' % (self.project,)
@@ -266,9 +270,10 @@ def exists(self, client=None):
266270
See
267271
https://cloud.google.com/dns/api/v1/managedZones/get
268272
269-
:type client: :class:`google.cloud.dns.client.Client` or ``NoneType``
270-
:param client: the client to use. If not passed, falls back to the
271-
``client`` stored on the current zone.
273+
:type client: :class:`google.cloud.dns.client.Client`
274+
:param client:
275+
(Optional) the client to use. If not passed, falls back to the
276+
``client`` stored on the current zone.
272277
273278
:rtype: bool
274279
:returns: Boolean indicating existence of the managed zone.
@@ -289,9 +294,10 @@ def reload(self, client=None):
289294
See
290295
https://cloud.google.com/dns/api/v1/managedZones/get
291296
292-
:type client: :class:`google.cloud.dns.client.Client` or ``NoneType``
293-
:param client: the client to use. If not passed, falls back to the
294-
``client`` stored on the current zone.
297+
:type client: :class:`google.cloud.dns.client.Client`
298+
:param client:
299+
(Optional) the client to use. If not passed, falls back to the
300+
``client`` stored on the current zone.
295301
"""
296302
client = self._require_client(client)
297303

@@ -305,9 +311,10 @@ def delete(self, client=None):
305311
See:
306312
https://cloud.google.com/dns/api/v1/managedZones/delete
307313
308-
:type client: :class:`google.cloud.dns.client.Client` or ``NoneType``
309-
:param client: the client to use. If not passed, falls back to the
310-
``client`` stored on the current zone.
314+
:type client: :class:`google.cloud.dns.client.Client`
315+
:param client:
316+
(Optional) the client to use. If not passed, falls back to the
317+
``client`` stored on the current zone.
311318
"""
312319
client = self._require_client(client)
313320
client.connection.api_request(method='DELETE', path=self.path)
@@ -328,9 +335,10 @@ def list_resource_record_sets(self, max_results=None, page_token=None,
328335
not passed, the API will return the first page of
329336
zones.
330337
331-
:type client: :class:`google.cloud.dns.client.Client` or ``NoneType``
332-
:param client: the client to use. If not passed, falls back to the
333-
``client`` stored on the current zone.
338+
:type client: :class:`google.cloud.dns.client.Client`
339+
:param client:
340+
(Optional) the client to use. If not passed, falls back to the
341+
``client`` stored on the current zone.
334342
335343
:rtype: :class:`~google.cloud.iterator.Iterator`
336344
:returns: Iterator of :class:`~.resource_record_set.ResourceRecordSet`
@@ -361,9 +369,10 @@ def list_changes(self, max_results=None, page_token=None, client=None):
361369
not passed, the API will return the first page of
362370
zones.
363371
364-
:type client: :class:`google.cloud.dns.client.Client` or ``NoneType``
365-
:param client: the client to use. If not passed, falls back to the
366-
``client`` stored on the current zone.
372+
:type client: :class:`google.cloud.dns.client.Client`
373+
:param client:
374+
(Optional) the client to use. If not passed, falls back to the
375+
``client`` stored on the current zone.
367376
368377
:rtype: :class:`~google.cloud.iterator.Iterator`
369378
:returns: Iterator of :class:`~.changes.Changes`

0 commit comments

Comments
 (0)