Coverage for functions \ flipdare \ core \ parked_decorator.py: 0%
14 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-05-08 12:22 +1000
« prev ^ index » next coverage.py v7.13.0, created at 2026-05-08 12:22 +1000
1#!/usr/bin/env python
2# Copyright (c) 2026 Flipdare Pty Ltd. All rights reserved.
3#
4# This file is part of Flipdare's proprietary software and contains
5# confidential and copyrighted material. Unauthorised copying,
6# modification, distribution, or use of this file is strictly
7# prohibited without prior written permission from Flipdare Pty Ltd.
8#
9# This software includes third-party components licensed under MIT,
10# BSD, and Apache 2.0 licences. See THIRD_PARTY_NOTICES for details.
11#
12import functools
13import warnings
14from collections.abc import Callable
15from typing import ParamSpec, TypeVar
17# P captures the parameter types (args/kwargs)
18P = ParamSpec("P")
19# R captures the return type
20R = TypeVar("R")
23def parked(reason: str = "future use") -> Callable[[Callable[P, R]], Callable[P, R]]:
24 """
25 For features that are not yet ready for use but we want to have the code in place.
27 Usage:
28 @parked(reason="Firebase migration v2")
29 def my_future_feature(data: str, retry: bool = True) -> int:
30 return len(data)
32 """
34 def decorator(func: Callable[P, R]) -> Callable[P, R]:
35 @functools.wraps(func)
36 def wrapper(*args: P.args, **kwargs: P.kwargs) -> R:
37 warnings.warn(
38 f"Feature '{func.__name__}' is currently parked for: {reason}.",
39 category=FutureWarning,
40 stacklevel=2,
41 )
42 return func(*args, **kwargs)
44 return wrapper
46 return decorator