[libvirt PATCH v2 4/6] ci: Introduce a util module

Andrea Bolognani abologna at redhat.com
Wed Mar 17 17:11:32 UTC 2021


On Wed, 2021-03-17 at 18:05 +0100, Erik Skultety wrote:
> On Wed, Mar 17, 2021 at 05:06:33PM +0100, Andrea Bolognani wrote:
> > I don't know how to express that in terms of Python types
> > (List[Dict[str, Any]]?), and I'm concerned by the fact that changing
> > the return type to something obviously wrong like "int" results in
> > zero observable changes.
> 
> I'd suggest List[Dict] to be enough in this case since. We can safely assume
> the returned JSON will always be a list of objects, the rest is on the caller.

I trust your expertise here :)

> > How are type hints enforced? Do we need to turn that on somehow?
> 
> They're not. Python will always remain a dynamically typed language. The whole
> point of type hinting is for static analysis via 'mypy' and for various IDEs
> that can actually make use of those as well during completion which is nice.
> (I'm wondering whether the jedi vim plugin is capable of reading those too)

I see. It would be nice to run mypy in 'check' mode (assuming that
exists) at syntax-check time, similarly to what we already do with
flake8. That can come later, though.

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list