Skip to content
  • Frank Bessou's avatar
    mypy: Use protocol to declare type of translation function · a785fee4735d
    Frank Bessou authored
    1. Define a custom type: TranslationFunction:
    This depends on `Protocol` which is only available on python >= 3.8.
    `typing_extensions` provides it for lower versions.
    
    2. Update get_description function signature:
    For `tr` parameter, Use TranslationFunction instead of Callable[[str, str], str]
    
    3. get_description signature redefined, stop ignoring call-arg errors
    a785fee4735d