Skip to content

Commit

Permalink
5.0: Update django.db.models.functions.datetime (#2167)
Browse files Browse the repository at this point in the history
  • Loading branch information
JaeHyuckSa authored May 19, 2024
1 parent 2224595 commit bcd4bfd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
21 changes: 20 additions & 1 deletion django-stubs/db/models/functions/datetime.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
from datetime import tzinfo
from typing import Any, ClassVar

from django.db import models
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.models import Func, Transform
from django.db.models.expressions import Expression
from django.db.models.fields import Field
from django.db.models.sql.compiler import SQLCompiler, _AsSqlType

class TimezoneMixin:
tzinfo: Any
Expand Down Expand Up @@ -33,7 +38,21 @@ class TruncBase(TimezoneMixin, Transform):
kind: str
tzinfo: Any

class Trunc(TruncBase): ...
def __init__(
self, expression: Expression, output_field: Field | None = ..., tzinfo: tzinfo | None = ..., **extra: Any
) -> None: ...
def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... # type: ignore[override]

class Trunc(TruncBase):
def __init__(
self,
expression: Expression,
kind: str,
output_field: Field | None = ...,
tzinfo: tzinfo | None = ...,
**extra: Any,
) -> None: ...

class TruncYear(TruncBase): ...
class TruncQuarter(TruncBase): ...
class TruncMonth(TruncBase): ...
Expand Down
8 changes: 0 additions & 8 deletions scripts/stubtest/allowlist_todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1051,9 +1051,6 @@ django.db.models.functions.Pi.as_oracle
django.db.models.functions.Radians.as_oracle
django.db.models.functions.Random
django.db.models.functions.Round.__init__
django.db.models.functions.Trunc.__init__
django.db.models.functions.TruncDate.as_sql
django.db.models.functions.TruncTime.as_sql
django.db.models.functions.comparison.Cast.as_mysql
django.db.models.functions.comparison.Cast.as_oracle
django.db.models.functions.comparison.Cast.as_postgresql
Expand All @@ -1070,12 +1067,7 @@ django.db.models.functions.datetime.Extract.as_sql
django.db.models.functions.datetime.Extract.lookup_name
django.db.models.functions.datetime.Now.as_mysql
django.db.models.functions.datetime.Now.as_postgresql
django.db.models.functions.datetime.Trunc.__init__
django.db.models.functions.datetime.TruncBase.__init__
django.db.models.functions.datetime.TruncBase.as_sql
django.db.models.functions.datetime.TruncBase.kind
django.db.models.functions.datetime.TruncDate.as_sql
django.db.models.functions.datetime.TruncTime.as_sql
django.db.models.functions.math.Ceil.as_oracle
django.db.models.functions.math.Cot.as_oracle
django.db.models.functions.math.Degrees.as_oracle
Expand Down

0 comments on commit bcd4bfd

Please sign in to comment.