Skip to content

Commit c954989

Browse files
committed
ruff format / docstring
1 parent 49411bf commit c954989

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

irods/meta.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,32 @@ def __init__(self, operation, avu, **kw):
132132

133133
class iRODSMetaCollection:
134134
def __getattr__(self, name):
135+
"""Here we intervene for the purpose of casting such settable flags such
136+
as 'admin', 'timestamps', etc. as readable attributes of the object.
137+
138+
If the attribute name exists as a key in _MetadataManager_opts_initializer
139+
(for the "_opts" lookup in the manager object), then the current value from
140+
_opts is returned. Otherwise we throw an exception to revert to the default
141+
__getattr__ behavior.
142+
143+
For more specific coverage of such attributes and how they are used, please
144+
consult the test module irods/test/meta_test.py and read the test for
145+
issue #709, named:
146+
147+
test_cascading_changes_of_metadata_manager_options__issue_709
148+
"""
149+
135150
from irods.manager.metadata_manager import _MetadataManager_opts_initializer
151+
136152
# Separating _MetadataManager_opts_initializer from the MetadataManager class
137153
# prevents the possibility of arbitrary access by copy.copy() to parts of
138154
# our object's state before they have been initialized, as it is known to do
139155
# by calling hasattr on the "__setstate__" attribute. The result of such
140156
# unfettered access is infinite recursion. See:
141157
# https://nedbatchelder.com/blog/201010/surprising_getattr_recursion
158+
142159
if name in _MetadataManager_opts_initializer:
143-
return self._manager._opts[name]
160+
return self._manager._opts[name] # noqa: SLF001
144161
raise AttributeError
145162

146163
def __call__(self, **opts):

0 commit comments

Comments
 (0)