8000 Issue #446: Fixed calls to open without ctx manager by milaiwi · Pull Request #469 · SWE-agent/SWE-agent · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Issue #446: Fixed calls to open without ctx manager #469

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

Merged
merged 13 commits into from
Jun 2, 2024

Conversation

milaiwi
Copy link
Contributor
@milaiwi milaiwi commented May 31, 2024

Reference Issues/PRs

Fixes #446

What does this implement/fix? Explain your changes.

Fixes issues identified by Ruff which advises on proper file handling in Python. Replaces direct file handling methods with safer context handler by using Path.read_text() and with open(...) as file: where appropriate.

Files

  1. evaluation/aggregate_results.py
  2. evaluation/evaluation.py
  3. inspector/server.py
  4. make_demos/convert_traj_to_demo.py
  5. run_replay.py
  6. sweagent/agent/agents.py
  7. sweagent/agent/commands.py
  8. sweagent/agent/models.py
  9. sweagent/environment/swe_env.py
  10. sweagent/environment/utils.py
  11. inspector/static.py

Copy link
codecov bot commented May 31, 2024

Codecov Report

Attention: Patch coverage is 88.23529% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 75.74%. Comparing base (c69747d) to head (315734b).
Report is 15 commits behind head on main.

Files Patch % Lines
run_replay.py 75.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #469      +/-   ##
==========================================
+ Coverage   75.71%   75.74%   +0.03%     
==========================================
  Files          20       20              
  Lines        3125     3134       +9     
==========================================
+ Hits         2366     2374       +8     
- Misses        759      760       +1     

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

@klieret
Copy link
Member
klieret commented May 31, 2024

Just skimmed it and it looks good. Don't mind the build-docs failure, that's probably on me. Edit: Fixed with #474

Gonna look a bit more thoroughly in a bit!

@@ -277,15 +277,18 @@ def main(data_path, directory, port):
data = []
if data_path is not None:
if data_path.endswith(".jsonl"):
data = [json.loads(x) for x in open(data_path).readlines()]
data = [json.loads(x) for x in Path(data_path).read_text().splitlines(keepend=True)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be keepends

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will merge after this is resolved :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed! :)

8000

@ofirpress
Copy link
Member

Thanks @milaiwi !

@klieret klieret merged commit 47da56d into SWE-agent:main Jun 2, 2024
6 checks passed
@klieret
Copy link
Member
klieret commented Jun 2, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix calls to open without context manager
3 participants
0