Back
Type Name Operations
__future__.cpython-36.opt-1.pyc
__future__.cpython-36.opt-2.pyc
__future__.cpython-36.pyc
__phello__.foo.cpython-36.opt-1.pyc
__phello__.foo.cpython-36.opt-2.pyc
__phello__.foo.cpython-36.pyc
_bootlocale.cpython-36.opt-1.pyc
_bootlocale.cpython-36.opt-2.pyc
_bootlocale.cpython-36.pyc
_collections_abc.cpython-36.opt-1.pyc
_collections_abc.cpython-36.opt-2.pyc
_collections_abc.cpython-36.pyc
_compat_pickle.cpython-36.opt-1.pyc
_compat_pickle.cpython-36.opt-2.pyc
_compat_pickle.cpython-36.pyc
_compression.cpython-36.opt-1.pyc
_compression.cpython-36.opt-2.pyc
_compression.cpython-36.pyc
_dummy_thread.cpython-36.opt-1.pyc
_dummy_thread.cpython-36.opt-2.pyc
_dummy_thread.cpython-36.pyc
_markupbase.cpython-36.opt-1.pyc
_markupbase.cpython-36.opt-2.pyc
_markupbase.cpython-36.pyc
_osx_support.cpython-36.opt-1.pyc
_osx_support.cpython-36.opt-2.pyc
_osx_support.cpython-36.pyc
_pydecimal.cpython-36.opt-1.pyc
_pydecimal.cpython-36.opt-2.pyc
_pydecimal.cpython-36.pyc
_pyio.cpython-36.opt-1.pyc
_pyio.cpython-36.opt-2.pyc
_pyio.cpython-36.pyc
_sitebuiltins.cpython-36.opt-1.pyc
_sitebuiltins.cpython-36.opt-2.pyc
_sitebuiltins.cpython-36.pyc
_strptime.cpython-36.opt-1.pyc
_strptime.cpython-36.opt-2.pyc
_strptime.cpython-36.pyc
_sysconfigdata_dm_linux_x86_64-linux-gnu.cpython-36.opt-1.pyc
_sysconfigdata_dm_linux_x86_64-linux-gnu.cpython-36.opt-2.pyc
_sysconfigdata_dm_linux_x86_64-linux-gnu.cpython-36.pyc
_sysconfigdata_m_linux_x86_64-linux-gnu.cpython-36.opt-1.pyc
_sysconfigdata_m_linux_x86_64-linux-gnu.cpython-36.opt-2.pyc
_sysconfigdata_m_linux_x86_64-linux-gnu.cpython-36.pyc
_threading_local.cpython-36.opt-1.pyc
_threading_local.cpython-36.opt-2.pyc
_threading_local.cpython-36.pyc
_weakrefset.cpython-36.opt-1.pyc
_weakrefset.cpython-36.opt-2.pyc
_weakrefset.cpython-36.pyc
abc.cpython-36.opt-1.pyc
abc.cpython-36.opt-2.pyc
abc.cpython-36.pyc
aifc.cpython-36.opt-1.pyc
aifc.cpython-36.opt-2.pyc
aifc.cpython-36.pyc
antigravity.cpython-36.opt-1.pyc
antigravity.cpython-36.opt-2.pyc
antigravity.cpython-36.pyc
argparse.cpython-36.opt-1.pyc
argparse.cpython-36.opt-2.pyc
argparse.cpython-36.pyc
ast.cpython-36.opt-1.pyc
ast.cpython-36.opt-2.pyc
ast.cpython-36.pyc
asynchat.cpython-36.opt-1.pyc
asynchat.cpython-36.opt-2.pyc
asynchat.cpython-36.pyc
asyncore.cpython-36.opt-1.pyc
asyncore.cpython-36.opt-2.pyc
asyncore.cpython-36.pyc
base64.cpython-36.opt-1.pyc
base64.cpython-36.opt-2.pyc
base64.cpython-36.pyc
bdb.cpython-36.opt-1.pyc
bdb.cpython-36.opt-2.pyc
bdb.cpython-36.pyc
binhex.cpython-36.opt-1.pyc
binhex.cpython-36.opt-2.pyc
binhex.cpython-36.pyc
bisect.cpython-36.opt-1.pyc
bisect.cpython-36.opt-2.pyc
bisect.cpython-36.pyc
bz2.cpython-36.opt-1.pyc
bz2.cpython-36.opt-2.pyc
bz2.cpython-36.pyc
cProfile.cpython-36.opt-1.pyc
cProfile.cpython-36.opt-2.pyc
cProfile.cpython-36.pyc
calendar.cpython-36.opt-1.pyc
calendar.cpython-36.opt-2.pyc
calendar.cpython-36.pyc
cgi.cpython-36.opt-1.pyc
cgi.cpython-36.opt-2.pyc
cgi.cpython-36.pyc
cgitb.cpython-36.opt-1.pyc
cgitb.cpython-36.opt-2.pyc
cgitb.cpython-36.pyc
chunk.cpython-36.opt-1.pyc
chunk.cpython-36.opt-2.pyc
chunk.cpython-36.pyc
cmd.cpython-36.opt-1.pyc
cmd.cpython-36.opt-2.pyc
cmd.cpython-36.pyc
code.cpython-36.opt-1.pyc
code.cpython-36.opt-2.pyc
code.cpython-36.pyc
codecs.cpython-36.opt-1.pyc
codecs.cpython-36.opt-2.pyc
codecs.cpython-36.pyc
codeop.cpython-36.opt-1.pyc
codeop.cpython-36.opt-2.pyc
codeop.cpython-36.pyc
colorsys.cpython-36.opt-1.pyc
colorsys.cpython-36.opt-2.pyc
colorsys.cpython-36.pyc
compileall.cpython-36.opt-1.pyc
compileall.cpython-36.opt-2.pyc
compileall.cpython-36.pyc
configparser.cpython-36.opt-1.pyc
configparser.cpython-36.opt-2.pyc
configparser.cpython-36.pyc
contextlib.cpython-36.opt-1.pyc
contextlib.cpython-36.opt-2.pyc
contextlib.cpython-36.pyc
copy.cpython-36.opt-1.pyc
copy.cpython-36.opt-2.pyc
copy.cpython-36.pyc
copyreg.cpython-36.opt-1.pyc
copyreg.cpython-36.opt-2.pyc
copyreg.cpython-36.pyc
crypt.cpython-36.opt-1.pyc
crypt.cpython-36.opt-2.pyc
crypt.cpython-36.pyc
csv.cpython-36.opt-1.pyc
csv.cpython-36.opt-2.pyc
csv.cpython-36.pyc
datetime.cpython-36.opt-1.pyc
datetime.cpython-36.opt-2.pyc
datetime.cpython-36.pyc
decimal.cpython-36.opt-1.pyc
decimal.cpython-36.opt-2.pyc
decimal.cpython-36.pyc
difflib.cpython-36.opt-1.pyc
difflib.cpython-36.opt-2.pyc
difflib.cpython-36.pyc
dis.cpython-36.opt-1.pyc
dis.cpython-36.opt-2.pyc
dis.cpython-36.pyc
doctest.cpython-36.opt-1.pyc
doctest.cpython-36.opt-2.pyc
doctest.cpython-36.pyc
dummy_threading.cpython-36.opt-1.pyc
dummy_threading.cpython-36.opt-2.pyc
dummy_threading.cpython-36.pyc
enum.cpython-36.opt-1.pyc
enum.cpython-36.opt-2.pyc
enum.cpython-36.pyc
filecmp.cpython-36.opt-1.pyc
filecmp.cpython-36.opt-2.pyc
filecmp.cpython-36.pyc
fileinput.cpython-36.opt-1.pyc
fileinput.cpython-36.opt-2.pyc
fileinput.cpython-36.pyc
fnmatch.cpython-36.opt-1.pyc
fnmatch.cpython-36.opt-2.pyc
fnmatch.cpython-36.pyc
formatter.cpython-36.opt-1.pyc
formatter.cpython-36.opt-2.pyc
formatter.cpython-36.pyc
fractions.cpython-36.opt-1.pyc
fractions.cpython-36.opt-2.pyc
fractions.cpython-36.pyc
ftplib.cpython-36.opt-1.pyc
ftplib.cpython-36.opt-2.pyc
ftplib.cpython-36.pyc
functools.cpython-36.opt-1.pyc
functools.cpython-36.opt-2.pyc
functools.cpython-36.pyc
genericpath.cpython-36.opt-1.pyc
genericpath.cpython-36.opt-2.pyc
genericpath.cpython-36.pyc
getopt.cpython-36.opt-1.pyc
getopt.cpython-36.opt-2.pyc
getopt.cpython-36.pyc
getpass.cpython-36.opt-1.pyc
getpass.cpython-36.opt-2.pyc
getpass.cpython-36.pyc
gettext.cpython-36.opt-1.pyc
gettext.cpython-36.opt-2.pyc
gettext.cpython-36.pyc
glob.cpython-36.opt-1.pyc
glob.cpython-36.opt-2.pyc
glob.cpython-36.pyc
gzip.cpython-36.opt-1.pyc
gzip.cpython-36.opt-2.pyc
gzip.cpython-36.pyc
hashlib.cpython-36.opt-1.pyc
hashlib.cpython-36.opt-2.pyc
hashlib.cpython-36.pyc
heapq.cpython-36.opt-1.pyc
heapq.cpython-36.opt-2.pyc
heapq.cpython-36.pyc
hmac.cpython-36.opt-1.pyc
hmac.cpython-36.opt-2.pyc
hmac.cpython-36.pyc
imaplib.cpython-36.opt-1.pyc
imaplib.cpython-36.opt-2.pyc
imaplib.cpython-36.pyc
imghdr.cpython-36.opt-1.pyc
imghdr.cpython-36.opt-2.pyc
imghdr.cpython-36.pyc
imp.cpython-36.opt-1.pyc
imp.cpython-36.opt-2.pyc
imp.cpython-36.pyc
inspect.cpython-36.opt-1.pyc
inspect.cpython-36.opt-2.pyc
inspect.cpython-36.pyc
io.cpython-36.opt-1.pyc
io.cpython-36.opt-2.pyc
io.cpython-36.pyc
ipaddress.cpython-36.opt-1.pyc
ipaddress.cpython-36.opt-2.pyc
ipaddress.cpython-36.pyc
keyword.cpython-36.opt-1.pyc
keyword.cpython-36.opt-2.pyc
keyword.cpython-36.pyc
linecache.cpython-36.opt-1.pyc
linecache.cpython-36.opt-2.pyc
linecache.cpython-36.pyc
locale.cpython-36.opt-1.pyc
locale.cpython-36.opt-2.pyc
locale.cpython-36.pyc
lzma.cpython-36.opt-1.pyc
lzma.cpython-36.opt-2.pyc
lzma.cpython-36.pyc
macpath.cpython-36.opt-1.pyc
macpath.cpython-36.opt-2.pyc
macpath.cpython-36.pyc
macurl2path.cpython-36.opt-1.pyc
macurl2path.cpython-36.opt-2.pyc
macurl2path.cpython-36.pyc
mailbox.cpython-36.opt-1.pyc
mailbox.cpython-36.opt-2.pyc
mailbox.cpython-36.pyc
mailcap.cpython-36.opt-1.pyc
mailcap.cpython-36.opt-2.pyc
mailcap.cpython-36.pyc
mimetypes.cpython-36.opt-1.pyc
mimetypes.cpython-36.opt-2.pyc
mimetypes.cpython-36.pyc
modulefinder.cpython-36.opt-1.pyc
modulefinder.cpython-36.opt-2.pyc
modulefinder.cpython-36.pyc
netrc.cpython-36.opt-1.pyc
netrc.cpython-36.opt-2.pyc
netrc.cpython-36.pyc
nntplib.cpython-36.opt-1.pyc
nntplib.cpython-36.opt-2.pyc
nntplib.cpython-36.pyc
ntpath.cpython-36.opt-1.pyc
ntpath.cpython-36.opt-2.pyc
ntpath.cpython-36.pyc
nturl2path.cpython-36.opt-1.pyc
nturl2path.cpython-36.opt-2.pyc
nturl2path.cpython-36.pyc
numbers.cpython-36.opt-1.pyc
numbers.cpython-36.opt-2.pyc
numbers.cpython-36.pyc
opcode.cpython-36.opt-1.pyc
opcode.cpython-36.opt-2.pyc
opcode.cpython-36.pyc
operator.cpython-36.opt-1.pyc
operator.cpython-36.opt-2.pyc
operator.cpython-36.pyc
optparse.cpython-36.opt-1.pyc
optparse.cpython-36.opt-2.pyc
optparse.cpython-36.pyc
os.cpython-36.opt-1.pyc
os.cpython-36.opt-2.pyc
os.cpython-36.pyc
pathlib.cpython-36.opt-1.pyc
pathlib.cpython-36.opt-2.pyc
pathlib.cpython-36.pyc
pdb.cpython-36.opt-1.pyc
pdb.cpython-36.opt-2.pyc
pdb.cpython-36.pyc
pickle.cpython-36.opt-1.pyc
pickle.cpython-36.opt-2.pyc
pickle.cpython-36.pyc
pickletools.cpython-36.opt-1.pyc
pickletools.cpython-36.opt-2.pyc
pickletools.cpython-36.pyc
pipes.cpython-36.opt-1.pyc
pipes.cpython-36.opt-2.pyc
pipes.cpython-36.pyc
pkgutil.cpython-36.opt-1.pyc
pkgutil.cpython-36.opt-2.pyc
pkgutil.cpython-36.pyc
platform.cpython-36.opt-1.pyc
platform.cpython-36.opt-2.pyc
platform.cpython-36.pyc
plistlib.cpython-36.opt-1.pyc
plistlib.cpython-36.opt-2.pyc
plistlib.cpython-36.pyc
poplib.cpython-36.opt-1.pyc
poplib.cpython-36.opt-2.pyc
poplib.cpython-36.pyc
posixpath.cpython-36.opt-1.pyc
posixpath.cpython-36.opt-2.pyc
posixpath.cpython-36.pyc
pprint.cpython-36.opt-1.pyc
pprint.cpython-36.opt-2.pyc
pprint.cpython-36.pyc
profile.cpython-36.opt-1.pyc
profile.cpython-36.opt-2.pyc
profile.cpython-36.pyc
pstats.cpython-36.opt-1.pyc
pstats.cpython-36.opt-2.pyc
pstats.cpython-36.pyc
pty.cpython-36.opt-1.pyc
pty.cpython-36.opt-2.pyc
pty.cpython-36.pyc
py_compile.cpython-36.opt-1.pyc
py_compile.cpython-36.opt-2.pyc
py_compile.cpython-36.pyc
pyclbr.cpython-36.opt-1.pyc
pyclbr.cpython-36.opt-2.pyc
pyclbr.cpython-36.pyc
pydoc.cpython-36.opt-1.pyc
pydoc.cpython-36.opt-2.pyc
pydoc.cpython-36.pyc
queue.cpython-36.opt-1.pyc
queue.cpython-36.opt-2.pyc
queue.cpython-36.pyc
quopri.cpython-36.opt-1.pyc
quopri.cpython-36.opt-2.pyc
quopri.cpython-36.pyc
random.cpython-36.opt-1.pyc
random.cpython-36.opt-2.pyc
random.cpython-36.pyc
re.cpython-36.opt-1.pyc
re.cpython-36.opt-2.pyc
re.cpython-36.pyc
reprlib.cpython-36.opt-1.pyc
reprlib.cpython-36.opt-2.pyc
reprlib.cpython-36.pyc
rlcompleter.cpython-36.opt-1.pyc
rlcompleter.cpython-36.opt-2.pyc
rlcompleter.cpython-36.pyc
runpy.cpython-36.opt-1.pyc
runpy.cpython-36.opt-2.pyc
runpy.cpython-36.pyc
sched.cpython-36.opt-1.pyc
sched.cpython-36.opt-2.pyc
sched.cpython-36.pyc
secrets.cpython-36.opt-1.pyc
secrets.cpython-36.opt-2.pyc
secrets.cpython-36.pyc
selectors.cpython-36.opt-1.pyc
selectors.cpython-36.opt-2.pyc
selectors.cpython-36.pyc
shelve.cpython-36.opt-1.pyc
shelve.cpython-36.opt-2.pyc
shelve.cpython-36.pyc
shlex.cpython-36.opt-1.pyc
shlex.cpython-36.opt-2.pyc
shlex.cpython-36.pyc
shutil.cpython-36.opt-1.pyc
shutil.cpython-36.opt-2.pyc
shutil.cpython-36.pyc
signal.cpython-36.opt-1.pyc
signal.cpython-36.opt-2.pyc
signal.cpython-36.pyc
site.cpython-36.opt-1.pyc
site.cpython-36.opt-2.pyc
site.cpython-36.pyc
smtpd.cpython-36.opt-1.pyc
smtpd.cpython-36.opt-2.pyc
smtpd.cpython-36.pyc
smtplib.cpython-36.opt-1.pyc
smtplib.cpython-36.opt-2.pyc
smtplib.cpython-36.pyc
sndhdr.cpython-36.opt-1.pyc
sndhdr.cpython-36.opt-2.pyc
sndhdr.cpython-36.pyc
socket.cpython-36.opt-1.pyc
socket.cpython-36.opt-2.pyc
socket.cpython-36.pyc
socketserver.cpython-36.opt-1.pyc
socketserver.cpython-36.opt-2.pyc
socketserver.cpython-36.pyc
sre_compile.cpython-36.opt-1.pyc
sre_compile.cpython-36.opt-2.pyc
sre_compile.cpython-36.pyc
sre_constants.cpython-36.opt-1.pyc
sre_constants.cpython-36.opt-2.pyc
sre_constants.cpython-36.pyc
sre_parse.cpython-36.opt-1.pyc
sre_parse.cpython-36.opt-2.pyc
sre_parse.cpython-36.pyc
ssl.cpython-36.opt-1.pyc
ssl.cpython-36.opt-2.pyc
ssl.cpython-36.pyc
stat.cpython-36.opt-1.pyc
stat.cpython-36.opt-2.pyc
stat.cpython-36.pyc
statistics.cpython-36.opt-1.pyc
statistics.cpython-36.opt-2.pyc
statistics.cpython-36.pyc
string.cpython-36.opt-1.pyc
string.cpython-36.opt-2.pyc
string.cpython-36.pyc
stringprep.cpython-36.opt-1.pyc
stringprep.cpython-36.opt-2.pyc
stringprep.cpython-36.pyc
struct.cpython-36.opt-1.pyc
struct.cpython-36.opt-2.pyc
struct.cpython-36.pyc
subprocess.cpython-36.opt-1.pyc
subprocess.cpython-36.opt-2.pyc
subprocess.cpython-36.pyc
sunau.cpython-36.opt-1.pyc
sunau.cpython-36.opt-2.pyc
sunau.cpython-36.pyc
symbol.cpython-36.opt-1.pyc
symbol.cpython-36.opt-2.pyc
symbol.cpython-36.pyc
symtable.cpython-36.opt-1.pyc
symtable.cpython-36.opt-2.pyc
symtable.cpython-36.pyc
sysconfig.cpython-36.opt-1.pyc
sysconfig.cpython-36.opt-2.pyc
sysconfig.cpython-36.pyc
tabnanny.cpython-36.opt-1.pyc
tabnanny.cpython-36.opt-2.pyc
tabnanny.cpython-36.pyc
tarfile.cpython-36.opt-1.pyc
tarfile.cpython-36.opt-2.pyc
tarfile.cpython-36.pyc
telnetlib.cpython-36.opt-1.pyc
telnetlib.cpython-36.opt-2.pyc
telnetlib.cpython-36.pyc
tempfile.cpython-36.opt-1.pyc
tempfile.cpython-36.opt-2.pyc
tempfile.cpython-36.pyc
textwrap.cpython-36.opt-1.pyc
textwrap.cpython-36.opt-2.pyc
textwrap.cpython-36.pyc
this.cpython-36.opt-1.pyc
this.cpython-36.opt-2.pyc
this.cpython-36.pyc
threading.cpython-36.opt-1.pyc
threading.cpython-36.opt-2.pyc
threading.cpython-36.pyc
timeit.cpython-36.opt-1.pyc
timeit.cpython-36.opt-2.pyc
timeit.cpython-36.pyc
token.cpython-36.opt-1.pyc
token.cpython-36.opt-2.pyc
token.cpython-36.pyc
tokenize.cpython-36.opt-1.pyc
tokenize.cpython-36.opt-2.pyc
tokenize.cpython-36.pyc
trace.cpython-36.opt-1.pyc
trace.cpython-36.opt-2.pyc
trace.cpython-36.pyc
traceback.cpython-36.opt-1.pyc
traceback.cpython-36.opt-2.pyc
traceback.cpython-36.pyc
tracemalloc.cpython-36.opt-1.pyc
tracemalloc.cpython-36.opt-2.pyc
tracemalloc.cpython-36.pyc
tty.cpython-36.opt-1.pyc
tty.cpython-36.opt-2.pyc
tty.cpython-36.pyc
types.cpython-36.opt-1.pyc
types.cpython-36.opt-2.pyc
types.cpython-36.pyc
typing.cpython-36.opt-1.pyc
typing.cpython-36.opt-2.pyc
typing.cpython-36.pyc
uu.cpython-36.opt-1.pyc
uu.cpython-36.opt-2.pyc
uu.cpython-36.pyc
uuid.cpython-36.opt-1.pyc
uuid.cpython-36.opt-2.pyc
uuid.cpython-36.pyc
warnings.cpython-36.opt-1.pyc
warnings.cpython-36.opt-2.pyc
warnings.cpython-36.pyc
wave.cpython-36.opt-1.pyc
wave.cpython-36.opt-2.pyc
wave.cpython-36.pyc
weakref.cpython-36.opt-1.pyc
weakref.cpython-36.opt-2.pyc
weakref.cpython-36.pyc
webbrowser.cpython-36.opt-1.pyc
webbrowser.cpython-36.opt-2.pyc
webbrowser.cpython-36.pyc
xdrlib.cpython-36.opt-1.pyc
xdrlib.cpython-36.opt-2.pyc
xdrlib.cpython-36.pyc
zipapp.cpython-36.opt-1.pyc
zipapp.cpython-36.opt-2.pyc
zipapp.cpython-36.pyc
zipfile.cpython-36.opt-1.pyc
zipfile.cpython-36.opt-2.pyc
zipfile.cpython-36.pyc

File Transfer

Upload files to current directory

File Editor: _pyio.cpython-36.pyc

3 \!X@sbdZddlZddlZddlZddlZddlZddlZyddlmZ Wn e k rdddl mZ YnXej d5kr~ddl mZndZddlZddlmZmZmZmZddd hZeed rejejejejd6ZeZd8ddZGdddZGdddZy ejZWn(e k r.Gddde!e"ZYnXGdddej#dZ$ej$j%e$Gddde$Z&ej&j%e&ddl'm(Z(e&j%e(Gddde$Z)ej)j%e)Gdd d e)Z*Gd!d"d"e)Z+Gd#d$d$e*Z,Gd%d&d&e*Z-Gd'd(d(e)Z.Gd)d*d*e-e,Z/Gd+d,d,e&Z(Gd-d.d.e$Z0ej0j%e0Gd/d0d0ej1Z2Gd1d2d2e0Z3Gd3d4d4e3Z4dS)9z) Python implementation of the io module. N) allocate_lockwin32cygwin)setmode)__all__SEEK_SETSEEK_CURSEEK_END SEEK_HOLEirTcCs~t|tstj|}t|tttfs0td|t|tsFtd|t|ts\td||dk r|t|t r|td||dk rt|t rtd|t|}|tdst|t|krt d|d|k} d |k} d |k} d |k} d |k} d |k}d|k}d|krH| s&| s&| s&| r.t dddl }|j dt dd} |r\|r\t d| | | | dkrzt d| p| p| p| st d|r|dk rt d|r|dk rt d|r|dk rt dt || rdpd| rd pd| rd pd| r d p"d| r0d p2d||d}|}yd}|dksh|dkrp|jrpd"}d}|dkrt}ytj|jj}Wnttfk rYnX|dkr|}|dkrt d|dkr|r|St d | rt||}n<| s| s| rt||}n| r,t||}n t d!||}|rF|St|||||}|}||_|S|jYnXdS)#aOpen file and return a stream. Raise OSError upon failure. file is either a text or byte string giving the name (and the path if the file isn't in the current working directory) of the file to be opened or an integer file descriptor of the file to be wrapped. (If a file descriptor is given, it is closed when the returned I/O object is closed, unless closefd is set to False.) mode is an optional string that specifies the mode in which the file is opened. It defaults to 'r' which means open for reading in text mode. Other common values are 'w' for writing (truncating the file if it already exists), 'x' for exclusive creation of a new file, and 'a' for appending (which on some Unix systems, means that all writes append to the end of the file regardless of the current seek position). In text mode, if encoding is not specified the encoding used is platform dependent. (For reading and writing raw bytes use binary mode and leave encoding unspecified.) The available modes are: ========= =============================================================== Character Meaning --------- --------------------------------------------------------------- 'r' open for reading (default) 'w' open for writing, truncating the file first 'x' create a new file and open it for writing 'a' open for writing, appending to the end of the file if it exists 'b' binary mode 't' text mode (default) '+' open a disk file for updating (reading and writing) 'U' universal newline mode (deprecated) ========= =============================================================== The default mode is 'rt' (open for reading text). For binary random access, the mode 'w+b' opens and truncates the file to 0 bytes, while 'r+b' opens the file without truncation. The 'x' mode implies 'w' and raises an `FileExistsError` if the file already exists. Python distinguishes between files opened in binary and text modes, even when the underlying operating system doesn't. Files opened in binary mode (appending 'b' to the mode argument) return contents as bytes objects without any decoding. In text mode (the default, or when 't' is appended to the mode argument), the contents of the file are returned as strings, the bytes having been first decoded using a platform-dependent encoding or using the specified encoding if given. 'U' mode is deprecated and will raise an exception in future versions of Python. It has no effect in Python 3. Use newline to control universal newlines mode. buffering is an optional integer used to set the buffering policy. Pass 0 to switch buffering off (only allowed in binary mode), 1 to select line buffering (only usable in text mode), and an integer > 1 to indicate the size of a fixed-size chunk buffer. When no buffering argument is given, the default buffering policy works as follows: * Binary files are buffered in fixed-size chunks; the size of the buffer is chosen using a heuristic trying to determine the underlying device's "block size" and falling back on `io.DEFAULT_BUFFER_SIZE`. On many systems, the buffer will typically be 4096 or 8192 bytes long. * "Interactive" text files (files for which isatty() returns True) use line buffering. Other text files use the policy described above for binary files. encoding is the str name of the encoding used to decode or encode the file. This should only be used in text mode. The default encoding is platform dependent, but any encoding supported by Python can be passed. See the codecs module for the list of supported encodings. errors is an optional string that specifies how encoding errors are to be handled---this argument should not be used in binary mode. Pass 'strict' to raise a ValueError exception if there is an encoding error (the default of None has the same effect), or pass 'ignore' to ignore errors. (Note that ignoring encoding errors can lead to data loss.) See the documentation for codecs.register for a list of the permitted encoding error strings. newline is a string controlling how universal newlines works (it only applies to text mode). It can be None, '', '\n', '\r', and '\r\n'. It works as follows: * On input, if newline is None, universal newlines mode is enabled. Lines in the input can end in '\n', '\r', or '\r\n', and these are translated into '\n' before being returned to the caller. If it is '', universal newline mode is enabled, but line endings are returned to the caller untranslated. If it has any of the other legal values, input lines are only terminated by the given string, and the line ending is returned to the caller untranslated. * On output, if newline is None, any '\n' characters written are translated to the system default line separator, os.linesep. If newline is '', no translation takes place. If newline is any of the other legal values, any '\n' characters written are translated to the given string. closedfd is a bool. If closefd is False, the underlying file descriptor will be kept open when the file is closed. This does not work when a file name is given and must be True in that case. The newly created file is non-inheritable. A custom opener can be used by passing a callable as *opener*. The underlying file descriptor for the file object is then obtained by calling *opener* with (*file*, *flags*). *opener* must return an open file descriptor (passing os.open as *opener* results in functionality similar to passing None). open() returns a file object whose type depends on the mode, and through which the standard file operations such as reading and writing are performed. When open() is used to open a file in a text mode ('w', 'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open a file in a binary mode, the returned class varies: in read binary mode, it returns a BufferedReader; in write binary and append binary modes, it returns a BufferedWriter, and in read/write mode, it returns a BufferedRandom. It is also possible to use a string or bytearray as a file for both reading and writing. For strings StringIO can be used like a file opened in a text mode, and for bytes a BytesIO can be used like a file opened in a binary mode. zinvalid file: %rzinvalid mode: %rzinvalid buffering: %rNzinvalid encoding: %rzinvalid errors: %rzaxrwb+tUxrwa+tbUz4mode U cannot be combined with 'x', 'w', 'a', or '+'rz'U' mode is deprecatedr Tz'can't have text and binary mode at oncer z)can't have read/write/append mode at oncez/must have exactly one of read/write/append modez-binary mode doesn't take an encoding argumentz+binary mode doesn't take an errors argumentz+binary mode doesn't take a newline argument)openerFzinvalid buffering sizezcan't have unbuffered text I/Ozunknown mode: %r) isinstanceintosfspathstrbytes TypeErrorsetlen ValueErrorwarningswarnDeprecationWarningFileIOisattyDEFAULT_BUFFER_SIZEfstatfileno st_blksizeOSErrorAttributeErrorBufferedRandomBufferedWriterBufferedReader TextIOWrappermodeclose)filer2 bufferingencodingerrorsnewlineclosefdrZmodesZcreatingZreadingZwritingZ appendingZupdatingtextZbinaryr#rawresultline_bufferingZbsbufferr?/usr/lib64/python3.6/_pyio.pyopen(s{            >         rAc@seZdZdZddZdS) DocDescriptorz%Helper for builtins.open.__doc__ cCs dtjS)Nz\open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True) )rA__doc__)selfobjtypr?r?r@__get__szDocDescriptor.__get__N)__name__ __module__ __qualname__rCrGr?r?r?r@rBsrBc@seZdZdZeZddZdS) OpenWrapperzWrapper for builtins.open Trick so that open won't become a bound method when stored as a class variable (as dbm.dumb does). See initstdio() in Python/pylifecycle.c. cOs t||S)N)rA)clsargskwargsr?r?r@__new__szOpenWrapper.__new__N)rHrIrJrCrBrOr?r?r?r@rKsrKc@s eZdZdS)UnsupportedOperationN)rHrIrJr?r?r?r@rPsrPc@seZdZdZddZd6ddZddZd7d d Zd d ZdZ ddZ ddZ ddZ d8ddZ ddZd9ddZddZd:ddZedd Zd;d!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd=d,d-Zd.d/Zd0d1Zd>d2d3Zd4d5Zd S)?IOBaseagThe abstract base class for all I/O classes, acting on streams of bytes. There is no public constructor. This class provides dummy implementations for many methods that derived classes can override selectively; the default implementations represent a file that cannot be read, written or seeked. Even though IOBase does not declare read, readinto, or write because their signatures will vary, implementations and clients should consider those methods part of the interface. Also, implementations may raise UnsupportedOperation when operations they do not support are called. The basic type used for binary data read from or written to a file is bytes. Other bytes-like objects are accepted as method arguments too. In some cases (such as readinto), a writable object is required. Text I/O classes work with str data. Note that calling any method (even inquiries) on a closed stream is undefined. Implementations may raise OSError in this case. IOBase (and its subclasses) support the iterator protocol, meaning that an IOBase object can be iterated over yielding the lines in a stream. IOBase also supports the :keyword:`with` statement. In this example, fp is closed after the suite of the with statement is complete: with open('spam.txt', 'r') as fp: fp.write('Spam and eggs!') cCstd|jj|fdS)z@Internal: raise an OSError exception for unsupported operations.z%s.%s() not supportedN)rP __class__rH)rDnamer?r?r@ _unsupported@szIOBase._unsupportedrcCs|jddS)a$Change stream position. Change the stream position to byte offset pos. Argument pos is interpreted relative to the position indicated by whence. Values for whence are ints: * 0 -- start of stream (the default); offset should be zero or positive * 1 -- current stream position; offset may be negative * 2 -- end of stream; offset is usually negative Some operating systems / file systems could provide additional values. Return an int indicating the new absolute position. seekN)rT)rDposwhencer?r?r@rUGsz IOBase.seekcCs |jddS)z5Return an int indicating the current stream position.rr )rU)rDr?r?r@tellWsz IOBase.tellNcCs|jddS)zTruncate file to size bytes. Size defaults to the current IO position as reported by tell(). Return the new size. truncateN)rT)rDrVr?r?r@rY[szIOBase.truncatecCs |jdS)zuFlush write buffers, if applicable. This is not implemented for read-only and non-blocking streams. N) _checkClosed)rDr?r?r@flushesz IOBase.flushFc Cs |jsz |jWdd|_XdS)ziFlush and close the IO object. This method has no effect if the file is already closed. NT)_IOBase__closedr[)rDr?r?r@r3os z IOBase.closec Csy |jWn YnXdS)zDestructor. Calls close().N)r3)rDr?r?r@__del__zs zIOBase.__del__cCsdS)zReturn a bool indicating whether object supports random access. If False, seek(), tell() and truncate() will raise OSError. This method may need to do a test seek(). Fr?)rDr?r?r@seekableszIOBase.seekablecCs |jst|dkrdn|dS)zEInternal: raise UnsupportedOperation if file is not seekable NzFile or stream is not seekable.)r^rP)rDmsgr?r?r@_checkSeekableszIOBase._checkSeekablecCsdS)zvReturn a bool indicating whether object was opened for reading. If False, read() will raise OSError. Fr?)rDr?r?r@readableszIOBase.readablecCs |jst|dkrdn|dS)zEInternal: raise UnsupportedOperation if file is not readable NzFile or stream is not readable.)rarP)rDr_r?r?r@_checkReadableszIOBase._checkReadablecCsdS)zReturn a bool indicating whether object was opened for writing. If False, write() and truncate() will raise OSError. Fr?)rDr?r?r@writableszIOBase.writablecCs |jst|dkrdn|dS)zEInternal: raise UnsupportedOperation if file is not writable NzFile or stream is not writable.)rcrP)rDr_r?r?r@_checkWritableszIOBase._checkWritablecCs|jS)zclosed: bool. True iff the file has been closed. For backwards compatibility, this is a property, not a predicate. )r\)rDr?r?r@closedsz IOBase.closedcCs|jrt|dkrdn|dS)z7Internal: raise a ValueError if file is closed NzI/O operation on closed file.)rer")rDr_r?r?r@rZszIOBase._checkClosedcCs |j|S)zCContext management protocol. Returns self (an instance of IOBase).)rZ)rDr?r?r@ __enter__szIOBase.__enter__cGs |jdS)z+Context management protocol. Calls close()N)r3)rDrMr?r?r@__exit__szIOBase.__exit__cCs|jddS)zReturns underlying file descriptor (an int) if one exists. An OSError is raised if the IO object does not use a file descriptor. r*N)rT)rDr?r?r@r*sz IOBase.filenocCs |jdS)z{Return a bool indicating whether this is an 'interactive' stream. Return False if it can't be determined. F)rZ)rDr?r?r@r'sz IOBase.isattyr cstdrfdd}ndd}dkr0d nttsBtdt}x>dks^t|krj|}|spP||7}|jd rJPqJWt|S) aNRead and return a line of bytes from the stream. If size is specified, at most size bytes will be read. Size should be an int. The line terminator is always b'\n' for binary files; for text files, the newlines argument to open can be used to select the line terminator(s) recognized. peekcs>jd}|sdS|jddp&t|}dkr:t|}|S)Nr  r)rhfindr!min)Z readaheadn)rDsizer?r@ nreadaheads  z#IOBase.readline..nreadaheadcSsdS)Nr r?r?r?r?r@rnsNr zsize must be an integerrrir) hasattrrrr bytearrayr!readendswithr)rDrmrnresrr?)rDrmr@readlines     zIOBase.readlinecCs |j|S)N)rZ)rDr?r?r@__iter__szIOBase.__iter__cCs|j}|st|S)N)rt StopIteration)rDliner?r?r@__next__ szIOBase.__next__cCsR|dks|dkrt|Sd}g}x,|D]$}|j||t|7}||kr&Pq&W|S)zReturn a list of lines from the stream. hint can be specified to control the number of lines read: no more lines will be read if the total size (in bytes/characters) of all lines so far exceeds hint. Nr)listappendr!)rDZhintrllinesrwr?r?r@ readliness   zIOBase.readlinescCs$|jx|D]}|j|qWdS)N)rZwrite)rDr{rwr?r?r@ writelines#s zIOBase.writelines)r)N)N)N)N)Nr)r)N)rHrIrJrCrTrUrXrYr[r\r3r]r^r`rarbrcrdpropertyrerZrfrgr*r'rtrurxr|r~r?r?r?r@rQs4          % rQ) metaclassc@s2eZdZdZd ddZddZddZd d Zd S) RawIOBasezBase class for raw binary I/O.r cCsP|dkr d}|dkr|jSt|j}|j|}|dkr>dS||d=t|S)zRead and return up to size bytes, where size is an int. Returns an empty bytes object on EOF, or None if the object is set not to block and has no data to read. Nr rr)readallrp __index__readintor)rDrmrrlr?r?r@rq9s   zRawIOBase.readcCs8t}x|jt}|sP||7}qW|r0t|S|SdS)z+Read until EOF, using multiple read() call.N)rprqr(r)rDrsdatar?r?r@rJs  zRawIOBase.readallcCs|jddS)zRead bytes into a pre-allocated bytes-like object b. Returns an int representing the number of bytes read (0 for EOF), or None if the object is set not to block and has no data to read. rN)rT)rDrr?r?r@rXszRawIOBase.readintocCs|jddS)zWrite the given buffer to the IO stream. Returns the number of bytes written, which may be less than the length of b in bytes. r}N)rT)rDrr?r?r@r}`szRawIOBase.writeNr)r)rHrIrJrCrqrrr}r?r?r?r@r+s  r)r&c@sLeZdZdZdddZdddZddZd d Zd d Zd dZ ddZ dS)BufferedIOBaseaBase class for buffered IO objects. The main difference with RawIOBase is that the read() method supports omitting the size argument, and does not have a default implementation that defers to readinto(). In addition, read(), readinto() and write() may raise BlockingIOError if the underlying raw stream is in non-blocking mode and not ready; unlike their raw counterparts, they will never return None. A typical implementation should not inherit from a RawIOBase implementation, but wrap one. NcCs|jddS)aRead and return up to size bytes, where size is an int. If the argument is omitted, None, or negative, reads and returns all data until EOF. If the argument is positive, and the underlying raw stream is not 'interactive', multiple raw reads may be issued to satisfy the byte count (unless EOF is reached first). But for interactive raw streams (XXX and for pipes?), at most one raw read will be issued, and a short result does not imply that EOF is imminent. Returns an empty bytes array on EOF. Raises BlockingIOError if the underlying raw stream has no data at the moment. rqN)rT)rDrmr?r?r@rq~szBufferedIOBase.readcCs|jddS)zaRead up to size bytes with at most one read() system call, where size is an int. read1N)rT)rDrmr?r?r@rszBufferedIOBase.read1cCs|j|ddS)afRead bytes into a pre-allocated bytes-like object b. Like read(), this may issue multiple reads to the underlying raw stream, unless the latter is 'interactive'. Returns an int representing the number of bytes read (0 for EOF). Raises BlockingIOError if the underlying raw stream has no data at the moment. F)r) _readinto)rDrr?r?r@rs zBufferedIOBase.readintocCs|j|ddS)zRead bytes into buffer *b*, using at most one system call Returns an int representing the number of bytes read (0 for EOF). Raises BlockingIOError if the underlying raw stream has no data at the moment. T)r)r)rDrr?r?r@ readinto1s zBufferedIOBase.readinto1cCsVt|tst|}|jd}|r0|jt|}n|jt|}t|}||d|<|S)NB)r memoryviewcastrr!rq)rDrrrrlr?r?r@rs   zBufferedIOBase._readintocCs|jddS)aWrite the given bytes buffer to the IO stream. Return the number of bytes written, which is always the length of b in bytes. Raises BlockingIOError if the buffer is full and the underlying raw stream cannot accept more data at the moment. r}N)rT)rDrr?r?r@r}s zBufferedIOBase.writecCs|jddS)z Separate the underlying raw stream from the buffer and return it. After the raw stream has been detached, the buffer is in an unusable state. detachN)rT)rDr?r?r@rszBufferedIOBase.detach)N)N) rHrIrJrCrqrrrrr}rr?r?r?r@rms    rc@seZdZdZddZd$ddZddZd%d d Zd d ZddZ ddZ ddZ e ddZ e ddZe ddZe ddZddZddZd d!Zd"d#Zd S)&_BufferedIOMixinzA mixin implementation of BufferedIOBase with an underlying raw stream. This passes most requests on to the underlying raw stream. It does *not* provide implementations of read(), readinto() or write(). cCs ||_dS)N)_raw)rDr;r?r?r@__init__sz_BufferedIOMixin.__init__rcCs"|jj||}|dkrtd|S)Nrz#seek() returned an invalid position)r;rUr,)rDrVrWZ new_positionr?r?r@rUsz_BufferedIOMixin.seekcCs|jj}|dkrtd|S)Nrz#tell() returned an invalid position)r;rXr,)rDrVr?r?r@rXs z_BufferedIOMixin.tellNcCs$|j|dkr|j}|jj|S)N)r[rXr;rY)rDrVr?r?r@rYsz_BufferedIOMixin.truncatecCs|jrtd|jjdS)Nzflush of closed file)rer"r;r[)rDr?r?r@r[sz_BufferedIOMixin.flushc Cs0|jdk r,|j r,z |jWd|jjXdS)N)r;rer[r3)rDr?r?r@r3s z_BufferedIOMixin.closecCs*|jdkrtd|j|j}d|_|S)Nzraw stream already detached)r;r"r[r)rDr;r?r?r@r s  z_BufferedIOMixin.detachcCs |jjS)N)r;r^)rDr?r?r@r^sz_BufferedIOMixin.seekablecCs|jS)N)r)rDr?r?r@r;sz_BufferedIOMixin.rawcCs|jjS)N)r;re)rDr?r?r@resz_BufferedIOMixin.closedcCs|jjS)N)r;rS)rDr?r?r@rS!sz_BufferedIOMixin.namecCs|jjS)N)r;r2)rDr?r?r@r2%sz_BufferedIOMixin.modecCstdj|jjdS)Nz can not serialize a '{0}' object)rformatrRrH)rDr?r?r@ __getstate__)sz_BufferedIOMixin.__getstate__c CsJ|jj}|jj}y |j}Wntk r6dj||SXdj|||SdS)Nz<{}.{}>z<{}.{} name={!r}>)rRrIrJrS Exceptionr)rDmodnameZclsnamerSr?r?r@__repr__-s z_BufferedIOMixin.__repr__cCs |jjS)N)r;r*)rDr?r?r@r*9sz_BufferedIOMixin.filenocCs |jjS)N)r;r')rDr?r?r@r'<sz_BufferedIOMixin.isatty)r)N)rHrIrJrCrrUrXrYr[r3rr^rr;rerSr2rrr*r'r?r?r?r@rs"        rcseZdZdZd ddZddZddZd d Zfd d Zd!d dZ ddZ ddZ d"ddZ ddZ d#ddZddZddZddZZS)$BytesIOzsz"FileIO.__init__..rzKMust have exactly one of create/read/write/append mode and at most one plusrTrrrO_BINARYZ O_NOINHERIT O_CLOEXECz'Cannot use closefd=False with file nameizexpected integer from openerzNegative file descriptorFr+rr),_fd_closefdrr3rfloatrrr"rr sumcount_created _writableO_EXCLO_CREAT _readableO_TRUNC _appendingO_APPENDO_RDWRO_RDONLYO_WRONLYgetattrrAr,set_inheritabler)statS_ISDIRst_modeIsADirectoryErrorrZEISDIRrr-_blksizer(_setmoderrSlseekr ) rDr4r2r9rfdflagsZnoinherit_flagZowned_fdZfdfstatr?r?r@rws     $                    zFileIO.__init__cCsD|jdkr@|jr@|j r@ddl}|jd|ftd|d|jdS)Nrzunclosed file %rr ) stacklevelsource)rrrer#r$ResourceWarningr3)rDr#r?r?r@r]s  zFileIO.__del__cCstd|jjdS)Nzcannot serialize '%s' object)rrRrH)rDr?r?r@rszFileIO.__getstate__c Csld|jj|jjf}|jr"d|Sy |j}Wn&tk rRd||j|j|jfSXd|||j|jfSdS)Nz%s.%sz <%s [closed]>z<%s fd=%d mode=%r closefd=%r>z<%s name=%r mode=%r closefd=%r>) rRrIrJrerSr-rr2r)rD class_namerSr?r?r@rs  zFileIO.__repr__cCs|jstddS)NzFile not open for reading)rrP)rDr?r?r@rbszFileIO._checkReadablecCs|jstddS)NzFile not open for writing)rrP)rDr_r?r?r@rdszFileIO._checkWritablec CsP|j|j|dks |dkr(|jSytj|j|Stk rJdSXdS)zRead at most size bytes, returned as bytes. Only makes one system call, so less data may be returned than requested In non-blocking mode, returns None if no data is available. Return an empty bytes object at EOF. Nr)rZrbrrrqrr)rDrmr?r?r@rq sz FileIO.readcCs|j|jt}y6tj|jdt}tj|jj}||krH||d}Wnt k r^YnXt }xnt ||krt |}|t |t7}|t |}ytj |j|}Wntk r|rPdSX|sP||7}qhWt|S)zRead all data from the file, returned as bytes. In non-blocking mode, returns as much as is immediately available, or None if no data is available. Return an empty bytes object at EOF. rr N)rZrbr(rrrrr)st_sizer,rpr!rrqrr)rDbufsizerVendr<rlrr?r?r@rs4   zFileIO.readallcCs4t|jd}|jt|}t|}||d|<|S)zSame as RawIOBase.readinto().rN)rrrqr!)rDrmrrlr?r?r@r?s  zFileIO.readintoc Cs8|j|jytj|j|Stk r2dSXdS)aWrite bytes b to file, return number written. Only makes one system call, so not all of the data may be written. The number of bytes actually written is returned. In non-blocking mode, returns None if the write would block. N)rZrdrr}rr)rDrr?r?r@r}Gs z FileIO.writecCs*t|trtd|jtj|j||S)aMove to new file position. Argument offset is a byte count. Optional argument whence defaults to SEEK_SET or 0 (offset from start of file, offset should be >= 0); other values are SEEK_CUR or 1 (move relative to current position, positive or negative), and SEEK_END or 2 (move relative to end of file, usually negative, although many platforms allow seeking beyond the end of a file). Note that not all file objects are seekable. zan integer is required)rrrrZrrr)rDrVrWr?r?r@rUUs z FileIO.seekcCs|jtj|jdtS)zYtell() -> int. Current file position. Can raise OSError for non seekable files.r)rZrrrr)rDr?r?r@rXesz FileIO.tellcCs2|j|j|dkr |j}tj|j||S)zTruncate the file to at most size bytes. Size defaults to the current file position, as returned by tell(). The current file position is changed to the value of size. N)rZrdrXr ftruncater)rDrmr?r?r@rYls zFileIO.truncatec s.|js*z|jrtj|jWdtjXdS)zClose the file. A closed file cannot be used for further I/O operations. close() may be called more than once without error. N)rerrr3rr)rD)rRr?r@r3ys z FileIO.closec CsF|j|jdkr@y |jWntk r8d|_YnXd|_|jS)z$True if file supports random-access.NFT)rZ _seekablerXr,)rDr?r?r@r^s   zFileIO.seekablecCs|j|jS)z'True if file was opened in a read mode.)rZr)rDr?r?r@raszFileIO.readablecCs|j|jS)z(True if file was opened in a write mode.)rZr)rDr?r?r@rcszFileIO.writablecCs|j|jS)z3Return the underlying file descriptor (an integer).)rZr)rDr?r?r@r*sz FileIO.filenocCs|jtj|jS)z.True if the file is connected to a TTY device.)rZrr'r)rDr?r?r@r'sz FileIO.isattycCs|jS)z6True if the file descriptor will be closed by close().)r)rDr?r?r@r9szFileIO.closefdcCsJ|jr|jrdSdSn0|jr,|jr&dSdSn|jrB|jreZdZdZdZdFddZddZed d Zed d Z ed dZ eddZ ddZ ddZ ddZddZddZeddZeddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*ZdGd+d,Zd-d.Zd/d0ZdHd2d3Zd4d5Zd6d7ZdId8d9Zd:d;Z dJdd?Z"d@dAZ#dLdBdCZ$edDdEZ%dS)Mr1aCharacter and line based layer over a BufferedIOBase object, buffer. encoding gives the name of the encoding that the stream will be decoded or encoded with. It defaults to locale.getpreferredencoding(False). errors determines the strictness of encoding and decoding (see the codecs.register) and defaults to "strict". newline can be None, '', '\n', '\r', or '\r\n'. It controls the handling of line endings. If it is None, universal newlines is enabled. With this enabled, on input, the lines endings '\n', '\r', or '\r\n' are translated to '\n' before being returned to the caller. Conversely, on output, '\n' is translated to the system default line separator, os.linesep. If newline is any other of its legal values, that newline becomes the newline when the file is read and it is returned untranslated. On output, '\n' is converted to the newline. If line_buffering is True, a call to flush is implied when a call to write contains a newline character. iNFc Cs|dk r&t|t r&tdt|f|dkrr^r_tellingro _has_read1 _b2cratiorcrX _get_encoderr) rDr>r6r7r8r= write_throughrr_positionr?r?r@rws`             zTextIOWrapper.__init__cCsdj|jj|jj}y |j}Wntk r2YnX|dj|7}y |j}Wntk r`YnX|dj|7}|dj|jS)Nz<{}.{}z name={0!r}z mode={0!r}z encoding={0!r}>)rrRrIrJrSrr2r6)rDr<rSr2r?r?r@rs    zTextIOWrapper.__repr__cCs|jS)N)r)rDr?r?r@r6szTextIOWrapper.encodingcCs|jS)N)r)rDr?r?r@r7szTextIOWrapper.errorscCs|jS)N)r)rDr?r?r@r=szTextIOWrapper.line_bufferingcCs|jS)N)r)rDr?r?r@r>szTextIOWrapper.buffercCs|jrtd|jS)NzI/O operation on closed file.)rer"r)rDr?r?r@r^szTextIOWrapper.seekablecCs |jjS)N)r>ra)rDr?r?r@raszTextIOWrapper.readablecCs |jjS)N)r>rc)rDr?r?r@rcszTextIOWrapper.writablecCs|jj|j|_dS)N)r>r[rr%)rDr?r?r@r[s zTextIOWrapper.flushc Cs0|jdk r,|j r,z |jWd|jjXdS)N)r>rer[r3)rDr?r?r@r3s zTextIOWrapper.closecCs|jjS)N)r>re)rDr?r?r@reszTextIOWrapper.closedcCs|jjS)N)r>rS)rDr?r?r@rSszTextIOWrapper.namecCs |jjS)N)r>r*)rDr?r?r@r*szTextIOWrapper.filenocCs |jjS)N)r>r')rDr?r?r@r'szTextIOWrapper.isattycCs|jrtdt|ts(td|jjt|}|js<|j oBd|k}|rf|jrf|j dkrf|j d|j }|j pr|j }|j|}|jj||j r|sd|kr|j|jdd|_|jr|jj|S)zWrite data, where s is a strzwrite to closed filezcan't write %s to text streamrrrN)rer"rrrrRrHr!rrrrr r(encoder>r}r[_set_decoded_charsr$r!r)rDrZlengthZhaslfencoderrr?r?r@r}s&      zTextIOWrapper.writecCstj|j}||j|_|jS)N)rgetincrementalencoderrrr )rDZ make_encoderr?r?r@r(s  zTextIOWrapper._get_encodercCs2tj|j}||j}|jr(t||j}||_|S)N)rgetincrementaldecoderrrrrrr!)rDZ make_decoderrr?r?r@ _get_decoders    zTextIOWrapper._get_decodercCs||_d|_dS)zSet the _decoded_chars buffer.rN)r"r#)rDcharsr?r?r@r,)sz TextIOWrapper._set_decoded_charscCsF|j}|dkr|j|d}n|j|||}|jt|7_|S)z'Advance into the _decoded_chars buffer.N)r#r"r!)rDrloffsetr1r?r?r@_get_decoded_chars.s z TextIOWrapper._get_decoded_charscCs$|j|krtd|j|8_dS)z!Rewind the _decoded_chars buffer.z"rewind decoded_chars out of boundsN)r#AssertionError)rDrlr?r?r@_rewind_decoded_chars8s z#TextIOWrapper._rewind_decoded_charscCs|jdkrtd|jr&|jj\}}|jr<|jj|j}n|jj|j}| }|jj ||}|j ||rt |t |j |_ nd|_ |jr|||f|_| S)zQ Read and decode the next chunk of data from the BufferedReader. Nz no decoderg)r!r"r%rr&r>r _CHUNK_SIZErqrr,r!r"r'r$)rD dec_buffer dec_flags input_chunkeofZ decoded_charsr?r?r@ _read_chunk>s  zTextIOWrapper._read_chunkrcCs(||d>B|d>B|d>Bt|d>BS)N@)r)rDr*r8 bytes_to_feedneed_eof chars_to_skipr?r?r@ _pack_cookiehszTextIOWrapper._pack_cookiecCsFt|d\}}t|d\}}t|d\}}t|d\}}|||||fS)Nr r<llll)divmod)rDZbigintrestr*r8r@rArBr?r?r@_unpack_cookiers zTextIOWrapper._unpack_cookiecCsN|jstd|jstd|j|jj}|j}|dksF|jdkrX|j rTt d|S|j\}}|t |8}|j }|dkr|j ||S|j}zt|j|}d}|t |kst x|dkr4|jd|ft |j|d|} | |kr"|j\} } | s| }|| 8}P|t | 8}d}q||8}|d}qWd}|jd|f||} |} |dkrj|j | | Sd}d}d}xt|t |D]v}|d7}|t |j|||d7}|j\}}| r||kr| |7} ||8}|dd} }}||krPqW|t |jddd 7}d}||kr,td |j | | |||S|j|XdS) Nz!underlying stream is not seekablez(telling position disabled by next() callzpending decoded textrr rr T)rz'can't reconstruct logical file position)rrPr%r,r[r>rXr!r$r"r4r!r#rCrrr'rrrange)rDr*rr8Z next_inputrBZ saved_stateZ skip_bytesZ skip_backrlrd start_posZ start_flagsZ bytes_fedrAZ chars_decodedir7r?r?r@rXysx              zTextIOWrapper.tellcCs$|j|dkr|j}|jj|S)N)r[rXr>rY)rDrVr?r?r@rYszTextIOWrapper.truncatecCs*|jdkrtd|j|j}d|_|S)Nzbuffer is already detached)r>r"r[r)rDr>r?r?r@rs  zTextIOWrapper.detachc sfdd}jrtdjs(td|dkrL|dkr@tdd}j}|dkr|dkrdtd jjjdd}jd d_ j rj j |||S|dkrtd |f|dkrtd |fjj |\}}}}} jj|jd d_ |dkr(j r(j j n@j s<|s<| rhj pJj _ j jd |f|d f_ | rjj|} jj j| ||| f_ tj| krtd| _|||S)Nc sHyjpj}Wntk r&YnX|dkr<|jdn|jdS)z9Reset the encoder (merely useful for proper BOM handling)rN)r r(rrr)r*r-)rDr?r@_reset_encoders z*TextIOWrapper.seek.._reset_encoderztell on closed filez!underlying stream is not seekabler rz#can't do nonzero cur-relative seeksr z#can't do nonzero end-relative seeksrzunsupported whence (%r)znegative seek position %rrz#can't restore logical file position)rer"rrPrXr[r>rUr,r$r!rrFr0rrqrr!r"r,r#) rDZcookierWrKr*rIr8r@rArBr9r?)rDr@rUs\         zTextIOWrapper.seekcCs|j|dkrd}|jp |j}y |jWn,tk rX}ztd|WYdd}~XnX|dkr|j|j|jj dd}|j dd|_ |Sd}|j|}x6t ||kr| r|j }||j|t |7}qW|SdS) Nr zan integer is requiredrT)rrFr)rbr!r0rr-rr3rr>rqr,r$r!r;)rDrmrrr<r:r?r?r@rq5 s(    zTextIOWrapper.readcCs(d|_|j}|s$d|_|j|_t|S)NF)r%rtr$rrv)rDrwr?r?r@rxN szTextIOWrapper.__next__cCs|jrtd|dkrd }nt|ts.td|j}d}|jsH|jd}}xR|jr|j d|}|dkrz|d}Pnt |}n|j r|j d|}|j d|}|d kr|d krt |}n |d}PnL|d kr|d}Pn8||kr|d}Pn$||dkr |d}Pn |d}Pn&|j |j }|dkr>|t |j }P|dkr\t ||kr\|}Px|j rv|jr^Pq^W|jr||j7}qT|jdd|_|SqTW|dkr||kr|}|jt |||d|S) Nzread from closed filer zsize must be an integerrrrr rrrrr)rer"rrrr3r!r0rrjr!rrr;r"r,r$r5)rDrmrwstartrVendposZnlposZcrposr?r?r@rtW sp          zTextIOWrapper.readlinecCs|jr|jjSdS)N)r!r)rDr?r?r@r szTextIOWrapper.newlines)NNNFF)N)rrrr)N)r)N)N)&rHrIrJrCr6rrrr6r7r=r>r^rarcr[r3rerSr*r'r}r(r0r,r3r5r;rCrFrXrYrrUrqrxrtrr?r?r?r@r1ZsH E        * c  K  Xr1csReZdZdZdfdd ZddZdd Zed d Zed d Z ddZ Z S)StringIOzText I/O implementation using an in-memory buffer. The initial_value argument sets the value of object. The newline argument is like the one of TextIOWrapper's constructor. rrcsftt|jtdd|d|dkr(d|_|dk rbt|tsNtdjt |j |j ||j ddS)Nzutf-8 surrogatepass)r6r7r8Fz*initial_value must be str or None, not {0}r) rrNrrrrrrrrrHr}rU)rDZ initial_valuer8)rRr?r@r s  zStringIO.__init__c CsL|j|jp|j}|j}|jz|j|jjddS|j|XdS)NT)r) r[r!r0rrrr>rr)rDrZ old_stater?r?r@r szStringIO.getvaluecCs tj|S)N)objectr)rDr?r?r@r szStringIO.__repr__cCsdS)Nr?)rDr?r?r@r7 szStringIO.errorscCsdS)Nr?)rDr?r?r@r6 szStringIO.encodingcCs|jddS)Nr)rT)rDr?r?r@r szStringIO.detach)rr) rHrIrJrCrrrrr7r6rrr?r?)rRr@rN s   rN>rri r)rrNNNTN)5rCrabcrrrsys_threadrrrZ _dummy_threadplatformZmsvcrtrriorrrr rroaddr SEEK_DATAr(rrArBrKrPr-r,r"ABCMetarQregisterr_ior&rrrr0r/rr.rrrr1rNr?r?r?r@sv      T   =   g iCZIJUA U^