Skip to content

Commit

Permalink
changed Tuple to tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
krishnaglodha committed Jul 17, 2023
1 parent 4cf157b commit 661b9e7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
16 changes: 8 additions & 8 deletions leafmap/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -7325,15 +7325,15 @@ 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,
add_progress_bar: bool = True,
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,
Expand All @@ -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.
Expand Down
18 changes: 9 additions & 9 deletions leafmap/foliumap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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().
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions leafmap/heremap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions leafmap/osm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 661b9e7

Please sign in to comment.