(self)
| 182 | return f"<{self.__class__.__name__} {self._location}>" |
| 183 | |
| 184 | def __enter__(self): |
| 185 | if self.do_create: |
| 186 | self.do_create = False |
| 187 | self.create() |
| 188 | self.created = True |
| 189 | try: |
| 190 | self.open(exclusive=bool(self.exclusive), lock_wait=self.lock_wait, lock=self.do_lock) |
| 191 | except Exception: |
| 192 | self.close() |
| 193 | raise |
| 194 | return self |
| 195 | |
| 196 | def __exit__(self, exc_type, exc_val, exc_tb): |
| 197 | self.close() |