Query module UnguardedNextInGenerator

name
Unguarded next in generator
description
Calling next() in a generator may cause unintended early termination of an iteration.
kind
problem
tags
maintainability portability
problem.severity
warning
sub-severity
low
precision
very-high
id
py/unguarded-next-in-generator

Imports

Predicates

call_to_iter
call_to_next
guarded_not_empty_sequence
iter
iter_not_exhausted

The pattern next(iter(x)) is often used where x is known not be empty. Check for that.

next
stop_iteration_handled