-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Conversation
for more information, see https://pre-commit.ci
Codecov ReportAttention: Patch coverage is
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. |
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! |
inspector/server.py
Outdated
@@ -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)] |
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.
this should be keepends
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.
Will merge after this is resolved :)
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.
Fixed! :)
Thanks @milaiwi ! |
Thanks! |
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()
andwith open(...) as file:
where appropriate.Files