Skip to content

Commit 4a6ed06

Browse files
don't remove objects / DoesNotExist / etc. from model classes (#2)
django-stubs fails to restore these in too many cases. see upstream issue typeddjango#1744 (not upstreamed)
1 parent b396232 commit 4a6ed06

File tree

3 files changed

+3
-30
lines changed

3 files changed

+3
-30
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -43,33 +43,6 @@ jobs:
4343
- name: Run mypy on stubs
4444
run: mypy --cache-dir=/dev/null --no-incremental django-stubs
4545

46-
test:
47-
timeout-minutes: 15
48-
runs-on: ubuntu-latest
49-
strategy:
50-
matrix:
51-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
52-
shard: [0, 1, 2, 3]
53-
fail-fast: false
54-
steps:
55-
- uses: actions/checkout@v4
56-
- name: Setup system dependencies
57-
run: |
58-
sudo apt-get update
59-
sudo apt-get install binutils libproj-dev gdal-bin
60-
- name: Set up Python ${{ matrix.python-version }}
61-
uses: actions/setup-python@v4
62-
with:
63-
python-version: ${{ matrix.python-version }}
64-
- name: Install dependencies
65-
run: |
66-
pip install -U pip setuptools wheel
67-
SETUPTOOLS_ENABLE_FEATURES=legacy-editable pip install -r ./requirements.txt
68-
69-
# Must match `shard` definition in the test matrix:
70-
- name: Run tests
71-
run: PYTHONPATH='.' pytest --num-shards=4 --shard-id=${{ matrix.shard }} tests
72-
7346
stubtest:
7447
timeout-minutes: 10
7548
runs-on: ubuntu-latest

django-stubs/contrib/sessions/base_session.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from datetime import datetime
2-
from typing import Any, Literal, TypeVar
2+
from typing import Any, ClassVar, Literal, TypeVar
33

44
from django.contrib.sessions.backends.base import SessionBase
55
from django.db import models
@@ -14,7 +14,7 @@ class AbstractBaseSession(models.Model):
1414
expire_date: datetime
1515
session_data: str
1616
session_key: str
17-
objects: Any
17+
objects: ClassVar[Any]
1818

1919
class Meta:
2020
abstract: Literal[True]

mypy_django_plugin/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def get_method_hook(self, fullname: str) -> Optional[Callable[[MethodContext], M
224224

225225
def get_customize_class_mro_hook(self, fullname: str) -> Optional[Callable[[ClassDefContext], None]]:
226226
if fullname == fullnames.MODEL_CLASS_FULLNAME:
227-
return MetaclassAdjustments.adjust_model_class
227+
return None
228228

229229
sym = self.lookup_fully_qualified(fullname)
230230
if (

0 commit comments

Comments
 (0)