PHP 8.0.30
Preview: newopen.py Size: 810 B
/opt/alt/python37/lib/python3.7/site-packages/future/types/newopen.py

"""
A substitute for the Python 3 open() function.

Note that io.open() is more complete but maybe slower. Even so, the
completeness may be a better default. TODO: compare these
"""

_builtin_open = open

class newopen(object):
    """Wrapper providing key part of Python 3 open() interface.

    From IPython's py3compat.py module. License: BSD.
    """
    def __init__(self, fname, mode="r", encoding="utf-8"):
        self.f = _builtin_open(fname, mode)
        self.enc = encoding

    def write(self, s):
        return self.f.write(s.encode(self.enc))

    def read(self, size=-1):
        return self.f.read(size).decode(self.enc)

    def close(self):
        return self.f.close()

    def __enter__(self):
        return self

    def __exit__(self, etype, value, traceback):
        self.f.close()

Directory Contents

Dirs: 1 × Files: 10

Name Size Perms Modified Actions
- drwxr-xr-x 2023-12-06 03:19:52
Edit Download
15.86 KB lrw-r--r-- 2018-10-25 22:21:01
Edit Download
3.03 KB lrw-r--r-- 2018-10-25 22:21:01
Edit Download
12.92 KB lrw-r--r-- 2018-10-25 22:21:01
Edit Download
2.23 KB lrw-r--r-- 2018-10-25 22:21:01
Edit Download
654 B lrw-r--r-- 2018-10-25 22:21:01
Edit Download
3.26 KB lrw-r--r-- 2018-10-25 22:21:01
Edit Download
810 B lrw-r--r-- 2018-10-25 22:21:01
Edit Download
5.07 KB lrw-r--r-- 2018-10-25 22:21:01
Edit Download
15.10 KB lrw-r--r-- 2018-10-25 22:21:01
Edit Download
6.67 KB lrw-r--r-- 2018-10-25 22:21:01
Edit Download

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