Skip to content

ARROW-13476: [Doc][Python] Switch ipc/io doc to use context managers#10957

Closed
amol- wants to merge 2 commits into
apache:masterfrom
amol-:ARROW-13476
Closed

ARROW-13476: [Doc][Python] Switch ipc/io doc to use context managers#10957
amol- wants to merge 2 commits into
apache:masterfrom
amol-:ARROW-13476

Conversation

@amol-

@amol- amol- commented Aug 18, 2021

Copy link
Copy Markdown
Member

No description provided.

@github-actions

Copy link
Copy Markdown

batches = [b for b in reader]
with pa.ipc.open_stream(buf) as reader:
schema = reader.schema
batches = [b for b in reader]

@amol- amol- Aug 18, 2021

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took me a while to get around this one, if you wonder why this block is indented to more spaces than the other blocks, it's to work around what seemed like a bug in ipython directive.
When indented normally the second line was parsed as outside of the with block

In [0]: with pa.ipc.open_stream(buf) as reader:
   ...:    schema = reader.schema
In [1]: batches = [b for b in reader]

instead of

In [0]: with pa.ipc.open_stream(buf) as reader:
   ...:       schema = reader.schema
   ...:       batches = [b for b in reader]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh.

@amol- amol- marked this pull request as ready for review August 18, 2021 12:55

@pitrou pitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, thank you

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants