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

remove non-model overload for Field descriptor #4

Merged
merged 1 commit into from
Nov 9, 2023

Conversation

asottile-sentry
Copy link
Member

(not upstreamed)

hopefully eventually can remove when python/mypy#5570 is solved

little testcase for this:

from __future__ import annotations

from django.db import models

class M1(models.Model):
    f: models.Field[int, int] = models.IntegerField()

class C:
    f: int

def f(inst: C | M1 | M2) -> int:
    return inst.f

# should also work with field subclasses
class F(models.Field[int, int]):
    pass

class M2(models.Model):
    f = F()

def g(inst: C | M2) -> int:
    return inst.f

(not upstreamed)

hopefully eventually can remove when python/mypy#5570 is solved
@asottile-sentry asottile-sentry merged commit 5af709a into sentry-4.2.6 Nov 9, 2023
16 checks passed
@asottile-sentry asottile-sentry deleted the sentry-4-2-6-field-descriptor branch November 9, 2023 17:22
asottile-sentry added a commit that referenced this pull request Dec 5, 2023
(not upstreamed)

hopefully eventually can remove when python/mypy#5570 is solved
asottile-sentry added a commit that referenced this pull request Apr 30, 2024
(not upstreamed)

hopefully eventually can remove when python/mypy#5570 is solved
asottile-sentry added a commit that referenced this pull request May 28, 2024
(not upstreamed)

hopefully eventually can remove when python/mypy#5570 is solved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants