|
1 | 1 | import collections |
2 | 2 | import copy |
| 3 | +import warnings |
| 4 | + |
3 | 5 | from irods.collection import iRODSCollection |
4 | 6 | from irods.data_object import iRODSDataObject |
5 | 7 | from irods.path import iRODSPath |
@@ -202,10 +204,26 @@ def __repr__(self): |
202 | 204 | } |
203 | 205 |
|
204 | 206 |
|
205 | | -class _iRODSAccess_pre_4_3_0(_iRODSAccess_base): |
206 | | - codes = collections.OrderedDict( |
207 | | - (key.replace("_", " "), value) |
208 | | - for key, value in iRODSAccess.codes.items() |
209 | | - if key in ("own", "write", "modify_object", "read", "read_object", "null") |
210 | | - ) |
211 | | - strings = collections.OrderedDict((number, string) for string, number in codes.items()) |
| 207 | +class _deprecated: |
| 208 | + class _iRODSAccess_pre_4_3_0(_iRODSAccess_base): |
| 209 | + codes = collections.OrderedDict( |
| 210 | + (key.replace("_", " "), value) |
| 211 | + for key, value in iRODSAccess.codes.items() |
| 212 | + if key in ("own", "write", "modify_object", "read", "read_object", "null") |
| 213 | + ) |
| 214 | + strings = collections.OrderedDict((number, string) for string, number in codes.items()) |
| 215 | + def __init__(self, *args, **kwargs): |
| 216 | + warnings.warn( |
| 217 | + "_iRODSAccess_pre_4_3_0 is deprecated and will be removed in a future version. Use iRODSAccess instead.", |
| 218 | + DeprecationWarning, |
| 219 | + stacklevel=2 |
| 220 | + ) |
| 221 | + super().__init__(*args,**kwargs) |
| 222 | + |
| 223 | +_deprecated_names = {'_iRODSAccess_pre_4_3_0':_deprecated._iRODSAccess_pre_4_3_0} |
| 224 | + |
| 225 | +def __getattr__(name): |
| 226 | + if name in _deprecated_names: |
| 227 | + warnings.warn(f"{name} is deprecated", DeprecationWarning, stacklevel=2) |
| 228 | + return _deprecated_names[name] |
| 229 | + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") |
0 commit comments