Skip to content

Commit 8205089

Browse files
authored
Fix MyPy 0.800 errors in Markdown plugin (#384)
1 parent a1cd67d commit 8205089

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

webviz_config/generic_plugins/_markdown.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def __init__(self, image_link_re: str, md: markdown.core.Markdown, base_path: Pa
3434

3535
super().__init__(image_link_re, md)
3636

37-
def handleMatch(self, m, data: str) -> tuple: # type: ignore[no-untyped-def]
37+
def handleMatch(self, m, data: str) -> tuple: # type: ignore[no-untyped-def, override]
3838
image, start, index = super().handleMatch(m, data)
3939

4040
if image is None or not image.get("title"):
@@ -43,7 +43,7 @@ def handleMatch(self, m, data: str) -> tuple: # type: ignore[no-untyped-def]
4343
src = image.get("src")
4444
caption = image.get("title")
4545

46-
if src.startswith("http"):
46+
if src is None or src.startswith("http"):
4747
raise ValueError(
4848
f"Image path {src} has been given. Only images "
4949
"available on the file system can be added."
@@ -57,7 +57,7 @@ def handleMatch(self, m, data: str) -> tuple: # type: ignore[no-untyped-def]
5757
url = WEBVIZ_ASSETS.add(image_path)
5858

5959
image_style = ""
60-
for style_prop in image.get("alt").split(","):
60+
for style_prop in image.get("alt", default="").split(","):
6161
prop, value = style_prop.split("=")
6262
if prop == "width":
6363
image_style += f"width: {value};"

0 commit comments

Comments
 (0)