(
self,
db_path: str | None = None,
)
| 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: |
no outgoing calls