Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't remove objects / DoesNotExist / etc. from model classes #2

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,33 +43,6 @@ jobs:
- name: Run mypy on stubs
run: mypy --cache-dir=/dev/null --no-incremental django-stubs

test:
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
shard: [0, 1, 2, 3]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Setup system dependencies
run: |
sudo apt-get update
sudo apt-get install binutils libproj-dev gdal-bin
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -U pip setuptools wheel
SETUPTOOLS_ENABLE_FEATURES=legacy-editable pip install -r ./requirements.txt

# Must match `shard` definition in the test matrix:
- name: Run tests
run: PYTHONPATH='.' pytest --num-shards=4 --shard-id=${{ matrix.shard }} tests

stubtest:
timeout-minutes: 10
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions django-stubs/contrib/sessions/base_session.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from datetime import datetime
from typing import Any, Literal, TypeVar
from typing import Any, ClassVar, Literal, TypeVar

from django.contrib.sessions.backends.base import SessionBase
from django.db import models
Expand All @@ -14,7 +14,7 @@ class AbstractBaseSession(models.Model):
expire_date: datetime
session_data: str
session_key: str
objects: Any
objects: ClassVar[Any]

class Meta:
abstract: Literal[True]
Expand Down
2 changes: 1 addition & 1 deletion mypy_django_plugin/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def get_method_hook(self, fullname: str) -> Optional[Callable[[MethodContext], M

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

sym = self.lookup_fully_qualified(fullname)
if (
Expand Down