Skip to content

Commit dabc682

Browse files
committed
Code lint
1 parent 5589c2b commit dabc682

File tree

2 files changed

+27
-19
lines changed

2 files changed

+27
-19
lines changed

merge_proxy/merge_proxy/server.py

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333

3434

3535
config_by_key: Dict[str, Dict[str, Any]] = defaultdict(dict)
36-
for (config_id, config_source) in config["sources"].items():
36+
for config_id, config_source in config["sources"].items():
3737
config_by_key[config_source["key"]][config_id] = config_source
3838

3939
style_by_key: Dict[str, Dict[str, Any]] = defaultdict(dict)
40-
for (config_id, config_source) in config["sources"].items():
41-
for (style_id, style_config) in (config_source.get("styles") or {}).items():
40+
for config_id, config_source in config["sources"].items():
41+
for style_id, style_config in (config_source.get("styles") or {}).items():
4242
style_by_key[config_source["key"]][style_id] = {
4343
"config_id": config_id,
4444
"style_config": style_config,
@@ -105,8 +105,8 @@ class MergeConfig(object):
105105

106106

107107
merge_config: Dict[str, Dict[str, Any]] = defaultdict(dict)
108-
for (key, source_id_confs) in config_by_key.items():
109-
for (source_id, source_conf) in source_id_confs.items():
108+
for key, source_id_confs in config_by_key.items():
109+
for source_id, source_conf in source_id_confs.items():
110110
try:
111111
tile_in_poly = None
112112
polygon_path = config_path + source_id + ".geojson"
@@ -241,20 +241,22 @@ async def style(style_id: str, key: str, request: Request):
241241

242242
style_gl = StyleGL(
243243
url=style_config["url"],
244-
overwrite={
245-
"sources": {
246-
style_config["merged_source"]: {
247-
"type": "vector",
248-
"url": public_url(request)
249-
+ public_base_path
250-
+ app.url_path_for("tilejson", data_id=id)
251-
+ "?"
252-
+ str(request.query_params),
244+
overwrite=(
245+
{
246+
"sources": {
247+
style_config["merged_source"]: {
248+
"type": "vector",
249+
"url": public_url(request)
250+
+ public_base_path
251+
+ app.url_path_for("tilejson", data_id=id)
252+
+ "?"
253+
+ str(request.query_params),
254+
}
253255
}
254256
}
255-
}
256-
if style_config.get("merged_source")
257-
else {},
257+
if style_config.get("merged_source")
258+
else {}
259+
),
258260
)
259261

260262
if style_config.get("sprite"):

merge_proxy/merge_proxy/style.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import difflib
22
from dataclasses import dataclass, field
3-
from typing import Any, Dict, List, Optional, Set, cast
3+
from typing import Any, Callable, Dict, List, Optional, Set, cast
44

55
import requests
66
from mergedeep import merge as mergedeep
@@ -173,7 +173,13 @@ def apply_patch(self, patch: StyleGLStylePatch):
173173
# Layer patch
174174
if patch.layers:
175175
self._gljson["layers"] = list(
176-
filter(lambda layer: layer["id"] not in patch.layers.delete, self.layers())
176+
filter(
177+
cast(
178+
Callable[[Layer], bool],
179+
lambda layer: layer["id"] not in patch.layers.delete,
180+
),
181+
self.layers(),
182+
)
177183
)
178184
edited_map = {layer["id"]: layer for layer in patch.layers.edited}
179185
self._gljson["layers"] = list(

0 commit comments

Comments
 (0)