Skip to content

feat: add update, clear, pop, popitem, and ior methods to Context with (batched) signal emissions#282

Open
tlambert03 wants to merge 4 commits intopyapp-kit:mainfrom
tlambert03:fix-context-signals
Open

feat: add update, clear, pop, popitem, and ior methods to Context with (batched) signal emissions#282
tlambert03 wants to merge 4 commits intopyapp-kit:mainfrom
tlambert03:fix-context-signals

Conversation

@tlambert03
Copy link
Copy Markdown
Member

@tlambert03 tlambert03 commented May 8, 2026

this fixes (and batches) signal emission for various ChainMap methods on the Context object that were escaping signal emission

  • update — positional dict, **kwargs, iterable of pairs, mixed dict + kwargs (all assert single signal with the union
    of keys)
  • clear — non-empty emits one signal with all keys; empty emits nothing; only maps[0] is cleared, parents untouched
  • pop — existing key emits one signal; missing-with-default returns default and emits nothing;
    missing-without-default raises KeyError; parent-only key raises (matches ChainMap semantics)
  • popitem — emits one signal; empty raises KeyError
  • |= (__ior__) — emits one signal; preserves object identity
  • Propagation — bulk changes on a parent context arrive at a grandchild as a single buffered event

@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.78%. Comparing base (f975605) to head (f39df15).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #282   +/-   ##
=======================================
  Coverage   99.78%   99.78%           
=======================================
  Files          31       31           
  Lines        1851     1879   +28     
=======================================
+ Hits         1847     1875   +28     
  Misses          4        4           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant