MCPcopy
hub / github.com/borgbackup/borg / release

Method release

src/borg/fslocking.py:180–199  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

178 pass
179
180 def release(self):
181 if not self.is_locked():
182 raise NotLocked(str(self.path))
183 if not self.by_me():
184 raise NotMyLock(str(self.path))
185 self.unique_name.unlink()
186 for retry in range(42):
187 try:
188 self.path.rmdir()
189 except OSError as err:
190 if err.errno in (errno.EACCES,):
191 # windows behaving strangely? -> just try again.
192 continue
193 if err.errno not in (errno.ENOTEMPTY, errno.EEXIST, errno.ENOENT):
194 # EACCES or EIO or ... = we cannot operate anyway, so re-throw
195 raise err
196 # else:
197 # Directory is not empty or doesn't exist any more.
198 # this means we lost the race to somebody else -- which is ok.
199 return
200
201 def is_locked(self):
202 return self.path.exists()

Callers 1

__exit__Method · 0.95

Calls 4

is_lockedMethod · 0.95
by_meMethod · 0.95
NotLockedClass · 0.70
NotMyLockClass · 0.70

Tested by

no test coverage detected