@@ -32,9 +32,9 @@ class ItemCollection(Collection[pystac.Item]):
3232 :class:`~ItemCollection`.
3333 clone_items : Optional flag indicating whether :class:`~pystac.Item` instances
3434 should be cloned before storing in the :class:`~ItemCollection`. Setting to
35- ``False `` will result in faster instantiation, but any changes made to
36- :class:`~pystac.Item` instances in the :class:`~ItemCollection` will also
37- mutate the original :class:`~pystac.Item`. Defaults to ``True ``.
35+ ``True `` ensures that changes made to :class:`~pystac.Item` instances in
36+ the :class:`~ItemCollection` will not mutate the original ``Item``, but
37+ will result in slower instantiation. Defaults to ``False ``.
3838
3939 Examples:
4040
@@ -50,27 +50,21 @@ class ItemCollection(Collection[pystac.Item]):
5050 >>> length: int = len(item_collection)
5151
5252 Check if an :class:`~pystac.Item` is in the :class:`~ItemCollection`. Note
53- that you must use `clone_items= False` for this to return ``True``, since
54- equality of PySTAC objects is currently evaluated using default object
55- equality (i.e. ``item_1 is item_2``).
53+ that the ``clone_items`` argument must be `` False`` for this to return
54+ ``True``, since equality of PySTAC objects is currently evaluated using default
55+ object equality (i.e. ``item_1 is item_2``).
5656
5757 >>> item: Item = ...
58- >>> item_collection = ItemCollection(items=[item], clone_items=False )
58+ >>> item_collection = ItemCollection(items=[item])
5959 >>> assert item in item_collection
6060
6161 Combine :class:`~ItemCollection` instances
6262
6363 >>> item_1: Item = ...
6464 >>> item_2: Item = ...
6565 >>> item_3: Item = ...
66- >>> item_collection_1 = ItemCollection(
67- ... items=[item_1, item_2],
68- ... clone_items=False
69- ... )
70- >>> item_collection_2 = ItemCollection(
71- ... items=[item_2, item_3],
72- ... clone_items=False
73- ... )
66+ >>> item_collection_1 = ItemCollection(items=[item_1, item_2])
67+ >>> item_collection_2 = ItemCollection(items=[item_2, item_3])
7468 >>> combined = item_collection_1 + item_collection_2
7569 >>> assert len(combined) == 3
7670 # If an item is present in both ItemCollections it will only be added once
@@ -87,7 +81,7 @@ def __init__(
8781 self ,
8882 items : Iterable [ItemLike ],
8983 extra_fields : Optional [Dict [str , Any ]] = None ,
90- clone_items : bool = True ,
84+ clone_items : bool = False ,
9185 ):
9286 def map_item (item_or_dict : ItemLike ) -> pystac .Item :
9387 # Converts dicts to pystac.Items and clones if necessary
@@ -152,9 +146,7 @@ def from_dict(cls, d: Dict[str, Any]) -> "ItemCollection":
152146 items = [pystac .Item .from_dict (item ) for item in d .get ("features" , [])]
153147 extra_fields = {k : v for k , v in d .items () if k not in ("features" , "type" )}
154148
155- # Since we are reading these Items from a dict within this method, there will be
156- # no other references and we do not need to clone them.
157- return cls (items = items , extra_fields = extra_fields , clone_items = False )
149+ return cls (items = items , extra_fields = extra_fields )
158150
159151 @classmethod
160152 def from_file (
0 commit comments