|
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 |
|
@@ -285,11 +287,39 @@ def __repr__(self): |
285 | 287 | **{key: iRODSAccess.codes[_synonym_mapping[key]] for key in _synonym_mapping}, |
286 | 288 | } |
287 | 289 |
|
| 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 | + |
288 | 324 |
|
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