<commit_before>import MapKit

class UserLocationAnnotationView: MKAnnotationView {
    
    override init(annotation: MKAnnotation?, reuseIdentifier: String?) {
        super.init(annotation: annotation, reuseIdentifier: reuseIdentifier)
        let dimension = 14
        frame = CGRect(x: 0, y: 0, width: dimension, height: dimension)
        layer.borderWidth = 3
        layer.borderColor = UIColor.white.cgColor
        layer.zPosition = -1
        backgroundColor = UIColor.wmf_blueTint()
        self.annotation = annotation
    }
    
    required init?(coder aDecoder: NSCoder) {
        return nil
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        layer.cornerRadius = round(0.5*bounds.size.width)
    }

}<commit_msg>add heading arrow<commit_after>import MapKit

class UserLocationAnnotationView: MKAnnotationView {
    
    let shapeLayer = CAShapeLayer()
    let dotLayer = CALayer()
    
    
    var isHeadingArrowVisible = false {
        didSet {
            shapeLayer.isHidden = !isHeadingArrowVisible
        }
    }
    
    var heading: CGFloat = 0 {
        didSet {
            let transform = CATransform3DMakeRotation((heading/180.0)*CGFloat.pi, 0, 0, 1.0)
            CATransaction.begin()
            CATransaction.setAnimationDuration(0.3)
            shapeLayer.transform = transform
            CATransaction.setCompletionBlock {
                self.shapeLayer.transform = transform
            }
            CATransaction.commit()
        }
    }
    
    override init(annotation: MKAnnotation?, reuseIdentifier: String?) {
        super.init(annotation: annotation, reuseIdentifier: reuseIdentifier)
        
        let arrowWidth: CGFloat = 12
        let arrowHeight: CGFloat = 8
        let dotDimension: CGFloat = 14
        let dimension = arrowHeight + dotDimension
        
        frame = CGRect(x: 0, y: 0, width: dimension, height: dimension)
        layer.zPosition = -1
        

        
        let path = UIBezierPath()

        path.move(to: CGPoint(x: 0.5*dimension - 0.5*arrowWidth, y:arrowHeight))
        path.addLine(to: CGPoint(x: 0.5*dimension, y:0))
        path.addLine(to: CGPoint(x: 0.5*dimension + 0.5*arrowWidth, y:arrowHeight))
        path.close()
        
        shapeLayer.isHidden = true
        shapeLayer.frame = layer.bounds
        shapeLayer.path = path.cgPath
        shapeLayer.fillColor = UIColor.wmf_blueTint().cgColor
        layer.addSublayer(shapeLayer)
        
        dotLayer.borderWidth = 3
        dotLayer.borderColor = UIColor.white.cgColor
        dotLayer.backgroundColor = UIColor.wmf_blueTint().cgColor
        dotLayer.cornerRadius = round(0.5*dotDimension)
        dotLayer.bounds = CGRect(x: 0, y: 0, width: dotDimension, height: dotDimension)
        dotLayer.position = CGPoint(x: bounds.midX, y: bounds.midY)
        layer.addSublayer(dotLayer)
        
        self.annotation = annotation
    }
    
    required init?(coder aDecoder: NSCoder) {
        return nil
    }
    

}
{'fraction_non_alphanumeric': 0.09012591119946985, 'fraction_numerical': 0.0145791915175613, 'mean_word_length': 2.256742179072276, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7581447', 'n_tokens_mistral': 931, 'n_tokens_neox': 880, 'n_words': 180}