| 77 | from threading import Lock |
| 78 | |
| 79 | class LockingGrid(Grid): |
| 80 | def __init__(self, height, width): |
| 81 | super().__init__(height, width) |
| 82 | self.lock = Lock() |
| 83 | |
| 84 | def __str__(self): |
| 85 | with self.lock: |
| 86 | return super().__str__() |
| 87 | |
| 88 | def get(self, y, x): |
| 89 | with self.lock: |
| 90 | return super().get(y, x) |
| 91 | |
| 92 | def set(self, y, x, state): |
| 93 | with self.lock: |
| 94 | return super().set(y, x, state) |
| 95 | |
| 96 | |
| 97 | def count_neighbors(y, x, get_cell): |
no outgoing calls
no test coverage detected