<commit_before>//
//  Renderer.swift
//  AsyncImageView
//
//  Created by <NAME> on 11/22/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import UIKit
import ReactiveCocoa

/// Information required to produce an image
public protocol RenderDataType: Hashable {
	var size: CGSize { get }
}

public protocol RenderResultType {
	var image: UIImage { get }
	var cacheHit: Bool { get }
}

public struct RenderResult: RenderResultType {
	public let image: UIImage
	public let cacheHit: Bool
}

extension UIImage: RenderResultType {
	public var image: UIImage {
		return self
	}

	public var cacheHit: Bool {
		// A raw UIImage created by a `RendererType` is implicitly not cached.
		return false
	}
}

public protocol RendererType {
	typealias RenderData: RenderDataType

	typealias Result: RenderResultType
	typealias Error: ErrorType

	func renderImageWithData(data: RenderData) -> SignalProducer<Result, Error>
}

public protocol SynchronousRendererType {
	typealias RenderData: RenderDataType

	func renderImageWithData(data: RenderData) -> UIImage
}
<commit_msg>Renderer: exposed initializer<commit_after>//
//  Renderer.swift
//  AsyncImageView
//
//  Created by <NAME> on 11/22/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import UIKit
import ReactiveCocoa

/// Information required to produce an image
public protocol RenderDataType: Hashable {
	var size: CGSize { get }
}

public protocol RenderResultType {
	var image: UIImage { get }
	var cacheHit: Bool { get }
}

public struct RenderResult: RenderResultType {
	public let image: UIImage
	public let cacheHit: Bool

	public init(image: UIImage, cacheHit: Bool) {
		self.image = image
		self.cacheHit = cacheHit
	}
}

extension UIImage: RenderResultType {
	public var image: UIImage {
		return self
	}

	public var cacheHit: Bool {
		// A raw UIImage created by a `RendererType` is implicitly not cached.
		return false
	}
}

public protocol RendererType {
	typealias RenderData: RenderDataType

	typealias Result: RenderResultType
	typealias Error: ErrorType

	func renderImageWithData(data: RenderData) -> SignalProducer<Result, Error>
}

public protocol SynchronousRendererType {
	typealias RenderData: RenderDataType

	func renderImageWithData(data: RenderData) -> UIImage
}

{'fraction_non_alphanumeric': 0.08063801506424458, 'fraction_numerical': 0.008861320336730172, 'mean_word_length': 4.190804597701149, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, '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': '7135618', 'n_tokens_mistral': 716, 'n_tokens_neox': 693, 'n_words': 229}