Skip to content

Commit f599cf6

Browse files
committed
Improved put mode docstring
1 parent 9a56cce commit f599cf6

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

obstore/python/obstore/_put.pyi

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,19 @@ class UpdateVersion(TypedDict, total=False):
3939
PutMode = Literal["create", "overwrite"] | UpdateVersion
4040
"""Configure preconditions for the put operation
4141
42+
There are three modes:
43+
44+
- Overwrite: Perform an atomic write operation, overwriting any object present at the provided path.
45+
- Create: Perform an atomic write operation, returning [`AlreadyExistsError`][obstore.exceptions.AlreadyExistsError] if an object already exists at the provided path.
46+
- Update: Perform an atomic write operation if the current version of the object matches the provided [`UpdateVersion`][obstore.UpdateVersion], returning [`PreconditionError`][obstore.exceptions.PreconditionError] otherwise.
47+
4248
If a string is provided, it must be one of:
4349
44-
- `"overwrite"`: Perform an atomic write operation, overwriting any object present at the provided path.
45-
- `"create"`: Perform an atomic write operation, returning [`AlreadyExistsError`][obstore.exceptions.AlreadyExistsError] if an object already exists at the provided path
50+
- `"overwrite"`
51+
- `"create"`
4652
47-
If a `dict` is provided, it must meet the criteria of `UpdateVersion`. In this case,
48-
perform an atomic write operation if the current version of the object matches the
49-
provided [`UpdateVersion`][obstore.UpdateVersion], returning
50-
[`PreconditionError`][obstore.exceptions.PreconditionError] otherwise.
53+
If a `dict` is provided, it must meet the criteria of
54+
[`UpdateVersion`][obstore.UpdateVersion].
5155
"""
5256

5357
class PutResult(TypedDict):
@@ -116,7 +120,9 @@ def put(
116120
protocol.
117121
118122
Keyword args:
119-
mode: Configure the `PutMode` for this operation. If this provided and is not `"overwrite"`, a non-multipart upload will be performed. Defaults to `"overwrite"`.
123+
mode: Configure the [`PutMode`][obstore.PutMode] for this operation. Refer to the [`PutMode`][obstore.PutMode] docstring for more information.
124+
125+
If this provided and is not `"overwrite"`, a non-multipart upload will be performed. Defaults to `"overwrite"`.
120126
attributes: Provide a set of `Attributes`. Defaults to `None`.
121127
tags: Provide tags for this object. Defaults to `None`.
122128
use_multipart: Whether to use a multipart upload under the hood. Defaults using a multipart upload if the length of the file is greater than `chunk_size`. When `use_multipart` is `False`, the entire input will be materialized in memory as part of the upload.

0 commit comments

Comments
 (0)