SILENT KILLERPanel

Current Path: > > opt > > hc_python > > > lib64 > python3.12 > site-packages > filelock


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: //opt//hc_python///lib64/python3.12/site-packages/filelock

NameTypeSizeLast ModifiedActions
__pycache__ Directory - -
__init__.py File 1769 bytes April 04 2025 08:02:26.
_api.py File 14545 bytes April 04 2025 08:02:26.
_error.py File 787 bytes April 04 2025 08:02:26.
_soft.py File 1711 bytes April 04 2025 08:02:26.
_unix.py File 2351 bytes April 04 2025 08:02:26.
_util.py File 1715 bytes April 04 2025 08:02:26.
_windows.py File 2179 bytes April 04 2025 08:02:26.
asyncio.py File 12451 bytes April 04 2025 08:02:26.
py.typed File 0 bytes April 04 2025 08:02:26.
version.py File 513 bytes April 04 2025 08:02:26.

Reading File: //opt//hc_python///lib64/python3.12/site-packages/filelock/_soft.py

from __future__ import annotations

import os
import sys
from contextlib import suppress
from errno import EACCES, EEXIST
from pathlib import Path

from ._api import BaseFileLock
from ._util import ensure_directory_exists, raise_on_not_writable_file


class SoftFileLock(BaseFileLock):
    """Simply watches the existence of the lock file."""

    def _acquire(self) -> None:
        raise_on_not_writable_file(self.lock_file)
        ensure_directory_exists(self.lock_file)
        # first check for exists and read-only mode as the open will mask this case as EEXIST
        flags = (
            os.O_WRONLY  # open for writing only
            | os.O_CREAT
            | os.O_EXCL  # together with above raise EEXIST if the file specified by filename exists
            | os.O_TRUNC  # truncate the file to zero byte
        )
        try:
            file_handler = os.open(self.lock_file, flags, self._context.mode)
        except OSError as exception:  # re-raise unless expected exception
            if not (
                exception.errno == EEXIST  # lock already exist
                or (exception.errno == EACCES and sys.platform == "win32")  # has no access to this lock
            ):  # pragma: win32 no cover
                raise
        else:
            self._context.lock_file_fd = file_handler

    def _release(self) -> None:
        assert self._context.lock_file_fd is not None  # noqa: S101
        os.close(self._context.lock_file_fd)  # the lock file is definitely not None
        self._context.lock_file_fd = None
        with suppress(OSError):  # the file is already deleted and that's what we want
            Path(self.lock_file).unlink()


__all__ = [
    "SoftFileLock",
]

SILENT KILLER Tool