Skip to content

Commit

Permalink
refactor: quench mypy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
joanise committed Mar 17, 2022
1 parent 158a44e commit aa54382
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion readalongs/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def align(
**kwargs
)

assert cli.align.callback is not None # to make mypy happy
cli.align.callback(**align_args)

return (0, None, logging_stream.getvalue())
Expand Down Expand Up @@ -133,10 +134,11 @@ def prepare(
),
**kwargs
)
assert cli.prepare.callback is not None # to make mypy happy
cli.prepare.callback(**prepare_args)
except OSError as e:
# e.g.: FileNotFoundError or PermissionError on open(plaintextfile) above
raise click.UsageError(e) from e
raise click.UsageError(str(e)) from e

return (0, None, logging_stream.getvalue())
except Exception as e:
Expand Down
1 change: 1 addition & 0 deletions readalongs/text/make_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def encode_from_path(path: str) -> str:
# TODO: Check other popular audio formats, .wav, .mp3, .ogg, etc...
mime_type = "audio/mp4"
elif mime[0]:
assert mime[0] is not None # keep mypy happy. Q why is `if mime[0]` not enough?
mime_type = mime[0].replace(
"video", "audio"
) # Hack: until we properly extract audio from video files, force any video-based mime type to be read as audio
Expand Down

0 comments on commit aa54382

Please sign in to comment.