<commit_before>//
//  File.swift
//  
//
//  Created by <NAME> on 7/1/19.
//


#if os(iOS) || os(tvOS) || os(OSX) || os(watchOS)
import Foundation
import CoreGraphics
import SwiftUI
import Scalar2D_GraphicPath
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)
public extension Path
{
     init?(svgPath: String)
    {
        guard let cgPath = CGPath.path(fromSVGPath: svgPath) else
        {
            return nil
        }
        self.init(cgPath)
    }
}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)
extension CGPath
{
    func fitting(geometry : GeometryProxy) -> CGPath
    {
        let baseBox = self.boundingBoxOfPath
        guard !baseBox.isEmpty && !baseBox.isInfinite && !baseBox.isNull else
        {
            return self
        }
        
        let nativeWidth = baseBox.width
        let nativeHeight = baseBox.height
        let nativeAspectRatio = nativeWidth/nativeHeight;
        let boundedAspectRatio = geometry.size.width/geometry.size.height;
        
        var scale : CGFloat!
        if(nativeAspectRatio >= boundedAspectRatio) // blank space on top and bottom
        {
            scale = geometry.size.width / nativeWidth
        }
        else
        {
            scale = geometry.size.height / nativeHeight
        }
        var requiredTransform = CGAffineTransform(scaleX: scale, y: scale).translatedBy(x: -baseBox.minX*scale, y: -baseBox.minY*scale)
        
        return self.copy(using: &requiredTransform) ?? self
    }
}



#endif
<commit_msg>Had neglected to make fitting extension on CGPath public.<commit_after>//
//  File.swift
//  
//
//  Created by <NAME> on 7/1/19.
//


#if os(iOS) || os(tvOS) || os(OSX) || os(watchOS)
import Foundation
import CoreGraphics
import SwiftUI
import Scalar2D_GraphicPath
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)
public extension Path
{
     init?(svgPath: String)
    {
        guard let cgPath = CGPath.path(fromSVGPath: svgPath) else
        {
            return nil
        }
        self.init(cgPath)
    }
}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)
public extension CGPath
{
    /// Transform this CGPath to fit int the GeometryProxy's size.
    /// - Parameter geometry: geometry environment to fit into
    func fitting(geometry : GeometryProxy) -> CGPath
    {
        let baseBox = self.boundingBoxOfPath
        guard !baseBox.isEmpty && !baseBox.isInfinite && !baseBox.isNull else
        {
            return self
        }
        
        let nativeWidth = baseBox.width
        let nativeHeight = baseBox.height
        let nativeAspectRatio = nativeWidth/nativeHeight;
        let boundedAspectRatio = geometry.size.width/geometry.size.height;
        
        var scale : CGFloat!
        if(nativeAspectRatio >= boundedAspectRatio) // blank space on top and bottom
        {
            scale = geometry.size.width / nativeWidth
        }
        else
        {
            scale = geometry.size.height / nativeHeight
        }
        var requiredTransform = CGAffineTransform(scaleX: scale, y: scale).translatedBy(x: -baseBox.minX*scale, y: -baseBox.minY*scale)
        
        return self.copy(using: &requiredTransform) ?? self
    }
}
#endif

{'fraction_non_alphanumeric': 0.10322380657160571, 'fraction_numerical': 0.017978921264724116, 'mean_word_length': 2.179310344827586, 'pattern_counts': {'":': 0, '<': 5, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5379134', 'n_tokens_mistral': 1055, 'n_tokens_neox': 989, 'n_words': 245}