Fix mypy errors in events directory
This PR fixes all mypy errors in the openhands/events directory. The changes include:
- Added proper type annotations to functions and methods
- Fixed issues with Any vs any
- Added proper type checking for getattr() calls
- Fixed string concatenation with dict
- Added proper null checks for optional values
- Fixed lambda type inference issues
- Added proper type assertions for returned values
All changes are confined to the openhands/events directory.
Part of #6809
To run this PR locally, use the following command:
docker run -it --rm -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock --add-host host.docker.internal:host-gateway -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:4f46e49-nikolaik --name openhands-app-4f46e49 docker.all-hands.dev/all-hands-ai/openhands:4f46e49
@openhands: please use GITHUB_TOKEN to take a look at the failing runtime tests and carefully diagnose the problem. Ideally we would catch this problem with unit tests (not runtime tests), so if you can, find an appropriate place in the testing code to add a unit test and make sure that it fails with the current code. Once you have confirmed that it fails with the current code, fix the code and re-run the unit test to see that it passes. Once it passes, you can push back to the branch, wait 90 seconds, then monitor github actions to see if they're now passing.
I'm working on a fix! @neubig can track my progress at all-hands.dev
Looks like there are a few issues preventing this PR from being merged!
- GitHub Actions are failing:
- Docker
If you'd like me to help, just leave a comment, like
@OpenHands please fix the failing actions on PR #6810
Feel free to include any additional details that might help me get this PR into a better state.
@openhands please fix all merge conflicts in this PR
I'm on it! @neubig can track my progress at all-hands.dev
@openhands please fix the merge conflicts, then read the whole PR and push back to github. Once you have done that wait 90 seconds then check if github actions are passing. If not, read the codebase carefully to understand the cause and propose 5 possible reasons. In decreasing order of plausibility, further investigate each reason, explaining to me the exact code that caused the problem BEFORE making any modifications. Once you are absolutely certain that you have identified the cause of the problem, fix it, push to github, and monitor github actions again.
I'm on it! @neubig can track my progress at all-hands.dev