zuul/zuul/lib
Monty Taylor fb8f5a44bd
Use mypy to do static type checking
python3 includes support for optional type annotations which can be used by
static analysis tools to perform type checking. The mypy tool is a
static type checking tool that can also infer type information in many
cases, but which will use explicit type information if it is present.

Add mypy to test-requirements and to the pep8 job so that our pep8 job
can do more analysis work and less with the code style.

To support this, there were a few places in the current codebase that
needed an explicit type hint. For variables/attributes in 3.5 this is done via
comments. There is a conditional import that was confusion that just got
marked with an 'ignore'.

Our ansible action and lookup plugins confuse mypi with the way they
import the ansible base classes. That's ok - they confuse us with that
too. The .pyi files are 'typeshed' files, which are a way that one can
provide static type annotations without putting the information into the
file itself. mypy will always prefer a .pyi file over a .py file (since
the point of them is to be external annotion/interface description) So
in order to get mypy to not barf on the ansible import weirdness, just
add a corresponding empty .pyi file. We could potentially actually put
interface descriptions in them - but I don't think there is very much
value in that.

It should be amusing to at least someone that we have to flake8: noqa
an import from typing that was done to provide a type hint in a comment.

Change-Id: I6c4ac3dcfc6fd990e6c6886749de147ad28389d1
2017-07-27 14:34:07 -05:00
..
__init__.py Initial commit. 2012-05-29 14:49:32 -07:00
clonemapper.py Remove use of six library 2017-06-19 10:34:57 -05:00
cloner.py Remove use of six library 2017-06-19 10:34:57 -05:00
commandsocket.py Remove use of six library 2017-06-19 10:34:57 -05:00
config.py config: refactor config get default 2017-06-17 02:00:50 +00:00
connections.py Merge "Add support for bwrap" into feature/zuulv3 2017-06-02 19:35:25 +00:00
encryption.py Augment references of pkcs1 with oaep 2017-03-29 12:44:45 -07:00
gearserver.py Ansible launcher: add private gearman function 2016-06-13 09:33:00 -07:00
log_streamer.py Merge "Add web-based console log streaming" into feature/zuulv3 2017-07-10 20:09:21 +00:00
yamlutil.py Use mypy to do static type checking 2017-07-27 14:34:07 -05:00