MCPcopy Index your code
hub / github.com/PDFMathTranslate/PDFMathTranslate / init_db

Function init_db

pdf2zh/cache.py:98–112  ·  view source on GitHub ↗
(remove_exists=False)

Source from the content-addressed store, hash-verified

96
97
98def init_db(remove_exists=False):
99 cache_folder = os.path.join(os.path.expanduser("~"), ".cache", "pdf2zh")
100 os.makedirs(cache_folder, exist_ok=True)
101 # The current version does not support database migration, so add the version number to the file name.
102 cache_db_path = os.path.join(cache_folder, "cache.v1.db")
103 if remove_exists and os.path.exists(cache_db_path):
104 os.remove(cache_db_path)
105 db.init(
106 cache_db_path,
107 pragmas={
108 "journal_mode": "wal",
109 "busy_timeout": 1000,
110 },
111 )
112 db.create_tables([_TranslationCache], safe=True)
113
114
115def init_test_db():

Callers 1

cache.pyFile · 0.85

Calls 1

removeMethod · 0.80

Tested by

no test coverage detected