Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

d-w-moore
Copy link
Collaborator

Open data object option raw | buffering , preserving option for auto_close in both cases.

managed/raw/buffering
@@ -523,6 +530,8 @@ def open(
allow_redirect=client_config.getter("data_objects", "allow_redirect"),
**options
):
if buffering < 0:
Copy link
Member

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?

Copy link
Collaborator Author

@d-w-moore d-w-moore Jan 5, 2025

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.

Copy link
Contributor

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?

Copy link
Contributor

@korydraughn korydraughn left a 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):
Copy link
Contributor

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.

Comment on lines +145 to +146
m_BufferedRandom = managed_class(io.BufferedRandom)
m_iRODSDataObjectFileRaw = managed_class(iRODSDataObjectFileRaw)
Copy link
Contributor

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.

@@ -523,6 +530,8 @@ def open(
allow_redirect=client_config.getter("data_objects", "allow_redirect"),
**options
):
if buffering < 0:
Copy link
Contributor

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):
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants