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

Use string Literal for str-based matching #1810

Open
Zeitsperre opened this issue Jun 27, 2024 · 0 comments
Open

Use string Literal for str-based matching #1810

Zeitsperre opened this issue Jun 27, 2024 · 0 comments
Assignees
Labels
API Interfacing and User Concerns standards / conventions Suggestions on ways forward

Comments

@Zeitsperre
Copy link
Collaborator

I think we could simply map it to xclim's STRING ? Unless there's a simple way to detect if the allowed values' type, my guess is that we don't really need Literals for anything else than strings. So here :

xclim/xclim/core/utils.py

Lines 659 to 660 in 98c251c

if annot.issuperset({"str"}):
return InputKind.STRING

And if we do that, maybe we could apply the same for all op and method arguments throughout the library ? And maybe use the annotation to parse the choices property of xclim.core.indicator.Parameter ?

Originally posted by @aulemahal in #1796 (comment)

@Zeitsperre Zeitsperre added standards / conventions Suggestions on ways forward API Interfacing and User Concerns labels Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Interfacing and User Concerns standards / conventions Suggestions on ways forward
Projects
None yet
Development

No branches or pull requests

2 participants