A simple _ModuleLock equivalent for Python builds without multi-threading support.
| 390 | |
| 391 | |
| 392 | class _DummyModuleLock: |
| 393 | """A simple _ModuleLock equivalent for Python builds without |
| 394 | multi-threading support.""" |
| 395 | |
| 396 | def __init__(self, name): |
| 397 | self.name = name |
| 398 | self.count = 0 |
| 399 | |
| 400 | def acquire(self): |
| 401 | self.count += 1 |
| 402 | return True |
| 403 | |
| 404 | def release(self): |
| 405 | if self.count == 0: |
| 406 | raise RuntimeError('cannot release un-acquired lock') |
| 407 | self.count -= 1 |
| 408 | |
| 409 | def __repr__(self): |
| 410 | return f'_DummyModuleLock({self.name!r}) at {id(self)}' |
| 411 | |
| 412 | |
| 413 | class _ModuleLockManager: |
no outgoing calls
no test coverage detected
searching dependent graphs…