MCPcopy Index your code
hub / github.com/pre-commit/pre-commit / connect

Method connect

pre_commit/store.py:112–123  ·  view source on GitHub ↗
(
            self,
            db_path: str | None = None,
    )

Source from the content-addressed store, hash-verified

110
111 @contextlib.contextmanager
112 def connect(
113 self,
114 db_path: str | None = None,
115 ) -> Generator[sqlite3.Connection]:
116 db_path = db_path or self.db_path
117 # sqlite doesn't close its fd with its contextmanager >.<
118 # contextlib.closing fixes this.
119 # See: https://stackoverflow.com/a/28032829/812183
120 with contextlib.closing(sqlite3.connect(db_path)) as db:
121 # this creates a transaction
122 with db:
123 yield db
124
125 @classmethod
126 def db_repo_name(cls, repo: str, deps: Sequence[str]) -> str:

Callers 13

__init__Method · 0.95
_get_resultMethod · 0.95
_new_repoMethod · 0.95
mark_config_usedMethod · 0.95
_gcFunction · 0.80
_select_all_configsFunction · 0.80
_select_all_reposFunction · 0.80
_repo_countFunction · 0.80
_config_countFunction · 0.80

Calls

no outgoing calls

Tested by 8

_select_all_configsFunction · 0.64
_select_all_reposFunction · 0.64
_repo_countFunction · 0.64
_config_countFunction · 0.64