-
Notifications
You must be signed in to change notification settings - Fork 74
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
[#491] open raw/managed/buffering #680
base: main
Are you sure you want to change the base?
Conversation
managed/raw/buffering
irods/manager/data_object_manager.py
Outdated
@@ -523,6 +530,8 @@ def open( | |||
allow_redirect=client_config.getter("data_objects", "allow_redirect"), | |||
**options | |||
): | |||
if buffering < 0: |
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.
always true? since set to -1 just above?
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 buffering = -1
was in a parameter declaration, so here it means a parameter named buffering
with a default value of 1. Admittedly an ambiguity from a human standpoint, and the reason many early languages like Pascal chose :=
instead of =
for their assignment operators.
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.
... so here it means a parameter named
buffering
with a default value of 1.
I don't understand. The default value is -1
, based on the function signature. Am I misunderstanding something?
What values are considered valid for the buffering
parameter?
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.
How does this code change play with existing PRC applications?
@@ -121,23 +121,29 @@ def call___del__if_exists(super_): | |||
next_finalizer_in_MRO() | |||
|
|||
|
|||
class ManagedBufferedRandom(io.BufferedRandom): | |||
def managed_class(cls): |
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.
Is this private to the implementation? i.e. Should users of the library ever reach for this? If not, consider adding a leading underscore to signal that to the reader.
m_BufferedRandom = managed_class(io.BufferedRandom) | ||
m_iRODSDataObjectFileRaw = managed_class(iRODSDataObjectFileRaw) |
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.
Are these private to the implementation? i.e. Should users of the library ever reach for this? If not, consider adding a leading underscore to signal that to the reader.
irods/manager/data_object_manager.py
Outdated
@@ -523,6 +530,8 @@ def open( | |||
allow_redirect=client_config.getter("data_objects", "allow_redirect"), | |||
**options | |||
): | |||
if buffering < 0: |
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.
... so here it means a parameter named
buffering
with a default value of 1.
I don't understand. The default value is -1
, based on the function signature. Am I misunderstanding something?
What values are considered valid for the buffering
parameter?
@@ -121,23 +121,29 @@ def call___del__if_exists(super_): | |||
next_finalizer_in_MRO() | |||
|
|||
|
|||
class ManagedBufferedRandom(io.BufferedRandom): | |||
def managed_class(cls): |
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.
Needs a line or two explaining what this is for.
… correctly. line buffering only applicable in cases of e.g. TextIOWrapper opened via iRODSFS (https://github.com/d-w-moore/fs-irods@pass_root_path)
Open data object option raw | buffering , preserving option for auto_close in both cases.