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

Rename package observers to observation #1123

Merged
merged 3 commits into from
May 20, 2020
Merged
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
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ graft examples
recursive-exclude examples *.pyc
include traits/ctraits.c
recursive-include traits *.py
include traits/observers/_dsl_grammar.lark
include traits/observation/_dsl_grammar.lark
2 changes: 1 addition & 1 deletion docs/source/traits_api_reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Subpackages

traits.adaptation
traits.etsconfig
traits.observers
traits.observation
traits.testing
traits.util

Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
:mod:`traits.observers` Package
===============================
:mod:`traits.observation` Package
=================================

.. automodule:: traits.observers
.. automodule:: traits.observation
:members:
:undoc-members:
:show-inheritance:


:mod:`traits.observers.expression` Module
-----------------------------------------
:mod:`traits.observation.expression` Module
-------------------------------------------

.. automodule:: traits.observers.expression
.. automodule:: traits.observation.expression
:members:
:undoc-members:
:show-inheritance:
:special-members: __eq__, __or__


:mod:`traits.observers.events` Module
-------------------------------------
:mod:`traits.observation.events` Module
---------------------------------------

.. automodule:: traits.observers.events
.. automodule:: traits.observation.events
:members:
:undoc-members:
:show-inheritance:
Expand All @@ -42,10 +42,10 @@
:inherited-members:


:mod:`traits.observers.parsing` Module
--------------------------------------
:mod:`traits.observation.parsing` Module
----------------------------------------

.. automodule:: traits.observers.parsing
.. automodule:: traits.observation.parsing
:members:
:undoc-members:
:show-inheritance:
2 changes: 1 addition & 1 deletion etstool.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def generate_parser(edm, runtime, environment):
parameters = get_parameters(edm, runtime, environment)

root_dir = os.path.dirname(__file__)
observers_dir = os.path.join(root_dir, "traits", "observers")
observers_dir = os.path.join(root_dir, "traits", "observation")

# parser file to be generated.
out_path = os.path.join(observers_dir, "_generated_parser.py")
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[flake8]
exclude = examples, traits/observers/_generated_parser.py
exclude = examples, traits/observation/_generated_parser.py
ignore = E266,W503,E722,E731,E741
2 changes: 1 addition & 1 deletion traits/ctrait.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

from . import ctraits
from .constants import ComparisonMode, DefaultValue, default_value_map
from .observers._i_observable import IObservable
from .observation._i_observable import IObservable
from .trait_base import SequenceTypes, Undefined
from .trait_dict_object import TraitDictObject
from .trait_list_object import TraitListObject
Expand Down
6 changes: 3 additions & 3 deletions traits/has_traits.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from .constants import DefaultValue, TraitKind
from .ctrait import CTrait, __newobj__
from .ctraits import CHasTraits
from .observers import api as observe_api
from .observation import api as observe_api
from .traits import (
ForwardProperty,
Property,
Expand Down Expand Up @@ -724,7 +724,7 @@ def updated(self, event):
...

The decorated function must accept one argument which is the event object
representing the change. See :py:mod:`traits.observers.events` for details.
representing the change. See :mod:`traits.observation.events` for details.

Parameters
----------
Expand Down Expand Up @@ -2209,7 +2209,7 @@ def observe(self, handler, expression, *, remove=False, dispatch="same"):
A callable that will be invoked when the observed trait changes.
It must accept one argument, which is an event object providing
information about the change.
See :py:mod:`traits.observers.events` for details.
See :py:mod:`traits.observation.events` for details.
expression : str or list or ObserverExpression
A description of what traits are being observed.
If this is a list, each item must be a string or an Expression.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
#
# Thanks for using Enthought open source!

from traits.observers._dict_change_event import dict_event_factory
from traits.observers._i_observer import IObserver
from traits.observers._observe import add_or_remove_notifiers
from traits.observers._observer_change_notifier import ObserverChangeNotifier
from traits.observers._trait_event_notifier import TraitEventNotifier
from traits.observation._dict_change_event import dict_event_factory
from traits.observation._i_observer import IObserver
from traits.observation._observe import add_or_remove_notifiers
from traits.observation._observer_change_notifier import ObserverChangeNotifier
from traits.observation._trait_event_notifier import TraitEventNotifier
from traits.trait_dict_object import TraitDict


Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
#
# Thanks for using Enthought open source!

from traits.observers._has_traits_helpers import (
from traits.observation._has_traits_helpers import (
iter_objects,
observer_change_handler,
)
from traits.observers._i_observer import IObserver
from traits.observers._observer_change_notifier import ObserverChangeNotifier
from traits.observers._observer_graph import ObserverGraph
from traits.observers._trait_change_event import trait_event_factory
from traits.observers._trait_added_observer import TraitAddedObserver
from traits.observers._trait_event_notifier import TraitEventNotifier
from traits.observation._i_observer import IObserver
from traits.observation._observer_change_notifier import ObserverChangeNotifier
from traits.observation._observer_graph import ObserverGraph
from traits.observation._trait_change_event import trait_event_factory
from traits.observation._trait_added_observer import TraitAddedObserver
from traits.observation._trait_event_notifier import TraitEventNotifier
from traits.trait_base import Uninitialized


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

from traits.constants import ComparisonMode
from traits.ctraits import CHasTraits
from traits.observers._exceptions import NotifierNotFound
from traits.observers._observe import add_or_remove_notifiers
from traits.observation._exceptions import NotifierNotFound
from traits.observation._observe import add_or_remove_notifiers
from traits.trait_base import Undefined, Uninitialized
from traits.trait_types import Dict, List, Set

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
#
# Thanks for using Enthought open source!

from traits.observers._list_change_event import list_event_factory
from traits.observers._i_observer import IObserver
from traits.observers._trait_event_notifier import TraitEventNotifier
from traits.observers._observe import add_or_remove_notifiers
from traits.observers._observer_change_notifier import ObserverChangeNotifier
from traits.observation._list_change_event import list_event_factory
from traits.observation._i_observer import IObserver
from traits.observation._trait_event_notifier import TraitEventNotifier
from traits.observation._observe import add_or_remove_notifiers
from traits.observation._observer_change_notifier import ObserverChangeNotifier
from traits.trait_list_object import TraitList


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
#
# Thanks for using Enthought open source!

from traits.observers._trait_change_event import trait_event_factory
from traits.observers._has_traits_helpers import (
from traits.observation._trait_change_event import trait_event_factory
from traits.observation._has_traits_helpers import (
iter_objects,
object_has_named_trait,
observer_change_handler,
)
from traits.observers._i_observer import IObserver
from traits.observers._observer_change_notifier import ObserverChangeNotifier
from traits.observers._observer_graph import ObserverGraph
from traits.observers._trait_added_observer import TraitAddedObserver
from traits.observers._trait_event_notifier import TraitEventNotifier
from traits.observation._i_observer import IObserver
from traits.observation._observer_change_notifier import ObserverChangeNotifier
from traits.observation._observer_graph import ObserverGraph
from traits.observation._trait_added_observer import TraitAddedObserver
from traits.observation._trait_event_notifier import TraitEventNotifier
from traits.trait_base import Uninitialized


Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import types
import weakref

from traits.observers._exceptions import NotifierNotFound
from traits.observation._exceptions import NotifierNotFound


class ObserverChangeNotifier:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
#
# Thanks for using Enthought open source!

from traits.observers._i_observer import IObserver
from traits.observers._observe import add_or_remove_notifiers
from traits.observers._observer_change_notifier import ObserverChangeNotifier
from traits.observers._set_change_event import set_event_factory
from traits.observers._trait_event_notifier import TraitEventNotifier
from traits.observation._i_observer import IObserver
from traits.observation._observe import add_or_remove_notifiers
from traits.observation._observer_change_notifier import ObserverChangeNotifier
from traits.observation._set_change_event import set_event_factory
from traits.observation._trait_event_notifier import TraitEventNotifier
from traits.trait_set_object import TraitSet


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

from unittest import mock

from traits.observers._exceptions import NotifierNotFound
from traits.observers._observe import add_or_remove_notifiers
from traits.observers._observer_graph import ObserverGraph
from traits.observation._exceptions import NotifierNotFound
from traits.observation._observe import add_or_remove_notifiers
from traits.observation._observer_graph import ObserverGraph


#: An object that does not get garbage collected until the very end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
#
# Thanks for using Enthought open source!

from traits.observers._has_traits_helpers import (
from traits.observation._has_traits_helpers import (
iter_objects,
object_has_named_trait,
)
from traits.observers._i_observer import IObserver
from traits.observers._observe import add_or_remove_notifiers
from traits.observers._observer_change_notifier import ObserverChangeNotifier
from traits.observers._observer_graph import ObserverGraph
from traits.observers._trait_change_event import trait_event_factory
from traits.observation._i_observer import IObserver
from traits.observation._observe import add_or_remove_notifiers
from traits.observation._observer_change_notifier import ObserverChangeNotifier
from traits.observation._observer_graph import ObserverGraph
from traits.observation._trait_change_event import trait_event_factory


@IObserver.register
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import types
import weakref

from traits.observers._exception_handling import handle_exception
from traits.observers._exceptions import NotifierNotFound
from traits.observation._exception_handling import handle_exception
from traits.observation._exceptions import NotifierNotFound


class TraitEventNotifier:
Expand Down
6 changes: 3 additions & 3 deletions traits/observers/api.py → traits/observation/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#
# Thanks for using Enthought open source!

from traits.observers.expression import ( # noqa: F401
from traits.observation.expression import ( # noqa: F401
dict_items,
list_items,
match,
Expand All @@ -17,8 +17,8 @@
trait,
)

from traits.observers.observe import ( # noqa: F401
from traits.observation.observe import ( # noqa: F401
dispatch_same,
observe,
)
from traits.observers.parsing import parse # noqa: F401
from traits.observation.parsing import parse # noqa: F401
8 changes: 4 additions & 4 deletions traits/observers/events.py → traits/observation/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
""" Event objects received by change handlers added using observe.
"""

from traits.observers._dict_change_event import ( # noqa: F401
from traits.observation._dict_change_event import ( # noqa: F401
DictChangeEvent,
)

from traits.observers._list_change_event import ( # noqa: F401
from traits.observation._list_change_event import ( # noqa: F401
ListChangeEvent,
)

from traits.observers._set_change_event import ( # noqa: F401
from traits.observation._set_change_event import ( # noqa: F401
SetChangeEvent,
)

from traits.observers._trait_change_event import ( # noqa: F401
from traits.observation._trait_change_event import ( # noqa: F401
TraitChangeEvent,
)
Loading