X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/c8c1fd28b0a587a91041e02da13918ca34a5ce6f..85ec07b3d4f0a14285a0d20db682c282e490e7e7:/sdk/python/arvados/collection.py diff --git a/sdk/python/arvados/collection.py b/sdk/python/arvados/collection.py index a96474549a..d03790411a 100644 --- a/sdk/python/arvados/collection.py +++ b/sdk/python/arvados/collection.py @@ -86,7 +86,7 @@ ChangeType = Literal[ADD, DEL, MOD, TOK] CollectionItem = Union[ArvadosFile, 'Collection'] ChangeCallback = Callable[[ChangeType, 'Collection', str, CollectionItem], object] CreateType = Literal[COLLECTION, FILE] -Properties = Mapping[str, Any] +Properties = Dict[str, Any] StorageClasses = List[str] class CollectionBase(object): @@ -567,7 +567,7 @@ class RichCollectionBase(CollectionBase): Arguments: - * source_obj: ArvadosFile | Subcollection --- The file or subcollection + * source_obj: arvados.arvfile.ArvadosFile | Subcollection --- The file or subcollection to add to this collection * target_name: str --- The path inside this collection where @@ -660,17 +660,18 @@ class RichCollectionBase(CollectionBase): Arguments: - * source: str | ArvadosFile | Subcollection --- The file or - subcollection to add to this collection. If `source` is a str, the - object will be found by looking up this path from `source_collection` - (see below). + * source: str | arvados.arvfile.ArvadosFile | + arvados.collection.Subcollection --- The file or subcollection to + add to this collection. If `source` is a str, the object will be + found by looking up this path from `source_collection` (see + below). * target_path: str --- The path inside this collection where the source object should be added. - * source_collection: Collection | None --- The collection to find the - source object from when `source` is a path. Defaults to the current - collection (`self`). + * source_collection: arvados.collection.Collection | None --- The + collection to find the source object from when `source` is a + path. Defaults to the current collection (`self`). * overwrite: bool --- Controls the behavior of this method when the collection already contains an object at `target_path`. If `False` @@ -693,17 +694,18 @@ class RichCollectionBase(CollectionBase): Arguments: - * source: str | ArvadosFile | Subcollection --- The file or - subcollection to add to this collection. If `source` is a str, the - object will be found by looking up this path from `source_collection` - (see below). + * source: str | arvados.arvilfe.ArvadosFile | + arvados.collection.Subcollection --- The file or subcollection to + add to this collection. If `source` is a str, the object will be + found by looking up this path from `source_collection` (see + below). * target_path: str --- The path inside this collection where the source object should be added. - * source_collection: Collection | None --- The collection to find the - source object from when `source` is a path. Defaults to the current - collection (`self`). + * source_collection: arvados.collection.Collection | None --- The + collection to find the source object from when `source` is a + path. Defaults to the current collection (`self`). * overwrite: bool --- Controls the behavior of this method when the collection already contains an object at `target_path`. If `False` @@ -846,16 +848,17 @@ class RichCollectionBase(CollectionBase): Arguments: - * end_collection: RichCollectionBase --- A collection object with the - desired end state. The returned diff list will describe how to go - from the current collection object `self` to `end_collection`. + * end_collection: arvados.collection.RichCollectionBase --- A + collection object with the desired end state. The returned diff + list will describe how to go from the current collection object + `self` to `end_collection`. * prefix: str --- The name to use for this collection's stream in the diff list. Default `'.'`. - * holding_collection: Collection | None --- A collection object used to - hold objects for the returned diff list. By default, a new empty - collection is created. + * holding_collection: arvados.collection.Collection | None --- A + collection object used to hold objects for the returned diff + list. By default, a new empty collection is created. """ changes = [] if holding_collection is None: @@ -889,8 +892,8 @@ class RichCollectionBase(CollectionBase): Arguments: - * changes: ChangeList --- The list of differences generated by - `RichCollectionBase.diff`. + * changes: arvados.collection.ChangeList --- The list of differences + generated by `RichCollectionBase.diff`. """ if changes: self.set_committed(False) @@ -948,8 +951,8 @@ class RichCollectionBase(CollectionBase): Arguments: - * callback: ChangeCallback --- The callable to call each time the - collection is changed. + * callback: arvados.collection.ChangeCallback --- The callable to + call each time the collection is changed. """ if self._callback is None: self._callback = callback @@ -984,12 +987,14 @@ class RichCollectionBase(CollectionBase): * event: Literal[ADD, DEL, MOD, TOK] --- The type of modification to the collection. - * collection: RichCollectionBase --- The collection that was modified. + * collection: arvados.collection.RichCollectionBase --- The + collection that was modified. * name: str --- The name of the file or stream within `collection` that was modified. - * item: ArvadosFile | Subcollection --- The new contents at `name` + * item: arvados.arvfile.ArvadosFile | + arvados.collection.Subcollection --- The new contents at `name` within `collection`. """ if self._callback: @@ -1156,14 +1161,14 @@ class Collection(RichCollectionBase): except errors.SyntaxError as e: raise errors.ArgumentError("Error processing manifest text: %s", str(e)) from None - def storage_classes_desired(self) -> list[str]: + def storage_classes_desired(self) -> List[str]: """Get this collection's `storage_classes_desired` value""" return self._storage_classes_desired or [] def root_collection(self) -> 'Collection': return self - def get_properties(self) -> dict[str, Any]: + def get_properties(self) -> Properties: """Get this collection's properties This method always returns a dict. If this collection object does not @@ -1200,7 +1205,7 @@ class Collection(RichCollectionBase): @synchronized def known_past_version( self, - modified_at_and_portable_data_hash: tuple[Optional[str], Optional[str]] + modified_at_and_portable_data_hash: Tuple[Optional[str], Optional[str]] ) -> bool: """Indicate whether an API record for this collection has been seen before @@ -1231,17 +1236,17 @@ class Collection(RichCollectionBase): Arguments: - * other: Collection | None --- The collection whose contents should be - merged into this instance. When not provided, this method reloads this - collection's API record and constructs a Collection object from it. - If this instance does not have a corresponding API record, this method - raises `arvados.errors.ArgumentError`. + * other: arvados.collection.Collection | None --- The collection + whose contents should be merged into this instance. When not + provided, this method reloads this collection's API record and + constructs a Collection object from it. If this instance does not + have a corresponding API record, this method raises + `arvados.errors.ArgumentError`. * num_retries: int | None --- The number of times to retry reloading the collection's API record from the API server. If not specified, uses the `num_retries` provided when this instance was constructed. """ - if other is None: if self._manifest_locator is None: raise errors.ArgumentError("`other` is None but collection does not have a manifest_locator uuid") @@ -1379,8 +1384,9 @@ class Collection(RichCollectionBase): Arguments: - * new_parent: Collection | None --- This value is passed to the new - Collection's constructor as the `parent` argument. + * new_parent: arvados.collection.Collection | None --- This value is + passed to the new Collection's constructor as the `parent` + argument. * new_name: str | None --- This value is unused.