Ejemplo n.º 1
0
def import_file(file, backend):
    url = backend
    backend = get_backend(backend)
    with backend(url) as bnd:
        if zipfile.is_zipfile(file):
            click.echo("Using packed SIPS File for {}".format(file))
            with PackedSipsFile(file) as psf:
                pstats = psf.stats
                for sips_file in psf:
                    print sips_file.path
                    stats = sips_file.stats
                    for line in sips_file:
                        if not line:
                            continue
                        bnd.insert(line)
                        print pstats.progress, stats.progress, stats.elapsed_time, stats.speed
        else:
            with SipsFile(file) as sips_file:
                stats = sips_file.stats
                for line in sips_file:
                    if not line:
                        continue
                    bnd.insert(line)
                    print stats.progress, stats.elapsed_time, stats.speed
Ejemplo n.º 2
0
 def test_get_backend(self):
     backend = get_backend("mongodb://*****:*****@host:1234/sips")
     self.assertEqual(backend, MongoDBBackend)