-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Add DivIcon and CustomIcon as accepted type of Marker icon #2056
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @pixelsapphire, thanks for your PR, that makes sense! Good to improve this.
It's missing an import of that class, can you maybe add that? It will lead to a circular import, so the way to address that is by only importing it for type checking:
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from folium.features import DivIcon
One more thing: I assume this argument also accepts CustomIcon
objects. Maybe you can add that as well?
Thanks for your help!
My bad, should have checked that first.
Done and dusted. |
@Conengmo Do you know what is the issue with the failing mypy checks? It seems mypy is bothered by some method signature redefinitions between Branca and Folium. |
@hansthen This is something I've been wondering about too. Why does the |
I'm trying to reproduce this issue locally... When I upgrade my local packages I get the same issue. It also occurs on the main branch. The change in this PR doesn't cause the issue, and also doesn't add any type issues (the number of issues on this PR and the main branch is the same). I'll work on fixing the issues in a separate PR. Means we can go ahead and merge this PR! |
Thanks @pixelsapphire! This PS is much appreciated, I hadn't noticed this! |
I have been banging my head on this for a few days now. The signature redefinition seems to start already in Branca. See
In I will open a discussion on the talk page for this. |
A
DivIcon
works when passed as theicon
argument ofMarker
, but the argument is annotated asOptional[Icon]
instead ofOptional[Union[Icon, "DivIcon"]]
.