MCPcopy Create free account
hub / github.com/requests-cache/requests-cache / _get_sqlite_cache_path

Function _get_sqlite_cache_path

requests_cache/backends/sqlite.py:464–478  ·  view source on GitHub ↗

Get a resolved path for a SQLite database file (or memory URI)

(
    db_path: StrOrPath, use_cache_dir: bool, use_temp: bool, use_memory: bool = False
)

Source from the content-addressed store, hash-verified

462
463
464def _get_sqlite_cache_path(
465 db_path: StrOrPath, use_cache_dir: bool, use_temp: bool, use_memory: bool = False
466) -> StrOrPath:
467 """Get a resolved path for a SQLite database file (or memory URI)"""
468 # Use an in-memory database, if specified
469 db_path = str(db_path)
470 if use_memory:
471 return MEMORY_URI
472 elif ':memory:' in db_path or 'mode=memory' in db_path:
473 return db_path
474
475 # Add file extension if not specified
476 if not Path(db_path).suffix:
477 db_path += '.sqlite'
478 return get_cache_path(db_path, use_cache_dir, use_temp)
479
480
481def get_cache_path(db_path: StrOrPath, use_cache_dir: bool = False, use_temp: bool = False) -> Path:

Callers 1

__init__Method · 0.85

Calls 1

get_cache_pathFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…