Coverage for install/scipp/core/deprecation.py: 54%
13 statements
« prev ^ index » next coverage.py v7.4.0, created at 2024-04-28 01:28 +0000
« prev ^ index » next coverage.py v7.4.0, created at 2024-04-28 01:28 +0000
1import warnings
3from .util import VisibleDeprecationWarning
6def _warn_attr_removal():
7 warnings.warn(
8 "sc.DataArray.attrs has been deprecated and will be removed in Scipp v24.12.0. "
9 "The deprecation includes sc.DataArray.meta and sc.DataArray.drop_attrs. "
10 "For unaligned coords, use sc.DataArray.coords and unset the alignment flag. "
11 "For other attributes, use a higher-level data structure.",
12 VisibleDeprecationWarning,
13 stacklevel=3,
14 )
17def _deprecated_attrs(cls):
18 """
19 Dict of attrs.
21 .. deprecated:: 23.9.0
22 Use :py:attr:`coords` with unset alignment flag instead, or
23 store attributes in higher-level data structures.
24 """
25 _warn_attr_removal()
26 return cls.deprecated_attrs
29def _deprecated_meta(cls):
30 """
31 Dict of coords and attrs.
33 .. deprecated:: 23.9.0
34 Use :py:attr:`coords` with unset alignment flag instead, or
35 store attributes in higher-level data structures.
36 """
37 _warn_attr_removal()
38 return cls.deprecated_meta
41def _deprecated_drop_attrs(cls, *args, **kwargs):
42 """
43 Drop attrs.
45 .. deprecated:: 23.9.0
46 Use :py:attr:`coords` with unset alignment flag instead, or
47 store attributes in higher-level data structures.
48 """
49 _warn_attr_removal()
50 return cls.deprecated_drop_attrs(*args, **kwargs)