[PATCH 05 of 23 yams] [mypy] type __init__.py and add types.py

Laurent Peuch cortex at worlddomination.be
Wed Feb 26 14:54:16 CET 2020


On Wed, Feb 26, 2020 at 09:32:23AM +0100, Nicolas Chauvat wrote:
> Hi Laurent,
> 
> On Tue, Feb 25, 2020 at 11:27:44PM +0100, Laurent Peuch wrote:
> 
> > > Also, you can take a look at TypedDict which seems to be appropriate to type
> > > this kind of values:
> > > https://mypy.readthedocs.io/en/latest/more_types.html#id3
> > > (this is only available since python3.8 but there is a backport in the
> > > typing-extensions package).
> > 
> > So I've actually explored a bit this option before realising that it
> > won't work here :/ Why? Because, as quote from the documentation:
> > 
> > > Mypy will also reject a runtime-computed expression as a key, as it
> > > can’t verify that it’s a valid key. You can only use string literals
> > > as TypedDict keys.
> 
> Would using https://pyre-check.org/ remove that limitation ?
> 
> I suppose it won't, but did you try pyre anyway to compare its results with mypy ?

I wasn't aware of this program, thx for the hint!

I don't think it will (typed dictionary really seems bleeding edge
right now) but I've gave it a try and well, yams won apparently:

> ƛ Client exited with error code 1:
> Exception: Stack overflow

Full trace:

> (yams) psychojoker at incubus ~/code/yunohost/ynh-dev/logilab/yams/yams(virtualbox↓4|) pyre --source-directory . check
>  Setting up a `.pyre_configuration` with `pyre init` may reduce overhead.
>  ƛ Client exited with error code 1:
>  Exception: Stack overflow
>  Potential backtrace:
>  Raised by primitive operation at file "hashtbl.ml", line 196,
>  characters 9-23
>  Called from file "hack_parallel/hack_parallel/heap/sharedMem.ml",
>  line 1075, characters 15-35
>  Worker exited (code: 2)
>  Exception: Stack overflow
>  Potential backtrace:
>  Raised by primitive operation at file "hashtbl.ml", line 196,
>  characters 9-23
>  Called from file "hack_parallel/hack_parallel/heap/sharedMem.ml",
>  line 1075, characters 15-35
>  Worker exited (code: 2)

I guess it's report-a-bug time.

-- 

Laurent Peuch -- Bram



More information about the cubicweb-devel mailing list