PHP 8.2.31
Preview: misc.py Size: 971 B
/proc/self/root/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/misc.py

# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 The Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
"""Backports for individual classes and functions."""

import os
import sys

__all__ = ['cache_from_source', 'callable', 'fsencode']


try:
    from imp import cache_from_source
except ImportError:
    def cache_from_source(py_file, debug=__debug__):
        ext = debug and 'c' or 'o'
        return py_file + ext


try:
    callable = callable
except NameError:
    from collections import Callable

    def callable(obj):
        return isinstance(obj, Callable)


try:
    fsencode = os.fsencode
except AttributeError:
    def fsencode(filename):
        if isinstance(filename, bytes):
            return filename
        elif isinstance(filename, str):
            return filename.encode(sys.getfilesystemencoding())
        else:
            raise TypeError("expect bytes or str, not %s" %
                            type(filename).__name__)

Directory Contents

Dirs: 0 × Files: 16

Name Size Perms Modified Actions
971 B lrw-r--r-- 2022-04-21 18:08:21
Edit Download
1.39 KB lrw-r--r-- 2022-04-21 18:08:34
Edit Download
1.39 KB lrw-r--r-- 2022-04-21 18:08:34
Edit Download
25.05 KB lrw-r--r-- 2022-04-21 18:08:21
Edit Download
25.83 KB lrw-r--r-- 2022-04-21 18:08:34
Edit Download
25.83 KB lrw-r--r-- 2022-04-21 18:08:34
Edit Download
2.56 KB lrw-r--r-- 2022-04-21 18:08:21
Edit Download
26.32 KB lrw-r--r-- 2022-04-21 18:08:21
Edit Download
20.31 KB lrw-r--r-- 2022-04-21 18:08:34
Edit Download
20.25 KB lrw-r--r-- 2022-04-21 18:08:35
Edit Download
90.46 KB lrw-r--r-- 2022-04-21 18:08:21
Edit Download
77.82 KB lrw-r--r-- 2022-04-21 18:08:34
Edit Download
77.82 KB lrw-r--r-- 2022-04-21 18:08:34
Edit Download
274 B lrw-r--r-- 2022-04-21 18:08:21
Edit Download
451 B lrw-r--r-- 2022-04-21 18:08:34
Edit Download
451 B lrw-r--r-- 2022-04-21 18:08:34
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).