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.
This PR fixes most warnings that flake8 gives.
A few notable warnings remain that require some further discussion (grouped by type):
The ambiguous variable names should be easy to fix, but I'm not sure, so we should check.
The complexity warnings usually mean that it may make sense to refactor a function into some separate functions. The best time to do this, I think, would be when you want to work on the function for some other reason. Otherwise, if it works, maybe better to leave it alone.
The assignment of lambda expressions makes some sense (you can look up the PEP8 explanation), but I'm not 100% convinced that you should use full def's just to set some default parameter, which is what it's used for here. However, it does maybe indicate a slight code smell: it may be cleaner to just pass around this beam_size parameter in a parameter dict so that the caller of this function can just pass that stuff to the function when they call it. Something to consider.