<commit_before>import UIKit

protocol HasSparklingStars: class {
    
    var sparklingStars: [UIImageView]? { get }
    
}

extension HasSparklingStars {
    
    func animateSparklingStarsWithCycleDuration(duration: NSTimeInterval) {
        guard let sparklingStars = sparklingStars else {
            return
        }
        
        let variation = duration < 1 ? 0 : 0.4
        
        for star in sparklingStars {
            let delay: NSTimeInterval = Double(arc4random_uniform(UInt32(duration * 100))) / 100 // 0 ... duration
            let duration: NSTimeInterval = (duration - variation / 2) + Double(arc4random_uniform(UInt32(variation * 100))) / 100 // (duration - variation / 2) ... (duration + variation / 2)
            
            animateSparklingStarWithDuration(duration, delay: delay, star: star)
        }
    }
    
    private func animateSparklingStarWithDuration(duration: NSTimeInterval, delay: NSTimeInterval, star: UIImageView) {
        UIView.animateWithDuration(duration, delay: delay, options: [UIViewAnimationOptions.CurveEaseInOut], animations: {
            star.transform = CGAffineTransformMakeScale(1.5, 1.5)
            }, completion: { _ in
                UIView.animateWithDuration(duration, delay: 0, options: [UIViewAnimationOptions.CurveEaseInOut], animations: {
                    star.transform = CGAffineTransformMakeScale(0.7, 0.7)
                    }, completion: { _ in
                        self.animateSparklingStarWithDuration(duration, delay: 0, star: star)
                })
        })
    }
    
}<commit_msg>Remove unnecessary recursion in sparklingStars animation<commit_after>import UIKit

protocol HasSparklingStars: class {
    
    var sparklingStars: [UIImageView]? { get }
    
}

extension HasSparklingStars {
    
    func animateSparklingStarsWithCycleDuration(duration: NSTimeInterval) {
        guard let sparklingStars = sparklingStars else {
            return
        }
        
        let variation = duration < 1 ? 0 : 0.4
        
        for star in sparklingStars {
            let delay: NSTimeInterval = Double(arc4random_uniform(UInt32(duration * 100))) / 100 // 0 ... duration
            let duration: NSTimeInterval = (duration - variation / 2) + Double(arc4random_uniform(UInt32(variation * 100))) / 100 // (duration - variation / 2) ... (duration + variation / 2)
            
            animateSparklingStarWithDuration(duration, delay: delay, star: star)
        }
    }
    
    private func animateSparklingStarWithDuration(duration: NSTimeInterval, delay: NSTimeInterval, star: UIImageView) {
        UIView.animateWithDuration(duration, delay: delay, options: .CurveEaseInOut, animations: {
            star.transform = CGAffineTransformMakeScale(1.5, 1.5)
        }, completion: { _ in
            
            UIView.animateWithDuration(duration, delay: 0, options: [.CurveEaseInOut, .Autoreverse, .Repeat], animations: {
                star.transform = CGAffineTransformMakeScale(0.7, 0.7)
            }, completion: nil)
            
        })
    }
    
}
{'fraction_non_alphanumeric': 0.09156076898012382, 'fraction_numerical': 0.023134571521668295, 'mean_word_length': 2.3773377337733774, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3313831', 'n_tokens_mistral': 926, 'n_tokens_neox': 848, 'n_words': 188}