<commit_before>@_exported import Node
import Core
import Foundation

public final class Config: StructuredDataWrapper {
    public var wrapped: StructuredData
    public var context: Context
    
    /// The arguments passed to theConfig
    public var arguments: [String]
    
    /// The current droplet environment
    public var environment: Environment
    
    /// For building onto the Config object
    public var storage: [String: Any]

    public init(_ wrapped: StructuredData, in context: Context?) {
        self.wrapped = wrapped.hydratedEnv() ?? StructuredData([:])
        self.context = context ?? emptyContext
        self.arguments = []
        self.environment = .development
        self.storage = [:]
    }

    public init(
        prioritized: [Source],
        arguments: [String] = CommandLine.arguments,
        environment: Environment = .development
    ) throws {
        let node = try Node.makeConfig(prioritized: prioritized)
        self.wrapped = node.wrapped
        self.context = emptyContext
        self.arguments = arguments
        self.environment = environment
        self.storage = [:]
    }
}

extension Config {
    public convenience init(
        arguments: [String] = CommandLine.arguments
    ) throws {
        let env = arguments.environment ?? .development

        let configDirectory = Config.workingDirectory(for: arguments) + "Config/"
<commit_msg>add ability to configure config w/ absolute directory<commit_after>@_exported import Node
import Core
import Foundation

public final class Config: StructuredDataWrapper {
    public var wrapped: StructuredData
    public var context: Context
    
    /// The arguments passed to theConfig
    public var arguments: [String]
    
    /// The current droplet environment
    public var environment: Environment
    
    /// For building onto the Config object
    public var storage: [String: Any]

    public init(_ wrapped: StructuredData, in context: Context?) {
        self.wrapped = wrapped.hydratedEnv() ?? StructuredData([:])
        self.context = context ?? emptyContext
        self.arguments = []
        self.environment = .development
        self.storage = [:]
    }

    public init(
        prioritized: [Source],
        arguments: [String] = CommandLine.arguments,
        environment: Environment = .development
    ) throws {
        let node = try Node.makeConfig(prioritized: prioritized)
        self.wrapped = node.wrapped
        self.context = emptyContext
        self.arguments = arguments
        self.environment = environment
        self.storage = [:]
    }
}

extension Config {
    public convenience init(
        arguments: [String] = CommandLine.arguments,
        absoluteDirectory: String? = nil
    ) throws {
        let env = arguments.environment ?? .development

        let configDirectory = absoluteDirectory
            ?? Config.workingDirectory(for: arguments) + "Config/"

{'fraction_non_alphanumeric': 0.08501194947080914, 'fraction_numerical': 0.0, 'mean_word_length': 2.5950920245398774, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2239431', 'n_tokens_mistral': 730, 'n_tokens_neox': 707, 'n_words': 227}