Skip to content

Commit

Permalink
refactor: Revert "refactor: quench mypy errors" and update mypy
Browse files Browse the repository at this point in the history
This mostly reverts commit aa54382.

Instead of adding superfluous assertions, let's update mypy to the latest, which
has better parsers that recognize that `if mime[0]:` already guarantees that
`mime[0] is not None` holds.
  • Loading branch information
joanise committed Mar 17, 2022
1 parent aa54382 commit a874959
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ repos:
types: [python]
stages: [commit]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.782' # Use the sha / tag you want to point at
rev: 'v0.941' # Use the sha / tag you want to point at
hooks:
- id: mypy
2 changes: 0 additions & 2 deletions readalongs/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ 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 @@ -134,7 +133,6 @@ 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
Expand Down
1 change: 0 additions & 1 deletion readalongs/text/make_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ 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 a874959

Please sign in to comment.