Add Python type hints
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 11 Aug 2020 18:33:35 +0000 (14:33 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 11 Aug 2020 18:33:35 +0000 (14:33 -0400)
commit2d55dc7d9471bef93c1e896d7c2a6b9ba0c4851a
tree8aab48cb33a4b28b264617831e26389e3176b149
parent93cfc11db14ebf4f5a2d98349cad494a57499156
Add Python type hints

This patch adds Python type hints to all the modules except
`codegen.py`, `gen.py`, and `tsdl182gen.py`, as it is likely that those
will change significantly in the future.

Mypy 0.782 reports no errors with this patch.

The few errors that were found during the type hint introduction process
are fixed as part of this patch.

`typing.py` is a new module which contains public and private type
aliases, mostly derivatives of `int` to add semantics (index, count,
version number, and the rest). The ones that are public are available
from the `barectf` package itself (`__init__.py`). A `barectf` API user
doesn't need to use them without static type checking needs. If she
wants to, then she must use `barectf` types explicitly, for example:

    import barectf

    clk_type = barectf.ClockType('my_clock',
                                 frequency=barectf.Count(100000))

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
barectf/__init__.py
barectf/argpar.py
barectf/cli.py
barectf/config.py
barectf/config_file.py
barectf/config_parse.py
barectf/config_parse_common.py
barectf/config_parse_v2.py
barectf/config_parse_v3.py
barectf/typing.py [new file with mode: 0644]
This page took 0.023864 seconds and 4 git commands to generate.