Skip to content

Commit cf0e881

Browse files
committed
Updated after review comments
1 parent 74dadcb commit cf0e881

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

folium/features.py

+9
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
Sequence,
1818
Tuple,
1919
Union,
20+
get_args,
2021
)
2122

2223
import numpy as np
@@ -43,6 +44,7 @@
4344
TypeJsonValue,
4445
TypeLine,
4546
TypePathOptions,
47+
TypePosition,
4648
_parse_size,
4749
escape_backticks,
4850
get_bounds,
@@ -2045,11 +2047,18 @@ def __init__(
20452047
self,
20462048
control: Optional[str] = None,
20472049
*args,
2050+
position: Optional[TypePosition] = None,
20482051
**kwargs,
20492052
):
20502053
super().__init__()
20512054
if control:
20522055
self._name = control
20532056

2057+
if position:
2058+
position = position.lower()
2059+
if position not in (args := get_args(TypePosition)):
2060+
raise TypeError(f"position must be one of {args}")
2061+
kwargs["position"] = position
2062+
20542063
self.args = args
20552064
self.options = remove_empty(**kwargs)

folium/utilities.py

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
Iterable,
1717
Iterator,
1818
List,
19+
Literal,
1920
Optional,
2021
Sequence,
2122
Tuple,
@@ -57,6 +58,7 @@
5758
TypeBoundsReturn = List[List[Optional[float]]]
5859

5960
TypeContainer = Union[Figure, Div, "Popup"]
61+
TypePosition = Literal["bottomright", "bottomleft", "topright", "topleft"]
6062

6163

6264
_VALID_URLS = set(uses_relative + uses_netloc + uses_params)

0 commit comments

Comments
 (0)