MCPcopy
hub / github.com/isso-comments/isso / dispatch

Function dispatch

isso/migrate.py:335–356  ·  view source on GitHub ↗
(type, db, dump, empty_id=False)

Source from the content-addressed store, hash-verified

333
334
335def dispatch(type, db, dump, empty_id=False):
336 if db.execute("SELECT * FROM comments").fetchone():
337 if input("Isso DB is not empty! Continue? [y/N]: ") not in ("y", "Y"):
338 raise SystemExit("Abort.")
339
340 if type == "disqus":
341 cls = Disqus
342 elif type == "wordpress":
343 cls = WordPress
344 elif type == "generic":
345 cls = Generic
346 else:
347 with io.open(dump, encoding="utf-8") as fp:
348 cls = autodetect(fp.read(io.DEFAULT_BUFFER_SIZE))
349
350 if cls is None:
351 raise SystemExit("Unknown format, abort.")
352
353 if cls is Disqus:
354 cls = functools.partial(cls, empty_id=empty_id)
355
356 cls(db, dump).migrate()

Callers

nothing calls this directly

Calls 5

autodetectFunction · 0.85
executeMethod · 0.80
openMethod · 0.80
readMethod · 0.80
migrateMethod · 0.45

Tested by

no test coverage detected