<commit_before>//
//  FileFetcher.swift
//  HttpRequest
//
//  Created by <NAME> on 24/4/16.
//  Copyright © 2016 Lomotif Private Limited. All rights reserved.
//

import Foundation
import Haneke

typealias FileCache = Haneke.Cache

// MARK: - FileFetcher class
/**
 Custom fetcher class
 */
public class FileFetcher: Fetcher<NSData> {
    
    public typealias SuccessHandler = (NSData) -> ()
    public typealias FailureHandler = (NSError?) -> ()
    
    // MARK: - Properties
    public private(set) var URL: URLStringConvertible?
    public private(set) var URLRequest: URLRequestConvertible?
    public private(set) var headers: HttpHeaders?
    public private(set) var body: HttpBody?
    public private(set) var request: Request?
    public private(set) var formatName: String!
    public var successHandler: SuccessHandler?
    public var failureHandler: FailureHandler?
    
    // MARK: - Initializer
    public init(URL: URLStringConvertible, headers: HttpHeaders? = nil, body: HttpBody? = nil, formatName: String = HanekeGlobals.Cache.OriginalFormatName) {
        super.init(key: URL.URLString)
        self.URL = URL
        self.headers = headers
        self.body = body
        self.formatName = formatName
    }
    
    public init(request: URLRequestConvertible, formatName: String = HanekeGlobals.Cache.OriginalFormatName) {
        super.init(key: request.URLRequest.URLString)
        self.URLRequest = request
        self.formatName = formatName
    }
    
    // MARK: - Functions
    /**
     Fetching file with alamofire request

     - parameter failure: Failure handler block
     - parameter success: Success handler block
    */
    public override func fetch(failure failure: FailureHandler?, success: SuccessHandler?) {
        if URL == nil {
            failure?(nil)
        }<commit_msg>make all properties public settable<commit_after>//
//  FileFetcher.swift
//  HttpRequest
//
//  Created by <NAME> on 24/4/16.
//  Copyright © 2016 Lomotif Private Limited. All rights reserved.
//

import Foundation
import Haneke

typealias FileCache = Haneke.Cache

// MARK: - FileFetcher class
/**
 Custom fetcher class
 */
public class FileFetcher: Fetcher<NSData> {
    
    public typealias SuccessHandler = (NSData) -> ()
    public typealias FailureHandler = (NSError?) -> ()
    
    // MARK: - Properties
    public var URL: URLStringConvertible?
    public var URLRequest: URLRequestConvertible?
    public var headers: HttpHeaders?
    public var body: HttpBody?
    public var request: Request?
    public var formatName: String!
    public var successHandler: SuccessHandler?
    public var failureHandler: FailureHandler?
    
    // MARK: - Initializer
    public init(URL: URLStringConvertible, headers: HttpHeaders? = nil, body: HttpBody? = nil, formatName: String = HanekeGlobals.Cache.OriginalFormatName) {
        super.init(key: URL.URLString)
        self.URL = URL
        self.headers = headers
        self.body = body
        self.formatName = formatName
    }
    
    public init(request: URLRequestConvertible, formatName: String = HanekeGlobals.Cache.OriginalFormatName) {
        super.init(key: request.URLRequest.URLString)
        self.URLRequest = request
        self.formatName = formatName
    }
    
    // MARK: - Functions
    /**
     Fetching file with alamofire request

     - parameter failure: Failure handler block
     - parameter success: Success handler block
    */
    public override func fetch(failure failure: FailureHandler?, success: SuccessHandler?) {
        if URL == nil {
            failure?(nil)
        }
{'fraction_non_alphanumeric': 0.0917686318131257, 'fraction_numerical': 0.005005561735261402, 'mean_word_length': 2.830670926517572, 'pattern_counts': {'":': 0, '<': 7, '<?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': '789947', 'n_tokens_mistral': 1032, 'n_tokens_neox': 1002, 'n_words': 292}