Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(6)  |  Call(5)  |  Derive(0)  |  Import(1)

        def import_file(importer_class, col, path, allow_update = True):
    importer = importer_class(col, path)
    importer.allowUpdate = allow_update

    if importer.needMapper:
        importer.open()

    importer.run()
        


src/a/n/anki-sync-server-HEAD/AnkiServer/apps/rest_app.py   anki-sync-server(Download)
                fd.write(filedata)
 
            AnkiServer.importer.import_file(importer_class, col, path)
        finally:
            if path is not None:

src/a/n/AnkiServer-2.0.5/AnkiServer/apps/rest_app.py   AnkiServer(Download)
                fd.write(filedata)
 
            AnkiServer.importer.import_file(importer_class, col, path)
        finally:
            if path is not None:

src/a/n/anki-sync-server-HEAD/tests/test_importer.py   anki-sync-server(Download)
 
import AnkiServer
from AnkiServer.importer import get_importer_class, import_file
 
import anki.storage
 
        # import it into the main collection
        import_file(get_importer_class('apkg'), self.collection, dst1_path)
 
        # make sure the note exists
 
        # first, import it without allow_update - no change should happen
        import_file(get_importer_class('apkg'), self.collection, dst2_path, allow_update=False)
        note = self.collection.getNote(note_id)
        self.assertEqual(note['Front'], 'The front')
        self.assertEqual(note.tags, ['Tag1', 'Tag2'])
 
        # now, import it with allow_update=True, so the note should change
        import_file(get_importer_class('apkg'), self.collection, dst2_path, allow_update=True)