-
Notifications
You must be signed in to change notification settings - Fork 12
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
add read mode for dxpy #138
base: master
Are you sure you want to change the base?
Conversation
@@ -128,7 +128,7 @@ def normpath(self): | |||
normed = posixpath.normpath('/' + str(self)[len(self.drive):])[1:] | |||
return self.path_class(self.drive + normed) | |||
|
|||
def read_object(self): | |||
def read_object(self, mode='r'): |
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.
If the intention is to use with stor.Path('dx://path/to/file).open(mode='rb')
to access dx files, this is not really necessary because mode is already set in the self
object by this point. You can remove it from dx.py
, s3.py
and swift.py
as well. You'd just do in dx.py
:
def read_object(self):
....
file_handler = dxpy.DXFile(dxid=self.canonical_resource, project=self.canonical_project, mode=self.mode)
....
if self.mode == 'r':
....
If there was some other reasoning behind this, you can disregard my 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.
Thanks for the feedback. I just realized that OBSFile
defined mode
i was looking for it in OBSPath
instead and not finding it so I dont think the self.mode
in your example would work
I'll make the change but I'm not really sure about when when to use open()
vs read_object()
I think that the correct answer is to just not decode? Probably just need to review this again - good point... |
Now that dxpy supports non-utf8 read modes, pass 'rb' through
make lint
doesn't work tho: