Skip to content

Commit b5d3d36

Browse files
authored
Type hints (#1677)
* Configure Mypy * Type hints in utilities.py * Type hints in folium.py * Type hints in map.py * Fix regression in Marker * Add Github Action Workflow for Mypy * fix type hint in map.py * Split test locations and multi-locations * Type hints in features.py * Type hints in vector_layers.py * Update elements.py * combine optional and union * fix regressions * Refactor TypeBounds * Type hints in raster_layers.py
1 parent 3964193 commit b5d3d36

File tree

11 files changed

+562
-361
lines changed

11 files changed

+562
-361
lines changed

.github/workflows/test_mypy.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Mypy type hint checks
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
run:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v3
11+
12+
- name: Setup Micromamba
13+
uses: mamba-org/provision-with-micromamba@v14
14+
with:
15+
environment-file: false
16+
17+
- name: Create env
18+
shell: bash -l {0}
19+
run: |
20+
micromamba create --name TEST python=${{ matrix.python-version }} --file requirements.txt --file requirements-dev.txt --channel conda-forge
21+
micromamba activate TEST
22+
python -m pip install -e . --no-deps --force-reinstall
23+
24+
- name: Selenium tests
25+
shell: bash -l {0}
26+
run: |
27+
micromamba activate TEST
28+
mypy folium

folium/elements.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1+
from typing import List, Tuple
2+
13
from branca.element import CssLink, Element, Figure, JavascriptLink
24

35

46
class JSCSSMixin(Element):
57
"""Render links to external Javascript and CSS resources."""
68

7-
default_js = []
8-
default_css = []
9+
default_js: List[Tuple[str, str]] = []
10+
default_css: List[Tuple[str, str]] = []
911

10-
def render(self, **kwargs):
12+
def render(self, **kwargs) -> None:
1113
figure = self.get_root()
1214
assert isinstance(
1315
figure, Figure

0 commit comments

Comments
 (0)