Skip to content

Conversation

@kiukchung
Copy link
Contributor

Summary:
There's a bunch of use-cases where it is useful to be able to iterate over all the registered named resources. Implementing the __iter__() method makes this possible.

NOTE: To keep the API consistent, the _NamedResourcesLibrary.__iter__() method materializes the resource objec by calling the factory function. This means that if you iterate over named_resources early in the program, you end up losing out on any lazy materialization.

Reviewed By: AbishekS

Differential Revision: D86984810

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 13, 2025
@meta-codesync
Copy link

meta-codesync bot commented Nov 13, 2025

@kiukchung has exported this pull request. If you are a Meta employee, you can view the originating Diff in D86984810.

facebook-github-bot pushed a commit that referenced this pull request Nov 13, 2025
Summary:

There's a bunch of use-cases where it is useful to be able to iterate over all the registered named resources. Implementing the `__iter__()` method makes this possible.

NOTE: To keep the API consistent, the `_NamedResourcesLibrary.__iter__()` method materializes the resource objec by calling the factory function. This means that if you iterate over `named_resources` early in the program, you end up losing out on any lazy materialization.

Reviewed By: AbishekS

Differential Revision: D86984810
@facebook-github-bot facebook-github-bot force-pushed the export-D86984810 branch 2 times, most recently from f968b3d to 41cf3ec Compare November 14, 2025 00:01
@codecov-commenter
Copy link

codecov-commenter commented Nov 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.64%. Comparing base (6bde935) to head (6b6fda0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1163      +/-   ##
==========================================
+ Coverage   91.63%   91.64%   +0.01%     
==========================================
  Files          84       84              
  Lines        6595     6596       +1     
==========================================
+ Hits         6043     6045       +2     
+ Misses        552      551       -1     
Flag Coverage Δ
unittests 91.64% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

Summary:

There's a bunch of use-cases where it is useful to be able to iterate over all the registered named resources. Implementing the `__iter__()` method makes this possible.

Reviewed By: AbishekS

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants