-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
TYP/DOC: flavor parameter with incorrect type hint in read_html #55059
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
Comments
Sounds good to me! As you mentioned, the doc-string of read_html needs to also be updated as it only mentions |
twoertwein
pushed a commit
that referenced
this issue
Sep 9, 2023
mroeschke
pushed a commit
to mroeschke/pandas
that referenced
this issue
Sep 11, 2023
Dr-Irv
pushed a commit
to pandas-dev/pandas-stubs
that referenced
this issue
Nov 2, 2023
* Fix flavor param with incorrect type hint in read_html refs: - pandas-dev/pandas#55059 - pandas-dev/pandas#55076 * Add HTMLFlavors type to read_html ref: pandas-dev/pandas#55529 * Add tests and new dev dependencies Added: - tests to check HTMLFlavors type in read_html flavor arg; - set beautifulsoup4 and html5lib as dev dependencies. They are used by the respective flavors in read_html.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
The
flavor
parameter has the incorret type hint in theread_html(...)
function.Currently, the type hint is an optional
str
. However, according to the documentation in io.html it is possible to pass a list-like:Internally
read_html(...)
converts the passed value to atuple
in both cases.With this incorrect type hint, type checkers throw an error when passed a list-like:
Solution
We can set the type hint to a
str
or aSequence[str]
, both of which are optional:I can resolve this and create a PR by updating the type hints, docstrings and documentation. Just let me know if you agree with my solution.
The text was updated successfully, but these errors were encountered: