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

Raise a better error message when select* are given non string options and no preprocessor is given #139

Open
doronbehar opened this issue Jan 9, 2025 · 7 comments

Comments

@doronbehar
Copy link

MWE:

import beaupy
# works
beaupy.select(
    options= [982, 898, 859]
)
# Doesn't work
beaupy.select_multiple(
    options= [982, 898, 859]
)
@petereon
Copy link
Owner

petereon commented Jan 9, 2025

Hey hey, it's not supposed to work for other types than strings, select works accidentally I suppose.

It is also typed wrong, I'll take a look at this over the weekend also.

If you want to use other types than strings you can either handle it yourself prior or there is a preprocessor callable parameter.

@doronbehar
Copy link
Author

Yea I too noticed the typing there seems to be wrong... It states that a tuple of integers is an allowed type for the list's items. Why wasn't it simply List[str]?

@petereon
Copy link
Owner

petereon commented Jan 9, 2025

Only god and I knew when it was written - now only god knows.

@doronbehar
Copy link
Author

Thankfully God created Linus Torvalds that gave us Git, and Git should know?

@doronbehar
Copy link
Author

BTW using preprocessor works great 👍 .

@petereon
Copy link
Owner

petereon commented Jan 9, 2025

Git should know?

I skimmed blame, couldn't figure it out 🤷

@doronbehar
Copy link
Author

Maybe it'd be nice if the select* functions would have also gave a nicer error message recommending preprocessor, if the options are a list in which some items are not strings.

@doronbehar doronbehar changed the title select_multiple doesn't work with non string lists of options? Raise a better error message when select* are given non string options and no preprocessor is given Jan 9, 2025
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

No branches or pull requests

2 participants