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

Feature request: Return truncated rows from encoded_text instead of raising an error #114

Closed
natekspencer opened this issue Jun 2, 2023 · 6 comments · Fixed by #115
Closed
Labels
enhancement New feature or request

Comments

@natekspencer
Copy link
Contributor

Right now, when encode_text is called with data that results in a number of rows greater than 6, a ValueError is raised. It would be nice if, instead, this could log a warning, and then return only the first 6 rows. This would be useful for truncating long song names while also trying to append a header or footer without introducing more complex logic.

@jparise
Copy link
Owner

jparise commented Jun 2, 2023

The sounds like a useful change.

I might implement it by adding a new max_rows argument (which could be None for no maximum), but I'll also think about whether it's ever helpful to raise that row-related ValueError instead of just passing that responsibility on to the caller (by returning as many rows as were needed).

@natekspencer
Copy link
Contributor Author

Thanks! That would be most helpful indeed!

@jparise jparise added the enhancement New feature or request label Jun 6, 2023
@jparise
Copy link
Owner

jparise commented Jun 6, 2023

@natekspencer #115 implements the max_rows approach and drops the ValueError. How does that look to you?

@natekspencer
Copy link
Contributor Author

That looks great to me @jparise!

@jparise
Copy link
Owner

jparise commented Jun 6, 2023

@natekspencer Great! I just merged it to main. If you're able to test it out, let me know if you have any feedback before I tag a new release.

@natekspencer
Copy link
Contributor Author

@jparise it worked exactly like I expected it to for my use case! Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants