@@ -75,7 +75,7 @@ def __init__(
75
75
ignore_version_mismatch = True ,
76
76
ignore_unrecognized_tag = False ,
77
77
ignore_implicit_conversion = NotSet ,
78
- copy_arrays = False ,
78
+ copy_arrays = NotSet ,
79
79
memmap = NotSet ,
80
80
lazy_load = True ,
81
81
custom_schema = None ,
@@ -117,16 +117,15 @@ def __init__(
117
117
as-is.
118
118
119
119
copy_arrays : bool, optional
120
+ Deprecated; use ``memmap`` instead.
120
121
When `False`, when reading files, attempt to memmap underlying data
121
122
arrays when possible.
122
123
123
124
memmap : bool, optional
124
125
When `True`, when reading files, attempt to memmap underlying data
125
126
arrays when possible. When set, this argument will override
126
- ``copy_arrays``. When not set, the ``copy_arrays`` will determine
127
- if arrays are memory mapped or copied. ``copy_arrays`` will be
128
- deprecated and the default will change in an upcoming asdf version
129
- which by default will not memory map arrays.
127
+ ``copy_arrays``. The default will change to ``False`` in an upcoming
128
+ ASDF version. At the moment the default is ``True``.
130
129
131
130
lazy_load : bool, optional
132
131
When `True` and the underlying file handle is seekable, data
@@ -135,8 +134,6 @@ def __init__(
135
134
open during the lifetime of the tree. Setting to False causes
136
135
all data arrays to be loaded up front, which means that they
137
136
can be accessed even after the underlying file is closed.
138
- Note: even if ``lazy_load`` is `False`, ``copy_arrays`` is still taken
139
- into account.
140
137
141
138
custom_schema : str, optional
142
139
Path to a custom schema file that will be used for a secondary
@@ -182,9 +179,16 @@ def __init__(
182
179
self ._closed = False
183
180
self ._external_asdf_by_uri = {}
184
181
# if memmap is set, it overrides copy_arrays
185
- if memmap is not NotSet :
186
- copy_arrays = not memmap
187
- self ._blocks = BlockManager (uri = uri , lazy_load = lazy_load , memmap = not copy_arrays )
182
+ if copy_arrays is not NotSet :
183
+ warnings .warn (
184
+ "copy_arrays is deprecated; use memmap instead. Note that memmap will default to False in asdf 4.0." ,
185
+ AsdfWarning ,
186
+ )
187
+ if memmap is NotSet :
188
+ memmap = not copy_arrays
189
+ elif memmap is NotSet :
190
+ memmap = True
191
+ self ._blocks = BlockManager (uri = uri , lazy_load = lazy_load , memmap = memmap )
188
192
# this message is passed into find_references to only warn if
189
193
# a reference was found
190
194
find_ref_warning_msg = (
@@ -1618,7 +1622,7 @@ def open_asdf(
1618
1622
ignore_version_mismatch = True ,
1619
1623
ignore_unrecognized_tag = False ,
1620
1624
_force_raw_types = False ,
1621
- copy_arrays = False ,
1625
+ copy_arrays = NotSet ,
1622
1626
memmap = NotSet ,
1623
1627
lazy_tree = NotSet ,
1624
1628
lazy_load = True ,
@@ -1661,16 +1665,15 @@ def open_asdf(
1661
1665
`False` by default.
1662
1666
1663
1667
copy_arrays : bool, optional
1668
+ Deprecated; use ``memmap`` instead.
1664
1669
When `False`, when reading files, attempt to memmap underlying data
1665
1670
arrays when possible.
1666
1671
1667
1672
memmap : bool, optional
1668
1673
When `True`, when reading files, attempt to memmap underlying data
1669
1674
arrays when possible. When set, this argument will override
1670
- ``copy_arrays``. When not set, the ``copy_arrays`` will determine
1671
- if arrays are memory mapped or copied. ``copy_arrays`` will be
1672
- deprecated and the default will change in an upcoming asdf version
1673
- which by default will not memory map arrays.
1675
+ ``copy_arrays``. The default will change to ``False`` in an upcoming
1676
+ ASDF version. At the moment the default is ``True``.
1674
1677
1675
1678
lazy_load : bool, optional
1676
1679
When `True` and the underlying file handle is seekable, data
0 commit comments