Skip to content

Commit 81e3c00

Browse files
committed
Update docstring and give hint for mypy
1 parent 2b66c89 commit 81e3c00

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

shiny/express/_is_express.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,16 @@ def find_magic_comment_mode(content: str) -> Literal["core", "express"] | None:
102102
Returns
103103
-------
104104
:
105-
`True` if Shiny Express comment is found, `False` if Shiny Core comment is
105+
`"express"` if Shiny Express comment is found, `"core"` if Shiny Core comment is
106106
found, and `None` if no magic comment is found.
107107
"""
108108
m = re.search(r"^#[ \t]*shiny_mode:[ \t]*(\S*)[ \t]*$", content, re.MULTILINE)
109109
if m is not None:
110110
shiny_mode = cast(str, m.group(1))
111111
if shiny_mode in ("express", "core"):
112-
return shiny_mode
112+
# The "type: ignore" is needed for mypy, which is used on some projects that
113+
# use duplicates of this code.
114+
return shiny_mode # type: ignore
113115
else:
114116
print(f'Invalid shiny_mode: "{shiny_mode}"', file=sys.stderr)
115117

0 commit comments

Comments
 (0)