Skip to content

Commit

Permalink
Mark deprecations (future PEP 702 @warnings.deprecated)
Browse files Browse the repository at this point in the history
  • Loading branch information
jace committed Jun 3, 2024
1 parent 8f267ac commit 27a58af
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/coaster/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
Union,
cast,
)
from typing_extensions import deprecated

import itsdangerous
from flask.json.provider import DefaultJSONProvider
Expand Down Expand Up @@ -217,7 +218,9 @@ class QuartRotatingKeySecureCookieSessionInterface(QuartSecureCookieSessionInter


# Flask version is also available with an unprefixed name
RotatingKeySecureCookieSessionInterface = FlaskRotatingKeySecureCookieSessionInterface
RotatingKeySecureCookieSessionInterface = deprecated(
"Renamed to FlaskRotatingKeySecureCookieSessionInterface"
)(FlaskRotatingKeySecureCookieSessionInterface)

# --- App init utilities ---------------------------------------------------------------

Expand Down
5 changes: 4 additions & 1 deletion src/coaster/sqlalchemy/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

from typing import Any, Callable, Optional, Union
from typing_extensions import deprecated

import sqlalchemy as sa
from markupsafe import Markup
Expand Down Expand Up @@ -170,4 +171,6 @@ class CustomMarkdownComposite(MarkdownComposite):


# Compatibility name
MarkdownColumn = markdown_column
MarkdownColumn = deprecated("MarkdownColumn has been renamed to markdown_column")(
markdown_column
)
8 changes: 2 additions & 6 deletions src/coaster/views/classview.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from __future__ import annotations

import warnings
from collections.abc import Awaitable, Collection, Coroutine
from functools import partial, update_wrapper, wraps
from inspect import iscoroutinefunction
Expand All @@ -33,6 +32,7 @@
Self,
TypeAlias,
TypeVar,
deprecated,
get_original_bases,
)

Expand Down Expand Up @@ -782,13 +782,9 @@ def __init__(self) -> None:
self.view_args = {}

@property
@deprecated("current_handler has been renamed to current_method")
def current_handler(self) -> ViewMethodBind:
"""Deprecated name for :attr:`current_method`."""
warnings.warn(
"current_handler has been renamed to current_method",
DeprecationWarning,
stacklevel=2,
)
return self.current_method

def __eq__(self, other: object) -> bool:
Expand Down

0 comments on commit 27a58af

Please sign in to comment.