Skip to content

Commit f96ab51

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 2e434a0 commit f96ab51

File tree

2 files changed

+1
-31
lines changed

2 files changed

+1
-31
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -43,35 +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.10', '3.11', '3.12', '3.13']
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@v5
62-
with:
63-
python-version: ${{ matrix.python-version }}
64-
- name: Install dependencies
65-
run: |
66-
pip install -U pip "setuptools<79.0.0" 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 pytest tests
71-
run: PYTHONPATH='.' pytest --num-shards=4 --shard-id=${{ matrix.shard }} -n auto tests
72-
- name: Run mypy on the test cases
73-
run: mypy --strict tests/assert_type
74-
7546
stubtest:
7647
timeout-minutes: 10
7748
runs-on: ubuntu-latest

mypy_django_plugin/main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
resolve_manager_method,
4646
)
4747
from mypy_django_plugin.transformers.models import (
48-
MetaclassAdjustments,
4948
handle_annotated_type,
5049
process_model_class,
5150
set_auth_user_model_boolean_fields,
@@ -226,7 +225,7 @@ def get_customize_class_mro_hook(self, fullname: str) -> Callable[[ClassDefConte
226225

227226
def get_metaclass_hook(self, fullname: str) -> Callable[[ClassDefContext], None] | None:
228227
if fullname == fullnames.MODEL_METACLASS_FULLNAME:
229-
return MetaclassAdjustments.adjust_model_class
228+
return None
230229
return None
231230

232231
def get_base_class_hook(self, fullname: str) -> Callable[[ClassDefContext], None] | None:

0 commit comments

Comments
 (0)