def exclusive_lock(self): def blocked_cb(): # pragma: no cover (tests are single-process) logger.info('Locking pre-commit directory') with file_lock.lock(os.path.join(self.directory, '.lock'), blocked_cb): yield
def exclusive_lock(self) -> Generator[None, None, None]: def blocked_cb() -> None: # pragma: no cover (tests are in-process) logger.info('Locking pre-commit directory') with file_lock.lock(os.path.join(self.directory, '.lock'), blocked_cb): yield
def exclusive_lock(self, quiet=False): if not quiet: logger.info('Locking pre-commit directory') with file_lock.lock(os.path.join(self.directory, '.lock')): yield