Attempt to fix 'INTERNAL ERROR using annotate'. (#753)

KeyError: "Failed qualified lookup: '_AnyAttrAllowed' (fullname =
'django._AnyAttrAllowed')."

https://github.com/typeddjango/django-stubs/issues/745
This commit is contained in:
Seth Yastrov
2022-01-28 19:43:03 +01:00
committed by GitHub
parent 28d6dc992c
commit c556668d7a
4 changed files with 14 additions and 8 deletions

View File

@@ -2,5 +2,6 @@ from .aliases import ValuesQuerySet as ValuesQuerySet
from .annotations import Annotations as Annotations
from .annotations import WithAnnotations as WithAnnotations
from .patch import monkeypatch as monkeypatch
from .types import AnyAttrAllowed as AnyAttrAllowed
__all__ = ["monkeypatch", "ValuesQuerySet", "WithAnnotations", "Annotations"]
__all__ = ["monkeypatch", "ValuesQuerySet", "WithAnnotations", "Annotations", "AnyAttrAllowed"]

View File

@@ -0,0 +1,10 @@
from typing import Any, Protocol
# Used internally by mypy_django_plugin.
class AnyAttrAllowed(Protocol):
def __getattr__(self, item: str) -> Any:
...
def __setattr__(self, item: str, value: Any) -> None:
...