404

[ Avaa Bypassed ]




Upload:

Command:

botdev@3.145.82.96: ~ $
"""
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()


Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
__init__.py File 6.68 KB 0644
newbytes.py File 14.56 KB 0644
newdict.py File 3.04 KB 0644
newint.py File 12.92 KB 0644
newlist.py File 2.23 KB 0644
newmemoryview.py File 654 B 0644
newobject.py File 3.65 KB 0644
newopen.py File 811 B 0644
newrange.py File 4.92 KB 0644
newstr.py File 14.83 KB 0644