GRAYBYTE WORDPRESS FILE MANAGER3525

Server IP : 198.54.121.189 / Your IP : 216.73.216.112
System : Linux premium69.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
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /usr/lib/python3.8/site-packages/pip/_internal/utils/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /usr/lib/python3.8/site-packages/pip/_internal/utils//filesystem.py
import os
import os.path
import shutil
import stat
from contextlib import contextmanager
from tempfile import NamedTemporaryFile

# NOTE: retrying is not annotated in typeshed as on 2017-07-17, which is
#       why we ignore the type on this import.
from pip._vendor.retrying import retry  # type: ignore
from pip._vendor.six import PY2

from pip._internal.utils.compat import get_path_uid
from pip._internal.utils.misc import cast
from pip._internal.utils.typing import MYPY_CHECK_RUNNING

if MYPY_CHECK_RUNNING:
    from typing import BinaryIO, Iterator

    class NamedTemporaryFileResult(BinaryIO):
        @property
        def file(self):
            # type: () -> BinaryIO
            pass


def check_path_owner(path):
    # type: (str) -> bool
    # If we don't have a way to check the effective uid of this process, then
    # we'll just assume that we own the directory.
    if not hasattr(os, "geteuid"):
        return True

    previous = None
    while path != previous:
        if os.path.lexists(path):
            # Check if path is writable by current user.
            if os.geteuid() == 0:
                # Special handling for root user in order to handle properly
                # cases where users use sudo without -H flag.
                try:
                    path_uid = get_path_uid(path)
                except OSError:
                    return False
                return path_uid == 0
            else:
                return os.access(path, os.W_OK)
        else:
            previous, path = path, os.path.dirname(path)
    return False  # assume we don't own the path


def copy2_fixed(src, dest):
    # type: (str, str) -> None
    """Wrap shutil.copy2() but map errors copying socket files to
    SpecialFileError as expected.

    See also https://bugs.python.org/issue37700.
    """
    try:
        shutil.copy2(src, dest)
    except (OSError, IOError):
        for f in [src, dest]:
            try:
                is_socket_file = is_socket(f)
            except OSError:
                # An error has already occurred. Another error here is not
                # a problem and we can ignore it.
                pass
            else:
                if is_socket_file:
                    raise shutil.SpecialFileError("`%s` is a socket" % f)

        raise


def is_socket(path):
    # type: (str) -> bool
    return stat.S_ISSOCK(os.lstat(path).st_mode)


@contextmanager
def adjacent_tmp_file(path):
    # type: (str) -> Iterator[NamedTemporaryFileResult]
    """Given a path to a file, open a temp file next to it securely and ensure
    it is written to disk after the context reaches its end.
    """
    with NamedTemporaryFile(
        delete=False,
        dir=os.path.dirname(path),
        prefix=os.path.basename(path),
        suffix='.tmp',
    ) as f:
        result = cast('NamedTemporaryFileResult', f)
        try:
            yield result
        finally:
            result.file.flush()
            os.fsync(result.file.fileno())


_replace_retry = retry(stop_max_delay=1000, wait_fixed=250)

if PY2:
    @_replace_retry
    def replace(src, dest):
        # type: (str, str) -> None
        try:
            os.rename(src, dest)
        except OSError:
            os.remove(dest)
            os.rename(src, dest)

else:
    replace = _replace_retry(os.replace)

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
March 05 2024 23:45:22
root / root
0755
__pycache__
--
March 05 2024 23:45:22
root / root
0755
__init__.py
0 KB
October 17 2023 18:30:24
root / root
0644
appdirs.py
9.537 KB
October 17 2023 18:30:24
root / root
0644
compat.py
9.341 KB
October 17 2023 18:30:24
root / root
0644
deprecation.py
3.24 KB
October 17 2023 18:30:24
root / root
0644
encoding.py
1.289 KB
October 17 2023 18:30:24
root / root
0644
filesystem.py
3.256 KB
October 17 2023 18:30:24
root / root
0644
filetypes.py
0.558 KB
October 17 2023 18:30:24
root / root
0644
glibc.py
4.294 KB
October 17 2023 18:30:24
root / root
0644
hashes.py
3.926 KB
October 17 2023 18:30:24
root / root
0644
inject_securetransport.py
0.791 KB
October 17 2023 18:30:24
root / root
0644
logging.py
12.728 KB
October 17 2023 18:30:24
root / root
0644
marker_files.py
0.804 KB
October 17 2023 18:30:24
root / root
0644
misc.py
24.979 KB
October 17 2023 18:30:24
root / root
0644
models.py
1.121 KB
October 17 2023 18:30:24
root / root
0644
packaging.py
2.964 KB
October 17 2023 18:30:24
root / root
0644
setuptools_build.py
1.593 KB
October 17 2023 18:30:24
root / root
0644
subprocess.py
9.679 KB
October 17 2023 18:30:24
root / root
0644
temp_dir.py
5.392 KB
October 17 2023 18:30:24
root / root
0644
typing.py
1.099 KB
October 17 2023 18:30:24
root / root
0644
ui.py
13.58 KB
October 17 2023 18:30:24
root / root
0644
unpacking.py
9.455 KB
October 17 2023 18:30:24
root / root
0644
urls.py
1.446 KB
October 17 2023 18:30:24
root / root
0644
virtualenv.py
0.87 KB
October 17 2023 18:30:24
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF