Skip to content

Commit 2fe7a6f

Browse files
committed
WIP: Fix ci pipeline
- Reformat files with `black` - Update dependencies. E.g. jsmin -> 3.0.1 as this version removes the use_2to3, which creates issues with latest setuptools
1 parent 8d91cf2 commit 2fe7a6f

File tree

6 files changed

+558
-414
lines changed

6 files changed

+558
-414
lines changed

examples/example_2.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ def map_created_in_view():
5757
)
5858

5959
# print(get_address(api, 22.4761596, 88.4149326))
60-
return render_template("example_2.html", dmap=dmap, gmap=gmap, wmap=wmap, key=api)
60+
return render_template(
61+
"example_2.html", dmap=dmap, gmap=gmap, wmap=wmap, key=api
62+
)
6163

6264

6365
if __name__ == "__main__":

examples/simple.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
"glyph": "",
1313
"scale": 2.0,
1414
}
15-
image_content = {"icon_urls": "https://img.shields.io/badge/PayPal-Donante-red.svg"}
15+
image_content = {
16+
"icon_urls": "https://img.shields.io/badge/PayPal-Donante-red.svg"
17+
}
1618

1719

1820
@app.route("/")

flask_googlemaps/__init__.py

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,19 @@ def build_rectangle_dict(
213213
"stroke_weight": stroke_weight,
214214
"fill_color": fill_color,
215215
"fill_opacity": fill_opacity,
216-
"bounds": {"north": north, "west": west, "south": south, "east": east},
216+
"bounds": {
217+
"north": north,
218+
"west": west,
219+
"south": south,
220+
"east": east,
221+
},
217222
}
218223

219224
return rectangle
220225

221-
def add_rectangle(self, north=None, west=None, south=None, east=None, **kwargs):
226+
def add_rectangle(
227+
self, north=None, west=None, south=None, east=None, **kwargs
228+
):
222229
# type: (Optional[float], Optional[float], Optional[float], Optional[float], **Any) -> None
223230
"""Adds a rectangle dict to the Map.rectangles attribute
224231
@@ -254,7 +261,9 @@ def add_rectangle(self, north=None, west=None, south=None, east=None, **kwargs):
254261
if east:
255262
kwargs["bounds"]["east"] = east
256263

257-
if set(("north", "east", "south", "west")) != set(kwargs["bounds"].keys()):
264+
if set(("north", "east", "south", "west")) != set(
265+
kwargs["bounds"].keys()
266+
):
258267
raise AttributeError("rectangle bounds required to rectangles")
259268

260269
kwargs.setdefault("stroke_color", "#FF0000")
@@ -303,7 +312,9 @@ def build_circles(self, circles):
303312
elif isinstance(circle, (tuple, list)):
304313
if len(circle) != 3:
305314
raise AttributeError("circle requires center and radius")
306-
circle_dict = self.build_circle_dict(circle[0], circle[1], circle[2])
315+
circle_dict = self.build_circle_dict(
316+
circle[0], circle[1], circle[2]
317+
)
307318
self.add_circle(**circle_dict)
308319

309320
def build_circle_dict(
@@ -352,7 +363,9 @@ def build_circle_dict(
352363

353364
return circle
354365

355-
def add_circle(self, center_lat=None, center_lng=None, radius=None, **kwargs):
366+
def add_circle(
367+
self, center_lat=None, center_lng=None, radius=None, **kwargs
368+
):
356369
# type: (Optional[float], Optional[float], Optional[float], **Any) -> None
357370
"""Adds a circle dict to the Map.circles attribute
358371
@@ -720,7 +733,9 @@ def add_heatmap(self, lat=None, lng=None, **kwargs):
720733
if "lat" not in kwargs or "lng" not in kwargs:
721734
raise AttributeError("heatmap_data requires 'lat' and 'lng' values")
722735
if len(kwargs) > 2:
723-
raise AttributeError("heatmap_data can only contain 'lat' and 'lng' values")
736+
raise AttributeError(
737+
"heatmap_data can only contain 'lat' and 'lng' values"
738+
)
724739

725740
self.heatmap_data.append(kwargs)
726741

@@ -764,7 +779,9 @@ def as_json(self):
764779
@property
765780
def js(self):
766781
# type: () -> Markup
767-
return Markup(self.render("googlemaps/gmapjs.html", gmap=self, DEFAULT_PIN=""))
782+
return Markup(
783+
self.render("googlemaps/gmapjs.html", gmap=self, DEFAULT_PIN="")
784+
)
768785

769786
@property
770787
def html(self):
@@ -809,12 +826,24 @@ def get_address(API_KEY, lat, lon):
809826
+ "&key="
810827
+ API_KEY
811828
).json()
812-
add_dict["zip"] = response["results"][0]["address_components"][-1]["long_name"]
813-
add_dict["country"] = response["results"][0]["address_components"][-2]["long_name"]
814-
add_dict["state"] = response["results"][0]["address_components"][-3]["long_name"]
815-
add_dict["city"] = response["results"][0]["address_components"][-4]["long_name"]
816-
add_dict["locality"] = response["results"][0]["address_components"][-5]["long_name"]
817-
add_dict["road"] = response["results"][0]["address_components"][-6]["long_name"]
829+
add_dict["zip"] = response["results"][0]["address_components"][-1][
830+
"long_name"
831+
]
832+
add_dict["country"] = response["results"][0]["address_components"][-2][
833+
"long_name"
834+
]
835+
add_dict["state"] = response["results"][0]["address_components"][-3][
836+
"long_name"
837+
]
838+
add_dict["city"] = response["results"][0]["address_components"][-4][
839+
"long_name"
840+
]
841+
add_dict["locality"] = response["results"][0]["address_components"][-5][
842+
"long_name"
843+
]
844+
add_dict["road"] = response["results"][0]["address_components"][-6][
845+
"long_name"
846+
]
818847
add_dict["formatted_address"] = response["results"][0]["formatted_address"]
819848
return add_dict
820849

@@ -852,7 +881,9 @@ def init_app(self, app):
852881
app.add_template_global(googlemap_obj)
853882
app.add_template_filter(googlemap)
854883
app.add_template_global(googlemap)
855-
app.add_template_global(app.config.get("GOOGLEMAPS_KEY"), name="GOOGLEMAPS_KEY")
884+
app.add_template_global(
885+
app.config.get("GOOGLEMAPS_KEY"), name="GOOGLEMAPS_KEY"
886+
)
856887
app.add_template_global(set_googlemaps_loaded)
857888
app.add_template_global(is_googlemaps_loaded)
858889

0 commit comments

Comments
 (0)