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

Fix formatting of empty zip lists #350

Merged
merged 1 commit into from
Dec 12, 2023

Conversation

pvandyken
Copy link
Contributor

Empty zip lists (meaning zip lists with entities but without any values) gave an IndexError when attempting formatting. This fixes the problem, plus refactors the formatting code. In particular, the function to find the elision has been refactored to work only on the 'values' portion of the table to reduce the amount of 'magic numbers', previously needed to account for the table keys

Resolves #339

Empty zip lists (meaning zip lists with entities but without any
values) gave an IndexError when attempting formatting. This fixes the
problem, plus refactors the formatting code. In particular, the function
to find the elision has been refactored to work only on the 'values'
portion of the table to reduce the amount of 'magic numbers', previously
needed to account for the table keys

Resolves khanlab#339
@pvandyken pvandyken added the bug Something isn't working label Dec 12, 2023
@github-actions github-actions bot requested review from akhanf and kaitj December 12, 2023 13:47
Copy link
Contributor

@kaitj kaitj left a comment

Choose a reason for hiding this comment

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

Took me a little bit to wrap my head around https://github.com/akhanf/snakebids/blob/b8f78980481904263832ab9e2fa0eedb7e9d3829/snakebids/io/printing.py#L27-L28 and the subsequent code, but looks good to me!

@pvandyken pvandyken merged commit a6b30c2 into khanlab:main Dec 12, 2023
28 checks passed
@pvandyken pvandyken deleted the fix/format_empty_ziplist branch December 12, 2023 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

_format_zip_lists breaks when formatting an empty zip list
2 participants