Skip to content

Fix stream=True in fisher, reldist, and splitbed, and reldist(detail=False) - #445

Open
rpinho wants to merge 1 commit into
daler:masterfrom
rpinho:fix-stream-output-handlers
Open

rpinho wants to merge 1 commit into
daler:masterfrom
rpinho:fix-stream-output-handlers

Conversation

@rpinho

@rpinho rpinho commented Dec 1, 2026

Copy link
Copy Markdown

Who hits this: anyone using stream=True (https://daler.github.io/pybedtools/topical-iterators.html) with fisher, reldist, or splitbed, or detail=False with reldist, which the docs say returns a dictionary (https://daler.github.io/pybedtools/autodocs/pybedtools.bedtool.BedTool.reldist.html).

With stream=True, you get an AttributeError from fisher and splitbed, and an UnboundLocalError from reldist. That's because it only has the check for the Python 2 next. And if you set detail=False in reldist, you get a MalformedBedLineError. It should be the same as without it, but it only checks if detail is there.

With this, it also works with __next__, the same as for jaccard, and reldist now checks if detail is true. And now it also closes the files after.

I added a test for this. It works now: 556 before, 557 now.

I'm doing this with AI agents. A second agent on a different model checked the bug again from the report alone, without the first agent's code.

🤖 Generated with Claude Code

…False)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant