Skip to content
New issue

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

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

Already on GitHub? # to your account

Add type information to LoggingContext.__call__ #79

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Feb 6, 2024

  1. Add type information to LoggingContext.__call__

    Adds a `DecoratedCallable` TypeVar and uses that in the type hints for the
    `__call__` method in `LoggingContext`. This allows type information to pass
    through correctly when used as a decorator.
    
    It seems like the `@wraps` decorator on the wrapper mangles the type info so I
    had to disable type checking on the return because Pyright was convinced it was
    wasn't the correct type, but the tests proved otherwise.
    
    I'm not sure there's a good way to test since at runtime the function signature
    is getting passed through correctly. It's only on the type checking pass that
    things break down. It's probably fine as-is since no tests broke as a result,
    but figured it was worth mentioning.
    
    Fixes tackle-io#60
    sapslaj committed Feb 6, 2024
    Configuration menu
    Copy the full SHA
    b8d9ed1 View commit details
    Browse the repository at this point in the history