diff --git a/mypy/hooks.py b/mypy/hooks.py index 55e04dbeedd6e..47740bfa5a991 100644 --- a/mypy/hooks.py +++ b/mypy/hooks.py @@ -73,6 +73,9 @@ def locate(path: str) -> Optional[object]: class Hook(Generic[T]): + """ + Holds a single hook function and its options dictionary + """ def __init__(self) -> None: self.func = None # type: T @@ -87,6 +90,9 @@ def __ne__(self, other: object) -> bool: def __repr__(self) -> str: return 'Hook({}, {})'.format(self.func, self.options) + def __bool__(self) -> bool: + return self.func is not None + # The docstring_parser hook is called for each unannotated function that has a # docstring. The callable should accept four arguments: @@ -108,6 +114,10 @@ def __repr__(self) -> str: class Hooks: + """ + Holds all known hooks + """ + def __init__(self) -> None: self.docstring_parser = DocstringParserHook()