--quick doesn't look inside generators?
Testcase:
from typing import List
def f(d: int) -> int:
return d + 1
def g(l: List[str]) -> List[str]:
return list(f(x) for x in l)
Running pytype-single --quick says it's fine, but running without that flag reveals the error:
File "testcase.py", line 7, in g: Function f was called with the wrong arguments [wrong-arg-types]
Expected: (d: int)
Actually passed: (d: str)
Also tried running with the various other optional flags (e.g. protocols) and they don't fix the problem.
I believe the issue here is that --quick restricts the analysis depth, so it sees g() calls list() calls a generator, and it gives up at that point because it hits maximum call depth. The only way to really fix this is to increase the maximum depth, which has potential performance implications.
Is there a way to specifically override maximum call depth?
There's no way to pass in a specific maximum call depth, no; you can choose to not use --quick which will remove the limit altogether.
But there's no way to remove --quick when running over a package, only for a single file. People have previously been told that there's no need for it.
Ah you're right; we've hard-coded --quick into pytype_runner (https://github.com/google/pytype/blob/5a00cf4f5e05b0411ea3feb6ebd2dbcba72c09cd/pytype/tools/analyze_project/pytype_runner.py#L173).
I'm not sure what exactly you're referring to with "People have previously been told that there's no need for it," but what I've probably said in the past (which still applies) is that pytype is primarily run and tested with --quick (that's the only configuration we use internally), so it's hard to say how well the tool will perform with --quick disabled. In some cases, it'll probably be unusably slow.
With that said, we do offer other options (such as --protocols) that are more experimental, so I wouldn't be opposed to making --quick configurable.