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
[#525] Add support for touch API operation #531
base: main
Are you sure you want to change the base?
Conversation
Why all caps error code? Is there precedent for that in PRC? |
Just not familiar with all the conventions yet. Also, I think I saw exceptions like that used in other places in the PRC. |
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.
This is well done. I like the use of an irods.manager.common
for commonly /multiply used code. Wonder now if we should scan for instances where irods.common
would be similarly useful.
Approve the changes so far. Guess we'll have one more round once tests are implemented
I don't know the valid uses of |
I added a new exception type, All new tests pass. The only way I could run my tests was by skipping the iRODS version check code in |
Forgot to mention this PR also adds |
Looks like I need to address a few more codacy issues. |
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 meat of the change is good. Just a few suggestions/questions
All review comments addressed. All that's left is to run the full test suite. |
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.
Just had one more suggestion. Looks good otherwise
from irods.api_number import api_number | ||
from irods.message import iRODSMessage, JSON_Message | ||
|
||
def touch_impl(session, path, **options): |
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.
Should this be _touch_impl
so that it discourages use? Feels like people should be calling the methods in data_object_manager
or collection_manager
. Thoughts?
Sounds like @d-w-moore is in favor of a module like this, so maybe I'm in the minority here.
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.
Good idea. Keep them conventions coming.
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.
Thinking about this more, user code shouldn't import the util
module at all. Are there conventions for expressing that?
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.
@korydraughn @alanking - prefixing with underscore, ie renaming to _touch_impl
as you said., is probably what you want. That's a clear enough indication to users this isn't for them to call. Also (and in support of that conclusion), a statement from <module> import *
won't import symbols starting with underscores
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.
(One can still do from X.Y.Z import _my_prefixed_thing
or simply import X.Y.Z
then then do something with X.Y.Z._my_prefixed_thing
)
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.
@alanking in other words doing __all__ = [ ]
does not prevent individual import of symbols by name, nor does it prevent access to the module namespace. It simply does the best of Python symbol-hiding, which is to prevent mass clobbering (or just accidental importation) via from blah import *
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'm just now seeing there were additional comments. My comment about moving forward with a source file level docstring didn't take the rest of the conversation into account.
I'm going to add leading underscores.
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 can also rename the module to use a leading underscore (e.g. _internal
).
That seems to be a known convention. Thoughts?
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 can also rename the module to use a leading underscore (e.g.
_internal
).That seems to be a known convention. Thoughts?
That is true. Generally modules are considered not user domain if their names have a leading underscore.
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.
Good. I'll tweak the code to use leading underscores in the module name and functions. Then it becomes crystal clear that they are for internal use only.
The implementation appears to work.
Just need to implement tests.