Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typing updates for recent mypy versions #481

Merged
merged 4 commits into from Jan 5, 2022
Merged

Commits on Jan 5, 2022

  1. 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.
    David Robertson committed Jan 5, 2022
    Configuration menu
    Copy the full SHA
    cdc0c66 View commit details
    Browse the repository at this point in the history
  2. 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`.
    David Robertson committed Jan 5, 2022
    Configuration menu
    Copy the full SHA
    cf9e62d View commit details
    Browse the repository at this point in the history
  3. Changelog

    David Robertson committed Jan 5, 2022
    Configuration menu
    Copy the full SHA
    b33536d View commit details
    Browse the repository at this point in the history
  4. Remove unused imports

    David Robertson committed Jan 5, 2022
    Configuration menu
    Copy the full SHA
    57398d8 View commit details
    Browse the repository at this point in the history