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/testing | |
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/testing')
-rw-r--r-- | src/buildstream/testing/__init__.py | 2 | ||||
-rw-r--r-- | src/buildstream/testing/_utils/site.py | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/buildstream/testing/__init__.py b/src/buildstream/testing/__init__.py index 5a034cf30..3926b4eab 100644 --- a/src/buildstream/testing/__init__.py +++ b/src/buildstream/testing/__init__.py @@ -38,7 +38,7 @@ except ImportError: # Of the form plugin_name -> (repo_class, plugin_package) -ALL_REPO_KINDS = OrderedDict() +ALL_REPO_KINDS = OrderedDict() # type: OrderedDict[Repo, str] def create_repo(kind, directory, subdir='repo'): diff --git a/src/buildstream/testing/_utils/site.py b/src/buildstream/testing/_utils/site.py index d51d37525..b098b7d41 100644 --- a/src/buildstream/testing/_utils/site.py +++ b/src/buildstream/testing/_utils/site.py @@ -5,13 +5,14 @@ import os import subprocess import sys import platform +from typing import Optional # pylint: disable=unused-import from buildstream import _site, utils, ProgramNotFoundError from buildstream._platform import Platform try: - GIT = utils.get_host_tool('git') + GIT = utils.get_host_tool('git') # type: Optional[str] HAVE_GIT = True out = str(subprocess.check_output(['git', '--version']), "utf-8") @@ -33,7 +34,7 @@ except ProgramNotFoundError: GIT_ENV = dict() try: - BZR = utils.get_host_tool('bzr') + BZR = utils.get_host_tool('bzr') # type: Optional[str] HAVE_BZR = True BZR_ENV = { "BZR_EMAIL": "Testy McTesterson <testy.mctesterson@example.com>" |