Skip to content

Commit 0d296b0

Browse files
committed
docs: streamline docstrings for conditional parmas
Link to new narrative docs. Also, move 'timeout' argument to end (just before 'retry', if present) for consistency. Closes #460.
1 parent d676c0a commit 0d296b0

File tree

6 files changed

+376
-494
lines changed

6 files changed

+376
-494
lines changed

google/cloud/storage/_helpers.py

Lines changed: 42 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@ def reload(
147147
self,
148148
client=None,
149149
projection="noAcl",
150-
timeout=_DEFAULT_TIMEOUT,
151150
if_generation_match=None,
152151
if_generation_not_match=None,
153152
if_metageneration_match=None,
154153
if_metageneration_not_match=None,
154+
timeout=_DEFAULT_TIMEOUT,
155155
retry=DEFAULT_RETRY,
156156
):
157157
"""Reload properties from Cloud Storage.
@@ -168,31 +168,26 @@ def reload(
168168
Defaults to ``'noAcl'``. Specifies the set of
169169
properties to return.
170170
171-
:type timeout: float or tuple
172-
:param timeout:
173-
(Optional) The amount of time, in seconds, to wait
174-
for the server response. See: :ref:`configuring_timeouts`
175-
176171
:type if_generation_match: long
177-
:param if_generation_match: (Optional) Make the operation conditional on whether
178-
the blob's current generation matches the given value.
179-
Setting to 0 makes the operation succeed only if there
180-
are no live versions of the blob.
172+
:param if_generation_match:
173+
(Optional) See :ref:`using-if-generation-match`
181174
182175
:type if_generation_not_match: long
183-
:param if_generation_not_match: (Optional) Make the operation conditional on whether
184-
the blob's current generation does not match the given
185-
value. If no live blob exists, the precondition fails.
186-
Setting to 0 makes the operation succeed only if there
187-
is a live version of the blob.
176+
:param if_generation_not_match:
177+
(Optional) See :ref:`using-if-generation-not-match`
188178
189179
:type if_metageneration_match: long
190-
:param if_metageneration_match: (Optional) Make the operation conditional on whether the
191-
blob's current metageneration matches the given value.
180+
:param if_metageneration_match:
181+
(Optional) See :ref:`using-if-metageneration-match`
192182
193183
:type if_metageneration_not_match: long
194-
:param if_metageneration_not_match: (Optional) Make the operation conditional on whether the
195-
blob's current metageneration does not match the given value.
184+
:param if_metageneration_not_match:
185+
(Optional) See :ref:`using-if-metageneration-not-match`
186+
187+
:type timeout: float or tuple
188+
:param timeout:
189+
(Optional) The amount of time, in seconds, to wait
190+
for the server response. See: :ref:`configuring_timeouts`
196191
197192
:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
198193
:param retry:
@@ -251,11 +246,11 @@ def _set_properties(self, value):
251246
def patch(
252247
self,
253248
client=None,
254-
timeout=_DEFAULT_TIMEOUT,
255249
if_generation_match=None,
256250
if_generation_not_match=None,
257251
if_metageneration_match=None,
258252
if_metageneration_not_match=None,
253+
timeout=_DEFAULT_TIMEOUT,
259254
retry=DEFAULT_RETRY_IF_METAGENERATION_SPECIFIED,
260255
):
261256
"""Sends all changed properties in a PATCH request.
@@ -269,31 +264,26 @@ def patch(
269264
:param client: the client to use. If not passed, falls back to the
270265
``client`` stored on the current object.
271266
272-
:type timeout: float or tuple
273-
:param timeout:
274-
(Optional) The amount of time, in seconds, to wait
275-
for the server response. See: :ref:`configuring_timeouts`
276-
277267
:type if_generation_match: long
278-
:param if_generation_match: (Optional) Make the operation conditional on whether
279-
the blob's current generation matches the given value.
280-
Setting to 0 makes the operation succeed only if there
281-
are no live versions of the blob.
268+
:param if_generation_match:
269+
(Optional) See :ref:`using-if-generation-match`
282270
283271
:type if_generation_not_match: long
284-
:param if_generation_not_match: (Optional) Make the operation conditional on whether
285-
the blob's current generation does not match the given
286-
value. If no live blob exists, the precondition fails.
287-
Setting to 0 makes the operation succeed only if there
288-
is a live version of the blob.
272+
:param if_generation_not_match:
273+
(Optional) See :ref:`using-if-generation-not-match`
289274
290275
:type if_metageneration_match: long
291-
:param if_metageneration_match: (Optional) Make the operation conditional on whether the
292-
blob's current metageneration matches the given value.
276+
:param if_metageneration_match:
277+
(Optional) See :ref:`using-if-metageneration-match`
293278
294279
:type if_metageneration_not_match: long
295-
:param if_metageneration_not_match: (Optional) Make the operation conditional on whether the
296-
blob's current metageneration does not match the given value.
280+
:param if_metageneration_not_match:
281+
(Optional) See :ref:`using-if-metageneration-not-match`
282+
283+
:type timeout: float or tuple
284+
:param timeout:
285+
(Optional) The amount of time, in seconds, to wait
286+
for the server response. See: :ref:`configuring_timeouts`
297287
298288
:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
299289
:param retry:
@@ -327,11 +317,11 @@ def patch(
327317
def update(
328318
self,
329319
client=None,
330-
timeout=_DEFAULT_TIMEOUT,
331320
if_generation_match=None,
332321
if_generation_not_match=None,
333322
if_metageneration_match=None,
334323
if_metageneration_not_match=None,
324+
timeout=_DEFAULT_TIMEOUT,
335325
retry=DEFAULT_RETRY_IF_METAGENERATION_SPECIFIED,
336326
):
337327
"""Sends all properties in a PUT request.
@@ -345,31 +335,26 @@ def update(
345335
:param client: the client to use. If not passed, falls back to the
346336
``client`` stored on the current object.
347337
348-
:type timeout: float or tuple
349-
:param timeout:
350-
(Optional) The amount of time, in seconds, to wait
351-
for the server response. See: :ref:`configuring_timeouts`
352-
353338
:type if_generation_match: long
354-
:param if_generation_match: (Optional) Make the operation conditional on whether
355-
the blob's current generation matches the given value.
356-
Setting to 0 makes the operation succeed only if there
357-
are no live versions of the blob.
339+
:param if_generation_match:
340+
(Optional) See :ref:`using-if-generation-match`
358341
359342
:type if_generation_not_match: long
360-
:param if_generation_not_match: (Optional) Make the operation conditional on whether
361-
the blob's current generation does not match the given
362-
value. If no live blob exists, the precondition fails.
363-
Setting to 0 makes the operation succeed only if there
364-
is a live version of the blob.
343+
:param if_generation_not_match:
344+
(Optional) See :ref:`using-if-generation-not-match`
365345
366346
:type if_metageneration_match: long
367-
:param if_metageneration_match: (Optional) Make the operation conditional on whether the
368-
blob's current metageneration matches the given value.
347+
:param if_metageneration_match:
348+
(Optional) See :ref:`using-if-metageneration-match`
369349
370350
:type if_metageneration_not_match: long
371-
:param if_metageneration_not_match: (Optional) Make the operation conditional on whether the
372-
blob's current metageneration does not match the given value.
351+
:param if_metageneration_not_match:
352+
(Optional) See :ref:`using-if-metageneration-not-match`
353+
354+
:type timeout: float or tuple
355+
:param timeout:
356+
(Optional) The amount of time, in seconds, to wait
357+
for the server response. See: :ref:`configuring_timeouts`
373358
374359
:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
375360
:param retry:

0 commit comments

Comments
 (0)