{"library":"types-deprecated","code":"import warnings\nfrom deprecated import deprecated\n\n# Enable DeprecationWarnings to be visible (they are often ignored by default)\nwarnings.simplefilter('always', DeprecationWarning)\n\n@deprecated(reason=\"Use new_function instead\")\ndef old_function(a: int, b: int) -> int:\n    \"\"\"This is an old function.\"\"\"\n    return a + b\n\n@deprecated(version='1.2.0', reason=\"Use NewClass instead\")\nclass OldClass:\n    def __init__(self, value: str):\n        self.value = value\n\n    def get_value(self) -> str:\n        return self.value\n\n\ndef new_function(x: int, y: int) -> int:\n    \"\"\"This is the new function.\"\"\"\n    return x * y\n\n\n# Using the deprecated function and class\nresult = old_function(5, 3)\nprint(f\"Result from old_function: {result}\")\n\nobj = OldClass(\"hello\")\nprint(f\"Value from OldClass: {obj.get_value()}\")\n\n\n# Expected usage of the new function\nnew_result = new_function(5, 3)\nprint(f\"Result from new_function: {new_result}\")\n\n# Example of using a deprecated parameter (requires deprecated.params)\nfrom deprecated.params import deprecated_params\n\n@deprecated_params('old_arg', reason='Use new_arg instead')\ndef example_function(new_arg: str, old_arg: str = 'default') -> None:\n    print(f\"Called with new_arg: {new_arg}, old_arg: {old_arg}\")\n\nexample_function(new_arg='modern value', old_arg='legacy value')\n\n# Restore default warning filter (optional)\nwarnings.simplefilter('default', DeprecationWarning)\n","lang":"python","description":"This quickstart demonstrates how to apply the `@deprecated` decorator to functions and classes from the `Deprecated` library. It also includes an example of using `@deprecated_params` for specific arguments. Crucially, it shows how to enable `DeprecationWarning` messages, which are often ignored by default in Python, so you can see the warnings generated by using deprecated code.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}