MCPcopy Index your code
hub / github.com/python/mypy / __init__

Method __init__

mypy/metastore.py:180–201  ·  view source on GitHub ↗
(
        self, cache_dir_prefix: str, set_journal_mode: bool = False, num_shards: int = 1
    )

Source from the content-addressed store, hash-verified

178
179class SqliteMetadataStore(MetadataStore):
180 def __init__(
181 self, cache_dir_prefix: str, set_journal_mode: bool = False, num_shards: int = 1
182 ) -> None:
183 # We check startswith instead of equality because the version
184 # will have already been appended by the time the cache dir is
185 # passed here.
186 self.dbs: list[sqlite3.Connection] = []
187 self.num_shards = num_shards
188 self.dirty_shards: set[int] = set()
189 if cache_dir_prefix.startswith(os.devnull):
190 return
191
192 os.makedirs(cache_dir_prefix, exist_ok=True)
193 if num_shards <= 1:
194 self.dbs.append(
195 connect_db(os_path_join(cache_dir_prefix, "cache.db"), set_journal_mode)
196 )
197 else:
198 for i in range(num_shards):
199 self.dbs.append(
200 connect_db(os_path_join(cache_dir_prefix, f"cache.{i}.db"), set_journal_mode)
201 )
202
203 def _shard_index(self, name: str) -> int:
204 if self.num_shards <= 1:

Callers

nothing calls this directly

Calls 6

os_path_joinFunction · 0.90
setClass · 0.85
connect_dbFunction · 0.85
rangeClass · 0.85
appendMethod · 0.80
startswithMethod · 0.45

Tested by

no test coverage detected