Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Typing updates for recent mypy versions (#481)
* Remove redunant casts A version of mypy has been released which includes python/typeshed#6150. (Typeshed is vendored with mypy these days.) We can now remove the redundant cast. * Mark logging handler as a generic logging handler. Since python/typeshed#5681 (vendored in recent mypy releases), StreamHandler is now generic over its stream. This causes us pain: > Missing type parameters for generic type "StreamHandler" And I couldn't find a satisfactory type parameter that worked here. - a `TimedRotatingFileHandler` instance is a `FileHandler` which is a `StreamHandler[TextIOWrapper]`. - the instance `StreamHandler()` (which writes to stdout) is overloaded to be a `StreamHandler[TextIO]` `handler: StreamHandler[TextIO]` didn't work. I don't fully understand the difference between the concrete TextIOWrapper and the abstract TextIO (the former looks to be compatible with the latter?). I think the StreamHandler type parameter would need to be covariant for this to work. In any case, we're not making use of any of the stream or file specific attributes here. So let's just mark it as a general `Handler`.
- Loading branch information
David Robertson
committed
Jan 5, 2022
1 parent
347b9f5
commit abc63a7
Showing
4 changed files
with
7 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Update type annotations to ensure Sydent typechecks with recent mypy versions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters