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

Improve kwargs typing in callbacks protocols #720

Merged
merged 4 commits into from
Mar 27, 2021
Merged

Improve kwargs typing in callbacks protocols #720

merged 4 commits into from
Mar 27, 2021

Commits on Mar 27, 2021

  1. Unquote callbacks as unspecific callables at runtime

    In a recent commit, callbacks were properly defined, but this required MyPy extensions (to be released in Python & typing_extensions on Python 3.10 release, presumably Oct'2021). The existence of these extensions required a conditional to avoid installing them at runtime (where they are not needed). Thus, in turn, required quoting (ForwardRef'ing) all references to callbacks.
    
    As a result, this broke IDE navigation, as PyCharm does not understand "quoted" types.
    
    To fix that, a little improvement is added: for runtime, define the same callback protocols, but with no arguments specified — make them just callables. This allows us to unquote the callback types and to use them both at runtime and type-checking time naturally.
    
    Signed-off-by: Sergey Vasilyev <[email protected]>
    nolar committed Mar 27, 2021
    Configuration menu
    Copy the full SHA
    e19bdce View commit details
    Browse the repository at this point in the history
  2. Apply Google Style Guide's importing notation

    Signed-off-by: Sergey Vasilyev <[email protected]>
    nolar committed Mar 27, 2021
    Configuration menu
    Copy the full SHA
    3cd12ee View commit details
    Browse the repository at this point in the history
  3. Export labels/annotations type declarations as readonly mappings

    Since annotations become readonly even in body essences, this requires stricter typing in storages.
    
    Signed-off-by: Sergey Vasilyev <[email protected]>
    nolar committed Mar 27, 2021
    Configuration menu
    Copy the full SHA
    ea4eba9 View commit details
    Browse the repository at this point in the history
  4. Accept both sync & async daemon stoppers in protocols

    Signed-off-by: Sergey Vasilyev <[email protected]>
    nolar committed Mar 27, 2021
    Configuration menu
    Copy the full SHA
    ea05caa View commit details
    Browse the repository at this point in the history