-
Notifications
You must be signed in to change notification settings - Fork 14
Fetch context item by type #182
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR extends the global context retrieval functionality by adding a raise_on_not_found flag to the fetch_context_item function and introducing a new function fetch_context_item_by_type to retrieve context items by their type.
- Updated fetch_context_item signature to optionally raise a KeyError when a key isn’t found.
- Added fetch_context_item_by_type function for type-based context retrieval.
- Updated tests and documentation to reflect these new behaviors.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| that_depends/providers/context_resources.py | Updated fetch_context_item and added fetch_context_item_by_type functionality |
| that_depends/init.py | Updated imports to include the new fetch_context_item_by_type |
| tests/providers/test_context_resources.py | Added tests for fetch_context_item_by_type and functionality for raise_on_not_found |
| docs/providers/context-resources.md | Updated documentation to demonstrate usage of fetch_context_item_by_type |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
* Graph (#169) * Removed redundant kwargs. * Added SupportsTeardown API. * Added test for local singleton. * Added child self registration. * Added tear_down propagation to children. * Extended SupportsTeardown API. * Made registration happen or resolution. * Fixed some bugs and wrote tests for teardown. * Tear down tests for containers * Improved the injection documentation. * Extended override API * Removed limitations sections. * Fixed async tear-down bug. * Added tear-down documentation. * Added tests for tear down during overriding. * Added overriding during teardown documentation. * Added container tear-down to documentation. * Minor documentation fixes. * Added async override methods. (#172) * Changed override to sync_override. * Added async overrides. * Added tests for overrides. * Renamed from sync_* to *_sync. (#176) * Removed support for container_context(). (#175) * Removed support for container_context(). * Added tests. * Adjusted documentation. * Fetch context item by type (#182) * Added fetch_context_item_by_type * Added documentation. * Inject only enters scope for relevant providers. (#183) * Correctly enter context for relevant provides when injecting. * Correctly enter context for parent providers. * Modified parent and child registration and implemented context initialization during injection. * Removed redundant test file. * Clarified unreachable location in comment. * Re-added at runtime parent-child registration. * Added asyncio lock. * Adjusted some issues and made test order random. * Fixed pr comments. * Renamed override_context, extended scope documentation and wrote the migration guide for v3. * Fixed >>>. * Refactored injection to improve performance. * Fixed incorrect api. Added benchmarks. * Added 3.0.0.a1 results. * Added 2.2.0 results. * Fixed api naming in Container.
Resolves #181