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

Add trait_added support for FilteredTraitObserver #1108

Merged
merged 2 commits into from
May 19, 2020

Conversation

kitchoi
Copy link
Contributor

@kitchoi kitchoi commented May 19, 2020

Part of #977

This PR adds trait_added support for the observer that observes traits using a generic filter (FilteredTraitObserver).

When a new trait is added via HasTraits.add_trait, provided that the trait_added event is fired, the new trait will be tested against the filter defined in FilteredTraitObserver, and if the trait is a match, notifiers will be attached to the new trait.

Checklist

  • Tests
  • Update API reference (docs/source/traits_api_reference)
  • Update User manual (docs/source/traits_user_manual)
  • Update type annotation hints in traits-stubs

@codecov-commenter
Copy link

codecov-commenter commented May 19, 2020

Codecov Report

Merging #1108 into master will decrease coverage by 1.91%.
The diff coverage is 68.56%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1108      +/-   ##
==========================================
- Coverage   76.15%   74.24%   -1.92%     
==========================================
  Files          54       79      +25     
  Lines        6493     8481    +1988     
  Branches     1263     1610     +347     
==========================================
+ Hits         4945     6297    +1352     
- Misses       1205     1806     +601     
- Partials      343      378      +35     
Impacted Files Coverage Δ
traits/api.py 100.00% <ø> (+9.67%) ⬆️
traits/base_trait_handler.py 61.76% <ø> (ø)
traits/observers/_i_notifier.py 0.00% <0.00%> (ø)
traits/observers/events.py 0.00% <0.00%> (ø)
traits/traits.py 75.10% <ø> (-2.45%) ⬇️
traits/util/resource.py 15.25% <ø> (ø)
traits/observers/_generated_parser.py 51.96% <51.96%> (ø)
traits/trait_types.py 72.29% <88.88%> (-0.16%) ⬇️
traits/observers/parsing.py 95.34% <95.34%> (ø)
traits/observers/_trait_event_notifier.py 96.61% <96.61%> (ø)
... and 59 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cd41fb2...ca003bb. Read the comment docs.

Copy link
Member

@mdickinson mdickinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kitchoi kitchoi merged commit 1b96396 into master May 19, 2020
@kitchoi kitchoi deleted the 977-trait-added-filtered-trait-observer branch May 19, 2020 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants