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 typing.Literal for mode #49

Open
adamchainz opened this issue Oct 17, 2020 · 0 comments
Open

Use typing.Literal for mode #49

adamchainz opened this issue Oct 17, 2020 · 0 comments

Comments

@adamchainz
Copy link

Is your feature request related to a problem? Please describe.

Only certain "mode" strings are accepted to Soup.find(), and underneath that, Soup._triage(). The type annotation str allows typos through for a runtime error.

Describe the solution you'd like

Use typing.Literal to specify the known mode names, so that such bugs can be caught at type checking type.

Describe alternatives you've considered
n/a

Additional context
n/a

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

1 participant