Skip to content

Commit 2069cec

Browse files
committed
[_809] deprecate class for storing permission codes pre-iRODS-4.3
1 parent 9bc921a commit 2069cec

1 file changed

Lines changed: 25 additions & 7 deletions

File tree

irods/access.py

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import collections
22
import copy
3+
import warnings
4+
35
from irods.collection import iRODSCollection
46
from irods.data_object import iRODSDataObject
57
from irods.path import iRODSPath
@@ -202,10 +204,26 @@ def __repr__(self):
202204
}
203205

204206

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

Comments
 (0)