<commit_before>import time
import sys
from logging import debug
from cStringIO import StringIO

from model import *
import basedir
from namespaces import *
import ConfigParser
import reader
import download
from iface_cache import iface_cache

class Policy(object):
	__slots__ = ['root', 'implementation', 'watchers',
		     'help_with_testing', 'network_use',
		     'freshness', 'store', 'ready']

	def __init__(self, root, handler = None):
		self.store = iface_cache.stores[0]	# XXX
		self.watchers = []
		self.help_with_testing = False
		self.network_use = network_full
		self.freshness = 60 * 60 * 24 * 7	# Seconds allowed since last update

		# (allow self for backwards compat)
		self.handler = handler or self

		path = basedir.load_first_config(config_site, config_prog, 'global')
		if path:
			try:
				config = ConfigParser.ConfigParser()
				config.read(path)
				self.help_with_testing = config.getboolean('global',
								'help_with_testing')
				self.network_use = config.get('global', 'network_use')
				self.freshness = int(config.get('global', 'freshness'))
				assert self.network_use in network_levels
			except Exception, ex:
				print >>sys.stderr, "Error loading config:", ex

		self.set_root(root)

		iface_cache.add_watcher(self)
	<commit_msg>Removed stores from policy interface.<commit_after>import time
import sys
from logging import debug
from cStringIO import StringIO

from model import *
import basedir
from namespaces import *
import ConfigParser
import reader
import download
from iface_cache import iface_cache

class Policy(object):
	__slots__ = ['root', 'implementation', 'watchers',
		     'help_with_testing', 'network_use',
		     'freshness', 'ready']

	def __init__(self, root, handler = None):
		self.watchers = []
		self.help_with_testing = False
		self.network_use = network_full
		self.freshness = 60 * 60 * 24 * 7	# Seconds allowed since last update

		# (allow self for backwards compat)
		self.handler = handler or self

		path = basedir.load_first_config(config_site, config_prog, 'global')
		if path:
			try:
				config = ConfigParser.ConfigParser()
				config.read(path)
				self.help_with_testing = config.getboolean('global',
								'help_with_testing')
				self.network_use = config.get('global', 'network_use')
				self.freshness = int(config.get('global', 'freshness'))
				assert self.network_use in network_levels
			except Exception, ex:
				print >>sys.stderr, "Error loading config:", ex

		self.set_root(root)

		iface_cache.add_watcher(self)
	
{'fraction_non_alphanumeric': 0.10127591706539076, 'fraction_numerical': 0.005980861244019139, 'mean_word_length': 4.3382978723404255, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2989838', 'n_tokens_mistral': 895, 'n_tokens_neox': 764, 'n_words': 214}