Skip to content

Commit

Permalink
fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
zsol committed Jul 16, 2023
1 parent e381609 commit 6f473b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions py_wtf/indexer/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ def handle_string_like(
contents = node.evaluated_value
if not contents:
return dumb_annotation(node)
if isinstance(contents, bytes):
contents = contents.decode()
try:
return self(cst.parse_expression(contents))
except Exception as e:
Expand Down
5 changes: 4 additions & 1 deletion py_wtf/indexer/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ def extract_docstring(node: cst.Module | cst.BaseSuite) -> list[Documentation]:
docstring = cast(cst.SimpleString, match["docstring"])
docstring_quotes = {'"""', "'''"}
if any(docstring.value.startswith(quote) for quote in docstring_quotes):
return [convert_to_myst(docstring.evaluated_value)]
value = docstring.evaluated_value
if isinstance(value, bytes):
value = value.decode()
return [convert_to_myst(value)]
return []


Expand Down

0 comments on commit 6f473b5

Please sign in to comment.