示例#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
示例#2
0
文件: weight.py 项目: spr3nk3ls/koert
	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
示例#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))
示例#4
0
文件: event.py 项目: spr3nk3ls/koert
	def from_path(cls, path, code, boozedir, board):
		return cls.from_array(open_rikf_ar(path), code, boozedir, board)
示例#5
0
文件: event.py 项目: spr3nk3ls/koert
	def from_path(cls, path, number, boozedir):
		ar = open_rikf_ar(path)
		return cls.from_array(ar, number, boozedir)
示例#6
0
文件: event.py 项目: spr3nk3ls/koert
	def _load_btc_from_path(cls, path, boozedir):
		return cls._load_btc_from_array(open_rikf_ar(path), boozedir)