-
Notifications
You must be signed in to change notification settings - Fork 74
[_795] allow options to be accessed as attrs of metadata obj #796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
alanking
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please address or explicitly ignore Ruff as you see fit.
| if n in _default_MetadataManager_opts: | ||
| return self._manager._opts[n] | ||
| raise AttributeError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of _default_MetadataManager_opts is a little confusing to me. Does this mean that we cannot access non-default options?
Does something like this improve the situation, or make it worse?
| if n in _default_MetadataManager_opts: | |
| return self._manager._opts[n] | |
| raise AttributeError | |
| if (attr := self._manager._opts.get(n)) is None: | |
| raise AttributeError(f"Attribute [{n}] not found") | |
| return attr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried it that way and got a never-ending recursion, unfortunately : (
|
|
||
|
|
||
| class iRODSMetaCollection: | ||
| def __getattr__(self,n): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider changing n to name or some other more descriptive parameter name.
| _default_MetadataManager_opts = { | ||
| 'admin':False, | ||
| 'timestamps':False, | ||
| 'iRODSMeta_type':iRODSMeta, | ||
| 'reload':True | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this buy us over just... adding the new option to self._opts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somehow doing it this way avoided a bottomless recursion. I do not know why....
No description provided.