Skip to content

Commit defc468

Browse files
switch from black to ruff-format (#1059)
* switch from black to ruff-format * update ruff version
1 parent 3bc2465 commit defc468

30 files changed

+402
-414
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,21 @@ repos:
44
hooks:
55
- id: validate-pyproject
66

7-
- repo: https://github.com/psf/black
8-
rev: 22.12.0
9-
hooks:
10-
- id: black
11-
language_version: python
12-
137
- repo: https://github.com/PyCQA/isort
148
rev: 5.12.0
159
hooks:
1610
- id: isort
1711
language_version: python
1812

19-
- repo: https://github.com/charliermarsh/ruff-pre-commit
20-
rev: v0.0.238
13+
- repo: https://github.com/astral-sh/ruff-pre-commit
14+
rev: v0.8.4
2115
hooks:
2216
- id: ruff
2317
args: ["--fix"]
18+
- id: ruff-format
2419

2520
- repo: https://github.com/pre-commit/mirrors-mypy
26-
rev: v1.3.0
21+
rev: v1.11.2
2722
hooks:
2823
- id: mypy
2924
language_version: python

docs/src/examples/notebooks/Working_with_Algorithm.ipynb

Lines changed: 36 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939
"metadata": {},
4040
"outputs": [],
4141
"source": [
42-
"titiler_endpoint = \"https://titiler.xyz\" # Developmentseed Demo endpoint. Please be kind."
42+
"titiler_endpoint = (\n",
43+
" \"https://titiler.xyz\" # Developmentseed Demo endpoint. Please be kind.\n",
44+
")"
4345
]
4446
},
4547
{
@@ -70,9 +72,9 @@
7072
"# Fetch dataset Metadata\n",
7173
"r = httpx.get(\n",
7274
" f\"{titiler_endpoint}/cog/info\",\n",
73-
" params = {\n",
75+
" params={\n",
7476
" \"url\": url,\n",
75-
" }\n",
77+
" },\n",
7678
").json()\n",
7779
"\n",
7880
"print(r)"
@@ -97,21 +99,19 @@
9799
"source": [
98100
"r = httpx.get(\n",
99101
" f\"{titiler_endpoint}/cog/WebMercatorQuad/tilejson.json\",\n",
100-
" params = {\n",
102+
" params={\n",
101103
" \"url\": url,\n",
102-
" }\n",
104+
" },\n",
103105
").json()\n",
104106
"\n",
105107
"bounds = r[\"bounds\"]\n",
106108
"m = Map(\n",
107-
" location=((bounds[1] + bounds[3]) / 2,(bounds[0] + bounds[2]) / 2),\n",
108-
" zoom_start=r[\"minzoom\"]\n",
109+
" location=((bounds[1] + bounds[3]) / 2, (bounds[0] + bounds[2]) / 2),\n",
110+
" zoom_start=r[\"minzoom\"],\n",
109111
")\n",
110112
"\n",
111113
"TileLayer(\n",
112-
" tiles=r[\"tiles\"][0],\n",
113-
" opacity=1,\n",
114-
" attr=\"Office fédéral de topographie swisstopo\"\n",
114+
" tiles=r[\"tiles\"][0], opacity=1, attr=\"Office fédéral de topographie swisstopo\"\n",
115115
").add_to(m)\n",
116116
"m"
117117
]
@@ -127,24 +127,22 @@
127127
"source": [
128128
"r = httpx.get(\n",
129129
" f\"{titiler_endpoint}/cog/WebMercatorQuad/tilejson.json\",\n",
130-
" params = {\n",
130+
" params={\n",
131131
" \"url\": url,\n",
132132
" # rio-tiler cannot rescale automatically the data when using a colormap\n",
133133
" \"rescale\": \"1615.812,2015.09448\",\n",
134134
" \"colormap_name\": \"terrain\",\n",
135-
" }\n",
135+
" },\n",
136136
").json()\n",
137137
"\n",
138138
"bounds = r[\"bounds\"]\n",
139139
"m = Map(\n",
140-
" location=((bounds[1] + bounds[3]) / 2,(bounds[0] + bounds[2]) / 2),\n",
141-
" zoom_start=r[\"minzoom\"]\n",
140+
" location=((bounds[1] + bounds[3]) / 2, (bounds[0] + bounds[2]) / 2),\n",
141+
" zoom_start=r[\"minzoom\"],\n",
142142
")\n",
143143
"\n",
144144
"aod_layer = TileLayer(\n",
145-
" tiles=r[\"tiles\"][0],\n",
146-
" opacity=1,\n",
147-
" attr=\"Office fédéral de topographie swisstopo\"\n",
145+
" tiles=r[\"tiles\"][0], opacity=1, attr=\"Office fédéral de topographie swisstopo\"\n",
148146
")\n",
149147
"aod_layer.add_to(m)\n",
150148
"m"
@@ -200,26 +198,22 @@
200198
"source": [
201199
"r = httpx.get(\n",
202200
" f\"{titiler_endpoint}/cog/WebMercatorQuad/tilejson.json\",\n",
203-
" params = {\n",
201+
" params={\n",
204202
" \"url\": url,\n",
205203
" \"algorithm\": \"hillshade\",\n",
206204
" # Hillshade algorithm use a 3pixel buffer so we need\n",
207205
" # to tell the tiler to apply a 3 pixel buffer around each tile\n",
208206
" \"buffer\": 3,\n",
209-
" }\n",
207+
" },\n",
210208
").json()\n",
211209
"\n",
212210
"bounds = r[\"bounds\"]\n",
213211
"m = Map(\n",
214-
" location=((bounds[1] + bounds[3]) / 2,(bounds[0] + bounds[2]) / 2),\n",
215-
" zoom_start=r[\"minzoom\"]\n",
212+
" location=((bounds[1] + bounds[3]) / 2, (bounds[0] + bounds[2]) / 2),\n",
213+
" zoom_start=r[\"minzoom\"],\n",
216214
")\n",
217215
"\n",
218-
"aod_layer = TileLayer(\n",
219-
" tiles=r[\"tiles\"][0],\n",
220-
" opacity=1,\n",
221-
" attr=\"Yo!!\"\n",
222-
")\n",
216+
"aod_layer = TileLayer(tiles=r[\"tiles\"][0], opacity=1, attr=\"Yo!!\")\n",
223217
"aod_layer.add_to(m)\n",
224218
"m"
225219
]
@@ -241,31 +235,27 @@
241235
"source": [
242236
"r = httpx.get(\n",
243237
" f\"{titiler_endpoint}/cog/WebMercatorQuad/tilejson.json\",\n",
244-
" params = {\n",
238+
" params={\n",
245239
" \"url\": url,\n",
246240
" \"algorithm\": \"contours\",\n",
247241
" \"algorithm_params\": json.dumps(\n",
248242
" {\n",
249-
" \"increment\": 20, # contour line every 20 meters\n",
250-
" \"thickness\": 2, # 2m thickness\n",
243+
" \"increment\": 20, # contour line every 20 meters\n",
244+
" \"thickness\": 2, # 2m thickness\n",
251245
" \"minz\": 1600,\n",
252-
" \"maxz\": 2000\n",
246+
" \"maxz\": 2000,\n",
253247
" }\n",
254248
" ),\n",
255-
" }\n",
249+
" },\n",
256250
").json()\n",
257251
"\n",
258252
"bounds = r[\"bounds\"]\n",
259253
"m = Map(\n",
260-
" location=((bounds[1] + bounds[3]) / 2,(bounds[0] + bounds[2]) / 2),\n",
261-
" zoom_start=r[\"minzoom\"]\n",
254+
" location=((bounds[1] + bounds[3]) / 2, (bounds[0] + bounds[2]) / 2),\n",
255+
" zoom_start=r[\"minzoom\"],\n",
262256
")\n",
263257
"\n",
264-
"TileLayer(\n",
265-
" tiles=r[\"tiles\"][0],\n",
266-
" opacity=1,\n",
267-
" attr=\"Yo!!\"\n",
268-
").add_to(m)\n",
258+
"TileLayer(tiles=r[\"tiles\"][0], opacity=1, attr=\"Yo!!\").add_to(m)\n",
269259
"m"
270260
]
271261
},
@@ -278,31 +268,27 @@
278268
"source": [
279269
"r = httpx.get(\n",
280270
" f\"{titiler_endpoint}/cog/WebMercatorQuad/tilejson.json\",\n",
281-
" params = {\n",
271+
" params={\n",
282272
" \"url\": url,\n",
283273
" \"algorithm\": \"contours\",\n",
284274
" \"algorithm_params\": json.dumps(\n",
285275
" {\n",
286-
" \"increment\": 5, # contour line every 5 meters\n",
287-
" \"thickness\": 1, # 1m thickness\n",
276+
" \"increment\": 5, # contour line every 5 meters\n",
277+
" \"thickness\": 1, # 1m thickness\n",
288278
" \"minz\": 1600,\n",
289-
" \"maxz\": 2000\n",
279+
" \"maxz\": 2000,\n",
290280
" }\n",
291281
" ),\n",
292-
" }\n",
282+
" },\n",
293283
").json()\n",
294284
"\n",
295285
"bounds = r[\"bounds\"]\n",
296286
"m = Map(\n",
297-
" location=((bounds[1] + bounds[3]) / 2,(bounds[0] + bounds[2]) / 2),\n",
298-
" zoom_start=r[\"minzoom\"]\n",
287+
" location=((bounds[1] + bounds[3]) / 2, (bounds[0] + bounds[2]) / 2),\n",
288+
" zoom_start=r[\"minzoom\"],\n",
299289
")\n",
300290
"\n",
301-
"TileLayer(\n",
302-
" tiles=r[\"tiles\"][0],\n",
303-
" opacity=1,\n",
304-
" attr=\"Yo!!\"\n",
305-
").add_to(m)\n",
291+
"TileLayer(tiles=r[\"tiles\"][0], opacity=1, attr=\"Yo!!\").add_to(m)\n",
306292
"m"
307293
]
308294
},

0 commit comments

Comments
 (0)