Skip to content

Commit cf5f834

Browse files
authored
Merge pull request #1728 from ocefpaf/ruff
Use Ruff instead of pyflakes
2 parents 11187ff + 319d3bf commit cf5f834

File tree

9 files changed

+18
-71
lines changed

9 files changed

+18
-71
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ exclude: examples/data/|.*\.css|.*\.json|.*\.geojson|.*\.html
22

33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.3.0
5+
rev: v4.4.0
66
hooks:
77
- id: trailing-whitespace
88
- id: check-ast
@@ -14,22 +14,13 @@ repos:
1414
- id: file-contents-sorter
1515
files: requirements-dev.txt
1616

17-
- repo: https://github.com/PyCQA/flake8
18-
rev: 5.0.4
17+
- repo: https://github.com/charliermarsh/ruff-pre-commit
18+
rev: v0.0.247
1919
hooks:
20-
- id: flake8
21-
exclude: docs/conf.py
22-
args: [--max-line-length=120]
23-
24-
- repo: https://github.com/pycqa/isort
25-
rev: 5.12.0
26-
hooks:
27-
- id: isort
28-
additional_dependencies: [toml]
29-
args: ["--profile", "black", "--filter-files"]
20+
- id: ruff
3021

3122
- repo: https://github.com/psf/black
32-
rev: 22.10.0
23+
rev: 23.1.0
3324
hooks:
3425
- id: black
3526
language_version: python3
@@ -44,16 +35,9 @@ repos:
4435
hooks:
4536
- id: codespell
4637
args:
47-
- --ignore-words-list=thex
38+
- --ignore-words-list=thex,nd,fo,som,nam,tha
4839
exclude: >
4940
(?x)^(
5041
.*\.csv |
5142
.*\.json |
5243
)$
53-
54-
- repo: https://github.com/asottile/pyupgrade
55-
rev: v3.2.0
56-
hooks:
57-
- id: pyupgrade
58-
args:
59-
- --py36-plus

folium/__init__.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import sys
2-
31
import branca
42
from branca.colormap import ColorMap, LinearColormap, StepColormap
53
from branca.element import (
@@ -59,29 +57,6 @@
5957
)
6058

6159

62-
if sys.version_info < (3, 0):
63-
raise ImportError(
64-
"""You are running folium {} on Python 2
65-
66-
folium 0.9 and above are no longer compatible with Python 2, but somehow
67-
you got this version anyway. Make sure you have pip >= 9.0 to avoid this
68-
kind of issue, as well as setuptools >= 24.2:
69-
70-
$ pip install pip setuptools --upgrade
71-
72-
Your choices:
73-
74-
- Upgrade to Python 3.
75-
76-
- Install an older version of folium:
77-
78-
$ pip install 'folium<0.9.0'
79-
80-
""".format(
81-
__version__
82-
)
83-
) # noqa
84-
8560
__all__ = [
8661
"Choropleth",
8762
"ClickForMarker",

folium/folium.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565

6666

6767
class GlobalSwitches(Element):
68-
6968
_template = Template(
7069
"""
7170
<script>

folium/plugins/measure_control.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ def __init__(
5555
secondary_area_unit="acres",
5656
**kwargs
5757
):
58-
5958
super().__init__()
6059
self._name = "MeasureControl"
6160

folium/plugins/minimap.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ def __init__(
105105
minimized=False,
106106
**kwargs
107107
):
108-
109108
super().__init__()
110109
self._name = "MiniMap"
111110

folium/plugins/mouse_position.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ def __init__(
8585
lng_formatter=None,
8686
**kwargs
8787
):
88-
8988
super().__init__()
9089
self._name = "MousePosition"
9190

folium/raster_layers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ def __init__(
107107
opacity: float = 1,
108108
**kwargs
109109
):
110-
111110
# check for xyzservices.TileProvider without importing it
112111
if isinstance(tiles, dict):
113112
attr = attr if attr else tiles.html_attribution # type: ignore

pyproject.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,15 @@ color = true
1717

1818
[tool.mypy]
1919
ignore_missing_imports = true
20+
21+
[tool.ruff]
22+
select = [
23+
"F", # flakes
24+
"I", # import sorting
25+
"U", # upgrade
26+
]
27+
target-version = "py37"
28+
line-length = 120
29+
30+
[tool.ruff.per-file-ignores]
31+
"docs/conf.py" = ["E402"]

setup.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,9 @@
11
import os
2-
import sys
32

43
from setuptools import setup
54

65
rootpath = os.path.abspath(os.path.dirname(__file__))
76

8-
if sys.version_info < (3, 5):
9-
error = """
10-
folium 0.9+ supports Python 3.5 and above.
11-
When using Python 2.7, please install folium 0.8.*.
12-
13-
See folium `README.rst` file for more information:
14-
15-
https://github.com/python-visualization/folium/blob/main/README.rst
16-
17-
Python {py} detected.
18-
19-
Try upgrading pip and retry.
20-
""".format(
21-
py=".".join([str(v) for v in sys.version_info[:3]])
22-
)
23-
print(error, file=sys.stderr)
24-
sys.exit(1)
25-
267

278
def read(*parts):
289
return open(os.path.join(rootpath, *parts)).read()

0 commit comments

Comments
 (0)