<commit_before>//
//  Swinject+Operators.swift
//  Pods
//
//  Created by <NAME> on 8/30/16.
//
//

import Swinject
import Foundation

//infix operator ~ { associativity left precedence 160 }
postfix operator ~> {}

/** Unary operator which automatically resolves the return type
 Usage: `SomeClass(dependencyA: r~>, dependencyB: r~>)`
 - Parameters:
 - r: Resolver
 - Returns: The resolved service type instance.
 - Important: Fails on unresolvable service.
 */
public postfix func ~> <Service>(r: ResolverType) -> Service {
    return r.resolve(Service.self)!
}

/** Binary operator ~> equivalent to `r.resolve(Service.Type)!`
 
 Usage: `SomeClass(dependencyA: r ~> DependencyA.self)`
 - Parameters:
 - r: Resolver
 - service: Type of service to resolve.
 
 - Returns: The resolved service type instance.
 - Important: Fails on unresolvable service.
 */
public func ~> <Service>(r: ResolverType, service: Service.Type) -> Service {
    return r.resolve(service)!
}

/** Binary operator ~> equivalent to `r.resolve(Service.Type, argument: Arg1)!`
 
 Usage: `SomeClass(dependencyA: r ~> (DependencyA.self, argument: arg))`
 - Parameters:
 - r: Resolver
 - o.service: Type of service to resolve.
 - o.argument: Argument to pass
 
 - Returns: The resolved service type instance.
 - Important: Fails on unresolvable service.
 */
public func ~> <Service, Arg1>(r: ResolverType, o: (service: Service.Type, argument: Arg1) ) -> Service {
    return r.resolve(o.service, argument: o.argument)!
}

/** Binary operator ~> equivalent to `r.resolve(Service.Type, arguments: (Arg1, Arg2))!`
 
 Usage: `SomeClass(dependencyA: r ~> (DependencyA.self, arguments: (arg1, arg2)))`
 - Parameters:
 - r: Resolver
 - o.service: Type of service to resolve.
 - o.arguments: Arguments to pass
 
 - Returns: The resolved service type instance.
 - Important: Fails on unresolvable service.
 */
public func ~> <Service, Arg1, Arg2>(r: ResolverType, o: (Service.Type, arguments: (Arg1, Arg2)) ) -> Service {
    return r.resolve(o.0, arguments: o.arguments)!
}<commit_msg>Added name to ~> operators<commit_after>//
//  Swinject+Operators.swift
//  Pods
//
//  Created by <NAME> on 8/30/16.
//
//

import Swinject
import Foundation

//infix operator ~ { associativity left precedence 160 }
postfix operator ~> {}

/** Unary operator which automatically resolves the return type
 Usage: `SomeClass(dependencyA: r~>, dependencyB: r~>)`
 - Parameters:
 - r: Resolver
 - Returns: The resolved service type instance.
 - Important: Fails on unresolvable service.
 */
public postfix func ~> <Service>(r: ResolverType) -> Service {
    return r.resolve(Service.self)!
}

/** Binary operator ~> equivalent to `r.resolve(Service.Type)!`
 
 Usage: `SomeClass(dependencyA: r ~> DependencyA.self)`
 - Parameters:
 - r: Resolver
 - service: Type of service to resolve.
 
 - Returns: The resolved service type instance.
 - Important: Fails on unresolvable service.
 */
public func ~> <Service>(r: ResolverType, service: Service.Type) -> Service {
    return r.resolve(service)!
}

/** Binary operator ~> equivalent to `r.resolve(Service.Type, name: "ServiceName")!`
 
 Usage: `SomeClass(dependencyA: r ~> (DependencyA.self, name: "ServiceName"))`
 - Parameters:
 - r: Resolver
 - service: Type of service to resolve.
 
 - Returns: The resolved service type instance.
 - Important: Fails on unresolvable service.
 */
public func ~> <Service>(r: ResolverType, o: (service: Service.Type, name: String)) -> Service {
    return r.resolve(o.service, name: o.name)!
}

/** Binary operator ~> equivalent to `r.resolve(Service.Type, argument: Arg1)!`
 
 Usage: `SomeClass(dependencyA: r ~> (DependencyA.self, argument: arg))`
 - Parameters:
 - r: Resolver
 - o.service: Type of service to resolve.
 - o.argument: Argument to pass
 
 - Returns: The resolved service type instance.
 - Important: Fails on unresolvable service.
 */
public func ~> <Service, Arg1>(r: ResolverType, o: (service: Service.Type, argument: Arg1) ) -> Service {
    return r.resolve(o.service, argument: o.argument)!
}

/** Binary operator ~> equivalent to `r.resolve(Service.Type, name: String, argument: Arg1)!`
 
 Usage: `SomeClass(dependencyA: r ~> (DependencyA.self, name: "ServiceName", argument: arg))`
 - Parameters:
 - r: Resolver
 - o.service: Type of service to resolve.
 - o.argument: Argument to pass
 
 - Returns: The resolved service type instance.
 - Important: Fails on unresolvable service.
 */
public func ~> <Service, Arg1>(r: ResolverType, o: (service: Service.Type, name: String, argument: Arg1) ) -> Service {
    return r.resolve(o.service, name: o.name, argument: o.argument)!
}

/** Binary operator ~> equivalent to `r.resolve(Service.Type, arguments: (Arg1, Arg2))!`
 
 Usage: `SomeClass(dependencyA: r ~> (DependencyA.self, arguments: (arg1, arg2)))`
 - Parameters:
 - r: Resolver
 - o.service: Type of service to resolve.
 - o.arguments: Arguments to pass
 
 - Returns: The resolved service type instance.
 - Important: Fails on unresolvable service.
 */
public func ~> <Service, Arg1, Arg2>(r: ResolverType, o: (Service.Type, arguments: (Arg1, Arg2)) ) -> Service {
    return r.resolve(o.0, arguments: o.arguments)!
}


/** Binary operator ~> equivalent to `r.resolve(Service.Type, name: "ServiceName", arguments: (Arg1, Arg2))!`
 
 Usage: `SomeClass(dependencyA: r ~> (DependencyA.self, name: "ServiceName", arguments: (arg1, arg2)))`
 - Parameters:
 - r: Resolver
 - o.service: Type of service to resolve.
 - o.arguments: Arguments to pass
 
 - Returns: The resolved service type instance.
 - Important: Fails on unresolvable service.
 */
public func ~> <Service, Arg1, Arg2>(r: ResolverType, o: (Service.Type, name: String, arguments: (Arg1, Arg2)) ) -> Service {
    return r.resolve(o.0, name: o.name, arguments: o.arguments)!
}


/** Binary operator ~> equivalent to `r.resolve(Service.Type, arguments: (Arg1, Arg2, Arg3))!`
 
 Usage: `SomeClass(dependencyA: r ~> (DependencyA.self, arguments: (arg1, arg2, arg3)))`
 - Parameters:
 - r: Resolver
 - o.service: Type of service to resolve.
 - o.arguments: Arguments to pass
 
 - Returns: The resolved service type instance.
 - Important: Fails on unresolvable service.
 */
public func ~> <Service, Arg1, Arg2, Arg3>(r: ResolverType, o: (Service.Type, arguments: (Arg1, Arg2, Arg3)) ) -> Service {
    return r.resolve(o.0, arguments: o.arguments)!
}

/** Binary operator ~> equivalent to `r.resolve(Service.Type, name: "ServiceName", arguments: (Arg1, Arg2, Arg3))!`
 
 Usage: `SomeClass(dependencyA: r ~> (DependencyA.self, name: "ServiceName", arguments: (arg1, arg2, arg3)))`
 - Parameters:
 - r: Resolver
 - o.service: Type of service to resolve.
 - o.arguments: Arguments to pass
 
 - Returns: The resolved service type instance.
 - Important: Fails on unresolvable service.
 */
public func ~> <Service, Arg1, Arg2, Arg3>(r: ResolverType, o: (Service.Type, name: String, arguments: (Arg1, Arg2, Arg3)) ) -> Service {
    return r.resolve(o.0, name: o.name, arguments: o.arguments)!
}
{'fraction_non_alphanumeric': 0.14538956397426733, 'fraction_numerical': 0.011150822015725518, 'mean_word_length': 3.993576017130621, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 73, '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': '3099956', 'n_tokens_mistral': 2300, 'n_tokens_neox': 2168, 'n_words': 699}