You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BS4 now ships with type hints, but one particular change is wreaking havoc on our typing.
BS4 now returns PageElement for almost everything as Tags and Navigable strings both inherit from these. But these are distinctly different types with their own functions.
So right now, when we expect a Tag object or a NavigableString, we get an error because BS4 says it returns a PageElement.
We have functions that check is_tag etc., but mypy can't see figure this out and requires explicit inline checks for it to be able to figure stuff out. This is some of the pain of Python's typing system, it's helpful, but sometimes too dumb to be helpful in a meaningful sense. Anyway, we have a lot to fix because of this :(. I want to like typing so much, but stuff like this causes unnecessary churn. If only these tools were smart enough to see what was actually being used.
The text was updated successfully, but these errors were encountered:
BS4 now ships with type hints, but one particular change is wreaking havoc on our typing.
BS4 now returns PageElement for almost everything as Tags and Navigable strings both inherit from these. But these are distinctly different types with their own functions.
So right now, when we expect a Tag object or a NavigableString, we get an error because BS4 says it returns a PageElement.
We have functions that check
is_tag
etc., but mypy can't see figure this out and requires explicit inline checks for it to be able to figure stuff out. This is some of the pain of Python's typing system, it's helpful, but sometimes too dumb to be helpful in a meaningful sense. Anyway, we have a lot to fix because of this :(. I want to like typing so much, but stuff like this causes unnecessary churn. If only these tools were smart enough to see what was actually being used.The text was updated successfully, but these errors were encountered: