parsers.parsers

Here are the examples of the python api parsers.parsers taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

Example 1

Project: python-imdb Source File: __init__.py
    def rebuild_index(self, dbdir):
        """Convert and index data files for random access.
           Index movie list for searching."""
        # Import and index data files
        if os.path.exists(self.dbfile):
            raise Exception('%s exists' % self.dbfile)
        for parsername, parser in parsers.parsers():
            obj = parser(dbfile=self.dbfile, dbdir=dbdir, debug=self.debug)
            if self.debug:
                print "Indexing %s..." % parsername
            with Timer(indent=2, quiet=not self.debug):
                obj.rebuild_index(do_copy=True)

        # Create index of movie titles
        if self.debug:
            print "Creating search index..."
        with Timer(indent=2, quiet=not self.debug):
            search.create_index(self.dbfile, dbdir, debug=self.debug)

Example 2

Project: python-imdb Source File: __init__.py
def _install_parsers():
    """Install support for each parser into the IMDb and IMDbTitle classes."""
    property_name = re.compile(r'(?<=[a-z])([A-Z])')
    for name, parser in parsers.parsers():
        name = property_name.sub(r'_\1', name).lower()
        populator = imdb_populator(parser, name, default=parser.default)
        setattr(IMDb, 'populate_'+name, populator)
        prop = property(*imdbtitle_property(name),
                        doc="""IMDb """+name+""" autogenerated property.""")
        setattr(IMDbTitle, name, prop)