Skip to content

Commit 46ecbb0

Browse files
committed
[_809] deprecate class for storing permission codes pre-iRODS-4.3
809changes spc
1 parent c671140 commit 46ecbb0

1 file changed

Lines changed: 37 additions & 7 deletions

File tree

irods/access.py

Lines changed: 37 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

@@ -285,11 +287,39 @@ def __repr__(self):
285287
**{key: iRODSAccess.codes[_synonym_mapping[key]] for key in _synonym_mapping},
286288
}
287289

290+
canonical_permissions = {k: v for k, v in all_permissions.items() if ' ' not in k and k not in ('read', 'write')}
291+
292+
293+
# ruff: noqa: RUF012 N801 SLF001 on
294+
295+
296+
class _deprecated:
297+
class _iRODSAccess_pre_4_3_0(_iRODSAccess_base):
298+
codes = collections.OrderedDict(
299+
(key.replace("_", " "), value)
300+
for key, value in iRODSAccess.codes.items()
301+
if key in ("own", "write", "modify_object", "read", "read_object", "null")
302+
)
303+
strings = collections.OrderedDict((number, string) for string, number in codes.items())
304+
305+
def __init__(self, *args, **kwargs):
306+
warnings.warn(
307+
"_iRODSAccess_pre_4_3_0 is deprecated and will be removed in "
308+
"a future version. Use iRODSAccess instead.",
309+
DeprecationWarning,
310+
stacklevel=2,
311+
)
312+
super().__init__(*args, **kwargs)
313+
314+
315+
_deprecated_names = {'_iRODSAccess_pre_4_3_0': _deprecated._iRODSAccess_pre_4_3_0}
316+
317+
318+
def __getattr__(name):
319+
if name in _deprecated_names:
320+
warnings.warn(f"{name} is deprecated", DeprecationWarning, stacklevel=2)
321+
return _deprecated_names[name]
322+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
323+
288324

289-
class _iRODSAccess_pre_4_3_0(_iRODSAccess_base):
290-
codes = collections.OrderedDict(
291-
(key.replace("_", " "), value)
292-
for key, value in iRODSAccess.codes.items()
293-
if key in ("own", "write", "modify_object", "read", "read_object", "null")
294-
)
295-
strings = collections.OrderedDict((number, string) for string, number in codes.items())
325+
# ruff: noqa: RUF012 N801 SLF001 off

0 commit comments

Comments
 (0)