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

5.0: Update django.utils #2006

Merged
merged 1 commit into from
Mar 14, 2024
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
8 changes: 4 additions & 4 deletions django-stubs/utils/deprecation.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ from django.http.request import HttpRequest
from django.http.response import HttpResponseBase
from typing_extensions import TypeAlias

class RemovedInDjango50Warning(DeprecationWarning): ...
class RemovedInDjango51Warning(PendingDeprecationWarning): ...
class RemovedInDjango51Warning(DeprecationWarning): ...
class RemovedInDjango60Warning(PendingDeprecationWarning): ...

RemovedInNextVersionWarning: TypeAlias = RemovedInDjango50Warning
RemovedAfterNextVersionWarning: TypeAlias = RemovedInDjango51Warning
RemovedInNextVersionWarning: TypeAlias = RemovedInDjango51Warning
RemovedAfterNextVersionWarning: TypeAlias = RemovedInDjango60Warning

class warn_about_renamed_method:
class_name: str
Expand Down
2 changes: 2 additions & 0 deletions django-stubs/utils/html.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ from _typeshed import Incomplete
from django.utils.functional import SimpleLazyObject, _StrOrPromise
from django.utils.safestring import SafeData, SafeString

VOID_ELEMENTS: set[str]

def escape(text: Any) -> SafeString: ...
def escapejs(value: Any) -> SafeString: ...
def json_script(value: Any, element_id: str | None = ..., encoder: type[JSONEncoder] | None = ...) -> SafeString: ...
Expand Down
2 changes: 1 addition & 1 deletion django-stubs/utils/text.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ re_newlines: Pattern[str]
re_camel_case: Pattern[str]

def wrap(text: _StrOrPromiseT, width: int) -> _StrOrPromiseT: ...
def add_truncation_text(text: str, truncate: str | None = ...) -> str: ...

class Truncator(SimpleLazyObject):
MAX_LENGTH_HTML: ClassVar[int]
def __init__(self, text: Model | str) -> None: ...
def add_truncation_text(self, text: str, truncate: str | None = ...) -> str: ...
def chars(self, num: int, truncate: str | None = ..., html: bool = ...) -> str: ...
def words(self, num: int, truncate: str | None = ..., html: bool = ...) -> str: ...

Expand Down
6 changes: 2 additions & 4 deletions django-stubs/utils/timezone.pyi
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from contextlib import ContextDecorator
from datetime import date, datetime, time, timedelta, timezone, tzinfo
from types import TracebackType
from typing import Any, Literal, overload
from typing import Literal, overload

import zoneinfo

utc: Any

def get_fixed_timezone(offset: timedelta | int) -> timezone: ...
def get_default_timezone() -> zoneinfo.ZoneInfo: ...
def get_default_timezone_name() -> str: ...
Expand Down Expand Up @@ -38,5 +36,5 @@ def is_aware(value: datetime) -> bool: ...
def is_naive(value: time) -> Literal[True]: ...
@overload
def is_naive(value: datetime) -> bool: ...
def make_aware(value: datetime, timezone: tzinfo | None = ..., is_dst: bool | None = ...) -> datetime: ...
def make_aware(value: datetime, timezone: tzinfo | None = ...) -> datetime: ...
def make_naive(value: datetime, timezone: tzinfo | None = ...) -> datetime: ...
7 changes: 0 additions & 7 deletions django-stubs/utils/topological_sort.pyi

This file was deleted.

8 changes: 0 additions & 8 deletions scripts/stubtest/allowlist_todo_django50.txt
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,3 @@ django.template.autoreload
django.template.base.Template.__iter__
django.template.defaultfilters.escapeseq
django.utils.choices
django.utils.deprecation.RemovedInDjango50Warning
django.utils.deprecation.RemovedInDjango60Warning
django.utils.html.VOID_ELEMENTS
django.utils.text.Truncator.add_truncation_text
django.utils.text.add_truncation_text
django.utils.timezone.make_aware
django.utils.timezone.utc
django.utils.topological_sort