$99 GRAYBYTE WORDPRESS FILE MANAGER $41

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/cloudlinux/venv/lib/python3.11/site-packages/setuptools/_distutils/

HOME
Current File : /opt/cloudlinux/venv/lib/python3.11/site-packages/setuptools/_distutils//_modified.py
"""Timestamp comparison of files and groups of files."""

from __future__ import annotations

import functools
import os.path
from collections.abc import Callable, Iterable
from typing import Literal, TypeVar

from jaraco.functools import splat

from .compat.py39 import zip_strict
from .errors import DistutilsFileError

_SourcesT = TypeVar(
    "_SourcesT", bound="str | bytes | os.PathLike[str] | os.PathLike[bytes]"
)
_TargetsT = TypeVar(
    "_TargetsT", bound="str | bytes | os.PathLike[str] | os.PathLike[bytes]"
)


def _newer(source, target):
    return not os.path.exists(target) or (
        os.path.getmtime(source) > os.path.getmtime(target)
    )


def newer(
    source: str | bytes | os.PathLike[str] | os.PathLike[bytes],
    target: str | bytes | os.PathLike[str] | os.PathLike[bytes],
) -> bool:
    """
    Is source modified more recently than target.

    Returns True if 'source' is modified more recently than
    'target' or if 'target' does not exist.

    Raises DistutilsFileError if 'source' does not exist.
    """
    if not os.path.exists(source):
        raise DistutilsFileError(f"file {os.path.abspath(source)!r} does not exist")

    return _newer(source, target)


def newer_pairwise(
    sources: Iterable[_SourcesT],
    targets: Iterable[_TargetsT],
    newer: Callable[[_SourcesT, _TargetsT], bool] = newer,
) -> tuple[list[_SourcesT], list[_TargetsT]]:
    """
    Filter filenames where sources are newer than targets.

    Walk two filename iterables in parallel, testing if each source is newer
    than its corresponding target.  Returns a pair of lists (sources,
    targets) where source is newer than target, according to the semantics
    of 'newer()'.
    """
    newer_pairs = filter(splat(newer), zip_strict(sources, targets))
    return tuple(map(list, zip(*newer_pairs))) or ([], [])


def newer_group(
    sources: Iterable[str | bytes | os.PathLike[str] | os.PathLike[bytes]],
    target: str | bytes | os.PathLike[str] | os.PathLike[bytes],
    missing: Literal["error", "ignore", "newer"] = "error",
) -> bool:
    """
    Is target out-of-date with respect to any file in sources.

    Return True if 'target' is out-of-date with respect to any file
    listed in 'sources'. In other words, if 'target' exists and is newer
    than every file in 'sources', return False; otherwise return True.
    ``missing`` controls how to handle a missing source file:

    - error (default): allow the ``stat()`` call to fail.
    - ignore: silently disregard any missing source files.
    - newer: treat missing source files as "target out of date". This
      mode is handy in "dry-run" mode: it will pretend to carry out
      commands that wouldn't work because inputs are missing, but
      that doesn't matter because dry-run won't run the commands.
    """

    def missing_as_newer(source):
        return missing == 'newer' and not os.path.exists(source)

    ignored = os.path.exists if missing == 'ignore' else None
    return not os.path.exists(target) or any(
        missing_as_newer(source) or _newer(source, target)
        for source in filter(ignored, sources)
    )


newer_pairwise_group = functools.partial(newer_pairwise, newer=newer_group)

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
14 Aug 2025 9.30 PM
root / root
0755
__pycache__
--
14 Aug 2025 9.30 PM
root / root
0755
command
--
14 Aug 2025 9.30 PM
root / root
0755
compat
--
14 Aug 2025 9.24 PM
root / root
0755
compilers
--
14 Aug 2025 9.24 PM
root / root
0755
tests
--
14 Aug 2025 9.24 PM
root / root
0755
__init__.py
0.351 KB
17 Apr 2025 8.10 PM
root / root
0644
_log.py
0.041 KB
17 Apr 2025 8.10 PM
root / root
0644
_macos_compat.py
0.233 KB
17 Apr 2025 8.10 PM
root / root
0644
_modified.py
3.136 KB
17 Apr 2025 8.10 PM
root / root
0644
_msvccompiler.py
0.327 KB
17 Apr 2025 8.10 PM
root / root
0644
archive_util.py
8.676 KB
17 Apr 2025 8.10 PM
root / root
0644
ccompiler.py
0.512 KB
17 Apr 2025 8.10 PM
root / root
0644
cmd.py
21.666 KB
17 Apr 2025 8.10 PM
root / root
0644
core.py
9.145 KB
17 Apr 2025 8.10 PM
root / root
0644
cygwinccompiler.py
0.58 KB
17 Apr 2025 8.10 PM
root / root
0644
debug.py
0.136 KB
17 Apr 2025 8.10 PM
root / root
0644
dep_util.py
0.341 KB
17 Apr 2025 8.10 PM
root / root
0644
dir_util.py
7.066 KB
17 Apr 2025 8.10 PM
root / root
0644
dist.py
54.486 KB
17 Apr 2025 8.10 PM
root / root
0644
errors.py
3.02 KB
17 Apr 2025 8.10 PM
root / root
0644
extension.py
10.894 KB
17 Apr 2025 8.10 PM
root / root
0644
fancy_getopt.py
17.476 KB
17 Apr 2025 8.10 PM
root / root
0644
file_util.py
7.791 KB
17 Apr 2025 8.10 PM
root / root
0644
filelist.py
14.978 KB
17 Apr 2025 8.10 PM
root / root
0644
log.py
1.172 KB
17 Apr 2025 8.10 PM
root / root
0644
spawn.py
3.99 KB
17 Apr 2025 8.10 PM
root / root
0644
sysconfig.py
19.266 KB
17 Apr 2025 8.10 PM
root / root
0644
text_file.py
11.817 KB
17 Apr 2025 8.10 PM
root / root
0644
unixccompiler.py
0.207 KB
17 Apr 2025 8.10 PM
root / root
0644
util.py
17.67 KB
17 Apr 2025 8.10 PM
root / root
0644
version.py
12.323 KB
17 Apr 2025 8.10 PM
root / root
0644
versionpredicate.py
5.083 KB
17 Apr 2025 8.10 PM
root / root
0644
zosccompiler.py
0.057 KB
17 Apr 2025 8.10 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF