<s> import itertools <EOL> def repair ( data , is_anomaly , fixer = None , depth = <NUM_LIT:1> ) : <EOL> """<STR_LIT>""" <EOL> iterators = [ ] <EOL> for i in range ( depth * <NUM_LIT:2> + <NUM_LIT:1> ) : <EOL> iterators . append ( itertools . islice ( data , i , None ) ) <EOL> items_iter = itertools . izip ( * iterators ) <EOL> for items in items_iter : <EOL> mid = items [ depth ] <EOL> other = items [ : depth ] + items [ depth + <NUM_LIT:1> : ] <EOL> if is_anomaly ( mid , other ) : <EOL> if fixer is not None : <EOL> yield fixer ( mid , other ) <EOL> else : <EOL> yield mid <EOL> def vrepair ( data , anomalies , fixer = None , depth = <NUM_LIT:1> ) : <EOL> iterators = [ ] <EOL> for i in range ( depth * <NUM_LIT:2> + <NUM_LIT:1> ) : <EOL> iterators . append ( itertools . islice ( data , i , None ) ) <EOL> items_iter = itertools . izip ( * iterators ) <EOL> for items in items_iter : <EOL> mid = items [ depth ] <EOL> other = items [ : depth ] + items [ depth + <NUM_LIT:1> : ] <EOL> anoms = anomalies ( mid , other ) <EOL> if anoms : <EOL> if fixer is not None : <EOL> yield fixer ( mid , other , anoms ) <EOL> else : <EOL> yield mid </s>
