Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Make scripts-dev pass mypy --disallow-untyped-defs #12356

Merged
merged 14 commits into from
Apr 27, 2022

Commits on Apr 20, 2022

  1. Typecheck build_debian_packages

    David Robertson committed Apr 20, 2022
    Configuration menu
    Copy the full SHA
    3833322 View commit details
    Browse the repository at this point in the history
  2. Typecheck federation_client.py

    David Robertson committed Apr 20, 2022
    Configuration menu
    Copy the full SHA
    9310352 View commit details
    Browse the repository at this point in the history
  3. Typecheck sign_json

    David Robertson committed Apr 20, 2022
    Configuration menu
    Copy the full SHA
    d955162 View commit details
    Browse the repository at this point in the history
  4. Easy type fixes for the release script

    David Robertson committed Apr 20, 2022
    Configuration menu
    Copy the full SHA
    79a5ab9 View commit details
    Browse the repository at this point in the history
  5. Workaround a false positive about indexing into refs

    ```
    scripts-dev/release.py:495: error: Unsupported right operand type for in ("Callable[[], IterableList[Reference]]")  [operator]
    scripts-dev/release.py:496: error: Value of type "Callable[[], IterableList[Reference]]" is not indexable  [index]
    ```
    
    `refs` is an alias the the property `references`. Mypy gets confused by
    the alias, see python/mypy#6700
    David Robertson committed Apr 20, 2022
    Configuration menu
    Copy the full SHA
    42c7b52 View commit details
    Browse the repository at this point in the history
  6. Get tracking branch to avoid a second None check

    Mypy can't see that `tracking_branch()` returning truthy means that the
    second call to `tracking_branch` returns a non-`None` value.
    
    A use for the walrus operator?
    David Robertson committed Apr 20, 2022
    Configuration menu
    Copy the full SHA
    c25e51d View commit details
    Browse the repository at this point in the history
  7. Assert away a complaint about LegacyVersion

    David Robertson committed Apr 20, 2022
    Configuration menu
    Copy the full SHA
    4cb3e76 View commit details
    Browse the repository at this point in the history
  8. Fix a complaint that click.edit can return None

    David Robertson committed Apr 20, 2022
    Configuration menu
    Copy the full SHA
    b2fe52a View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    41618ef View commit details
    Browse the repository at this point in the history
  10. Use set_reference over a write to .reference

    `.reference` is a property whose setter function is `set_reference`.
    My isn't happy when we try to assign directly:
    
    ```
    scripts-dev/release.py:208: error: Trying to assign name "reference" that is not in "__slots__" of type "git.refs.head.HEAD"  [misc]
    scripts-dev/release.py:208: error: Incompatible types in assignment (expression has type "HEAD", variable has type "Union[Head, TagReference, RemoteReference, Reference]")  [assignment]
    ```
    
    but calling `set_reference` ourselves makes the typechecker happy.
    
    Confusingly the following three types are all different:
    
    - the `refererence` property: `Union['Head', 'TagReference', 'RemoteReference', 'Reference']`
    - return type of `_get_reference`: `SymbolicReference`
    - `set_reference` first argument: `Union[Commit_ish, 'SymbolicReference', str]`
      where `Commit_ish = Union['Commit', 'TagObject', 'Blob', 'Tree']`
    
    It seems that typecheckers haven't settled down on The Way to handle
    properties whose getter and setter types differ: see e.g.
    python/mypy#3004 .
    David Robertson committed Apr 20, 2022
    Configuration menu
    Copy the full SHA
    dba3efc View commit details
    Browse the repository at this point in the history
  11. Changelog

    David Robertson committed Apr 20, 2022
    Configuration menu
    Copy the full SHA
    6b20e2d View commit details
    Browse the repository at this point in the history

Commits on Apr 27, 2022

  1. Comment to clarify the click.edit assertion

    David Robertson committed Apr 27, 2022
    Configuration menu
    Copy the full SHA
    9901aac View commit details
    Browse the repository at this point in the history
  2. Merge remote-tracking branch 'origin/develop' into dmr/typing-scripts…

    …-dev
    
    This includes the changes to the release script to make it work
    post-poetry.
    David Robertson committed Apr 27, 2022
    Configuration menu
    Copy the full SHA
    15dc9e2 View commit details
    Browse the repository at this point in the history
  3. Need a cast to safely narrow a union

    David Robertson committed Apr 27, 2022
    Configuration menu
    Copy the full SHA
    36c86a4 View commit details
    Browse the repository at this point in the history