def __parsefile__(self): self.dict = {} # Ouvrir le fichier associe self.parser = _bibtex.open_file(Open.url_to_local(self.key), Config.get('bibtex/strict').data) # Incorporer les definitions de l'utilisateur if not Config.get('bibtex+/override').data: user = Config.get('bibtex/macros').data valid = re.compile('^\w+$') for k in user.keys(): if not valid.match(k): raise TypeError, _(u"key “%s” is malformed") % k _bibtex.set_string( self.parser, k, _bibtex.reverse(_base_fieldtype[Text], Config.get('bibtex+/braces').data, user[k][0])) errors = [] # Creer la base de cles iter = BibtexIterator(self, self.parser) try: entry = iter.first() if entry is not None: if entry.key is None: self.add(entry) else: if self.dict.has_key(entry.key): errors.append( _(u"%s:%d: key “%s” already defined") % (str(self.key), entry.line, entry.key.key)) else: self.dict[entry.key] = entry except Exceptions.ParserError, err: errors.append(str(err))
def __parsefile__(self): self.dict = {} # Ouvrir le fichier associe self.parser = _bibtex.open_file(Open.url_to_local(self.key), Config.get ('bibtex/strict').data) # Incorporer les definitions de l'utilisateur if not Config.get('bibtex+/override').data: user = Config.get('bibtex/macros').data valid = re.compile('^\w+$') for k in user.keys(): if not valid.match(k): raise TypeError, _("key `%s' is malformed") % k _bibtex.set_string(self.parser, k, _bibtex.reverse(_base_fieldtype[Text], Config.get('bibtex+/braces').data, user [k][0])) finished = 0 errors = [] # Creer la base de cles iter = BibtexIterator(self, self.parser) try: entry = iter.first() if entry is not None: if entry.key is None: self.add(entry) else: if self.dict.has_key(entry.key): errors.append(_("%s:%d: key `%s' already defined") % ( str(self.key), entry.line, entry.key.key)) else: self.dict [entry.key] = entry except Exceptions.ParserError, err: errors.append (str (err))
def iterator (url, check): ''' This methods returns an iterator that will parse the database on the fly (useful for merging or to parse broken databases ''' if check and url.url [2] [-4:] != '.med': return return MedlineIterator (open (Open.url_to_local (url), 'r'))
def iterator(url, check): ''' This methods returns an iterator that will parse the database on the fly (useful for merging or to parse broken databases ''' if check and url.url[2][-4:] != '.med': return return MedlineIterator(open(Open.url_to_local(url), 'r'))
def iterator(url, check): ''' This methods returns an iterator that will parse the database on the fly (useful for merging or to parse broken databases ''' if check and url.url[2][-5:] != '.ovid': return file = open(Open.url_to_local(url)) return OvidLike.OvidLike(file, Config.get('ovid/mapping').data, Config.get('ovid/deftype').data)
def iterator (url, check): ''' This methods returns an iterator that will parse the database on the fly (useful for merging or to parse broken databases ''' if check and url.url [2] [-5:] != '.ovid': return file = open (Open.url_to_local (url)) return OvidLike.OvidLike ( file, Config.get ('ovid/mapping').data, Config.get ('ovid/deftype').data )
def iterator (url, check): ''' This methods returns an iterator that will parse the database on the fly (useful for merging or to parse broken databases ''' if check and url.url [2] [-4:] != '.bib': return None # Ouvrir le fichier associe parser = _bibtex.open_file (Open.url_to_local (url), Config.get ('bibtex/strict').data) # create a database to generate correct keys db = Base.DataBase (url) return BibtexIterator (db, parser)
def iterator(url, check): ''' This methods returns an iterator that will parse the database on the fly (useful for merging or to parse broken databases ''' if check and url.url[2][-4:] != '.bib': return None # Ouvrir le fichier associe parser = _bibtex.open_file(Open.url_to_local(url), Config.get('bibtex/strict').data) # create a database to generate correct keys db = Base.DataBase(url) return BibtexIterator(db, parser)
def __init__(self, url): # each hash value contains a 2-uplet (opener, closer) self.format = None self.top = [] self.data = [] self.config = [] self.methods = {} fh = open(Open.url_to_local(url)) parser = sax.make_parser() parser.setFeature(sax.handler.feature_validation, False) parser.setContentHandler(self) parser.parse(fh) fh.close() return
def __init__ (self, url): # each hash value contains a 2-uplet (opener, closer) self.format = None self.top = [] self.data = [] self.config = [] self.methods = {} fh = open (Open.url_to_local (url)) parser = sax.make_parser () parser.setFeature (sax.handler.feature_validation, False) parser.setContentHandler (self) parser.parse (fh) fh.close () return
def iterator (url, check): if check and url.url [2] [-6:] != '.refer': return file = open (Open.url_to_local (url)) return ReferIterator (file)
def iterator(url, check): if check and url.url[2][-6:] != '.refer': return file = open(Open.url_to_local(url)) return ReferIterator(file)