Create a LockFile instance on the given file path, and acquire lock. :param str path: the path to the file that will hold a lock
(self, path: str)
| 34 | depending on Linux or Windows. |
| 35 | """ |
| 36 | def __init__(self, path: str) -> None: |
| 37 | """ |
| 38 | Create a LockFile instance on the given file path, and acquire lock. |
| 39 | :param str path: the path to the file that will hold a lock |
| 40 | """ |
| 41 | self._path = path |
| 42 | mechanism = _UnixLockMechanism if POSIX_MODE else _WindowsLockMechanism |
| 43 | self._lock_mechanism = mechanism(path) |
| 44 | |
| 45 | self.acquire() |
| 46 | |
| 47 | def __repr__(self) -> str: |
| 48 | repr_str = '{0}({1}) <'.format(self.__class__.__name__, self._path) |