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.
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
Cleanup script to search and remove rageshakes from applications based on a time #61
Cleanup script to search and remove rageshakes from applications based on a time #61
Changes from 4 commits
1f586a6
3f57c18
f6d5868
1a8b7c7
df8bde0
3981d90
6285f58
7b23c89
1383654
a4b6a07
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 probably needs a docstring, if only to document what the parameters mean.
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.
suggest moving everything other than the
with gzip.open
block outside thetry/except
.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.
I'm not sure about this;
I was aiming for not taking any action (deletion etc) if the details.log.gz file was not found. Putting the remaining logic outside the
try/except
would mean it does get run, even if the (current) if block would always evaluate to False as app_name would always be None.I feel it's more obvious if we simply don't evaluate the decision at all when we get a file not found error.
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.
Sorry, I failed to add: you'd want an early
return False
inside theexcept
block.The idea is to be clearer about which parts of the code we're expecting to throw. For example: currently we need to worry about what happens if
_delete
throws aFileNotFoundError
. In that case, we'll report a misleading message about not being able to check the application name.Generally, it's good practice to be minimal with the size of your
try
block; sticking extra code inside thetry
block as a way of skipping that code if the exception is throw means (a) you could end up catching exceptions you didn't want to; (b) it disrupts the flow of the code: the error handling forgzip.open
is now a long way from that call.