fix(examples): deduplicate imports, Tools() instantiation, and __main__ block in browser-use-cua#181
Open
Ricardo-M-L wants to merge 1 commit into
Open
Conversation
…_main__ block in browser-use-cua The browser-use-cua example had three duplicated sections at the top level: - Two sets of imports for \`asyncio\`, \`base64\`, \`os\`, and \`io.BytesIO\` - Two \`tools = Tools()\` instantiations (the second overwrote the first, discarding any action registrations that referenced the original binding — harmless here only because the registration occurs after the second line) - Two \`if __name__ == "__main__": asyncio.run(main())\` blocks at the bottom (the second runs main twice in a row) Removed the redundant copies. This is a pure cleanup; behavior is unchanged for normal happy-path runs, but the example no longer ships with the second main() call that would have executed after the first completed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #180.
The browser-use-cua example had three sections copy-pasted twice: the imports block, the
tools = Tools()instantiation, and theif __name__ == "__main__"entry point. The secondtools = Tools()also overwrote the first binding, making any decorator attached between them silently dead code.This PR collapses them to single occurrences each.
Behavioral changes
main()twice on invocation (previously the two__main__blocks executed sequentially).toolsbinding is the one the rest of the file already uses.Test plan
python -m py_compile examples/browser-use-cua/main.py— passestools = Tools()appears once and all@tools.registry.action(...)decorators fall after itRelated
Part of splitting closed PR #167. Previously opened: #171, #173, #175, #177, #179. This is the final bug (6 of 6).
🤖 Generated with Claude Code