mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-11 06:21:58 +08:00
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:
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Protocol
|
||||
from typing import Any
|
||||
|
||||
from .utils.version import get_version as get_version
|
||||
|
||||
@@ -6,8 +6,3 @@ VERSION: Any
|
||||
__version__: str
|
||||
|
||||
def setup(set_prefix: bool = ...) -> None: ...
|
||||
|
||||
# Used internally by mypy_django_plugin.
|
||||
class _AnyAttrAllowed(Protocol):
|
||||
def __getattr__(self, item: str) -> Any: ...
|
||||
def __setattr__(self, item: str, value: Any) -> None: ...
|
||||
|
||||
@@ -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"]
|
||||
|
||||
10
django_stubs_ext/django_stubs_ext/types.py
Normal file
10
django_stubs_ext/django_stubs_ext/types.py
Normal 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:
|
||||
...
|
||||
@@ -38,4 +38,4 @@ HTTPREQUEST_CLASS_FULLNAME = "django.http.request.HttpRequest"
|
||||
|
||||
F_EXPRESSION_FULLNAME = "django.db.models.expressions.F"
|
||||
|
||||
ANY_ATTR_ALLOWED_CLASS_FULLNAME = "django._AnyAttrAllowed"
|
||||
ANY_ATTR_ALLOWED_CLASS_FULLNAME = "django_stubs_ext.AnyAttrAllowed"
|
||||
|
||||
Reference in New Issue
Block a user