Skip to content

Commit

Permalink
Update violation docs for yield from violation.
Browse files Browse the repository at this point in the history
Address issue wemake-services#1057. Update violation docs to make it easier for developers to understand how to refactor more complex yield statements.
  • Loading branch information
andreaestrada committed Dec 8, 2019
1 parent 673a064 commit 3aff26e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions wemake_python_styleguide/violations/refactoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,17 @@ class ImplicitYieldFromViolation(ASTViolation):
for item in some():
yield item
# Correct:
yield from (
value[index:index + chunk_size]
for index in range(0, len(value), chunk_size)
)
# Wrong:
def chunks(value, chunk_size):
for index in range(0, len(value), chunk_size):
yield value[index:index + chunk_size]
.. versionadded:: 0.13.0
"""
Expand Down

0 comments on commit 3aff26e

Please sign in to comment.