-
-
Notifications
You must be signed in to change notification settings - Fork 377
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
Fix/addtyping #494
Fix/addtyping #494
Conversation
@giswqs can you please approve test CI file |
I just did. CI is automatically disabled for new contributors. It should run automatically after your first PR. |
I see |
I'll need a bit of to and fro for this PR as I am relying on testing from CI |
Check your email for the invite to become a collaborator for the project. CI should be able to run automatically for all collaborators. |
leafmap/common.py
Outdated
@@ -286,7 +291,7 @@ def random_string(string_length=3): | |||
return "".join(random.choice(letters) for i in range(string_length)) | |||
|
|||
|
|||
def open_image_from_url(url): | |||
def open_image_from_url(url: str) -> dict: |
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.
Removing the return data type -> dict
, which is incorrect.
leafmap/deck.py
Outdated
@@ -3,7 +3,7 @@ | |||
from .osm import * | |||
from .leafmap import basemaps | |||
from . import examples | |||
|
|||
from geopandas import GeoDataFrame |
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.
Removing this line as GeoPandas is not a required dependency.
@@ -14,6 +14,9 @@ | |||
from .basemaps import xyz_to_heremap | |||
from .common import shp_to_geojson, gdf_to_geojson, vector_to_geojson, random_string | |||
from . import examples | |||
from typing import Optional, Union, List, Dict, Callable, Any, Tuple |
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.
The heremap package has not update since October 2021. I am going to remove this module.
https://github.com/heremaps/here-map-widget-for-jupyter
@@ -13,8 +13,14 @@ | |||
from folium.elements import JSCSSMixin | |||
from folium.map import Layer | |||
from jinja2 import Template | |||
from geopandas import GeoDataFrame, GeoSeries |
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.
Removing this line. GeoPandas is not a required dependency.
from typing import Optional, Union, Any, Callable, Dict, Tuple | ||
import shapely | ||
from sqlalchemy.engine import Engine | ||
from ipywidgets.widgets import Image as ipywidgetsImage | ||
|
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.
Removing shapely and sqlalchemy that are not required dependencies.
leafmap/foliumap.py
Outdated
opacity: Optional[float] = 1.0, | ||
shown: Optional[bool] = True, | ||
bands: Optional[List] = None, | ||
titiler_endpoint: Optional[str] = "https://titiler.xyz", |
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.
The default value should be None.
leafmap/foliumap.py
Outdated
@@ -1707,7 +1734,7 @@ def st_map_bounds(self, st_component): | |||
bounds = [[south, west], [north, east]] | |||
return bounds | |||
|
|||
def st_fit_bounds(self): | |||
def st_fit_bounds(self) -> folium.Map: |
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.
The function does not return values. Removing -> folium.Map
leafmap/foliumap.py
Outdated
popup: Optional[List] = None, | ||
min_width: Optional[int] = 100, | ||
max_width: Optional[int] = 200, | ||
layer_name: Optional[str] = "Points", |
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.
The default layer name is Marker Cluster
, not Points
leafmap/foliumap.py
Outdated
layer_name: Optional[str] = "Points", | ||
color_column: Optional[str] = None, | ||
marker_colors: Optional[List] = None, | ||
icon_colors: Optional[List] = None, |
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.
The default icon_colors
is ["white"]
leafmap/foliumap.py
Outdated
color_column: Optional[str] = None, | ||
marker_colors: Optional[List] = None, | ||
icon_colors: Optional[List] = None, | ||
icon_names: Optional[List] = None, |
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.
The default icon_names
is ["info"]
leafmap/kepler.py
Outdated
@@ -9,6 +9,10 @@ | |||
from .common import * | |||
from .osm import * | |||
from . import examples | |||
from typing import Optional, Union, Dict | |||
from geopandas import GeoDataFrame |
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.
Removing geopandas
leafmap/kepler.py
Outdated
from typing import Optional, Union, Dict | ||
from geopandas import GeoDataFrame | ||
from pandas import DataFrame | ||
from sqlalchemy.engine import Engine |
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.
Removing sqlalchemy
leafmap/osm.py
Outdated
|
||
warnings.filterwarnings("ignore") | ||
from geopandas import GeoDataFrame |
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.
Removing Geopandas
|
||
warnings.filterwarnings("ignore") | ||
from geopandas import GeoDataFrame | ||
from shapely.geometry import Polygon, MultiPolygon |
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.
Removing shapely. Not a required dependency.
leafmap/osm.py
Outdated
webbrowser.open_new_tab("https://wiki.openstreetmap.org/wiki/Map_features") | ||
|
||
|
||
"""The module contains functions for downloading OpenStreetMap data. It wraps the geometries module of the osmnx package |
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.
Duplicate copy of the modules. Removing all lines after 426
leafmap/plotlymap.py
Outdated
@@ -7,6 +7,9 @@ | |||
from .common import * | |||
from .osm import * | |||
from . import examples | |||
from typing import Optional, List, Union, Dict, Tuple | |||
from plotly import graph_objects |
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.
Removing graph_objects
import
leafmap/plotlymap.py
Outdated
attribution: Optional[str] = "", | ||
opacity: Optional[float] = 1.0, | ||
bands: Optional[List] = None, | ||
titiler_endpoint: Optional[str] = "https://titiler.xyz", |
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.
The default value should be None
leafmap/stac.py
Outdated
@@ -1,16 +1,20 @@ | |||
import os | |||
import pystac | |||
import requests | |||
from typing import Optional, Dict, List, Callable, Any, Tuple, Union | |||
import pystac_client.item_search |
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.
Removing pystac_client.item_search
leafmap/stac.py
Outdated
@@ -105,7 +109,7 @@ def url_for_mosaic_lat_lon_assets(self, searchid, lon, lat): | |||
return f"{self.endpoint}/mosaic/{searchid}/{lon},{lat}/assets" | |||
|
|||
|
|||
def check_titiler_endpoint(titiler_endpoint=None): | |||
def check_titiler_endpoint(titiler_endpoint: Optional[str] = None) -> Dict: |
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.
The return type is not Dict.
leafmap/toolbar.py
Outdated
@@ -8,9 +8,14 @@ | |||
from ipyfilechooser import FileChooser | |||
from .common import * | |||
from .pc import * | |||
from typing import Optional, Union, Dict, List | |||
from leafmap import Map as leafMap | |||
from ipyleaflet import Map as ipyleafletMap |
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.
Removing leafMap
and ipyleafletMap
leafmap/toolbar.py
Outdated
@@ -579,7 +584,7 @@ def layers_btn_click(change): | |||
m.add(toolbar_control) | |||
|
|||
|
|||
def open_data_widget(m): | |||
def open_data_widget(m: Dict): |
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.
m
is not Dict
type.
All issues have been resolved. It is ready to be merged now. Thank you very much for your contribution, @krishnaglodha |
* first init * added typing for map * added colormaps * working on common * fix spell error * added deck * working on folium * worked on folium map * fixed common * added heremap * added kepler * added osm * updated pc * changed Tuple to tuple * added plotlymap * working on stack * updated osm.py and req * updated stac * updated all py files * removed stac_io type hint * tuple to Tuple * tuple to Tuple * fixed typos * updated bokehmap to Sequency * updated stac and plotlymap * updated plotlymap * access_token - None * updated with black * removed kml * updated basemap and stac * updated bokeh * updated notebook * Update mkdocs.yml added "notebooks/38_plotly.ipynb", in execute_ignore * updated req * updated mkdocs * removed geemap * made collection as Optional * added None to Collection * Fix bokeh error * Fix bokehmap typing * Pin pyymal version * Fix pyymal error * Skip notebook 71 * Fix button width error * Fix basemap notebook error * Improve typing * Improve typing --------- Co-authored-by: Qiusheng Wu <giswqs@gmail.com>
* first init * added typing for map * added colormaps * working on common * fix spell error * added deck * working on folium * worked on folium map * fixed common * added heremap * added kepler * added osm * updated pc * changed Tuple to tuple * added plotlymap * working on stack * updated osm.py and req * updated stac * updated all py files * removed stac_io type hint * tuple to Tuple * tuple to Tuple * fixed typos * updated bokehmap to Sequency * updated stac and plotlymap * updated plotlymap * access_token - None * updated with black * removed kml * updated basemap and stac * updated bokeh * updated notebook * Update mkdocs.yml added "notebooks/38_plotly.ipynb", in execute_ignore * updated req * updated mkdocs * removed geemap * made collection as Optional * added None to Collection * Fix bokeh error * Fix bokehmap typing * Pin pyymal version * Fix pyymal error * Skip notebook 71 * Fix button width error * Fix basemap notebook error * Improve typing * Improve typing --------- Co-authored-by: Qiusheng Wu <giswqs@gmail.com>
fixed basemaps and bokehmap file