def from_csv(ss,reader,verifier = None): for row in reader: data = ss.readrow(row) if data is None: continue (name,type,who,what,when,where,merge) = data if verifier is not None: verifier.verify_row(name,type,who,what,when,where,merge) merge = merge.lower() == 'yes' or merge.lower() == 'true' yield Element(who,what,where,fullpattern.FullPattern(when),merge,type,name)
def parse(self): (base,mult,implicit) = self._p.parse_full() if mult is not None and self._group is not None: if implicit: base = self._group.last() return self._apply(base,mult) else: out = fullpattern.FullPattern(base) if self._group is not None: self._group.track_pattern(out) return out
def _apply(self,base,mult): out = fullpattern.FullPattern() for p in self._group.get_next_n(base,mult,trial = False): out.addAll(p) return out
def add_event(part, when, code, what, who): dt = get_details(part, code) dt.addRow( element.Element(who, what, "See faculty notices", fullpattern.FullPattern(when), True, 'Lecture', mml_subjs[part][code]))
def from_json(e,template,type,name): out = Element(e['who'],e['what'],e['where'],fullpattern.FullPattern(e['code'],template),e['merge'],type,name) if isinstance(out._when,str): raise Exception("string! '%s'" % out._when) return out