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

Export event types in traits.observation.api. #1805

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
36 changes: 36 additions & 0 deletions changelog.d/20240621_105210_mdickinson_add_event_types_to_api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.. A new scriv changelog fragment.
..
.. Uncomment the header that is right (remove the leading dots).
..
.. Removed
.. -------
..
.. - A bullet item for the Removed category.
..
Added
-----

- Event types for the ``event`` received by observers have been made
available in ``traits.observation.api``. This is useful for those
wanting to use the types in type annotations. (#1805)

.. Changed
.. -------
..
.. - A bullet item for the Changed category.
..
.. Deprecated
.. ----------
..
.. - A bullet item for the Deprecated category.
..
.. Fixed
.. -----
..
.. - A bullet item for the Fixed category.
..
.. Security
.. --------
..
.. - A bullet item for the Security category.
..
7 changes: 7 additions & 0 deletions traits/observation/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
#
# Thanks for using Enthought open source!

from traits.observation.events import (
DictChangeEvent,
ListChangeEvent,
SetChangeEvent,
TraitChangeEvent,
)

from traits.observation.exception_handling import (
pop_exception_handler,
push_exception_handler,
Expand Down
6 changes: 2 additions & 4 deletions traits/observation/tests/test_dict_change_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@

import unittest

from traits.observation._dict_change_event import (
DictChangeEvent,
dict_event_factory,
)
from traits.observation.api import DictChangeEvent
from traits.observation._dict_change_event import dict_event_factory
from traits.trait_dict_object import TraitDict


Expand Down
6 changes: 2 additions & 4 deletions traits/observation/tests/test_list_change_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@

import unittest

from traits.observation._list_change_event import (
ListChangeEvent,
list_event_factory,
)
from traits.observation.api import ListChangeEvent
from traits.observation._list_change_event import list_event_factory
from traits.trait_list_object import TraitList


Expand Down
6 changes: 2 additions & 4 deletions traits/observation/tests/test_set_change_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@

import unittest

from traits.observation._set_change_event import (
SetChangeEvent,
set_event_factory,
)
from traits.observation.api import SetChangeEvent
from traits.observation._set_change_event import set_event_factory
from traits.trait_set_object import TraitSet


Expand Down
6 changes: 2 additions & 4 deletions traits/observation/tests/test_trait_change_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@

from traits.has_traits import HasTraits
from traits.trait_types import Int
from traits.observation._trait_change_event import (
trait_event_factory,
TraitChangeEvent,
)
from traits.observation.api import TraitChangeEvent
from traits.observation._trait_change_event import trait_event_factory


class TestTraitChangeEvent(unittest.TestCase):
Expand Down
Loading