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

ref: fix types for create_or_update to match the requirements of BaseManager #73596

Merged
merged 1 commit into from
Jul 1, 2024
Merged
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
6 changes: 3 additions & 3 deletions src/sentry/db/models/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _resolve(instance: Model, node: BaseExpression | F) -> BaseExpression:
return runner


def _get_field(model: type[BaseModel], key: str) -> Field[object, object]:
def _get_field(model: type[Model], key: str) -> Field[object, object]:
field = model._meta.get_field(key)
if not isinstance(field, Field):
raise TypeError(f"expected Field for {key}, got ({field})")
Expand Down Expand Up @@ -171,8 +171,8 @@ def update_or_create(


def create_or_update(
model: type[BaseModel], using: str | None = None, **kwargs: Any
) -> tuple[int, Literal[False]] | tuple[BaseModel, Literal[True]]:
model: type[Model], using: str | None = None, **kwargs: Any
) -> tuple[int, Literal[False]] | tuple[Model, Literal[True]]:
"""
Similar to get_or_create, either updates a row or creates it.

Expand Down
Loading