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

Code cleanups from running type checking lints #11938

Merged
merged 7 commits into from
Jul 20, 2023

Commits on Jul 19, 2023

  1. Configuration menu
    Copy the full SHA
    3171fc5 View commit details
    Browse the repository at this point in the history
  2. linkers: reorganize code so that linker base classes always come first

    So that we can later reference them.
    eli-schwartz committed Jul 19, 2023
    Configuration menu
    Copy the full SHA
    ca34c76 View commit details
    Browse the repository at this point in the history
  3. linkers: fix mypy errors that were ignored due to lack of inheritance

    A linker mixin has to be able to align with the base linker it will be
    used for, in order to reference super(). Since they weren't inherited,
    calls to super() resulted in mypy errors, which we ignored, and casting.
    
    Use the same trick we use for compilers, and make the linker inherit
    from the base linker type when running under mypy, and from object at
    runtime.
    eli-schwartz committed Jul 19, 2023
    Configuration menu
    Copy the full SHA
    621264e View commit details
    Browse the repository at this point in the history
  4. mypy: add more mixin base classes

    These don't have new errors or old ignored ones, but add them anyway so
    we can generally validate their sanity.
    eli-schwartz committed Jul 19, 2023
    Configuration menu
    Copy the full SHA
    cfc3960 View commit details
    Browse the repository at this point in the history
  5. fix implicit_reexport issues and enforce them going forward

    This detects cases where module A imports a function from B, and C
    imports that same function from A instead of B. It's not part of the API
    contract of A, and causes innocent refactoring to break things.
    eli-schwartz committed Jul 19, 2023
    Configuration menu
    Copy the full SHA
    7afc692 View commit details
    Browse the repository at this point in the history
  6. avoid module indirection in name resolution for imported objects

    We already import a bunch of objects directly from ..build but don't use
    them nearly as much as we can. This resulted both in longer lines and s
    minor performance difference since python has to resolve the name
    binding the long way. There's no reason not to rewrite these names to
    use the direct imports.
    
    Found while investigating the fact that Executable was imported but
    never used. It's easier to just use it.
    eli-schwartz committed Jul 19, 2023
    Configuration menu
    Copy the full SHA
    cff2fb5 View commit details
    Browse the repository at this point in the history
  7. move various bits of type-checking only code to TYPE_CHECKING blocks

    Mostly detected with flake8-type-checking. Also quote T.cast() first
    arguments, since those are not affected by future annotations.
    eli-schwartz committed Jul 19, 2023
    Configuration menu
    Copy the full SHA
    0bb1647 View commit details
    Browse the repository at this point in the history