<commit_before>import Foundation

extension MGiphy
{
    private static let kKeyData:String = "data"
    private static let kKeyIdentifier:String = "id"
    private static let kKeyGiphy:String = "giphy"
    private static let kKeyDownloadPrefix:String = "download_prefix"
    private static let kKeyShareSuffix:String = "share_suffix"
    
    //MARK: internal
    
    class func factoryItems(json:Any) -> [MGiphyItem]?
    {
        guard
            
            let jsonMap:[String:AnyObject] = json as? [String:AnyObject],
            let datas:[AnyObject] = jsonMap[kKeyData] as? [AnyObject]
            
        else
        {
            return nil
        }
        
        var items:[MGiphyItem] = []
        
        for data:AnyObject in datas
        {
            guard
            
                let item:MGiphyItem = parseItem(data:data)
            
            else
            {
                continue
            }
            
            items.append(item)
        }
        
        return items
    }
    
    class func parseItem(data:AnyObject) -> MGiphyItem?
    {
        guard
            
            let dataMap:[String:AnyObject] = data as? [String:AnyObject],
            let identifier:String = dataMap[kKeyIdentifier] as? String
            
        else
        {
            return nil
        }
        
        let item:MGiphyItem = MGiphyItem(identifier:identifier)
        
        return item
    }
    
    class func factoryShareGifUrl(model:MHomeItem) -> URL?
    {
        guard
            
            let urlMap:[String:AnyObject] = MRequest.factoryUrlMap(),
            let giphy:[String:AnyObject] = urlMap[kKeyGiphy] as? [String:AnyObject],
            let downloadPrefix:String = giphy[kKeyDownloadPrefix] as? String,
            let shareSuffix:String = giphy[kKeyShareSuffix] as? String,
            let itemId:String = model.gif?.identifier
            
        else
        {
            return nil
        }
        
        var gifString:String = downloadPrefix
        gifString.append(itemId)
        gifString.append(shareSuffix)
        
        let url:URL? = URL(string:gifString)
        
        return url
    }
}<commit_msg>Method doesn't need to be exposed<commit_after>import Foundation

extension MGiphy
{
    private static let kKeyData:String = "data"
    private static let kKeyIdentifier:String = "id"
    private static let kKeyGiphy:String = "giphy"
    private static let kKeyDownloadPrefix:String = "download_prefix"
    private static let kKeyShareSuffix:String = "share_suffix"
    
    //MARK: private
    
    private class func parseItem(data:AnyObject) -> MGiphyItem?
    {
        guard
            
            let dataMap:[String:AnyObject] = data as? [String:AnyObject],
            let identifier:String = dataMap[kKeyIdentifier] as? String
            
        else
        {
            return nil
        }
        
        let item:MGiphyItem = MGiphyItem(identifier:identifier)
        
        return item
    }
    
    //MARK: internal
    
    class func factoryItems(json:Any) -> [MGiphyItem]?
    {
        guard
            
            let jsonMap:[String:AnyObject] = json as? [String:AnyObject],
            let datas:[AnyObject] = jsonMap[kKeyData] as? [AnyObject]
            
        else
        {
            return nil
        }
        
        var items:[MGiphyItem] = []
        
        for data:AnyObject in datas
        {
            guard
            
                let item:MGiphyItem = parseItem(data:data)
            
            else
            {
                continue
            }
            
            items.append(item)
        }
        
        return items
    }
    
    class func factoryShareGifUrl(model:MHomeItem) -> URL?
    {
        guard
            
            let urlMap:[String:AnyObject] = MRequest.factoryUrlMap(),
            let giphy:[String:AnyObject] = urlMap[kKeyGiphy] as? [String:AnyObject],
            let downloadPrefix:String = giphy[kKeyDownloadPrefix] as? String,
            let shareSuffix:String = giphy[kKeyShareSuffix] as? String,
            let itemId:String = model.gif?.identifier
            
        else
        {
            return nil
        }
        
        var gifString:String = downloadPrefix
        gifString.append(itemId)
        gifString.append(shareSuffix)
        
        let url:URL? = URL(string:gifString)
        
        return url
    }
}
{'fraction_non_alphanumeric': 0.07732074623510901, 'fraction_numerical': 0.0, 'mean_word_length': 1.5141242937853108, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5436502', 'n_tokens_mistral': 1255, 'n_tokens_neox': 1220, 'n_words': 260}