<commit_before>import Foundation

class WMFMapsActivity : UIActivity {
    
    public var mapItem: MKMapItem?
    
    override open var activityType: UIActivityType? {
        get {
            return UIActivityType(rawValue: String(describing: self))
        }
    }
    
    override open func canPerform(withActivityItems activityItems: [Any]) -> Bool {
        
        for activityItem in activityItems {
            if (activityItem is MKMapItem) {
                return true
            }
        }
        
        return false
    }
    
    override open func prepare(withActivityItems activityItems: [Any]) {
        
        for activityItem in activityItems {
            guard let mapItem = activityItem as? MKMapItem else {
                continue
            }
            self.mapItem = mapItem
        }
    }
}


class WMFOpenInMapsActivity : WMFMapsActivity {

    
    override open var activityTitle: String? {
        get {
            return localizedStringForKeyFallingBackOnEnglish("share-open-in-maps")
        }
    }
    
    override open var activityImage: UIImage? {
        get {
            return UIImage(named: "places-map")
        }
    }
    
    override func perform() {
        
        guard let mapItem = self.mapItem else {
            assertionFailure("MapItem should have been set")
            return
        }
        
        mapItem.openInMaps(launchOptions: nil)
        
        activityDidFinish(true)
    }
}


class WMFGetDirectionsInMapsActivity : WMFMapsActivity {

    override open var activityTitle: String? {
        get {
            return  localizedStringForKeyFallingBackOnEnglish("share-get-directions-in-maps")
        }
    }
    <commit_msg>Adding activityDidFinish(false) if MapItem is not set<commit_after>import Foundation

class WMFMapsActivity : UIActivity {
    
    public var mapItem: MKMapItem?
    
    override open var activityType: UIActivityType? {
        get {
            return UIActivityType(rawValue: String(describing: self))
        }
    }
    
    override open func canPerform(withActivityItems activityItems: [Any]) -> Bool {
        
        for activityItem in activityItems {
            if (activityItem is MKMapItem) {
                return true
            }
        }
        
        return false
    }
    
    override open func prepare(withActivityItems activityItems: [Any]) {
        
        for activityItem in activityItems {
            guard let mapItem = activityItem as? MKMapItem else {
                continue
            }
            self.mapItem = mapItem
        }
    }
}


class WMFOpenInMapsActivity : WMFMapsActivity {

    
    override open var activityTitle: String? {
        get {
            return localizedStringForKeyFallingBackOnEnglish("share-open-in-maps")
        }
    }
    
    override open var activityImage: UIImage? {
        get {
            return UIImage(named: "places-map")
        }
    }
    
    override func perform() {
        
        guard let mapItem = self.mapItem else {
            assertionFailure("MapItem not set")
            activityDidFinish(false)
            return
        }
        
        mapItem.openInMaps(launchOptions: nil)
        
        activityDidFinish(true)
    }
}


class WMFGetDirectionsInMapsActivity : WMFMapsActivity {

    override open var activityTitle: String? {
        get {
            return  localizedStringForKeyFallingBackOnEnglish("share-get-directions-in-maps")
        }
    }
    
{'fraction_non_alphanumeric': 0.06525472238122496, 'fraction_numerical': 0.0, 'mean_word_length': 1.7650316455696202, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4921165', 'n_tokens_mistral': 952, 'n_tokens_neox': 928, 'n_words': 217}