From 661b9e7a12f612717aac438df5a44dc3df93bd21 Mon Sep 17 00:00:00 2001 From: Krishna Lodha Date: Mon, 17 Jul 2023 19:28:02 +0530 Subject: [PATCH] changed Tuple to tuple --- leafmap/common.py | 16 ++++++++-------- leafmap/foliumap.py | 18 +++++++++--------- leafmap/heremap.py | 6 +++--- leafmap/osm.py | 6 +++--- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/leafmap/common.py b/leafmap/common.py index 19a7193b20..9e0e20b7ce 100644 --- a/leafmap/common.py +++ b/leafmap/common.py @@ -13,7 +13,7 @@ import ipyleaflet import ipywidgets as widgets import whitebox -from typing import Union, List, Dict, Tuple, Optional +from typing import Union, List, Dict, Optional from .stac import * try: @@ -430,7 +430,7 @@ def upload_to_imgur(in_gif:str): raise Exception(e) -def rgb_to_hex(rgb:Optional[Tuple[int,int,int]]=(255, 255, 255)) -> str: +def rgb_to_hex(rgb:Optional[tuple[int,int,int]]=(255, 255, 255)) -> str: """Converts RGB to hex color. In RGB color R stands for Red, G stands for Green, and B stands for Blue, and it ranges from the decimal value of 0 – 255. Args: @@ -442,7 +442,7 @@ def rgb_to_hex(rgb:Optional[Tuple[int,int,int]]=(255, 255, 255)) -> str: return "%02x%02x%02x" % rgb -def hex_to_rgb(value:Optional[str]="FFFFFF") -> Tuple[int, int,int]: +def hex_to_rgb(value:Optional[str]="FFFFFF") -> tuple[int, int,int]: """Converts hex color to RGB color. Args: @@ -456,7 +456,7 @@ def hex_to_rgb(value:Optional[str]="FFFFFF") -> Tuple[int, int,int]: return tuple(int(value[i : i + lv // 3], 16) for i in range(0, lv, lv // 3)) -def check_color(in_color: Union[str, Tuple]) -> str: +def check_color(in_color: Union[str, tuple]) -> str: """Checks the input color and returns the corresponding hex color code. Args: @@ -5436,7 +5436,7 @@ def find_tiles(self, region=None, return_type="list", geopandas_args={}, API={}) def find_details( self, bbox: List[float] = None, - polygon: List[Tuple[float, float]] = None, + polygon: List[tuple[float, float]] = None, datasets: str = None, prodFormats: str = None, prodExtents: str = None, @@ -7325,7 +7325,7 @@ def create_timelapse( out_gif: str, ext: str = ".tif", bands: Optional[List] = None, - size: Optional[Tuple] = None, + size: Optional[tuple] = None, bbox: Optional[List] = None, fps: int = 5, loop: int = 0, @@ -7333,7 +7333,7 @@ def create_timelapse( progress_bar_color: str = "blue", progress_bar_height: int = 5, add_text: bool = False, - text_xy: Optional[Tuple] = None, + text_xy: Optional[tuple] = None, text_sequence: Optional[List] = None, font_type: str = "arial.ttf", font_size: int = 20, @@ -7352,7 +7352,7 @@ def create_timelapse( out_gif (str): File path to the output gif. ext (str, optional): The extension of the images. Defaults to '.tif'. bands (Optional[list], optional): The bands to use for the gif. For example, [0, 1, 2] for RGB, and [0] for grayscale. Defaults to None. - size (Optional[Tuple], optional): The size of the gif. For example, (500, 500). Defaults to None, using the original size. + size (Optional[tuple], optional): The size of the gif. For example, (500, 500). Defaults to None, using the original size. bbox (Optional[list], optional): The bounding box of the gif. For example, [xmin, ymin, xmax, ymax]. Defaults to None, using the original bounding box. fps (int, optional): The frames per second of the gif. Defaults to 5. loop (int, optional): The number of times to loop the gif. Defaults to 0, looping forever. diff --git a/leafmap/foliumap.py b/leafmap/foliumap.py index 87a8132613..5756f21c07 100644 --- a/leafmap/foliumap.py +++ b/leafmap/foliumap.py @@ -16,7 +16,7 @@ from geopandas import GeoDataFrame,GeoSeries basemaps = Box(xyz_to_folium(), frozen_box=True) import pandas as pd -from typing import Optional, Union, Any, Callable, Tuple, Dict +from typing import Optional, Union, Any, Callable, Dict import shapely from sqlalchemy.engine import Engine import ipywidgets.Image @@ -189,7 +189,7 @@ def set_center(self, lon:float, lat:float, zoom:Optional[int]=10): arc_zoom_to_extent(lon, lat, lon, lat) - def zoom_to_bounds(self, bounds: Union[List[float], Tuple[float,float,float,float]]): + def zoom_to_bounds(self, bounds: Union[List[float], tuple[float,float,float,float]]): """Zooms to a bounding box in the form of [minx, miny, maxx, maxy]. Args: @@ -767,7 +767,7 @@ def add_osm_from_place( def add_osm_from_point( self, - center_point: Tuple[float, float], + center_point: tuple[float, float], tags: dict, dist: Optional[int] = 1000, layer_name: Optional[str] = "Untitled", @@ -1438,7 +1438,7 @@ def add_vector( self, filename:str, layer_name:Optional[str]="Untitled", - bbox:Optional[Union[Tuple, GeoDataFrame, GeoSeries, shapely.geometry.base.BaseGeometry]]=None, + bbox:Optional[Union[tuple, GeoDataFrame, GeoSeries, shapely.geometry.base.BaseGeometry]]=None, mask:Optional[Union[Dict, GeoDataFrame, GeoSeries, shapely.geometry.base.BaseGeometry]]=None, rows:Optional[Union[int, slice]]=None, info_mode:Optional[str]="on_hover", @@ -1675,7 +1675,7 @@ def to_streamlit( except Exception as e: raise Exception(e) - def st_map_center(self, st_component) -> Tuple: + def st_map_center(self, st_component) -> tuple: """Get the center of the map. Args: @@ -1692,7 +1692,7 @@ def st_map_center(self, st_component) -> Tuple: north = bounds["_northEast"]["lat"] return (south + (north - south) / 2, west + (east - west) / 2) - def st_map_bounds(self, st_component) -> Tuple: + def st_map_bounds(self, st_component) -> tuple: """Get the bounds of the map in the format of (miny, minx, maxy, maxx). Args: @@ -1942,7 +1942,7 @@ def add_colormap( orientation:Optional[str]="horizontal", dpi:Optional[Union[str, float]]="figure", transparent:Optional[bool]=False, - position:Optional[Tuple]=(70, 5), + position:Optional[tuple]=(70, 5), **kwargs ): """Add a colorbar to the map. Under the hood, it uses matplotlib to generate the colorbar, save it as a png file, and add it to the map using m.add_image(). @@ -2643,7 +2643,7 @@ def add_data( if add_legend: self.add_legend(title=legend_title, legend_dict=legend_dict) - def add_image(self, image:Union[str,ipywidgets.Image ], position:Optional[Tuple]=(0, 0), **kwargs): + def add_image(self, image:Union[str,ipywidgets.Image ], position:Optional[tuple]=(0, 0), **kwargs): """Add an image to the map. Args: @@ -3005,7 +3005,7 @@ def get_scale(self): "The folium plotting backend does not support this function. Use the ipyleaflet plotting backend instead." ) - def image_overlay(self, url:str, bounds: Tuple, name:str): + def image_overlay(self, url:str, bounds: tuple, name:str): """Overlays an image from the Internet or locally on the map. Args: diff --git a/leafmap/heremap.py b/leafmap/heremap.py index 5b5ef10bec..20993d83d1 100644 --- a/leafmap/heremap.py +++ b/leafmap/heremap.py @@ -14,7 +14,7 @@ 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, Tuple, Dict, Callable, Any +from typing import Optional, Union, List, Dict, Callable, Any from geopandas import GeoDataFrame, GeoSeries import shapely.geometry.base.BaseGeometry @@ -112,7 +112,7 @@ def set_center(self, lon:float, lat:float, zoom:Optional[int] =None): if zoom is not None: self.zoom = zoom - def zoom_to_bounds(self, bounds: Union[List, Tuple]): + def zoom_to_bounds(self, bounds: Union[List, tuple]): """Zooms to a bounding box in the form of [south, west, north, east]. Args: @@ -482,7 +482,7 @@ def add_vector( self, filename:str, layer_name:Optional[str]="Untitled", - bbox:Optional[Union[Tuple, GeoDataFrame, GeoSeries, shapely.geometry.base.BaseGeometry]]=None, + bbox:Optional[Union[tuple, GeoDataFrame, GeoSeries, shapely.geometry.base.BaseGeometry]]=None, mask:Optional[Union[Dict, GeoDataFrame, GeoSeries, shapely.geometry.base.BaseGeometry]]=None, rows:Optional[Union[int, slice]]=None, style:Optional[Dict]=None, diff --git a/leafmap/osm.py b/leafmap/osm.py index 8ea0b03059..e4e6d2ed24 100644 --- a/leafmap/osm.py +++ b/leafmap/osm.py @@ -515,7 +515,7 @@ def osm_geojson_from_place( def osm_gdf_from_point( - center_point: Tuple[float, float], tags: Dict, dist: Optional[int] = 1000 + center_point: tuple[float, float], tags: Dict, dist: Optional[int] = 1000 ): """Create GeoDataFrame of OSM entities within some distance N, S, E, W of a point. @@ -535,7 +535,7 @@ def osm_gdf_from_point( def osm_shp_from_point( - center_point: Tuple[float, float], + center_point: tuple[float, float], tags: Dict, filepath: str, dist: Optional[int] = 1000, @@ -553,7 +553,7 @@ def osm_shp_from_point( def osm_geojson_from_point( - center_point: Tuple[float, float], + center_point: tuple[float, float], tags: Dict, filepath: str = None, dist: Optional[int] = 1000,