Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I tried out adding type hints to the main modules (not the plugins).
Rationale
For users that use folium in an ad-hoc way the type hints may help in finding out what input a function accepts. And they may use an IDLE that gives those warnings automatically.
Users that write software with folium can now run Mypy on their software and get warnings for when their code is not compatible with folium.
For folium developers it becomes easier to work, because with explicit types you can change things with more confidence. And it forces you to think better about how a function should work.
Remarks
Any, which is fine.Changes
validate_locationsfunction into a version for normal lines and one for multi-lines. This makes it more robust for classes that use normal lines and the type hints more accurate.path_options: define the two keyword arguments on usage. This is necessary for mypy and is more explicit as well. Change theradiusargument from a bool/float into an optional float.Unrelated changes
get_obj_in_upper_treehad a bug. It assumed the top of a tree was reached if there's no_parentinstance attribute. But actually allElementinstances have this attribute, but it'sNoneif there's no parent.Merge plan
Don't merge this until we did a release. Ideally have Selenium tests up first so we can merge this with more confidence.