Example #1
0
 def __init__(self, path):
     factors = {}
     self.path = path
     ar = open_rikf_ar(path)
     for line in ar:
         factor = Factor.from_line(line)
         handle = factor.handle
         if handle in factors:
             raise ValueError("factor handle appears " "twice: %s" % (handle,))
         factors[handle] = factor
     self.factors = factors
Example #2
0
	def __init__(self, path, boozedir):
		weights = {}
		self.boozedir = boozedir
		self.path = path
		ar = open_rikf_ar(path)
		for line in ar:
			weight = Weight.from_line(line, boozedir.productdir)
			product = weight.product
			if product in weights:
				raise ValueError("weight of product appears "
					"twice: %s" % (product,))
			weights[product] = weight
			product.weight = weight
		self.weights = weights
Example #3
0
 def __init__(self, path, boozedir):
     errors = []
     products = {}
     self.boozedir = boozedir
     self.path = path
     ar = open_rikf_ar(path)
     for line in ar:
         try:
             product = Product.from_line(line, self.boozedir)
         except MildErr as e:
             errors.append(LoadErr("product", line, e))
             continue
         handle = product.handle
         if handle in products:
             errors.append(DoubleErr("product handle", handle))
             continue
         products[handle] = product
     self.products = products
     if len(errors) > 0:
         warn("Errors when loading the product directory: %s" % ManyMildErrs(errors))
Example #4
0
	def from_path(cls, path, code, boozedir, board):
		return cls.from_array(open_rikf_ar(path), code, boozedir, board)
Example #5
0
	def from_path(cls, path, number, boozedir):
		ar = open_rikf_ar(path)
		return cls.from_array(ar, number, boozedir)
Example #6
0
	def _load_btc_from_path(cls, path, boozedir):
		return cls._load_btc_from_array(open_rikf_ar(path), boozedir)