henribru
henribru
In most cases you can get away with just sticking `from __future__ import annotations` at the top of your file. As long as the subscripting is in a "type annotation...
Escaping is also missing for these relatively simple cases: ``` $ pandoc --version pandoc.exe 2.7.3 Compiled with pandoc-types 1.17.5.4, texmath 0.11.2.2, skylighting 0.8.1 [...] $ echo "*Foo*" | pandoc -f...
The solution given at https://pytest-django.readthedocs.io/en/latest/database.html#populate-the-database-with-initial-test-data seems to interact weirdly with multi-database support. I end up with this warning if any of my tests use multiple databases: ``` @contextmanager def _nodb_cursor(self):...
At the face of this sounds very simple, but if it was I guess someone would have solved it already. Is there some hidden complexity that means `update_fields = [field...
You can get around this by using `PYTHONPATH=/path/to/src mypy .`. That way you're still running mypy from the project directory, but since your source directory is added to `PYTHONPATH` each...
``` class ItemSerializer(serializers.ModelSerializer[Item]): ```
You need to use DRF 3.12. If you need to stay on an earlier version you can do this: https://mypy.readthedocs.io/en/stable/runtime_troubles.html#using-classes-that-are-generic-in-stubs-but-not-at-runtime There's also a workaround using monkeypatch, but I don't know...
There's kind of some prior art in Typescript: https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html It's not quite as powerful as this regex idea though.
> Can we reproduce it with `rm -rf .mypy_cache && mypy && mypy`, or does it only happen when files change between the cache generation and the final run? I'm...
> Not sure I understand what that would accomplish? I think code that doesn't use `WithAnnotations` can still use the cache just fine? You don't have to have `WithAnnotations` anywhere...