<commit_before>import Foundation
import XmlHero

final class MVitaXmlThumbnail
{
    //MARK: private
    
    private init() { }
    
    private class func findThumbnail(
        item:DVitaItemDirectory) -> Data?
    {
        guard
            
            let elements:[DVitaItemElement] = item.elements?.array as? [
                DVitaItemElement],
            let thumbnail:DVitaItemElement = findSmallerImage(
                elements:elements),
            let data:Data = MVitaLink.elementData(
                element:thumbnail)
            
        else
        {
            return nil
        }
        
        return data
    }
    
    private class func findSmallerImage(
        elements:[DVitaItemElement]) -> DVitaItemElement?
    {
        var smaller:DVitaItemElement?
        
        for element:DVitaItemElement in elements
        {
            guard
                
                element.fileExtension == MVitaItemInExtension.png
                
            else
            {
                continue
            }
            
            guard
                
                let currentSmaller:DVitaItemElement = smaller,
                element.size > currentSmaller.size
                
            else
            {
                smaller = element
                
                continue
            }
        }
        
        return smaller
    }
    
    //MARK: internal
    
    class func factoryMetadata(
        item:DVitaItemDirectory,
        completion:@escaping((Data?) -> ()))
    {
        
    }
}<commit_msg>Look for pngs on directory<commit_after>import Foundation
import XmlHero

final class MVitaXmlThumbnail
{
    //MARK: private
    
    private init() { }
    
    private class func findThumbnail(
        item:DVitaItemDirectory) -> Data?
    {
        guard
            
            let pngs:[DVitaItemElementPng] = item.png?.array as? [
                DVitaItemElementPng],
            let thumbnail:DVitaItemElement = findSmallerImage(
                pngs:pngs),
            let data:Data = MVitaLink.elementData(
                element:thumbnail)
            
        else
        {
            return nil
        }
        
        return data
    }
    
    private class func findSmallerImage(
        pngs:[DVitaItemElementPng]) -> DVitaItemElement?
    {
        var smaller:DVitaItemElement?
        
        for png:DVitaItemElement in pngs
        {
            guard
                
                let currentSmaller:DVitaItemElement = smaller,
                png.size > currentSmaller.size
                
            else
            {
                smaller = png
                
                continue
            }
        }
        
        return smaller
    }
    
    //MARK: internal
    
    class func factoryMetadata(
        item:DVitaItemDirectory,
        completion:@escaping((Data?) -> ()))
    {
        
    }
}
{'fraction_non_alphanumeric': 0.06288448393711552, 'fraction_numerical': 0.0, 'mean_word_length': 1.142752562225476, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '6875633', 'n_tokens_mistral': 779, 'n_tokens_neox': 722, 'n_words': 143}