Skip to content

Commit

Permalink
linter
Browse files Browse the repository at this point in the history
  • Loading branch information
chrieke committed Apr 23, 2024
1 parent bc13b1d commit 8d97f7a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
20 changes: 10 additions & 10 deletions prettymapp/tests/test_geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ def test_get_aoi_from_user_input_address(ox_geocode):
assert isinstance(poly, Polygon)
assert poly.bounds == (
13.373621926483281,
52.507705884952586,
13.403083847278062,
52.52567909987013,
52.50770588495259,
13.40308384727806,
52.525679099870146,
)
assert poly.area == 0.00041542753985753124
assert poly.area == 0.000415427539857519


@patch.object(ox, "geocode")
Expand All @@ -45,9 +45,9 @@ def test_get_aoi_from_user_input_coordinates(ox_geocode):
assert isinstance(poly, Polygon)
assert poly.bounds == (
13.38526793559592,
52.51101333875345,
52.511013338753465,
13.414732236942758,
52.52898664609028,
52.52898664609029,
)


Expand All @@ -59,11 +59,11 @@ def test_get_aoi_from_user_input_rectangle(ox_geocode):
assert isinstance(poly, Polygon)
assert poly.bounds == (
13.373621926483281,
52.507705884952586,
13.403083847278062,
52.52567909987013,
52.50770588495259,
13.40308384727806,
52.525679099870146,
)
assert poly.area == 0.0005295254343283185
assert poly.area == 0.0005295254343284959


@pytest.mark.live
Expand Down
6 changes: 3 additions & 3 deletions streamlit-prettymapp/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
)
st.markdown("# Prettymapp")

with open("./streamlit-prettymapp/examples.json", "r") as f:
with open("./streamlit-prettymapp/examples.json", "r", encoding="utf8") as f:
EXAMPLES = json.load(f)

if not st.session_state:
Expand Down Expand Up @@ -61,7 +61,7 @@
key="radius",
)

style = col3.selectbox(
style: str = col3.selectbox(
"Color theme",
options=list(STYLES.keys()),
key="style",
Expand Down Expand Up @@ -148,7 +148,7 @@
)

if style != st.session_state["previous_style"]:
st.session_state.update(get_colors_from_style(style))
st.session_state.update(get_colors_from_style(style)) # type: ignore
draw_settings = copy.deepcopy(STYLES[style])
for lc_class in st.session_state.lc_classes:
picked_color = col3style.color_picker(lc_class, key=lc_class)
Expand Down
2 changes: 1 addition & 1 deletion streamlit-prettymapp/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
streamlit==1.32.2
streamlit==1.33.0
streamlit-image-select==0.6.0
prettymapp
6 changes: 2 additions & 4 deletions streamlit-prettymapp/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ def plt_to_svg(fig: figure) -> str:
def svg_to_html(svg_string: str) -> str:
b64 = base64.b64encode(svg_string.encode("utf-8")).decode("utf-8")
css_justify = "center"
css = '<p style="text-align:center; display: flex; flex-direction: column; justify-content: {};">'.format(
css_justify
)
html = r'{}<img src="data:image/svg+xml;base64,{}"/>'.format(css, b64)
css = f'<p style="text-align:center; display: flex; flex-direction: column; justify-content: {css_justify};">'
html = rf'{css}<img src="data:image/svg+xml;base64,{b64}"/>'
return html


Expand Down

0 comments on commit 8d97f7a

Please sign in to comment.