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
131 locate free extensions #139
131 locate free extensions #139
Changes from 3 commits
5f8f98d
edb8861
efbaacd
94d771a
a1c2c14
adaac88
4b969fa
ef183e6
b1da395
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.
Have you ran the code? Missing '.main()' here on the end of 'locate_free_extension' which would have errored if you ran it.
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 is a little repetitive looping three times, can we be more efficient here collecting all data and looping once maybe?
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.
Condensed version of lines 58-61:
return extensions if extensions else None
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.
Not sure this is needed as we have the range we are looking for anyway and in line 94/95 you achieve looking for only numbers in the range given to us.
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.
Not sure why you've done this dude, extensions is already an iterable. Converting to a set is usually only done when we want to remove duplicates or need specific set functionality.
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.
Why do you skip the first extension in the range by adding 1? Range starts at the first value and goes up to but doesn't include the last value so would have thought you'd add 1 to the end to include the last value.
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 believed the range would be better suitable for extensions between the passed range values however
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.
Does this work as extensions will be a set of strings right like '100' and you are looking for an integer just 100.
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 is just keeping convention we have but here return a python dict like the below.
return {'extension': extension}
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.
Here we want to raise an a new error that the user hasn't been found. The reason we do this is if a developer has a script that uses this function to first find a free extension and in the next step takes what is returned from this and inserts into a new function to build it printing we didnt find it has no control flow value. We need to interrupt otherwise we will cause rurther errors down the line.