python-visualization / folium

Python Data. Leaflet.js Maps.
https://python-visualization.github.io/folium/
MIT License
6.93k stars 2.23k forks source link

Correct type annotations in Realtime #1960

Closed hansthen closed 5 months ago

hansthen commented 5 months ago

This PR corrects a few type annotations for the Realtime plugin.

  1. Realtime superclass in leaflet is GeoJson (which is a subclass of featuregroup). In Folium I cannot make Realtime a subclass of GeoJson since GeoJson requires features to be present before rendering. I made it a subclass of FeatureGroup to more clearly document that features can be added to a Realtime layer.

  2. The container parameter for Realtime cannot just be any L.Layer. It must be a FeatureGroup or something that allows adding features.

I created type annotations to reflect this on the Folium side.

Conengmo commented 5 months ago

@ocefpaf is looking into that test failure in https://github.com/python-visualization/folium/pull/1978, so no need to do that here fortunately. Maybe you can revert the latest commit, then merge it?

ocefpaf commented 5 months ago

Keep merging things without worrying about that Windows failure. It is a problem with the dependencies in conda-forge and we are working to fix it upstream.