diff options
author | Chandan Singh <chandan@chandansingh.net> | 2019-06-30 02:43:56 +0100 |
---|---|---|
committer | Chandan Singh <chandan@chandansingh.net> | 2019-09-02 21:56:34 +0100 |
commit | 419a3afbe6e774c9182001977874c8ea08a9f49d (patch) | |
tree | 18d3c0f24179ae843caa76db46d4c38478e81dd7 /src/buildstream/_options | |
parent | 3641578dcac7bd514f8e074835841f381a36c877 (diff) | |
download | buildstream-419a3afbe6e774c9182001977874c8ea08a9f49d.tar.gz |
Add initial mypy configuration and types
As a first step, add type hints to variables whose type `mypy` cannot
infer automatically. This is the minimal set of type hints that allow
running `mypy` without any arguments, and having it not fail.
We currently ignore C extensions that mypy can't process directly.
Later, we can look into generating stubs for such modules (potentially
automatically).
Diffstat (limited to 'src/buildstream/_options')
-rw-r--r-- | src/buildstream/_options/option.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/buildstream/_options/option.py b/src/buildstream/_options/option.py index da1191310..51017be22 100644 --- a/src/buildstream/_options/option.py +++ b/src/buildstream/_options/option.py @@ -17,8 +17,13 @@ # Authors: # Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> +from typing import TYPE_CHECKING + from ..node import _assert_symbol_name +if TYPE_CHECKING: + from typing import Optional + # Shared symbols for validation purposes # @@ -41,7 +46,7 @@ class Option(): # Subclasses use this to specify the type name used # for the yaml format and error messages - OPTION_TYPE = None + OPTION_TYPE = None # type: Optional[str] def __init__(self, name, definition, pool): self.name = name |