<commit_before>module Reno
	class Package
		class State
			attr_reader :public, :private
			
			def initialize(package, parent)
				@package = package
				@parent = parent
				@components = {}
				@public = Components.new
				@private = Components.new
			end
			
			def nodes(type = nil, private = true)
				(private ? @private : @public).nodes(type)
			end
			
			def use(compoonents, args, block)
				result = []
				
				state = self
				
				if block
					state = @package.state(state, block)
				end
				
				args.each do |component|
					result.concat(compoonents.use(component, state))
				end
				
				result.flatten!
				
				if result.empty?
					nil
				elsif result.size == 1
					result.first
				else
					result
				end
			end
		end
		
		class Interface
			attr :state, true
			
			def initialize(package)
				@package = package
			end
			
			def name(name)
				@package.name = name
			end
			
			def version(version)
				@package.version = version
			end
			
			def nodes(type = nil)
				@state.nodes(type)
			end
			
			def use(*args, &block)
				@state.use(@state.private, args, block)
			end
			
			def export(*args, &block)
				@state.use(@state.public, args, block)
			end
			
			def o(name, desc = nil)
			end
		end
		
		attr :name, true
		attr :version, true
		
		def initialize(&block)
			@block = block
			@interface = Interface.new(self)
			@state = nil
		end
		
		def state(parent, block)
			old_state = @interface.state
			new_state = State.new(self, old_state)
			begin
				@interface.state = new_state
				@interface.instance_eval(&block)
			ensure
				@interface.state = old_state
			end
			new_state
		end
		
		def run
			state(0, @block)
		end
	end
end<commit_msg>State stored in package instead of interface.<commit_after>module Reno
	class Package
		class State
			attr_reader :public, :private
			
			def initialize(package, parent)
				@package = package
				@parent = parent
				@components = {}
				@public = Components.new
				@private = Components.new
			end
			
			def nodes(type = nil, private = true)
				(private ? @private : @public).nodes(type)
			end
			
			def use(components, args, block)
				result = []
				
				state = self
				
				if block
					state = @package.state_block(state, block)
				end
				
				args.each do |component|
					result.concat(components.use(component, state))
				end
				
				result.flatten!
				
				if result.empty?
					nil
				elsif result.size == 1
					result.first
				else
					result
				end
			end
		end
		
		class Interface
			def initialize(package)
				@package = package
			end

			def name(name)
				@package.name = name
			end
			
			def version(version)
				@package.version = version
			end
			
			def nodes(type = nil)
				@package.state.nodes(type)
			end
			
			def use(*args, &block)
				@package.state.use(@package.state.private, args, block)
			end
			
			def export(*args, &block)
				@package.state.use(@package.state.public, args, block)
			end
			
			def o(name, desc = nil)
			end
		end
		
		attr :name, true
		attr :version, true
		attr_reader :state
		
		def initialize(&block)
			@block = block
			@interface = Interface.new(self)
			@state = nil
		end
		
		def state_block(parent, block)
			old_state = @state
			new_state = State.new(self, old_state)
			begin
				@state = new_state
				@interface.instance_eval(&block)
			ensure
				@state = old_state
			end
			new_state
		end
		
		def run
			state_block(0, @block)
		end
	end
end
{'fraction_non_alphanumeric': 0.09579100145137881, 'fraction_numerical': 0.0011611030478955006, 'mean_word_length': 2.254013220018886, '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': '2433553', 'n_tokens_mistral': 1585, 'n_tokens_neox': 1106, 'n_words': 300}