Skip to content

Commit 323e9bf

Browse files
committed
remove deprecated code
1 parent f7d7e29 commit 323e9bf

File tree

6 files changed

+21
-57
lines changed

6 files changed

+21
-57
lines changed

docs/source/about/changelog.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ Unreleased
2828
- :pull:`876` - ``idom.widgets.hotswap``. The function has no clear uses outside of some
2929
internal applications. For this reason it has been deprecated.
3030

31+
**Removed**
32+
33+
- :pull:`886` - Ability to access element value from events via `event['value']` key.
34+
Instead element value should be accessed via `event['target']['value']`. Originally
35+
deprecated in :ref:`v0.34.0`.
36+
- :pull:`886` - old misspelled option ``idom.config.IDOM_WED_MODULES_DIR``. Originally
37+
deprecated in :ref:`v0.36.1`.
38+
3139

3240
v0.43.0
3341
-------

src/idom/_option.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,19 +120,14 @@ def __repr__(self) -> str:
120120

121121

122122
class DeprecatedOption(Option[_O]): # pragma: no cover
123-
def __init__(self, new_opt: Option[_O], name: str) -> None:
124-
# copy over attrs
125-
attrs = new_opt.__dict__.copy()
126-
attrs.pop("_current", None)
127-
self.__dict__.update(new_opt.__dict__)
128-
# then set the ones needed here
129-
self._name = name
130-
self._new_opt = new_opt
123+
def __init__(self, message: str, *args: Any, **kwargs: Any) -> None:
124+
self._deprecation_message = message
125+
super().__init__(*args, **kwargs)
131126

132127
@property # type: ignore
133128
def _current(self) -> _O:
134129
warn(
135-
f"{self.name!r} has been renamed to {self._new_opt.name!r}",
130+
self._deprecation_message,
136131
DeprecationWarning,
137132
stacklevel=_frame_depth_in_module() + 1,
138133
)

src/idom/config.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from pathlib import Path
77
from tempfile import TemporaryDirectory
88

9-
from ._option import DeprecatedOption as _DeprecatedOption
109
from ._option import Option as _Option
1110

1211

@@ -54,12 +53,6 @@
5453
set of publically available APIs for working with the client.
5554
"""
5655

57-
IDOM_WED_MODULES_DIR: _Option[Path] = _DeprecatedOption(
58-
new_opt=IDOM_WEB_MODULES_DIR,
59-
name="IDOM_WED_MODULES_DIR",
60-
)
61-
"""This has been renamed to :data:`IDOM_WEB_MODULES_DIR`"""
62-
6356
IDOM_TESTING_DEFAULT_TIMEOUT = _Option(
6457
"IDOM_TESTING_DEFAULT_TIMEOUT",
6558
5.0,

src/idom/core/_event_proxy.py

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/idom/core/layout.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
from idom.config import IDOM_CHECK_VDOM_SPEC, IDOM_DEBUG_MODE
2727
from idom.utils import Ref
2828

29-
from ._event_proxy import _wrap_in_warning_event_proxies
3029
from .hooks import LifeCycleHook
3130
from .types import (
3231
ComponentType,
@@ -99,7 +98,7 @@ async def deliver(self, event: LayoutEventMessage) -> None:
9998

10099
if handler is not None:
101100
try:
102-
await handler.function(_wrap_in_warning_event_proxies(event["data"]))
101+
await handler.function(event["data"])
103102
except Exception:
104103
logger.exception(f"Failed to execute event handler {handler}")
105104
else:

tests/test__option.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import pytest
55

6-
from idom._option import Option
6+
from idom._option import DeprecatedOption, Option
77

88

99
def test_option_repr():
@@ -99,3 +99,10 @@ def test_option_subscribe():
9999

100100
opt.unset()
101101
assert calls == ["default", "new-1", "new-2", "default"]
102+
103+
104+
def test_deprecated_option():
105+
opt = DeprecatedOption("is deprecated!", "A_FAKE_OPTION", None)
106+
107+
with pytest.warns(DeprecationWarning, match="is deprecated!"):
108+
opt.current

0 commit comments

Comments
 (0)