pdb.cpython-36.opt-1.pyc000064400000131727152462730460010722 0ustar003 \"@sdZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z GdddeZddddd d d d d g ZddZddZddZGdddeZdZGdddejejZedk rbd ddddddddd d!d"d#d$d%d&d'd(dd)d*d+d,d-d.d/d0d1d2d3d4d5d6d7g"Zx*eD]"Zeeed8ejjd97Zq,Weejj7Z[[dId:dZdJd;dZ dd Z#dKd?d Z$d@dZ%dAZ&dBdCZ'dDd Z(dEZ)dFdGZ*e+dHkrddl,Z,e,j*dS)La The Python Debugger Pdb ======================= To use the debugger in its simplest form: >>> import pdb >>> pdb.run('') The debugger's prompt is '(Pdb) '. This will stop in the first function call in . Alternatively, if a statement terminated with an unhandled exception, you can use pdb's post-mortem facility to inspect the contents of the traceback: >>> >>> import pdb >>> pdb.pm() The commands recognized by the debugger are listed in the next section. Most can be abbreviated as indicated; e.g., h(elp) means that 'help' can be typed as 'h' or 'help' (but not as 'he' or 'hel', nor as 'H' or 'Help' or 'HELP'). Optional arguments are enclosed in square brackets. Alternatives in the command syntax are separated by a vertical bar (|). A blank line repeats the previous command literally, except for 'list', where it lists the next 11 lines. Commands that the debugger doesn't recognize are assumed to be Python statements and are executed in the context of the program being debugged. Python statements can also be prefixed with an exclamation point ('!'). This is a powerful way to inspect the program being debugged; it is even possible to change variables or call functions. When an exception occurs in such a statement, the exception name is printed but the debugger's state is not changed. The debugger supports aliases, which can save typing. And aliases can have parameters (see the alias help entry) which allows one a certain level of adaptability to the context under examination. Multiple commands may be entered on a single line, separated by the pair ';;'. No intelligence is applied to separating the commands; the input is split at the first ';;', even if it is in the middle of a quoted string. If a file ".pdbrc" exists in your home directory or in the current directory, it is read in and executed as if it had been typed at the debugger prompt. This is particularly useful for aliases. If both files exist, the one in the home directory is read first and aliases defined there can be overridden by the local file. This behavior can be disabled by passing the "readrc=False" argument to the Pdb constructor. Aside from aliases, the debugger is not directly programmable; but it is implemented as a class from which you can derive your own debugger class, which you can make as fancy as you like. Debugger commands ================= Nc@seZdZdZdS)RestartzBCauses a debugger to be restarted for the debugged python program.N)__name__ __module__ __qualname____doc__rr/usr/lib64/python3.6/pdb.pyrUsrrunpmPdbrunevalrunctxruncall set_trace post_mortemhelpcCsxtjdtj|}y t|}Wntk r4dSX|4x,t|ddD]\}}|j|rJ|||fSqJWWdQRXdS)Nzdef\s+%s\s*[(])start)recompileescapeopenOSError enumeratematch)funcnamefilenameZcrefplinenolinerrr find_function\s  r cCsXtj|\}}tj|r,|j|jkr,|dfStj|r>|dfStj||d|dfS)Nr)inspectZ findsourceZisframe f_globalsf_localsZismoduleZgetblock)objlinesrrrrgetsourcelinesis  r&cCs8ttj|}|jx|D]\}}||kr|SqWdS)Nr)listdisZfindlinestartsreverse)codeZlastiZ linestartsirrrr lasti2linenors r,c@seZdZdZddZdS)_rstrz#String that doesn't quote its repr.cCs|S)Nr)selfrrr__repr__}sz_rstr.__repr__N)rrrrr/rrrrr-{sr-z -> c@seZdZdZdddZddZd d Zd d Zd dZddZ ddZ ddZ ddZ ddZ ddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6ZeZdd8d9Zd:d;ZeZ eZ!eZ"dd?Z%d@dAZ&dBdCZ'eZ(dDdEZ)eZ*dFdGZ+eZ,dHdIZ-eZ.dJdKZ/e/Z0eZ1eZ2dLdMZ3e3Z4e3Z5dNdOZ6dPdQZ7e7Z8dRdSZ9e9Z:dTdUZ;e;ZdXdYZ?e?Z@dZd[ZAeAZBd\d]ZCeCZDd^d_ZEeEZFZGd`daZHeHZIdbdcZJeZKdddeZLeLZMeLZNdfdgZOdhdiZPePZQdjdkZReRZSdldmZTddndoZUdpdqZVdrdsZWeZXeZYeZZdtduZ[e[Z\dvdwZ]e]Z^dxdyZ_eZ`fdfdzd{Zad|d}ZbeZcd~dZdeZeddZfddZgddZhddZiddZjddZkddddddgZlddZmenfddZoddZpepZqddZrddZsddZtddZudS)r NtabFTc $CsJtjj||dtjj|||||r,d|_d|_i|_i|_d|_ d|_ i|_ yddl }|j dWntk rzYnXd|_||_g|_|r(dtjkrtjd}y.ttjj|d} |jj| WdQRXWntk rYnXy$td} |jj| WdQRXWntk r&YnXi|_i|_i|_d|_d|_dS) N)skiprz(Pdb) Fz `@#$%^&*()=+[{]}\|;:'",<>?HOMEz.pdbrc)bdbBdb__init__cmdCmdZ use_rawinputpromptaliases displaying mainpyfile_wait_for_mainpyfile tb_linenoreadlineZset_completer_delims ImportError allow_kbdintnosigintrcLinesosenvironrpathjoinextendrcommandscommands_dopromptcommands_silentcommands_defining commands_bnum) r. completekeystdinstdoutr1rBZreadrcr?ZenvHomeZrcFilerrrr6sH   z Pdb.__init__cCs*|jr t|jd|j|j|dS)Nz- Program interrupted. (Use 'cont' to resume).)rAKeyboardInterruptmessageset_stepr)r.Zsignumframerrrsigint_handlers  zPdb.sigint_handlercCstjj||jdS)N)r4r5resetforget)r.rrrrVs z Pdb.resetcCs&d|_g|_d|_d|_|jjdS)Nr)rstackcurindexcurframer>clear)r.rrrrWs z Pdb.forgetcCsl|j|j||\|_|_x*|rFt|jj|j}||j|j<|j }qW|j|jd|_ |j j |_ |j S)Nr)rWZ get_stackrXrYr,tb_framef_codetb_lastir>tb_nextrZr#curframe_locals execRcLines)r.ftbrrrrsetups   z Pdb.setupcCsh|js dS|j}|jg|_xD|rb|jj}|r |ddkr |j|r |jt|7_dSq WdS)Nr#T)rCr)popstriponecmdreversed)r.rCrrrrras  zPdb.execRcLinescCs.|jr dS|j|r*|jd|j|ddS)znThis method is called when there is the remote possibility that we ever need to stop in this function.Nz--Call--)r=Z stop_hererR interaction)r.rTZ argument_listrrr user_calls   z Pdb.user_callcCsH|jr.|j|j|jjks$|jdkr(dSd|_|j|rD|j|ddS)z;This function is called when we stop or break at this line.rNF)r=r<canonicr] co_filenamef_lineno bp_commandsrj)r.rTrrr user_lines  z Pdb.user_linecCst|ddr|j|jkr|j}d|_|j}|j|dx|j|D]}|j|qBW||_|j|sv|j|j|j |j |r|j |j dSdS)zCall every command that was set for the current active breakpoint (if there is one). Returns True if the normal interaction function must be called, False otherwise. currentbpFrNr) getattrrqrIlastcmdrdrhrKprint_stack_entryrXrYrJ_cmdlooprW)r.rTrqZ lastcmd_backrrrrros      zPdb.bp_commandscCs.|jr dS||jd<|jd|j|ddS)z7This function is called when a return trap is set here.N __return__z --Return--)r=r#rRrj)r.rTZ return_valuerrr user_returns   zPdb.user_returncCsj|jr dS|\}}}||f|jd<| r4|tkr4dnd}|jd|tj||djf|j||dS)zoThis function is called if an exception occurs, but only if we are to stop at or just below this level.NZ __exception__z Internal r2z%s%sr)r=r# StopIterationrR tracebackformat_exception_onlyrgrj)r.rTexc_infoexc_type exc_value exc_tracebackprefixrrruser_exception's zPdb.user_exceptionc CsDx>yd|_|jd|_PWqtk r:|jdYqXqWdS)NTFz--KeyboardInterrupt--)rAcmdlooprQrR)r.rrrru;sz Pdb._cmdloopcCsb|jj|j}|r^xJ|jD]>\}}|j|}||k r||kr|||<|jd|||fqWdS)Nzdisplay %s: %r [old: %r])r;getrZitems_getval_exceptrR)r.r;exprZoldvalueZnewvaluerrrpreloopHs z Pdb.preloopcCsZtjrtjtjtjdt_|j||r4|jdS|j|j|j|j |jdS)N) r _previous_sigint_handlersignalSIGINTrdrWrtrXrYru)r.rTrzrrrrjUs zPdb.interactioncCs|dk r|jt|dS)z{Custom displayhook for the exec in default(), which prevents assignment of the _ variable in the builtins. N)rRrepr)r.r$rrr displayhookcszPdb.displayhookc Cs|dddkr|dd}|j}|jj}ydt|ddd}tj}tj}tj}z(|jt_|jt_|jt_t|||Wd|t_|t_|t_XWn4tj dd}|j t j |dj YnXdS)Nr! zZsinglerx)r`rZr"rsysrPrOrexecr|errorrzr{rg) r.rlocalsglobalsr*Z save_stdoutZ save_stdinZsave_displayhookr|rrrdefaultks(  z Pdb.defaultcCs|js |S|j}xx|d|jkr|j|d}d}x0|ddD] }|jdt||}|d7}qDW|jddj|dd}|j}qW|ddkr|jd}|dkr||d dj}|jj ||d|j }|S) z*Handle alias expansion and ';;' separator.rrN%z%* aliasz;;r) rgsplitr:replacestrrGfindlstripcmdqueueappendrstrip)r.rargsZiiZtmpArgZmarkernextrrrprecmds&     z Pdb.precmdcCs"|jstjj||S|j|SdS)zInterpret the argument as though it had been typed in response to the prompt. Checks whether this line is typed at the normal prompt or in a breakpoint command list definition. N)rLr7r8rhhandle_command_def)r.rrrrrhsz Pdb.onecmdc Cs|j|\}}}|sdS|dkr0d|j|j<dS|dkrBg|_dS|j|j}|rf|j|d|n |j|yt|d|}Wntk r|j}YnX|j |j krd|j |j<g|_dSdS) z8Handles one command line during command list definition.NZsilentTendrrdo_F) Z parselinerKrMrrIrrrAttributeErrorrrcommands_resumingrJ)r.rr7argZcmdlistfuncrrrrs,      zPdb.handle_command_defcCst||jddS)N)file)printrP)r.msgrrrrRsz Pdb.messagecCstd||jddS)Nz***)r)rrP)r.rrrrrsz Pdb.errorc Cs|jjdrgSy|j||||}Wntk r>g}YnXtj|d}xP|D]H}tjj|rt|j|dqTtjj |rT|j jdrT|j|dqTW|S) N:,*/.py.pyw)rr)rr) rgendswith_complete_expression ExceptionglobrDrFisdirrisfilelower)r.textrbegidxendidxZretglobsfnrrr_complete_locations   zPdb._complete_locationcsfddttjjDS)Ncs.g|]&\}}|dk rt|jrt|qS)N)r startswith).0r+bp)rrr sz*Pdb._complete_bpnumber..)rr4 Breakpoint bpbynumber)r.rrrrr)rr_complete_bpnumberszPdb._complete_bpnumberc s|js gS|jjj}|j|jdkrjdy0|d}xddD]}t||}qPWWnttfk r|gSXdj dddfddt |DSfdd|j DSdS) N.rrcs"g|]}|jdr|qS)rrx)r)rn)dottedrrrrsz,Pdb._complete_expression..csg|]}|jr|qSr)r)rr)rrrrsrxrx) rZr"copyupdater`rrrKeyErrorrrGdirkeys)r.rrrrnsr$partr)rrrrrs    zPdb._complete_expressioncCs(|sttjjd}n"y t|}Wn|jddS||_||jkrf|j||j||j |f}nd}g|j|<d|j|<d|j |<|j }d|_ d|_ zzy |j Wnht k r|r|d|j|<|d|j|<|d|j |<n|j|=|j|=|j |=|jd YnXWdd|_ ||_ XdS) a4commands [bpnumber] (com) ... (com) end (Pdb) Specify a list of commands for breakpoint number bpnumber. The commands themselves are entered on the following lines. Type a line containing just 'end' to terminate the commands. The commands are executed when the breakpoint is hit. To remove all commands from a breakpoint, type commands and follow it immediately with end; that is, give no commands. With no bpnumber argument, commands refers to the last breakpoint set. You can use breakpoint commands to start your program up again. Simply use the continue command, or step, or any other command that resumes execution. Specifying any command resuming execution (currently continue, step, next, return, jump, quit and their abbreviations) terminates the command list (as if that command was immediately followed by end). This is because any time you resume execution (even with a simple next or step), you may encounter another breakpoint -- which could have its own command list, leading to ambiguities about which list to execute. If you use the 'silent' command in the command list, the usual message about stopping at a breakpoint is not printed. This may be desirable for breakpoints that are to print a specific message and then continue. If none of the other commands print anything, you will see no sign that the breakpoint was reached. rz.Usage: commands [bnum] ... endNTFz(com) rrz1command definition aborted, old commands restored)lenr4rrintrrMrIrJrKr9rLrrQ)r.rZbnumZold_command_defsZ prompt_backrrr do_commandss@%       zPdb.do_commandsrcCs@|s<|jr8|jdx"tjjD]}|r|j|jqWdSd}d}d}|jd}|dkr~||ddj}|d|j}|j d}d} |dkr|d|j}|j |} | s|j d|dS| }||ddj}y t |}Wn$t k r|j d|dSXny t |}Wnt k ryt||jj|j} Wn|} YnXy.t| d rl| j} | j} | j} | j}| j}Wn@|j|\} }}| s|j d |dS| } t |}YnXYnX|s|j}|j||}|r<|j||||| }|r|j |n*|j||d }|jd |j|j|jfdS) ab(reak) [ ([filename:]lineno | function) [, condition] ] Without argument, list all breaks. With a line number argument, set a break at this line in the current file. With a function name, set a break at the first executable line of that function. If a second argument is present, it is a string specifying an expression which must evaluate to true before the breakpoint is honored. The line number may be prefixed with a filename and a colon, to specify a breakpoint in another file (probably one that hasn't been loaded yet). The file is searched for on sys.path; the .py suffix may be omitted. z!Num Type Disp Enb WhereNrrrrz%r not found from sys.pathzBad lineno: %s__func__zJThe specified object %r is not a function or was not found along sys.path.zBreakpoint %d at %s:%drx) breaksrRr4rrZbpformatrrrrfind lookupmodulerr ValueErrorevalrZr"r`hasattrr__code__co_nameco_firstlinenormlineinfo defaultFile checklineZ set_break get_breaksnumberrr)r.rZ temporaryrrrcondZcommaZcolonrrbrr*oklnrerrrrrdo_breakTs~             z Pdb.do_breakcCs"|jjj}|dkr|jr|j}|S)zProduce a reasonable default.z)rZr]rmr<)r.rrrrrs zPdb.defaultFilecCs|j|ddS)ztbreak [ ([filename:]lineno | function) [, condition] ] Same arguments as break, but sets a temporary breakpoint: it is automatically deleted when first hit. rN)r)r.rrrr do_tbreaksz Pdb.do_tbreakc Csd}|jd}t|dkr(|dj}nt|dkrB|dj}n|S|dkrR|S|jd}|ddkr~|d=t|dkr~|S|j}t|dkr|d}n|j|d}|r|}|d}t||} | p|S) N'rrr2rr.)NNN)rrrgrrr ) r.Z identifierZfailedZidstringidpartsZfnameitemrbZanswerrrrrs.         z Pdb.lineinfocCst|dr|jjnd}tj|||}|s6|jddS|j}| sp|ddksp|dddksp|dddkr~|jd dS|S) zCheck whether specified line seems to be executable. Return `lineno` if it is, 0 if not (e.g. a docstring, comment, blank line or EOF). Warning: testing is not comprehensive. rZNz End of filerrerz"""z'''zBlank or comment)rrZr" linecachegetlinerRrgr)r.rrrrrrrrs   z Pdb.checklinecCsl|j}x^|D]V}y|j|}Wn,tk rL}z|j|WYdd}~XqX|j|jd|qWdS)zenable bpnumber [bpnumber ...] Enables the breakpoints given as a space separated list of breakpoint numbers. Nz Enabled %s)rget_bpbynumberrrenablerR)r.rrr+rrrrr do_enables z Pdb.do_enablecCsl|j}x^|D]V}y|j|}Wn,tk rL}z|j|WYdd}~XqX|j|jd|qWdS)aNdisable bpnumber [bpnumber ...] Disables the breakpoints given as a space separated list of breakpoint numbers. Disabling a breakpoint means it cannot cause the program to stop execution, but unlike clearing a breakpoint, it remains in the list of breakpoints and can be (re-)enabled. Nz Disabled %s)rrrrdisablerR)r.rrr+rrrrr do_disable s zPdb.do_disablecCs|jdd}y |d}Wntk r0d}YnXy|j|dj}WnHtk rf|jdYnXtk r}z|j|WYdd}~Xn.X||_|s|jd|jn|jd|jdS)a#condition bpnumber [condition] Set a new condition for the breakpoint, an expression which must evaluate to true before the breakpoint is honored. If condition is absent, any existing condition is removed; i.e., the breakpoint is made unconditional. rrNrzBreakpoint number expectedz#Breakpoint %d is now unconditional.z$New condition set for breakpoint %d.) r IndexErrorrrgrrrrRr)r.rrrrrrrr do_condition!s   zPdb.do_conditioncCs|j}yt|dj}Wnd}YnXy|j|dj}WnHtk rb|jdYnvtk r}z|j|WYdd}~XnLX||_|dkr|dkrd|}nd}|jd||j fn|jd|j dS) aignore bpnumber [count] Set the ignore count for the given breakpoint number. If count is omitted, the ignore count is set to 0. A breakpoint becomes active when the ignore count is zero. When non-zero, the count is decremented each time the breakpoint is reached and the breakpoint is not disabled and any associated condition evaluates to true. rrzBreakpoint number expectedNz %d crossingsz 1 crossingz%Will ignore next %s of breakpoint %d.z-Will stop next time breakpoint %d is reached.) rrrgrrrrignorerRr)r.rrcountrrZcountstrrrr do_ignore<s(   z Pdb.do_ignorec !Cs|sxy td}Wntk r(d}YnX|jj}|d krtddtjjD}|jx|D]}|jd|q^WdSd |kr|j d }|d|}||d d}y t |}Wnt k rd |}YnX|j ||}|j ||}|r|j|nx|D]}|jd|qWdS|j} xd| D]\}y|j|}Wn.t k rl}z|j|WYdd}~XnX|j||jd|q,WdS) a=cl(ear) filename:lineno cl(ear) [bpnumber [bpnumber...]] With a space separated list of breakpoint numbers, clear those breakpoints. Without argument, clear all breaks (but first ask confirmation). With a filename:lineno argument, clear all breaks at that line in that file. zClear all breaks? noyyescSsg|] }|r|qSrr)rrrrrrmsz Pdb.do_clear..z Deleted %sNrrzInvalid line number (%s))rr)inputEOFErrorrgrr4rrZclear_all_breaksrRrrrrZ clear_breakrrrZclear_bpbynumber) r.rZreplyZbplistrr+rrrZ numberlistrrrdo_clear_sF              z Pdb.do_clearcCs |jdS)zw(here) Print a stack trace, with the most recent frame at the bottom. An arrow indicates the "current frame", which determines the context of most commands. 'bt' is an alias for this command. N)print_stack_trace)r.rrrrdo_wheresz Pdb.do_wherecCs>||_|j|jd|_|jj|_|j|j|jd|_dS)Nr)rYrXrZr#r`rtr)r.rrrr _select_frames  zPdb._select_framec Csx|jdkr|jddSyt|p"d}Wn"tk rJ|jd|dSX|dkrZd}ntd|j|}|j|dS)zu(p) [count] Move the current frame count (default one) levels up in the stack trace (to an older frame). rz Oldest frameNrzInvalid frame count (%s))rYrrrmaxr)r.rrnewframerrrdo_ups  z Pdb.do_upc Cs|jdt|jkr"|jddSyt|p,d}Wn"tk rT|jd|dSX|dkrnt|jd}ntt|jd|j|}|j|dS)zd(own) [count] Move the current frame count (default one) levels down in the stack trace (to a newer frame). rz Newest frameNzInvalid frame count (%s)r)rYrrXrrrminr)r.rrrrrrdo_downs z Pdb.do_downc Csf|rPy t|}Wn"tk r2|jd|dSX||jjkrT|jddSnd}|j|j|dS)aNunt(il) [lineno] Without argument, continue execution until the line with a number greater than the current one is reached. With a line number, continue execution until a line with a number greater or equal to that is reached. In both cases, also stop when the current frame returns. zError in argument: %rNz7"until" line number is smaller than current line numberr)rrrrZrnZ set_until)r.rrrrrdo_untils   z Pdb.do_untilcCs |jdS)zs(tep) Execute the current line, stop at the first possible occasion (either in a function that is called or in the current function). r)rS)r.rrrrdo_stepsz Pdb.do_stepcCs|j|jdS)zxn(ext) Continue execution until the next line in the current function is reached or it returns. r)Zset_nextrZ)r.rrrrdo_nexts z Pdb.do_nextcCs<|r4ddl}tjdd}|j|t_|tjdd<tdS)arun [args...] Restart the debugged python program. If a string is supplied it is split with "shlex", and the result is used as the new sys.argv. History, breakpoints, actions and debugger options are preserved. "restart" is an alias for "run". rNr)shlexrargvrr)r.rr Zargv0rrrdo_runs  z Pdb.do_runcCs|j|jdS)zPr(eturn) Continue execution until the current function returns. r)Z set_returnrZ)r.rrrr do_returns z Pdb.do_returnc Cs>|js2ytjtj|jt_Wntk r0YnX|jdS)z]c(ont(inue)) Continue execution, only stop when a breakpoint is encountered. r)rBrrrUr rrZ set_continue)r.rrrr do_continueszPdb.do_continuecCs|jdt|jkr"|jddSy t|}Wntk rL|jdYnnXy:||j_|j|jd|f|j|j<|j|j|jWn0tk r}z|jd|WYdd}~XnXdS)aj(ump) lineno Set the next line that will be executed. Only available in the bottom-most frame. This lets you jump back and execute code again, or jump forward to skip code that you don't want to run. It should be noted that not all jumps are allowed -- for instance it is not possible to jump into the middle of a for loop or out of a finally clause. rz)You can only jump within the bottom frameNz)The 'jump' command requires a line numberrzJump failed: %s) rYrrXrrrrZrnrt)r.rerrrdo_jump"s   z Pdb.do_jumpcCsztjd|jj}|j}t|j|j|j}d|j j |_ |j dtj |j |||f|j dtj|j|j|_dS)zdebug code Enter a recursive debugger that steps through the code argument (which is an arbitrary expression or statement to be executed in the current environment). Nz(%s) zENTERING RECURSIVE DEBUGGERzLEAVING RECURSIVE DEBUGGER)rsettracerZr"r`r rNrOrPr9rgrR call_tracingr Ztrace_dispatchrs)r.rrrprrrdo_debug?s    z Pdb.do_debugcCsd|_|jdS)z[q(uit) exit Quit from the debugger. The program being executed is aborted. Tr)_user_requested_quitset_quit)r.rrrrdo_quitRsz Pdb.do_quitcCs|jdd|_|jdS)z=EOF Handles the receipt of EOF as a command. r2Tr)rRrr)r.rrrrdo_EOF]s z Pdb.do_EOFcCs|jj}|j}|j}|jd@r&|d}|jd@r8|d}xJt|D]>}|j|}||krp|jd|||fqB|jd|fqBWdS)zHa(rgs) Print the argument list of the current function. rz%s = %rz%s = *** undefined ***N)rZr]r` co_argcountco_flagsrange co_varnamesrR)r.rcodictrr+namerrrdo_argsfs   z Pdb.do_argscCs.d|jkr |jt|jdn |jddS)zQretval Print the return value for the last return of a function. rvzNot yet returned!N)r`rRrr)r.rrrr do_retvalws z Pdb.do_retvalc CsNyt||jj|jStjdd}|jtj|dj YnXdS)Nrrrx) rrZr"r`rr|rrzr{rg)r.rr|rrr_getvals z Pdb._getvalc Cshy.|dkrt||jj|jSt||j|jSWn4tjdd}tj|dj }t d|SdS)Nrrz** raised %s **rx) rrZr"r`r#rr|rzr{rgr-)r.rrTr|rrrrrszPdb._getval_exceptc Cs*y|jt|j|Wn YnXdS)z@p expression Print the value of the expression. N)rRrr&)r.rrrrdo_pszPdb.do_pc Cs,y|jtj|j|Wn YnXdS)zHpp expression Pretty-print the value of the expression. N)rRpprintZpformatr&)r.rrrrdo_ppsz Pdb.do_ppcCsdd|_d}|r|dkry^d|krX|jd\}}t|j}t|j}||krr||}nt|j}td|d}Wqtk r|jd|dSXn0|jdks|dkrtd|jj d}n |jd}|dkr|d}|jj j }|j |}yZt j||jj}|j||d||||jt|t||_t||krF|jd Wntk r^YnXdS) al(ist) [first [,last] | .] List source code for the current file. Without arguments, list 11 lines around the current line or continue the previous listing. With . as argument, list 11 lines around the current line. With one argument, list 11 lines starting at that line. With two arguments, list the given range; if the second argument is less than the first, it is a count. The current line in the current frame is indicated by "->". If an exception is being debugged, the line where the exception was originally raised or propagated is indicated by ">>", if it differs from the current line. r'NrrrzError in argument: %r z[EOF])rsrrrgrrrrrZrnr]rmget_file_breaksrgetlinesr" _print_linesrrrRrQ)r.rZlastfirstr breaklistr%rrrdo_lists>        z Pdb.do_listcCsh|jjj}|j|}yt|j\}}Wn*tk rP}z|j|dSd}~XnX|j||||jdS)z\longlist | ll List the whole source code for the current function or frame. N)rZr]rmr,r&rrr.)r.rrr0r%rrrrr do_longlists   zPdb.do_longlistcCsjy|j|}Wn dSyt|\}}Wn.ttfk rX}z|j|dSd}~XnX|j||dS)z^source expression Try to get source code for the given object and display it. N)r&r&r TypeErrorrr.)r.rr$r%rrrrr do_sources z Pdb.do_sourcec Cs|r|j}|jj|d }nd }}xt||D]|\}}t|jd} t| dkrX| d7} ||krj| d7} n| d7} ||kr| d7} n||kr| d7} |j| d|jq.Wd S) zPrint a range of lines.rrrrBz->z>> Nrxrx) rnr>rrrrjustrrRr) r.r%rrrTZcurrent_linenoZ exc_linenorrsrrrr.s    zPdb._print_linescCsy|j|}Wn dSd}y |j}Wntk r<YnX|rV|jd|jdSy |jj}Wntk rvYnX|r|jd|jdS|jtkr|jd|j|j fdS|jt|dS)z;whatis arg Print the type of the argument. Nz Function %sz Method %sz Class %s.%s) r&rrrRrr __class__typerr)r.rvaluer*rrr do_whatiss.   z Pdb.do_whatiscCsp|s<|jdx\|jj|jijD]}|jd|q$Wn0|j|}||jj|ji|<|jd||fdS)zdisplay [expression] Display the value of the expression if it changed, each time execution stops in the current frame. Without expression, list all display expressions for the current frame. zCurrently displaying:z%s: %rzdisplay %s: %rN)rRr;rrZrr setdefault)r.rrvalrrr do_display4s  zPdb.do_displayc CsT|r@y|jj|ji|=WqPtk r<|jd|YqPXn|jj|jddS)zundisplay [expression] Do not display the expression any more in the current frame. Without expression, clear all display expressions for the current frame. znot displaying %sN)r;rrZrrrf)r.rrrr do_undisplayGs zPdb.do_undisplaycsfdd|jj|jiDS)Ncsg|]}|jr|qSr)r)rr)rrrrWsz*Pdb.complete_undisplay..)r;rrZ)r.rrrrr)rrcomplete_undisplayVszPdb.complete_undisplaycCs*|jjj}|j|jtjd|ddS)zinteract Start an interactive interpreter whose global namespace contains all the (global and local) names found in the current scope. z *interactive*)ZlocalN)rZr"rrr`r*interact)r.rrrrr do_interactZs  zPdb.do_interactcCs|j}t|dkrLt|jj}x$|D]}|jd||j|fq(WdS|d|jkrt|dkr|jd|d|j|dfndj|dd|j|d<dS)acalias [name [command [parameter parameter ...] ]] Create an alias called 'name' that executes 'command'. The command must *not* be enclosed in quotes. Replaceable parameters can be indicated by %1, %2, and so on, while %* is replaced by all the parameters. If no command is given, the current alias for name is shown. If no name is given, all aliases are listed. Aliases may be nested and can contain anything that can be legally typed at the pdb prompt. Note! You *can* override internal pdb commands with aliases! Those internal commands are then hidden until the alias is removed. Aliasing is recursively applied to the first word of the command line; all other words in the line are left alone. As an example, here are two useful aliases (especially when placed in the .pdbrc file): # Print instance variables (usage "pi classInst") alias pi for k in %1.__dict__.keys(): print("%1.",k,"=",%1.__dict__[k]) # Print instance variables in self alias ps pi self rz%s = %sNrr)rrsortedr:rrRrG)r.rrrrrrrdo_aliasds  "z Pdb.do_aliascCs6|j}t|dkrdS|d|jkr2|j|d=dS)z9unalias name Delete the specified alias. rN)rrr:)r.rrrrr do_unaliass  zPdb.do_unaliascsfdd|jDS)Ncsg|]}|jr|qSr)r)ra)rrrrsz(Pdb.complete_unalias..)r:)r.rrrrr)rrcomplete_unaliasszPdb.complete_unaliasrr r rrrc Cs8yx|jD]}|j|q WWntk r2YnXdS)N)rXrtrQ)r. frame_linenorrrrs  zPdb.print_stack_tracecCs6|\}}||jkrd}nd}|j||j||dS)Nz> z )rZrRZformat_stack_entry)r.rIZ prompt_prefixrTrrrrrrts  zPdb.print_stack_entrycCs|stjj||Sy}xtjj |rtj |}qWtjj||}tjj|r|SqWdS)zHelper function for break/clear parsing -- may be overridden. lookupmodule() translates (possibly incomplete) file or module name into an absolute file name. rr2z.pyN) rDrFisabsexistsrGrrlr<splitextislinkreadlink)r.rrbrootZextdirnamefullnamerrrrs"   zPdb.lookupmodulec Cstddl}|jj|jjd|tdd|_|j||_d|_t |d}d|j |jf}WdQRX|j |dS)Nr__main__)r__file__ __builtins__TFrbzexec(compile(%r, %r, 'exec'))) rW__dict__r[rrYr=rlr<rrreadr )r.rrWr statementrrr _runscripts    zPdb._runscript)r0NNNFT)r)N)vrrrrr6rUrVrWrdrarkrprorwrrurrjrrrrhrrRrrrrrZcomplete_commandsrrZdo_bZcomplete_breakZ complete_brZcomplete_tbreakrrrZcomplete_enablerZcomplete_disablerZcomplete_conditionrZcomplete_ignorerZdo_clZcomplete_clearZ complete_clrZdo_wZdo_btrrZdo_urZdo_dr Zdo_untr Zdo_sr Zdo_nrZ do_restartrZdo_rrZdo_cZdo_contrZdo_jrZcomplete_debugrZdo_qZdo_exitrr$Zdo_ar%Zdo_rvr&rr'r)Zcomplete_printZ complete_pZ complete_ppr1Zdo_lr2Zdo_llr4Zcomplete_sourcer.r<Zcomplete_whatisr?Zcomplete_displayr@rArCrErFrHrr line_prefixrtrJZdo_hrMrNrr^rrrrr s /     M ]!!.    1 ! #    whereZdownZupbreakZtbreakr[rrrZ conditionrIsteprZuntilZjumpreturnZretvalcontinuer'ZlonglistrrZppZwhatissourceZdisplayZ undisplayrBrZunaliasdebugquitrz cCstj|||dS)N)r r )r]rrrrrr #scCstj|||S)N)r r )Z expressionrrrrrr &scCst|||dS)N)r )r]rrrrrr )scOstj||S)N)r r)rkwdsrrrr-scCstjtjjdS)N)r rr _getframef_backrrrrr0scCsB|dkrtjd}|dkr$tdt}|j|jd|dS)NrzAA valid traceback must be passed if no exception is being handled)rr|rr rVrj)trrrrr5s cCsttjdS)N)rrlast_tracebackrrrrr Cszimport x; x.main()cCs ttdS)N)r TESTCMDrrrrtestKsrncCsddl}|jtdS)Nr)pydocZpagerr)rorrrrOsausage: pdb.py [-c command] ... pyfile [arg] ... Debug the Python program given by pyfile. Initial commands are read from .pdbrc files in your home directory and in the current directory, if they exist. Commands supplied with -c are executed after commands from .pdbrc files. To let the script run until an exception occurs, use "-c continue". To let the script run up to a given line X in the debugged file, use "-c 'until X'".c Csddl}|jtjdddddg\}}|s>tttjdg}x<|D]4\}}|dkrjtttjqH|dkrH|j|qHW|d}tjj |std |d tjd|tjdd<tjj |tjd<t }|j j |xy|j||jrPtd Wqtk r0td |dtddj|Yqtk r`tdddttjdYqtk rtjtjdYqtjtdtdtjd}|jd|td|dYqXqWdS)Nrrzhc:--helpz --command=r-h-c --commandzError:zdoes not existz*The program finished and will be restartedZ Restartingzwith arguments:r6rz/The program exited via sys.exit(). Exit status:)rz2Uncaught exception. Entering post mortem debuggingz1Running 'cont' or 'step' will restart the programz#Post mortem debugger finished. The z will be restarted)rqrp)rrrs)getoptrr r_usageexitrrDrFrPrUr rCrHr^rrrG SystemExitr| SyntaxErrorrz print_excrj) rtZoptsrrIoptZoptargr<pdbrkrrrmain`sV             r|rW)NN)NN)N)-rrDrrr7r4r(r*rr(rr!rzrrr__all__r r&r,rr-r_r5r8r Z _help_orderZ_commandrrrgrMr r r rrrr rmrnrrur|rr{rrrrBst      "    < traceback.cpython-36.opt-2.pyc000064400000024773152462730460012077 0ustar003 \[@s6ddlZddlZddlZddlZdddddddd d d d d dddddddgZd2ddZddZd3ddZd4ddZd5ddZ dZ dZ d6dd Z d7ddZ d dZd!d"Zd#d$Zd8d%d Zd9d&d Zd:d'd Zd;d(d ZdN extract_stack extract_tbformat_exceptionformat_exception_only format_list format_stack format_tb print_exc format_excprint_exception print_last print_stackprint_tb clear_frames FrameSummary StackSummaryTracebackException walk_stackwalk_tbcCs8|dkrtj}x$tj|jD]}t||ddqWdS)N)fileend)sysstderrr from_listformatprint)extracted_listritemr!/usr/lib64/python3.6/traceback.py print_listsr!cCstj|jS)N)rrr)rrrr rs cCstt||d|ddS)N)limit)r)r!r)tbr"rrrr r-scCst||djS)N)r")rr)r#r"rrr r7scCstjt||dS)N)r")rextractr)r#r"rrr r;s zG The above exception was the direct cause of the following exception: zF During handling of the above exception, another exception occurred: TcCsF|dkrtj}x2tt||||dj|dD]}t||ddq,WdS)N)r")chainr)rr)rrrtyperr)etypevaluer#r"rr%linerrr r Ws cCs ttt||||dj|dS)N)r")r%)listrr&r)r'r(r#r"r%rrr rls cCstt||djS)N)r*rr)r'r(rrr r|scCs0t|}|dks| r d|}n d||f}|S)Nz%s z%s: %s ) _some_str)r'r(valuestrr)rrr _format_final_exc_lines   r-c Cs"yt|Sdt|jSdS)Nz)strr&__name__)r(rrr r+sr+cCsttj|||ddS)N)r"rr%)r rexc_info)r"rr%rrr r scCsdjttj||dS)Nr)r"r%)joinrrr0)r"r%rrr r scCs.ttdstdttjtjtj|||dS)N last_typezno last exception)hasattrr ValueErrorr r2 last_valuelast_traceback)r"rr%rrr r s cCs*|dkrtjj}tt||d|ddS)N)r")r)r _getframef_backr!r)fr"rrrr r s cCs"|dkrtjj}tt||dS)N)r")rr7r8rr)r9r"rrr rs cCs0|dkrtjj}tjt||d}|j|S)N)r")rr7r8rr$rreverse)r9r"stackrrr rs  c Cs<x6|dk r6y|jjWntk r,YnX|j}qWdS)N)tb_frameclear RuntimeErrortb_next)r#rrr rs  c@sNeZdZdZddddd d Zd d Zd dZddZddZe ddZ dS)rfilenamelinenoname_linelocalsTN) lookup_linerDr)cCsF||_||_||_||_|r"|j|rsz(FrameSummary.__init__..)r@rArBrCr)dictitemsrD)selfr@rArBrErDr)rrr __init__s zFrameSummary.__init__cCs`t|tr:|j|jko8|j|jko8|j|jko8|j|jkSt|tr\|j|j|j|jf|kStS)N) isinstancerr@rArBrDtupler)NotImplemented)rMotherrrr __eq__s      zFrameSummary.__eq__cCs|j|j|j|jf|S)N)r@rArBr))rMposrrr __getitem__szFrameSummary.__getitem__cCst|j|j|j|jgS)N)iterr@rArBr))rMrrr __iter__szFrameSummary.__iter__cCsdj|j|j|jdS)Nz7)r@rArB)rr@rArB)rMrrr __repr__szFrameSummary.__repr__cCs&|jdkr tj|j|jj|_|jS)N)rC linecachegetliner@rAstrip)rMrrr r)s zFrameSummary.line)r@rArBrCrD) r/ __module__ __qualname__ __slots__rNrSrUrWrXpropertyr)rrrr rs ccs8|dkrtjjj}x|dk r2||jfV|j}qWdS)N)rr7r8f_lineno)r9rrr r"s    ccs&x |dk r |j|jfV|j}qWdS)N)r< tb_linenor?)r#rrr r/s c@s6eZdZeddddddZeddZd d ZdS) rNTF)r" lookup_linescapture_localsc Cs|dkr(ttdd}|dk r(|dkr(d}|dk rV|dkrFtj||}ntj|| d}|}t}xb|D]Z\}}|j} | j} | j } |j | t j | |j |r|j} nd} |jt| || d| dqhWx|D]} t j| qW|rx|D] }|jqW|S)Ntracebacklimitr)maxlenF)rErD)getattrr itertoolsislice collectionsdequesetf_code co_filenameco_nameaddrY lazycache f_globalsf_localsappendr checkcacher)) klass frame_genr"rcrdresultfnamesr9rAcor@rBrsrrr r$?s6     zStackSummary.extractcCsPt}xD|D]<}t|tr&|j|q |\}}}}|jt||||dq W|S)N)r))rrOrrt)rva_listrxframer@rArBr)rrr ros     zStackSummary.from_listc Csxg}d}d}d}d}x$|D]}|dksX||jksX|dksX||jksX|dksX||jkr|tkr|t8}|jd|d|dkrdndd|j}|j}|j}d}|d7}|tkrqg}|jdj|j|j|j|jr|jd j|jj|jr(x0t |jj D]\}} |jd j|| d qW|jdj |qW|tkrt|t8}|jd|d|dkrhdndd|S) Nrz [Previous line repeated z more timesrz] z File "{}", line {}, in {} z {} z {name} = {value} )rBr() r@rArB_RECURSIVE_CUTOFFrtrr)r[rDsortedrLr1) rMrx last_file last_line last_namecountr|rowrBr(rrr rsD   "zStackSummary.format)r/r\r] classmethodr$rrrrrr r<s . c@sZeZdZdddddddZeddZd d Zd d Zd dZddZ ddddZ dS)rNTF)r"rcrd_seenc Cs<|dkrt}|jt||r\|jdk r\t|j|kr\tt|j|j|jj|d||d}nd}|r|jdk rt|j|krtt|j|j|jj|d||d} nd} ||_||_| |_|r|j nd|_ t j t ||||d|_ ||_t||_|ot|tr*|j|_t|j|_|j|_|j|_|j|_|r8|jdS)NF)r"rcrdr)r"rcrd)rlrpid __cause__rr& __traceback__ __context__ exc_traceback__suppress_context__rr$rr;exc_typer+_str issubclass SyntaxErrorr@r.rAtextoffsetmsg _load_lines) rMr exc_valuerr"rcrdrcausecontextrrr rNsT      zTracebackException.__init__cOs|t|||jf||S)N)r&r)clsexcargskwargsrrr from_exception sz!TracebackException.from_exceptioncCs:x|jD] }|jqW|jr&|jj|jr6|jjdS)N)r;r)rrr)rMr|rrr rs    zTracebackException._load_linescCs |j|jkS)N)__dict__)rMrRrrr rSszTracebackException.__eq__cCs|jS)N)r)rMrrr __str__szTracebackException.__str__c cs|jdkrtd|jVdS|jj}|jj}|dkr@|d|}t|jts^t||jVdS|jpfd}t|j ptd}dj ||V|j }|j }|dk rdj |j V|dk r|jd}tt||d }|d|j}d d |D}d j d j|V|jp d}dj ||VdS)N__main__builtins.z?z File "{}", line {} z {}  r}css|]}|jr|pdVqdS) N)isspace)rGcrrr rJHsz;TracebackException.format_exception_only..z {}^ rzz{}: {} )rr)rr-rr]r\rrr@r.rArrrr[rstripminlenlstripr1r) rMstypesmodr@rAbadliner caretspacerrrr r s2        z(TracebackException.format_exception_only)r%ccs|rV|jdk r*|jj|dEdHtVn,|jdk rV|j rV|jj|dEdHtV|jdk rfdV|jjEdH|jEdHdS)N)r%z#Traceback (most recent call last): ) rr_cause_messagerr_context_messagerr;r)rMr%rrr rMs    zTracebackException.format) r/r\r]rNrrrrSrrrrrrr rs9  -)N)NN)N)N)NNT)NT)NNT)NT)NNT)NNN)NN)NN)rjrhrYr__all__r!rrrrrrr rrr-r+r r r r rrrrrrrr*rrrrrr sD          ?  zsymbol.cpython-36.opt-1.pyc000064400000004727152462730460011461 0ustar003 \G@sdZdZdZdZdZdZdZdZdZd Z d Z d Z d Z d Z dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Z d!Z!d"Z"d#Z#d$Z$d%Z%d&Z&d'Z'd(Z(d)Z)d*Z*d+Z+d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1d2Z2d3Z3d4Z4d5Z5d6Z6d7Z7d8Z8d9Z9d:Z:d;Z;dZ>d?Z?d@Z@dAZAdBZBdCZCdDZDdEZEdFZFdGZGdHZHdIZIdJZJdKZKdLZLdMZMdNZNdOZOdPZPdQZQdRZRdSZSdTZTdUZUdVZViZWx6eXeYjZD]$\Z[Z\e]e\e]dWkrpe[eWe\<qpWdXdYZ^e_dZkre^d[S)\z;Non-terminal symbols of Python grammar (from "graminit.h").iiiiiiiii i i i i iiiiiiiiiiiiiiiiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9i:i;i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUcCs:ddl}ddl}t|jdkr.|jddg|_|jdS)NrzInclude/graminit.hz Lib/symbol.py)systokenlenargv_main)rrr /usr/lib64/python3.6/symbol.pyrks r__main__N)`__doc__Z single_inputZ file_inputZ eval_inputZ decoratorZ decoratorsZ decoratedZ async_funcdefZfuncdefZ parametersZ typedargslistZtfpdefZ varargslistZvfpdefZstmtZ simple_stmtZ small_stmtZ expr_stmtZ annassignZtestlist_star_exprZ augassignZdel_stmtZ pass_stmtZ flow_stmtZ break_stmtZ continue_stmtZ return_stmtZ yield_stmtZ raise_stmtZ import_stmtZ import_nameZ import_fromZimport_as_nameZdotted_as_nameZimport_as_namesZdotted_as_namesZ dotted_nameZ global_stmtZ nonlocal_stmtZ assert_stmtZ compound_stmtZ async_stmtZif_stmtZ while_stmtZfor_stmtZtry_stmtZ with_stmtZ with_itemZ except_clauseZsuiteZtestZ test_nocondZlambdefZlambdef_nocondZor_testZand_testZnot_testZ comparisonZcomp_opZ star_exprexprZxor_exprZand_exprZ shift_exprZ arith_exprZtermZfactorZpowerZ atom_exprZatomZ testlist_compZtrailerZ subscriptlistZ subscriptZsliceopZexprlistZtestlistZdictorsetmakerZclassdefZarglistZargumentZ comp_iterZcomp_forZcomp_ifZ encoding_declZ yield_exprZ yield_argZsym_namelistglobalsitems_nameZ_valuetyper__name__r r r r s  ntpath.cpython-36.pyc000064400000032670152462730460010511 0ustar003 \6Z'@s>dZdZdZdZdZdZdZdZdZdd l Z dd l Z dd l Z dd l Z dd l Td d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1g'Z d2d3Zd4d Zd5d Zd6d Zd7dZd8d"Zd9dZd:dZe jje_d;dZddZydd?lmZWnek r2d ZYnXd@dZdAdZdBdZ dCd Z!dDdEZ"yddFlm#Z#Wnek re"Z$Yn XdGd!Z$e$Z%e&e dHoe j'dIdJkZ(dRdKd-Z)dLd1Z*y,e j'd dJdSkrddNlm+Z+neWn"e,efk rdOdPZ+YnXyddQlm-Z.Wnek r8YnXd S)TzCommon pathname manipulations, WindowsNT/95 version. Instead of importing this module directly, import os and refer to this module as os.path. .z..\;/z.;C:\binZnulN)*normcaseisabsjoin splitdrivesplitsplitextbasenamedirname commonprefixgetsizegetmtimegetatimegetctimeislinkexistslexistsisdirisfileismount expanduser expandvarsnormpathabspathsplitunccurdirpardirseppathsepdefpathaltsepextsepdevnullrealpathsupports_unicode_filenamesrelpathsamefile sameopenfilesamestat commonpathcCst|trdSdSdS)Ns\/z\/) isinstancebytes)pathr1/usr/lib64/python3.6/ntpath.py _get_bothseps"s r3c Csxtj|}y.t|tr&|jddjS|jddjSWn:ttfk rrt|ttfsltd|j j dYnXdS)zaNormalize case of pathname. Makes all characters lowercase and all slashes into backslashes./\rrz0normcase() argument must be str or bytes, not %rN) osfspathr.r/replacelower TypeErrorAttributeErrorstr __class____name__)sr1r1r2r,s  cCs2tj|}t|d}t|dko0|dt|kS)zTest whether a path is absoluter)r6r7r lenr3)r?r1r1r2rCs  c GsVtj|}t|tr"d}d}d}n d}d}d}y|sD|dd|t|\}}xttj|D]}t|\}} | r| d|kr|s| r|}| }q^n*|r||kr|j|jkr|}| }q^|}|r|d |kr||}|| }q^W|r|d|kr|r|d d|kr|||S||Sttt fk rPt j d |f|YnXdS) Nr5s\/:rz\/:rr@r rD) r6r7r.r/r mapr9r:r; BytesWarning genericpath_check_arg_types) r0pathsr!sepscolonZ result_driveZ result_pathpZp_driveZp_pathr1r1r2r KsF        cCstj|}t|dkrt|tr0d}d}d}n d}d}d}|j||}|dd|dkr|dd |kr|j|d}|d kr|d d|fS|j||d }||d kr|d d|fS|d krt|}|d |||d fS|d d|kr|d d|dd fS|d d|fS)aSplit a pathname into drive/UNC sharepoint and relative path specifiers. Returns a 2-tuple (drive_or_unc, path); either part may be empty. If you assign result = splitdrive(p) It is always true that: result[0] + result[1] == p If the path contained a drive letter, drive_or_unc will contain everything up to and including the colon. e.g. splitdrive("c:/dir") returns ("c:", "/dir") If the path contained a UNC path, the drive_or_unc will contain the host name and share up to but not including the fourth directory separator character. e.g. splitdrive("//host/computer/dir") returns ("//host/computer", "/dir") Paths cannot contain both a drive letter and a UNC path. r5r4rBrrrCrr@NrDrD)r6r7rAr.r/r8find)rLr!r$rKZnormpindexZindex2r1r1r2r zs.   $  cCsFddl}|jdtdt|\}}t|dkr>|dd|fS||fS)aDeprecated since Python 3.1. Please use splitdrive() instead; it now handles UNC paths. Split a pathname into UNC mount point and relative path specifiers. Return a 2-tuple (unc, rest); either part may be empty. If unc is not empty, it has the form '//host/mount' (or similar using backslashes). unc+rest is always the input path. Paths containing drive letters never have a UNC part. rNzJszrelpath..cSsg|] }|r|qSr1r1)rrr1r1r2rKsrr@r))r6r7r.r/r~rrr rr ziprAr r:r;rFrSrGrH)r0startr!rr Z start_absZpath_absZ start_driveZ start_restZ path_driveZ path_rest start_list path_listrWZe1Ze2rel_listr1r1r2r).sF         c s|s tdtttj|}t|dtr8dddn dddy>fd d |D}fd d |D}ytfd d |D\}Wntk rtddYnXttdd |Ddkrtdt |dj \}}|j }fdd |D}fdd |D}t |}t |}xBt|D]&\} } | || kr,|d| }Pq,W|dt|}|rt|n|} | j|Sttfk rtjd|YnXdS)zDGiven a sequence of path names, returns the longest common sub-path.z%commonpath() arg is an empty sequencerr5r4rZrrrcs g|]}t|jjqSr1)r r8r9)rrL)r$r!r1r2rwszcommonpath..csg|]\}}|jqSr1)r )rrVrL)r!r1r2rxsc3s"|]\}}|ddkVqdS)Nr@r1)rrVrL)r!r1r2 {szcommonpath..z%Can't mix absolute and relative pathsNcss|]\}}|VqdS)Nr1)rrVrLr1r1r2rsr@zPaths don't have the same drivecsg|]}|r|kr|qSr1r1)rr)rr1r2rscsg|]}fdd|DqS)csg|]}|r|kr|qSr1r1)rr)rr1r2rsz)commonpath...r1)rr?)rr1r2rsr-)r-)r~tuplerEr6r7r.r/setrAr r8r minmax enumerater r:r;rGrH) rIZ drivesplits split_pathsrrTr0commons1s2rWrrr1)r$rr!r2r-fsF  )_getfinalpathnamecCs tt|S)N)rr)fr1r1r2rsr)_isdir)N)rr)/__doc__rr r%r!r"r$r#r&r6sysr^rG__all__r3rrr r rr r r[r rrrntrb ImportErrorrrrrrrrr'hasattrrr(r)r-rr;rrr1r1r1r2s|      /4   2q1   85io.cpython-36.opt-2.pyc000064400000003552152462730460010557 0ustar003 \ @sfdZddddddddd d d d d dddddgZddlZddlZddlmZmZmZmZmZm Z m Z m Z m Z m Z mZmZmZejZde_dZdZdZGdddejejdZGdddejeZGdddejeZGdd d ejeZejex e e e ee fD]Z eje qWxe efD]Z eje qW[ yddlm!Z!Wne"k rVYn Xeje!dS)zGuido van Rossum , Mike Verdone , Mark Russell , Antoine Pitrou , Amaury Forgeot d'Arc , Benjamin Peterson BlockingIOErroropenIOBase RawIOBaseFileIOBytesIOStringIOBufferedIOBaseBufferedReaderBufferedWriterBufferedRWPairBufferedRandom TextIOBase TextIOWrapperUnsupportedOperationSEEK_SETSEEK_CURSEEK_ENDN) DEFAULT_BUFFER_SIZErrrrrrr r r r IncrementalNewlineDecoderrioc@seZdZejjZdS)rN)__name__ __module__ __qualname___io_IOBase__doc__rr/usr/lib64/python3.6/io.pyrHs) metaclassc@seZdZejjZdS)rN)rrrr _RawIOBaserrrrr rKsc@seZdZejjZdS)rN)rrrr_BufferedIOBaserrrrr rNsc@seZdZejjZdS)r N)rrrr _TextIOBaserrrrr r Qs)_WindowsConsoleIO)# __author____all__rabcrrrrrrrr r r r rr OpenWrapperrrrrrABCMetarr"rr#rr$r registerklassr% ImportErrorrrrr %s:  <   tarfile.cpython-36.opt-2.pyc000064400000164703152462730460011604 0ustar003 i'@s>dZdZdZdZdZddlmZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZy ddlZWnek rdZYnXy ddlZWnek rdZYnXeefZyeef7ZWnek rYnXdd d d d d dddddddddgZdZdZdZdZedZdZ dZ!dZ"dZ#dZ$d Z%dZ&d!Z'd"Z(d#Z)d$Z*d%Z+d&Z,d'Z-d(Z.d)Z/d*Z0d+Z1d,Z2d-Z3dZ4d.Z5d/Z6e5Z7e%e&e'e(e+e,e-e)e*e.e/e0f Z8e%e&e-e0fZ9e.e/e0fZ:dZ;d0d1d6d7hZe>e>d8Z?e j@d9krd:ZAnejBZAd;d<ZCd=d>ZDd?d@ZEdAe7fdBdCZFdDdEZGdedfdFdGZHdHdIZIdJdKZJGdLd d eKZLGdMddeLZMGdNd d eLZNGdOd d eLZOGdPddeLZPGdQddeLZQGdRdSdSeQZRGdTdUdUeQZSGdVdWdWeQZTGdXdYdYeQZUGdZd[d[eQZVGd\d]d]ZWGd^d_d_ZXGd`dadaeYZZGdbdcdceYZ[Gdddedee j\Z]GdfdgdgeLZ^Gdhdidie^Z_Gdjdkdke^Z`Gdldmdme^ZaGdndodoe^ZbGdpdqdqe^ZcGdrdsdse^Zde^eeMfZeddtduZfdvdwZgdxdyZhdzd{Ziegeheid|ZjeYZkejld}ZmGd~d d eYZnGdddeYZodd ZpeojZddZqerdkr:eqdS)z0.9.0u"Lars Gustäbel (lars@gustaebel.de)z5$Date: 2011-02-25 17:42:01 +0200 (Fri, 25 Feb 2011) $z?$Id: tarfile.py 88586 2011-02-25 15:42:01Z marc-andre.lemburg $u4Gustavo Niemeyer, Niels Gustäbel, Richard Townsend.)openNTarFileTarInfo is_tarfileTarError ReadErrorCompressionError StreamError ExtractError HeaderErrorENCODING USTAR_FORMAT GNU_FORMAT PAX_FORMATDEFAULT_FORMATrTz/etc/python/tarfile.cfgisustar sustar00d01234567LKSxgXpathlinkpathsizemtimeuidgidunamegname)ZatimeZctimer(r)r*r'ntzutf-8cCs8|dkrtd|j||}|d||t|tS)Nzmetadata cannot contain None) ValueErrorencodelenNUL)slengthencodingerrorsr6/usr/lib64/python3.6/tarfile.pystns r8cCs*|jd}|dkr|d|}|j||S)Nrr#)finddecode)r2r4r5pr6r6r7ntss  r=c Cs|dd krfd}x0tt|dD]}|dK}|||d7}q"W|ddkrdt|d| }n@y"t|dd}t|jpd d}Wntk rtd YnX|S) Nrr#asciistrict0zinvalid header)r>r?)ranger0r=intstripr.InvalidHeaderError)r2nir6r6r7ntis   rKr@cCst|}d|ko"d|dknrDtd|d|fdt}n|tkrd|d |kopd|dknr|dkrtdg}ntdg}d||}x6t|dD]}|jd|d@|dL}qWntd |S) Nrr@r#z%0*orBrAr>r?zoverflow in number field)rFbytesr1r bytearrayrEinsertr.)rIdigitsformatr2rJr6r6r7itns  2   rQcCs0dttjd|}dttjd|}||fS)NrAZ 148B8x356BZ 148b8x356b)sumstructZ unpack_from)bufZunsigned_chksumZ signed_chksumr6r6r7 calc_chksumss rUc Cs|pd}|dkrdS|dkr.tj|||dSt||\}}x8t|D],}|j|}t||krh|d|j|qFW|dkr|j|}t||kr|d|j|dS)Nirzunexpected end of datai@)shutil copyfileobjdivmodrEreadr0write) srcdstr3 exceptionbufsizeblocks remainderbrTr6r6r7rXs$     rXcCs ddl}|jdtdtj|S)Nrz$deprecated in favor of stat.filemoder$)warningswarnDeprecationWarningstatfilemode)modercr6r6r7rgsrgcCs8ttjdd}|dk r(|j|dj|}t|dddS)Nr4backslashreplace )end)getattrsysstdoutr/r;print)r2r4r6r6r7 _safe_printsrpc@s eZdZdS)rN)__name__ __module__ __qualname__r6r6r6r7rsc@s eZdZdS)r N)rqrrrsr6r6r6r7r !sc@s eZdZdS)rN)rqrrrsr6r6r6r7r$sc@s eZdZdS)rN)rqrrrsr6r6r6r7r'sc@s eZdZdS)r N)rqrrrsr6r6r6r7r *sc@s eZdZdS)r N)rqrrrsr6r6r6r7r -sc@s eZdZdS)EmptyHeaderErrorN)rqrrrsr6r6r6r7rt0srtc@s eZdZdS)TruncatedHeaderErrorN)rqrrrsr6r6r6r7ru3sruc@s eZdZdS)EOFHeaderErrorN)rqrrrsr6r6r6r7rv6srvc@s eZdZdS)rHN)rqrrrsr6r6r6r7rH9srHc@s eZdZdS)SubsequentHeaderErrorN)rqrrrsr6r6r6r7rw<srwc@s,eZdZddZddZddZddZd S) _LowLevelFilecCsFtjtjtjBtjBd|}ttdr2|tjO}tj||d|_dS)N)rwO_BINARYi) osO_RDONLYO_WRONLYO_CREATO_TRUNChasattrr{rfd)selfnamerhr6r6r7__init__Is   z_LowLevelFile.__init__cCstj|jdS)N)r|closer)rr6r6r7rRsz_LowLevelFile.closecCstj|j|S)N)r|rZr)rr'r6r6r7rZUsz_LowLevelFile.readcCstj|j|dS)N)r|r[r)rr2r6r6r7r[Xsz_LowLevelFile.writeN)rqrrrsrrrZr[r6r6r6r7rxCs rxc@speZdZddZddZddZddZd d Zd d Zd dZ ddZ dddZ dddZ ddZ ddZdS)_Streamc Csd|_|dkrt||}d|_|dkr6t|}|j}|pt|j|jkrL|jj|jd|j|j|jd|_qWdS)N)rTr0r_rr[)rr2r6r6r7Z__writesz_Stream.__writec Cs|jr dSd|_z|jdkr:|jdkr:|j|jj7_|jdkr|jr|jj|jd|_|jdkr|jjtj d|j |jjtj d|j d@Wd|j s|jj XdS)NTrzrrrzd|fg}d|_g|_d}|j}xT|D]L\}}||kr~|jj d||df|jj d||||f||7}||}qZW||jkr|jj d||jdfdS)NrrFT) roffsetr'positionrlrr map_indexmapr)rrrr'Z blockinfoZlastposZrealposr6r6r7rus(   z_FileInFile.__init__cCsdS)Nr6)rr6r6r7rsz_FileInFile.flushcCsdS)NTr6)rr6r6r7readablesz_FileInFile.readablecCsdS)NFr6)rr6r6r7writablesz_FileInFile.writablecCs |jjS)N)rseekable)rr6r6r7rsz_FileInFile.seekablecCs|jS)N)r)rr6r6r7rsz_FileInFile.tellcCs|tjkr tt|d|j|_nj|tjkr\|dkrFt|j|d|_qt|j||j|_n.|tjkrtt|j||jd|_ntd|jS)NrzInvalid argument) ioSEEK_SETminmaxr'rSEEK_CURSEEK_ENDr.)rrwhencer6r6r7rs   z_FileInFile.seekc Cs|dkr|j|j}nt||j|j}d}x|dkr xZ|j|j\}}}}||jkob|knrlPq:|jd7_|jt|jkr:d|_q:Wt|||j}|r|jj||j||jj|}t||krt d||7}n |t |7}||8}|j|7_q.W|S)Nrrr#zunexpected end of data) r'rrrrr0rrrZrr1) rr'rTdatastartstoprr3rbr6r6r7rZs.      z_FileInFile.readcCs&|jt|}||dt|<t|S)N)rZr0)rrbrTr6r6r7readintosz_FileInFile.readintocCs d|_dS)NT)r)rr6r6r7rsz_FileInFile.close)N)N)rqrrrsrrrrrrrrrrZrrr6r6r6r7ros  rcseZdZfddZZS) ExFileObjectcs&t|j|j|j|j}tj|dS)N)rr offset_datar'sparsesuperr)rtarfiletarinfor) __class__r6r7rs  zExFileObject.__init__)rqrrrsr __classcell__r6r6)rr7rsrc@s eZdZdS) FilterErrorN)rqrrrsr6r6r6r7rsrcseZdZfddZZS)AbsolutePathErrorcs ||_tjd|jddS)Nzmember z has an absolute path)rrrr)rr)rr6r7rszAbsolutePathError.__init__)rqrrrsrrr6r6)rr7rsrcseZdZfddZZS)OutsideDestinationErrorcs.||_||_tj|jd|dddS)Nz would be extracted to z, z which is outside the destination)r_pathrrr)rrr%)rr6r7rsz OutsideDestinationError.__init__)rqrrrsrrr6r6)rr7rsrcseZdZfddZZS)SpecialFileErrorcs||_tj|jddS)Nz is a special file)rrrr)rr)rr6r7rszSpecialFileError.__init__)rqrrrsrrr6r6)rr7rsrcseZdZfddZZS)AbsoluteLinkErrorcs||_tj|jddS)Nz! is a symlink to an absolute path)rrrr)rr)rr6r7rszAbsoluteLinkError.__init__)rqrrrsrrr6r6)rr7rsrcseZdZfddZZS)LinkOutsideDestinationErrorcs.||_||_tj|jd|dddS)Nz would link to z, z which is outside the destination)rrrrr)rrr%)rr6r7rsz$LinkOutsideDestinationError.__init__)rqrrrsrrr6r6)rr7rsrcseZdZfddZZS)LinkFallbackErrorcs2||_||_tjd|jdd|ddS)Nzlink z would be extracted as a zcopy of z, which was rejected)rrrrr)rrr%)rr6r7rszLinkFallbackError.__init__)rqrrrsrrr6r6)rr7rsrcCs$i}|j}tjj|tjjd}|jdtjfrH|jjdtj}|d<tjj|r\t |tjjtjj ||tjjd}tjj ||g|krt |||j }|dk r|d@}|r|js|jr|d@s|dM}|dO}n|js|jrd}nt|||j kr||d<|r |jdk r,d|d <|jdk r@d|d <|jdk rTd|d <|jdk rhd|d <|js||jr tjj|jrt|tjj|j}||jkr||d <|jrtjj |tjj||j}ntjj ||j}tjj|tjjd}tjj ||g|kr t|||S)N)rC/ri@Iirhr)r*r+r,linknamei)rr|r%realpath ALLOW_MISSINGrseplstripisabsrr commonpathrrhisregislnkisdirissymrr)r*r+r,rrnormpathdirnamer)member dest_pathZfor_data new_attrsrZ target_pathrhZ normalizedr6r6r7_get_filtered_attrssd                rcCs|S)Nr6)rrr6r6r7fully_trusted_filterTsrcCs(t||d}|r$|jf|ddiS|S)NFdeep)rr)rrrr6r6r7 tar_filterWs rcCs(t||d}|r$|jf|ddiS|S)NTrF)rr)rrrr6r6r7 data_filter]s r)Z fully_trustedrrs([0-9]{1,20}) c@seZdZdlZdmddZddZddZeeeZddZ ddZ ee e Z d d!Z e e e e e e e e d"e d# d$d%Zd&d'Zeed(fd)d*Zd+d,Zd-d.Zd/d0Zed1d2Zd3d4Zed5d6Zed7d8Zed9d:Zed;d<Zed=d>Zed?d@ZdAdBZ dCdDZ!dEdFZ"dGdHZ#dIdJZ$dKdLZ%dMdNZ&dOdPZ'dQdRZ(dSdTZ)dUdVZ*dWdXZ+dYdZZ,d[d\Z-d]d^Z.d_d`Z/dadbZ0dcddZ1dedfZ2dgdhZ3didjZ4dkS)nrrrhr)r*r'r(chksumtyperr+r,devmajordevminorrr pax_headersrr_sparse_structs _link_targetrcCsj||_d|_d|_d|_d|_d|_d|_t|_d|_ d|_ d|_ d|_ d|_ d|_d|_d|_i|_dS)Nirr)rrhr)r*r'r(rREGTYPErrr+r,rrrrrr)rrr6r6r7rs"zTarInfo.__init__cCs|jS)N)r)rr6r6r7_getpathszTarInfo._getpathcCs ||_dS)N)r)rrr6r6r7_setpathszTarInfo._setpathcCs|jS)N)r)rr6r6r7 _getlinkpathszTarInfo._getlinkpathcCs ||_dS)N)r)rrr6r6r7 _setlinkpathszTarInfo._setlinkpathcCsd|jj|jt|fS)Nz<%s %r at %#x>)rrqrid)rr6r6r7__repr__szTarInfo.__repr__T) rr(rhrr)r*r+r,r_KEEPc Cs| rtj|} n tj|} || k r(|| _|| k r6|| _|| k rD|| _|| k rR|| _|| k r`|| _|| k rn|| _|| k r||| _|| k r|| _ | S)N) copydeepcopyrr(rhrr)r*r+r,) rrr(rhrr)r*r+r,rr resultr6r6r7rs(  zTarInfo.replacecCs|jdkrd}n |jd@}|j||j|j|j|j|j|j|j|j |j |j |j d }|dt kr~|djd r~|dd7<|S)Ni) rrhr)r*r'r(rrrr+r,rrrrr)rhrr)r*r'r(rrrr+r,rrDIRTYPEr)rrhinfor6r6r7get_infos&   zTarInfo.get_infosurrogateescapecCs~|j}x(|jD]\}}|dkrtd|qW|tkrH|j|||S|tkr^|j|||S|tkrr|j||StddS)Nz%s may not be Nonezinvalid format) ritemsr.r create_ustar_headerrcreate_gnu_headerrcreate_pax_header)rrPr4r5rrvaluer6r6r7tobufs z TarInfo.tobufcCsnt|d<t|dj||tkr(tdt|dj||tkr^|j|d||\|d<|d<|j|t||S)Nmagicrzlinkname is too longrprefix) POSIX_MAGICr0r/ LENGTH_LINKr. LENGTH_NAME_posix_split_name_create_headerr )rrr4r5r6r6r7rs zTarInfo.create_ustar_headercCst|d<d}t|dj||tkr<||j|dt||7}t|dj||tkrl||j|dt||7}||j|t ||S)Nrrrr) GNU_MAGICr0r/r_create_gnu_long_headerGNUTYPE_LONGLINKrGNUTYPE_LONGNAMErr)rrr4r5rTr6r6r7rszTarInfo.create_gnu_headerc Cs4t|d<|jj}xddtfddtfddfD]h\}}}||kr@q,y||jd d Wn"tk rv||||<w,YnXt|||kr,||||<q,WxldD]d\}}||krd||<q||}d|kod |dkn st|t rt |||<d||<qW|r|j |t |} nd} | |j |td dS)Nrrr%rr&r+ r,rBrCr)r@r*r' r(rr#rr)r+r+r")r,r,r"r)r@r*r@r'r#r(r#)r$r%r&r')rrr rrr/UnicodeEncodeErrorr0 isinstancefloatstr_create_pax_generic_headerXHDTYPErr ) rrr4rrZhnamer3rOvalrTr6r6r7rs4  .  zTarInfo.create_pax_headercCs|j|tdS)Nzutf-8)r,XGLTYPE)clsrr6r6r7create_pax_global_header?sz TarInfo.create_pax_global_headercCs|jd}xltdt|D]R}dj|d|}dj||d}t|j||tkrt|j||tkrPqWtd||fS)Nrr#zname is too long)splitrEr0rr/ LENGTH_PREFIXrr.)rrr4r5Z componentsrJrr6r6r7rEs zTarInfo._posix_split_namec Cs|jdttfk}|r@t|jddd|}t|jddd|}ntdd||}tdd||}|jdt}|dkrxtdt|jddd ||t|jd dd @d|t|jd dd|t|jd dd|t|jddd|t|jddd|d|t|jddd |||jdtt|jddd||t|jddd||t|jddd|t|jddd|t|jddd||g}tj dt dj |} t | t dd} | ddt d| d| d d} | S)!Nrrrr@rrzTarInfo.type must not be Nonerrrhir)r*r'r#r(s rrr+r"r,rrz%dsrilz%06orBieii)getCHRTYPEBLKTYPErQr8rr.rrSrrrrUrL) rrPr4r5Zhas_device_fieldsrrZfiletypepartsrTrr6r6r7rUs8  &zTarInfo._create_headercCs.tt|t\}}|dkr*|t|t7}|S)Nr)rYr0rr1)Zpayloadr`rar6r6r7_create_payloadszTarInfo._create_payloadcCsR|j||t}i}d|d<||d<t||d<t|d<|j|t|||j|S)Nz ././@LongLinkrrr'r)r/r1r0rrr r8)r0rrr4r5rr6r6r7rs zTarInfo._create_gnu_long_headerc Cs:d}x@|jD]4\}}y|jddWqtk r@d}PYqXqWd}|rV|d7}x|jD]\}}|jd}|r|j|d}n |jd}t|t|d}d } } x"|tt| } | | krP| } qW|tt| d d |d |d 7}q`Wi} d| d<|| d<t|| d<t| d<|j| td d|j |S)NFzutf-8rCTrs21 hdrcharset=BINARY rrrrB = z././@PaxHeaderrrr'rr) rr/r(r0r+rLrrr r8) r0rrr4ZbinarykeywordrZrecordslrIr<rr6r6r7r,s<   * z"TarInfo._create_pax_generic_headerc Cstt|dkrtdt|tkr(td|jttkr>tdt|dd}|t|krbt d|}t |dd|||_ t|dd |_ t|d d |_ t|d d |_t|d d |_t|d d|_||_|dd |_t |d d|||_t |dd|||_t |dd|||_t|dd|_t|dd|_t |dd||}|jtkr|j jdrt|_|jtkr6d}g}xrtdD]f} y0t|||d} t||d|d} Wntk rPYnX|j| | f|d7}qWt|d} t|dd} || | f|_ |j!rN|j j"d|_ |rp|jt#krp|d|j |_ |S)Nrz empty headerztruncated headerzend of file headerz bad checksumrlt|ii i)iIiQiYirirr#iii)$r0rtrrucountr1rvrKrUrHr=rrhr)r*r'r(rrrr+r,rrAREGTYPErr GNUTYPE_SPARSErEr.rboolrrrstrip GNU_TYPES)r0rTr4r5robjrrstructsrJrnumbytes isextendedorigsizer6r6r7frombufsZ       zTarInfo.frombufcCs8|jjt}|j||j|j}|jjt|_|j|S)N) rrZrrQr4r5rr _proc_member)r0rrTrLr6r6r7 fromtarfile s zTarInfo.fromtarfilecCsT|jttfkr|j|S|jtkr,|j|S|jtttfkrF|j |S|j |SdS)N) rr!r  _proc_gnulongrH _proc_sparser-r/SOLARIS_XHDTYPE _proc_pax _proc_builtin)rrr6r6r7rR!s    zTarInfo._proc_membercCsR|jj|_|j}|js$|jtkr4||j|j7}||_|j |j |j |j |S)N) rrrrrSUPPORTED_TYPES_blockr'r_apply_pax_inforr4r5)rrrr6r6r7rX.s zTarInfo._proc_builtinc Cs|jj|j|j}y|j|}Wntk r>tdYnX|j|_|jt krft ||j |j |_ n|jtkrt ||j |j |_|S)Nz missing or bad subsequent header)rrZrZr'rSr rwrrr!r=r4r5rr r)rrrTnextr6r6r7rT?s  zTarInfo._proc_gnulongc Cs|j\}}}|`x|r|jjt}d}xvtdD]j}y0t|||d}t||d|d} Wntk rzPYnX|r| r|j|| f|d7}q0Wt|d}qW||_ |jj |_ |j |j |j |_||_ |S)Nrr#rEi)rrrZrrErKr.rrIrrrrZr'r) rrrMrOrPrTrrJrrNr6r6r7rUUs(    zTarInfo._proc_sparsec Cs|jj|j|j}|jtkr&|j}n |jj}d}d}g}x0t||koV||dkrnt j ||}|srt dyt |j d}Wntk rt dYnX|dkrt d||t|krt d|jd|d} ||jdd| } | jd\} } } | s"| dks"|| dkr*t d|j|| | f| dkrd|dkrd| dkr`|j}nd }||7}q@W|dkr~d }x`|D]X\}} } |j| d d |j}|tkr|j| ||j|j}n|j| d d |j}|||<qWy|j|}Wntk r td YnXd |kr&|j||nFd |kr>|j||n.|jd dkrl|jddkrl|j||||jttfkr|j ||j|j|j!|_!d|kr|j"}|j#s|jt$kr||j|j7}||_!|S)Nrzinvalid headerr#r:rs hdrcharsetsBINARYzutf-8z missing or bad subsequent headerzGNU.sparse.mapzGNU.sparse.sizezGNU.sparse.major1zGNU.sparse.minorrDr')%rrZrZr'rr/rr r0_header_length_prefix_rematchrHrFgroupr.rrk partitionrr4_decode_pax_fieldr5PAX_NAME_FIELDSrSr rw_proc_gnusparse_01_proc_gnusparse_00r4_proc_gnusparse_10r-rVr[rrrrY)rrrTrrr4 raw_headersrar3Zheader_value_end_offsetZkeyword_and_valueZ raw_keywordZequalsZ raw_valuer<rr\rr6r6r7rWqsx                 zTarInfo._proc_paxc Csg}g}x|D]\}}}|dkrVy|jt|jWqtk rRtdYqXq|dkry|jt|jWqtk rtdYqXqWtt|||_dS)NsGNU.sparse.offsetzinvalid headersGNU.sparse.numbytes)rrFr;r.rHlistzipr)rr\riZoffsetsrN_r<rr6r6r7rgszTarInfo._proc_gnusparse_00cCs@dd|djdD}tt|ddd|ddd|_dS)NcSsg|] }t|qSr6)rF).0xr6r6r7 sz.TarInfo._proc_gnusparse_01..zGNU.sparse.map,r$r#)r2rjrkr)rr\rrr6r6r7rfszTarInfo._proc_gnusparse_01cCsd}g}|jjt}|jdd\}}t|}xJt||dkrvd|krV||jjt7}|jdd\}}|jt|q.W|jj|_t t |ddd|ddd|_ dS)Nr;r#r$) rrZrr2rFr0rrrrjrkr)rr\rrZfieldsrrTZnumberr6r6r7rhs  zTarInfo._proc_gnusparse_10c Csx|jD]\}}|dkr(t|d|q |dkrBt|dt|q |dkr\t|dt|q |tkr |tkryt||}Wntk rd}YnX|dkr|jd}t|||q W|j|_dS)NzGNU.sparse.namer%zGNU.sparse.sizer'zGNU.sparse.realsizerr) rsetattrrF PAX_FIELDSPAX_NUMBER_FIELDSr.rJr r)rrr4r5r<rr6r6r7r[s"  zTarInfo._apply_pax_infoc Cs.y |j|dStk r(|j||SXdS)NrC)r;UnicodeDecodeError)rrr4Zfallback_encodingZfallback_errorsr6r6r7rd,s zTarInfo._decode_pax_fieldcCs2|dkrtdt|t\}}|r*|d7}|tS)Nrzinvalid offsetr#)rHrYr)rrFr`rar6r6r7rZ4s zTarInfo._blockcCs |jtkS)N)r REGULAR_TYPES)rr6r6r7r@sz TarInfo.isregcCs|jS)N)r)rr6r6r7isfileBszTarInfo.isfilecCs |jtkS)N)rr )rr6r6r7rDsz TarInfo.isdircCs |jtkS)N)rSYMTYPE)rr6r6r7rFsz TarInfo.issymcCs |jtkS)N)rLNKTYPE)rr6r6r7rHsz TarInfo.islnkcCs |jtkS)N)rr5)rr6r6r7ischrJsz TarInfo.ischrcCs |jtkS)N)rr6)rr6r6r7isblkLsz TarInfo.isblkcCs |jtkS)N)rFIFOTYPE)rr6r6r7isfifoNszTarInfo.isfifocCs |jdk S)N)r)rr6r6r7issparsePszTarInfo.issparsecCs|jtttfkS)N)rr5r6r{)rr6r6r7isdevRsz TarInfo.isdevN)rrhr)r*r'r(rrrr+r,rrrrrrrrr)r)5rqrrrs __slots__rrrpropertyr%rrr&rr rrrr rrrr classmethodr1r staticmethodrr8rr,rQrSrRrXrTrUrWrgrfrhr[rdrZrrvrrrryrzr|r}r~r6r6r6r7rssd    1  *  3 ?  z c @seZdZdZdZdZdZeZe Z dZ e Z eZdZdjddZedddefd d Zedkd d ZedlddZedmddZednddZdddddZddZddZddZdd Zdod!d"Zdpdd$d%d&Zdqdd'd(d)Z drd*d+Z!d,d-Z"dsddd/d0d1Z#d2d3Z$dtddd/d5d6Z%d7d8Z&dud9d:Z'd;d<Z(d=d>Z)d?d@Z*dvdddAdBdCZ+dDdEZ,dFdGZ-dHdIZ.dJdKZ/dLdMZ0dNdOZ1dPdQZ2dRdSZ3dTdUZ4dVdWZ5dXdYZ6dwdZd[Z7d\d]Z8dxd^d_Z9d`daZ:dbdcZ;dddeZdS)yrrFr#NryrcCsddddd}||krtd||_|||_|sj|jdkrVtjj| rVd|_d|_t||j}d |_n@|dkrt|d rt |j t t fr|j }t|d r|j|_d |_|rtjj |nd|_ ||_|dk r||_|dk r||_|dk r||_|dk r||_|dk r||_| |_| dk r4|jtkr4| |_ni|_| dk rJ| |_| dk rZ| |_| |_d |_g|_d |_|jj|_i|_y|jd krd|_ |j!|_ |jdkr8x|jj"|jy|jj#|}|jj$|WnTt%k r|jj"|jPYn0t&k r0}zt't |WYdd}~XnXqW|jdkrd |_|jr|jj(|jj)}|jj*||jt+|7_Wn&|js|jj,d |_YnXdS)Nrbzr+bwbZxb)ryarzrnz!mode must be 'r', 'a', 'w' or 'x'rrzFrrhTryrn)rrzrn)-r.rh_moder|r%exists bltn_openrrr)rr+rLabspathrrPr dereference ignore_zerosr4r5rrdebug errorlevel copybufsizermembers_loadedrrinodes firstmemberr\rrSrrvr rr1r r[r0r)rrrhrrPrrrr4r5rrrrZmodeserTr6r6r7rrs             $   zTarFile.__init__c s| r| rtd|dkrfdd}xttj|dD]b}tj|}|dk r\|j} y||d|f|Sttfk r|dk r|j| w8Yq8Xq8Wtdnd|kr |jdd \} }| pd} |pd }|jkrtj|}n td |||| |f|Sd |kr|jd d \} }| p.d} |p8d }| dkrLtdt || |||} y|| | f|} Wn| j YnXd| _ | S|dkrj |||f|StddS)Nznothing to openryr:*csj|dkS)Ntaropen) OPEN_METH)r)r0r6r7not_compressed sz$TarFile.open..not_compressed)keyz%file could not be opened successfully:r#rzunknown compression type %r|rzzmode must be 'r' or 'w'Frrnzundiscernible mode)ryr)ryrz)rrzrn) r.sortedrrlrrrrr2rrrr) r0rrhrr_kwargsrrfuncZ saved_posrgstreamrr6)r0r7rsP%             z TarFile.opencKs |dkrtd||||f|S)Nryrrzrnz!mode must be 'r', 'a', 'w' or 'x')ryrrzrn)r.)r0rrhrrr6r6r7r<szTarFile.taropenrcKs|d krtdyddl}|jWn ttfk rBtdYnXy|j||d||}Wn.tk r|dk r|dkrtdYnXy|j|||f|}WnBtk r|j |dkrtdYn|j YnXd |_ |S) Nryrzrnzmode must be 'r', 'w' or 'x'rzgzip module is not availablerbznot a gzip fileF)ryrzrn) r.gzipZGzipFilerAttributeErrorrrrrrr)r0rrhr compresslevelrrrr6r6r7gzopenDs2 zTarFile.gzopencKs|d krtdy ddl}Wntk r8tdYnX|j|pD|||d}y|j|||f|}WnFttfk r|j|dkrt dYn|jYnXd |_ |S) Nryrzrnzmode must be 'r', 'w' or 'x'rzbz2 module is not available)rznot a bzip2 fileF)ryrzrn) r.rrrZBZ2FilerrEOFErrorrrr)r0rrhrrrrrr6r6r7bz2openfs(  zTarFile.bz2opencKs|d krtdy ddl}Wntk r8tdYnX|j|pD|||d}y|j|||f|}WnH|jtfk r|j|dkrt dYn|jYnXd |_ |S) Nryrzrnzmode must be 'r', 'w' or 'x'rzlzma module is not available)presetznot an lzma fileF)ryrzrn) r.rrrZLZMAFilerrrrrr)r0rrhrrrrrr6r6r7xzopens& zTarFile.xzopenrrrr)rrrrc Cs|jr dSd|_z`|jdkrn|jjttd|jtd7_t|jt\}}|dkrn|jjtt|Wd|j s|jj XdS)NTrrzrnr$r)rrzrn) rrhrr[r1rrrY RECORDSIZErr)rr`rar6r6r7rs z TarFile.closecCs"|j|}|dkrtd||S)Nzfilename %r not found) _getmemberKeyError)rrrr6r6r7 getmembers  zTarFile.getmembercCs|j|js|j|jS)N)_checkr_loadr)rr6r6r7 getmembersszTarFile.getmemberscCsdd|jDS)NcSsg|] }|jqSr6)r)rmrr6r6r7rosz$TarFile.getnames..)r)rr6r6r7getnamesszTarFile.getnamesc Csp|jd|dk r|j}|dkr$|}tjj|\}}|jtjd}|jd}|j}||_ |dkrt tdr|j rtj |}qtj |}ntj|j}d}|j}t j|r|j|jf} |j r|jdkr| |jkr||j| krt} |j| }nt} | drx||j| <nht j|r"t} nVt j|r4t} nDt j|rPt} tj|}n(t j|rbt } nt j!|rtt"} ndS||_||_#|j$|_%|j&|_'| tkr|j(|_)nd|_)|j*|_+| |_,||_-t.ryt.j/|j%d|_0Wnt1k rYnXt2r*yt2j3|j'd|_4Wnt1k r(YnX| t t"fkrlt tdrlt tdrltj5|j6|_7tj8|j6|_9|S) Nawxrlstatrr#rmajorminor):rrr|r% splitdriverrrrrrrrrffstatfilenost_modeS_ISREGst_inost_devst_nlinkrrxrS_ISDIRr S_ISFIFOr{S_ISLNKrwreadlinkS_ISCHRr5S_ISBLKr6rhst_uidr)st_gidr*st_sizer'st_mtimer(rrpwdgetpwuidr+rgrpZgetgrgidr,rst_rdevrrr) rrarcnamerZdrvrZstatresrZstmdinoderr6r6r7 gettarinfos~                 zTarFile.gettarinfoT)rcCs0|j|dkr|}x|D] }|r|jdkr:tdnttj|jtd|jpX|j|jpb|jf|j sz|j rtdd|j |j fntd|j |jdkrtdntdtj|jddt|j|jrd nd |r"|jr td |j|jr"td |jtqWdS) Nz ??????????z%s/%sz%10sz%d,%dz%10dz????-??-?? ??:??:??z%d-%02d-%02d %02d:%02d:%02drrrz-> zlink to )rrhrprfrgr+r)r,r*ryrzrrr'r(rZ localtimerrrrrro)rverboserrr6r6r7rj>s2      z TarFile.list)filterc Csv|jd|dkr|}|dk rPddl}|jdtd||rP|jdd|dS|jdk rtjj||jkr|jdd|dS|jd||j ||}|dkr|jdd|dS|dk r||}|dkr|jdd|dS|j rt |d }|j ||WdQRXnd|j rh|j ||rrxHtj|D].}|jtjj||tjj|||||d q4Wn |j |dS) Nrrzuse the filter argument insteadr$ztarfile: Excluded %rztarfile: Skipped %rr#ztarfile: Unsupported type %rr)r)rrcrdre_dbgrr|r%rrrraddfilerlistdiraddr) rrr recursiveZexcluderrcrfr6r6r7rdsB       z TarFile.addcCs|jdtj|}|j|j|j|j}|jj||jt |7_|j }|dk rt ||j|j |dt |j t\}}|dkr|jjtt||d7}|j|t7_|jj|dS)Nr)r_rr#)rr rrPr4r5rr[rr0rrXr'rYrr1rr)rrrrTr_r`rar6r6r7rs   zTarFile.addfilec"CsH|dkr|j}|dkrtjjd}|dkry tt}Wntk rNYnBXddl}|jddd}||j |WdQRX|jdddd}|ry t |}Wn&t k rt d|d dYnX||_|St rtjdttStSt|trtd|St|r|Syt |St k rBt d|d dYnXdS)NZ PYTHON_TARFILE_EXTRACTION_FILTERr#)Z interpolationZcomment_prefixesrr)Zfallbackzfilter z not foundz4The default behavior of tarfile extraction has been z$changed to disallow common exploits z(including CVE-2007-4559). z1By default, absolute/parent paths are disallowed z and some mode bits are cleared. z/See https://access.redhat.com/articles/7004769 zfor more details.z#String names are not supported for z2TarFile.extraction_filter. Use a function such as ztarfile.data_filter directly.)rzXThe default behavior of tarfile extraction has been changed to disallow common exploits zsThe default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). zThe default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). By default, absolute/parent paths are disallowed zThe default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). By default, absolute/parent paths are disallowed and some mode bits are cleared. zThe default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). By default, absolute/parent paths are disallowed and some mode bits are cleared. See https://access.redhat.com/articles/7004769 aThe default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). By default, absolute/parent paths are disallowed and some mode bits are cleared. See https://access.redhat.com/articles/7004769 for more details.zUString names are not supported for TarFile.extraction_filter. Use a function such as zrString names are not supported for TarFile.extraction_filter. Use a function such as tarfile.data_filter directly.)extraction_filterr|environr4r_CONFIG_FILENAMEFileNotFoundError configparserZ ConfigParserZ read_file_NAMED_FILTERSrr._RH_SAFER_DEFAULTrcrdRuntimeWarningrrr)r+ TypeErrorcallable)rrrfilerZconfr6r6r7_get_filter_functionsR       zTarFile._get_filter_function.) numeric_ownerrc"Csg}|j|}|dkr|}xT|D]L}|j|||\}} |dkr@q |jrR|j| |j|||j ||dq W|jddddx$|D]} yy|| |}Wn4tk r} z|j| t| wWYdd} ~ XnX|dkr|j| dwt j j ||j } yt j | } Wn$tk r.|j|dwYnXtj| jsL|j|dw|j|| |d |j|| |j|| Wqtk r} z|j| WYdd} ~ XqXqWdS) N) set_attrsrfilter_functioncSs|jS)N)r)rr6r6r7 sz$TarFile.extractall..T)rreversezexcluded by filterZmissingznot a directory)r)r_get_extract_tarinforr _extract_onesort_FILTER_ERRORS_log_no_directory_fixupreprr|r%rrrrrfrrchownutimechmodr _handle_nonfatal_error)rr%rrrZ directoriesrrr unfilteredexcdirpathrrr6r6r7 extractallsP       zTarFile.extractallcCs|jdd|j|fdS)Nr$z(tarfile: Not fixing up directory %r (%s))rr)rrreasonr6r6r7r4 szTarFile._log_no_directory_fixuprc Cs8|j|}|j|||\}}|dk r4|j||||dS)N)rrr) rrr%rrrrrrr6r6r7extract8 s  zTarFile.extractcCst|tr|j|}n|}d}y|||}WnZttfk r\}z|j|WYdd}~Xn,tk r}z|j|WYdd}~XnX|dkr|jdd|j dS|j rt j |}t j j||j|_||fS)Nr$ztarfile: Excluded %r)NN)r)r+rrr_handle_fatal_errorr rrrrr r|r%rrr)rrrr%rfilteredrr6r6r7rL s"   zTarFile._get_extract_tarinfocCs|jdy&|j|tjj||j||||dWnVtk r\}z|j|WYdd}~Xn,tk r}z|j |WYdd}~XnXdS)Nry)rrrextraction_root) r_extract_memberr|r%rrrrr r)rrr%rrrrr6r6r7rj s  zTarFile._extract_onecCs"|jdkrn|jdd|dS)Nr#z tarfile: %s)rr)rrr6r6r7r~ s zTarFile._handle_nonfatal_errorcCsn|jdkrn\t|trP|jdkr6|jdd|jqj|jdd|j|jfn|jddt|j|fdS)Nrr#z tarfile: %sztarfile: %s %rztarfile: %s %s)rr)rfilenamerstrerrorrrq)rrr6r6r7r s   zTarFile._handle_fatal_errorcCs|jdt|tr |j|}n|}|js6|jtkrB|j||S|jsR|j rzt|j t rht dq~|j |j|SndSdS)Nryz'cannot extract (sym)link as file object)rr)r+rrrrY fileobjectrrrrr extractfile_find_link_target)rrrr6r6r7r s      zTarFile.extractfile)rrcCs\|jd}|jdtj}tjj|}|r@tjj| r@tj||jsP|j rj|j dd|j |j fn|j d|j |j r|j||n|jr|j||n~|jr|j||nh|js|jr|j||nJ|js|j r|j||||dn&|jtkr|j||n |j|||rX|j||||j sX|j|||j||dS)Nrr#z%s -> %s)rr)rJrr|rr%rrmakedirsrrrrrrmakefilermakedirr|makefiforyrzmakedevmakelink_with_filterrrY makeunknownrrr)rr targetpathrrrrZ upperdirsr6r6r7r s:        zTarFile._extract_memberc Cs@y&|jdkrtj|n tj|dWntk r:YnXdS)Ni)rhr|mkdirFileExistsError)rrrr6r6r7r s   zTarFile.makedircCs|j}|j|j|j}t|df}|jdk rrx,|jD]"\}}|j|t|||t|q6W|j|j|j nt|||jt|WdQRXdS)Nr) rrrrrrrXrr'truncate)rrrsourcer_targetrr'r6r6r7r s      zTarFile.makefilecCs"|j|||jdd|jdS)Nr#z9tarfile: Unknown file type %r, extracted as regular file.)rrr)rrrr6r6r7r s zTarFile.makeunknowncCs"ttdrtj|ntddS)Nmkfifozfifo not supported by system)rr|r r )rrrr6r6r7r s  zTarFile.makefifocCsnttd sttd r td|j}|dkr2d}|jrF|tjO}n |tjO}tj||tj |j |j dS)Nmknodrz'special devices not supported by systemi) rr|r rhrzrfS_IFBLKS_IFCHRrrrr)rrrrhr6r6r7r s  zTarFile.makedevcCs|j||ddS)N)r)rrrr6r6r7makelink( szTarFile.makelinkc $Cs&d}yT|jr6tjj|r$tj|tj|j|dStjj|jrVtj |j|dSWnt k rpd}YnXy|j |}Wn$t k r|rt dnYnX|dkr|}nR|dkrt dy|||}Wn2tk r}zt||j|WYdd}~XnX|dk r"|j||||ddS)NFTz%unable to resolve link inside archivez6makelink_with_filter: if filter_function is not None, z%extraction_root must also not be None)rrz[makelink_with_filter: if filter_function is not None, extraction_root must also not be None)rr|r%lexistsunlinksymlinkrrrlinksymlink_exceptionrrr rrrr) rrrrrZkeyerror_to_extracterrorrrcauser6r6r7r+ sB      zTarFile.makelink_with_filtercCsttdrtjdkr|j}|j}|sytrB|jrBtj|jd}Wntk rXYnXyt rv|j rvt j |j d}Wntk rYnX|dkrd}|dkrd}y4|j rttdrtj |||ntj|||Wntk rtdYnXdS) Ngeteuidrr$r#lchownzcould not change ownerr9r9)rr|rr*r)rr,Zgetgrnamrrr+getpwnamrrrrr )rrrrgur6r6r7r] s0  z TarFile.chownc CsL|jdkrdSttdrHytj||jWntk rFtdYnXdS)Nrzcould not change mode)rhrr|rrr )rrrr6r6r7r~ s  z TarFile.chmodc CsV|j}|dkrdSttds dSytj|||fWntk rPtdYnXdS)Nrz"could not change modification time)r(rr|rrr )rrrr(r6r6r7r s z TarFile.utimecCs|jd|jdk r$|j}d|_|S|j|jjkrZ|jj|jd|jjdsZtdd}xby|jj |}WnHt k r}z2|j r|j dd|j|f|jt 7_wbWYdd}~Xntk r,}zN|j r|j dd|j|f|jt 7_wbn|jdkrtt|WYdd}~Xntk rT|jdkrPtdYnjtk r}z|jdkr~tt|WYdd}~Xn0tk r}ztt|WYdd}~XnXPqbW|dk r|jj|nd|_|S) NZrar#zunexpected end of datar$z0x%X: %srz empty fileT)rrrrrrrZrrrSrvrrrrHr+rtrurwrrr)rmrrr6r6r7r\ sL        z TarFile.nextc Cs|j}d}|dk rHy|j|}Wntk r:d}YnX|d|}|rXtjj|}xLt|D]@}|r||j|jkrbd}qb|rtjj|j}n|j}||krb|SqbW|rt|dS)NFT) rindexr.r|r%rreversedrr) rrr normalizerZskippingrr member_namer6r6r7r s,    zTarFile._getmembercCs"x|j}|dkrPqWd|_dS)NT)r\r)rrr6r6r7r s z TarFile._loadcCs:|jrtd|jj|dk r6|j|kr6td|jdS)Nz %s is closedzbad operation for mode %r)rrrrqrh)rrhr6r6r7r szTarFile._checkcCs`|jr.djtdtjj|j|jf}d}n |j}|}|j||dd}|dkr\t d||S)NrT)rr zlinkname %r not found) rrrr|r%rrrrr)rrrlimitrr6r6r7r s  zTarFile._find_link_targetccs|jr|jEdHdSd}|jdk r:|j}|d7}|VxN|t|jkrV|j|}n"|jst|j}|sxd|_dSndS|d7}|VqzFilter for extraction)metavarchoicesr.z-lz--list zShow listing of a tarfile)r/r.z-ez --extract+ zExtract tarfile into target dir)nargsr/r.z-cz--createzCreate tarfile from sourcesz-tz--testzTest if a tarfile is validr#z&--filter is only valid for extraction ry)rz{!r} is a tar archive.z{!r} is not a tar archive. zr:*)rr$)r%rrz{!r} file is extracted.z+{!r} file is extracted into {!r} directory.rrr)z.gzz.tgzz.xzz.txzz.bz2z.tbzz.tbz2z.tb2zw:rzz{!r} file created.)r1r3)r5r6)argparseArgumentParser add_argumentrZadd_mutually_exclusive_group parse_argsrrexitZtestrrrrormr$rrPrjrr0r|curdirZ format_helprZcreatepopr%splitextr)r7r*parserrbargsr\rZtfr<r&Ztar_namerlZextZ compressionsZtar_modeZ tar_files file_namer6r6r7main` s                  rB__main__)r%r&r'r(r)r*r+r,)T)sversion __author__Z__date__Z __cvsid__ __credits__builtinsrrrmr|rrWrfrrSr rercrrrrNotImplementedErrorrr NameError__all__rrr1rrrrrrr3rrGrxrwr5r6r r{ZCONTTYPEr!r rHr-r/rVr rrrrYrurKrrrer*rFrsrr getfilesystemencodingr8r=rKrQrUrXrgrp Exceptionrr rrr r rtrurvrHrwrxrobjectrrBufferedReaderrrrrrrrrrrrrrrr compiler`rrrrBrqr6r6r6r7 s$         wh   D h b macpath.cpython-36.pyc000064400000013013152462730460010616 0ustar003 \S @s2dZdZdZdZdZdZdZdZdZddl Z ddl Tddl Z ddl Td d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(g Z d)d*Z d+d Zd,d Zd-d Zd.d Zd/dZe jje_d0d Zd1dZd2dZd3d4Zd5dZd6dZd7dZd8dZGd9d:d:eZd;dZdZ!dS)?z7Pathname and path-related operations for the Macintosh.:z::. NzDev:Null)*normcaseisabsjoin splitdrivesplitsplitextbasenamedirname commonprefixgetsizegetmtimegetatimegetctimeislinkexistslexistsisdirisfile expanduser expandvarsnormpathabspathcurdirpardirseppathsepdefpathaltsepextsepdevnullrealpathsupports_unicode_filenamescCst|trdSdSdS)N:r) isinstancebytes)pathr*/usr/lib64/python3.6/macpath.py _get_colons r,cCs(t|ttfs tdj|jj|jS)Nz2normcase() argument must be str or bytes, not '{}')r'r(str TypeErrorformat __class____name__lower)r)r*r*r+r#s cCs t|}||ko|dd|kS)zReturn true if a path is absolute. On the Mac, relative paths begin with a colon, but as a special case, paths with no colons at all are also relative. Anything else is absolute (the string up to the first colon is the volume name).N)r,)scolonr*r*r+r*sc Gsyt|}|}|s"|dd|xl|D]d}| s:t|r@|}q(|dd|kr\|dd}||krl||}|dd|kr||}||}q(W|Stttfk rtjd|f|YnXdS)Nrr3r)r,rr.AttributeError BytesWarning genericpath_check_arg_types)r4pr5r)tr*r*r+r5s(   cCst|}||kr |dd|fSd}x0tt|D] }|||d|kr2|d}q2W|d|d||d}}|r||kr||}||fS)zSplit a pathname into two parts: the directory leading up to the final bit, and the basename (the filename, without colons, in that directory). The result (s, t) is such that join(s, t) yields the original argument.Nrr3)r,rangelen)r4r5colir)filer*r*r+r Ls  cCs.t|trtj|dtdStj|tttSdS)Nr&.)r'r(r9 _splitextr!rr")r;r*r*r+r \s cCs|dd|fS)a@Split a pathname into a drive specification and the rest of the path. Useful on DOS/Windows/NT; on the Mac, the drive is always empty (don't use the volume name -- it doesn't have the same syntactic and semantic oddities as DOS drive letters, such as there being a separate current directory per drive).Nrr*)r;r*r*r+r cscCs t|dS)Nr)r )r4r*r*r+r oscCs t|dS)Nr3)r )r4r*r*r+r pscCs*t|s dSt|}t|dko(|d S)NFr3)rr r>)r4 componentsr*r*r+ismountrsrFc Cs*yddl}|jj|ddSdSdS)z6Return true if the pathname refers to a symbolic link.rNrDF) Carbon.FileFileZResolveAliasFile)r4Carbonr*r*r+rxs c Cs(ytj|}Wntk r"dSXdS)zCTest whether a path exists. Returns True for broken symbolic linksFT)oslstatOSError)r)str*r*r+rs cCs|S)zEDummy to retain interface-compatibility with other operating systems.r*)r)r*r*r+rscCs|S)zEDummy to retain interface-compatibility with other operating systems.r*)r)r*r*r+rsc@seZdZdZdS) norm_errorzPath cannot be normalizedN)r1 __module__ __qualname____doc__r*r*r*r+rNsrNcCst|}||kr||S|j|}d}x`|t|dkr|| r|||dr||dkrr||d|d=|d}qtdq(|d}q(W|j|}|dd|krt|dkr||t|kr|dd}|S)zLNormalize a pathname. Will return the same result for equivalent paths.r3z+Cannot use :: immediately after volume nameNrDr6r6)r,r r>rNr)r4r5compsr@r*r*r+rs      , cCs6t|s.t|trtj}ntj}t||}t|S)zReturn an absolute path.)rr'r(rJgetcwdbgetcwdrr)r)cwdr*r*r+rs    cCst|}y ddl}Wntk r(|SX|s2|St|}|j|}|d|}xR|ddD]B}t||}y|jj|ddj}Wq^|jj k rYq^Xq^W|S)Nrr3) rrG ImportErrorr,r rrHZFSResolveAliasFileZ as_pathnameError)r)rIr5rEcr*r*r+r$s"     T)"rQrrr"rrr r!r#rJstatr9__all__r,rrrr r rCr r r rFrrrr ExceptionrNrrr$r%r*r*r*r+sL         stringprep.cpython-36.pyc000064400000023460152462730460011405 0ustar003 \u2@sdZddlmZejdkstddZedddd d d d d dddg eeddZ ddZ dddddddddddd d!d"d#d$d%d&d'd(dd)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;dd?d@dAdBdCdDd=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdEdFdGdHdIdJdKdLdMdNdOdPdQdNddRdSdTdUdVdSdWddXdYdZdd[d\d]d^d_d`dadbd_dcdddedfdgdhdhdhdididjdkdldmdndodododpdqdrdsdsdtdddudvdwdxd&dydzd{d|d}d~ddddddddddddddd}ddddddddddddddddddddddddddddddddddddddddddddtdddydudvddhdidddjdwdkddmdndoddddddddsddtdddydudvddhdidddjdwdkddmdndoddddddddsddtdddydudvddhdidddjdwdkddmdndoddddddddsddddyddddkddmdnddddddddsddtdddydudvddhdidddjdwdkddmdndoddddddddsddtdydudvddddjdwdkddmdndddddddddtdydudvddidddjdwddddddddddtdddydudvddhdidddjdwdkddmdndoddddddddsddtdddydudvddhdidddjdwdkddmdndoddddddddsddtdddydudvddhdidddjdwdkddmdndoddddddddsddtdddydudvddhdidddjdwdkddmdndoddddddddsddtdddydudvddhdidddjdwdkddmdndoddddddddsddtdddydudvddhdidddjdwdkddmdndoddddddddsdd dxdd)ddd!dd'dddddd&d(d!ddd"d%dddddd dxdd)ddd!dd'dddddd&d(d!ddd"d%dddddd dxdd)ddd!dd'dddddd&d(d!ddd"d%dddddd dxdd)ddd!dd'dddddd&d(d!ddd"d%dddddd dxdd)ddd!dd'dddddd&d(d!ddd"d%dddddːZ dd̈́Z ddτZ ddфZddӄZddՄZddׄZedddd ddddgeedd݃eedd߃eeddeeddZddZddZddZddZddZeeddZddZeeddZddZeddddgeeddeedd߃ZddZedgeeddZddZddZ ddZ!dS(zLibrary that exposes various tables found in the StringPrep RFC 3454. There are two kinds of tables: sets, for which a member test is provided, and mappings, for which a mapping function is provided. ) ucd_3_2_0z3.2.0cCsBtj|dkrdSt|}d|ko,dknr6dS|d@dkS)NZCnFii)rr) unicodedatacategoryord)codecr "/usr/lib64/python3.6/stringprep.py in_table_a1 s r iOii i i i i i i` iiicCs t|tkS)N)rb1_set)rr r r in_table_b1sruμZssui̇uʼnsuǰuιu ιuΐuΰuσuβuθuυuύuϋuφuπuκuρuεuեւuẖuẗuẘuẙuaʾuṡuὐuὒuὔuὖuἀιuἁιuἂιuἃιuἄιuἅιuἆιuἇιuἠιuἡιuἢιuἣιuἤιuἥιuἦιuἧιuὠιuὡιuὢιuὣιuὤιuὥιuὦιuὧιuὰιuαιuάιuᾶuᾶιuὴιuηιuήιuῆuῆιuῒuῖuῗuῢuῤuῦuῧuὼιuωιuώιuῶuῶιZrsr u°cuɛu°fhilnnopqrZsmZtelZtmzbefmuγdZhpaZauZovZpaZnauμaZmaZkaZkbZmbZgbZpfZnfuμfhzZkhzZmhzZghzZthzZkpaZmpaZgpaZpvZnvuμvZmvZkvZpwZnwuμwZmwkwukωumωZbquc∕kgzco.ZdbZgyZhpZkkZkmZphZppmZprZsvwbZffZfiZflZffiZfflstuմնuմեuմիuվնuմխagjkotuvwxyuαuδuζuηuλuνuξuοuτuχuψuω(i0iIiiiEiziiiiiiiiiiiiiiiiiiiiiiPiRiTiViiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i!i!i!i !i !i !i !i!i!i!i!i!i!i!i!i!i!i !i!!i"!i$!i(!i,!i-!i0!i1!i3!i>!i?!iE!iq3is3iu3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3iiiiiiiiiiiiiiiiiiiiii i i i i iiiiiiiiiiiii4i5i6i7i8i9i:i;i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMihiiijikiliminioipiqirisitiuiviwixiyizi{i|i}i~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i i iiiiiiiiiiiiiii8i9i;i<i=i>i@iAiBiCiDiFiJiKiLiMiNiOiPiliminioipiqirisitiuiviwixiyizi{i|i}i~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i i i i iiiiiiiiiiiiiiiiiii i!i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUipiqirisitiuiviwixiyizi{i|i}i~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4iGiViWiXiYiZi[i\i]i^i_i`iaibicidieifigihiiijikiliminiiiiiiiiiiiiiiiiiiiiiiiiiiicCs"tjt|}|dk r|S|jS)N) b3_exceptionsgetrlower)rrr r r map_table_b3sr3cCsHt|}tjd|}djdd|D}tjd|}||kr@|S|SdS)NZNFKCcSsg|] }t|qSr )r3).0Zchr r r sz map_table_b2..)r3rZ normalizejoin)r#ZalrZblr r r r map_table_b2s  r8cCs|dkS)N r )rr r r in_table_c11sr:cCstj|dko|dkS)NZsr9)rr)rr r r in_table_c12sr<cCstj|dkS)Nr;)rr)rr r r in_table_c11_c12sr=cCst|dkotj|dkS)NCc)rrr)rr r r in_table_c21sr@iiii( i) id ij ip iiisi{cCs.t|}|dkrdStj|dkr&dS|tkS)Nr>Fr?T)rrr c22_specials)rr r r r in_table_c22s rBcCstj|dkpt|tkS)Nr?)rrrrA)rr r r in_table_c21_c22srCcCstj|dkS)NZCo)rr)rr r r in_table_c3srDcCs0t|}|dkrdS|dkr dSt|d@dkS)NiFiT)rFrE)r)rr r r r in_table_c4s rGcCstj|dkS)NZCs)rr)rr r r in_table_c5srHicCs t|tkS)N)rc6_set)rr r r in_table_c6srJi/i/cCs t|tkS)N)rc7_set)rr r r in_table_c7srLi@iAi i i* i/ cCs t|tkS)N)rc8_set)rr r r in_table_c8srNii icCs t|tkS)N)rc9_set)rr r r in_table_c9srPcCstj|dkS)NRAL)rQrR)r bidirectional)rr r r in_table_d1 srTcCstj|dkS)NL)rrS)rr r r in_table_d2srVN)"__doc__rrZunidata_versionAssertionErrorr setlistrangerrr0r3r8r:r<r=r@rArBrCrDrGrHrIrJrKrLrMrNrOrPrTrVr r r r s| ,  P,  compileall.cpython-36.opt-2.pyc000064400000013776152462730460012302 0ustar003 \]/@sddlZddlZddlZddlZddlZddlmZdddgZdddZ dd dZ dd dZ dd dZ ddZ edkree ZejedS)N)partial compile_dir compile_file compile_path ccs |dkrt|tjrtj|}|s0tdj|ytj|}Wn.tk rl|dkrdtdj|g}YnX|jx|D]}|dkrq|tj j ||}|dk rtj j ||}nd}tj j |s|Vq||dkr||tj kr||tj kr|tj j |r|tj j| r|t|||d|dEdHq|WdS)NzListing {!r}...zCan't list {!r} __pycache__r)ddir maxlevelsquiet) isinstanceosPathLikefspathprintformatlistdirOSErrorsortpathjoinisdircurdirpardirislink _walk_dir)dirr r r namesnamefullnamedfiler""/usr/lib64/python3.6/compileall.pyrs0    rFr c Csd} |dk rP|dkrtdn2|dkrPyddlm} Wntk rNd}YnXt||||d} d} |dk r|dkr| dk r|pd}| |d0} | jtt||||||d| } t| dd } WdQRXn&x$| D]}t|||||||sd } qW| S) Nrz%workers must be greater or equal to 0r )ProcessPoolExecutor)r r r T)Z max_workers)r forcerxr legacyoptimize)defaultF) ValueErrorZconcurrent.futuresr$ ImportErrorrmaprrmin)rr r r%r&r r'r(workersr$filessuccessZexecutorZresultsfiler"r"r#r2s6     cCsd}|dkr"t|tjr"tj|}tjj|}|dk rFtjj||} nd} |dk rd|j|} | rd|Stjj|r|r|d} nB|dkr|dkr|nd} t j j || d} n t j j |} tjj | } |dd|dd}}|d kr|sXyTt tj|j}tjd t j j|}t| d }|jd }WdQRX||kr>|SWntk rVYnX|sltd j|ytj|| | d|d}Wntjk r}zdd}|dkr|S|rtdj|n tddd|jjtjjdd}|j tjj}t|WYdd}~Xn~t!t"tfk rv}zLd}|dkr2|S|rHtdj|n tdddt|j#j$d|WYdd}~XnX|dkrd}|S)NTrcrr ) optimizationz.pyz<4slrbzCompiling {!r}...)r(Fz*** Error compiling {!r}...z*** )endbackslashreplace)errors:r<)%r rrrrbasenamersearchisfile importlibutilcache_from_sourcedirnameintstatst_mtimestructZpack MAGIC_NUMBERopenreadrrr py_compilecompilePyCompileErrormsgencodesysstdoutencodingdecode SyntaxError UnicodeError __class____name__)r r r%r&r r'r(r0rr!ZmocfileoptZ cache_dirheadtailmtimeZexpectZchandleZactualokerrrNer"r"r#rbsx                  $ c CsXd}xNtjD]D}| s |tjkr6|r6|dkrPtdq |oNt||d||||d}q W|S)NTrzSkipping current directory)r r'r()rPrrrrr)Z skip_curdirr r%r r'r(r0rr"r"r#rs    c Cszddl}|jdd}|jddddddd |jd td d d |jddddd|jdddddd|jddddd|jdddddd|jd d!d"dd#d|jd$d%d&d'd(|jd)d*d+d,d-|jd.d/d0td1d2|j}|j}|jrddl}|j|j|_|j dk r|j }n|j }|j ryJ|j d3kr4t j nt|j $}x|D]}|j|jqFWWdQRXWn2tk r|jd4krtd5j|j d6SX|jdk r|jpd|_d7}y|r4xj|D]b} tjj| rt| |j|j|j|j|js*d6}n*t| ||j|j|j|j|j|jd8sd6}qW|St|j|j|jd9SWn*tk rt|jd4krptd:d6SXd7S);Nrz1Utilities to support installing Python libraries.)Z descriptionz-lZ store_constrr z!don't recurse into subdirectories)actionZconstr)desthelpz-r recursionzhcontrol the maximum recursion level. if `-l` and `-r` options are specified, then `-r` takes precedence.)typerarbz-f store_truer%z/force rebuild even if timestamps are up to date)r`rarbz-qcountr zIoutput only error messages; -qq will suppress the error messages as well.)r`rar)rbz-br'z0use legacy (pre-PEP3147) compiled file locationsz-dZDESTDIRr zdirectory to prepend to file paths for use in compile-time tracebacks and in runtime tracebacks in cases where the source file is unavailable)metavarrar)rbz-xZREGEXPr&zskip files matching the regular expression; the regexp is searched for in the full path of each file considered for compilationz-iZFILEflistzzadd all the files and directories listed in FILE to the list considered for compilation; if "-", names are read from stdin)rgrarb compile_destzFILE|DIR*zrzero or more file and directory names to compile; if no arguments given, defaults to the equivalent of -l sys.path)rgnargsrbz-jz --workersr zRun compileall concurrently)r)rdrb-rzError reading file list {}FT)r.)r'r%r z [interrupted]) argparseArgumentParser add_argumentrD parse_argsrir&rerLrcr rhrPstdinrIappendstriprr rrr.rrr?rr r%r'rrKeyboardInterrupt) rmparserargsZ compile_destsrqr fliner0rar"r"r#mains~             "        rz__main__)Nrr)rNFNrFr|r r|)NFNrFr|r|)r rFrFr|)rrPimportlib.utilr@rKrG functoolsr__all__rrrrrzrWrDZ exit_statusexitr"r"r"r# s"    / R [ macpath.cpython-36.opt-1.pyc000064400000013013152462730460011555 0ustar003 \S @s2dZdZdZdZdZdZdZdZdZddl Z ddl Tddl Z ddl Td d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(g Z d)d*Z d+d Zd,d Zd-d Zd.d Zd/dZe jje_d0d Zd1dZd2dZd3d4Zd5dZd6dZd7dZd8dZGd9d:d:eZd;dZdZ!dS)?z7Pathname and path-related operations for the Macintosh.:z::. NzDev:Null)*normcaseisabsjoin splitdrivesplitsplitextbasenamedirname commonprefixgetsizegetmtimegetatimegetctimeislinkexistslexistsisdirisfile expanduser expandvarsnormpathabspathcurdirpardirseppathsepdefpathaltsepextsepdevnullrealpathsupports_unicode_filenamescCst|trdSdSdS)N:r) isinstancebytes)pathr*/usr/lib64/python3.6/macpath.py _get_colons r,cCs(t|ttfs tdj|jj|jS)Nz2normcase() argument must be str or bytes, not '{}')r'r(str TypeErrorformat __class____name__lower)r)r*r*r+r#s cCs t|}||ko|dd|kS)zReturn true if a path is absolute. On the Mac, relative paths begin with a colon, but as a special case, paths with no colons at all are also relative. Anything else is absolute (the string up to the first colon is the volume name).N)r,)scolonr*r*r+r*sc Gsyt|}|}|s"|dd|xl|D]d}| s:t|r@|}q(|dd|kr\|dd}||krl||}|dd|kr||}||}q(W|Stttfk rtjd|f|YnXdS)Nrr3r)r,rr.AttributeError BytesWarning genericpath_check_arg_types)r4pr5r)tr*r*r+r5s(   cCst|}||kr |dd|fSd}x0tt|D] }|||d|kr2|d}q2W|d|d||d}}|r||kr||}||fS)zSplit a pathname into two parts: the directory leading up to the final bit, and the basename (the filename, without colons, in that directory). The result (s, t) is such that join(s, t) yields the original argument.Nrr3)r,rangelen)r4r5colir)filer*r*r+r Ls  cCs.t|trtj|dtdStj|tttSdS)Nr&.)r'r(r9 _splitextr!rr")r;r*r*r+r \s cCs|dd|fS)a@Split a pathname into a drive specification and the rest of the path. Useful on DOS/Windows/NT; on the Mac, the drive is always empty (don't use the volume name -- it doesn't have the same syntactic and semantic oddities as DOS drive letters, such as there being a separate current directory per drive).Nrr*)r;r*r*r+r cscCs t|dS)Nr)r )r4r*r*r+r oscCs t|dS)Nr3)r )r4r*r*r+r pscCs*t|s dSt|}t|dko(|d S)NFr3)rr r>)r4 componentsr*r*r+ismountrsrFc Cs*yddl}|jj|ddSdSdS)z6Return true if the pathname refers to a symbolic link.rNrDF) Carbon.FileFileZResolveAliasFile)r4Carbonr*r*r+rxs c Cs(ytj|}Wntk r"dSXdS)zCTest whether a path exists. Returns True for broken symbolic linksFT)oslstatOSError)r)str*r*r+rs cCs|S)zEDummy to retain interface-compatibility with other operating systems.r*)r)r*r*r+rscCs|S)zEDummy to retain interface-compatibility with other operating systems.r*)r)r*r*r+rsc@seZdZdZdS) norm_errorzPath cannot be normalizedN)r1 __module__ __qualname____doc__r*r*r*r+rNsrNcCst|}||kr||S|j|}d}x`|t|dkr|| r|||dr||dkrr||d|d=|d}qtdq(|d}q(W|j|}|dd|krt|dkr||t|kr|dd}|S)zLNormalize a pathname. Will return the same result for equivalent paths.r3z+Cannot use :: immediately after volume nameNrDr6r6)r,r r>rNr)r4r5compsr@r*r*r+rs      , cCs6t|s.t|trtj}ntj}t||}t|S)zReturn an absolute path.)rr'r(rJgetcwdbgetcwdrr)r)cwdr*r*r+rs    cCst|}y ddl}Wntk r(|SX|s2|St|}|j|}|d|}xR|ddD]B}t||}y|jj|ddj}Wq^|jj k rYq^Xq^W|S)Nrr3) rrG ImportErrorr,r rrHZFSResolveAliasFileZ as_pathnameError)r)rIr5rEcr*r*r+r$s"     T)"rQrrr"rrr r!r#rJstatr9__all__r,rrrr r rCr r r rFrrrr ExceptionrNrrr$r%r*r*r*r+sL         gettext.cpython-36.opt-2.pyc000064400000032304152462730460011631 0ustar003 \T@sddlZddlZddlZddlZddlZddlZddlZddlmZddddddd d d d d ddddddgZ ej j ej ddZ ejdejejBZddZddZdOZd(d)eed*DZd+d,d-d.ZdQd/d0Zd1d2Zd3d4Zd5d6ZGd7ddZGd8ddeZdRd:dZiZdSd;dZdTdd Z$dVd?d Z%dWd@d Z&dAd Z'dBdZ(dCd Z)dDdZ*dEdZ+dFdZ,dGdZ-dHdZ.eZ/dS)XN)ENOENTNullTranslationsGNUTranslationsCatalogfind translationinstall textdomainbindtextdomainbind_textdomain_codesetdgettext dngettextgettextlgettext ldgettext ldngettext lngettextngettextZsharelocalea (?P[ \t]+) | # spaces and horizontal tabs (?P[0-9]+\b) | # decimal integer (?Pn\b) | # only n is allowed (?P[()]) | (?P[-*/%+?:]|[>, # <=, >=, ==, !=, &&, ||, # ? : # unary and bitwise ops # not allowed (?P\w+|.) # invalid token ccsTxHtjt|D]8}|j}|dkr"q|j|}|dkr@td||VqWdVdS)NZ WHITESPACESZINVALIDz invalid token in plural form: %s)refinditer_token_pattern lastgroupgroup ValueError)pluralZmoZkindvaluer/usr/lib64/python3.6/gettext.py _tokenizeTs   r cCs|rtd|StdSdS)Nz#unexpected token in plural form: %szunexpected end of plural form)r)rrrr_error_s r!||&&==!=<><=>=+-*/%cCs i|]\}}|D] }||qqSrr).0iZopsoprrr msr2orandz//)z||z&&r-c Csd}t|}x|dkr(|d7}t|}qW|dkr\t|\}}d||f}|dkrtdnP|dkrrd ||f}n:yt|d }Wntk rt|dYnXd ||f}t|}d }xh|tkr t|}||krP|dkr|dkrd|}tj||}t||d\} }d||| f}|}qW||ko6dknrFd|}|dkr|dkrt|d\} }|dkrzt|t|\} }d| || f}|dkrd|}||fS)Nr!znot (z%s(%s))z%unbalanced parenthesis in plural formnz%s%s z%s%ddz(%s)r3z%s %s %s?r:z%s if %s else %s)r<r=)r<r=)next_parserintr! _binary_ops _c2py_opsget) tokensZpriorityresultnexttoksubrjr0r1rightZif_trueZif_falserrrrApsP           rAc Cs:y t|}Wn(tk r4td|jjfdYnX|S)Nz'Plural value must be an integer, got %s)round TypeError __class____name__)r9r0rrr_as_ints  rPc Cst|dkrtdy~tt|\}}|r2t|d}x>|D]6}|dkrb|d7}|dkrrtdq<|dkr<|d8}qt|D]\}}!t |!||||f<qWnt |||t ||<| d7} | d7} qWdS)NnamercSs t|dkS)Nr3)rB)r9rrrUsz(GNUTranslations._parse..z4Iz>IIzBad magic numberzBad version number zFile is corrupt r?r3 z content-typezcharset=z plural-forms;zplural=ascii)structunpackgetattr_catalogrreadrSLE_MAGICBE_MAGICOSErrorrVERSIONSstrr]splitdecodestriplowerrfrgrX enumerate)"rjrkrfilenameZcatalogZbufZbuflenmagicrZmsgcountZ masteridxZtransidxZiiZ major_versionZ minor_versionr0ZmlenZmoffZmendZtlenZtoffZtendmsgrtZlastkZb_itemitemkvrrvrrrsxrrrrANsr                     zGNUTranslations._parsecCsRt}|jj||}||kr2|jr.|jj|S|}|jrD|j|jS|jtjS)N) objectrrErirrhrprrq)rjromissingrtrrrrs  zGNUTranslations.lgettextc Csvy|j||j|f}Wn<tk rT|jr>|jj|||S|dkrL|}n|}YnX|jrh|j|jS|jtjS)Nr3) rrKeyErrorrirrhrprrq)rjrrrsr9rtrrrrs  zGNUTranslations.lngettextcCs6t}|jj||}||kr2|jr.|jj|S|S|S)N)rrrErir)rjrorrtrrrrs zGNUTranslations.gettextc CsZy|j||j|f}Wn<tk rT|jr>|jj|||S|dkrL|}n|}YnX|S)Nr3)rrrrir)rjrrrsr9rtrrrrs zGNUTranslations.ngettextN)rr3) rOr~rrrrrrArrrrrrrrrBsT  Fc Cs|dkr t}|dkrTg}x(dD] }tjj|}|r|jd}PqWd|krT|jdg}x0|D](}x"t|D]}||krl|j|qlWq^W|rg} nd} xL|D]D}|dkrPtjj||dd|} tjj | r|r| j| q| SqW| S) NLANGUAGELC_ALL LC_MESSAGESLANGr?Cz%s.mo)rrrr) _default_localedirosenvironrErr^repathjoinexists) domain localedir languagesallZenvarrdZnelangsZlangZnelangrGmofilerrrrs8        c Cs|dkr t}t|||dd}|s6|r*tSttd|d}x|D]|}|tjj|f} tj | } | dkrt |d} tj | || } WdQRXt j | } |r| j ||dkr| }q@|j| q@W|S)NT)rz$No translation file found for domainrb)rrrrrrrabspath _translationsrEopen setdefaultcopyrxrm) rrrZclass_rnrcZmofilesrGrkeytrkrrrrs*      cCst||d|d}|j|dS)NT)rnrc)rr)rrrcr}rrrrrsZmessagescCs|dk r |atS)N)_current_domain)rrrrr 'scCs|dk r|t|<tj|tS)N) _localedirsrEr)rrrrrr .scCs|dk r|t|<tj|S)N)_localecodesetsrE)rrcrrrr 5sc Cs@y t|tj|dtj|d}Wntk r4|SX|j|S)N)rc)rrrErrr)rrorrrrr <s c CsRtj|}yt|tj|d|d}Wn"tk rF|j|pBtjSX|j|S)N)rc) rrErrrrprrqr)rrorcrrrrrDs  c CsTy t|tj|dtj|d}Wn$tk rD|dkr<|S|SYnX|j|||S)N)rcr3)rrrErrr)rrrrsr9rrrrr Ls c Cshtj|}yt|tj|d|d}Wn4tk rX|dkrB|}n|}|j|pTtjSX|j|||S)N)rcr3) rrErrrrprrqr)rrrrsr9rcrrtrrrrWs cCs tt|S)N)r r)rorrrrcscCs tt|S)N)rr)rorrrrfscCstt|||S)N)r r)rrrsr9rrrriscCstt|||S)N)rr)rrrsr9rrrrlsr"r#r$r%r&r'r(r)r*r+r,r-r.)rrrrrr)r)NNF)NNNFN)NNN)N)N)N)0rriorrrsyserrnor__all__rr base_prefixrcompileVERBOSEDOTALLrr r!rCrrDrArPrXrerrrrrrrrrr r r r rr rrrrrrrrrr1s\8         1$*K &       _threading_local.cpython-36.opt-1.pyc000064400000014433152462730460013425 0ustar003 \.@s^dZddlmZddlmZdgZGdddZeddZGd ddZdd l m Z m Z d S) a% Thread-local objects. (Note that this module provides a Python version of the threading.local class. Depending on the version of Python you're using, there may be a faster one available. You should always import the `local` class from `threading`.) Thread-local objects support the management of thread-local data. If you have data that you want to be local to a thread, simply create a thread-local object and use its attributes: >>> mydata = local() >>> mydata.number = 42 >>> mydata.number 42 You can also access the local-object's dictionary: >>> mydata.__dict__ {'number': 42} >>> mydata.__dict__.setdefault('widgets', []) [] >>> mydata.widgets [] What's important about thread-local objects is that their data are local to a thread. If we access the data in a different thread: >>> log = [] >>> def f(): ... items = sorted(mydata.__dict__.items()) ... log.append(items) ... mydata.number = 11 ... log.append(mydata.number) >>> import threading >>> thread = threading.Thread(target=f) >>> thread.start() >>> thread.join() >>> log [[], 11] we get different data. Furthermore, changes made in the other thread don't affect data seen in this thread: >>> mydata.number 42 Of course, values you get from a local object, including a __dict__ attribute, are for whatever thread was current at the time the attribute was read. For that reason, you generally don't want to save these values across threads, as they apply only to the thread they came from. You can create custom local objects by subclassing the local class: >>> class MyLocal(local): ... number = 2 ... def __init__(self, **kw): ... self.__dict__.update(kw) ... def squared(self): ... return self.number ** 2 This can be useful to support default values, methods and initialization. Note that if you define an __init__ method, it will be called each time the local object is used in a separate thread. This is necessary to initialize each thread's dictionary. Now if we create a local object: >>> mydata = MyLocal(color='red') Now we have a default number: >>> mydata.number 2 an initial color: >>> mydata.color 'red' >>> del mydata.color And a method that operates on the data: >>> mydata.squared() 4 As before, we can access the data in a separate thread: >>> log = [] >>> thread = threading.Thread(target=f) >>> thread.start() >>> thread.join() >>> log [[('color', 'red')], 11] without affecting this thread's data: >>> mydata.number 2 >>> mydata.color Traceback (most recent call last): ... AttributeError: 'MyLocal' object has no attribute 'color' Note that subclasses can define slots, but they are not thread local. They are shared across threads: >>> class MyLocal(local): ... __slots__ = 'number' >>> mydata = MyLocal() >>> mydata.number = 42 >>> mydata.color = 'red' So, the separate thread: >>> thread = threading.Thread(target=f) >>> thread.start() >>> thread.join() affects what we see: >>> mydata.number 11 >>> del mydata )ref)contextmanagerlocalc@s,eZdZdZdZddZd d Zd d Zd S) _localimplz#A class managing thread-local dictskeydicts localargs locallock __weakref__cCsdtt||_i|_dS)Nz_threading_local._localimpl.)stridrr)selfr(/usr/lib64/python3.6/_threading_local.py__init__sz_localimpl.__init__cCst}|jt|dS)zPReturn the dict for the current thread. Raises KeyError if none defined.)current_threadrr )r threadrrrget_dictsz_localimpl.get_dictcshi}|j}t}t|}|ffdd }|ffdd }t||t|||j|<|f|j|<|S)z8Create a new dict for the current thread, and return it.cs}|dk r|j|=dS)N)__dict__)_rr)wrthreadrr local_deletedsz-_localimpl.create_dict..local_deletedcs}|dk r|jj|}dS)N)rpop)ridtrdct)wrlocalrrthread_deletedsz._localimpl.create_dict..thread_deleted)rrr rrr)r Z localdictrrrrrr)rrr create_dicts   z_localimpl.create_dictN)rrrr r )__name__ __module__ __qualname____doc__ __slots__rrrrrrrrs rccsvtj|d}y |j}Wn2tk rJ|j}|j\}}|j||YnX|jtj|d|dVWdQRXdS)N _local__implr) object__getattribute__rKeyErrorrrrr __setattr__)r implrargskwrrr_patchs   r,c@s0eZdZd ZddZddZddZd d Zd S) rr$rcOsX|s|r|jtjkrtdtj|}t}||f|_t|_tj|d||j |S)Nz*Initialization arguments are not supportedr$) rr% TypeError__new__rrRLockr r(r)clsr*r+r r)rrrr.s  z local.__new__c Cs t|tj||SQRXdS)N)r,r%r&)r namerrrr&s zlocal.__getattribute__c Cs:|dkrtd|jjt|tj|||SQRXdS)Nrz+%r object attribute '__dict__' is read-only)AttributeError __class__rr,r%r()r r1valuerrrr(s   zlocal.__setattr__c Cs8|dkrtd|jjt|tj||SQRXdS)Nrz+%r object attribute '__dict__' is read-only)r2r3rr,r% __delattr__)r r1rrrr5s   zlocal.__delattr__N)r$r)rr r!r#r.r&r(r5rrrrrs )rr/N) r"weakrefr contextlibr__all__rr,rZ threadingrr/rrrrs   , &cgitb.cpython-36.opt-1.pyc000064400000023542152462730460011240 0ustar003 \.@sdZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddZ gZ ddZ ddZd d Zd d Zd dZdddZdddZGdddZejZdddZdS)aMore comprehensive traceback formatting for Python scripts. To enable this module, do: import cgitb; cgitb.enable() at the top of your script. The optional arguments to enable() are: display - if true, tracebacks are displayed in the web browser logdir - if set, tracebacks are written to files in this directory context - number of lines of source code to show for each stack frame format - 'text' or 'html' controls the output format By default, tracebacks are displayed but not saved, the context is 5 lines and the output format is 'html' (for backwards compatibility with the original use of this module) Alternatively, if you have caught an exception and want cgitb to display it for you, call cgitb.handler(). The optional argument to handler() is a 3-item tuple (etype, evalue, etb) just like the value of sys.exc_info(). The default handler displays output as HTML. NcCsdS)zAReturn a string that resets the CGI and browser to a known state.a' --> --> rrr/usr/lib64/python3.6/cgitb.pyreset#srcCs|rd|dSdSdS)Nzzr)textrrrsmall.s rcCs|rd|dSdSdS)Nzz rr)rrrrstrong4s rcCs|rd|dSdSdS)Nzzrr)rrrrgrey:s r cCs||krd||fS||jkr,d|j|fSd|jkr~|jd}t|tikrf||kr~d||fSnt||r~dt||fSdtfS)z9Find the value for a given name in the given environment.localglobal __builtins__builtinN) f_globalstypehasattrgetattr __UNDEF__)nameframelocalsbuiltinsrrrlookup@s     rcCsgdddtf\}}}}}xtj|D]\}} } } } |tjkr>P|tjkr| tjkr|dkr|tk rt|| t}|j|| ||fqt | ||\} }|j| | |fn"| dkr||d7}|}nd\}}| }q$W|S)zEScan one logical line of Python and look up values of variables used.Nr.)Nr) rtokenizegenerate_tokensNEWLINENAMEkeywordkwlistrappendr)readerrrvarsZ lasttokenparentprefixvalueZttypetokenstartendlinewhererrrscanvarsPs"   r*c" s|\}}}t|tr|j}dtjjddtj}tjtj}dt j j dt t j j t|dd|d|d }d td d d }g} tj||} xJ| D]@\} } } }}rtjjdt j j f}nd}tj| \}}}}d}| dkr2dt t j j | tj||||ddd}i| gffdd }t|| |}dd||fg}|dk r| |}x|D]}td d tt|t|d }|krd|t j j|f}|jd|n&d|t j j|f}|jdt||d7}q~Wig}}x|D]\}}} ||kr0qd||<| tk r|d-kr^d!|t |}n*|d"krrt |}n|t |jd#d.}|jd$|t j j| fn|j|d%qW|jdttd&j|| jd'd(j|qWd)t t j j t|t j j t|fg}!xNt|D]B}|ddd*kr:q t j jt ||} |!jd+||| fq W|dj| dj|!d,t j j djt!j"|||S)/z9Return a nice HTML document describing a given traceback.zPython rz: zz%sz#ffffffz#6622aaz
z

A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.

zz r+z  z
%s?rzin cSsdtjj|S)N=)pydochtmlrepr)r$rrrszhtml..) formatvaluec s4d|d<ztj|dS|dd7<XdS)Nr) linecachegetline)lnum)file highlightrrr s zhtml..readerz+%s%s %sz Nz=>%s%sz&%sz  %s%sz%sr3r r z %s r rz %s = %sz undefinedz, zF %s
 z

%s: %s_z
%s%s = %sz )r r )# isinstancer__name__sysversionsplit executabletimectimer.r/Zheadingrescapestrrinspectgetinnerframesospathabspath getargvaluesformatargvaluesr*lenZ preformatrr rr0joindirr tracebackformat_exception)"einfocontextetypeevalueetbpyverdateheadindentframesrecordsrr6funclinesindexlinkargsvarargsvarkwrcallr r!rowsir(numdonedumprr)r$ exceptionr)r7r8rr/es|  0       $        r/c s|\}}}t|tr|j}dtjjddtj}tjtj}dt |||fd}g}t j ||} x| D]\} } } } }rt j jpdt j| \}}}}d}| dkrd| t j||||d d d }i| gffd d }t|| |}d|fg}|dk rL| |}x0| D](}d|}|j||j|d7}q Wig}}x|D]\}}}||krtq\d||<|tk r|dkrd|}n|dkr||jdd}|jd|tjj|fn|j|dq\W|jdj||jddj|qrWdt |t |fg}x8t|D],}tjjt||}|jdd ||fq.W|dj|dj|ddjtj|||S)!z:Return a plain text document describing a given traceback.zPython rz: z %s %s %s z A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred. r,rzin cSsdtjj|S)Nr-)r.rr0)r$rrrr1sztext..)r2c s4d|d<ztj|dS|dd7<XdS)Nr3r)r4r5)r6)r7r8rrr s ztext..readerz %s %sNz%5d r3r zglobal r rz%s = %sz undefinedr9z %s z%s: %sz %s%s = %s zc The above is a description of an error in a Python program. Here is the original traceback: %s r;z )r<rr=r>r?r@rArBrCrErFrGrHrIrJrKrLr*rrstriprr.rr0rNrOrrPrQ) rRrSrTrUrVrWrXrYr[r\rr6r]r^r_rarbrcrrdr r!rerfr(rgrhrirr)r$rjr)r7r8rrs^            rc@s,eZdZdZd ddZdd Zd d d ZdS)Hookz?A hook to replace sys.excepthook that shows tracebacks in HTML.r3Nr+r/cCs(||_||_||_|ptj|_||_dS)N)displaylogdirrSr>stdoutr7format)selfrorprSr7rrrrr__init__s  z Hook.__init__cCs|j|||fdS)N)handle)rsrTrUrVrrr__call__ sz Hook.__call__c Csz|p tj}|jdkr$|jjt|jdkr2tp4t}d}y|||j}Wn dj t j |}d}YnX|j r|rt jj|}|jjd|dq|jj|dn |jjd|jdk rZd d g|jdk}tj||jd \}}y.tj|d }|j|WdQRXd |} Wnd|} YnX|jdkrJ|jjd| n|jj| dy|jjWn YnXdS)Nr/FrTz

z
r9z*

A problem occurred in a Python script. z.txtz.html)suffixrOwz*%s contains the description of this error.z*Tried to save traceback to %s, but failed.z

%s

)r>exc_inforrr7writerr/rrSrNrPrQror.rDrptempfileZmkstemprHfdopenflush) rsinfoZ formatterZplaindocrwfdrIr7msgrrrrus@        z Hook.handle)r3Nr+Nr/)N)r= __module__ __qualname____doc__rtrvrurrrrrns  rnr3cCst||||dt_dS)aInstall an exception handler that formats tracebacks as HTML. The optional argument 'display' can be set to 0 to suppress sending the traceback to the browser, and 'logdir' can be set to a directory to cause tracebacks to be written to files there.)rorprSrrN)rnr> excepthook)rorprSrrrrrenable8sr)r+)r+)r3Nr+r/)rrFrr4rHr.r>r{rBrrPrrrrr rr*r/rrnruZhandlerrrrrrs,  Z A7cgi.cpython-36.opt-1.pyc000064400000067720152462730460010720 0ustar003 ic@sdZdZddlmZmZmZddlmZddlZddl Z ddl Z ddl m Z ddlmZddlmZddlZddlZddlZd d d d d ddddddddddgZdadaddZddZddZdd Zeadade jdddfd!d Zd5d"d Z d6d#d Z!d$dZ"d%d&Z#d'dZ$Gd(d d Z%Gd)d d Z&e jfd*dZ'd7d+dZ(e jfd,dZ)d-dZ*d.dZ+d/dZ,d0dZ-d8d1dZ.d2d3Z/e0d4kre'dS)9zSupport module for CGI (Common Gateway Interface) scripts. This module defines a number of utilities for use by CGI scripts written in Python. z2.6)StringIOBytesIO TextIOWrapper)MappingN) FeedParser)Message)warnMiniFieldStorage FieldStorageparseparse_qs parse_qslparse_multipart parse_headertestprint_exception print_environ print_formprint_directoryprint_argumentsprint_environ_usageescapec GsHtr.t r.yttdaWntk r,YnXts8tantat|dS)aWrite a log message, if there is a log file. Even though this function is called initlog(), you should always use log(); log is a variable that is set either to initlog (initially), to dolog (once the log file has been opened), or to nolog (when logging is disabled). The first argument is a format string; the remaining arguments (if any) are arguments to the % operator, so e.g. log("%s: %s", "a", "b") will write "a: b" to the log file, followed by a newline. If the global logfp is not None, it should be a file object to which log data is written. If the global logfp is None, the global logfile may be a string giving a filename to open, in append mode. This file should be world writable!!! If the file can't be opened, logging is silently disabled (since there is no safe place where we could send an error message). aN)logfilelogfpopenOSErrornologlogdolog)allargsr"/usr/lib64/python3.6/cgi.pyinitlog:s r$cGstj||ddS)z=Write a log message to the log file. See initlog() for docs. N)rwrite)Zfmtargsr"r"r#r ]sr cGsdS)z9Dummy function, assigned to log when logging is disabled.Nr")r!r"r"r#rasrcCsdatrtjdatadS)zClose the log file.rN)rrcloser$rr"r"r"r#closeloges r)c Cs\|dkrtj}t|dr |j}nd}t|tr4|j}d|krDd|d<|ddkr t|d\}}|dkrxt|||d S|d krt |d }t r|t krt d |j |j |} nd } d|kr| r| d} | |d} n*tjddr| r| d} | tjd} | |d<nr aStore a sequence of fields, reading multipart/form-data. This class provides naming, typing, files stored on disk, and more. At the top level, it is accessible like a dictionary, whose keys are the field names. (Note: None can occur as a field name.) The items are either a Python list (if there's multiple values) or another FieldStorage or MiniFieldStorage object. If it's a single object, it has the following attributes: name: the field name, if specified; otherwise None filename: the filename, if specified; otherwise None; this is the client side filename, *not* the file name on which it is stored (that's a temporary file you don't deal with) value: the value as a *string*; for file uploads, this transparently reads the file every time you request the value and returns *bytes* file: the file(-like) object from which you can read the data *as bytes* ; None if the data is stored a simple string type: the content-type, or None if not specified type_options: dictionary of options specified on the content-type line disposition: content-disposition, or None if not specified disposition_options: dictionary of corresponding options headers: a dictionary(-like) object (sometimes email.message.Message or a subclass thereof) containing *all* headers The class is subclassable, mostly for the purpose of overriding the make_file() method, which is called internally to come up with a file open for reading and writing. This makes it possible to override the default choice of storing all files in a temporary directory and unlinking them as soon as they have been opened. NrJrzutf-8rlc  CsRd} ||_||_| |_| |_d|kr0|dj} d|_| dksF| dkrd|krX|d} ntjddrrtjd} nd} | jt j d} t | }|dkrd d i}|dkri}| d krd |d <d |kr|d |d <d|kr|d|_d |kr|d |d<nt |t tfstd||_|dkr*tjj|_nencodelocalegetpreferredencodingrr7rr TypeErrorrZr5r8r@rr6r*errorsrXrzrt outerboundary bytes_readlimitrr}r~rMrx _binary_filer| innerboundaryr9r;r:lengthryr{doneread_urlencoded read_multi read_single)rqr@rZrrArBrCrr*rrr/methodrGZcdisprErDZclenr"r"r#rrs/                         zFieldStorage.__init__c Cs(y|jjWntk r"YnXdS)N)r{r(AttributeError)rqr"r"r#__del__;szFieldStorage.__del__cCs|S)Nr")rqr"r"r# __enter__AszFieldStorage.__enter__cGs|jjdS)N)r{r()rqr'r"r"r#__exit__DszFieldStorage.__exit__cCsd|j|j|jfS)z"Return a printable representation.zFieldStorage(%r, %r, %r))rMrxrp)rqr"r"r#rsGszFieldStorage.__repr__cCs t|jS)N)iterkeys)rqr"r"r#__iter__LszFieldStorage.__iter__cCsT|dkrt||jr:|jjd|jj}|jjdn|jdk rL|j}nd}|S)Nrpr)rr{seekr<ry)rqrMrpr"r"r# __getattr__Os   zFieldStorage.__getattr__cCsb|jdkrtdg}x"|jD]}|j|kr|j|qW|sFt|t|dkrZ|dS|SdS)zDictionary style indexing.Nz not indexabler3r)ryrrMrUKeyErrorrb)rqr]founditemr"r"r# __getitem__\s    zFieldStorage.__getitem__cCs8||kr0||}t|tr(dd|DS|jSn|SdS)z8Dictionary style get() method, including 'value' lookup.cSsg|] }|jqSr")rp).0xr"r"r# osz)FieldStorage.getvalue..N)r7ryrp)rqr]defaultrpr"r"r#getvaluejs  zFieldStorage.getvaluecCs4||kr,||}t|tr$|djS|jSn|SdS)z! Return the first value received.rN)r7ryrp)rqr]rrpr"r"r#getfirstus   zFieldStorage.getfirstcCs:||kr2||}t|tr(dd|DS|jgSngSdS)z Return list of received values.cSsg|] }|jqSr")rp)rrr"r"r#rsz(FieldStorage.getlist..N)r7ryrp)rqr]rpr"r"r#getlists   zFieldStorage.getlistcCs*|jdkrtdttdd|jDS)zDictionary style keys() method.Nz not indexablecss|] }|jVqdS)N)rM)rrr"r"r# sz$FieldStorage.keys..)ryrset)rqr"r"r#rs zFieldStorage.keyscs*|jdkrtdtfdd|jDS)z%Dictionary style __contains__ method.Nz not indexablec3s|]}|jkVqdS)N)rM)rr)r]r"r#rsz,FieldStorage.__contains__..)ryrany)rqr]r")r]r# __contains__s zFieldStorage.__contains__cCs t|jS)z Dictionary style len(x) support.)rbr)rqr"r"r#__len__szFieldStorage.__len__cCs|jdkrtdt|jS)NzCannot be converted to bool.)ryrbool)rqr"r"r#__bool__s zFieldStorage.__bool__c Cs|jj|j}t|ts0td|jt|jf|j|j |j }|j rT|d|j 7}t j j||j|j|j |j |j|jd}dd|D|_|jdS)z+Internal: read data in query string format.z%s should return bytes, got %sr2)r*rrr/cSsg|]\}}t||qSr")r )rr]rpr"r"r#rsz0FieldStorage.read_urlencoded..N)r@r<rr7rXr;rzrtr=r*rrr?r r rBrCrr/ry skip_lines)rqrGqueryr"r"r#rs  zFieldStorage.read_urlencodedc CsB|j}t|std|fg|_|jrftjj|j|j|j |j |j |j |j d}|jjdd|D|jpp|j}|jj}t|tstd|jt|jf|jt|7_x6|jd|jkr|r|jj}|jt|7_qW|j }|dk r|t|j8}x,t} d} x$|jj} | | 7} | jsPqW| sBP|jt| 7_| j| j|j |j | j} d | kr| d =||j| |||||j|j|j |j ||j d } |dk r|d 8}| jr|t| j8}|d krtd |j| j7_|jj| | j s.|j|j!ko&d knr Pq W|j"dS)z/Internal: read a part that is itself multipart.z&Invalid boundary in multipart form: %r)r*rrr/css|]\}}t||VqdS)N)r )rr]rpr"r"r#rsz*FieldStorage.read_multi..z%s should return bytes, got %ss--NrJzcontent-length)r/r3rzMax number of fields exceeded)#rrPr;ryrr?r r rBrCr*rrr/extendFieldStorageClass __class__r@rRr7rXrzrtrrbrcrZfeedr=r(rrUrrr)rqrArBrCZibrklassZ first_linerparserZhdr_textrYrZpartr"r"r#rsj               (zFieldStorage.read_multicCs4|jdkr|j|jn|j|jjddS)zInternal: read an atomic part.rN)r read_binaryr read_linesr{r)rqr"r"r#rs   zFieldStorage.read_singleicCs|j|_|j}|dkrxx|dkr|jjt||j}t|tsXt d|jt |j f|j t |7_ |svd|_P|jj||t |}qWdS)zInternal: read binary data.rz%s should return bytes, got %sr3NrN) make_filer{rr@r<minbufsizer7rXr;rzrtrrbrr&)rqZtodorYr"r"r#rs    zFieldStorage.read_binarycCs@|jrt|_|_nt|_|_|jr4|jn|jdS)z0Internal: read lines until EOF or outerboundary.N)rrr{_FieldStorage__filerrread_lines_to_outerboundaryread_lines_to_eof)rqr"r"r#rs  zFieldStorage.read_linescCsv|jdk rF|jjt|dkrF|j|_|jj}|jj|d|_|jrZ|jj|n|jj|j|j |j dS)z line is always bytes, not stringNi) rtellrbrr{rr&rr=r*r)rqr\rYr"r"r#Z__writes    zFieldStorage.__writecCs>x8|jjd}|jt|7_|s,d|_P|j|qWdS)zInternal: read lines until EOF.r3NirN)r@rRrrbr_FieldStorage__write)rqr\r"r"r#r,s zFieldStorage.read_lines_to_eofc Cs,d|j}|d}d}d}d}x||jkr.P|jjd }|jt|7_|t|7}|sdd|_P|dkrx||}d}|jdr|r|j}||krP||krd|_P|}|j drd}|d d}d}nJ|j d rd }|d d}d}n*|j drd}|d d}d }nd}d }|j ||q"Wd S)zInternal: read lines until outerboundary. Data is read as bytes: boundaries and line ends must be converted to bytes for comparisons. s--rJTrr3r s NrHrLFirNrOrNrN) rrr@rRrrbrrSrTendswithr) rq next_boundary last_boundaryZdelimlast_line_lfendZ_readr\ strippedlineZodelimr"r"r#r6sP          z(FieldStorage.read_lines_to_outerboundarycCs|j s|jrdSd|j}|d}d}xh|jjd}|jt|7_|sTd|_P|jdr|r|j}||krtP||krd|_P|jd}q*WdS) z5Internal: skip lines until outer boundary if defined.Ns--Tr3rrLirN)rrr@rRrrbrrc)rqrrrr\rr"r"r#rgs&  zFieldStorage.skip_linescCs&|jrtjdStjd|jddSdS)aOverridable: return a readable & writable file. The file will be used as follows: - data is written to it - seek(0) - data is read from it The file is opened in binary mode for files, in text mode for other fields This version opens a temporary file for reading and writing, and immediately deletes (unlinks) it. The trick (on Unix!) is that the file can still be used, but it can't be opened by another process, and it will automatically be deleted when it is closed or when the current process terminates. If you want a more permanent file, you derive a class which overrides this method. If you want a visible temporary file that is nevertheless automatically deleted when the script terminates, try defining a __del__ method in a derived class which unlinks the temporary files you have created. zwb+zw+r%)r*newlineN)rtempfileZ TemporaryFiler*)rqr"r"r#r}s zFieldStorage.make_file)N)Ni )!rtrurvrwosrArrrrrrsrrrrrrrrrrrrrrrrrrrrrrr"r"r"r#r ls@*"   D   1cCstdttjt_yNt}ttt|t|t dd}|fdd}td|Wnt YnXtdda y&t}ttt|t|Wnt YnXd S) zRobust test CGI script, usable as main program. Write minimal HTTP headers and dump all information provided to the script in HTML form. zContent-type: text/htmlcSs tddS)Nz,testing print_exception() -- italics?)execr"r"r"r#rfsztest..fcSs |dS)Nr")rfr"r"r#gsztest..gz9

What follows is a test, not an actual exception:

z*

Second try with a small maxlen...

2N) printr4stdoutstderrr rrrrrrr:)rAformrfrr"r"r#rs4    cCsx|dkrtj\}}}ddl}ttd|j|||j||}tdtjdj|ddtj|df~dS)Nrz+

Traceback (most recent call last):

z
%s%s
rr3rNrN) r4exc_info tracebackr format_tbformat_exception_onlyhtmlrrV)rzrptbrrryr"r"r#rs cCs`t|j}ttdtdx*|D]"}tdtj|dtj||q(WtdtdS)z#Dump the shell environment as HTML.z

Shell Environment:

z
z
z
z
N)sortedrrrr)rArr]r"r"r#rs  "cCst|j}ttd|s&tdtdxb|D]Z}tdtj|ddd||}tdtjtt|d td tjt|q4Wtd td S) z$Dump the contents of a form as HTML.z

Form Contents:

z

No form fields.z

z
: )rezzz
z
N)rrrrrreprrz)rrr]rpr"r"r#rs  cCsjttdy tj}Wn6tk rP}ztdtjt|WYdd}~XnXttj|tdS)z#Dump the current directory as HTML.z#

Current Working Directory:

zOSError:N)rrgetcwdrrrstr)pwdmsgr"r"r#rs &cCs(ttdtttjtdS)Nz

Command Line Arguments:

)rr4r>r"r"r"r#rs  cCs tddS)z9Dump a list of environment variables used by CGI as HTML.a

These environment variables could have been set:

  • AUTH_TYPE
  • CONTENT_LENGTH
  • CONTENT_TYPE
  • DATE_GMT
  • DATE_LOCAL
  • DOCUMENT_NAME
  • DOCUMENT_ROOT
  • DOCUMENT_URI
  • GATEWAY_INTERFACE
  • LAST_MODIFIED
  • PATH
  • PATH_INFO
  • PATH_TRANSLATED
  • QUERY_STRING
  • REMOTE_ADDR
  • REMOTE_HOST
  • REMOTE_IDENT
  • REMOTE_USER
  • REQUEST_METHOD
  • SCRIPT_NAME
  • SERVER_NAME
  • SERVER_PORT
  • SERVER_PROTOCOL
  • SERVER_ROOT
  • SERVER_SOFTWARE
In addition, HTTP headers sent by the server may be passed in the environment as well. Here are some common variable names:
  • HTTP_ACCEPT
  • HTTP_CONNECTION
  • HTTP_HOST
  • HTTP_PRAGMA
  • HTTP_REFERER
  • HTTP_USER_AGENT
N)rr"r"r"r#rs'cCsFtdtdd|jdd}|jdd}|jdd }|rB|jd d }|S) zDeprecated API.z1cgi.escape is deprecated, use html.escape insteadrH) stacklevelr2z&z>r_z")rrIrl)rdZquoter"r"r#r1s     cCs(ddl}t|trd}nd}|j||S)Nrs^[ -~]{0,200}[!-~]$z^[ -~]{0,200}[!-~]$)rer7rXmatch)rdrZ _vb_patternr"r"r#rP=s  rP__main__)rrN)rrN)NNNN)N)1rw __version__iorrr collectionsrr4rZ urllib.parser?Z email.parserrZ email.messagerwarningsrrrr__all__rrr$r rr)rr:rAr r r rrgrr r rrrrrrrrrPrtr"r"r"r#sb     # E  c 7'   /  uuid.cpython-36.pyc000064400000050724152462730460010161 0ustar003 i]@s dZddlZdZddddg\ZZZZeZe Z Gdd d e Z d d Z d d ZddZddZddZddZddZddZddZdZZyddlZddlZddlZdgZejjdsejdxLeD]DZyej ej!j"eZ#Wne$k rwYnXe%e#dre#j&ZPqW[ejd kr@eej'j(j)d!dd"kr@dZy ej*j+Z#WndZ#YnXe,e#d#e,e#d$dZWn YnXd%d&Z-d'd(Z.d)d*Z/da0e.eegZ1e-eeeeegZ2d+d,Z3da4d9d-d.Z5d/d0Z6d1d2Z7d3d4Z8e d5Z9e d6Z:e d7Z;e d8Z>> import uuid # make a UUID based on the host ID and current time >>> uuid.uuid1() # doctest: +SKIP UUID('a8098c1a-f86e-11da-bd1a-00112444be1e') # make a UUID using an MD5 hash of a namespace UUID and a name >>> uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org') UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e') # make a random UUID >>> uuid.uuid4() # doctest: +SKIP UUID('16fd2706-8baf-433b-82eb-8c7fada847da') # make a UUID using a SHA-1 hash of a namespace UUID and a name >>> uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org') UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d') # make a UUID from a string of hex digits (braces and hyphens ignored) >>> x = uuid.UUID('{00010203-0405-0607-0809-0a0b0c0d0e0f}') # convert a UUID to a string of hex digits in standard form >>> str(x) '00010203-0405-0607-0809-0a0b0c0d0e0f' # get the raw 16 bytes of the UUID >>> x.bytes b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f' # make a UUID from a 16-byte string >>> uuid.UUID(bytes=x.bytes) UUID('00010203-0405-0607-0809-0a0b0c0d0e0f') NzKa-Ping Yee zreserved for NCS compatibilityzspecified in RFC 4122z$reserved for Microsoft compatibilityzreserved for future definitionc@seZdZdZd7ddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZeddZeddZeddZedd Zed!d"Zed#d$Zed%d&Zed'd(Zed)d*Zed+d,Zed-d.Zed/d0Zed1d2Zed3d4Zed5d6ZdS)8UUIDaInstances of the UUID class represent UUIDs as specified in RFC 4122. UUID objects are immutable, hashable, and usable as dictionary keys. Converting a UUID to a string with str() yields something in the form '12345678-1234-1234-1234-123456789abc'. The UUID constructor accepts five possible forms: a similar string of hexadecimal digits, or a tuple of six integer fields (with 32-bit, 16-bit, 16-bit, 8-bit, 8-bit, and 48-bit values respectively) as an argument named 'fields', or a string of 16 bytes (with all the integer fields in big-endian order) as an argument named 'bytes', or a string of 16 bytes (with the first three fields in little-endian order) as an argument named 'bytes_le', or a single 128-bit integer as an argument named 'int'. UUIDs have these read-only attributes: bytes the UUID as a 16-byte string (containing the six integer fields in big-endian byte order) bytes_le the UUID as a 16-byte string (with time_low, time_mid, and time_hi_version in little-endian byte order) fields a tuple of the six integer fields of the UUID, which are also available as six individual attributes and two derived attributes: time_low the first 32 bits of the UUID time_mid the next 16 bits of the UUID time_hi_version the next 16 bits of the UUID clock_seq_hi_variant the next 8 bits of the UUID clock_seq_low the next 8 bits of the UUID node the last 48 bits of the UUID time the 60-bit timestamp clock_seq the 14-bit sequence number hex the UUID as a 32-character hexadecimal string int the UUID as a 128-bit integer urn the UUID as a URN as specified in RFC 4122 variant the UUID variant (one of the constants RESERVED_NCS, RFC_4122, RESERVED_MICROSOFT, or RESERVED_FUTURE) version the UUID version number (1 through 5, meaningful only when the variant is RFC_4122) NcCs|||||gjddkr td|dk rl|jddjdd}|jdjdd}t|d krbtd t|d }|dk rt|d krtd |d(dd)|d*d+d,|d-d.d/|dd}|dk rt|d krtdt|tst t |tj |dd}|dk r:t|dkr"td|\}}} } } } d|koFd0knsVtdd|kojd1knsztdd| kod2knstdd| kod3knstdd| kod4knstdd| kod5kns td| d>| B} |d>|d>B| d>B| d>B| B}|dk rld|ko\d d>knsltd |dk rd |kod!knstd"|d7M}|d8O}|d:M}||d&>O}||j d'<dS);amCreate a UUID from either a string of 32 hexadecimal digits, a string of 16 bytes as the 'bytes' argument, a string of 16 bytes in little-endian order as the 'bytes_le' argument, a tuple of six integers (32-bit time_low, 16-bit time_mid, 16-bit time_hi_version, 8-bit clock_seq_hi_variant, 8-bit clock_seq_low, 48-bit node) as the 'fields' argument, or a single 128-bit integer as the 'int' argument. When a string of hex digits is given, curly braces, hyphens, and a URN prefix are all optional. For example, these expressions all yield the same UUID: UUID('{12345678-1234-5678-1234-567812345678}') UUID('12345678123456781234567812345678') UUID('urn:uuid:12345678-1234-5678-1234-567812345678') UUID(bytes='\x12\x34\x56\x78'*4) UUID(bytes_le='\x78\x56\x34\x12\x34\x12\x78\x56' + '\x12\x34\x56\x78\x12\x34\x56\x78') UUID(fields=(0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x567812345678)) UUID(int=0x12345678123456781234567812345678) Exactly one of 'hex', 'bytes', 'bytes_le', 'fields', or 'int' must be given. The 'version' argument is optional; if given, the resulting UUID will have its variant and version set according to RFC 4122, overriding the given 'hex', 'bytes', 'bytes_le', 'fields', or 'int'. NzGone of the hex, bytes, bytes_le, fields, or int arguments must be givenzurn:zuuid:z{}- z$badly formed hexadecimal UUID stringz bytes_le is not a 16-char stringzbytes is not a 16-char stringbig) byteorderzfields is not a 6-tuplerz*field 1 out of range (need a 32-bit value)z*field 2 out of range (need a 16-bit value)z*field 3 out of range (need a 16-bit value)z*field 4 out of range (need an 8-bit value)z*field 5 out of range (need an 8-bit value)0z*field 6 out of range (need a 48-bit value)`P@z*int is out of range (need a 128-bit value)zillegal version numberiiiLintrrrrrliirll l lll) count TypeErrorreplacestriplen ValueErrorint_ isinstancebytes_AssertionErrorrepr from_bytes__dict__)selfhexbytesbytes_lefieldsrversiontime_lowtime_midtime_hi_versionclock_seq_hi_variant clock_seq_lownode clock_seqr3/usr/lib64/python3.6/uuid.py__init__js\   6    $    z UUID.__init__cCst|tr|j|jkStS)N)r rrNotImplemented)r&otherr3r3r4__eq__s  z UUID.__eq__cCst|tr|j|jkStS)N)r rrr6)r&r7r3r3r4__lt__s  z UUID.__lt__cCst|tr|j|jkStS)N)r rrr6)r&r7r3r3r4__gt__s  z UUID.__gt__cCst|tr|j|jkStS)N)r rrr6)r&r7r3r3r4__le__s  z UUID.__le__cCst|tr|j|jkStS)N)r rrr6)r&r7r3r3r4__ge__s  z UUID.__ge__cCs t|jS)N)hashr)r&r3r3r4__hash__sz UUID.__hash__cCs|jS)N)r)r&r3r3r4__int__sz UUID.__int__cCsd|jjt|fS)Nz%s(%r)) __class____name__str)r&r3r3r4__repr__sz UUID.__repr__cCs tddS)NzUUID objects are immutable)r)r&namevaluer3r3r4 __setattr__szUUID.__setattr__cCsDd|j}d|dd|dd|dd|dd|ddfS)Nz%032xz%s-%s-%s-%s-%sr r)r)r&r'r3r3r4__str__s z UUID.__str__cCs|jjddS)Nrr )rto_bytes)r&r3r3r4r(sz UUID.bytescCs<|j}|ddd|ddd |d d d |ddS) Nrrr r rrrrrrrr)r()r&r(r3r3r4r)s(z UUID.bytes_lecCs|j|j|j|j|j|jfS)N)r,r-r.r/r0r1)r&r3r3r4r*s z UUID.fieldscCs |jd?S)Nr)r)r&r3r3r4r,sz UUID.time_lowcCs|jd?d@S)Nri)r)r&r3r3r4r-sz UUID.time_midcCs|jd?d@S)Nri)r)r&r3r3r4r.szUUID.time_hi_versioncCs|jd?d@S)N8)r)r&r3r3r4r/szUUID.clock_seq_hi_variantcCs|jd?d@S)Nr rL)r)r&r3r3r4r0szUUID.clock_seq_lowcCs|jd@d>|jd>B|jBS)Nir r)r.r-r,)r&r3r3r4time sz UUID.timecCs|jd@d>|jBS)N?r )r/r0)r&r3r3r4r2s zUUID.clock_seqcCs |jd@S)Nl)r)r&r3r3r4r1sz UUID.nodecCs d|jS)Nz%032x)r)r&r3r3r4r'szUUID.hexcCs dt|S)Nz urn:uuid:)rB)r&r3r3r4urnszUUID.urncCs2|jd@stS|jd@stS|jd@s*tStSdS)Nir i@i lll)r RESERVED_NCSRFC_4122RESERVED_MICROSOFTRESERVED_FUTURE)r&r3r3r4variant s   z UUID.variantcCs |jtkrt|jd?d@SdS)Nr)rTrQr)r&r3r3r4r++s z UUID.version)NNNNNN)rA __module__ __qualname____doc__r5r8r9r:r;r<r>r?rCrFrIpropertyr(r)r*r,r-r.r/r0rMr2r1r'rOrTr+r3r3r3r4r:s8. O              rc Gsddl}ddl}ddl}|j|}|dkrP|jjd}|j||d}|dkrPdSt|j}d|d<|j|f||j |j |d}|S) Nr/sbin /usr/sbin)pathCLC_ALL)stdoutstderrenv)rZr[) osshutil subprocessZwhichpathsepjoindictenvironPopenPIPEZDEVNULL) commandargsrbrcrd executabler\raprocr3r3r4_popen1s    roc Csyt|f|j}|sdS|x|jD]z}|jjj}xdtt|D]T}|||krLy*|||}t|jddd} | r| SWqLt t fk rYqLXqLWq*WWdQRXWnt k rYnXdS)N:r) rosplitr_lowerrstriprangerrrr IndexErrorOSError) rkrlZhw_identifiersZ get_indexrnlinewordsiwordmacr3r3r4 _find_macDs$   r}cCs0d }x&d D]}td||d d }|r |Sq Wd S)z5Get the hardware address on Unix by running ifconfig.hwaddretheraddress:lladdrr-a-avZifconfigcSs|dS)Nrr3)rzr3r3r4bsz#_ifconfig_getnode..N)r~rrr)rrr)r})keywordsrlr|r3r3r4_ifconfig_getnode]s  rcCs tdddgdd}|r|SdS)z/Get the hardware address on Unix by running ip.Ziplinks link/ethercSs|dS)Nrr3)rzr3r3r4risz_ip_getnode..N)r})r|r3r3r4 _ip_getnodefsrcCsddl}ddl}y|j|j}Wntk r6dSXtdd|j|gdd}|rZ|Stdd|j|gdd}|r||Stdd|jd|gd d}|r|SdS) z0Get the hardware address on Unix by running arp.rNZarpz-ancSsdS)Nrrr3)rzr3r3r4rvsz_arp_getnode..cSs|dS)Nrr3)rzr3r3r4r{sz(%s)cSs|dS)Nr3)rzr3r3r4rs)rbsocketZ gethostbynameZ gethostnamerwr}fsencode)rbrZip_addrr|r3r3r4 _arp_getnodems rcCstdddgddS)z4Get the hardware address on Unix by running lanscan.Zlanscanz-aislan0cSsdS)Nrr3)rzr3r3r4rsz"_lanscan_getnode..)r}r3r3r3r4_lanscan_getnodesrc"Csytdd}|sdS||jjjj}y|jd}Wntk rNdSXxt|jD]j}yL|jj}||}t|dkr|jddkrt |j ddd }|r|SWqXtt fk rYqXXqXWWdQRXWnt k rYnXdS) z4Get the hardware address on Unix by running netstat.Znetstatz-iaNsAddressrprrqr) ror_readlinertrrindexrrrrrrvrw)rnryrzrxr{r|r3r3r4_netstat_getnodes,   rc Cs ddl}ddl}ddl}dddg}y:ddl}|jd}|jjj|d|jd|j j dWn YnXx|D]}y$|j |j j |dd g|jd d }Wntk rwpYnX|JxB|jD]8}|jd djj} |jd| rt| jdddSqWWdQRXqpWdS)z||kodknr>tjd}t|tt|jdSddl}t|jd}t|dd}tdk r~|tkr~td}|a|dkrddl }|j d }|d @}|d ?d @}|d ?d@} |d@} |d?d@} |dkrt }t||| | | |fddS)aGenerate a UUID from a host ID, sequence number, and the current time. If 'node' is not given, getnode() is used to obtain the hardware address. If 'clock_seq' is given, it is used as the sequence number; otherwise a random 14-bit sequence number is chosen.Nr)r(rgeAdl@'Hw rlrir irLr rN)r*r+) rrrrr!rrMr_last_timestamprrr) r1r2rrMZ nanosecondsZ timestamprr,r-r.r0r/r3r3r4uuid1Ds,     rcCs<ddlm}||jt|dddj}t|dddd S) zAGenerate a UUID from the MD5 hash of a namespace UUID and a name.r)md5zutf-8F)ZusedforsecurityNrr)r(r+)hashlibrr(digestr) namespacerDrrr3r3r4uuid3gs   rcCsttjdddS)zGenerate a random UUID.rr)r(r+)rrburandomr3r3r3r4uuid4psrcCs8ddlm}||jt|dj}t|ddddS)zCGenerate a UUID from the SHA-1 hash of a namespace UUID and a name.r)sha1zutf-8Nrr)r(r+)rrr(rr)rrDrr=r3r3r4uuid5ts rz$6ba7b810-9dad-11d1-80b4-00c04fd430c8z$6ba7b811-9dad-11d1-80b4-00c04fd430c8z$6ba7b812-9dad-11d1-80b4-00c04fd430c8z$6ba7b814-9dad-11d1-80b4-00c04fd430c8)NN)=rXrb __author__rPrQrRrSrrr(r!objectrror}rrrrrrrrrrZ ctypes.utilrZ _libnamesr startswithappendZlibnameZCDLLutilZ find_librarylib ExceptionhasattrrunamereleaserrrZrpcrt4getattrrrrrrrrrrrrrZ NAMESPACE_DNSZ NAMESPACE_URLZ NAMESPACE_OIDZNAMESPACE_X500r3r3r3r4-szx "           # pickletools.cpython-36.opt-1.pyc000064400000177223152462730460012506 0ustar003 \fI@s dZddlZddlZddlZddlZddlZdddgZejZdZdZ dZ dZ dZ Gd d d e Zdd lmZddZeddeddZddZeddeddZddZedd eddZddZedd eddZdd Zed!d"ed#dZdd%d&Zed'eed(dZd)d*Zed+eed,dZd-d.Z ed/ee d0dZ!d1d2Z"ed3e e"d4dZ#d5d6Z$ed7e e$d8dZ%d9d:Z&ed;e e&ddZ'd?d@Z(edAe e(dBdZ)dCdDZ*edEe e*dFdZ+dGdHZ,edIee,dJdZ-dKdLZ.edMe e.dNdZ/dOdPZ0edQe e0dRdZ1dSdTZ2edUe e2dVdZ3dWdXZ4dYdZZ5ed[ee4d\dZ6ed]ee5d^dZ7d_d`Z8edaee8dbdZ9dcddZ:eded"e:dfdZ;ddglmdldmZ?edne e?dodZ@Gdpdqdqe ZAeAdreBdsdtZCZDeAdueBeEfdvdtZFeAdweEdxdtZGeAdyeHdzdtZIeAd{eJeKfd|dtZLZMeAd}eJd~dtZNeAdeKddtZOeAdePdddtZQeAdeRddtZSeAdeTddtZUeAdeVddtZWeAdeXddtZYeAdeXddtZZeAde ddtZ[eAdeAddtZ\eAdeAddtZ]Gddde Z^e^Z_e_dde6geFgddde_ddegeCgddde_ddegeCgddde_ddegeCgddde_dde7geCgddde_dde>geCgddde_dde@geCgddde_ddegeLgddde_dde%geLgddde_dde#geLgddde_dde)geNgddde_dde'geNgddde_dde+geNgd dde_dddgeQgddde_dddgeGgddde_dddgeGgddde_dde-geOgddde_dde/geOgd dde_dde1geOgddde_dde3geOgd dde_dde9geIgddde_dde;geIgddde_dddgeUgddde_dddeUe[geUgddde_dddeUe\e]geUgddde_ddde\e]geUgddde_dddgeSgddde_ddde\e]geSgddde_ddde[geSgddde_ddde[e[geSgddde_ddde[e[e[geSgddde_dddgeWgddde_ddde\e]geWgddde_dddeWe[e[geWgddde_dddeWe\e]geWgddde_dddgeYgd dde_dddeYe\e]geYgd dde_ddde\e]geZgd dde_dd de[ggdd de_d d de[ge[e[gdd de_dddge\gddde_ddde\e]ggddde_dde6ge[gddde_ddege[gddde_ddege[gddde_dde6ggddde_d d!eggdd"de_d#d$eggdd%de_d&d'de[ge[gd d(de_d)d*ege[gdd+de_d,d-ege[gdd.de_d/d0ege[gdd1de_d2d3e!ge[gdd4de_d5d6deOeOge[gd d7de_d8d9de[e[ge[gdd:de_d;dd?e!e\e]ge[gdd@de_dAdBde\e[e]ge[gddCde_dDdEde[e[ge[gddFde_dGdHde[e[e[ge[gd dIde_dJdKeggddLde_dMdNde[ggddOde_dPdQeggd dRde_dSdTege[gddUde_dVdWde[ge[gddXdgAZ`[_iZaiZbxzece`D]n\ZdZeeejfeak regdYeejfeaeejfedfeejhebk regdZeejhebeejhedfedeaeejf<edebeejh< qW[a[b[d[eiZixe`D]Zeeeeieejh< qW[edd\d]Zjej[jdd^d_Zkd`dZldadZmddbdZnGdcddddZodeZpdfZqepeqdgZrdhdiZsetdjk rddluZueujvdkdlZwewjxdmeujydndodpdqewjxdrdsejzeujydtdudvewjxdwdxdydzd{ewjxd|d}d eBd~dvewjxdddydd{ewjxdddddewjxdddydd{ewjxddydd{ewj{Z|e|j} resne|j~ rdndZ~e|j sewjnee|jdk r*ene|jde|jde|je~nZe|j r6indZxHe|jD]>Ze|jjejfdZe|jjedenee|jee|je~ qBWdS(ar"Executable documentation" for the pickle module. Extensive comments about the pickle protocols and pickle-machine opcodes can be found here. Some functions meant for external use: genops(pickle) Generate all the opcodes in a pickle, as (opcode, arg, position) triples. dis(pickle, out=None, memo=None, indentlevel=4) Print a symbolic disassembly of a pickle. Ndisgenopsoptimizec@seZdZdZddZdS) ArgumentDescriptornamenreaderdoccCs||_||_||_||_dS)N)r r r r)selfr r r rr#/usr/lib64/python3.6/pickletools.py__init__szArgumentDescriptor.__init__N)r r r r)__name__ __module__ __qualname__ __slots__rrrrrr s r )unpackcCs"|jd}|r|dStddS)zG >>> import io >>> read_uint1(io.BytesIO(b'\xff')) 255 rrz'not enough data in stream to read uint1N)read ValueError)fdatarrr read_uint1s ruint1zOne-byte unsigned integer.)r r r rcCs0|jd}t|dkr$td|dStddS)z >>> import io >>> read_uint2(io.BytesIO(b'\xff\x00')) 255 >>> read_uint2(io.BytesIO(b'\xff\xff')) 65535 rz>> import io >>> read_int4(io.BytesIO(b'\xff\x00\x00\x00')) 255 >>> read_int4(io.BytesIO(b'\x00\x00\x00\x80')) == -(2**31) True rz>> import io >>> read_uint4(io.BytesIO(b'\xff\x00\x00\x00')) 255 >>> read_uint4(io.BytesIO(b'\x00\x00\x00\x80')) == 2**31 True rz>> import io >>> read_uint8(io.BytesIO(b'\xff\x00\x00\x00\x00\x00\x00\x00')) 255 >>> read_uint8(io.BytesIO(b'\xff' * 8)) == 2**64-1 True z>> import io >>> read_stringnl(io.BytesIO(b"'abcd'\nefg\n")) 'abcd' >>> read_stringnl(io.BytesIO(b"\n")) Traceback (most recent call last): ... ValueError: no string quotes around b'' >>> read_stringnl(io.BytesIO(b"\n"), stripquotes=False) '' >>> read_stringnl(io.BytesIO(b"''\n")) '' >>> read_stringnl(io.BytesIO(b'"abcd"')) Traceback (most recent call last): ... ValueError: no newline found when trying to read stringnl Embedded escapes are undone in the result. >>> read_stringnl(io.BytesIO(br"'a\n\\b\x00c\td'" + b"\n'e'")) 'a\n\\b\x00c\td'  z-no newline found when trying to read stringnlNr"'z,strinq quote %r not found at both ends of %rzno string quotes around %rrascii)r*r+r-)readlineendswithr startswithcodecs escape_decodedecode)rr3 stripquotesrqrrr read_stringnl;s         r6stringnlzA newline-terminated string. This is a repr-style string, with embedded escapes, and bracketing quotes. cCs t|ddS)NF)r4)r6)rrrrread_stringnl_noescapetsr8stringnl_noescapeaA newline-terminated string. This is a str-style string, without embedded escapes, or bracketing quotes. It should consist solely of printable ASCII characters. cCsdt|t|fS)zp >>> import io >>> read_stringnl_noescape_pair(io.BytesIO(b"Queue\nEmpty\njunk")) 'Queue Empty' z%s %s)r8)rrrrread_stringnl_noescape_pairsr:stringnl_noescape_pairaA pair of newline-terminated strings. These are str-style strings, without embedded escapes, or bracketing quotes. They should consist solely of printable ASCII characters. The pair is returned as a single string, with a single blank separating the two strings. cCs@t|}|j|}t||kr(|jdStd|t|fdS)z >>> import io >>> read_string1(io.BytesIO(b"\x00")) '' >>> read_string1(io.BytesIO(b"\x03abcdef")) 'abc' zlatin-1z2expected %d bytes in a string1, but only %d remainN)rrrr3r)rr rrrr read_string1s    r<string1zA counted string. The first argument is a 1-byte unsigned int giving the number of bytes in the string, and the second argument is that many bytes. cCsTt|}|dkrtd||j|}t||kr<|jdStd|t|fdS)aP >>> import io >>> read_string4(io.BytesIO(b"\x00\x00\x00\x00abc")) '' >>> read_string4(io.BytesIO(b"\x03\x00\x00\x00abcdef")) 'abc' >>> read_string4(io.BytesIO(b"\x00\x00\x00\x03abcdef")) Traceback (most recent call last): ... ValueError: expected 50331648 bytes in a string4, but only 6 remain rzstring4 byte count < 0: %dzlatin-1z2expected %d bytes in a string4, but only %d remainN)r"rrrr3)rr rrrr read_string4s     r>string4zA counted string. The first argument is a 4-byte little-endian signed int giving the number of bytes in the string, and the second argument is that many bytes. cCs:t|}|j|}t||kr"|Std|t|fdS)z >>> import io >>> read_bytes1(io.BytesIO(b"\x00")) b'' >>> read_bytes1(io.BytesIO(b"\x03abcdef")) b'abc' z1expected %d bytes in a bytes1, but only %d remainN)rrrr)rr rrrr read_bytes1s   r@bytes1zA counted bytes string. The first argument is a 1-byte unsigned int giving the number of bytes in the string, and the second argument is that many bytes. cCs:t|}|j|}t||kr"|Std|t|fdS)z >>> import io >>> read_bytes1(io.BytesIO(b"\x00")) b'' >>> read_bytes1(io.BytesIO(b"\x03abcdef")) b'abc' z1expected %d bytes in a bytes1, but only %d remainN)rrrr)rr rrrrr@s   zA counted bytes string. The first argument is a 1-byte unsigned int giving the number of bytes, and the second argument is that many bytes. cCsPt|}|tjkrtd||j|}t||kr8|Std|t|fdS)aN >>> import io >>> read_bytes4(io.BytesIO(b"\x00\x00\x00\x00abc")) b'' >>> read_bytes4(io.BytesIO(b"\x03\x00\x00\x00abcdef")) b'abc' >>> read_bytes4(io.BytesIO(b"\x00\x00\x00\x03abcdef")) Traceback (most recent call last): ... ValueError: expected 50331648 bytes in a bytes4, but only 6 remain z#bytes4 byte count > sys.maxsize: %dz1expected %d bytes in a bytes4, but only %d remainN)r$sysmaxsizerrr)rr rrrr read_bytes4s     rDbytes4zA counted bytes string. The first argument is a 4-byte little-endian unsigned int giving the number of bytes, and the second argument is that many bytes. cCsPt|}|tjkrtd||j|}t||kr8|Std|t|fdS)a >>> import io, struct, sys >>> read_bytes8(io.BytesIO(b"\x00\x00\x00\x00\x00\x00\x00\x00abc")) b'' >>> read_bytes8(io.BytesIO(b"\x03\x00\x00\x00\x00\x00\x00\x00abcdef")) b'abc' >>> bigsize8 = struct.pack(">> read_bytes8(io.BytesIO(bigsize8 + b"abcdef")) #doctest: +ELLIPSIS Traceback (most recent call last): ... ValueError: expected ... bytes in a bytes8, but only 6 remain z#bytes8 byte count > sys.maxsize: %dz1expected %d bytes in a bytes8, but only %d remainN)r'rBrCrrr)rr rrrr read_bytes83s    rFbytes8zA counted bytes string. The first argument is an 8-byte little-endian unsigned int giving the number of bytes, and the second argument is that many bytes. cCs0|j}|jdstd|dd}t|dS)zm >>> import io >>> read_unicodestringnl(io.BytesIO(b"abc\\uabcd\njunk")) == 'abc\uabcd' True r)z4no newline found when trying to read unicodestringnlNrzraw-unicode-escaper-)r.r/rstr)rrrrrread_unicodestringnlUs   rIunicodestringnlzA newline-terminated Unicode string. This is raw-unicode-escape encoded, so consists of printable ASCII characters, and may contain embedded escape sequences. cCsBt|}|j|}t||kr*t|ddStd|t|fdS)a >>> import io >>> s = 'abcd\uabcd' >>> enc = s.encode('utf-8') >>> enc b'abcd\xea\xaf\x8d' >>> n = bytes([len(enc)]) # little-endian 1-byte length >>> t = read_unicodestring1(io.BytesIO(n + enc + b'junk')) >>> s == t True >>> read_unicodestring1(io.BytesIO(n + enc[:-1])) Traceback (most recent call last): ... ValueError: expected 7 bytes in a unicodestring1, but only 6 remain zutf-8 surrogatepassz9expected %d bytes in a unicodestring1, but only %d remainN)rrrrHr)rr rrrrread_unicodestring1os    rLunicodestring1aAA counted Unicode string. The first argument is a 1-byte little-endian signed int giving the number of bytes in the string, and the second argument-- the UTF-8 encoding of the Unicode string -- contains that many bytes. cCsXt|}|tjkrtd||j|}t||kr@t|ddStd|t|fdS)a >>> import io >>> s = 'abcd\uabcd' >>> enc = s.encode('utf-8') >>> enc b'abcd\xea\xaf\x8d' >>> n = bytes([len(enc), 0, 0, 0]) # little-endian 4-byte length >>> t = read_unicodestring4(io.BytesIO(n + enc + b'junk')) >>> s == t True >>> read_unicodestring4(io.BytesIO(n + enc[:-1])) Traceback (most recent call last): ... ValueError: expected 7 bytes in a unicodestring4, but only 6 remain z+unicodestring4 byte count > sys.maxsize: %dzutf-8rKz9expected %d bytes in a unicodestring4, but only %d remainN)r$rBrCrrrrH)rr rrrrread_unicodestring4s     rNunicodestring4aAA counted Unicode string. The first argument is a 4-byte little-endian signed int giving the number of bytes in the string, and the second argument-- the UTF-8 encoding of the Unicode string -- contains that many bytes. cCsXt|}|tjkrtd||j|}t||kr@t|ddStd|t|fdS)a >>> import io >>> s = 'abcd\uabcd' >>> enc = s.encode('utf-8') >>> enc b'abcd\xea\xaf\x8d' >>> n = bytes([len(enc)]) + b'\0' * 7 # little-endian 8-byte length >>> t = read_unicodestring8(io.BytesIO(n + enc + b'junk')) >>> s == t True >>> read_unicodestring8(io.BytesIO(n + enc[:-1])) Traceback (most recent call last): ... ValueError: expected 7 bytes in a unicodestring8, but only 6 remain z+unicodestring8 byte count > sys.maxsize: %dzutf-8rKz9expected %d bytes in a unicodestring8, but only %d remainN)r'rBrCrrrrH)rr rrrrread_unicodestring8s     rPunicodestring8aBA counted Unicode string. The first argument is an 8-byte little-endian signed int giving the number of bytes in the string, and the second argument-- the UTF-8 encoding of the Unicode string -- contains that many bytes. cCs.t|ddd}|dkrdS|dkr&dSt|S)z >>> import io >>> read_decimalnl_short(io.BytesIO(b"1234\n56")) 1234 >>> read_decimalnl_short(io.BytesIO(b"1234L\n56")) Traceback (most recent call last): ... ValueError: invalid literal for int() with base 10: b'1234L' F)r3r4s00s01T)r6int)rsrrrread_decimalnl_shorts rTcCs2t|ddd}|dddkr*|dd}t|S)z >>> import io >>> read_decimalnl_long(io.BytesIO(b"1234L\n56")) 1234 >>> read_decimalnl_long(io.BytesIO(b"123456789012345678901234L\n6")) 123456789012345678901234 F)r3r4rNLr-r-)r6rR)rrSrrrread_decimalnl_longs  rVdecimalnl_shortaA newline-terminated decimal integer literal. This never has a trailing 'L', and the integer fit in a short Python int on the box where the pickle was written -- but there's no guarantee it will fit in a short Python int on the box where the pickle is read. decimalnl_longzA newline-terminated decimal integer literal. This has a trailing 'L', and can represent integers of any size. cCst|ddd}t|S)zO >>> import io >>> read_floatnl(io.BytesIO(b"-1.25\n6")) -1.25 F)r3r4)r6float)rrSrrr read_floatnl'srZfloatnlaA newline-terminated decimal floating literal. In general this requires 17 significant digits for roundtrip identity, and pickling then unpickling infinities, NaNs, and minus zero doesn't work across boxes, or on some boxes even on itself (e.g., Windows can't read the strings it produces for infinities or NaNs). cCs0|jd}t|dkr$td|dStddS)z >>> import io, struct >>> raw = struct.pack(">d", -1.25) >>> raw b'\xbf\xf4\x00\x00\x00\x00\x00\x00' >>> read_float8(io.BytesIO(raw + b"\n")) -1.25 r&z>drz(not enough data in stream to read float8N)rrrr)rrrrr read_float8=s  r\float8aAn 8-byte binary representation of a float, big-endian. The format is unique to Python, and shared with the struct module (format string '>d') "in theory" (the struct and pickle implementations don't share the code -- they should). It's strongly related to the IEEE-754 double format, and, in normal cases, is in fact identical to the big-endian 754 double format. On other boxes the dynamic range is limited to that of a 754 double, and "add a half and chop" rounding is used to reduce the precision to 53 bits. However, even on a 754 box, infinities, NaNs, and minus zero may not be handled correctly (may not survive roundtrip pickling intact). ) decode_longcCs.t|}|j|}t||kr&tdt|S)a+ >>> import io >>> read_long1(io.BytesIO(b"\x00")) 0 >>> read_long1(io.BytesIO(b"\x02\xff\x00")) 255 >>> read_long1(io.BytesIO(b"\x02\xff\x7f")) 32767 >>> read_long1(io.BytesIO(b"\x02\x00\xff")) -256 >>> read_long1(io.BytesIO(b"\x02\x00\x80")) -32768 z'not enough data in stream to read long1)rrrrr^)rr rrrr read_long1cs   r_long1aA binary long, little-endian, using 1-byte size. This first reads one byte as an unsigned size, then reads that many bytes and interprets them as a little-endian 2's-complement long. If the size is 0, that's taken as a shortcut for the long 0L. cCsBt|}|dkrtd||j|}t||kr:tdt|S)ag >>> import io >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\xff\x00")) 255 >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\xff\x7f")) 32767 >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\x00\xff")) -256 >>> read_long4(io.BytesIO(b"\x02\x00\x00\x00\x00\x80")) -32768 >>> read_long1(io.BytesIO(b"\x00\x00\x00\x00")) 0 rzlong4 byte count < 0: %dz'not enough data in stream to read long4)r"rrrr^)rr rrrr read_long4s   ralong4aA binary representation of a long, little-endian. This first reads four bytes as a signed size (but requires the size to be >= 0), then reads that many bytes and interprets them as a little-endian 2's-complement long. If the size is 0, that's taken as a shortcut for the int 0, although LONG1 should really be used then instead (and in any case where # of bytes < 256). c@s eZdZd ZddZddZdS) StackObjectr obtypercCs.||_t|trx |D]}qW||_||_dS)N)r isinstancetuplerdr)rr rdrZ containedrrrrs   zStackObject.__init__cCs|jS)N)r )rrrr__repr__szStackObject.__repr__N)r rdr)rrrrrrgrrrrrcs  rcrRzA Python integer object.)r rdrZ int_or_boolz#A Python integer or boolean object.boolzA Python boolean object.rYzA Python float object.Z bytes_or_strz*A Python bytes or (Unicode) string object.byteszA Python bytes object.rHz!A Python (Unicode) string object.NonezThe Python None object.rfzA Python tuple object.listzA Python list object.dictzA Python dict object.setzA Python set object. frozensetzA Python frozenset object.anyzAny kind of object whatsoever.Zmarkaz'The mark' is a unique object. Opcodes that operate on a variable number of objects generally don't embed the count of objects in the opcode, or pull it off the stack. Instead the MARK opcode is used to push a special marker object on the stack, and then some other opcodes grab all the objects from the top of the stack down to (but not including) the topmost marker object. stacksliceaAn object representing a contiguous slice of the stack. This is used in conjunction with markobject, to represent all of the stack following the topmost markobject. For example, the POP_MARK opcode changes the stack from [..., markobject, stackslice] to [...] No matter how many object are on the stack after the topmost markobject, POP_MARK gets rid of all of them (including the topmost markobject too). c@seZdZd Zdd Zd S) OpcodeInfor codearg stack_before stack_afterprotorc CsJ||_||_||_x |D]}qW||_x |D]}q,W||_||_||_dS)N)r rrrsrtrurvr) rr rrrsrtrurvrxrrrrTs  zOpcodeInfo.__init__N)r rrrsrtrurvr)rrrrrrrrrrq5srqZINTIaPush an integer or bool. The argument is a newline-terminated decimal literal string. The intent may have been that this always fit in a short Python int, but INT can be generated in pickles written on a 64-bit box that require a Python long on a 32-bit box. The difference between this and LONG then is that INT skips a trailing 'L', and produces a short int whenever possible. Another difference is due to that, when bool was introduced as a distinct type in 2.3, builtin names True and False were also added to 2.2.2, mapping to ints 1 and 0. For compatibility in both directions, True gets pickled as INT + "I01\n", and False as INT + "I00\n". Leading zeroes are never produced for a genuine integer. The 2.3 (and later) unpicklers special-case these and return bool instead; earlier unpicklers ignore the leading "0" and return the int. )r rrrsrtrurvrZBININTJa1Push a four-byte signed integer. This handles the full range of Python (short) integers on a 32-bit box, directly as binary bytes (1 for the opcode and 4 for the integer). If the integer is non-negative and fits in 1 or 2 bytes, pickling via BININT1 or BININT2 saves space. ZBININT1KzPush a one-byte unsigned integer. This is a space optimization for pickling very small non-negative ints, in range(256). ZBININT2MzPush a two-byte unsigned integer. This is a space optimization for pickling small positive ints, in range(256, 2**16). Integers in range(256) can also be pickled via BININT2, but BININT1 instead saves a byte. ZLONGLaPush a long integer. The same as INT, except that the literal ends with 'L', and always unpickles to a Python long. There doesn't seem a real purpose to the trailing 'L'. Note that LONG takes time quadratic in the number of digits when unpickling (this is simply due to the nature of decimal->binary conversion). Proto 2 added linear-time (in C; still quadratic-time in Python) LONG1 and LONG4 opcodes. ZLONG1Šz|Long integer using one-byte length. A more efficient encoding of a Python long; the long1 encoding says it all.ZLONG4‹z~Long integer using found-byte length. A more efficient encoding of a Python long; the long4 encoding says it all.STRINGSaPush a Python string object. The argument is a repr-style string, with bracketing quote characters, and perhaps embedded escapes. The argument extends until the next newline character. These are usually decoded into a str instance using the encoding given to the Unpickler constructor. or the default, 'ASCII'. If the encoding given was 'bytes' however, they will be decoded as bytes object instead. Z BINSTRINGTaPush a Python string object. There are two arguments: the first is a 4-byte little-endian signed int giving the number of bytes in the string, and the second is that many bytes, which are taken literally as the string content. These are usually decoded into a str instance using the encoding given to the Unpickler constructor. or the default, 'ASCII'. If the encoding given was 'bytes' however, they will be decoded as bytes object instead. ZSHORT_BINSTRINGUaPush a Python string object. There are two arguments: the first is a 1-byte unsigned int giving the number of bytes in the string, and the second is that many bytes, which are taken literally as the string content. These are usually decoded into a str instance using the encoding given to the Unpickler constructor. or the default, 'ASCII'. If the encoding given was 'bytes' however, they will be decoded as bytes object instead. ZBINBYTESBzPush a Python bytes object. There are two arguments: the first is a 4-byte little-endian unsigned int giving the number of bytes, and the second is that many bytes, which are taken literally as the bytes content. ZSHORT_BINBYTESCzPush a Python bytes object. There are two arguments: the first is a 1-byte unsigned int giving the number of bytes, and the second is that many bytes, which are taken literally as the string content. Z BINBYTES8ŽzPush a Python bytes object. There are two arguments: the first is an 8-byte unsigned int giving the number of bytes in the string, and the second is that many bytes, which are taken literally as the string content. ZNONENzPush None on the stack.ZNEWTRUEˆzPush True onto the stack.ZNEWFALSE‰zPush False onto the stack.UNICODEVzPush a Python Unicode string object. The argument is a raw-unicode-escape encoding of a Unicode string, and so may contain embedded escape sequences. The argument extends until the next newline character. ZSHORT_BINUNICODEŒaPush a Python Unicode string object. There are two arguments: the first is a 1-byte little-endian signed int giving the number of bytes in the string. The second is that many bytes, and is the UTF-8 encoding of the Unicode string. Z BINUNICODEXaPush a Python Unicode string object. There are two arguments: the first is a 4-byte little-endian unsigned int giving the number of bytes in the string. The second is that many bytes, and is the UTF-8 encoding of the Unicode string. Z BINUNICODE8aPush a Python Unicode string object. There are two arguments: the first is an 8-byte little-endian signed int giving the number of bytes in the string. The second is that many bytes, and is the UTF-8 encoding of the Unicode string. ZFLOATFaNewline-terminated decimal float literal. The argument is repr(a_float), and in general requires 17 significant digits for roundtrip conversion to be an identity (this is so for IEEE-754 double precision values, which is what Python float maps to on most boxes). In general, FLOAT cannot be used to transport infinities, NaNs, or minus zero across boxes (or even on a single box, if the platform C library can't read the strings it produces for such things -- Windows is like that), but may do less damage than BINFLOAT on boxes with greater precision or dynamic range than IEEE-754 double. ZBINFLOATGaFloat stored in binary form, with 8 bytes of data. This generally requires less than half the space of FLOAT encoding. In general, BINFLOAT cannot be used to transport infinities, NaNs, or minus zero, raises an exception if the exponent exceeds the range of an IEEE-754 double, and retains no more than 53 bits of precision (if there are more than that, "add a half and chop" rounding is used to cut it back to 53 significant bits). Z EMPTY_LIST]zPush an empty list.ZAPPENDazAppend an object to a list. Stack before: ... pylist anyobject Stack after: ... pylist+[anyobject] although pylist is really extended in-place. ZAPPENDSezExtend a list by a slice of stack objects. Stack before: ... pylist markobject stackslice Stack after: ... pylist+stackslice although pylist is really extended in-place. ZLISTlasBuild a list out of the topmost stack slice, after markobject. All the stack entries following the topmost markobject are placed into a single Python list, which single list object replaces all of the stack from the topmost markobject onward. For example, Stack before: ... markobject 1 2 3 'abc' Stack after: ... [1, 2, 3, 'abc'] Z EMPTY_TUPLE)zPush an empty tuple.ZTUPLEtavBuild a tuple out of the topmost stack slice, after markobject. All the stack entries following the topmost markobject are placed into a single Python tuple, which single tuple object replaces all of the stack from the topmost markobject onward. For example, Stack before: ... markobject 1 2 3 'abc' Stack after: ... (1, 2, 3, 'abc') ZTUPLE1…zBuild a one-tuple out of the topmost item on the stack. This code pops one value off the stack and pushes a tuple of length 1 whose one item is that value back onto it. In other words: stack[-1] = tuple(stack[-1:]) ZTUPLE2†aBuild a two-tuple out of the top two items on the stack. This code pops two values off the stack and pushes a tuple of length 2 whose items are those values back onto it. In other words: stack[-2:] = [tuple(stack[-2:])] ZTUPLE3‡aBuild a three-tuple out of the top three items on the stack. This code pops three values off the stack and pushes a tuple of length 3 whose items are those values back onto it. In other words: stack[-3:] = [tuple(stack[-3:])] Z EMPTY_DICT}zPush an empty dict.ZDICTdaBuild a dict out of the topmost stack slice, after markobject. All the stack entries following the topmost markobject are placed into a single Python dict, which single dict object replaces all of the stack from the topmost markobject onward. The stack slice alternates key, value, key, value, .... For example, Stack before: ... markobject 1 2 3 'abc' Stack after: ... {1: 2, 3: 'abc'} ZSETITEMrSzAdd a key+value pair to an existing dict. Stack before: ... pydict key value Stack after: ... pydict where pydict has been modified via pydict[key] = value. ZSETITEMSua\Add an arbitrary number of key+value pairs to an existing dict. The slice of the stack following the topmost markobject is taken as an alternating sequence of keys and values, added to the dict immediately under the topmost markobject. Everything at and after the topmost markobject is popped, leaving the mutated dict at the top of the stack. Stack before: ... pydict markobject key_1 value_1 ... key_n value_n Stack after: ... pydict where pydict has been modified via pydict[key_i] = value_i for i in 1, 2, ..., n, and in that order. Z EMPTY_SETzPush an empty set.ZADDITEMSa$Add an arbitrary number of items to an existing set. The slice of the stack following the topmost markobject is taken as a sequence of items, added to the set immediately under the topmost markobject. Everything at and after the topmost markobject is popped, leaving the mutated set at the top of the stack. Stack before: ... pyset markobject item_1 ... item_n Stack after: ... pyset where pyset has been modified via pyset.add(item_i) = item_i for i in 1, 2, ..., n, and in that order. Z FROZENSET‘azBuild a frozenset out of the topmost slice, after markobject. All the stack entries following the topmost markobject are placed into a single Python frozenset, which single frozenset object replaces all of the stack from the topmost markobject onward. For example, Stack before: ... markobject 1 2 3 Stack after: ... frozenset({1, 2, 3}) POP0z. ZBUILDbaFinish building an object, via __setstate__ or dict update. Stack before: ... anyobject argument Stack after: ... anyobject where anyobject may have been mutated, as follows: If the object has a __setstate__ method, anyobject.__setstate__(argument) is called. Else the argument must be a dict, the object must have a __dict__, and the object is updated via anyobject.__dict__.update(argument) ZINSTiaqBuild a class instance. This is the protocol 0 version of protocol 1's OBJ opcode. INST is followed by two newline-terminated strings, giving a module and class name, just as for the GLOBAL opcode (and see GLOBAL for more details about that). self.find_class(module, name) is used to get a class object. In addition, all the objects on the stack following the topmost markobject are gathered into a tuple and popped (along with the topmost markobject), just as for the TUPLE opcode. Now it gets complicated. If all of these are true: + The argtuple is empty (markobject was at the top of the stack at the start). + The class object does not have a __getinitargs__ attribute. then we want to create an old-style class instance without invoking its __init__() method (pickle has waffled on this over the years; not calling __init__() is current wisdom). In this case, an instance of an old-style dummy class is created, and then we try to rebind its __class__ attribute to the desired class object. If this succeeds, the new instance object is pushed on the stack, and we're done. Else (the argtuple is not empty, it's not an old-style class object, or the class object does have a __getinitargs__ attribute), the code first insists that the class object have a __safe_for_unpickling__ attribute. Unlike as for the __safe_for_unpickling__ check in REDUCE, it doesn't matter whether this attribute has a true or false value, it only matters whether it exists (XXX this is a bug). If __safe_for_unpickling__ doesn't exist, UnpicklingError is raised. Else (the class object does have a __safe_for_unpickling__ attr), the class object obtained from INST's arguments is applied to the argtuple obtained from the stack, and the resulting instance object is pushed on the stack. NOTE: checks for __safe_for_unpickling__ went away in Python 2.3. NOTE: the distinction between old-style and new-style classes does not make sense in Python 3. ZOBJoaBuild a class instance. This is the protocol 1 version of protocol 0's INST opcode, and is very much like it. The major difference is that the class object is taken off the stack, allowing it to be retrieved from the memo repeatedly if several instances of the same class are created. This can be much more efficient (in both time and space) than repeatedly embedding the module and class names in INST opcodes. Unlike INST, OBJ takes no arguments from the opcode stream. Instead the class object is taken off the stack, immediately above the topmost markobject: Stack before: ... markobject classobject stackslice Stack after: ... new_instance_object As for INST, the remainder of the stack above the markobject is gathered into an argument tuple, and then the logic seems identical, except that no __safe_for_unpickling__ check is done (XXX this is a bug). See INST for the gory details. NOTE: In Python 2.3, INST and OBJ are identical except for how they get the class object. That was always the intent; the implementations had diverged for accidental reasons. ZNEWOBJaLBuild an object instance. The stack before should be thought of as containing a class object followed by an argument tuple (the tuple being the stack top). Call these cls and args. They are popped off the stack, and the value returned by cls.__new__(cls, *args) is pushed back onto the stack. Z NEWOBJ_EX’auBuild an object instance. The stack before should be thought of as containing a class object followed by an argument tuple and by a keyword argument dict (the dict being the stack top). Call these cls and args. They are popped off the stack, and the value returned by cls.__new__(cls, *args, *kwargs) is pushed back onto the stack. PROTO€zProtocol version indicator. For protocol 2 and above, a pickle must start with this opcode. The argument is the protocol version, an int in range(2, 256). ZSTOP.zStop the unpickling machine. Every pickle ends with this opcode. The object at the top of the stack is popped, and that's the result of unpickling. The stack should be empty then. FRAME•zIndicate the beginning of a new frame. The unpickler may use this opcode to safely prefetch data from its underlying stream. ZPERSIDPaPush an object identified by a persistent ID. The pickle module doesn't define what a persistent ID means. PERSID's argument is a newline-terminated str-style (no embedded escapes, no bracketing quote characters) string, which *is* "the persistent ID". The unpickler passes this string to self.persistent_load(). Whatever object that returns is pushed on the stack. There is no implementation of persistent_load() in Python's unpickler: it must be supplied by an unpickler subclass. Z BINPERSIDQaXPush an object identified by a persistent ID. Like PERSID, except the persistent ID is popped off the stack (instead of being a string embedded in the opcode bytestream). The persistent ID is passed to self.persistent_load(), and whatever object that returns is pushed on the stack. See PERSID for more detail. z%repeated name %r at indices %d and %dz%repeated code %r at indices %d and %dFcCstj}xtjD]}tjd|s2|rtd|qtt|}t|t  sTt |dkrj|rtd||fq|j d}||kr|rtd||f||}|j |krt d|||j f||=qt d||fqW|rd g}x(|jD]\}}|jd |j |fqWt d j|dS) Nz[A-Z][A-Z0-9_]+$z0skipping %r: it doesn't look like an opcode namerz5skipping %r: value %r doesn't look like a pickle codezlatin-1z+checking name %r w/ code %r for consistencyzBfor pickle code %r, pickle.py uses name %r but we're using name %rzPpickle.py appears to have a pickle opcode with name %r and code %r, but we don'tz=we appear to have pickle opcodes that pickle.py doesn't have:z name %r with code %r )code2opcopypickle__all__rematchprintgetattrrerirr3r ritemsappendjoin)verboserr Z picklecodermsgrrrrrassure_pickle_consistencys>         rccst|trtj|}t|dr&|j}ndd}x|}|jd}tj|j d}|dkr|dkrjt dnt d|dkrzd n||f|j dkrd}n |j j |}|r||||fVn |||fV|d kr0Pq0WdS) NtellcSsdS)Nrrrrrsz_genops..rzlatin-1z#pickle exhausted before seeing STOPz!at position %s, opcode %r unknownz .) re bytes_typesioBytesIOhasattrrrrgetr3rrsr )r yield_end_posZgetposposrropcodersrrr_genopss.         rcCst|S)axGenerate all the opcodes in a pickle. 'pickle' is a file-like object, or string, containing the pickle. Each opcode in the pickle is generated, from the current pickle position, stopping after a STOP opcode is delivered. A triple is generated for each opcode: opcode, arg, pos opcode is an OpcodeInfo record, describing the current opcode. If the opcode has an argument embedded in the pickle, arg is its decoded value, as a Python object. If the opcode doesn't have an argument, arg is None. If the pickle has a tell() method, pos was the value of pickle.tell() before reading the current opcode. If the pickle is a bytes object, it's wrapped in a BytesIO object, and the latter's tell() result is used. Else (the pickle doesn't have a tell(), and it's not obvious how to query its current position) pos is None. )r)rrrrrscCsd}d}t}i}g}d}d}xt|ddD]\}} } } d|jkr\|j| |j|| fq,|jdkrt|} |j| |j|| fq,d|jkrq,d|jkr|j|kr|j}d || <|j|| fq,|jd kr| |kr| }| dkr|| | }n|j| | fq,|j| | fq,W~tj} | j |t j | |}|d krJ|j j d} x|D]x\}} ||kr| |krtqT|j| }| || <| d 7} n&||kr|j|| }n ||| }|j j|j |qTW|j j| jS) z7Optimize a pickle string by removing unused PUT opcodesrrrrT)rrrNrrr)rmrr addrrrvrrwriterZ_PicklerZframerZ start_framingputrZ commit_frameZ end_framinggetvalue)rrrZoldidsZnewidsopcodesrvZ protoheaderrrsrZend_posidxoutZpickleroprrrrrsd                    cCsg}|dkri}d}g}d|}d} |} xt|D]\} } } | dk rZtd| d|ddt| jdd |t|| jf}t|| j}| j}| j }t|}d}t |ks| jdko|o|d!t krD|r<|j }|dkrd}nd |}x|d"t k r|j qW|j y|j t }Wnt k r8d }YnXnd } }| jd#kr| jdkrnt|}d|}n| }||krd| } n,|sd} n |d$t krd} n |d%||<n*| jd&kr| |kr|| g}nd| } | dk s|r0|ddt| j7}| dk r|dt| 7}|r0|d|7}|rz|d| t|7}t|} | dkr`|} |d| jjddd 7}t||d| rt | t||krt d|t|f|r|| d=t |kr|j| |j|q4Wtd||d|r t d|dS)'aKProduce a symbolic disassembly of a pickle. 'pickle' is a file-like object, or string, containing a (at least one) pickle. The pickle is disassembled from the current position, through the first STOP opcode encountered. Optional arg 'out' is a file-like object to which the disassembly is printed. It defaults to sys.stdout. Optional arg 'memo' is a Python dict, used as the pickle's memo. It may be mutated by dis(), if the pickle contains PUT or BINPUT opcodes. Passing the same memo object to another dis() call then allows disassembly to proceed across multiple pickles that were all created by the same pickler with the same memo. Ordinarily you don't need to worry about this. Optional arg 'indentlevel' is the number of blanks by which to indent a new MARK level. It defaults to 4. Optional arg 'annotate' if nonzero instructs dis() to add short description of the opcode on each line of disassembled output. The value given to 'annotate' must be an integer and is used as a hint for the column where annotation should start. The default value is 0, meaning no annotations. In addition to printing the disassembly, some sanity checks are made: + All embedded opcode arguments "make sense". + Explicit and implicit pop operations have enough items on the stack. + When an opcode implicitly refers to a markobject, a markobject is actually on the stack. + A memo entry isn't referenced before it's defined. + The markobject isn't stored in the memo. + A memo entry isn't redefined. Nr z%5d:)endfilez %-4s %s%srz(MARK at unknown opcode offset)z (MARK at %d)rzno MARK exists on stackrrrrz(as %d)zmemo key %r already definedz'stack is empty -- can't store into memoz"can't store markobject in the memorrrz&memo key %r has never been stored into 2r)rz3tries to pop %d items from stack with only %d itemsz highest protocol among opcodes =zstack not empty after STOP: %rr-r-r-r-)rrrrr-r-)rrr)rrreprrrrr maxrvrtru markobjectpopindexrrsplitrextend)rrmemo indentlevelannotatestackZmaxprotoZ markstackZ indentchunkZerrormsgZannocolrrsrlineZbeforeafterZnumtopopZmarkmsgZmarkposZmemo_idxrrrr% s-                    c@seZdZddZdS)_ExamplecCs ||_dS)N)value)rrrrrr sz_Example.__init__N)rrrrrrrrr sra >>> import pickle >>> x = [1, 2, (3, 4), {b'abc': "def"}] >>> pkl0 = pickle.dumps(x, 0) >>> dis(pkl0) 0: ( MARK 1: l LIST (MARK at 0) 2: p PUT 0 5: L LONG 1 9: a APPEND 10: L LONG 2 14: a APPEND 15: ( MARK 16: L LONG 3 20: L LONG 4 24: t TUPLE (MARK at 15) 25: p PUT 1 28: a APPEND 29: ( MARK 30: d DICT (MARK at 29) 31: p PUT 2 34: c GLOBAL '_codecs encode' 50: p PUT 3 53: ( MARK 54: V UNICODE 'abc' 59: p PUT 4 62: V UNICODE 'latin1' 70: p PUT 5 73: t TUPLE (MARK at 53) 74: p PUT 6 77: R REDUCE 78: p PUT 7 81: V UNICODE 'def' 86: p PUT 8 89: s SETITEM 90: a APPEND 91: . STOP highest protocol among opcodes = 0 Try again with a "binary" pickle. >>> pkl1 = pickle.dumps(x, 1) >>> dis(pkl1) 0: ] EMPTY_LIST 1: q BINPUT 0 3: ( MARK 4: K BININT1 1 6: K BININT1 2 8: ( MARK 9: K BININT1 3 11: K BININT1 4 13: t TUPLE (MARK at 8) 14: q BINPUT 1 16: } EMPTY_DICT 17: q BINPUT 2 19: c GLOBAL '_codecs encode' 35: q BINPUT 3 37: ( MARK 38: X BINUNICODE 'abc' 46: q BINPUT 4 48: X BINUNICODE 'latin1' 59: q BINPUT 5 61: t TUPLE (MARK at 37) 62: q BINPUT 6 64: R REDUCE 65: q BINPUT 7 67: X BINUNICODE 'def' 75: q BINPUT 8 77: s SETITEM 78: e APPENDS (MARK at 3) 79: . STOP highest protocol among opcodes = 1 Exercise the INST/OBJ/BUILD family. >>> import pickletools >>> dis(pickle.dumps(pickletools.dis, 0)) 0: c GLOBAL 'pickletools dis' 17: p PUT 0 20: . STOP highest protocol among opcodes = 0 >>> from pickletools import _Example >>> x = [_Example(42)] * 2 >>> dis(pickle.dumps(x, 0)) 0: ( MARK 1: l LIST (MARK at 0) 2: p PUT 0 5: c GLOBAL 'copy_reg _reconstructor' 30: p PUT 1 33: ( MARK 34: c GLOBAL 'pickletools _Example' 56: p PUT 2 59: c GLOBAL '__builtin__ object' 79: p PUT 3 82: N NONE 83: t TUPLE (MARK at 33) 84: p PUT 4 87: R REDUCE 88: p PUT 5 91: ( MARK 92: d DICT (MARK at 91) 93: p PUT 6 96: V UNICODE 'value' 103: p PUT 7 106: L LONG 42 111: s SETITEM 112: b BUILD 113: a APPEND 114: g GET 5 117: a APPEND 118: . STOP highest protocol among opcodes = 0 >>> dis(pickle.dumps(x, 1)) 0: ] EMPTY_LIST 1: q BINPUT 0 3: ( MARK 4: c GLOBAL 'copy_reg _reconstructor' 29: q BINPUT 1 31: ( MARK 32: c GLOBAL 'pickletools _Example' 54: q BINPUT 2 56: c GLOBAL '__builtin__ object' 76: q BINPUT 3 78: N NONE 79: t TUPLE (MARK at 31) 80: q BINPUT 4 82: R REDUCE 83: q BINPUT 5 85: } EMPTY_DICT 86: q BINPUT 6 88: X BINUNICODE 'value' 98: q BINPUT 7 100: K BININT1 42 102: s SETITEM 103: b BUILD 104: h BINGET 5 106: e APPENDS (MARK at 3) 107: . STOP highest protocol among opcodes = 1 Try "the canonical" recursive-object test. >>> L = [] >>> T = L, >>> L.append(T) >>> L[0] is T True >>> T[0] is L True >>> L[0][0] is L True >>> T[0][0] is T True >>> dis(pickle.dumps(L, 0)) 0: ( MARK 1: l LIST (MARK at 0) 2: p PUT 0 5: ( MARK 6: g GET 0 9: t TUPLE (MARK at 5) 10: p PUT 1 13: a APPEND 14: . STOP highest protocol among opcodes = 0 >>> dis(pickle.dumps(L, 1)) 0: ] EMPTY_LIST 1: q BINPUT 0 3: ( MARK 4: h BINGET 0 6: t TUPLE (MARK at 3) 7: q BINPUT 1 9: a APPEND 10: . STOP highest protocol among opcodes = 1 Note that, in the protocol 0 pickle of the recursive tuple, the disassembler has to emulate the stack in order to realize that the POP opcode at 16 gets rid of the MARK at 0. >>> dis(pickle.dumps(T, 0)) 0: ( MARK 1: ( MARK 2: l LIST (MARK at 1) 3: p PUT 0 6: ( MARK 7: g GET 0 10: t TUPLE (MARK at 6) 11: p PUT 1 14: a APPEND 15: 0 POP 16: 0 POP (MARK at 0) 17: g GET 1 20: . STOP highest protocol among opcodes = 0 >>> dis(pickle.dumps(T, 1)) 0: ( MARK 1: ] EMPTY_LIST 2: q BINPUT 0 4: ( MARK 5: h BINGET 0 7: t TUPLE (MARK at 4) 8: q BINPUT 1 10: a APPEND 11: 1 POP_MARK (MARK at 0) 12: h BINGET 1 14: . STOP highest protocol among opcodes = 1 Try protocol 2. >>> dis(pickle.dumps(L, 2)) 0: \x80 PROTO 2 2: ] EMPTY_LIST 3: q BINPUT 0 5: h BINGET 0 7: \x85 TUPLE1 8: q BINPUT 1 10: a APPEND 11: . STOP highest protocol among opcodes = 2 >>> dis(pickle.dumps(T, 2)) 0: \x80 PROTO 2 2: ] EMPTY_LIST 3: q BINPUT 0 5: h BINGET 0 7: \x85 TUPLE1 8: q BINPUT 1 10: a APPEND 11: 0 POP 12: h BINGET 1 14: . STOP highest protocol among opcodes = 2 Try protocol 3 with annotations: >>> dis(pickle.dumps(T, 3), annotate=1) 0: \x80 PROTO 3 Protocol version indicator. 2: ] EMPTY_LIST Push an empty list. 3: q BINPUT 0 Store the stack top into the memo. The stack is not popped. 5: h BINGET 0 Read an object from the memo and push it on the stack. 7: \x85 TUPLE1 Build a one-tuple out of the topmost item on the stack. 8: q BINPUT 1 Store the stack top into the memo. The stack is not popped. 10: a APPEND Append an object to a list. 11: 0 POP Discard the top stack item, shrinking the stack by one item. 12: h BINGET 1 Read an object from the memo and push it on the stack. 14: . STOP Stop the unpickling machine. highest protocol among opcodes = 2 a= >>> import pickle >>> import io >>> f = io.BytesIO() >>> p = pickle.Pickler(f, 2) >>> x = [1, 2, 3] >>> p.dump(x) >>> p.dump(x) >>> f.seek(0) 0 >>> memo = {} >>> dis(f, memo=memo) 0: \x80 PROTO 2 2: ] EMPTY_LIST 3: q BINPUT 0 5: ( MARK 6: K BININT1 1 8: K BININT1 2 10: K BININT1 3 12: e APPENDS (MARK at 5) 13: . STOP highest protocol among opcodes = 2 >>> dis(f, memo=memo) 14: \x80 PROTO 2 16: h BINGET 0 18: . STOP highest protocol among opcodes = 2 )Zdisassembler_testZdisassembler_memo_testcCsddl}|jS)Nr)doctestZtestmod)rrrr_test sr__main__z$disassemble one or more pickle files)Z description pickle_filebr*zthe pickle file)typenargshelpz-oz--outputwz+the file where the output should be written)defaultrrz-mz--memo store_truez#preserve memo between disassemblies)actionrz-lz --indentlevelz8the number of blanks by which to indent a new MARK levelz-az --annotatez2annotate each line with a short opcode descriptionz-pz --preamblez==> {name} <==zMif more than one pickle file is specified, print this before each disassembly)rrz-tz--testzrun self-test suitez-vz)run verbosely; only affects self-test run)r rr-)TT)F)F)NNrr)__doc__r1rrrrBrrZ UP_TO_NEWLINEZTAKEN_FROM_ARGUMENT1ZTAKEN_FROM_ARGUMENT4ZTAKEN_FROM_ARGUMENT4UZTAKEN_FROM_ARGUMENT8Uobjectr Zstructrrrrr r!r"r#r$r%r'r(r6r7r8r9r:r;r<r=r>r?r@rArDrErFrGrIrJrLrMrNrOrPrQrTrVrWrXrZr[r\r]r^r_r`rarbrcrRZpyintZpylongrhZpyinteger_or_boolZpyboolrYZpyfloatrirHZpybytes_or_strZpystringZpybytesZ pyunicoderZpynonerfZpytuplerkZpylistrlZpydictrmZpysetZ pyfrozensetZ anyobjectrrprqrxrZname2iZcode2i enumeraterrr rrrrrrrrrrZ _dis_testZ _memo_testZ__test__rrargparseArgumentParserparser add_argumentZFileTypestdout parse_argsargsZtestrrZ print_helproutputrrrZpreambleformatrrrrr s $   /        ;           +      &  >                   _pyio.cpython-36.opt-2.pyc000064400000137517152462730460011300 0ustar003 \!X@s^ddlZddlZddlZddlZddlZddlZyddlmZWn e k r`ddl mZYnXej d4krzddl m ZndZddlZddlmZmZmZmZdddhZeed rejejejejd5ZeZd7ddZGdddZGdddZy ejZWn(ek r*Gddde e!ZYnXGdddej"dZ#ej#j$e#Gddde#Z%ej%j$e%ddl&m'Z'e%j$e'Gddde#Z(ej(j$e(Gddde(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#Z/ej/j$e/Gd.d/d/ej0Z1Gd0d1d1e/Z2Gd2d3d3e2Z3dS)8N) 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| rdpd| 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)"Nzinvalid file: %rzinvalid mode: %rzinvalid buffering: %rzinvalid 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@seZdZddZdS) DocDescriptorcCs 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__rGr?r?r?r@rBsrBc@seZdZeZddZdS) OpenWrappercOs t||S)N)rA)clsargskwargsr?r?r@__new__szOpenWrapper.__new__N)rHrIrJrBrCrOr?r?r?r@rKsrKc@s eZdZdS)UnsupportedOperationN)rHrIrJr?r?r?r@rPsrPc@seZdZddZd5ddZddZd6d d Zd d Zd ZddZ ddZ ddZ d7ddZ ddZ d8ddZddZd9ddZeddZd:d d!Zd"d#Zd$d%Zd&d'Zd(d)ZdIOBasecCstd|jj|fdS)Nz%s.%s() not supported)rP __class__rH)rDnamer?r?r@ _unsupported@szIOBase._unsupportedrcCs|jddS)Nseek)rT)rDposwhencer?r?r@rUGsz IOBase.seekcCs |jddS)Nrr )rU)rDr?r?r@tellWsz IOBase.tellNcCs|jddS)Ntruncate)rT)rDrVr?r?r@rY[szIOBase.truncatecCs |jdS)N) _checkClosed)rDr?r?r@flushesz IOBase.flushFc Cs |jsz |jWdd|_XdS)NT)_IOBase__closedr[)rDr?r?r@r3os z IOBase.closec Csy |jWn YnXdS)N)r3)rDr?r?r@__del__zs zIOBase.__del__cCsdS)NFr?)rDr?r?r@seekableszIOBase.seekablecCs |jst|dkrdn|dS)NzFile or stream is not seekable.)r^rP)rDmsgr?r?r@_checkSeekableszIOBase._checkSeekablecCsdS)NFr?)rDr?r?r@readableszIOBase.readablecCs |jst|dkrdn|dS)NzFile or stream is not readable.)rarP)rDr_r?r?r@_checkReadableszIOBase._checkReadablecCsdS)NFr?)rDr?r?r@writableszIOBase.writablecCs |jst|dkrdn|dS)NzFile or stream is not writable.)rcrP)rDr_r?r?r@_checkWritableszIOBase._checkWritablecCs|jS)N)r\)rDr?r?r@closedsz IOBase.closedcCs|jrt|dkrdn|dS)NzI/O operation on closed file.)rer")rDr_r?r?r@rZszIOBase._checkClosedcCs |j|S)N)rZ)rDr?r?r@ __enter__szIOBase.__enter__cGs |jdS)N)r3)rDrMr?r?r@__exit__szIOBase.__exit__cCs|jddS)Nr*)rT)rDr?r?r@r*sz IOBase.filenocCs |jdS)NF)rZ)rDr?r?r@r'sz IOBase.isattyr cstdrfdd}ndd}dkr0d nttsBtdt}x>dks^t|krj|}|spP||7}|jdrJPqJWt|S) Npeekcs>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@rnsr 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)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)rHrIrJrTrUrXrYr[r\r3r]r^r`rarbrcrdpropertyrerZrfrgr*r'rtrurxr|r~r?r?r?r@rQs2$         % rQ) metaclassc@s.eZdZd ddZddZddZdd Zd S) RawIOBaser cCsP|dkr d}|dkr|jSt|j}|j|}|dkr>dS||d=t|S)Nr rr)readallrp __index__readintor)rDrmrrlr?r?r@rq9s   zRawIOBase.readcCs8t}x|jt}|sP||7}qW|r0t|S|SdS)N)rprqr(r)rDrsdatar?r?r@rJs  zRawIOBase.readallcCs|jddS)Nr)rT)rDrr?r?r@rXszRawIOBase.readintocCs|jddS)Nr})rT)rDrr?r?r@r}`szRawIOBase.writeNr)r)rHrIrJrqrrr}r?r?r?r@r+s r)r&c@sHeZdZdddZdddZddZdd Zd d Zd d ZddZ dS)BufferedIOBaseNcCs|jddS)Nrq)rT)rDrmr?r?r@rq~szBufferedIOBase.readcCs|jddS)Nread1)rT)rDrmr?r?r@rszBufferedIOBase.read1cCs|j|ddS)NF)r) _readinto)rDrr?r?r@rs zBufferedIOBase.readintocCs|j|ddS)NT)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)Nr})rT)rDrr?r?r@r}s zBufferedIOBase.writecCs|jddS)Ndetach)rT)rDr?r?r@rszBufferedIOBase.detach)N)N) rHrIrJrqrrrrr}rr?r?r?r@rms    rc@seZdZddZd#ddZddZd$d d Zd d Zd dZddZ ddZ e ddZ e ddZ e ddZe ddZddZddZdd Zd!d"ZdS)%_BufferedIOMixincCs ||_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)rHrIrJrrUrXrYr[r3rr^rr;rerSr2rrr*r'r?r?r?r@rs          rcseZdZdddZddZddZdd Zfd d Zd d d ZddZ ddZ d!ddZ ddZ d"ddZ ddZddZddZZS)#BytesIONcCs&t}|dk r||7}||_d|_dS)Nr)rp_buffer_pos)rDZ initial_bytesbufr?r?r@rDs zBytesIO.__init__cCs|jrtd|jjS)Nz__getstate__ on closed file)rer"__dict__copy)rDr?r?r@rKszBytesIO.__getstate__cCs|jrtdt|jS)Nzgetvalue on closed file)rer"rr)rDr?r?r@getvaluePszBytesIO.getvaluecCs|jrtdt|jS)Nzgetbuffer on closed file)rer"rr)rDr?r?r@ getbufferWszBytesIO.getbuffercs|jjtjdS)N)rclearsuperr3)rD)rRr?r@r3^s z BytesIO.closecCst|jrtd|dkrd}|dkr,t|j}t|j|jkr@dStt|j|j|}|j|j|}||_t|S)Nzread from closed filer rr)rer"r!rrrkr)rDrmZnewposrr?r?r@rqbs z BytesIO.readcCs |j|S)N)rq)rDrmr?r?r@rpsz BytesIO.read1c Cs|jrtdt|tr tdt| }|j}WdQRX|dkrFdS|j}|t|j krzd|t|j }|j |7_ ||j |||<|j|7_|S)Nzwrite to closed filez can't write str to binary streamr) rer"rrrrnbytesrr!r)rDrZviewrlrVZpaddingr?r?r@r}us  z BytesIO.writercCs|jrtdy |jWn,tk rD}ztd|WYdd}~XnX|dkrl|dkrdtd|f||_nD|dkrtd|j||_n(|dkrtdt|j||_ntd|jS)Nzseek on closed filezan integer is requiredrznegative seek position %rr r zunsupported whence value) rer"rr-rrmaxr!r)rDrVrWerrr?r?r@rUs  z BytesIO.seekcCs|jrtd|jS)Nztell on closed file)rer"r)rDr?r?r@rXsz BytesIO.tellcCs||jrtd|dkr|j}nNy |jWn,tk rT}ztd|WYdd}~XnX|dkrltd|f|j|d=|S)Nztruncate on closed filezan integer is requiredrznegative truncate position %r)rer"rrr-rr)rDrVrr?r?r@rYs  zBytesIO.truncatecCs|jrtddS)NzI/O operation on closed file.T)rer")rDr?r?r@raszBytesIO.readablecCs|jrtddS)NzI/O operation on closed file.T)rer")rDr?r?r@rcszBytesIO.writablecCs|jrtddS)NzI/O operation on closed file.T)rer")rDr?r?r@r^szBytesIO.seekable)N)N)r)N)rHrIrJrrrrr3rqrr}rUrXrYrarcr^ __classcell__r?r?)rRr@r@s     rc@sreZdZefddZddZddZddd Zdd d Zdd dZ dddZ ddZ ddZ ddZ dddZdS)r0cCsF|jstdtj|||dkr,td||_|jt|_dS)Nz "raw" argument must be readable.rzinvalid buffer size) rar,rrr" buffer_size_reset_read_bufLock _read_lock)rDr;rr?r?r@rs zBufferedReader.__init__cCs |jjS)N)r;ra)rDr?r?r@raszBufferedReader.readablecCsd|_d|_dS)Nrr) _read_buf _read_pos)rDr?r?r@rszBufferedReader._reset_read_bufNc Cs4|dk r|dkrtd|j |j|SQRXdS)Nr zinvalid number of bytes to readr)r"r_read_unlocked)rDrmr?r?r@rqszBufferedReader.readc Csd}d}|j}|j}|dks$|dkr|jt|jdrj|jj}|dkrZ||dpXdS||d|S||dg}d}x2|jj}||kr|}P|t|7}|j|q~Wdj |p|St||} || kr|j|7_||||S||dg}t |j |} xB| |krL|jj| }||kr2|}P| t|7} |j|q Wt || }dj |} | |d|_d|_| r| d|S|S)Nrr rr)rNr) rrrror;rrqr!rzjoinrrrk) rDrlZ nodata_valZ empty_valuesrrVchunkZchunksZ current_sizeavailZwantedoutr?r?r@rsN            zBufferedReader._read_unlockedrc Cs|j |j|SQRXdS)N)r_peek_unlocked)rDrmr?r?r@rhszBufferedReader.peekcCsrt||j}t|j|j}||ks,|dkrb|j|}|jj|}|rb|j|jd||_d|_|j|jdS)Nr)rkrr!rrr;rq)rDrlZwantZhaveZto_readZcurrentr?r?r@r)s   zBufferedReader._peek_unlockedc CsT|dkrtd|dkrdS|j(|jd|jt|t|j|jSQRXdS)Nrz(number of bytes to read must be positiverr )r"rrrrkr!rr)rDrmr?r?r@r4s zBufferedReader.read1c Cst|tst|}|jdkr dS|jd}d}|jx|t|krtt|j|jt|}|r|j|j|j|||||<|j|7_||7}|t|krPt|||j kr|j j ||d}|sP||7}n|o|s|j dsP|r8|r8Pq8WWdQRX|S)Nrrr ) rrrrrr!rkrrrr;rr)rDrrwrittenrrlr?r?r@rFs4   "   zBufferedReader._readintocCstj|t|j|jS)N)rrXr!rr)rDr?r?r@rXtszBufferedReader.tellc CsX|tkrtd|j8|dkr4|t|j|j8}tj|||}|j|SQRXdS)Nzinvalid whence valuer ) valid_seek_flagsr"rr!rrrrUr)rDrVrWr?r?r@rUwszBufferedReader.seek)N)N)r)r)r)rHrIrJr(rrarrqrrhrrrrXrUr?r?r?r@r0s  4 .r0c@sTeZdZefddZddZddZddd Zd d Zd d Z ddZ dddZ dS)r/cCsF|jstdtj|||dkr,td||_t|_t|_ dS)Nz "raw" argument must be writable.rzinvalid buffer size) rcr,rrr"rrp _write_bufr _write_lock)rDr;rr?r?r@rs zBufferedWriter.__init__cCs |jjS)N)r;rc)rDr?r?r@rcszBufferedWriter.writablecCs|jrtdt|tr td|jt|j|jkr@|j t|j}|jj |t|j|}t|j|jkry |j Wnlt k r}zPt|j|jkrt|j|j}||8}|jd|j|_t |j |j |WYdd}~XnX|SQRXdS)Nzwrite to closed filez can't write str to binary stream)rer"rrrrr!rr_flush_unlockedextendBlockingIOErrorerrnostrerror)rDrZbeforereZoverager?r?r@r}s(    "zBufferedWriter.writeNc Cs8|j(|j|dkr"|jj}|jj|SQRXdS)N)rrr;rXrY)rDrVr?r?r@rYs  zBufferedWriter.truncatec Cs|j|jWdQRXdS)N)rr)rDr?r?r@r[szBufferedWriter.flushc Cs|jrtdxz|jry|jj|j}Wntk rDtdYnX|dkr\ttjdd|t |jksr|dkrzt d|jd|=qWdS)Nzflush of closed filezHself.raw should implement RawIOBase: it should not raise BlockingIOErrorz)write could not complete without blockingrz*write() returned incorrect number of bytes) rer"rr;r}r RuntimeErrorrZEAGAINr!r,)rDrlr?r?r@rszBufferedWriter._flush_unlockedcCstj|t|jS)N)rrXr!r)rDr?r?r@rXszBufferedWriter.tellrc Cs8|tkrtd|j|jtj|||SQRXdS)Nzinvalid whence value)rr"rrrrU)rDrVrWr?r?r@rUs zBufferedWriter.seek)N)r) rHrIrJr(rrcr}rYr[rrXrUr?r?r?r@r/s  r/c@seZdZefddZdddZddZdd Zdd d Zd dZ ddZ ddZ ddZ ddZ ddZddZeddZdS)BufferedRWPaircCs<|jstd|js tdt|||_t|||_dS)Nz#"reader" argument must be readable.z#"writer" argument must be writable.)rar,rcr0readerr/writer)rDrrrr?r?r@rs  zBufferedRWPair.__init__NcCs|dkr d}|jj|S)Nr r)rrq)rDrmr?r?r@rqszBufferedRWPair.readcCs |jj|S)N)rr)rDrr?r?r@rszBufferedRWPair.readintocCs |jj|S)N)rr})rDrr?r?r@r}szBufferedRWPair.writercCs |jj|S)N)rrh)rDrmr?r?r@rhszBufferedRWPair.peekcCs |jj|S)N)rr)rDrmr?r?r@rszBufferedRWPair.read1cCs |jj|S)N)rr)rDrr?r?r@r szBufferedRWPair.readinto1cCs |jjS)N)rra)rDr?r?r@ra szBufferedRWPair.readablecCs |jjS)N)rrc)rDr?r?r@rcszBufferedRWPair.writablecCs |jjS)N)rr[)rDr?r?r@r[szBufferedRWPair.flushc Cs z|jjWd|jjXdS)N)rr3r)rDr?r?r@r3szBufferedRWPair.closecCs|jjp|jjS)N)rr'r)rDr?r?r@r'szBufferedRWPair.isattycCs|jjS)N)rre)rDr?r?r@reszBufferedRWPair.closed)N)r)rHrIrJr(rrqrr}rhrrrarcr[r3r'rrer?r?r?r@rs   rc@sheZdZefddZdddZddZdd d Zdd d Zd dZ dddZ ddZ ddZ ddZ dS)r.cCs(|jtj|||tj|||dS)N)r`r0rr/)rDr;rr?r?r@r-szBufferedRandom.__init__rcCs|tkrtd|j|jrJ|j |jj|jt|jdWdQRX|jj||}|j|j WdQRX|dkrt d|S)Nzinvalid whence valuer rz seek() returned invalid position) rr"r[rrr;rUrr!rr,)rDrVrWr?r?r@rU2s$zBufferedRandom.seekcCs|jrtj|Stj|SdS)N)rr/rXr0)rDr?r?r@rXCs zBufferedRandom.tellNcCs|dkr|j}tj||S)N)rXr/rY)rDrVr?r?r@rYIszBufferedRandom.truncatecCs |dkr d}|jtj||S)Nr r)r[r0rq)rDrmr?r?r@rqOszBufferedRandom.readcCs|jtj||S)N)r[r0r)rDrr?r?r@rUszBufferedRandom.readintocCs|jtj||S)N)r[r0rh)rDrmr?r?r@rhYszBufferedRandom.peekcCs|jtj||S)N)r[r0r)rDrmr?r?r@r]szBufferedRandom.read1cCs|jtj||S)N)r[r0r)rDrr?r?r@raszBufferedRandom.readinto1c CsF|jr:|j(|jj|jt|jd|jWdQRXtj||S)Nr ) rrr;rUrr!rr/r})rDrr?r?r@r}es zBufferedRandom.write)r)N)N)r)rHrIrJr(rrUrXrYrqrrhrrr}r?r?r?r@r.$s     r.cseZdZd0ZdZdZdZdZdZdZ d1ddZ dd Z d d Z d d Z ddZd2ddZd3ddZddZddZddZefddZddZd4ddZfd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zed,d-Zed.d/Z Z!S)5r&r FNTrc Cs |jdkr*z|jrtj|jWdd|_Xt|trsz"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)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)Nrr )rZrbr(rrrrr)st_sizer,rpr!rrqrr)rDbufsizerVendr<rlrr?r?r@rs4   zFileIO.readallcCs4t|jd}|jt|}t|}||d|<|S)Nr)rrrqr!)rDrmrrlr?r?r@r?s  zFileIO.readintoc Cs8|j|jytj|j|Stk r2dSXdS)N)rZrdrr}rr)rDrr?r?r@r}Gs z FileIO.writecCs*t|trtd|jtj|j||S)Nzan integer is required)rrrrZrrr)rDrVrWr?r?r@rUUs z FileIO.seekcCs|jtj|jdtS)Nr)rZrrrr)rDr?r?r@rXesz FileIO.tellcCs2|j|j|dkr |j}tj|j||S)N)rZrdrXr ftruncater)rDrmr?r?r@rYls zFileIO.truncatec s.|js*z|jrtj|jWdtjXdS)N)rerrr3rr)rD)rRr?r@r3ys z FileIO.closec CsF|j|jdkr@y |jWntk r8d|_YnXd|_|jS)NFT)rZ _seekablerXr,)rDr?r?r@r^s   zFileIO.seekablecCs|j|jS)N)rZr)rDr?r?r@raszFileIO.readablecCs|j|jS)N)rZr)rDr?r?r@rcszFileIO.writablecCs|j|jS)N)rZr)rDr?r?r@r*sz FileIO.filenocCs|jtj|jS)N)rZrr'r)rDr?r?r@r'sz FileIO.isattycCs|jS)N)r)rDr?r?r@r9szFileIO.closefdcCsJ|jr|jrdSdSn0|jr,|jr&dSdSn|jrB|jrZ!d?d@Z"dKdAdBZ#edCdDZ$dS)Lr1iNFc 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)Nzwrite to closed filezcan't write %s to text streamrrr)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)Nr)r"r#)rDcharsr?r?r@r,)sz TextIOWrapper._set_decoded_charscCsF|j}|dkr|j|d}n|j|||}|jt|7_|S)N)r#r"r!)rDrloffsetr1r?r?r@_get_decoded_chars.s z TextIOWrapper._get_decoded_charscCs$|j|krtd|j|8_dS)Nz"rewind decoded_chars out of bounds)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)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_cookiecCs>|jstd|jstd|j|jj}|j}|dksF|jdkrX|j rTt d|S|j\}}|t |8}|j }|dkr|j ||S|j}zt|j|}d}x|dkr$|jd|ft |j|d|} | |kr|j\} } | s| }|| 8}P|t | 8}d}q||8}|d}qWd}|jd|f||} |} |dkrZ|j | | Sd}d}d}xt|t |D]v}|d7}|t |j|||d7}|j\}}| r||kr| |7} ||8}|dd} }}||krvPqvW|t |jddd 7}d}||krtd |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@rXysv              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)Nr)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)%rHrIrJr6rrrr6r7r=r>r^rarcr[r3rerSr*r'r}r(r0r,r3r5r;rCrFrXrYrrUrqrxrtrr?r?r?r@r1ZsF E        * c  K  Xr1csNeZdZdfdd ZddZddZed d Zed d Zd dZ Z S)StringIOrrcsftt|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) rHrIrJrrrrr7r6rrr?r?)rRr@rN s    rN>rri r)rrNNNTN)4rabcrrrsys_threadrrrZ _dummy_threadplatformZmsvcrtrriorrrr rroaddr SEEK_DATAr(rrArBrKrPr-r,r"ABCMetarQregisterr_ior&rrrr0r/rr.rrrr1rNr?r?r?r@st      T   =   g iCZIJUA U^symtable.cpython-36.opt-2.pyc000064400000022632152462730460011770 0ustar003 \m @sJddlZddlmZmZmZmZmZmZmZmZm Z m Z m Z m Z m Z mZddlZdddddgZddZGd d d ZeZGd ddeZGd ddeZGd ddeZGdddeZedkrFddlZddlZeejdZejZ WdQRXee ej!j"ejdddZ#x0e#j$D]$Z%e#j&e%Z'e(e'e'j)e'j*qWdS)N)USE DEF_GLOBAL DEF_LOCAL DEF_PARAM DEF_IMPORT DEF_BOUND DEF_ANNOT SCOPE_OFF SCOPE_MASKFREELOCALGLOBAL_IMPLICITGLOBAL_EXPLICITCELLsymtable SymbolTableClassFunctionSymbolcCstj|||}t||S)N) _symtabler_newSymbolTable)codefilenameZ compile_typetopr /usr/lib64/python3.6/symtable.pyr sc@s$eZdZddZddZddZdS)SymbolTableFactorycCstj|_dS)N)weakrefWeakValueDictionary_SymbolTableFactory__memo)selfrrr__init__szSymbolTableFactory.__init__cCs6|jtjkrt||S|jtjkr,t||St||S)N)typer TYPE_FUNCTIONr TYPE_CLASSrr)r tablerrrrnews     zSymbolTableFactory.newcCs8||f}|jj|d}|dkr4|j||}|j|<|S)N)rgetr&)r r%rkeyobjrrr__call__s zSymbolTableFactory.__call__N)__name__ __module__ __qualname__r!r&r*rrrrrsrc@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdS) rcCs||_||_i|_dS)N)_table _filename_symbols)r Z raw_tablerrrrr!'szSymbolTable.__init__cCsN|jtkrd}n d|jj}|jjdkr6dj||jSdj||jj|jSdS)Nz%s globalz<{0}SymbolTable for module {1}>z<{0}SymbolTable for {1} in {2}>) __class__rr+r.nameformatr/)r Zkindrrr__repr__,s   zSymbolTable.__repr__cCs:|jjtjkrdS|jjtjkr$dS|jjtjkr6dSdS)NmoduleZfunctionclass)r.r"rZ TYPE_MODULEr#r$)r rrrget_type9szSymbolTable.get_typecCs|jjS)N)r.id)r rrrget_idCszSymbolTable.get_idcCs|jjS)N)r.r4)r rrrget_nameFszSymbolTable.get_namecCs|jjS)N)r.lineno)r rrr get_linenoIszSymbolTable.get_linenocCst|jjtjkS)N)boolr.r"rr#)r rrr is_optimizedLszSymbolTable.is_optimizedcCs t|jjS)N)r?r.nested)r rrr is_nestedOszSymbolTable.is_nestedcCs t|jjS)N)r?r.children)r rrr has_childrenRszSymbolTable.has_childrencCsdS)NFr)r rrrhas_execUszSymbolTable.has_execcCs |jjjS)N)r.symbolskeys)r rrrget_identifiersYszSymbolTable.get_identifierscCsD|jj|}|dkr@|jj|}|j|}t|||}|j|<|S)N)r0r'r.rF_SymbolTable__check_childrenr)r r4Zsymflags namespacesrrrlookup\s    zSymbolTable.lookupcsfddjDS)Ncsg|]}j|qSr)rL).0ident)r rr esz+SymbolTable.get_symbols..)rH)r r)r r get_symbolsdszSymbolTable.get_symbolscsfddjjDS)Ncs"g|]}|jkrt|jqSr)r4rr/)rMst)r4r rrrOhsz0SymbolTable.__check_children..)r.rC)r r4r)r4r rZ__check_childrengs zSymbolTable.__check_childrencsfddjjDS)Ncsg|]}t|jqSr)rr/)rMrQ)r rrrOmsz,SymbolTable.get_children..)r.rC)r r)r r get_childrenls zSymbolTable.get_childrenN)r+r,r-r!r6r9r;r<r>r@rBrDrErHrLrPrIrRrrrrr%s  c@sDeZdZdZdZdZdZddZddZddZ dd Z d d Z dS) rNcstfddjDS)Ncs g|]}jj|r|qSr)r.rF)rMrN)r test_funcrrrOzsz.Function.__idents_matching..)tuplerH)r rSr)r rSrZ__idents_matchingyszFunction.__idents_matchingcCs |jdkr|jdd|_|jS)NcSs|t@S)N)r)xrrrsz)Function.get_parameters..)_Function__params_Function__idents_matching)r rrrget_parameters}s zFunction.get_parameterscs0|jdkr*ttffdd}|j||_|jS)Ncs|t?t@kS)N)r r )rU)locsrrrVsz%Function.get_locals..)_Function__localsr rrX)r testr)rZr get_localss    zFunction.get_localscs0|jdkr*ttffdd}|j||_|jS)Ncs|t?t@kS)N)r r )rU)globrrrVsz&Function.get_globals..)_Function__globalsr rrX)r r\r)r^r get_globalss    zFunction.get_globalscCs$|jdkrdd}|j||_|jS)NcSs|t?t@tkS)N)r r r )rUrrrrVsz$Function.get_frees..)_Function__freesrX)r is_freerrr get_freess  zFunction.get_frees) r+r,r-rWr[rar_rXrYr]r`rcrrrrrqsc@seZdZdZddZdS)rNcCs:|jdkr4i}x|jjD]}d||j<qWt||_|jS)N)_Class__methodsr.rCr4rT)r drQrrr get_methodss   zClass.get_methods)r+r,r-rergrrrrrsc@seZdZd ddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZddZddZdS)!rNcCs(||_||_|t?t@|_|p f|_dS)N) _Symbol__name_Symbol__flagsr r _Symbol__scope_Symbol__namespaces)r r4rJrKrrrr!szSymbol.__init__cCs dj|jS)Nz)r5rh)r rrrr6szSymbol.__repr__cCs|jS)N)rh)r rrrr<szSymbol.get_namecCst|jtj@S)N)r?rirr)r rrr is_referencedszSymbol.is_referencedcCst|jt@S)N)r?rir)r rrr is_parameterszSymbol.is_parametercCst|jttfkS)N)r?rjr r)r rrr is_globalszSymbol.is_globalcCst|jtkS)N)r?rjr)r rrris_declared_globalszSymbol.is_declared_globalcCst|jt@S)N)r?rir)r rrris_localszSymbol.is_localcCst|jt@S)N)r?rir)r rrr is_annotatedszSymbol.is_annotatedcCst|jtkS)N)r?rjr )r rrrrbszSymbol.is_freecCst|jt@S)N)r?rir)r rrr is_importedszSymbol.is_importedcCst|jt@S)N)r?rir)r rrr is_assignedszSymbol.is_assignedcCs t|jS)N)r?rk)r rrr is_namespaces zSymbol.is_namespacecCs|jS)N)rk)r rrrget_namespacesszSymbol.get_namespacescCs t|jdkrtd|jdS)Nrdz$name is bound to multiple namespacesr)lenrk ValueError)r rrr get_namespaceszSymbol.get_namespace)N)r+r,r-r!r6r<rlrmrnrorprqrbrrrsrtrurxrrrrrs  __main__rdexec)+rrrrrrrrr r r r r rrr__all__rrrobjectrrrrr+ossysopenargvfreadsrcpathsplitmodrHrNrLinfoprintrprtrrrrs$@L& C  optparse.cpython-36.pyc000064400000135670152462730460011054 0ustar003 \@sdZdZdddddddd d d d d dddddgZdZddlZddlZddlZddZyddlmZm Z Wn$e k rddZddZ YnXeZ Gdd d e Z Gddde ZGdddeZGd dde ZGd!dde ZGd"d#d#eZGd$d d ZGd%d d eZGd&d d eZd'd(Zd)d*Zee d+fee d+fee d,fee d-fd.Zd/d0Zd1dZd>ZGd4ddZd?Zd@Z Gd8ddZ!Gd9ddZ"Gd:dde"Z#Gd;d d e"Z$d Originally distributed as Optik. For support, use the optik-users@lists.sourceforge.net mailing list (http://lists.sourceforge.net/lists/listinfo/optik-users). Simple usage example: from optparse import OptionParser parser = OptionParser() parser.add_option("-f", "--file", dest="filename", help="write report to FILE", metavar="FILE") parser.add_option("-q", "--quiet", action="store_false", dest="verbose", default=True, help="don't print status messages to stdout") (options, args) = parser.parse_args() z1.5.3Option make_option SUPPRESS_HELPSUPPRESS_USAGEValuesOptionContainer OptionGroup OptionParser HelpFormatterIndentedHelpFormatterTitledHelpFormatter OptParseError OptionErrorOptionConflictErrorOptionValueErrorBadOptionError check_choicea" Copyright (c) 2001-2006 Gregory P. Ward. All rights reserved. Copyright (c) 2002-2006 Python Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. NcCsd|jjt||fS)Nz<%s at 0x%x: %s>) __class____name__id)selfr /usr/lib64/python3.6/optparse.py_reprOsr)gettextngettextcCs|S)Nr)messagerrrr\srcCs|dkr |S|S)Nr)ZsingularZpluralnrrrr_src@seZdZddZddZdS)r cCs ||_dS)N)msg)rrrrr__init__hszOptParseError.__init__cCs|jS)N)r)rrrr__str__kszOptParseError.__str__N)r __module__ __qualname__r r!rrrrr gsc@s eZdZdZddZddZdS)r z] Raised if an Option instance is created with invalid or inconsistent arguments. cCs||_t||_dS)N)rstr option_id)rroptionrrrr uszOptionError.__init__cCs |jrd|j|jfS|jSdS)Nz option %s: %s)r%r)rrrrr!yszOptionError.__str__N)rr"r#__doc__r r!rrrrr osc@seZdZdZdS)rzE Raised if conflicting options are added to an OptionParser. N)rr"r#r'rrrrrsc@seZdZdZdS)rzS Raised if an invalid option value is encountered on the command line. N)rr"r#r'rrrrrsc@s eZdZdZddZddZdS)rzB Raised if an invalid option is seen on the command line. cCs ||_dS)N)opt_str)rr(rrrr szBadOptionError.__init__cCstd|jS)Nzno such option: %s)_r()rrrrr!szBadOptionError.__str__N)rr"r#r'r r!rrrrrsc@s eZdZdZddZddZdS)AmbiguousOptionErrorzD Raised if an ambiguous option is seen on the command line. cCstj||||_dS)N)rr possibilities)rr(r+rrrr s zAmbiguousOptionError.__init__cCstd|jdj|jfS)Nzambiguous option: %s (%s?)z, )r)r(joinr+)rrrrr!szAmbiguousOptionError.__str__N)rr"r#r'r r!rrrrr*sr*c@seZdZdZdZddZddZddZd d Zd d Z d dZ ddZ ddZ ddZ ddZddZddZddZddZdd Zd!S)"r a Abstract base class for formatting option help. OptionParser instances should use one of the HelpFormatter subclasses for formatting help; by default IndentedHelpFormatter is used. Instance attributes: parser : OptionParser the controlling OptionParser instance indent_increment : int the number of columns to indent per nesting level max_help_position : int the maximum starting column for option help text help_position : int the calculated starting column for option help text; initially the same as the maximum width : int total number of columns for output (pass None to constructor for this value to be taken from the $COLUMNS environment variable) level : int current indentation level current_indent : int current indentation level (in columns) help_width : int number of columns available for option help text (calculated) default_tag : str text to replace with each option's default value, "%default" by default. Set to false value to disable default value expansion. option_strings : { Option : str } maps Option instances to the snippet of help text explaining the syntax of that option, e.g. "-h, --help" or "-fFILE, --file=FILE" _short_opt_fmt : str format string controlling how short options with values are printed in help text. Must be either "%s%s" ("-fFILE") or "%s %s" ("-f FILE"), because those are the two syntaxes that Optik supports. _long_opt_fmt : str similar but for long options; must be either "%s %s" ("--file FILE") or "%s=%s" ("--file=FILE"). ZnonecCsd|_||_|dkrLyttjd}Wnttfk rBd}YnX|d8}||_t|t |d|d|_ |_ d|_ d|_ d|_||_d|_i|_d|_d|_dS) NZCOLUMNSPrz%defaultz%s %sz%s=%s)parserindent_incrementintosenvironKeyError ValueErrorwidthminmax help_positionmax_help_positioncurrent_indentlevel help_width short_first default_tagoption_strings_short_opt_fmt _long_opt_fmt)rr1r;r7r?rrrr s$  zHelpFormatter.__init__cCs ||_dS)N)r0)rr0rrr set_parserszHelpFormatter.set_parsercCs&|dkrtd|d|d|_dS)N z/invalid metavar delimiter for short options: %rz%s)rErF)r6rB)rdelimrrrset_short_opt_delimiters z%HelpFormatter.set_short_opt_delimitercCs&|dkrtd|d|d|_dS)N=rFz.invalid metavar delimiter for long options: %rz%s)rIrF)r6rC)rrGrrrset_long_opt_delimiters z$HelpFormatter.set_long_opt_delimitercCs"|j|j7_|jd7_dS)Nr)r<r1r=)rrrrindentszHelpFormatter.indentcCs4|j|j8_|jdks"td|jd8_dS)NrzIndent decreased below 0.r)r<r1AssertionErrorr=)rrrrdedentszHelpFormatter.dedentcCs tddS)Nzsubclasses must implement)NotImplementedError)rusagerrr format_usageszHelpFormatter.format_usagecCs tddS)Nzsubclasses must implement)rN)rheadingrrrformat_headingszHelpFormatter.format_headingcCs.t|j|jd}d|j}tj||||dS)z Format a paragraph of free-form text for inclusion in the help output at the current indentation level. rF)Zinitial_indentZsubsequent_indent)r9r7r<textwrapZfill)rtextZ text_widthrKrrr _format_texts  zHelpFormatter._format_textcCs|r|j|dSdSdS)N rE)rV)r descriptionrrrformat_descriptionsz HelpFormatter.format_descriptioncCs|rd|j|dSdSdS)NrWrE)rV)repilogrrr format_epilogszHelpFormatter.format_epilogcCsR|jdks|j r|jS|jjj|j}|tks8|dkr>|j}|jj|jt |S)N) r0r@helpdefaultsgetdest NO_DEFAULTNO_DEFAULT_VALUEreplacer$)rr&Z default_valuerrrexpand_defaults zHelpFormatter.expand_defaultcsg}j|}jjd}t||krBdjd|f}j}ndjd||f}d}|j||jrj|}tj|j }|jd|d|df|j fdd|ddDn|d d kr|jd dj |S) Nr.z%*s%s rEz %*s%-*s rcsg|]}djd|fqS)z%*s%s rE)r:).0line)rrr Esz/HelpFormatter.format_option..rrW) rAr:r<lenappendr\rcrTZwrapr>extendr,)rr&resultoptsZ opt_widthZ indent_firstZ help_textZ help_linesr)rr format_option(s$      zHelpFormatter.format_optioncCs|jd}x6|jD],}|j|}||j|<t|t||j}qW|jxF|jD]<}x6|jD],}|j|}||j|<t|t||j}q`WqTW|j|jt |d|j |_ t|j |j d|_ dS)Nrr.rS)rK option_listformat_option_stringsrAr9rhr< option_groupsrMr8r;r:r7r>)rr0Zmax_lenoptZstringsgrouprrrstore_option_stringsKs        z"HelpFormatter.store_option_stringscst|jrF|jp|jjfdd|jD}fdd|jD}n |j}|j}jrb||}n||}dj|S)z@Return a comma-separated list of option strings & metavariables.csg|]}j|fqSr)rB)rdZsopt)metavarrrrrfasz7HelpFormatter.format_option_strings..csg|]}j|fqSr)rC)rdZlopt)rtrrrrfcsz, ) takes_valuertr_upper _short_opts _long_optsr?r,)rr&Z short_optsZ long_optsrlr)rtrrro]s     z#HelpFormatter.format_option_stringsN)rr"r#r'rar rDrHrJrKrMrPrRrVrYr[rcrmrsrorrrrr s")  #c@s*eZdZdZd ddZdd Zd d ZdS) r z.Format help with indented section bodies. r.NrcCstj|||||dS)N)r r )rr1r;r7r?rrrr tszIndentedHelpFormatter.__init__cCs td|S)Nz Usage: %s )r))rrOrrrrP|sz"IndentedHelpFormatter.format_usagecCsd|jd|fS)Nz%*s%s: rE)r<)rrQrrrrRsz$IndentedHelpFormatter.format_heading)r.ryNr)rr"r#r'r rPrRrrrrr ps c@s*eZdZdZd ddZddZd d ZdS) r z1Format help with underlined section headers. rryNcCstj|||||dS)N)r r )rr1r;r7r?rrrr szTitledHelpFormatter.__init__cCsd|jtd|fS)Nz%s %s ZUsage)rRr))rrOrrrrPsz TitledHelpFormatter.format_usagecCsd|d|jt|fS)Nz%s %s z=-)r=rh)rrQrrrrRsz"TitledHelpFormatter.format_heading)rryNr)rr"r#r'r rPrRrrrrr s cCsh|ddjdkrd}nD|ddjdkrDd}|ddp@d}n|dddkrZd}nd}|||S) Nr.Z0xZ0b0r )lower)valtyperadixrrr _parse_numsrcCs t|tS)N)rr2)rrrr _parse_intsrZintegerzfloating-pointcomplex)r2longfloatrc CsFt|j\}}y||Stk r@ttd|||fYnXdS)Nzoption %s: invalid %s value: %r) _builtin_cvtrr6rr))r&rqvalueZcvtZwhatrrr check_builtins rcCs:||jkr|Sdjtt|j}ttd|||fdS)Nz, z.option %s: invalid choice: %r (choose from %s))choicesr,mapreprrr))r&rqrrrrrrs  NODEFAULTc @seZdZdZdddddddd d d d d g ZdBZdCZdDZdEZdFZ dGZ e e e e e dZ dZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3ZeeeeeeegZd4d5ZeZd6d7Zd8d9Zd:d;Zdd?Z!d@dAZ"dS)Hrar Instance attributes: _short_opts : [string] _long_opts : [string] action : string type : string dest : string default : any nargs : int const : any choices : [string] callback : function callback_args : (any*) callback_kwargs : { string : any } help : string metavar : string actionrr_defaultnargsconstrcallback callback_argscallback_kwargsr\rtstore store_const store_true store_falseri append_constcountversionstringr2rrrchoice)r2rrrrNcOsFg|_g|_|j|}|j||j|x|jD] }||q2WdS)N)rwrx_check_opt_strings_set_opt_strings _set_attrs CHECK_METHODS)rrlattrscheckerrrrr 4s    zOption.__init__cCsdd|D}|std|S)NcSsg|] }|r|qSrr)rdrqrrrrfKsz-Option._check_opt_strings..z+at least one option string must be supplied) TypeError)rrlrrrrGszOption._check_opt_stringscCsx|D]}t|dkr&td||qt|dkrf|ddkoH|ddksXtd|||jj|q|dddko|ddkstd|||jj|qWdS) Nr.z>invalid option string %r: must be at least two characters longr-rzMinvalid short option string %r: must be of the form -x, (x any non-dash char)z--zGinvalid long option string %r: must start with --, followed by non-dash)rhr rwrirx)rrlrqrrrrPs$    zOption._set_opt_stringscCszxP|jD]F}||kr,t||||||=q|dkrBt||tqt||dqW|rvt|j}tddj||dS)Nrzinvalid keyword arguments: %sz, )ATTRSsetattrr`sortedkeysr r,)rrattrrrrres   zOption._set_attrscCs2|jdkrd|_n|j|jkr.td|j|dS)Nrzinvalid action: %r)rACTIONSr )rrrr _check_actionxs  zOption._check_actioncCs|jdkr0|j|jkr|jdk r(d|_qd|_n^t|jtrF|jj|_|jdkrVd|_|j|jkrrtd|j||j|jkrtd|j|dS)Nrrr$zinvalid option type: %rz$must not supply a type for action %r) rrALWAYS_TYPED_ACTIONSr isinstancerTYPESr TYPED_ACTIONS)rrrr _check_type~s        zOption._check_typecCsr|jdkrT|jdkr td|qnt|jttfsntdtt|jjdd|n|jdk rntd|j|dS)Nrz/must supply a list of choices for type 'choice'z1choices must be a list of strings ('%s' supplied)'rz#must not supply choices for type %r)rrr rtuplelistr$split)rrrr _check_choices     zOption._check_choicecCs\|j|jkp|jdk }|jdkrX|rX|jrH|jdddjdd|_n|jdd|_dS)Nrr.rr)r)r STORE_ACTIONSrr_rxrbrw)rrurrr _check_dests   zOption._check_destcCs*|j|jkr&|jdk r&td|j|dS)Nz*'const' must not be supplied for action %r)r CONST_ACTIONSrr )rrrr _check_constszOption._check_constcCs<|j|jkr|jdkr8d|_n|jdk r8td|j|dS)Nrz*'nargs' must not be supplied for action %r)rrrr )rrrr _check_nargss   zOption._check_nargscCs|jdkrvt|js$td|j||jdk rLt|jt rLtd|j||jdk rt|jt rtd|j|nB|jdk rtd|j||jdk rtd||jdk rtd|dS)Nrzcallback not callable: %rz3callback_args, if supplied, must be a tuple: not %rz4callback_kwargs, if supplied, must be a dict: not %rz.callback supplied (%r) for non-callback optionz.callback_args supplied for non-callback optionz0callback_kwargs supplied for non-callback option) rcallablerr rrrrdict)rrrr_check_callbacks0         zOption._check_callbackcCsdj|j|jS)N/)r,rwrx)rrrrr!szOption.__str__cCs |jdk S)N)r)rrrrruszOption.takes_valuecCs|jr|jdS|jdSdS)Nr)rxrw)rrrrget_opt_strings zOption.get_opt_stringcCs*|jj|j}|dkr|S||||SdS)N) TYPE_CHECKERr^r)rrqrrrrr check_valueszOption.check_valuecs:|dk r6jdkrj|Stfdd|DSdS)Nrcsg|]}j|qSr)r)rdv)rqrrrrfsz(Option.convert_value..)rrr)rrqrr)rqrr convert_values  zOption.convert_valuecCs$|j||}|j|j|j||||S)N)r take_actionrr_)rrqrvaluesr0rrrprocesss zOption.processc Cs:|dkrt|||n|dkr2t|||jn|dkrHt||dn|dkr^t||dn|dkrz|j|gj|n|dkr|j|gj|jn|d krt|||j|d d n||d kr|jpf}|jpi}|j||||f||nF|d kr |j|jn*|dkr(|j |jnt d|j d S)NrrrTrFrirrrrrr\rzunknown action %r) rr ensure_valuerirrr print_helpexit print_versionr6r) rrr_rqrrr0argskwargsrrrrs4      zOption.take_action) rrrrrirrrr\r)rrrrrirr)rrir)rri)rr)rr2rrrr)#rr"r#r'rrrrrrrrrrrr rrrrrrrrrrr!r__repr__rurrrrrrrrrrs      ZSUPPRESSZHELPZUSAGEc@s^eZdZdddZddZeZddZdd Zd d Z d d Z dddZ dddZ ddZ dS)rNcCs*|r&x |jD]\}}t|||qWdS)N)itemsr)rr]rrrrrr 9szValues.__init__cCs t|jS)N)r$__dict__)rrrrr!>szValues.__str__cCs2t|tr|j|jkSt|tr*|j|kStSdS)N)rrrrNotImplemented)rotherrrr__eq__Cs     z Values.__eq__cCs:x4t|D](}||kr ||}|dk r t|||q WdS)z Update the option values from an arbitrary dictionary, but only use keys from dict that already have a corresponding attribute in self. Any keys in dict without a corresponding attribute are silently ignored. N)dirr)rrrZdvalrrr_update_carefulKs zValues._update_carefulcCs|jj|dS)z Update the option values from an arbitrary dictionary, using all keys from the dictionary regardless of whether they have a corresponding attribute in self or not. N)rupdate)rrrrr _update_looseXszValues._update_loosecCs8|dkr|j|n |dkr(|j|n td|dS)NcarefulZloosezinvalid update mode: %r)rrr6)rrmoderrr_update`s   zValues._updatercCs&t|tj|}|jt||dS)N) __import__sysmodulesrvars)rmodnamermodrrr read_modulehs zValues.read_modulecCs&i}tt|j||j||dS)N)execopenreadr)rfilenamerrrrr read_filemszValues.read_filecCs0t|| st||dkr&t|||t||S)N)hasattrgetattrr)rrrrrrrrs zValues.ensure_value)N)r)r)rr"r#r r!rrrrrrrrrrrrrr7s    c@seZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZddZddZd d!Zd"S)#ra Abstract base class. Class attributes: standard_option_list : [Option] list of standard options that will be accepted by all instances of this parser class (intended to be overridden by subclasses). Instance attributes: option_list : [Option] the list of Option objects contained by this OptionContainer _short_opt : { string : Option } dictionary mapping short option strings, eg. "-f" or "-X", to the Option instances that implement them. If an Option has multiple short option strings, it will appear in this dictionary multiple times. [1] _long_opt : { string : Option } dictionary mapping long option strings, eg. "--file" or "--exclude", to the Option instances that implement them. Again, a given Option can occur multiple times in this dictionary. [1] defaults : { string : any } dictionary mapping option destination names to default values for each destination [1] [1] These mappings are common to (shared by) all components of the controlling OptionParser, where they are initially created. cCs&|j||_|j||j|dS)N)_create_option_list option_classset_conflict_handlerset_description)rrconflict_handlerrXrrrr s zOptionContainer.__init__cCsi|_i|_i|_dS)N) _short_opt _long_optr])rrrr_create_option_mappingssz'OptionContainer._create_option_mappingscCs|j|_|j|_|j|_dS)N)rrr])rr0rrr_share_option_mappingssz&OptionContainer._share_option_mappingscCs|dkrtd|||_dS)Nerrorresolvez$invalid conflict_resolution value %r)rr)r6r)rhandlerrrrrs z$OptionContainer.set_conflict_handlercCs ||_dS)N)rX)rrXrrrrszOptionContainer.set_descriptioncCs|jS)N)rX)rrrrget_descriptionszOptionContainer.get_descriptioncCs|`|`|`dS)zsee OptionParser.destroy().N)rrr])rrrrdestroyszOptionContainer.destroycCsg}x,|jD]"}||jkr |j||j|fq Wx,|jD]"}||jkr:|j||j|fq:W|r|j}|dkrtddjdd|D|nh|dkrx^|D]V\}}|jdr|jj ||j|=n|jj ||j|=|jp|js|j j j |qWdS)Nrz conflicting option string(s): %sz, cSsg|] }|dqS)rr)rdcorrrrfsz3OptionContainer._check_conflict..rz--) rwrrirxrrrr, startswithremove containerrn)rr&Z conflict_optsrqrZc_optionrrr_check_conflicts.         zOptionContainer._check_conflictcOst|dtr|j||}n:t|dkrN| rN|d}t|tsVtd|ntd|j||jj|||_ x|j D]}||j |<qzWx|j D]}||j |<qW|jdk r|jtk r|j|j|j<n|j|jkrd|j|j<|S)zOadd_option(Option) add_option(opt_str, ..., kwarg=val, ...) rrznot an Option instance: %rzinvalid argumentsN)rr$rrhrrrrnrirrwrrxrr_rr`r])rrrr&rqrrr add_options(         zOptionContainer.add_optioncCsx|D]}|j|qWdS)N)r)rrnr&rrr add_optionss zOptionContainer.add_optionscCs|jj|p|jj|S)N)rr^r)rr(rrr get_options zOptionContainer.get_optioncCs||jkp||jkS)N)rr)rr(rrr has_option s zOptionContainer.has_optioncCsv|jj|}|dkr |jj|}|dkr4td|x|jD] }|j|=qd?Z"d@dAZ#dSdBdCZ$dDdEZ%dTdFdGZ&dUdHdIZ'dJdKZ(dVdLdMZ)dWdNdOZ*dS)Xra$ Class attributes: standard_option_list : [Option] list of standard options that will be accepted by all instances of this parser class (intended to be overridden by subclasses). Instance attributes: usage : string a usage string for your program. Before it is displayed to the user, "%prog" will be expanded to the name of your program (self.prog or os.path.basename(sys.argv[0])). prog : string the name of the current program (to override os.path.basename(sys.argv[0])). description : string A paragraph of text giving a brief overview of your program. optparse reformats this paragraph to fit the current terminal width and prints it when the user requests help (after usage, but before the list of options). epilog : string paragraph of help text to print after option help option_groups : [OptionGroup] list of option groups in this parser (option groups are irrelevant for parsing the command-line, but very useful for generating help) allow_interspersed_args : bool = true if true, positional arguments may be interspersed with options. Assuming -a and -b each take a single argument, the command-line -ablah foo bar -bboo baz will be interpreted the same as -ablah -bboo -- foo bar baz If this flag were false, that command line would be interpreted as -ablah -- foo bar -bboo baz -- ie. we stop processing options as soon as we see the first non-option argument. (This is the tradition followed by Python's getopt module, Perl's Getopt::Std, and other argument- parsing libraries, but it is generally annoying to users.) process_default_values : bool = true if true, option default values are processed similarly to option values from the command line: that is, they are passed to the type-checking function for the option's type (as long as the default value is a string). (This really only matters if you have defined custom types; see SF bug #955889.) Set it to false to restore the behaviour of Optik 1.4.1 and earlier. rargs : [string] the argument list currently being parsed. Only set when parse_args() is active, and continually trimmed down as we consume arguments. Mainly there for the benefit of callback options. largs : [string] the list of leftover arguments that we have skipped while parsing options. If allow_interspersed_args is false, this list is always empty. values : Values the set of option values currently being accumulated. Only set when parse_args() is active. Also mainly for callbacks. Because of the 'rargs', 'largs', and 'values' attributes, OptionParser is not thread-safe. If, for some perverse reason, you need to parse command-line arguments simultaneously in different threads, use different OptionParser instances. NrTc Csrtj|||||j|| |_||_d|_d|_|dkr@t}||_|jj || |_ |j ||d|j dS)NT)add_help) rr set_usageprograllow_interspersed_argsprocess_default_valuesr rrDrZ_populate_option_list_init_parsing_state) rrOrnrrrrXrZadd_help_optionr rZrrrr s    zOptionParser.__init__cCs2tj|x|jD] }|jqW|`|`|`dS)a Declare that you are done with this OptionParser. This cleans up reference cycles so the OptionParser (and all objects referenced by it) can be garbage-collected promptly. After calling destroy(), the OptionParser is unusable. N)rrrprnr)rrrrrrrs    zOptionParser.destroycCsg|_g|_|jdS)N)rnrpr)rrrrrsz OptionParser._create_option_listcCs|jdddtdddS)Nz-hz--helpr\zshow this help message and exit)rr\)rr))rrrr_add_help_optionszOptionParser._add_help_optioncCs|jddtdddS)Nz --versionrz&show program's version number and exit)rr\)rr))rrrr_add_version_optionsz OptionParser._add_version_optioncCs>|jr|j|j|r |j||jr.|j|r:|jdS)N)standard_option_listrrrr)rrnrrrrr s  z"OptionParser._populate_option_listcCsd|_d|_d|_dS)N)rargslargsr)rrrrr sz OptionParser._init_parsing_statecCsL|dkrtd|_n4|tkr$d|_n$|jjdrB|dd|_n||_dS)Nz%prog [options]zusage: )r)rOrr~r)rrOrrrrs zOptionParser.set_usagecCs d|_dS)aSet parsing to not stop on the first non-option, allowing interspersing switches with command arguments. This is the default behavior. See also disable_interspersed_args() and the class documentation description of the attribute allow_interspersed_args.TN)r )rrrrenable_interspersed_argssz%OptionParser.enable_interspersed_argscCs d|_dS)zSet parsing to stop on the first non-option. Use this if you have a command processor which runs another command that has options of its own and you want to make sure these options don't get confused. FN)r )rrrrdisable_interspersed_argssz&OptionParser.disable_interspersed_argscCs ||_dS)N)r )rrrrrset_process_default_values sz'OptionParser.set_process_default_valuescCs||j|<dS)N)r])rr_rrrr set_defaultszOptionParser.set_defaultcKs|jj|dS)N)r]r)rrrrr set_defaultsszOptionParser.set_defaultscCs.|jdd}x|jD]}|j|jqW|S)N)rnrprj)rZoptionsrrrrr_get_all_optionss zOptionParser._get_all_optionscCsd|jst|jS|jj}x@|jD]4}|j|j}t|tr$|j }|j ||||j<q$Wt|S)N) r rr]copyrr^r_rr$rr)rr]r&rr(rrrget_default_valuess    zOptionParser.get_default_valuescOs|t|dtr t|f||}nLt|dkrd| rd|d}t|tsPtd||j|k rltdntd|jj||S)Nrrznot an OptionGroup instance: %rz"invalid OptionGroup (wrong parser)zinvalid arguments) rr$rrhrr0r6rpri)rrrrrrrradd_option_group+s     zOptionParser.add_option_groupcCs0|jj|p|jj|}|r,|j|k r,|jSdS)N)rr^rr)rr(r&rrrget_option_group;s   zOptionParser.get_option_groupcCs&|dkrtjddS|ddSdS)Nr)rargv)rrrrr _get_argsEszOptionParser._get_argscCs|j|}|dkr|j}||_g|_}||_y|j|||}Wn4ttfk rv}z|jt |WYdd}~XnX||}|j ||S)aR parse_args(args : [string] = sys.argv[1:], values : Values = None) -> (values : Values, args : [string]) Parse the command-line options found in 'args' (default: sys.argv[1:]). Any errors result in a call to 'error()', which by default prints the usage message to stderr and calls sys.exit() with an error message. On success returns a pair (values, args) where 'values' is a Values instance (with all your option values) and 'args' is the list of arguments left over after parsing options. N) rrrrr _process_argsrrrr$ check_values)rrrrrstoperrrrr parse_argsKs    zOptionParser.parse_argscCs||fS)a check_values(values : Values, args : [string]) -> (values : Values, args : [string]) Check that the supplied option values and leftover arguments are valid. Returns the option values and leftover arguments (possibly adjusted, possibly completely new -- whatever you like). Default implementation just returns the passed-in values; subclasses may override as desired. r)rrrrrrr!rs zOptionParser.check_valuescCsx|r|d}|dkr |d=dS|dddkr>|j||q|dddkrht|dkrh|j||q|jr|j||d=qdSqWdS)a_process_args(largs : [string], rargs : [string], values : Values) Process command-line arguments and populate 'values', consuming options and arguments from 'rargs'. If 'allow_interspersed_args' is false, stop at the first non-option argument. If true, accumulate any interspersed non-option arguments in 'largs'. rz--Nr.rr)_process_long_optrh_process_short_optsr ri)rrrrargrrrr s  zOptionParser._process_argscCs t||jS)a_match_long_opt(opt : string) -> string Determine which long option string 'opt' matches, ie. which one it is an unambiguous abbreviation for. Raises BadOptionError if 'opt' doesn't unambiguously match any long option string. ) _match_abbrevr)rrqrrr_match_long_optszOptionParser._match_long_optc Cs|jd}d|kr4|jdd\}}|jd|d}n|}d}|j|}|j|}|jr|j}t||kr|jt dd|||dq|dkr|jd} qt |d|} |d|=n|r|jt d |nd} |j || ||dS) NrrIrTFz.%(option)s option requires %(number)d argumentz/%(option)s option requires %(number)d arguments)r&numberz%s option does not take a value) poprinsertr)rrurrhrrrr)r) rrrr'rqZnext_argZhad_explicit_valuer&rrrrrr%s0       zOptionParser._process_long_optc Cs|jd}d}d}x|ddD]}d|}|jj|}|d7}|sLt||jr|t|krx|jd||dd}|j} t|| kr|jt dd| || dq| dkr|jd} qt |d| } |d| =nd} |j || |||r Pq WdS) NrFrrTz.%(option)s option requires %(number)d argumentz/%(option)s option requires %(number)d arguments)r&r*) r+rr^rrurhr,rrrrr) rrrr'r"iZchrqr&rrrrrr&s6      z OptionParser._process_short_optscCs&|jdkrtjjtjdS|jSdS)Nr)r r3pathbasenamerr)rrrr get_prog_names zOptionParser.get_prog_namecCs|jd|jS)Nz%prog)rbr0)rsrrrexpand_prog_nameszOptionParser.expand_prog_namecCs |j|jS)N)r2rX)rrrrrszOptionParser.get_descriptionrcCs|rtjj|tj|dS)N)rstderrwriter)rZstatusrrrrrs zOptionParser.exitcCs(|jtj|jdd|j|fdS)zerror(msg : string) Print a usage message incorporating 'msg' to stderr and exit. If you override this in a subclass, it should not return -- it should either exit or raise an exception. r.z%s: error: %s N) print_usagerr3rr0)rrrrrrs zOptionParser.errorcCs"|jr|jj|j|jSdSdS)NrE)rOrrPr2)rrrr get_usage#szOptionParser.get_usagecCs|jrt|j|ddS)aaprint_usage(file : file = stdout) Print the usage message for the current program (self.usage) to 'file' (default stdout). Any occurrence of the string "%prog" in self.usage is replaced with the name of the current program (basename of sys.argv[0]). Does nothing if self.usage is empty or not defined. )fileN)rOprintr6)rr7rrrr5*s zOptionParser.print_usagecCs|jr|j|jSdSdS)NrE)rr2)rrrr get_version6s zOptionParser.get_versioncCs|jrt|j|ddS)aEprint_version(file : file = stdout) Print the version message for this program (self.version) to 'file' (default stdout). As with print_usage(), any occurrence of "%prog" in self.version is replaced by the current program's name. Does nothing if self.version is empty or undefined. )r7N)rr8r9)rr7rrrr<szOptionParser.print_versioncCs|dkr|j}|j|g}|j|jtd|j|jrZ|jtj|||jdx(|j D]}|j|j ||jdqbW|j dj |ddS)NZOptionsrWrErrg) rrsrirRr)rKrnrrrprrMr,)rrrkrrrrrrGs   zOptionParser.format_option_helpcCs |j|jS)N)r[rZ)rrrrrr[XszOptionParser.format_epilogcCsn|dkr|j}g}|jr*|j|jd|jrD|j|j|d|j|j||j|j|dj|S)NrWrE) rrOrir6rXrYrr[r,)rrrkrrrr[szOptionParser.format_helpcCs |dkrtj}|j|jdS)zprint_help(file : file = stdout) Print an extended help message, listing all options and any help text provided with them, to 'file' (default stdout). N)rstdoutr4r)rr7rrrrgszOptionParser.print_help)T)NN)rN)N)N)N)N)N)+rr"r#r'rrr rrrrr r rrrrrrrrrrrr$r!r r)r%r&r0r2rrrr6r5r9rrr[rrrrrrrRs`D      ' 3 $)     csZ|kr Sfdd|jD}t|dkr6|dS|sDtn|jt|dS)z_match_abbrev(s : string, wordmap : {string : Option}) -> string Return the string key in 'wordmap' for which 's' is an unambiguous abbreviation. If 's' is found to be ambiguous or doesn't match any of 'words', raise BadOptionError. csg|]}|jr|qSr)r)rdZword)r1rrrfsz!_match_abbrev..rrN)rrhrsortr*)r1Zwordmapr+r)r1rr(ts  r()rrZ SUPPRESSHELPZ SUPPRESSUSAGE)'r' __version____all__Z __copyright__rr3rTrrr ImportErrorr) Exceptionr r rrrr*r r r rrrrrrrr`rrrrrrrr(rrrrrs~    P     uA=&py_compile.cpython-36.opt-2.pyc000064400000005576152462730460012320 0ustar003 \ @s~ddlZddlZddlZddlZddlZddlZddlZdddgZGddde Z d ddZ d d dZ e d krzeje dS)NcompilemainPyCompileErrorc@seZdZdddZddZdS)rcCst|j}|tkr2djtj||}|jdd|}n d||f}tj||pJ||||||_||_ ||_ |pl||_ dS)NrzFile ""z File "%s"z Sorry: %s: %s) __name__ SyntaxErrorjoin tracebackformat_exception_onlyreplace Exception__init__ exc_type_name exc_valuefilemsg)selfexc_typerrrrtbtexterrmsgr"/usr/lib64/python3.6/py_compile.pyr -s  zPyCompileError.__init__cCs|jS)N)r)rrrr__str__=szPyCompileError.__str__N)r)r __module__ __qualname__r rrrrrrs FcCs|dkr>|dkr2|dkr|nd}tjj||d}n tjj|}tjj|r^d}t|j|n,tjj|rtjj | rd}t|j|tj j d|}|j |}y|j ||p||d} WnVtk r} z8t| j| |p|} |r| ntjj| jd dSWYdd} ~ XnXy tjj|} | r0tj| Wntk rHYnX|j|} tjj| | d | d }tjj|}tjj||||S) Nrrr) optimizationzc{} is a symlink and will be changed into a regular file if import writes a byte-compiled file to itzk{} is a non-regular file and will be changed into a regular one if import writes a byte-compiled file to itz ) _optimize mtimesize) importlibutilcache_from_sourceospathislinkFileExistsErrorformatexistsisfile machinerySourceFileLoaderget_datasource_to_coder r __class__sysstderrwriterdirnamemakedirs path_stats_bootstrap_external_code_to_bytecode _calc_mode _write_atomic)rcfiledfiledoraiseoptimizerrloader source_bytescodeerrpy_excr3 source_statsbytecodemoderrrrAsF)         cCs"|dkrtjdd}d}|dgkrxtjj}|s6P|jd}yt|ddWq&tk r}zd}tjjd|j WYdd}~Xq&t k r}zd}tjjd|WYdd}~Xq&Xq&WnZxX|D]P}yt|ddWqtk r}zd}tjjd|j WYdd}~XqXqW|S)Nrr-rT)r<z%s ) r0argvstdinreadlinerstriprrr1r2rOSError)argsrvfilenameerrorrrrrs0    "( (__main__)NNFrQ)N)Zimportlib._bootstrap_externalr!importlib.machineryimportlib.utilr$Zos.pathr0r __all__r rrrrexitrrrrs 0 R &linecache.cpython-36.opt-1.pyc000064400000007304152462730460012061 0ustar003 \@sndZddlZddlZddlZddlZdddgZdddZiaddZddd Z dd dZ dd d Z d dZ dS)zCache lines from Python source files. This is intended to read lines from modules imported -- hence if a filename is not found, it will look down the module search path for a file by that name. Ngetline clearcache checkcachecCs:t||}d|ko t|knr2||dSdSdS)N)getlineslen)filenamelinenomodule_globalslinesr !/usr/lib64/python3.6/linecache.pyrs  cCsiadS)zClear the cache entirely.N)cacher r r rrsc CsR|tkr(t|}t|dkr(t|dSy t||Stk rLtgSXdS)zGet the lines for a Python source file from the cache. Update the cache if it doesn't contain an entry for this file already.rN)rr updatecache MemoryErrorr)r r entryr r rr%s   rc Cs|dkrttj}n|tkr&|g}ndSx~|D]v}t|}t|dkrJq0|\}}}}|dkr`q0ytj|}Wntk rt|=w0YnX||jks||jkr0t|=q0WdS)zUDiscard cache entries that are out of date. (This is not checked upon each call!)Nr) listrkeysrosstatOSErrorst_sizest_mtime)r filenamesrsizemtimer fullnamerr r rr5s&   c "Cs|tkrtt|dkrt|=| s8|jdr<|jdrrNcSsg|] }|dqS) r ).0liner r r qszupdatecache..rr!r%)rr startswithendswithrrr lazycache ImportError splitlinespathisabssysjoin TypeErrorAttributeErrortokenizeopen readlinesrr) r r rrbasenamedatadirnamefpr rrr r rrRsV        rcCs|tkr tt|dkrdSdS| s:|jdr>|jdr>dS|rd|kr|jd}|d}t|dd }|r|rtj||}|ft|<dSdS) aSeed the cache for filename with module_globals. The module loader will be asked for the source only when getlines is called, not immediately. If there is an entry in the cache already, it is not altered. :return: True if a lazy load is registered in the cache, otherwise False. To register such a load a module loader with a get_source method must be found, the filename must be a cachable filename, and the filename must not be already cached. rTFrr __loader____name__ get_sourceN)rrr&r'getgetattr functoolspartial)r r nameloaderr: get_linesr r rr(s      r()N)N)N)N) __doc__r=r-rr1__all__rrrrrrr(r r r rs     Aqueue.cpython-36.pyc000064400000021065152462730460010333 0ustar003 \L" @sdZy ddlZWnek r,ddlZYnXddlmZddlmZmZddl m Z dddd d gZ Gd dde Z Gd dde ZGd ddZGdd d eZGdd d eZdS)z'A multi-producer, multi-consumer queue.N)deque)heappushheappop) monotonicEmptyFullQueue PriorityQueue LifoQueuec@seZdZdZdS)rz4Exception raised by Queue.get(block=0)/get_nowait().N)__name__ __module__ __qualname____doc__rr/usr/lib64/python3.6/queue.pyr sc@seZdZdZdS)rz4Exception raised by Queue.put(block=0)/put_nowait().N)r r r rrrrrrsc@seZdZdZd!ddZddZddZd d Zd d Zd dZ d"ddZ d#ddZ ddZ ddZ ddZddZddZdd ZdS)$rzjCreate a queue object with a given maximum size. If maxsize is <= 0, the queue size is infinite. rcCsN||_|j|tj|_tj|j|_tj|j|_tj|j|_d|_ dS)Nr) maxsize_init threadingZLockmutexZ Condition not_emptynot_fullall_tasks_doneunfinished_tasks)selfrrrr__init__s  zQueue.__init__c CsH|j8|jd}|dkr4|dkr*td|jj||_WdQRXdS)a.Indicate that a formerly enqueued task is complete. Used by Queue consumer threads. For each get() used to fetch a task, a subsequent call to task_done() tells the queue that the processing on the task is complete. If a join() is currently blocking, it will resume when all items have been processed (meaning that a task_done() call was received for every item that had been put() into the queue). Raises a ValueError if called more times than there were items placed in the queue. rz!task_done() called too many timesN)rr ValueErrorZ notify_all)rZ unfinishedrrr task_done2s  zQueue.task_donec Cs,|jx|jr|jjq WWdQRXdS)aBlocks until all items in the Queue have been gotten and processed. The count of unfinished tasks goes up whenever an item is added to the queue. The count goes down whenever a consumer thread calls task_done() to indicate the item was retrieved and all work on it is complete. When the count of unfinished tasks drops to zero, join() unblocks. N)rrwait)rrrrjoinHs z Queue.joinc Cs|j |jSQRXdS)z9Return the approximate size of the queue (not reliable!).N)r_qsize)rrrrqsizeUsz Queue.qsizec Cs|j |j SQRXdS)aReturn True if the queue is empty, False otherwise (not reliable!). This method is likely to be removed at some point. Use qsize() == 0 as a direct substitute, but be aware that either approach risks a race condition where a queue can grow before the result of empty() or qsize() can be used. To create code that needs to wait for all queued tasks to be completed, the preferred technique is to use the join() method. N)rr )rrrremptyZs z Queue.emptyc Cs0|j d|jko |jkSSQRXdS)aOReturn True if the queue is full, False otherwise (not reliable!). This method is likely to be removed at some point. Use qsize() >= n as a direct substitute, but be aware that either approach risks a race condition where a queue can shrink before the result of full() or qsize() can be used. rN)rrr )rrrrfullhsz Queue.fullTNc Cs|j|jdkr|s*|j|jkrtnz|dkrRxp|j|jkrN|jjq4WnR|dkrdtdn@t|}x4|j|jkr|t}|dkrt|jj|qpW|j||jd7_|j j WdQRXdS)aPut an item into the queue. If optional args 'block' is true and 'timeout' is None (the default), block if necessary until a free slot is available. If 'timeout' is a non-negative number, it blocks at most 'timeout' seconds and raises the Full exception if no free slot was available within that time. Otherwise ('block' is false), put an item on the queue if a free slot is immediately available, else raise the Full exception ('timeout' is ignored in that case). rNz''timeout' must be a non-negative numbergr) rrr rrrtime_putrrnotify)ritemblocktimeoutendtime remainingrrrputss&      z Queue.putc Cs|j|s|jstnn|dkrs   B__phello__.foo.cpython-36.pyc000064400000000171152462730460012043 0ustar003 \@@sdS)Nrrr&/usr/lib64/python3.6/__phello__.foo.pyscrypt.cpython-36.opt-1.pyc000064400000004304152462730460011304 0ustar003 \H@sdZddlZddlZddlmZddlmZ ej ej dZ eZ Gddde ddZdd d Zdd d Zed dddZeddddZeddddZeddddZgZx:eeeefD]*ZedeZereeejkrejeqW[[dS)zEWrapper to the POSIX crypt library call and associated functionality.N) SystemRandom) namedtuplez./c@seZdZdZddZdS)_MethodziClass representing a salt method per the Modular Crypt Format or the legacy 2-character crypt method.cCs dj|jS)Nz)formatname)selfr/usr/lib64/python3.6/crypt.py__repr__sz_Method.__repr__N)__name__ __module__ __qualname____doc__r rrrr r srz name ident salt_chars total_sizecCsH|dkrtd}|jr"dj|jnd}|djddt|jD7}|S)zsGenerate a salt for the specified method. If not specified, the strongest available method will be used. Nrz${}$css|]}tjtVqdS)N)_srZchoice _saltchars).0charrrr szmksalt..)methodsZidentrjoinrangeZ salt_chars)methodsrrr mksalts rcCs&|dkst|trt|}tj||S)aRReturn a string representing the one-way hash of a password, with a salt prepended. If ``salt`` is not specified or is ``None``, the strongest available method will be selected and a salt generated. Otherwise, ``salt`` may be one of the ``crypt.METHOD_*`` values, or a string as returned by ``crypt.mksalt()``. N) isinstancerr_cryptcrypt)ZwordZsaltrrr r#s rZCRYPT ZMD51"ZSHA2565?ZSHA5126jr)N)N)rrstringZ_stringZrandomrZ _SystemRandom collectionsrZ _namedtupleZ ascii_lettersZdigitsrrrrrZ METHOD_CRYPTZ METHOD_MD5Z METHOD_SHA256Z METHOD_SHA512r_methodZ_resultlenZ total_sizeappendrrrr s&    netrc.cpython-36.opt-1.pyc000064400000007376152462730460011272 0ustar003 \4@sXdZddlZddlZddlZddgZGdddeZGdddZedkrTe edS)z-An object-oriented interface to .netrc files.NnetrcNetrcParseErrorc@s"eZdZdZdddZddZdS)rz5Exception raised on syntax errors in the .netrc file.NcCs"||_||_||_tj||dS)N)filenamelinenomsg Exception__init__)selfrrrr /usr/lib64/python3.6/netrc.pyr szNetrcParseError.__init__cCsd|j|j|jfS)Nz%s (%s, line %s))rrr)r r r r __str__szNetrcParseError.__str__)NN)__name__ __module__ __qualname____doc__rr r r r r r s c@s.eZdZd ddZddZddZdd ZdS) rNcCsx|dk}|dkrFytjjtjdd}Wntk rDtdYnXi|_i|_t|}|j |||WdQRXdS)NHOMEz.netrcz'Could not find .netrc: $HOME is not set) ospathjoinenvironKeyErrorOSErrorhostsmacrosopen_parse)r file default_netrcfpr r r rs znetrc.__init__cCstj|}|jd7_|jjdd|_x|j}|j}}|sFPn|ddkrv|j|kr,t|dkr,|jjq,n|dkr|j}nz|dkrd}nl|dkr|j}g|j |<d |_ x4|jj} | s| d krd |_ P|j |j | qWq,nt d |||jd} d} } i|j |<x|j}|jds:|dkr~| r^| | | f|j |<|j|Pnt d ||t|f||jq|dks|dkr|j} q|dkr|j} q|dkrtjdkr|rtj|j} | jtjkr|ddl}y|j| jd}Wn tk r*d| j}YnXy|jtjd}Wn"tk rddtj}YnXt d||f||j| jtjtjB@rt d||j|j} nt d|||jqWq,WdS)Nz !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~#rmachinedefaultmacdefz  z zbad toplevel token %rz&malformed %s entry %s terminated by %sloginuseraccountpasswordposixzuid %sz9~/.netrc file owner (%s) does not match current user (%s)zY~/.netrc access too permissive: access permissions must restrict access to only the ownerzbad follower token %r>r r#r"r$)shlexZ wordcharsZ commentersreplacerZ get_tokenlenZinstreamreadlinerZ whitespaceappendrr startswithZ push_tokenreprrnamefstatfilenost_uidgetuidpwdgetpwuidrst_modestatS_IRWXGS_IRWXO)r rrrZlexerZ saved_linenoZtoplevelZttZ entrynameliner&r(r)Zpropr7Zfownerr'r r r r#s                  z netrc._parsecCs0||jkr|j|Sd|jkr(|jdSdSdS)z8Return a (user, account, password) tuple for given host.r#N)r)r hostr r r authenticatorsts     znetrc.authenticatorscCsd}xf|jjD]X}|j|}|d|d|dd7}|drT|d|dd7}|d|d d7}qWxF|jjD]8}|d |d7}x|j|D] }||7}qW|d7}qxW|S) z3Dump the class data in the format of a .netrc file.r zmachine z login rr%r!z account z password zmacdef )rkeysr)r Zrepr>ZattrsZmacror=r r r __repr__}s   znetrc.__repr__)N)r rrrrr?rBr r r r rs Q __main__) rrr+r:__all__rrrr printr r r r s  wpyclbr.cpython-36.opt-2.pyc000064400000012703152462730460011441 0ustar003 \4@sddlZddlZddlZddlZddlmZmZmZddddgZ iZ GdddZ GdddZ dd dZ dd dZdd d Zd dZddZddZedkredS)N)NAMEDEDENTOP readmodule readmodule_exClassFunctioncs$eZdZfddZddZZS)rcs4||_||_|dkrg}||_i|_||_||_dS)N)modulenamesupermethodsfilelineno)selfr r r r r) __class__/usr/lib64/python3.6/pyclbr.py__init__7szClass.__init__cCs||j|<dS)N)r )rr rrrr _addmethodAszClass._addmethod)__name__ __module__ __qualname__rr __classcell__rr)rrr5s c@seZdZddZdS)rcCs||_||_||_||_dS)N)r r r r)rr r r rrrrrFszFunction.__init__N)rrrrrrrrrDscCs:i}x0t||pgjD]\}}t|tr|||<qW|S)N) _readmoduleitems isinstancer)r pathreskeyvaluerrrrLs   cCst||p gS)N)r)r rrrrrXsc&!Cs|dk rd||f}n|}|tkr*t|Si}|tjkrL|dkrL|t|<|S|jd}|dkr|d|}||dd}t|||}|dk rd||f}d|krtdj|t||d|Sd} |dk r|} n |tj} tj j || } |t|<| j dk r| j |d<y| j j |} | dkr$|SWnttfk r@|SX| j j|} tj| } g}tj| j}y<x4|D]*\}}}}}|tkr|\}}x$|r|dd|kr|d=qWqt|dkrl|\}}x$|r|dd|kr|d=qWt|dd\}}}|tkrqt|rH|dd}t|trZ|j||nt||| |||<|jd|fqt|d krD|\}}x$|r|dd|kr|d=qWt|dd\}}}|tkrȐqtt|dd\}}}d}|d krg}d}g}xt|dd\}}}|dkr|dkrd j|}||krD||}nL|jd}t|dkr|d} |d}| tkrt| }!||!kr|!|}|j|g}|d kr|d7}nX|d kr|d8}|dkr Pn8|d kr|dkrn"|tt fkr|dkr|j|qW|}t|||| |}|s2|||<|j||fqt|dkr|ddkrt!|}"xl|"D]d\}#}$yL|dkrt|#|n2yt|#||Wn tk rt|#gYnXWn YnXqjWn|dkrt|ddkrtt"|\}#}|# st|dkrqtt!|}yt|#||}!WnwtYnXxd|D]\\}}%||!krd|!|||%p`|<n4|dkr>x(|!D] }|ddkrt|!|||<qtWq>WqtWWnt#k rYnX| j$|S)Nz%s.%s.r__path__zNo package named {}defclass(),importfrom*_r/r/r/r/r/r/)r'r(r/)%_modulessysbuiltin_module_namesrfindr ImportErrorformatr importlibutil_find_spec_from_pathsubmodule_search_locationsloader get_sourceAttributeError get_filenameioStringIOtokenizegenerate_tokensreadlinernextrrrrrappendjoinsplitlenr _getnamelist_getname StopIterationclose)&r rZ inpackageZ fullmoduledictipackageZ submoduleparentfZ search_pathspecsourceZfnamestackg tokentypetokenstartZ_end_linerZ thisindentZ meth_nameZ cur_class class_nameZinheritnameslevelr ncmdmodulesmodZ_mod2Zn2rrrras                                           "rcCstg}xjt|\}}|sP|dkr.t|\}}nd}|j||fx |dkr`d|kr`t|d}qBW|dkrPqW|S)Nasr( r!)rJrErD)rUr[r rWZname2rrrrIs rIcCsg}t|dd\}}|tkr0|dkr0d|fS|j|xJt|dd\}}|dkrZPt|dd\}}|tkrxP|j|qTsz_main..)rr%r"z defr#)osoperatorrfr2argvrexistsdirnamebasenamelowerendswithrlistvaluessortrrprintr r rsortedr rr) rkrfrbrrMZobjsobjr r rrrr_mainFs*         ry__main__)N)N)N)r?r2importlib.utilr7rArWrrr__all__r1rrrrrrIrJryrrrrr*s"  ?fnmatch.cpython-36.opt-1.pyc000064400000005474152462730460011574 0ustar003 \^ @sjdZddlZddlZddlZddlZddddgZddZejdd d d d Zd dZ ddZ ddZ dS)aFilename matching with shell patterns. fnmatch(FILENAME, PATTERN) matches according to the local convention. fnmatchcase(FILENAME, PATTERN) always takes case in account. The functions operate by translating the pattern into a regular expression. They cache the compiled regular expressions for speed. The function translate(PATTERN) returns a regular expression corresponding to PATTERN. (It does not compile it.) Nfilterfnmatch fnmatchcase translatecCs"tjj|}tjj|}t||S)aTest whether FILENAME matches PATTERN. Patterns are Unix shell style: * matches everything ? matches any single character [seq] matches any character in seq [!seq] matches any char not in seq An initial period in FILENAME is not special. Both FILENAME and PATTERN are first case-normalized if the operating system requires it. If you don't want this, use fnmatchcase(FILENAME, PATTERN). )ospathnormcaser)namepatr /usr/lib64/python3.6/fnmatch.pyrs  T)maxsizetypedcCs<t|tr(t|d}t|}t|d}nt|}tj|jS)Nz ISO-8859-1) isinstancebytesstrrrecompilematch)r Zpat_strZres_strresr r r _compile_pattern&s    rcCspg}tjj|}t|}tjtkrDxH|D]}||r(|j|q(Wn(x&|D]}|tjj|rJ|j|qJW|S)z3Return the subset of the list NAMES that match PAT.)rrrr posixpathappend)namesr resultrr r r r r0s    cCst|}||dk S)zTest whether FILENAME matches PATTERN, including case. This is a version of fnmatch() which doesn't case-normalize its arguments. N)r)r r rr r r r@scCsHdt|}}d}x*||kr>||}|d}|dkrB|d}q|dkrT|d}q|dkr.|}||kr~||d kr~|d}||kr||d kr|d}x ||kr||d kr|d}qW||kr|d }n^|||jd d }|d}|dd kr d|dd}n|ddkr d |}d||f}q|tj|}qWd|S)zfTranslate a shell PATTERN to a regular expression. There is no way to quote meta-characters. r*z.*?.[!]z\[\z\\^Nz%s[%s]z (?s:%s)\Z)lenreplacerescape)r inrcjZstuffr r r rJs8     ) __doc__rrr functools__all__r lru_cacherrrrr r r r  s   tokenize.cpython-36.pyc000064400000044331152462730460011040 0ustar003 \8s-@sdZdZdZddlmZddlmZmZddl Z ddl m Z ddl m Z ddl ZddlZddlZdd lTejd ejZejd ejZddlZejd d dddddgZ[eZd ee<edZdee<edZdee<ed7Zeeeee e!e"e#e$e%e&e'e(e)e*e+e,e-e.e/e0e1e2e3e4e5e6e7e8e9e:e;ee?e@eAeBeCeDeEeFeGd,ZHGddde jIddZJddZKddZLddZMdZNd ZOeNeLd!eNeMeOZPd"ZQd#ZRd$ZSd%ZTd&ZUeKeReSeTeUZVd'ZWeKd(d)eMeWZXd*eWZYeKeXeYZZeKd+eZd,Z[eKe[eZeVZ\d-d.Z]d/d0Z^eKe]Z_d1Z`d2Zad3Zbd4ZceKe_d5e_d6ZdeKe_d7e_d8ZeeKd9d:d;dd?d@ZfdAZgeKdBdCdDZheKefegehZieKe\eieeeQZjePejZkeKe_dEeKdFd!e_dGeKdHd!ZleKdIeOedZmeNeKeme\eieleQZniZox@e]D]6Zpe`eoepdF<eaeoepdH<ebeoepd5<eceoepd6<qWeqZreqZsx\e]D]RZtx$etdHetdFfD]Zuerjveuq8Wx$etd6etd5fD]Zuesjveuq^Wq"WdJZwGdKdLdLexZyGdMdNdNexZzGdOdPdPZ{dQdZ|dRdSZ}dTdZ~dUdVZdWd ZdXdYZdZd[Zd\d]Zed^kredS)_aoTokenization help for Python programs. tokenize(readline) is a generator that breaks a stream of bytes into Python tokens. It decodes the bytes according to PEP-0263 for determining source file encoding. It accepts a readline-like method which is called repeatedly to get the next line of input (or b"" for EOF). It generates 5-tuples with these members: the token type (see token.py) the token (a string) the starting (row, column) indices of the token (a 2-tuple of ints) the ending (row, column) indices of the token (a 2-tuple of ints) the original line (string) It is designed to match the working of the Python tokenizer exactly, except that it produces COMMENT tokens for comments and gives type OP for all operators. Additionally, all token lists start with an ENCODING token which tells you which encoding was used to decode the bytes stream. zKa-Ping Yee zpGvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip Montanaro, Raymond Hettinger, Trent Nelson, Michael Foord)open)lookupBOM_UTF8N) TextIOWrapper)chain)*z&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)COMMENTtokenizedetect_encodingNL untokenizeENCODING TokenInfo),()[]:,;+-r/|&<>=.%{}z==z!=z<=z>=~^z<>z**z+=z-=z*=z/=z%=z&=z|=z^=z<<=z>>=z**=z//z//=@z@=c@s eZdZddZeddZdS)rcCs$d|jt|jf}d|j|dS)Nz%d (%s)z8TokenInfo(type=%s, string=%r, start=%r, end=%r, line=%r))type)r(tok_name_replace)selfannotated_typer- /usr/lib64/python3.6/tokenize.py__repr__dszTokenInfo.__repr__cCs(|jtkr|jtkrt|jS|jSdS)N)r(OPstringEXACT_TOKEN_TYPES)r+r-r-r. exact_typeis zTokenInfo.exact_typeN)__name__ __module__ __qualname__r/propertyr3r-r-r-r.rcsztype string start end linecGsddj|dS)Nrrr)join)choicesr-r-r.grouppsr:cGs t|dS)Nr)r:)r9r-r-r.anyqsr;cGs t|dS)N?)r:)r9r-r-r.maybersr=z[ \f\t]*z #[^\r\n]*z\\\r?\nz\w+z0[xX](?:_?[0-9a-fA-F])+z0[bB](?:_?[01])+z0[oO](?:_?[0-7])+z(?:0(?:_?0)*|[1-9](?:_?[0-9])*)z[eE][-+]?[0-9](?:_?[0-9])*z)[0-9](?:_?[0-9])*\.(?:[0-9](?:_?[0-9])*)?z\.[0-9](?:_?[0-9])*z[0-9](?:_?[0-9])*z[0-9](?:_?[0-9])*[jJ]z[jJ]cCsnddddddg}tdg}xN|D]F}x@tj|D]2}x,tjdd |DD]}|jdj|qJWq0Wq W|S) NbrufbrfrcSsg|]}||jfqSr-)upper).0cr-r-r. sz(_all_string_prefixes..)set _itertools permutationsproductaddr8)_valid_string_prefixesresultprefixtr@r-r-r._all_string_prefixess  rRcCstj|tjS)N)recompileUNICODE)exprr-r-r._compilesrWz[^'\\]*(?:\\.[^'\\]*)*'z[^"\\]*(?:\\.[^"\\]*)*"z%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''z%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""z'''z"""z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"z\*\*=?z>>=?z<<=?z!=z//=?z->z[+\-*/%&@|^=<>]=?r%z[][(){}]z\r?\nz\.\.\.z[:;.,@]z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"z \\\r?\n|\Zc@s eZdZdS) TokenErrorN)r4r5r6r-r-r-r.r[sr[c@s eZdZdS)StopTokenizingN)r4r5r6r-r-r-r.r\sr\c@s,eZdZddZddZddZddZd S) UntokenizercCsg|_d|_d|_d|_dS)Nrr)tokensprev_rowprev_colencoding)r+r-r-r.__init__szUntokenizer.__init__cCs|\}}||jks&||jkr>||jkr>tdj|||j|j||j}|rb|jjd|d|_||j}|r|jjd|dS)Nz+start ({},{}) precedes previous end ({},{})z\ r )r_r` ValueErrorformatr^append)r+startrowcol row_offset col_offsetr-r-r.add_whitespaces  zUntokenizer.add_whitespacec Cs4t|}g}d}x|D] }t|dkr8|j||P|\}}}} } |tkrV||_q|tkr`P|tkrv|j|qnl|tkr|j | \|_ |_ qnL|t t fkrd}n:|r|r|d} |dt| kr|jj| t| |_ d}|j||jj|| \|_ |_ |t t fkr|j d7_ d|_ qWdj|jS)NFrTrrrD)iterlencompatr ra ENDMARKERINDENTrfDEDENTpopr_r`NEWLINEr r^rlr8) r+iterableitindents startlinerQtok_typetokenrgendlineindentr-r-r.r sF            zUntokenizer.untokenizec Csg}|jj}|dttfk}d}xt|g|D]}|dd\}} |tkrR| |_q.|ttt t fkrj| d7} |t kr|r~d| } d}nd}|t kr|j| q.n>|t kr|jq.n*|ttfkrd}n|r|r||dd}|| q.WdS)NrFrrcTrrm)r^rfrur rr raNAMENUMBERASYNCAWAITSTRINGrrrsrt) r+r{rvrx toks_appendry prevstringtoktoknumtokvalr-r-r.rps8   zUntokenizer.compatN)r4r5r6rbrlr rpr-r-r-r.r]s %r]cCs*t}|j|}|jdk r&|j|j}|S)aTransform tokens back into Python source code. It returns a bytes object, encoded using the ENCODING token, which is the first token sequence output by tokenize. Each element returned by the iterable must be a token sequence with at least two elements, a token number and token value. If only two tokens are passed, the resulting output is poor. Round-trip invariant for full input: Untokenized source will match input source exactly Round-trip invariant for limited input: # Output bytes will tokenize back to the input t1 = [tok[:2] for tok in tokenize(f.readline)] newcode = untokenize(t1) readline = BytesIO(newcode).readline t2 = [tok[:2] for tok in tokenize(readline)] assert t1 == t2 N)r]r raencode)rvutoutr-r-r.r =s    cCsH|ddjjdd}|dks*|jdr.dS|d ks@|jdrDdS|S)z(Imitates get_normal_name in tokenizer.c.N _rzutf-8zutf-8-latin-1 iso-8859-1 iso-latin-1latin-1- iso-8859-1- iso-latin-1-)rrr)rrr)lowerreplace startswith)orig_encencr-r-r._get_normal_nameXs rc sy jjWntk r$dYnXdd}d}fdd}fdd}|}|jtrpd|d d}d }|s||gfS||}|r||gfStj|s||gfS|}|s||gfS||}|r|||gfS|||gfS) a The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argument, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a list of any lines (left as bytes) it has read in. It detects the encoding from the presence of a utf-8 bom or an encoding cookie as specified in pep-0263. If both a bom and a cookie are present, but disagree, a SyntaxError will be raised. If the encoding cookie is an invalid charset, raise a SyntaxError. Note that if a utf-8 bom is found, 'utf-8-sig' is returned. If no encoding is specified, then the default of 'utf-8' will be returned. NFzutf-8c s yStk rdSXdS)N) StopIterationr-)readliner-r. read_or_stop{sz%detect_encoding..read_or_stopcsy|jd}Wn4tk rBd}dk r6dj|}t|YnXtj|}|sVdSt|jd}y t|}Wn:t k rdkrd|}n dj|}t|YnXr|dkr؈dkrd}n dj}t||d 7}|S) Nzutf-8z'invalid or missing encoding declarationz {} for {!r}rzunknown encoding: zunknown encoding for {!r}: {}zencoding problem: utf-8z encoding problem for {!r}: utf-8z-sig) decodeUnicodeDecodeErrorre SyntaxError cookie_rematchrr:r LookupError)r} line_stringmsgrracodec) bom_foundfilenamer-r. find_cookies6     z$detect_encoding..find_cookieTrz utf-8-sig)__self__nameAttributeErrorrrblank_rer)rradefaultrrfirstsecondr-)rrrr.r cs8   &       c CsVt|d}y0t|j\}}|jdt||dd}d|_|S|jYnXdS)zXOpen a file in read only mode using the encoding detected by detect_encoding(). rbrT)line_bufferingr?N) _builtin_openr rseekrmodeclose)rbufferralinestextr-r-r.rs  rcCsBddlm}m}t|\}}t|d}|d}t||||j|S)a The tokenize() generator requires one argument, readline, which must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as bytes. Alternatively, readline can be a callable function terminating with StopIteration: readline = open(myfile, 'rb').__next__ # Example of alternate readline The generator produces 5-tuples with these members: the token type; the token string; a 2-tuple (srow, scol) of ints specifying the row and column where the token begins in the source; a 2-tuple (erow, ecol) of ints specifying the row and column where the token ends in the source; and the line on which the token was found. The line passed is the logical line; continuation lines are included. The first token sequence will always be an ENCODING token which tells you which encoding was used to decode the bytes stream. r)rrepeatr) itertoolsrrr rn _tokenize__next__)rrrraconsumedrl_genemptyr-r-r.r s   c!cs"d}}}d}d!\}}d}dg} d} d} d} d} |dk rX|dkrFd}tt|d"d#dVd}d}xy|}|}Wntk rd}YnX|dk r|j|}|d7}dt|}}|r|std ||j|}|r|jd}}tt||d||||f||Vd$\}}d}nf|rn|d%dd krn|d&dd krntt ||||t|f|Vd}d}qdn||}||}qdn@|dkr| r|sPd}xf||kr||dkr|d7}n6||dkr|t dt }n||dkrd}nP|d7}qW||krP||dkr||dkr||dj d}|t|}tt |||f||t|f|Vtt ||d||f|t|f|Vqdtt t f||dk||d||f|t|f|Vqd|| d'kr | j|tt|d||df||f|Vxv|| d(kr|| kr8tdd|||f| dd)} | rd| | d*krdd} d} d} ttd||f||f|VqW| r| r| | d+krd} d} d} n|std|dfd}x||krzttj||}|rL|jd\}}||f||f|}}}||krq|||||}}||ksZ|dkrp|dkrp|dkrptt||||Vqv|dkr| r| Vd} |dkrtt ||||Vntt||||V| rJd} qv|dkr |jd st| r| Vd} tt ||||Vqv|tkr~tt|}|j||}|r`|jd}|||}tt||||f|Vn||f}||d}|}Pqv|tks|dd tks|dd tkr |d,dkr ||f}ttj|ptj|dptj|d }||dd}}|}Pntt||||Vqv|jr|d-kr^| r^t|dkrJtnt||||Vqtt ||||}|dkr| r|} q|dkr| r| j!t kr| j"dkrd} | d.} tt| j"| j#| j| j$Vd} | r| Vd} |VnX|dkrd}nH|dkr|d7}n|d kr(|d8}| r8| Vd} tt%||||Vn*tt ||||f||df|V|d7}qWqdW| r| Vd} |r|d/dkrttd|dt|f|dt|dfdVx0| ddD] } ttd|df|dfdVqWtt&d|df|dfdVdS)0Nr 0123456789rDFz utf-8-sigzutf-8rrzEOF in multi-line stringrz\ rz\ rc  z# #z z3unindent does not match any outer indentation levelz zEOF in multi-line statementr!z...T asyncawaitdef\z([{z)]})rDr)rr)rr)rDrrmrmrmrmrmrm)rrrmrm)'rr rrror[rr|r ERRORTOKENtabsizerstriprr rfrrIndentationErrorrsrW PseudoTokenspanrruendswithAssertionError triple_quotedendpats single_quotedget isidentifierrrrr(r1rgr}r0rq)!rralnumparenlev continuednumcharscontstrneedcontcontlinerxstashed async_defasync_def_indent async_def_nl last_liner}posmaxstrstartendprogendmatchr|column comment_tokennl_pos pseudomatchrgsposeposr{initialrr~r-r-r.rst      *      "                          . rcCs t|dS)N)r)rr-r-r.generate_tokenssrc s(ddl}dddfdd }|jdd}|jdd d d d |jd ddddd|j}y|jr|j}t|d}tt|j}WdQRXnd}t t j jd}xF|D]>}|j }|j r|j}d|j|j} td| t||jfqWWn8tk r:} z2| jddd\} } || jd|| | fWYdd} ~ Xntk r} z*| jd\} } || jd|| | fWYdd} ~ Xntk r} z|| |WYdd} ~ Xnxtk r} z|| WYdd} ~ XnNtk rtdYn2tk r"} zd| WYdd} ~ XnXdS)NrcSst|tjddS)N)file)printsysstderr)messager-r-r.perrorszmain..perrorcsR|r"|f||f}d|n"|r8d||fn d|tjddS)Nz%s:%d:%d: error: %sz %s: error: %sz error: %sr)rexit)rrlocationargs)rr-r.errors zmain..errorzpython -m tokenize)progrr<z filename.pyz'the file to tokenize; defaults to stdin)destnargsmetavarhelpz-ez--exactexact store_truez(display token names using the exact type)ractionrrzz %d,%d-%d,%d:z%-20s%-15s%-15rrrz interrupted zunexpected error: %s)NN)argparseArgumentParser add_argument parse_argsrrlistr rrrstdinr(rr3rgr|rr)r1rrr[rOSErrorKeyboardInterrupt Exception) rrparserrrrAr^r{ token_type token_rangeerrr}rr-)rr.mainsN    &&  r__main__)__doc__ __author__ __credits__builtinsrrcodecsrr collectionsiorrrrJrSrr{rTASCIIrr__all__N_TOKENSrr)r r LPARRPARLSQBRSQBCOLONCOMMASEMIPLUSMINUSSTARSLASHVBARAMPERLESSGREATEREQUALDOTPERCENTLBRACERBRACEEQEQUALNOTEQUAL LESSEQUAL GREATEREQUALTILDE CIRCUMFLEX LEFTSHIFT RIGHTSHIFT DOUBLESTAR PLUSEQUALMINEQUAL STAREQUAL SLASHEQUAL PERCENTEQUAL AMPEREQUAL VBAREQUALCIRCUMFLEXEQUALLEFTSHIFTEQUALRIGHTSHIFTEQUALDOUBLESTAREQUAL DOUBLESLASHDOUBLESLASHEQUALATATEQUALr2 namedtuplerr:r;r= WhitespaceCommentIgnoreName Hexnumber Binnumber Octnumber Decnumber IntnumberExponent PointfloatExpfloat Floatnumber ImagnumberNumberrRrW StringPrefixSingleDoubleSingle3Double3TripleStringOperatorBracketSpecialFunny PlainTokenTokenContStr PseudoExtrasrr_prefixrIrrrQr@rMrr r[r\r]r rr r rrrr4r-r-r-r.s                   _ ]x< xdrlib.cpython-36.pyc000064400000020160152462730460010466 0ustar003 \@sxdZddlZddlmZddlmZddddgZGd ddeZGd ddeZ d d Z Gd ddZ GdddZ dS)zRImplements (a subset of) Sun XDR -- eXternal Data Representation. See: RFC 1014 N)BytesIO)wrapsErrorPackerUnpackerConversionErrorc@s(eZdZdZddZddZddZdS) rzException class for this module. Use: except xdrlib.Error as var: # var has the Error instance for the exception Public ivars: msg -- contains the message cCs ||_dS)N)msg)selfrr /usr/lib64/python3.6/xdrlib.py__init__szError.__init__cCs t|jS)N)reprr)r r r r __repr__szError.__repr__cCs t|jS)N)strr)r r r r __str__sz Error.__str__N)__name__ __module__ __qualname____doc__r rrr r r r rs c@s eZdZdS)rN)rrrr r r r r scstfdd}|S)z5 Wrap any raised struct.errors in a ConversionError. csDy ||Stjk r>}zt|jddWYdd}~XnXdS)Nr)structerrorrargs)r valuee)functionr r result&s z&raise_conversion_error..result)r)rrr )rr raise_conversion_error#src@seZdZdZddZddZddZeZedd Z ed d Z e Z d d Z ddZ e ZeddZeddZddZeZddZeZeZddZddZddZdS)rz0Pack various data representations into a buffer.cCs |jdS)N)reset)r r r r r 2szPacker.__init__cCs t|_dS)N)r _Packer__buf)r r r r r5sz Packer.resetcCs |jjS)N)rgetvalue)r r r r get_buffer8szPacker.get_buffercCs|jjtjd|dS)Nz>L)rwriterpack)r xr r r pack_uint=szPacker.pack_uintcCs|jjtjd|dS)Nz>l)rr!rr")r r#r r r pack_intAszPacker.pack_intcCs"|r|jjdn |jjddS)Nss)rr!)r r#r r r pack_boolGszPacker.pack_boolcCsy|j|d?d@Wn8ttjfk rN}zt|jddWYdd}~XnXy|j|d@Wn8ttjfk r}zt|jddWYdd}~XnXdS)N lr)r$ TypeErrorrrrr)r r#rr r r pack_uhyperKs"zPacker.pack_uhypercCs|jjtjd|dS)Nz>f)rr!rr")r r#r r r pack_floatWszPacker.pack_floatcCs|jjtjd|dS)Nz>d)rr!rr")r r#r r r pack_double[szPacker.pack_doublecCsP|dkrtd|d|}|ddd}||t|d}|jj|dS)Nrz fstring size must be nonnegative) ValueErrorlenrr!)r nsdatar r r pack_fstring_s  zPacker.pack_fstringcCs"t|}|j||j||dS)N)r0r$r4)r r2r1r r r pack_stringis zPacker.pack_stringcCs.x|D]}|jd||qW|jddS)Nr)r$)r list pack_itemitemr r r pack_listqs   zPacker.pack_listcCs.t||krtdx|D] }||qWdS)Nzwrong array size)r0r/)r r1r7r8r9r r r pack_farrayws  zPacker.pack_farraycCs$t|}|j||j|||dS)N)r0r$r;)r r7r8r1r r r pack_array}s zPacker.pack_arrayN)rrrrr rr Zget_bufrr$r%Z pack_enumr&r)Z pack_hyperr*r+r4Z pack_fopaquer5Z pack_opaqueZ pack_bytesr:r;r<r r r r r/s*     c@seZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ e Z ddZ ddZddZddZddZddZeZddZeZeZd d!Zd"d#Zd$d%Zd&S)'rz;Unpacks various data representations from the given buffer.cCs|j|dS)N)r)r r3r r r r szUnpacker.__init__cCs||_d|_dS)Nr)_Unpacker__buf_Unpacker__pos)r r3r r r rszUnpacker.resetcCs|jS)N)r>)r r r r get_positionszUnpacker.get_positioncCs ||_dS)N)r>)r Zpositionr r r set_positionszUnpacker.set_positioncCs|jS)N)r=)r r r r r szUnpacker.get_buffercCs|jt|jkrtddS)Nzunextracted data remains)r>r0r=r)r r r r donesz Unpacker.donecCsB|j}|d|_}|j||}t|dkr2ttjd|dS)Nr-z>Lr)r>r=r0EOFErrorrunpack)r ijr3r r r unpack_uints  zUnpacker.unpack_uintcCsB|j}|d|_}|j||}t|dkr2ttjd|dS)Nr-z>lr)r>r=r0rBrrC)r rDrEr3r r r unpack_ints  zUnpacker.unpack_intcCs t|jS)N)boolrG)r r r r unpack_boolszUnpacker.unpack_boolcCs |j}|j}t|d>|BS)Nr')rFint)r hilor r r unpack_uhyperszUnpacker.unpack_uhypercCs|j}|dkr|d}|S)Nll)rM)r r#r r r unpack_hyperszUnpacker.unpack_hypercCsB|j}|d|_}|j||}t|dkr2ttjd|dS)Nr-z>fr)r>r=r0rBrrC)r rDrEr3r r r unpack_floats  zUnpacker.unpack_floatcCsB|j}|d|_}|j||}t|dkr2ttjd|dS)Nz>dr)r>r=r0rBrrC)r rDrEr3r r r unpack_doubles  zUnpacker.unpack_doublecCsT|dkrtd|j}||ddd}|t|jkrr0r=rB)r r1rDrEr r r unpack_fstringszUnpacker.unpack_fstringcCs|j}|j|S)N)rFrR)r r1r r r unpack_stringszUnpacker.unpack_stringcCsFg}x<|j}|dkrP|dkr.td|f|}|j|qW|S)Nrr6z0 or 1 expected, got %r)rFrappend)r unpack_itemr7r#r9r r r unpack_listszUnpacker.unpack_listcCs&g}xt|D]}|j|qW|S)N)rangerT)r r1rUr7rDr r r unpack_farrayszUnpacker.unpack_farraycCs|j}|j||S)N)rFrX)r rUr1r r r unpack_arrayszUnpacker.unpack_arrayN)rrrrr rr?r@r rArFrGZ unpack_enumrIrMrNrOrQrRZunpack_fopaquerSZ unpack_opaqueZ unpack_bytesrVrXrYr r r r rs.  ) rrior functoolsr__all__ Exceptionrrrrrr r r r s    Utraceback.cpython-36.opt-1.pyc000064400000046300152462730460012064 0ustar003 \[@s:dZddlZddlZddlZddlZddddddd d d d d ddddddddgZd3ddZddZd4ddZd5dd Z d6ddZ dZ dZ d7dd Z d8d dZd!dZd"d#Zd$d%Zd9d&d Zd:d'd Zd;d(d Zdd+dZd,dZGd-ddZd.dZd/dZd0ZGd1ddeZGd2ddZdS)?z@Extract, format and print information about Python stack traces.N extract_stack extract_tbformat_exceptionformat_exception_only format_list format_stack format_tb print_exc format_excprint_exception print_last print_stackprint_tb clear_frames FrameSummary StackSummaryTracebackException walk_stackwalk_tbcCs8|dkrtj}x$tj|jD]}t||ddqWdS)zyPrint the list of tuples as returned by extract_tb() or extract_stack() as a formatted stack trace to the given file.N)fileend)sysstderrr from_listformatprint)extracted_listritemr!/usr/lib64/python3.6/traceback.py print_listsr!cCstj|jS)aFormat a list of tuples or FrameSummary objects for printing. Given a list of tuples or FrameSummary objects as returned by extract_tb() or extract_stack(), return a list of strings ready for printing. Each string in the resulting list corresponds to the item with the same index in the argument list. Each string ends in a newline; the strings may contain internal newlines as well, for those items whose source text line is not None. )rrr)rrrr rs cCstt||d|ddS)aPrint up to 'limit' stack trace entries from the traceback 'tb'. If 'limit' is omitted or None, all entries are printed. If 'file' is omitted or None, the output goes to sys.stderr; otherwise 'file' should be an open file or file-like object with a write() method. )limit)rN)r!r)tbr"rrrr r-scCst||djS)z5A shorthand for 'format_list(extract_tb(tb, limit))'.)r")rr)r#r"rrr r7scCstjt||dS)a# Return a StackSummary object representing a list of pre-processed entries from traceback. This is useful for alternate formatting of stack traces. If 'limit' is omitted or None, all entries are extracted. A pre-processed stack trace entry is a FrameSummary object containing attributes filename, lineno, name, and line representing the information that is usually printed for a stack trace. The line is a string with leading and trailing whitespace stripped; if the source is not available it is None. )r")rextractr)r#r"rrr r;s zG The above exception was the direct cause of the following exception: zF During handling of the above exception, another exception occurred: TcCsF|dkrtj}x2tt||||dj|dD]}t||ddq,WdS)aPrint exception up to 'limit' stack trace entries from 'tb' to 'file'. This differs from print_tb() in the following ways: (1) if traceback is not None, it prints a header "Traceback (most recent call last):"; (2) it prints the exception type and value after the stack trace; (3) if type is SyntaxError and value has the appropriate format, it prints the line where the syntax error occurred with a caret on the next line indicating the approximate position of the error. N)r")chainr)rr)rrrtyperr)etypevaluer#r"rr%linerrr r Ws cCs ttt||||dj|dS)azFormat a stack trace and the exception information. The arguments have the same meaning as the corresponding arguments to print_exception(). The return value is a list of strings, each ending in a newline and some containing internal newlines. When these lines are concatenated and printed, exactly the same text is printed as does print_exception(). )r")r%)listrr&r)r'r(r#r"r%rrr rls cCstt||djS)aFormat the exception part of a traceback. The arguments are the exception type and value such as given by sys.last_type and sys.last_value. The return value is a list of strings, each ending in a newline. Normally, the list contains a single string; however, for SyntaxError exceptions, it contains several lines that (when printed) display detailed information about where the syntax error occurred. The message indicating which exception occurred is always the last string in the list. N)r*rr)r'r(rrr r|scCs0t|}|dks| r d|}n d||f}|S)Nz%s z%s: %s ) _some_str)r'r(valuestrr)rrr _format_final_exc_lines   r-c Cs"yt|Sdt|jSdS)Nz)strr&__name__)r(rrr r+sr+cCsttj|||ddS)z>Shorthand for 'print_exception(*sys.exc_info(), limit, file)'.)r"rr%N)r rexc_info)r"rr%rrr r scCsdjttj||dS)z%Like print_exc() but return a string.r)r"r%)joinrrr0)r"r%rrr r scCs.ttdstdttjtjtj|||dS)znThis is a shorthand for 'print_exception(sys.last_type, sys.last_value, sys.last_traceback, limit, file)'. last_typezno last exceptionN)hasattrr ValueErrorr r2 last_valuelast_traceback)r"rr%rrr r s cCs*|dkrtjj}tt||d|ddS)zPrint a stack trace from its invocation point. The optional 'f' argument can be used to specify an alternate stack frame at which to start. The optional 'limit' and 'file' arguments have the same meaning as for print_exception(). N)r")r)r _getframef_backr!r)fr"rrrr r s cCs"|dkrtjj}tt||dS)z5Shorthand for 'format_list(extract_stack(f, limit))'.N)r")rr7r8rr)r9r"rrr rs cCs0|dkrtjj}tjt||d}|j|S)asExtract the raw traceback from the current stack frame. The return value has the same format as for extract_tb(). The optional 'f' and 'limit' arguments have the same meaning as for print_stack(). Each item in the list is a quadruple (filename, line number, function name, text), and the entries are in order from oldest to newest stack frame. N)r")rr7r8rr$rreverse)r9r"stackrrr rs  c Cs<x6|dk r6y|jjWntk r,YnX|j}qWdS)zEClear all references to local variables in the frames of a traceback.N)tb_frameclear RuntimeErrortb_next)r#rrr rs  c@sReZdZdZdZdddd d d Zd d ZddZddZddZ e ddZ dS)ra,A single frame from a traceback. - :attr:`filename` The filename for the frame. - :attr:`lineno` The line within filename for the frame that was active when the frame was captured. - :attr:`name` The name of the function or method that was executing when the frame was captured. - :attr:`line` The text from the linecache module for the of code that was running when the frame was captured. - :attr:`locals` Either None if locals were not supplied, or a dict mapping the name to the repr() of the variable. filenamelinenoname_linelocalsTN) lookup_linerDr)cCsF||_||_||_||_|r"|j|rsz(FrameSummary.__init__..N)r@rArBrCr)dictitemsrD)selfr@rArBrErDr)rrr __init__s zFrameSummary.__init__cCs`t|tr:|j|jko8|j|jko8|j|jko8|j|jkSt|tr\|j|j|j|jf|kStS)N) isinstancerr@rArBrDtupler)NotImplemented)rMotherrrr __eq__s      zFrameSummary.__eq__cCs|j|j|j|jf|S)N)r@rArBr))rMposrrr __getitem__szFrameSummary.__getitem__cCst|j|j|j|jgS)N)iterr@rArBr))rMrrr __iter__szFrameSummary.__iter__cCsdj|j|j|jdS)Nz7)r@rArB)rr@rArB)rMrrr __repr__szFrameSummary.__repr__cCs&|jdkr tj|j|jj|_|jS)N)rC linecachegetliner@rAstrip)rMrrr r)s zFrameSummary.line)r@rArBrCrD) r/ __module__ __qualname____doc__ __slots__rNrSrUrWrXpropertyr)rrrr rs  ccs8|dkrtjjj}x|dk r2||jfV|j}qWdS)zWalk a stack yielding the frame and line number for each frame. This will follow f.f_back from the given frame. If no frame is given, the current stack is used. Usually used with StackSummary.extract. N)rr7r8f_lineno)r9rrr r"s    ccs&x |dk r |j|jfV|j}qWdS)zWalk a traceback yielding the frame and line number for each frame. This will follow tb.tb_next (and thus is in the opposite order to walk_stack). Usually used with StackSummary.extract. N)r< tb_linenor?)r#rrr r/s c@s:eZdZdZeddddddZedd Zd d ZdS) rzA stack of frames.NTF)r" lookup_linescapture_localsc Cs|dkr(ttdd}|dk r(|dkr(d}|dk rV|dkrFtj||}ntj|| d}|}t}xb|D]Z\}}|j} | j} | j } |j | t j | |j |r|j} nd} |jt| || d| dqhWx|D]} t j| qW|rx|D] }|jqW|S)a?Create a StackSummary from a traceback or stack object. :param frame_gen: A generator that yields (frame, lineno) tuples to include in the stack. :param limit: None to include all frames or the number of frames to include. :param lookup_lines: If True, lookup lines for each frame immediately, otherwise lookup is deferred until the frame is rendered. :param capture_locals: If True, the local variables from each frame will be captured as object representations into the FrameSummary. Ntracebacklimitr)maxlenF)rErD)getattrr itertoolsislice collectionsdequesetf_code co_filenameco_nameaddrY lazycache f_globalsf_localsappendr checkcacher)) klass frame_genr"rdreresultfnamesr9rAcor@rBrtrrr r$?s6     zStackSummary.extractcCsPt}xD|D]<}t|tr&|j|q |\}}}}|jt||||dq W|S)z Create a StackSummary object from a supplied list of FrameSummary objects or old-style list of tuples. )r))rrOrru)rwa_listryframer@rArBr)rrr ros     zStackSummary.from_listc Csxg}d}d}d}d}x$|D]}|dksX||jksX|dksX||jksX|dksX||jkr|tkr|t8}|jd|d|dkrdndd|j}|j}|j}d}|d7}|tkrqg}|jd j|j|j|j|jr|jd j|jj|jr(x0t |jj D]\}} |jd j|| d qW|jdj |qW|tkrt|t8}|jd|d|dkrhdndd|S) aFormat the stack ready for printing. Returns a list of strings ready for printing. Each string in the resulting list corresponds to a single frame from the stack. Each string ends in a newline; the strings may contain internal newlines as well, for those items with source text lines. For long sequences of the same frame and line, the first few repetitions are shown, followed by a summary line stating the exact number of further repetitions. Nrz [Previous line repeated z more timesrz] z File "{}", line {}, in {} z {} z {name} = {value} )rBr() r@rArB_RECURSIVE_CUTOFFrurr)r[rDsortedrLr1) rMry last_file last_line last_namecountr}rowrBr(rrr rsD   "zStackSummary.format)r/r\r]r^ classmethodr$rrrrrr r<s . c@s^eZdZdZdddddddZedd Zd d Zd d ZddZ ddZ ddddZ dS)raAn exception ready for rendering. The traceback module captures enough attributes from the original exception to this intermediary form to ensure that no references are held, while still being able to fully print or format it. Use `from_exception` to create TracebackException instances from exception objects, or the constructor to create TracebackException instances from individual components. - :attr:`__cause__` A TracebackException of the original *__cause__*. - :attr:`__context__` A TracebackException of the original *__context__*. - :attr:`__suppress_context__` The *__suppress_context__* value from the original exception. - :attr:`stack` A `StackSummary` representing the traceback. - :attr:`exc_type` The class of the original traceback. - :attr:`filename` For syntax errors - the filename where the error occurred. - :attr:`lineno` For syntax errors - the linenumber where the error occurred. - :attr:`text` For syntax errors - the text where the error occurred. - :attr:`offset` For syntax errors - the offset into the text where the error occurred. - :attr:`msg` For syntax errors - the compiler error message. NTF)r"rdre_seenc Cs<|dkrt}|jt||r\|jdk r\t|j|kr\tt|j|j|jj|d||d}nd}|r|jdk rt|j|krtt|j|j|jj|d||d} nd} ||_||_| |_|r|j nd|_ t j t ||||d|_ ||_t||_|ot|tr*|j|_t|j|_|j|_|j|_|j|_|r8|jdS)NF)r"rdrer)r"rdre)rmrqid __cause__rr& __traceback__ __context__ exc_traceback__suppress_context__rr$rr;exc_typer+_str issubclass SyntaxErrorr@r.rAtextoffsetmsg _load_lines) rMr exc_valuerr"rdrercausecontextrrr rNsT      zTracebackException.__init__cOs|t|||jf||S)z.Create a TracebackException from an exception.)r&r)clsexcargskwargsrrr from_exception sz!TracebackException.from_exceptioncCs:x|jD] }|jqW|jr&|jj|jr6|jjdS)z7Private API. force all lines in the stack to be loaded.N)r;r)rrr)rMr}rrr rs    zTracebackException._load_linescCs |j|jkS)N)__dict__)rMrRrrr rSszTracebackException.__eq__cCs|jS)N)r)rMrrr __str__szTracebackException.__str__c cs|jdkrtd|jVdS|jj}|jj}|dkr@|d|}t|jts^t||jVdS|jpfd}t|j ptd}dj ||V|j }|j }|dk rdj |j V|dk r|jd }tt||d }|d|j}d d |D}d j dj|V|jp d}dj ||VdS)aFormat the exception part of the traceback. The return value is a generator of strings, each ending in a newline. Normally, the generator emits a single string; however, for SyntaxError exceptions, it emites several lines that (when printed) display detailed information about where the syntax error occurred. The message indicating which exception occurred is always the last string in the output. N__main__builtins.z?z File "{}", line {} z {}  r~css|]}|jr|pdVqdS) N)isspace)rGcrrr rJHsz;TracebackException.format_exception_only..z {}^ rzz{}: {} )rr)rr-rr]r\rrr@r.rArrrr[rstripminlenlstripr1r) rMstypesmodr@rAbadliner caretspacerrrr r s2        z(TracebackException.format_exception_only)r%ccs|rV|jdk r*|jj|dEdHtVn,|jdk rV|j rV|jj|dEdHtV|jdk rfdV|jjEdH|jEdHdS)aFormat the exception. If chain is not *True*, *__cause__* and *__context__* will not be formatted. The return value is a generator of strings, each ending in a newline and some containing internal newlines. `print_exception` is a wrapper around this method which just prints the lines to a file. The message indicating which exception occurred is always the last string in the output. N)r%z#Traceback (most recent call last): ) rr_cause_messagerr_context_messagerr;r)rMr%rrr rMs    zTracebackException.format) r/r\r]r^rNrrrrSrrrrrrr rs9  -)N)NN)N)N)NNT)NT)NNT)NT)NNT)NNN)NN)NN) r^rkrirYr__all__r!rrrrrrr rrr-r+r r r r rrrrrrrr*rrrrrr sF          ?  z_sysconfigdata_m_linux_x86_64-linux-gnu.cpython-36.opt-1.pyc000064400000056616152462730460017652 0ustar003 iv@sdddddddddddd d dd d d dddddddddddddddddddddddd dd!d"d#d$d%dddd&d'd d(d)d*d&d+dd!dddd,d-ddddddd.d&d&d&d&dd&dd&d&d&d&d&dddddddddd&dd&d&d&d&d&d&d&d&dd&d&d&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&dd&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&dd&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&ddd&d&dd&dddd&d&d&ddd&d&dddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&dd&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&d&d&d&d&d&ddd&d&dd&d&ddd&d&d&d&d&d&d&dddddd&dd&d&ddddddd&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd d/ddd0d1d0d0d2d3d4d d5d6dd7dd d8ddd9dd:d;ddd d d?d@dAdBdd+ddCdDdddEddddddd&dFdGdHddIdJd dKdLd&dMd dNdddddddd dOdPdQd dRdSdd ddTd&dUdd ddVddddWdXd d ddYd&dZd[dd\d6d]d^dd&dd&dd_d`dadbdcd9ddddd?dedddfdgdhdgdfdhdfdfdgdfd^dfdfdfdfdgd&didjdkd&dldmddnd:d&d&dddddoddpdqdrdd&dd ddsd&d&dtdudd&d&d&dddd&d&d&ddvdwdudxdydydudzZd{S)|marrcsz!-Wno-unused-result -Wsign-comparez-IObjects -IInclude -IPythonz/usr/binz/usr/lib64/python3.6z-L. -lpython3.6mzOgcc -pthread -shared -Wl,-z,relro -Wl,-z,now -g -Wl,-z,relro -Wl,-z,now -gpythonzx86_64-redhat-linux-gnu\z gcc -pthreadz-fPICa-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvz?configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.ina-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapva=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-typez-Wl,-z,relro -Wl,-z,now -gz-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -ga'--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-ipv6' '--enable-shared' '--with-computed-gotos=yes' '--with-dbmliborder=gdbm:ndbm:bdb' '--with-system-expat' '--with-system-ffi' '--enable-loadable-sqlite-extensions' '--with-dtrace' '--with-lto' '--with-ssl-default-suites=openssl' '--with-valgrind' '--without-ensurepip' '--enable-optimizations' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS= -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv ' 'LDFLAGS= -Wl,-z,relro -Wl,-z,now -g ' 'CPPFLAGS=' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'z /usr/includez/usr/include/python3.6m:z@/builddir/build/BUILD/Python-3.6.8/build/optimized/coverage.infoz>/builddir/build/BUILD/Python-3.6.8/build/optimized/lcov-reportz2--no-branch-coverage --title "CPython lcov report"zM-IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.6.8/Includez g++ -pthreadzE/usr /usr/lib64 /usr/lib64/python3.6 /usr/lib64/python3.6/lib-dynloadz /usr/lib64/python3.6/lib-dynloadizkREADME ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in Include Lib Misc Ext-dummyzInclude Lib Misc Ext-dummyzPREADME ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in.z/usr/bin/dtracezInclude/pydtrace_probes.hzPython/pydtrace.ozdynload_shlib.onoz .cpython-36m-x86_64-linux-gnu.soiyeszI/usr/include /usr/include /usr/include/python3.6m /usr/include/python3.6mz/usr/bin/install -cz/usr/bin/install -c -m 644z/usr/bin/install -c -m 555zlibpython3.6m.so.1.0zModules/_io/_iomodule.hzg++ -pthread -sharedz:-Wl,-z,relro -Wl,-z,now -g -Wl,-z,relro -Wl,-z,now -gzlibpython3.6m.soz3.6mz /usr/lib64z-lmzPython/z/usr/lib64/pkgconfigz1/usr/lib64/python3.6/config-3.6m-x86_64-linux-gnuzlibpython3.6m.az-lpthread -ldl -lutilz0tkinter tkinter/test tkinter/test/test_tkinter \gccz-Xlinker -export-dynamictruelnlinuxz4/builddir/build/BUILD/Python-3.6.8/Modules/makesetupz/usr/share/manz/usr/bin/mkdir -pz_thread posix errno pwd _sre _codecs _weakref _functools _operator _collections itertools atexit _signal _stat time _locale _io zipimport faulthandler _tracemalloc _symtable xxsubtypea{Modules/_threadmodule.o Modules/posixmodule.o Modules/errnomodule.o Modules/pwdmodule.o Modules/_sre.o Modules/_codecsmodule.o Modules/_weakref.o Modules/_functoolsmodule.o Modules/_operator.o Modules/_collectionsmodule.o Modules/itertoolsmodule.o Modules/atexitmodule.o Modules/signalmodule.o Modules/_stat.o Modules/timemodule.o Modules/_localemodule.o Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o Modules/zipimport.o Modules/faulthandler.o Modules/_tracemalloc.o Modules/hashtable.o Modules/symtablemodule.o Modules/xxsubtype.ozx86_64-linux-gnuz -DMULTIARCH=\"x86_64-linux-gnu\"z-Wl,--no-as-neededa:-DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvz:\ Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.oz Parser/pgenz\ \z-fprofile-generatez"-fprofile-use -fprofile-correctionz -m test --pgoz libpython3.soz no-frameworkz ./python -Ez python3.6a-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-type -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -O3 -fprofile-use -fprofile-correctiona-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-type -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -O3 -fprofile-use -fprofile-correction -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.6.8/Include -fPIC -DPy_BUILD_COREaT-Wl,-z,relro -Wl,-z,now -g -Wl,-z,relro -Wl,-z,now -g -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g -lcryptoz"z"a-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -gz)-x test_subprocess test_io test_lib2to3 \readelfzMac/Resources/frameworkvoidzBLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/optimizedz/bin/shz.sozcpython-36m-x86_64-linux-gnuz&Parser Objects Python Modules Programsz9/builddir/build/BUILD/Python-3.6.8/Tools/gdb/libpython.pyz"/* Don't use ncurses extensions */z-szInclude Lib MisczKLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/optimized ./pythonzLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/optimized ./python /builddir/build/BUILD/Python-3.6.8/Tools/scripts/run_tests.pyizPython/thread.ozIpython3.6 /builddir/build/BUILD/Python-3.6.8/Tools/scripts/update_file.pyz3.6z"/builddir/build/BUILD/Python-3.6.8z)xml xml/dom xml/etree xml/parsers xml/saxz2/builddir/build/BUILD/Python-3.6.8/build/optimizedz /usr/sharez/usr(ABIFLAGSAC_APPLE_UNIVERSAL_BUILDAIX_GENUINE_CPLUSPLUSANDROID_API_LEVELARARFLAGS BASECFLAGS BASECPPFLAGS BASEMODLIBSBINDIR BINLIBDEST BLDLIBRARY BLDSHAREDBUILDEXE BUILDPYTHONBUILD_GNU_TYPE BYTESTR_DEPSCCCCSHAREDCFLAGSCFLAGSFORSHAREDCFLAGS_ALIASING CONFIGFILESCONFIGURE_CFLAGSCONFIGURE_CFLAGS_NODISTCONFIGURE_CPPFLAGSCONFIGURE_LDFLAGSCONFIGURE_LDFLAGS_NODIST CONFIG_ARGSCONFINCLUDEDIR CONFINCLUDEPYCOREPYTHONPATH COVERAGE_INFOCOVERAGE_REPORTCOVERAGE_REPORT_OPTIONSCPPFLAGSCXXDESTDIRSDESTLIBDESTPATH DESTSHAREDDFLAGSDIRMODEDISTDISTDIRS DISTFILES DLINCLDIR DLLLIBRARY"DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754DOUBLE_IS_BIG_ENDIAN_IEEE754DOUBLE_IS_LITTLE_ENDIAN_IEEE754DTRACE DTRACE_DEPSDTRACE_HEADERS DTRACE_OBJS DYNLOADFILE ENABLE_IPV6 ENSUREPIPEXEEXEMODEEXTRAMACHDEPPATH EXTRATESTOPTS EXTRA_CFLAGS EXT_SUFFIXFILEMODEFLOCK_NEEDS_LIBBSDGETPGRP_HAVE_ARGGETTIMEOFDAY_NO_TZ GITBRANCHGITTAG GITVERSIONGNULD HAVE_ACCEPT4 HAVE_ACOSH HAVE_ADDRINFO HAVE_ALARMHAVE_ALIGNED_REQUIRED HAVE_ALLOCA_H HAVE_ALTZONE HAVE_ASINHHAVE_ASM_TYPES_H HAVE_ATANHHAVE_BIND_TEXTDOMAIN_CODESETHAVE_BLUETOOTH_BLUETOOTH_HHAVE_BLUETOOTH_HHAVE_BROKEN_MBSTOWCSHAVE_BROKEN_NICEHAVE_BROKEN_PIPE_BUFHAVE_BROKEN_POLLHAVE_BROKEN_POSIX_SEMAPHORESHAVE_BROKEN_PTHREAD_SIGMASKHAVE_BROKEN_SEM_GETVALUEHAVE_BROKEN_UNSETENVHAVE_BUILTIN_ATOMIC HAVE_CHFLAGS HAVE_CHOWN HAVE_CHROOT HAVE_CLOCKHAVE_CLOCK_GETRESHAVE_CLOCK_GETTIMEHAVE_CLOCK_SETTIMEHAVE_COMPUTED_GOTOS HAVE_CONFSTR HAVE_CONIO_H HAVE_COPYSIGN HAVE_CRYPT_H HAVE_CTERMIDHAVE_CTERMID_RHAVE_CURSES_FILTER HAVE_CURSES_HHAVE_CURSES_HAS_KEYHAVE_CURSES_IMMEDOKHAVE_CURSES_IS_PADHAVE_CURSES_IS_TERM_RESIZEDHAVE_CURSES_RESIZETERMHAVE_CURSES_RESIZE_TERMHAVE_CURSES_SYNCOKHAVE_CURSES_TYPEAHEADHAVE_CURSES_USE_ENVHAVE_CURSES_WCHGATHAVE_DECL_ISFINITEHAVE_DECL_ISINFHAVE_DECL_ISNANHAVE_DECL_RTLD_DEEPBINDHAVE_DECL_RTLD_GLOBALHAVE_DECL_RTLD_LAZYHAVE_DECL_RTLD_LOCALHAVE_DECL_RTLD_NODELETEHAVE_DECL_RTLD_NOLOADHAVE_DECL_RTLD_NOWHAVE_DECL_TZNAMEHAVE_DEVICE_MACROS HAVE_DEV_PTC HAVE_DEV_PTMX HAVE_DIRECT_HHAVE_DIRENT_D_TYPE HAVE_DIRENT_H HAVE_DIRFD HAVE_DLFCN_H HAVE_DLOPEN HAVE_DUP2 HAVE_DUP3HAVE_DYNAMIC_LOADING HAVE_ENDIAN_H HAVE_EPOLLHAVE_EPOLL_CREATE1HAVE_ERF HAVE_ERFC HAVE_ERRNO_H HAVE_EXECV HAVE_EXPM1HAVE_FACCESSAT HAVE_FCHDIR HAVE_FCHMOD HAVE_FCHMODAT HAVE_FCHOWN HAVE_FCHOWNAT HAVE_FCNTL_HHAVE_FDATASYNCHAVE_FDOPENDIR HAVE_FEXECVE HAVE_FINITE HAVE_FLOCK HAVE_FORK HAVE_FORKPTYHAVE_FPATHCONF HAVE_FSEEK64 HAVE_FSEEKO HAVE_FSTATAT HAVE_FSTATVFS HAVE_FSYNC HAVE_FTELL64 HAVE_FTELLO HAVE_FTIMEHAVE_FTRUNCATE HAVE_FUTIMENS HAVE_FUTIMESHAVE_FUTIMESATHAVE_GAI_STRERROR HAVE_GAMMAHAVE_GCC_ASM_FOR_MC68881HAVE_GCC_ASM_FOR_X64HAVE_GCC_ASM_FOR_X87HAVE_GCC_UINT128_THAVE_GETADDRINFOHAVE_GETC_UNLOCKEDHAVE_GETENTROPYHAVE_GETGROUPLISTHAVE_GETGROUPSHAVE_GETHOSTBYNAMEHAVE_GETHOSTBYNAME_RHAVE_GETHOSTBYNAME_R_3_ARGHAVE_GETHOSTBYNAME_R_5_ARGHAVE_GETHOSTBYNAME_R_6_ARGHAVE_GETITIMERHAVE_GETLOADAVG HAVE_GETLOGINHAVE_GETNAMEINFOHAVE_GETPAGESIZEHAVE_GETPEERNAME HAVE_GETPGID HAVE_GETPGRP HAVE_GETPIDHAVE_GETPRIORITY HAVE_GETPWENTHAVE_GETRANDOMHAVE_GETRANDOM_SYSCALLHAVE_GETRESGIDHAVE_GETRESUID HAVE_GETSID HAVE_GETSPENT HAVE_GETSPNAMHAVE_GETTIMEOFDAY HAVE_GETWDHAVE_GLIBC_MEMMOVE_BUG HAVE_GRP_HHAVE_HSTRERROR HAVE_HTOLE64 HAVE_HYPOT HAVE_IEEEFP_HHAVE_IF_NAMEINDEXHAVE_INET_ATONHAVE_INET_PTONHAVE_INITGROUPSHAVE_INTTYPES_H HAVE_IO_HHAVE_IPA_PURE_CONST_BUG HAVE_KILL HAVE_KILLPG HAVE_KQUEUEHAVE_LANGINFO_HHAVE_LARGEFILE_SUPPORT HAVE_LCHFLAGS HAVE_LCHMOD HAVE_LCHOWN HAVE_LGAMMA HAVE_LIBDL HAVE_LIBDLD HAVE_LIBIEEEHAVE_LIBINTL_HHAVE_LIBREADLINEHAVE_LIBRESOLVHAVE_LIBSENDFILEHAVE_LIBUTIL_H HAVE_LINK HAVE_LINKATHAVE_LINUX_CAN_BCM_HHAVE_LINUX_CAN_HHAVE_LINUX_CAN_RAW_FD_FRAMESHAVE_LINUX_CAN_RAW_HHAVE_LINUX_NETLINK_HHAVE_LINUX_RANDOM_HHAVE_LINUX_TIPC_H HAVE_LOCKF HAVE_LOG1P HAVE_LOG2HAVE_LONG_DOUBLE HAVE_LSTAT HAVE_LUTIMES HAVE_MAKEDEV HAVE_MBRTOWC HAVE_MEMMOVE HAVE_MEMORY_H HAVE_MEMRCHR HAVE_MKDIRAT HAVE_MKFIFO HAVE_MKFIFOAT HAVE_MKNOD HAVE_MKNODAT HAVE_MKTIME HAVE_MMAP HAVE_MREMAPHAVE_NCURSES_H HAVE_NDIR_HHAVE_NETPACKET_PACKET_H HAVE_NET_IF_H HAVE_NICE HAVE_OPENAT HAVE_OPENPTY HAVE_PATHCONF HAVE_PAUSE HAVE_PIPE2 HAVE_PLOCK HAVE_POLL HAVE_POLL_HHAVE_POSIX_FADVISEHAVE_POSIX_FALLOCATE HAVE_PREAD HAVE_PRLIMITHAVE_PROCESS_HHAVE_PROTOTYPESHAVE_PTHREAD_ATFORKHAVE_PTHREAD_CONDATTR_SETCLOCKHAVE_PTHREAD_DESTRUCTORHAVE_PTHREAD_HHAVE_PTHREAD_INITHAVE_PTHREAD_KILLHAVE_PTHREAD_SIGMASK HAVE_PTY_H HAVE_PUTENV HAVE_PWRITE HAVE_READLINKHAVE_READLINKAT HAVE_READV HAVE_REALPATH HAVE_RENAMEATHAVE_RL_APPEND_HISTORYHAVE_RL_CALLBACKHAVE_RL_CATCH_SIGNAL#HAVE_RL_COMPLETION_APPEND_CHARACTER'HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOKHAVE_RL_COMPLETION_MATCHES"HAVE_RL_COMPLETION_SUPPRESS_APPENDHAVE_RL_PRE_INPUT_HOOKHAVE_RL_RESIZE_TERMINAL HAVE_ROUNDHAVE_SCHED_GET_PRIORITY_MAX HAVE_SCHED_HHAVE_SCHED_RR_GET_INTERVALHAVE_SCHED_SETAFFINITYHAVE_SCHED_SETPARAMHAVE_SCHED_SETSCHEDULER HAVE_SELECTHAVE_SEM_GETVALUE HAVE_SEM_OPENHAVE_SEM_TIMEDWAITHAVE_SEM_UNLINK HAVE_SENDFILE HAVE_SETEGID HAVE_SETEUID HAVE_SETGIDHAVE_SETGROUPSHAVE_SETHOSTNAMEHAVE_SETITIMERHAVE_SETLOCALE HAVE_SETPGID HAVE_SETPGRPHAVE_SETPRIORITY HAVE_SETREGIDHAVE_SETRESGIDHAVE_SETRESUID HAVE_SETREUID HAVE_SETSID HAVE_SETUID HAVE_SETVBUF HAVE_SHADOW_HHAVE_SIGACTIONHAVE_SIGALTSTACKHAVE_SIGINTERRUPT HAVE_SIGNAL_HHAVE_SIGPENDING HAVE_SIGRELSEHAVE_SIGTIMEDWAIT HAVE_SIGWAITHAVE_SIGWAITINFO HAVE_SNPRINTFHAVE_SOCKADDR_ALGHAVE_SOCKADDR_SA_LENHAVE_SOCKADDR_STORAGEHAVE_SOCKETPAIR HAVE_SPAWN_H HAVE_SSIZE_T HAVE_STATVFSHAVE_STAT_TV_NSECHAVE_STAT_TV_NSEC2HAVE_STDARG_PROTOTYPES HAVE_STDINT_H HAVE_STDLIB_HHAVE_STD_ATOMIC HAVE_STRDUP HAVE_STRFTIMEHAVE_STRINGS_H HAVE_STRING_H HAVE_STRLCPYHAVE_STROPTS_HHAVE_STRUCT_PASSWD_PW_GECOSHAVE_STRUCT_PASSWD_PW_PASSWDHAVE_STRUCT_STAT_ST_BIRTHTIMEHAVE_STRUCT_STAT_ST_BLKSIZEHAVE_STRUCT_STAT_ST_BLOCKSHAVE_STRUCT_STAT_ST_FLAGSHAVE_STRUCT_STAT_ST_GENHAVE_STRUCT_STAT_ST_RDEVHAVE_STRUCT_TM_TM_ZONE HAVE_SYMLINKHAVE_SYMLINKAT HAVE_SYNC HAVE_SYSCONFHAVE_SYSEXITS_HHAVE_SYS_AUDIOIO_HHAVE_SYS_BSDTTY_HHAVE_SYS_DEVPOLL_HHAVE_SYS_DIR_HHAVE_SYS_ENDIAN_HHAVE_SYS_EPOLL_HHAVE_SYS_EVENT_HHAVE_SYS_FILE_HHAVE_SYS_IOCTL_HHAVE_SYS_KERN_CONTROL_HHAVE_SYS_LOADAVG_HHAVE_SYS_LOCK_HHAVE_SYS_MKDEV_HHAVE_SYS_MODEM_HHAVE_SYS_NDIR_HHAVE_SYS_PARAM_HHAVE_SYS_POLL_HHAVE_SYS_RANDOM_HHAVE_SYS_RESOURCE_HHAVE_SYS_SELECT_HHAVE_SYS_SENDFILE_HHAVE_SYS_SOCKET_HHAVE_SYS_STATVFS_HHAVE_SYS_STAT_HHAVE_SYS_SYSCALL_HHAVE_SYS_SYSMACROS_HHAVE_SYS_SYS_DOMAIN_HHAVE_SYS_TERMIO_HHAVE_SYS_TIMES_HHAVE_SYS_TIME_HHAVE_SYS_TYPES_HHAVE_SYS_UIO_H HAVE_SYS_UN_HHAVE_SYS_UTSNAME_HHAVE_SYS_WAIT_HHAVE_SYS_XATTR_HHAVE_TCGETPGRPHAVE_TCSETPGRP HAVE_TEMPNAMHAVE_TERMIOS_H HAVE_TERM_H HAVE_TGAMMA HAVE_TIMEGM HAVE_TIMES HAVE_TMPFILE HAVE_TMPNAM HAVE_TMPNAM_R HAVE_TM_ZONE HAVE_TRUNCATE HAVE_TZNAME HAVE_UCS4_TCL HAVE_UNAME HAVE_UNISTD_H HAVE_UNLINKAT HAVE_UNSETENVHAVE_USABLE_WCHAR_T HAVE_UTIL_HHAVE_UTIMENSAT HAVE_UTIMES HAVE_UTIME_H HAVE_WAIT3 HAVE_WAIT4 HAVE_WAITID HAVE_WAITPID HAVE_WCHAR_H HAVE_WCSCOLL HAVE_WCSFTIME HAVE_WCSXFRM HAVE_WMEMCMPHAVE_WORKING_TZSET HAVE_WRITEVHAVE_ZLIB_COPY HAVE__GETPTY HOST_GNU_TYPEINCLDIRSTOMAKE INCLUDEDIR INCLUDEPYINSTALL INSTALL_DATAINSTALL_PROGRAMINSTALL_SCRIPTINSTALL_SHARED INSTSONAMEIO_HIO_OBJS LDCXXSHAREDLDFLAGSLDLAST LDLIBRARY LDLIBRARYDIRLDSHARED LDVERSIONLIBCLIBDESTLIBDIRLIBFFI_INCLUDEDIRLIBM LIBOBJDIRLIBOBJSLIBPCLIBPLLIBRARY LIBRARY_OBJSLIBRARY_OBJS_OMIT_FROZENLIBS LIBSUBDIRSLINKCC LINKFORSHAREDLIPO_32BIT_FLAGS LLVM_PROF_ERRLLVM_PROF_FILELLVM_PROF_MERGERLN LOCALMODLIBSLOG1P_DROPS_ZERO_SIGNMACHDEP MACHDEPPATH MACHDEP_OBJS MACHDESTLIBMACOSX_DEPLOYMENT_TARGETMAINCCMAJOR_IN_MKDEVMAJOR_IN_SYSMACROS MAKESETUPMANDIRMKDIR_PMODLIBSMODNAMESMODOBJS MODULE_OBJS MULTIARCHMULTIARCH_CPPFLAGSMVWDELCH_IS_EXPRESSION NO_AS_NEEDED OBJECT_OBJSOPTOTHER_LIBTOOL_OPTPACKAGE_BUGREPORT PACKAGE_NAMEPACKAGE_STRINGPACKAGE_TARNAME PACKAGE_URLPACKAGE_VERSIONPARSER_HEADERS PARSER_OBJSPGENPGENOBJSPGOBJSPGO_PROF_GEN_FLAGPGO_PROF_USE_FLAGPLATDIRPOBJSPOSIX_SEMAPHORES_NOT_ENABLED PROFILE_TASKPTHREAD_SYSTEM_SCHED_SUPPORTED PY3LIBRARYPYLONG_BITS_IN_DIGITPYTHONPYTHONFRAMEWORKPYTHONFRAMEWORKDIRPYTHONFRAMEWORKINSTALLDIRPYTHONFRAMEWORKPREFIX PYTHONPATHPYTHON_FOR_BUILDPYTHON_FOR_REGENPYTHON_HEADERS PYTHON_OBJS PY_CFLAGSPY_CFLAGS_NODISTPY_COERCE_C_LOCALEPY_CORE_CFLAGSPY_CORE_LDFLAGS PY_CPPFLAGSPY_FORMAT_SIZE_T PY_LDFLAGSPY_LDFLAGS_NODISTPY_SSL_DEFAULT_CIPHERSPY_SSL_DEFAULT_CIPHER_STRINGPY_WARN_ON_C_LOCALEPy_DEBUGPy_ENABLE_SHAREDPy_HASH_ALGORITHM QUICKTESTOPTSREADELF RESSRCDIR RETSIGTYPE RUNSHARED SCRIPTDIRSETPGRP_HAVE_ARGSGI_ABISHELLSHLIBS SHLIB_SUFFIXSIGNED_RIGHT_SHIFT_ZERO_FILLSSITEPATH SIZEOF_DOUBLE SIZEOF_FLOAT SIZEOF_FPOS_T SIZEOF_INT SIZEOF_LONGSIZEOF_LONG_DOUBLESIZEOF_LONG_LONG SIZEOF_OFF_T SIZEOF_PID_TSIZEOF_PTHREAD_T SIZEOF_SHORT SIZEOF_SIZE_T SIZEOF_TIME_TSIZEOF_UINTPTR_T SIZEOF_VOID_PSIZEOF_WCHAR_T SIZEOF__BOOLSOABISRCDIRS SRC_GDB_HOOKS STDC_HEADERSSTRICT_SYSV_CURSES STRIPFLAGSUBDIRS SUBDIRSTOOSYSLIBSSYS_SELECT_WITH_SYS_TIMETANH_PRESERVES_ZERO_SIGNTCLTK_INCLUDES TCLTK_LIBSTESTOPTSTESTPATH TESTPYTHONTESTPYTHONOPTS TESTRUNNER TESTTIMEOUT THREADOBJTIMEMODULE_LIBTIME_WITH_SYS_TIMETM_IN_SYS_TIME UNICODE_DEPS UNIVERSALSDK UPDATE_FILEUSE_COMPUTED_GOTOS USE_INLINEVERSIONVPATHWANT_SIGFPE_HANDLERWINDOW_HAS_FLAGSWITH_DOC_STRINGS WITH_DTRACE WITH_DYLD WITH_LIBINTLWITH_NEXT_FRAMEWORK WITH_PYMALLOC WITH_THREAD WITH_VALGRINDX87_DOUBLE_ROUNDING XMLLIBSUBDIRS abs_builddir abs_srcdir datarootdir exec_prefixprefixsrcdirN)build_time_varsrr?/usr/lib64/python3.6/_sysconfigdata_m_linux_x86_64-linux-gnu.pys *sre_compile.cpython-36.pyc000064400000024050152462730460011505 0ustar003 \K@sdZddlZddlZddlTejeks.tdeehZe e e hZ e ehZeehZdWZd&d'eDZd(d)ZdXd*d+Zd,d-Zejd.Zd/e>d/Zd0d1d2Zeefd3d4Zd5d6Zd7d8Zd9d:Z d;d<Z!d=d>Z"d?d@Z#dAdBZ$dCdDZ%dYdEdFZ&dS)ZzInternal support module for sreN)*zSRE module mismatchi1sEacs.i|]&}|D]tfdd|Dq qS)c3s|]}|kr|VqdS)N).0j)ir$#/usr/lib64/python3.6/sre_compile.py =sz.)tuple)r%tr$)r'r( =sr,cCsr|j}t}t}t}t}t}|t@rD|t@ rD|t@rD|t @ rDt } nd} x"|D]\} } | |kr|t@rt j | |} | r| | kr|t ||} |d| tkr|tx&| f| | D]}|t||qW|t||| || <n|t| || n|| || qP| tkr|t@rF|t| |fdd}n || d}||} |dt| |||| ||| || <qP| tkr|t@r|tn|tqP| |kr|t@rtd| fnt| rR| tk rR| tkr|tn|t||} |d|| d|| dt|| d||t ||| || <nl|t||} |d|| d|| dt|| d|||| || <| tkr|t!n|t"qP| t#kr.| \}}}}|r|t$||ddt||||B|@|rj|t$||dddqP| |krB|| qP| |kr|| ||} |d| ddkr||dn*| dj%\} }| |krtd|| t|| d||t ||| || <qP| t&kr|| ||} |dt|| ||t ||| || <qP| t'kr|| |t(@r@t)j*| | } |t@rXt+j*| | } n"|t@rz|t @ rzt,j*| | } || qP| t-kr&|| g}|j}xZ| dD]N} ||} |dt|| ||t.||||d||| || <qW|tx|D]}|||||<q WqP| t/krt|| |t@rLt0| } n|t@rj|t @ rjt1| } || qP| t2kr|t@r|t| n|| || dqP| t3kr\|| || dd||}|dt|| d|| drF|t.||}|d|||d||<t|| d||||||<n|||d||<qPtd| fqPWdS) NrcSs tj||S)N)_sregetlower)literalflagsr$r$r(fixupfsz_compile..fixupz*internal: unsupported template operator %rz(look-behind requires fixed-width patternz%internal: unsupported operand type %r)4appendlen_LITERAL_CODES_REPEATING_CODES_SUCCESS_CODES _ASSERT_CODESSRE_FLAG_IGNORECASESRE_FLAG_LOCALESRE_FLAG_UNICODESRE_FLAG_ASCII_ignorecase_fixesr-r. IN_IGNORE NOT_LITERALNEGATELITERALFAILURE OP_IGNOREIN_compile_charsetANYSRE_FLAG_DOTALLANY_ALLSRE_FLAG_TEMPLATEerror_simpleREPEAT MAX_REPEAT REPEAT_ONEMIN_REPEAT_ONE_compileSUCCESS MAX_UNTIL MIN_UNTIL SUBPATTERNMARKgetwidthCALLATSRE_FLAG_MULTILINE AT_MULTILINEget AT_LOCALE AT_UNICODEBRANCHJUMPCATEGORY CH_LOCALE CH_UNICODEGROUPREFGROUPREF_EXISTS)codepatternr0emit_len LITERAL_CODESREPEATING_CODES SUCCESS_CODES ASSERT_CODESfixesopavloskipkr1group add_flags del_flagsphitail tailappendskipyesskipnor$r$r(rQ@s.                                                       rQcCs|j}xt|||D]\}}|||tkr.q|tkr@||q|tksP|tkrj||d||dq|tkr~|j|q|tkr|j|q|t kr|t @r|t |q|t @r|t @ r|t|q||qtd|fqW|tdS)Nrr2z%internal: unsupported set operator %r)r4_optimize_charsetrArBRANGE RANGE_IGNORECHARSETextend BIGCHARSETrar;rbr<r=rcrKrC)charsetr0rfr1rnrhrorpr$r$r(rFs,     rFc Csdg}g}td}xt|D]j\}}x^y|tkrx|rn||}d||<|rv||krvx"||D] } d|| <q\Wnd||<n|tkrt|d|dd} |rt|| } |r|rxN| D].} d|| <| |krx|| D] } d|| <qWqWnx>| D] } d|| <qWn(|tkr|j||fn|j||fWnTtk r|t|dkrV|dd7}w&|rj|tkrjt }|j||fYnXPq&WqWg} d} xj|j d| }|dkrPt| dkrd} P|j d|} | dkr| j|t|fP| j|| fqW| dk rvxF| D]>\}} | |dkr2|jt|fn|jt|| dffq W||7}|snt|t|krr|S|St|dkrt |}|jt |f||7}|St |}i}td}d}t}xftdddD]V} || | d}||kr|||| d<n$||| d<||<|d7}||7}qWt |}|gt||dd<|jt|f||7}|S)Nr2rir3i) bytearrayrBr~rangemaprAr4 IndexErrorr5rfind _mk_bitmaprbytes_bytes_to_codesr)rr1rnoutrycharmaprorprqrsrr'runsqrwdatacompsmappingblockchunkr$r$r(r}s              r}r201cs8|jtdddfddttd DS)Nr2cs"g|]}||dqS)r3r$)r%r') _CODEBITS_intsr$r( zsz_mk_bitmap..r) translate _BITS_TRANSrr5)bitsrrr$)rrrr(rxsrcCs@t|jd}|jtjkstt||jt|ks8t|jS)NI) memoryviewcastitemsizer-CODESIZEAssertionErrorr5tolist)bar$r$r(r}srcCs<|dj\}}||ko"dkno:|dddtkS)Nr3r2r)rWrU)rprqrxr$r$r(rLsrLcCsvdgt|}xbtdt|D]P}||d}x>||||kr`|dkrRd||<P||d}q0W|d||<qW|S)aj Generate an overlap table for the following prefix. An overlap table is a table of the same size as the prefix which informs about the potential self-overlap for each index in the prefix: - if overlap[i] == 0, prefix[i:] can't overlap prefix[0:...] - if overlap[i] == k with 0 < k <= i, prefix[i-k+1:i+1] overlaps with prefix[0:k] rr2)r5r)prefixtabler'idxr$r$r(_generate_overlap_tables  rc Csg}|j}d}x|jD]\}}|tkr0||q|tkr|\}}}} |t@rNPt| \} } } |dkr|dk rvt|}n| dk rt|| }|j| | sPqPqW||dfS||dfS)NTF)r4rrBrUr:_get_literal_prefixr5r) rgr prefixappend prefix_skiprorprtrurvrwprefix1 prefix_skip1got_allr$r$r(rs,      rc Cs"g}|j}|jr|jd\}}|tkr|\}}}}|r|t@ r|d\}}|tkrd|||fnR|tkrg} | j} x|dD].}|sP|d\}}|tkr| ||fqPqW| }nf|tkrg} | j} xP|dD]0}|sP|d\}}|tkr| ||fqPqW| }n|tkr|}|S)Nrr2)r4rrUr:rBr_rE) rgr charsetappendrorprtrurvrwccappendr$r$r(_get_charset_prefixsF       rc CsZ|j\}}|tkrt}|dkr8|jtdd||gdSg}d}g}|t@sft|\}}}|sft|}|j} | tt|} | dd} |rt } |dkr|r| t B} n |r| t B} | | |tkr| |n| t|dt}| t |t|r4| t||dkrt|}| ||j||jt |n|rFt|||t|| || <dS)Nr)rWMAXCODErINFOr:rrr4r5SRE_INFO_PREFIXSRE_INFO_LITERALSRE_INFO_CHARSETminrrF) rfrgr0rqrxrrrrrhrrmaskr$r$r( _compile_infosP         rcCst|ttfS)N) isinstancestrr)objr$r$r(isstringsrcCs8|jj|B}g}t|||t||j||jt|S)N)rgr0rrQrr4rR)rwr0rfr$r$r(_codes    rcCst|r|}tj||}nd}t||}|jj}dg|jj}x|jD]\}}|||<qHWtj |||jj B||jjd||S)Nr2) r sre_parseparserrg groupdictgroupsitemsr-compiler0)rwr0rgrf groupindex indexgrouprsr'r$r$r(r-s   rrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr r!r"r#)rrrrrrrrrrrrrrrr)NN)r)'__doc__r-r sre_constantsMAGICrrBr@r6rM MIN_REPEATrNr7rRrCr8ASSERT ASSERT_NOTr9 _equivalencesr>rQrFr}rrrrintrrrLrrrrrrrr$r$r$r( sV  {   )9shutil.cpython-36.opt-1.pyc000064400000074265152462730460011470 0ustar003 i}A@sdZddlZddlZddlZddlZddlZddlZyddlZ[dZWne k r^dZYnXyddl Z [ dZ Wne k rdZ YnXyddl Z [ dZ Wne k rdZ YnXyddlmZWne k rdZYnXyddlmZWne k r dZYnXddd d d d d ddddddddddddddddddgZGd ddeZGd!ddeZGd"ddeZGd#ddeZGd$d%d%eZGd&d'd'eZdd*dZd+d,Zdd-d.dZdd-d/d Zeed0rdd-d1d2Z nd3d2Z dd-d4d Z!dd-d5d Z"dd-d6d Z#d7dZ$dde#dfd8d Z%d9d:Z&d;d<Z'ej(ejej)ej*hej+ko~ej,ej-ko~ejej.kZ/dd=dZ0e/e0_1d>d?Z2e#fd@dZ3dAdBZ4dCdDZ5dEdFZ6ddHdIZ7ddJdKZ8dLe7dgdNfiZ9ere7dgdOfe9dP<e8gdQfe9dR<e re7dgdTfe9dU<e r0e7dgdWfe9dX<dYdZ:dd[dZ;d\dZd_d`Z?ddadZ@dbdZAdcddZBdedfZCddgdhdiZDdjgeDgdNfdkgeCgdQfdlZEerdmdngeDgdOfeEdP<e rdodpgeDgdTfeEdU<e rdqdrgeDgdWfeEdX<dsdtZFdddgdudZGeedvr\ejHdwejIdxdyZJdzeJjK_d{eJjL_d|eJjM_d}dwZNn2ejOd~krddlPZPejHdwejIdxdyZJddwZNdddZQdddZRejSejTBdfddZUdS)zUtility functions for copying and archiving files and directory trees. XXX The functions here don't copy the resource fork or other metadata on Mac. NTF)getpwnam)getgrnam copyfileobjcopyfilecopymodecopystatcopycopy2copytreemovermtreeErrorSpecialFileError ExecError make_archiveget_archive_formatsregister_archive_formatunregister_archive_formatget_unpack_formatsregister_unpack_formatunregister_unpack_formatunpack_archiveignore_patternschownwhichget_terminal_size SameFileErrorc@s eZdZdS)r N)__name__ __module__ __qualname__r r /usr/lib64/python3.6/shutil.pyr 7sc@seZdZdZdS)rz5Raised when source and destination are the same file.N)rrr__doc__r r r r!r:sc@seZdZdZdS)rz|Raised when trying to do a kind of operation (e.g. copying) which is not supported on a special file (e.g. a named pipe)N)rrrr"r r r r!r=sc@seZdZdZdS)rz+Raised when a command could not be executedN)rrrr"r r r r!rAsc@seZdZdZdS) ReadErrorz%Raised when an archive cannot be readN)rrrr"r r r r!r#Dsr#c@seZdZdZdS) RegistryErrorzVRaised when a registry operation with the archiving and unpacking registries failsN)rrrr"r r r r!r$Gsr$icCs$x|j|}|sP|j|qWdS)z=copy data from file-like object fsrc to file-like object fdstN)readwrite)fsrcfdstZlengthZbufr r r!rLs  c CsXttjdr0ytjj||Stk r.dSXtjjtjj|tjjtjj|kS)NsamefileF)hasattrospathr*OSErrornormcaseabspath)srcdstr r r! _samefileTs r3)follow_symlinkscCst||rtdj||xL||gD]@}ytj|}Wntk rJYq$Xtj|jr$td|q$W| rtj j |rtj tj ||n6t |d&}t |d}t||WdQRXWdQRX|S)zCopy data from src to dst. If follow_symlinks is not set and src is a symbolic link, a new symlink will be created instead of copying the file it points to. z{!r} and {!r} are the same filez`%s` is a named piperbwbN)r3rformatr,statr.S_ISFIFOst_moderr-islinksymlinkreadlinkopenr)r1r2r4fnstr(r)r r r!r`s    cCsz| r>tjj|r>tjj|r>ttdr8tjtj}}q\dSnttdrXtjtj}}ndS||}||tj|j dS)zCopy mode bits from src to dst. If follow_symlinks is not set, symlinks aren't followed if and only if both `src` and `dst` are symlinks. If `lchmod` isn't available (e.g. Linux) this method does nothing. lchmodNchmod) r,r-r;r+lstatrAr8rBS_IMODEr:)r1r2r4Z stat_funcZ chmod_funcr@r r r!r}s   listxattrcCsytj||d}Wn4tk rF}z|jtjtjfkr8dSd}~XnXxn|D]f}y&tj|||d}tj||||dWqNtk r}z|jtjtjtjfkrWYdd}~XqNXqNWdS)zCopy extended filesystem attributes from `src` to `dst`. Overwrite existing attributes. If `follow_symlinks` is false, symlinks won't be followed. )r4N) r,rEr.errnoENOTSUPZENODATAgetxattrsetxattrZEPERM)r1r2r4namesenamevaluer r r! _copyxattrs  rNcOsdS)Nr )argskwargsr r r!rNsc s6ddddd|p,tjj|o*tjj| }|r@fdd}n fdd}|d||d }tj|j}|d ||j|jf|dy|d |||d Wntk rYnXt |d r$y|d ||j |d WnPt k r"}z2x*dD] }t t |r|j t t |krPqWWYdd}~XnXt|||d dS)aCopy file metadata Copy the permission bits, last access time, last modification time, and flags from `src` to `dst`. On Linux, copystat() also copies the "extended attributes" where possible. The file contents, owner, and group are unaffected. `src` and `dst` are path names given as strings. If the optional flag `follow_symlinks` is not set, symlinks aren't followed if and only if both `src` and `dst` are symlinks. N)nsr4cWsdS)Nr )rQr4rOr r r!_nopszcopystat.._nopcs tt|S)N)getattrr,)rL)rRr r!lookupszcopystat..lookupcstt|}|tjkr|SS)N)rSr,supports_follow_symlinks)rLr?)rRr r!rTs  r8)r4utimerBst_flagsZchflags EOPNOTSUPPrG)rXrG)r,r-r;r8rDr: st_atime_ns st_mtime_nsNotImplementedErrorr+rWr.rFrSrN) r1r2r4ZfollowrTr@modewhyerrr )rRr!rs,      cCsBtjj|r"tjj|tjj|}t|||dt|||d|S)a3Copy data and mode bits ("cp src dst"). Return the file's destination. The destination may be a directory. If follow_symlinks is false, symlinks won't be followed. This resembles GNU's "cp -P src dst". If source and destination are the same file, a SameFileError will be raised. )r4)r,r-isdirjoinbasenamerr)r1r2r4r r r!rs cCsBtjj|r"tjj|tjj|}t|||dt|||d|S)a1Copy data and metadata. Return the file's destination. Metadata is copied with copystat(). Please see the copystat function for more information. The destination may be a directory. If follow_symlinks is false, symlinks won't be followed. This resembles GNU's "cp -P src dst". )r4)r,r-r_r`rarr)r1r2r4r r r!r s csfdd}|S)zFunction that can be used as copytree() ignore parameter. Patterns is a sequence of glob-style patterns that are used to exclude filescs,g}xD]}|jtj||q Wt|S)N)extendfnmatchfilterset)r-rJ ignored_namespattern)patternsr r!_ignore_patternss z)ignore_patterns.._ignore_patternsr )rhrir )rhr!r s cCstj|}|dk r|||}nt}tj|g}xB|D]8} | |krJq:tjj|| } tjj|| } ytjj| rtj| } |rtj| | t | | | dn ignored_names Since copytree() is called recursively, the callable will be called once for each directory that is copied. It returns a list of names relative to the `src` directory that should not be copied. The optional copy_function argument is a callable that will be used to copy each file. It will be called with the source path and the destination path as arguments. By default, copy2() is used, but any function that supports the same signature (like copy()) can be used. N)r4rZwinerror)r,listdirremakedirsr-r`r;r=r<rexistsr_r r rbrOr.appendstrrS)r1r2symlinksignore copy_functionZignore_dangling_symlinksrJrferrorsrLZsrcnameZdstnamelinktor^r]r r r!r sL$           *&c$CsLytjj|rtdWn(tk r@|tjj|tjdSXg}ytj|}Wn&tk rz|tj|tjYnXx|D]}tjj||}ytj|j }Wntk rd}YnXt j |rt ||qytj |Wqtk r |tj |tjYqXqWytj|Wn(tk rF|tj|tjYnXdS)Nz%Cannot call rmtree on a symbolic linkr)r,r-r;r.sysexc_inforjr`rCr:r8S_ISDIR_rmtree_unsafeunlinkrmdir)r-onerrorrJrLfullnamer\r r r!rwqs6      rwc 0Csg}ytj|}Wn:tk rL}z||_|tj|tjWYdd}~XnXx|D]x}tjj||}ytj||dd}|j }Wntk rd}YnXtj |rytj |tj |d} Wn&tk r|tj |tjYnXztjj |tj| rJt| ||ytj||dWn(tk rF|tj|tjYnXn8y tdWn*tk r|tjj|tjYnXWdtj| XqVytj||dWqVtk r|tj|tjYqVXqVWdS)NF)dir_fdr4r)r|z%Cannot call rmtree on a symbolic link)r,rjr.filenamertrur-r`r8r:rvr>O_RDONLYsamestatfstat_rmtree_safe_fdryr;closerx) topfdr-rzrJr^rLr{orig_str\dirfdr r r!rsD$     rc!Cs^|rdd}n|dkrdd}trPt|tr8tj|}ytj|}Wn&tk rl|tj|tjdSXytj |tj }Wn&tk r|tj|tjdSXztj j |tj |rt|||ytj|Wn(tk r|tj|tjYnXn8y tdWn*tk r<|tj j|tjYnXWdtj|Xn t||SdS)aRecursively delete a directory tree. If ignore_errors is set, errors are ignored; otherwise, if onerror is set, it is called to handle the error with arguments (func, path, exc_info) where func is platform and implementation dependent; path is the argument to that function that caused it to fail; and exc_info is a tuple returned by sys.exc_info(). If ignore_errors is false and onerror is None, an exception is raised. cWsdS)Nr )rOr r r!rzszrmtree..onerrorNcWsdS)Nr )rOr r r!rzsz%Cannot call rmtree on a symbolic link)_use_fd_functions isinstancebytesr,fsdecoderC Exceptionrtrur>r~r-rrrryr.r;rrw)r- ignore_errorsrzrfdr r r!r s<      cCs&tjjtjjpd}tjj|j|S)N)r,r-sepaltseprarstrip)r-rr r r! _basenamesrc Cs|}tjj|rTt||r*tj||dStjj|t|}tjj|rTtd|ytj||Wnt k rtjj |rtj |}tj ||tj |nTtjj|rt||rtd||ft|||ddt|n|||tj |YnX|S)a+Recursively move a file or directory to another location. This is similar to the Unix "mv" command. Return the file or directory's destination. If the destination is a directory or a symlink to a directory, the source is moved inside the directory. The destination path must not already exist. If the destination already exists but is not a directory, it may be overwritten depending on os.rename() semantics. If the destination is on our current filesystem, then rename() is used. Otherwise, src is copied to the destination and then removed. Symlinks are recreated under the new name if os.rename() fails because of cross filesystem renames. The optional `copy_function` argument is a callable that will be used to copy the source or it will be delegated to `copytree`. By default, copy2() is used, but any function that supports the same signature (like copy()) can be used. A lot more could be done here... A look at a mv.c shows a lot of the issues this implementation glosses over. Nz$Destination path '%s' already existsz.Cannot move a directory '%s' into itself '%s'.T)rqro)r,r-r_r3renamer`rrlr r.r;r=r<rx _destinsrcr r )r1r2rqZreal_dstrsr r r!r s2              cCsVtjj|}tjj|}|jtjjs2|tjj7}|jtjjsL|tjj7}|j|S)N)r,r-r0endswithr startswith)r1r2r r r!r8s    rc CsNtdks|dkrdSy t|}Wntk r8d}YnX|dk rJ|dSdS)z"Returns a gid, given a group name.N)rKeyError)rLresultr r r!_get_gidAs  rc CsNtdks|dkrdSy t|}Wntk r8d}YnX|dk rJ|dSdS)z"Returns an uid, given a user name.Nr)rr)rLrr r r!_get_uidMs  rgzipc s"|dkrd}nDtr |dkr d}n2tr2|dkr2d}n trD|dkrDd}ntdj|d dl} |rfd |nd} |d | } tjj| } | rtjj |  r|dk r|j d | |stj | |dk r|j d t t fdd} |s| j| d|}z|j|| dWd|jX| S)aCreate a (possibly compressed) tar file from all the files under 'base_dir'. 'compress' must be "gzip" (the default), "bzip2", "xz", or None. 'owner' and 'group' can be used to define an owner and a group for the archive that is being built. If not provided, the current owner and group will be used. The output tar file will be named 'base_name' + ".tar", possibly plus the appropriate compression extension (".gz", ".bz2", or ".xz"). Returns the output filename. NrrZgzbzip2bz2xzzCbad value for 'compress', or compression format not supported : {0}r.z.tarz creating %szCreating tar archivecs,dk r|_|_dk r(|_|_|S)N)gidZgnameuiduname)Ztarinfo)rgroupownerrr r! _set_uid_gidsz#_make_tarball.._set_uid_gidzw|%s)rd)_ZLIB_SUPPORTED_BZ2_SUPPORTED_LZMA_SUPPORTED ValueErrorr7tarfiler,r-dirnamerlinforkrrr>addr) base_namebase_dircompressverbosedry_runrrloggerZtar_compressionrZ compress_extZ archive_name archive_dirrtarr )rrrrr! _make_tarballYs<          rc Cs|ddl}|d}tjj|}|rPtjj| rP|dk rB|jd||sPtj||dk rf|jd|||sx|j|d|jd}tjj |} | tj kr|j | | |dk r|jd| xtj |D]\} } } xFt | D]:} tjj tjj| | } |j | | |dk r|jd| qWxT| D]L} tjj tjj| | } tjj| r|j | | |dk r|jd| qWqWWdQRX|S) zCreate a zip file from all the files under 'base_dir'. The output zip file will be named 'base_name' + ".zip". Returns the name of the output zip file. rNz.zipz creating %sz#creating '%s' and adding '%s' to itw)Z compressionz adding '%s')zipfiler,r-rrlrrkZipFileZ ZIP_DEFLATEDnormpathcurdirr'walksortedr`isfile)rrrrrrZ zip_filenamerZzfr-dirpathZdirnames filenamesrLr r r! _make_zipfiles@             rrrzuncompressed tar filezgzip'ed tar-fileZgztarzZIP fileziprzbzip2'ed tar-fileZbztarrzxz'ed tar-fileZxztarcCsddtjD}|j|S)zReturns a list of supported formats for archiving and unarchiving. Each element of the returned sequence is a tuple (name, description) cSsg|]\}}||dfqS)rr ).0rLregistryr r r! sz'get_archive_formats..)_ARCHIVE_FORMATSitemssort)formatsr r r!rs rcCsz|dkr g}t|s td|t|ttfs6tdx0|D](}t|ttf s\t|dkr|dk r$|jd|tjj|}|s>tj||dkrLtj}||d} y t|} Wn tk rt d|YnX| d} x| dD]\} }|| | <qW|dkr|| d<|| d <z| ||f| }Wd|dk r|dk r|jd | tj| X|S) aCreate an archive file (eg. zip or tar). 'base_name' is the name of the file to create, minus any format-specific extension; 'format' is the archive format: one of "zip", "tar", "gztar", "bztar", or "xztar". Or any other registered format. 'root_dir' is a directory that will be the root directory of the archive; ie. we typically chdir into 'root_dir' before creating the archive. 'base_dir' is the directory where we start archiving from; ie. 'base_dir' will be the common prefix of all files and directories in the archive. 'root_dir' and 'base_dir' both default to the current directory. Returns the name of the archive file. 'owner' and 'group' are used when creating a tar archive. By default, uses the current owner and group. Nzchanging into '%s')rrzunknown archive format '%s'rrrrzchanging back to '%s') r,getcwddebugr-r0chdirrrrr)rr7Zroot_dirrrrrrrZsave_cwdrP format_infofuncargvalr}r r r!rs6        cCsddtjD}|j|S)zReturns a list of supported formats for unpacking. Each element of the returned sequence is a tuple (name, extensions, description) cSs"g|]\}}||d|dfqS)rr )rrLrr r r!r6sz&get_unpack_formats..)_UNPACK_FORMATSrr)rr r r!r0s c Csvi}x.tjD]"\}}x|dD] }|||<q WqWx,|D]$}||kr:d}t||||fq:Wt|srtddS)z+Checks what gets registered as an unpacker.rz!%s is already registered for "%s"z*The registered function must be a callableN)rrr$rr) extensionsrrZexisting_extensionsrLrext extensionmsgr r r!_check_unpack_options;s rcCs,|dkr g}t|||||||ft|<dS)aMRegisters an unpack format. `name` is the name of the format. `extensions` is a list of extensions corresponding to the format. `function` is the callable that will be used to unpack archives. The callable will receive archives to unpack. If it's unable to handle an archive, it needs to raise a ReadError exception. If provided, `extra_args` is a sequence of (name, value) tuples that will be passed as arguments to the callable. description can be provided to describe the format, and will be returned by the get_unpack_formats() function. N)rr)rLrrrrr r r!rMs cCs t|=dS)z*Removes the pack format from the registry.N)r)rLr r r!rcscCs&tjj|}tjj|s"tj|dS)z1Ensure that the parent directory of `path` existsN)r,r-rr_rk)r-rr r r!_ensure_directorygs  rc Csddl}|j|std||j|}zx|jD]}|j}|jds4d|krRq4tjj |f|j d}|spq4t ||j ds4|j |j}t|d}z|j|Wd|j~Xq4WWd|jXdS)z+Unpack zip `filename` to `extract_dir` rNz%s is not a zip file/z..r6)rZ is_zipfiler#rZinfolistr}rr,r-r`splitrrr&r>r'r) r} extract_dirrrrrLtargetdatafr r r!_unpack_zipfilems*       r)rdcCs\ddl}y|j|}Wn"|jk r8td|YnXz|j||dWd|jXdS)zAUnpack tar/tar.gz/tar.bz2/tar.xz `filename` to `extract_dir` rNz/%s is not a compressed or uncompressed tar file)rd)rr>ZTarErrorr#Z extractallr)r}rrdrZtarobjr r r!_unpack_tarfilesrz.tarz.zip)rrz.tar.gzz.tgzz.tar.bz2z.tbz2z.tar.xzz.txzcCs:x4tjD](\}}x|dD]}|j|r|SqWq WdS)Nr)rrr)r}rLrrr r r!_find_unpack_formats   rc Cs|dkrtj}|dkri}nd|i}|dk ry t|}Wn"tk r\tdj|YnX|d}|||ft|d|nRt|}|dkrtdj|t|d}tt|d}|j ||||f|dS)a]Unpack an archive. `filename` is the name of the archive. `extract_dir` is the name of the target directory, where the archive is unpacked. If not provided, the current working directory is used. `format` is the archive format: one of "zip", "tar", "gztar", "bztar", or "xztar". Or any other registered format. If not provided, unpack_archive will use the filename extension and see if an unpacker was registered for that extension. In case none is found, a ValueError is raised. If `filter` is given, it is passed to the underlying extraction function. NrdzUnknown unpack format '{0}'rrzUnknown archive format '{0}') r,rrrrr7dictrr#update)r}rr7rdZ filter_kwargsrrrPr r r!rs&   statvfs disk_usageZusageztotal used freezTotal space in byteszUsed space in byteszFree space in bytescCs@tj|}|j|j}|j|j}|j|j|j}t|||S)zReturn disk usage statistics about the given path. Returned value is a named tuple with attributes 'total', 'used' and 'free', which are the amount of total, used and free space, in bytes. )r,rf_bavailf_frsizef_blocksf_bfree_ntuple_diskusage)r-r@freetotalusedr r r!rs    ntcCs"tj|\}}||}t|||S)zReturn disk usage statistics about the given path. Returned values is a named tuple with attributes 'total', 'used' and 'free', which are the amount of total, used and free space, in bytes. )rZ _getdiskusager)r-rrrr r r!rscCs|dkr|dkrtd|}|}|dkr.d}n(t|trVt|}|dkrVtdj||dkrdd}n(t|tst|}|dkrtdj|tj |||dS)zChange owner user and group of the given path. user and group can be the uid/gid or the user/group names, and in that case, they are converted to their respective uid/gid. Nzuser and/or group must be setrzno such user: {!r}zno such group: {!r}r) rrrnr LookupErrorr7intrr,r)r-userrZ_userZ_groupr r r!r s"  PcCsyttjd}Wnttfk r.d}YnXyttjd}Wnttfk r^d}YnX|dksp|dkrytjtjj}Wn$t tt fk rtj |}YnX|dkr|j }|dkr|j }tj ||fS)aGet the size of the terminal window. For each of the two dimensions, the environment variable, COLUMNS and LINES respectively, is checked. If the variable is defined and the value is a positive integer, it is used. When COLUMNS or LINES is not defined, which is the common case, the terminal connected to sys.__stdout__ is queried by invoking os.get_terminal_size. If the terminal size cannot be successfully queried, either because the system doesn't support querying, or because we are not connected to a terminal, the value given in fallback parameter is used. Fallback defaults to (80, 24) which is the default size used by many terminal emulators. The value returned is a named tuple of type os.terminal_size. ZCOLUMNSrZLINES)rr,environrrrrt __stdout__filenoAttributeErrorr. terminal_sizecolumnslines)Zfallbackrrsizer r r!r(s$  c s"dd}tjjr&||r"SdS|dkr>tjjdtj}|sFdS|jtj}tj dkrtj |krt|j dtj tjjddjtj}t fd d |Drg}q‡fd d |D}ng}t }xT|D]L}tjj|}||kr|j|x(|D] } tjj|| } || |r| SqWqWdS) a3Given a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file. `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or can be overridden with a custom search path. cSs&tjj|o$tj||o$tjj| S)N)r,r-rlaccessr_)r?r\r r r! _access_checkbszwhich.._access_checkNPATHZwin32rZPATHEXTrc3s |]}jj|jVqdS)N)lowerr)rr)cmdr r! szwhich..csg|] }|qSr r )rr)r r r!rszwhich..)r,r-rrgetdefpathrpathseprtplatformrinsertanyrer/rr`) r r\r-rZpathextfilesseendirZnormdirZthefilerLr )r r!rUs8            @)r)FN)rrrNNN)rrN)rN)rr)rr)rr)Nr)NNrrNNN)Nr)NN)NNrr)r)Vr"r,rtr8rc collectionsrFzlibr ImportErrorrrZlzmarpwdrZgrpr__all__r.r rrrr#rr$rr3rrr+rNrrr rr rwrr>rxrysupports_dir_fdrj supports_fdrUrr Zavoids_symlink_attacksrr rrrrrrrrrrrrrrrrrrrrrm namedtuplerrrrrrLrrrF_OKX_OKrr r r r!s          :  Y!,   5 8    @ -     6  "       /        -profile.cpython-36.pyc000064400000033117152462730460010650 0ustar003 \ V@sdZddlZddlZddlZddlZddlmZdddgZGdddZdd dZ dd dZ Gd ddZ d dZ e dkre dS)z Class for profiling Python code.N) OptionParserrunrunctxProfilec@s0eZdZdZddZddZddZdd Zd S) _UtilszSupport class for utility functions which are shared by profile.py and cProfile.py modules. Not supposed to be used directly. cCs ||_dS)N)profiler)selfrr /usr/lib64/python3.6/profile.py__init__1sz_Utils.__init__cCsF|j}z(y|j|Wntk r,YnXWd|j|||XdS)N)rr SystemExit_show)r statementfilenamesortprofr r r r4s  z _Utils.runcCsJ|j}z,y|j|||Wntk r0YnXWd|j|||XdS)N)rrr r )rrglobalslocalsrrrr r r r=s  z _Utils.runctxcCs"|dk r|j|n |j|dS)N) dump_stats print_stats)rrrrr r r r Fs z _Utils._showN)__name__ __module__ __qualname____doc__r rrr r r r r r+s   rcCsttj|||S)aRun statement under profiler optionally saving results in filename This function takes a single argument that can be passed to the "exec" statement, and an optional file name. In all cases this routine attempts to "exec" its first argument and gather profiling statistics from the execution. If no file name is present, then this function automatically prints a simple profiling report, sorted by the standard name string (file/line/function-name) that is presented in each line. )rrr)rrrr r r rRs cCsttj|||||S)zRun statement under profiler, supplying your own globals and locals, optionally saving results in filename. statement and filename have the same semantics as profile.run )rrr)rrrrrr r r r_sc@seZdZdZdZd4ddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ e e e e e e dZddZGdddZGdddZddZdd Zd6d"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd7d0d1Zd2d3ZdS)8raProfiler class. self.cur is always a tuple. Each such tuple corresponds to a stack frame that is currently active (self.cur[-2]). The following are the definitions of its members. We use this external "parallel stack" to avoid contaminating the program that we are profiling. (old profiler used to write into the frames local dictionary!!) Derived classes can change the definition of some entries, as long as they leave [-2:] intact (frame and previous tuple). In case an internal error is detected, the -3 element is used as the function name. [ 0] = Time that needs to be charged to the parent frame's function. It is used so that a function call will not have to access the timing data for the parent frame. [ 1] = Total time spent in this frame's function, excluding time in subfunctions (this latter is tallied in cur[2]). [ 2] = Total time spent in subfunctions, excluding time executing the frame's function (this latter is tallied in cur[1]). [-3] = Name of the function that corresponds to this frame. [-2] = Actual frame that we correspond to (used to sync exception handling). [-1] = Our parent 6-tuple (corresponds to frame.f_back). Timing data for each function is stored as a 5-tuple in the dictionary self.timings[]. The index is always the name stored in self.cur[-3]. The following are the definitions of the members: [0] = The number of times this function was called, not counting direct or indirect recursion, [1] = Number of times this function appears on the stack, minus one [2] = Total time spent internal to this function [3] = Cumulative time that this function was present on the stack. In non-recursive functions, this is the total execution time from start to finish of each invocation of a function, including time spent in all subfunctions. [4] = A dictionary indicating for each function name, the number of times it was called by us. rNc Csi|_d|_d|_d|_|dkr&|j}||_|sHtj|_|_|j |_ nl||_|j}y t |}Wn"t k r||_|j |_ Yn0X|dkr|j |_ n|j|_ |tfdd}||_|j|_|jddS)NcSs ||S)Nr )timersumr r r get_time_timersz(Profile.__init__..get_time_timerr)timingscurcmd c_func_namebiastimeZ process_timerget_timetrace_dispatch_i dispatcherlen TypeErrortrace_dispatchtrace_dispatch_lrt simulate_call)rrr$r-Zlengthrr r r r s0    zProfile.__init__cCs|j}|}|d|d|j|j}|dkr8|j|_|j||||rd|}|d|d|_n|}|d|d||_dS)Nrrc_call)rr-r$rr#dispatch)rframeeventargrr-rr r r r+szProfile.trace_dispatchcCsT|j}||j|j}|dkr(|j|_|j||||rD||_n |||_dS)Nr/)rr-r$rr#r0)rr1r2r3rr-r r r r's zProfile.trace_dispatch_icCs`|j}|d|j|j}|dkr,|j|_|j||||rL|d|_n|d||_dS)NgN@r/)rr-r$rr#r0)rr1r2r3rr-r r r trace_dispatch_macszProfile.trace_dispatch_maccCsT|j}||j|j}|dkr(|j|_|j||||rD||_n |||_dS)Nr/)r&r-r$rr#r0)rr1r2r3r&r-r r r r,s zProfile.trace_dispatch_lc CsD|j\}}}}}}||k r*|r*|j||S|||||||f|_dS)Nr)r!trace_dispatch_return) rr1r-rptritretrfnrframercurr r r trace_dispatch_exceptions   z Profile.trace_dispatch_exceptioncCs|jr|j|jdk r|j\}}}}}}t|tjs|j|jksXtd|||j||jf|j|d|jdks|j|jdkstd|jdf|j} | j| j | j f} |dd| ||jf|_|j } | | kr| | \} } }}}| | d|||f| | <nddddif| | <dS) NrzBad callrrr?) r!f_back isinstancer fake_frameAssertionErrorr6f_code co_filenameco_firstlinenoco_namer )rr1r-r7r8r9r:r;r<Zfcodefnr ccnsttctcallersr r r trace_dispatch_calls&    zProfile.trace_dispatch_callc Csndd|jf}|dd|||jf|_|j}||krX||\}}}}} ||d||| f||<nddddif||<dS)Nrrr)r#r!r ) rr1r-rIr rJrKrLrMrNr r r trace_dispatch_c_calls zProfile.trace_dispatch_c_callcCs||jdk rB||jdjks0td|jdf|j|jd d|j\}}}}}}||}||}|\} } } } } }| | || || | |f|_|j}||\}}}}}|s||}|d}| |kr|| d|| <nd|| <||d||||f||<dS) Nrz Bad returnr>rrr?r?r@r?)r!rArDr6r )rr1r-r7r8r9r:r<Z frame_totalZpptZpitZpetZpfnpframeZpcurr rJrKrLrMrNr r r r6#s$"zProfile.trace_dispatch_return)callZ exceptionreturnr/Z c_exceptionZc_returncCs"|jdrdS||_|j|dS)Nr)r!r"r.)rr"r r r set_cmdYs zProfile.set_cmdc@seZdZddZddZdS)zProfile.fake_codecCs||_||_||_d|_dS)Nr)rFco_linerHrG)rrlinenamer r r r _szProfile.fake_code.__init__cCst|j|j|jfS)N)reprrFrVrH)rr r r __repr__eszProfile.fake_code.__repr__N)rrrr rZr r r r fake_code^sr[c@seZdZddZdS)zProfile.fake_framecCs||_||_dS)N)rErA)rcodeZpriorr r r r iszProfile.fake_frame.__init__N)rrrr r r r r rChsrCcCsF|jdd|}|jr |jd}nd}|j||}|jd||ddS)NZprofilerrrRr?)r[r!rCr0)rrXr\rQr1r r r r.ms   zProfile.simulate_callcCsN|j}||j}x*|jdr<|jd||jd|d}qW|||_dS)NrrSrrrTr?)r&r-r!r0)rr&r-r r r simulate_cmd_completeys   zProfile.simulate_cmd_completercCs$ddl}|j|jj|jdS)Nr)pstatsZStatsZ strip_dirsZ sort_statsr)rrr^r r r rszProfile.print_statsc Cs0t|d}|jtj|j|WdQRXdS)Nwb)open create_statsmarshaldumpstats)rfilefr r r rs zProfile.dump_statscCs|j|jdS)N)r]snapshot_stats)rr r r raszProfile.create_statsc Csfi|_xZ|jjD]L\}\}}}}}|j}d}x|jD] }||7}q:W|||||f|j|<qWdS)Nr)rdr itemscopyvalues) rfuncrJrKrLrMrNZncZcallcntr r r rgs zProfile.snapshot_statscCsddl}|j}|j|||S)Nr)__main____dict__r)rr"rldictr r r rsz Profile.runc Cs8|j|tj|jzt|||WdtjdX|S)N)rUsys setprofiler(exec)rr"rrr r r rs    zProfile.runctxc Os6|jt|tj|jz |||StjdXdS)N)rUrYrorpr()rrkargskwr r r runcalls   zProfile.runcallc Cs8|jtk rtd|j}d|_z |j||S||_XdS)Nz&Subclasses must override .calibrate().r) __class__rr*r$_calibrate_inner)rmverboseZ saved_biasr r r calibrates  zProfile.calibratecCs$|j}dd}|fdd}|||}|||}||}|rLtd|t} |}| jdtt|}||} |rtd| d} d} x>| jjD]0\\} }}\}}}}}|dkr| |7} | |7} qW|rtd | td | | |d krtd| | |d| }|r td||S)NcSsxt|D]}d}q WdS)Nr)range)nixr r r f1sz$Profile._calibrate_inner..f1cSsxt|D] }|dq WdS)Nd)rz)rwr~r|r r r rfsz#Profile._calibrate_inner..fz elapsed time without profiling =zf(m)zelapsed time with profiling =grfr~z!'CPU seconds' profiler reported =ztotal # calls =rz internal error: total calls = %dg@z+mean stopwatch overhead per profile event =)rfr~) r&printrrrrr rh ValueError)rrwrxr&r~rfZt0Zt1Zelapsed_noprofilepZelapsed_profileZ total_callsZ reported_timerrWfuncnamerJrKrLrMrNZmeanr r r rvsB   "     zProfile._calibrate_inner)NNrT)rT)r)rrrrr$r r+r'r5r,r=rOrPr6r0rUr[rCr.r]rrrargrrrtryrvr r r r rhs>% ' '      1 c Csd}t|d}d|_|jdddddd|jd d d d ddtjd ds\|jtjd|j\}}|tjdd<t|dkr|d}tj j dt j j |t |d}t|j|d}WdQRX|dddd}t||d|j|jn|j|S)Nz?profile.py [-o output_file_path] [-s sort] scriptfile [arg] ...)usageFz-oz --outfileoutfilezSave stats to )desthelpdefaultz-sz--sortrz?Sort order when printing to stdout, based on pstats.Stats classrrrrbrqrl)__file__r __package__ __cached__rT)rZallow_interspersed_argsZ add_optionroargvZ print_usageexit parse_argsr)pathinsertosdirnamer`compilereadrrr)rparserZoptionsrrZprognamefpr\Zglobsr r r main*s2        rrlrT)NrTrT)NrT)rrorr%rbZoptparser__all__rrrrrrr r r r  s   ' E"rlcompleter.cpython-36.pyc000064400000013226152462730460011537 0ustar003 \ @sdZddlZddlZddlZdgZGdddZddZy ddlZWnek r\dZ Yn"Xej ej ej dd d Z dS) a1Word completion for GNU readline. The completer completes keywords, built-ins and globals in a selectable namespace (which defaults to __main__); when completing NAME.NAME..., it evaluates (!) the expression up to the last dot and completes its attributes. It's very cool to do "import sys" type "sys.", hit the completion key (twice), and see the list of names defined by the sys module! Tip: to use the tab key as the completion key, call readline.parse_and_bind("tab: complete") Notes: - Exceptions raised by the completer function are *ignored* (and generally cause the completion to fail). This is a feature -- since readline sets the tty device in raw (or cbreak) mode, printing a traceback wouldn't work well without some complicated hoopla to save, reset and restore the tty state. - The evaluation of the NAME.NAME... form may cause arbitrary application defined code to be executed if an object with a __getattr__ hook is found. Since it is the responsibility of the application (or the user) to enable this feature, I consider this an acceptable risk. More complicated expressions (e.g. function calls or indexing operations) are *not* evaluated. - When the original stdin is not a tty device, GNU readline is never used, and this module (and the readline module) are silently inactive. N Completerc@s6eZdZd ddZddZddZdd Zd d ZdS) rNcCs8|rt|t rtd|dkr(d|_n d|_||_dS)aCreate a new completer for the command line. Completer([namespace]) -> completer instance. If unspecified, the default namespace where completions are performed is __main__ (technically, __main__.__dict__). Namespaces should be given as dictionaries. Completer instances should be used as the completion mechanism of readline via the set_completer() call: readline.set_completer(Completer(my_namespace).complete) znamespace must be a dictionaryNr) isinstancedict TypeError use_main_ns namespace)selfrr #/usr/lib64/python3.6/rlcompleter.py__init__'s zCompleter.__init__c Cs|jrtj|_|jsB|dkr>tr8tjdtjdSdSndS|dkrld|kr`|j ||_ n |j ||_ y |j |St k rdSXdS)zReturn the next possible completion for 'text'. This is called successively with state == 0, 1, 2, ... until it returns None. The completion should begin with 'text'. r N.) r__main____dict__rstrip_readline_availablereadlineZ insert_textZ redisplay attr_matchesmatchesglobal_matches IndexError)r textstater r r completeBs$   zCompleter.completecCst|r|d}|S)N()callable)r valwordr r r _callable_postfixaszCompleter._callable_postfixc Csddl}g}dh}t|}xT|jD]J}|d||kr"|j||dkrR|d}n|dkrb|d}|j|q"Wx^|jtjgD]N}xH|jD]<\}}|d||kr||kr|j||j|j ||qWq~W|S)zCompute matches when text is a simple name. Return a list of all keywords, built-in functions and names currently defined in self.namespace that match. rN __builtins__finallytry:FalseNoneTruebreakcontinuepasselse >r"r#>r*r&r)r+r%r(r') keywordlenkwlistaddappendrbuiltinsritemsr ) r rr-rseennrZnspacerr r r rfs(    zCompleter.global_matchescCsnddl}|jd|}|sgS|jdd\}}yt||j}Wntk rPgSXtt|}|jdt |dr|j d|j t |j g}t|} |dkrd } n|d krd } nd} xx~|D]v} | d| |ko| o| d| d| k rd || f} yt|| } Wntk rYnX|j| | } |j| qW|sH| rJP| d krZd } qd} qW|j|S) aCompute matches when text contains a dot. Assuming the text is of the form NAME.NAME....[NAME], and is evaluable in self.namespace, it will be evaluated and its attributes (as revealed by dir()) are used as possible completions. (For class instances, class members are also considered.) WARNING: this can still invoke arbitrary C code, if an object with a __getattr__ hook is evaluated. rNz(\w+(\.\w+)*)\.(\w*)rr! __class__r___z%s.%s)rematchgroupevalr Exceptionsetdirdiscardhasattrr0updateget_class_membersr7r.getattrr r1sort)r rr:mexprattrZ thisobjectZwordsrr5Znoprefixrr;rr r r rsN          zCompleter.attr_matches)N)__name__ __module__ __qualname__r rr rrr r r r r&s  cCs2t|}t|dr.x|jD]}|t|}qW|S)N __bases__)r@rBrMrD)klassZretbaser r r rDs   rDFcCs tjdS)N)r set_completerr r r r srQT) __doc__atexitr2r__all__rrDr ImportErrorrrPrregisterr r r r s  sndhdr.cpython-36.opt-1.pyc000064400000015403152462730460011427 0ustar003 \@s2dZddgZddlmZeddZdej_dej_d ej_d ej_d ej _d dZ d dZ gZ ddZ e je ddZe jeddZe jeddZe jeddZe jeddZe jeddZe jeddZe jeddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zed*kr.ed+S),aRoutines to help recognizing sound files. Function whathdr() recognizes various types of sound file headers. It understands almost all headers that SOX can decode. The return tuple contains the following items, in this order: - file type (as SOX understands it) - sampling rate (0 if unknown or hard to decode) - number of channels (0 if unknown or hard to decode) - number of frames in the file (-1 if unknown or hard to decode) - number of bits/sample, or 'U' for U-LAW, or 'A' for A-LAW If the file doesn't have a recognizable type, it returns None. If the file can't be opened, OSError is raised. To compute the total time, divide the number of frames by the sampling rate (a frame contains a sample for each channel). Function what() calls whathdr(). (It used to also use some heuristics for raw data, but this doesn't work very well.) Finally, the function test() is a simple main program that calls what() for all files mentioned on the argument list. For directory arguments it calls what() for all files in that directory. Default argument is "." (testing all files in the current directory). The option -r tells it to recurse down directories found inside explicitly given directories. whatwhathdr) namedtuple SndHeadersz.filetype framerate nchannels nframes sampwidthzThe value for type indicates the data type and will be one of the strings 'aifc', 'aiff', 'au','hcom', 'sndr', 'sndt', 'voc', 'wav', '8svx', 'sb', 'ub', or 'ul'.zYThe sampling_rate will be either the actual value or 0 if unknown or difficult to decode.z^The number of channels or 0 if it cannot be determined or if the value is difficult to decode.z?The value for frames will be either the number of frames or -1.zAEither the sample size in bits or 'A' for A-LAW or 'U' for u-LAW.cCs t|}|S)zGuess the type of a sound file.)r)filenameresr/usr/lib64/python3.6/sndhdr.pyr4sc CsHt|d4}|jd}x"tD]}|||}|rt|SqWdSQRXdS)zRecognize sound headers.rbiN)openreadtestsr)rfhZtfrrrr r:s     cCsddl}|jdsdS|dddkr,d}n|dddkrBd}ndS|jdy|j|d }Wnt|jfk rzdSX||j|j|jd|j fS) NrsFORM sAIFCaifcsAIFFZaiffr) r startswithseekr EOFErrorError getframerate getnchannels getnframes getsampwidth)rrrZfmtarrr test_aifcKs  rc Cs|jdrt}n|dddkr&t}ndSd}||dd}||dd}||dd}||dd }||d d }d } |d krd } n$|d krd} n|dkrd} d } nd} | |} | r|| } nd} |||| | fS)Ns.sndds.dns.ZaurrU?)rr )r get_long_be get_long_le) rrfuncfiletypeZhdr_sizeZ data_sizeencodingrate nchannelsZ sample_sizeZ sample_bitsZ frame_sizeZnframerrr test_au`s2  r1cCsT|dddks |dddkr$dSt|dd}|rBd |}nd }d |d dd fS)NAEsFSSDsHCOMi"VrZhcomr$rr))r*)rrZdivisorr/rrr test_hcoms  r8cCst|jdsdSt|dd}d}d|ko4dknrf||dkrfd||d}|rftd |}d |dd d fS) NsCreative Voice Filer"rir$rg.AZvocrr))r get_short_leint)rrZsbseekr/Zratecoderrr test_vocs $ r=cCsddl}|jd s4|dddks4|dddkr8dS|jdy|j|d}Wnt|jfk rldSXd |j|j|jd|j fS) NrsRIFFrrsWAVEr!sfmt rZwav) waverrZopenfprrrrrr)rrr>wrrr test_wavs, r@cCs$|jd s|dddkr dSdS) NsFORMrrs8SVX8svxrr$)rArr$rr)r)rrrrr test_8svxsrBcCs<|jdr8t|dd}t|dd}d|d|dfSdS)NsSOUNDrrr"r9Zsndtr$)rr+r;)rrZnsamplesr/rrr test_sndts rCcCsD|jdr@t|dd}d|ko,dknr@d|dd dfSdS) Nsr&riiaZsndrr$rr))rr;)rrr/rrr test_sndrs rDcCs,|dd>|dd>B|dd>B|dBS)Nrr#r$r!r&rr'r)brrr r*sr*cCs,|dd>|dd>B|dd>B|dBS)Nr'r#r&r!r$rrr)rErrr r+sr+cCs|dd>|dBS)Nrrr$r)rErrr get_short_besrFcCs|dd>|dBS)Nr$rrr)rErrr r;sr;c Csddl}d}|jddr8|jddkr8|jdd=d}y8|jddr`t|jdd|dntdg|dWn*tk r|jjd|jdYnXdS)Nrr$z-rr&.z [Interrupted] )sysargvtestallKeyboardInterruptstderrwriteexit)rH recursiverrr tests  rPc Csddl}ddl}x|D]}|jj|rzt|ddd|s>|rptdddl}|j|jj|d}t||dqtdqt|ddd|jj ytt |Wqt k rtd YqXqWdS) Nrz/: )endzrecursing down:*z*** directory (use -r) ***:z*** not found ***) rHospathisdirprintglobjoinrJstdoutflushrOSError)listrOZtoplevelrHrUrrYnamesrrr rJs"    rJ__main__N)__doc____all__ collectionsrrr-Z framerater0ZnframesZ sampwidthrrr rappendr1r8r=r@rBrCrDr*r+rFr;rPrJ__name__rrrr sH          uuid.cpython-36.opt-2.pyc000064400000033500152462730460011112 0ustar003 i]@sddlZdZddddg\ZZZZeZeZ Gddde Z d d Z d d Z d dZddZddZddZddZddZddZdZZyddlZddlZddlZdgZejjdsejdxLeD]DZyejej j!eZ"Wne#k rwYnXe$e"dre"j%ZPqW[ejdkrzreserved for NCS compatibilityzspecified in RFC 4122z$reserved for Microsoft compatibilityzreserved for future definitionc@seZdZd6ddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ eddZeddZeddZeddZed d!Zed"d#Zed$d%Zed&d'Zed(d)Zed*d+Zed,d-Zed.d/Zed0d1Zed2d3Zed4d5ZdS)7UUIDNcCs|||||gjddkr td|dk rl|jddjdd}|jdjdd}t|dkrbtd t|d }|dk rt|d krtd |d'dd(|d)d*d+|d,d-d.|dd}|dk rt|d krtdtj|dd}|dk r"t|d kr td|\}}} } } } d|ko.d/kns>tdd|koRd0knsbtdd| kovd1knstdd| kod2knstdd| kod3knstdd| kod4knstd| d>| B} |d>|d>B| d>B| d>B| B}|dk rTd|koDd d>knsTtd|dk rd |kord knstd!|d6M}|d7O}|d9M}||d%>O}||jd&<dS):NzGone of the hex, bytes, bytes_le, fields, or int arguments must be givenzurn:zuuid:z{}- z$badly formed hexadecimal UUID stringz bytes_le is not a 16-char stringzbytes is not a 16-char stringbig) byteorderzfields is not a 6-tuplerz*field 1 out of range (need a 32-bit value)z*field 2 out of range (need a 16-bit value)z*field 3 out of range (need a 16-bit value)z*field 4 out of range (need an 8-bit value)z*field 5 out of range (need an 8-bit value)0z*field 6 out of range (need a 48-bit value)`P@z*int is out of range (need a 128-bit value)zillegal version numberiiiLintrrrrrliirll l lll) count TypeErrorreplacestriplen ValueErrorint_ from_bytes__dict__)selfhexbytesbytes_lefieldsrversiontime_lowtime_midtime_hi_versionclock_seq_hi_variant clock_seq_lownode clock_seqr//usr/lib64/python3.6/uuid.py__init__jsZ   6    $    z UUID.__init__cCst|tr|j|jkStS)N) isinstancerrNotImplemented)r"otherr/r/r0__eq__s  z UUID.__eq__cCst|tr|j|jkStS)N)r2rrr3)r"r4r/r/r0__lt__s  z UUID.__lt__cCst|tr|j|jkStS)N)r2rrr3)r"r4r/r/r0__gt__s  z UUID.__gt__cCst|tr|j|jkStS)N)r2rrr3)r"r4r/r/r0__le__s  z UUID.__le__cCst|tr|j|jkStS)N)r2rrr3)r"r4r/r/r0__ge__s  z UUID.__ge__cCs t|jS)N)hashr)r"r/r/r0__hash__sz UUID.__hash__cCs|jS)N)r)r"r/r/r0__int__sz UUID.__int__cCsd|jjt|fS)Nz%s(%r)) __class____name__str)r"r/r/r0__repr__sz UUID.__repr__cCs tddS)NzUUID objects are immutable)r)r"namevaluer/r/r0 __setattr__szUUID.__setattr__cCsDd|j}d|dd|dd|dd|dd|ddfS)Nz%032xz%s-%s-%s-%s-%sr r)r)r"r#r/r/r0__str__s z UUID.__str__cCs|jjddS)Nrr )rto_bytes)r"r/r/r0r$sz UUID.bytescCs<|j}|ddd|ddd |d d d |ddS) Nrrr r rrrrrrrr)r$)r"r$r/r/r0r%s(z UUID.bytes_lecCs|j|j|j|j|j|jfS)N)r(r)r*r+r,r-)r"r/r/r0r&s z UUID.fieldscCs |jd?S)Nr)r)r"r/r/r0r(sz UUID.time_lowcCs|jd?d@S)Nri)r)r"r/r/r0r)sz UUID.time_midcCs|jd?d@S)Nri)r)r"r/r/r0r*szUUID.time_hi_versioncCs|jd?d@S)N8)r)r"r/r/r0r+szUUID.clock_seq_hi_variantcCs|jd?d@S)Nr rI)r)r"r/r/r0r,szUUID.clock_seq_lowcCs|jd@d>|jd>B|jBS)Nir r)r*r)r()r"r/r/r0time sz UUID.timecCs|jd@d>|jBS)N?r )r+r,)r"r/r/r0r.s zUUID.clock_seqcCs |jd@S)Nl)r)r"r/r/r0r-sz UUID.nodecCs d|jS)Nz%032x)r)r"r/r/r0r#szUUID.hexcCs dt|S)Nz urn:uuid:)r?)r"r/r/r0urnszUUID.urncCs2|jd@stS|jd@stS|jd@s*tStSdS)Nir i@i lll)r RESERVED_NCSRFC_4122RESERVED_MICROSOFTRESERVED_FUTURE)r"r/r/r0variant s   z UUID.variantcCs |jtkrt|jd?d@SdS)Nr)rQrNr)r"r/r/r0r'+s z UUID.version)NNNNNN)r> __module__ __qualname__r1r5r6r7r8r9r;r<r@rCrFpropertyr$r%r&r(r)r*r+r,rJr.r-r#rLrQr'r/r/r/r0r:s60 O              rc Gsddl}ddl}ddl}|j|}|dkrP|jjd}|j||d}|dkrPdSt|j}d|d<|j|f||j |j |d}|S) Nr/sbin /usr/sbin)pathCLC_ALL)stdoutstderrenv)rVrW) osshutil subprocessZwhichpathsepjoindictenvironPopenPIPEZDEVNULL) commandargsr^r_r` executablerXr]procr/r/r0_popen1s    rkc Csyt|f|j}|sdS|x|jD]z}|jjj}xdtt|D]T}|||krLy*|||}t|jddd} | r| SWqLt t fk rYqLXqLWq*WWdQRXWnt k rYnXdS)N:r) rksplitr[lowerrstriprangerrrr IndexErrorOSError) rgrhZhw_identifiersZ get_indexrjlinewordsiwordmacr/r/r0 _find_macDs$   rycCs0d }x&d D]}td||d d }|r |Sq WdS) Nhwaddretheraddress:lladdrr-a-avZifconfigcSs|dS)Nrr/)rvr/r/r0bsz#_ifconfig_getnode..)rzr{r|r})rr~r)ry)keywordsrhrxr/r/r0_ifconfig_getnode]s  rcCs tdddgdd}|r|SdS)NZiplinks link/ethercSs|dS)Nrr/)rvr/r/r0risz_ip_getnode..)ry)rxr/r/r0 _ip_getnodefsrcCsddl}ddl}y|j|j}Wntk r6dSXtdd|j|gdd}|rZ|Stdd|j|gdd}|r||Stdd|jd|gdd}|r|SdS) NrZarpz-ancSsdS)Nrrr/)rvr/r/r0rvsz_arp_getnode..cSs|dS)Nrr/)rvr/r/r0r{sz(%s)cSs|dS)Nr/)rvr/r/r0rs)r^socketZ gethostbynameZ gethostnamersryfsencode)r^rZip_addrrxr/r/r0 _arp_getnodems rcCstdddgddS)NZlanscanz-aislan0cSsdS)Nrr/)rvr/r/r0rsz"_lanscan_getnode..)ryr/r/r/r0_lanscan_getnodesrc"Csytdd}|sdS||jjjj}y|jd}Wntk rNdSXxt|jD]j}yL|jj}||}t|dkr|jddkrt |j ddd}|r|SWqXtt fk rYqXXqXWWdQRXWnt k rYnXdS) NZnetstatz-iasAddressrlrrmr) rkr[readlinerprnindexrrrrrrrrs)rjrurvrtrwrxr/r/r0_netstat_getnodes,   rc Cs ddl}ddl}ddl}dddg}y:ddl}|jd}|jjj|d|jd|j j dWn YnXx|D]}y$|j |j j |ddg|jd d }Wntk rwpYnX|JxB|jD]8}|jd djj} |jd | rt| jdddSqWWdQRXqpWdS)Nrrzc:\windows\system32zc:\winnt\system32i,mbcsZipconfigz/allZoem)r[encoding:rz((?:[0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]rrr)r^rer`ctypescreate_string_bufferwindllZkernel32ZGetSystemDirectoryAinsertrBdecodererXrbrfrsr[rnrro fullmatchrr) r^rr`dirsrbufferdirrjrtrBr/r/r0_ipconfig_getnodes*      rcCsddl}ddl}|j}|j|_|j|_}|j|j|dkrHdS|j xt |j D]}|j |j |_t|j||_|j|dkrq\|j |j|_t|j||_djd|_|j|_}|j|dkrq\|j |jdd}t|dkrq\tj|dSWdS)Nr*rr r ) win32wnetnetbiosZNCBZNCBENUMZCommandZ LANA_ENUMZBufferZ_packZNetbiosZ_unpackrqZlengthZResetZNCBRESETordZlanaZLana_numZNCBASTATljustZCallnameZADAPTER_STATUSZadapter_addressrrr )rrZncbZadaptersrvZstatusr$r/r/r0_netbios_getnodes4  rZuuidwincuuid_generate_timedarwin. ZUuidCreateSequentialZ UuidCreatecCs$tjd}t|tt|jdjS)Nr)r$)rr_uuid_generate_timerbytes_rawr-)_bufferr/r/r0_unixdll_getnodes rcCs,tjd}t|dkr(tt|jdjSdS)Nrr)r$)rr _UuidCreaterrrr-)rr/r/r0_windll_getnodes  rcCsddl}|jddBS)Nrr l)random getrandbits)rr/r/r0_random_getnodesrc Cs~tdk r tSddl}|jdkr$t}nt}xP|tgD]B}y |aWnw4YnXtdk r4dtkoldknr4tSq4WdS)NrZwin32rr l)_nodesysplatform_NODE_GETTERS_WIN32_NODE_GETTERS_UNIXr)rZgettersgetterr/r/r0getnode&s    rc Cstr>||kodknr>tjd}t|tt|jdSddl}t|jd}t|dd}tdk r~|tkr~td}|a|dkrddl }|j d}|d @}|d ?d @}|d ?d @} |d@} |d?d@} |dkrt }t||| | | |fddS)Nr)r$rgeAdl@'Hw rlrir irIr rK)r&r') rrrrrrrJr_last_timestamprrr) r-r.rrJZ nanosecondsZ timestamprr(r)r*r,r+r/r/r0uuid1Ds,     rcCs<ddlm}||jt|dddj}t|ddddS) Nr)md5zutf-8F)Zusedforsecurityrr)r$r')hashlibrr$digestr) namespacerArrr/r/r0uuid3gs   rcCsttjdddS)Nrr)r$r')rr^urandomr/r/r/r0uuid4psrcCs8ddlm}||jt|dj}t|ddddS)Nr)sha1zutf-8rr)r$r')rrr$rr)rrArr:r/r/r0uuid5ts rz$6ba7b810-9dad-11d1-80b4-00c04fd430c8z$6ba7b811-9dad-11d1-80b4-00c04fd430c8z$6ba7b812-9dad-11d1-80b4-00c04fd430c8z$6ba7b814-9dad-11d1-80b4-00c04fd430c8)NN)/sxx "           # codecs.cpython-36.opt-1.pyc000064400000102156152462730460011407 0ustar003 \:@sdZddlZddlZy ddlTWn.ek rNZzedeWYddZ[XnXddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0g,Zd1Zd2Z Z d3Z Z d4Z d5Zejd6kre ZZe Zn e ZZeZe Ze Ze ZeZGd7ddeZGd8ddZGd9ddeZGd:d;d;eZGdd>eZGd?ddeZGd@ddeZ GdAddZ!GdBddZ"d\dFdZ#d]dGdZ$dHdZ%dId Z&dJd!Z'dKd"Z(dLd#Z)dMd$Z*d^dNd'Z+d_dOd(Z,dPdQZ-dRdSZ.y4e/dDZ0e/dTZ1e/dUZ2e/dVZ3e/dWZ4e/dXZ5Wn.e6k r`dZ0dZ1dZ2dZ3dZ4dZ5YnXdZ7e7rtddl8Z8e9dYkre$ej:dZd[e_:e$ej;d[dZe_;dS)`z codecs -- Python Codec Registry, API and helpers. Written by Marc-Andre Lemburg (mal@lemburg.com). (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. N)*z%Failed to load the builtin codecs: %sregisterlookupopen EncodedFileBOMBOM_BEBOM_LEBOM32_BEBOM32_LEBOM64_BEBOM64_LEBOM_UTF8 BOM_UTF16 BOM_UTF16_LE BOM_UTF16_BE BOM_UTF32 BOM_UTF32_LE BOM_UTF32_BE CodecInfoCodecIncrementalEncoderIncrementalDecoder StreamReader StreamWriterStreamReaderWriter StreamRecoder getencoder getdecodergetincrementalencodergetincrementaldecoder getreader getwriterencodedecode iterencode iterdecode strict_errors ignore_errorsreplace_errorsxmlcharrefreplace_errorsbackslashreplace_errorsnamereplace_errorsregister_error lookup_errorssssslittlec@s,eZdZdZdZd ddddZddZdS) rz0Codec details when looking up the codec registryTN)_is_text_encodingc CsPtj|||||f} || _|| _|| _|| _|| _|| _|| _|dk rL|| _ | S)N) tuple__new__namer#r$incrementalencoderincrementaldecoder streamwriter streamreaderr0) clsr#r$r7r6r4r5r3r0selfr:/usr/lib64/python3.6/codecs.pyr2]szCodecInfo.__new__cCsd|jj|jj|jt|fS)Nz%<%s.%s object for encoding %s at %#x>) __class__ __module__ __qualname__r3id)r9r:r:r;__repr__ls zCodecInfo.__repr__)NNNNN)__name__r=r>__doc__r0r2r@r:r:r:r;rRs  c@s$eZdZdZdddZd ddZdS) ra9 Defines the interface for stateless encoders/decoders. The .encode()/.decode() methods may use different error handling schemes by providing the errors argument. These string values are predefined: 'strict' - raise a ValueError error (or a subclass) 'ignore' - ignore the character and continue with the next 'replace' - replace with a suitable replacement character; Python will use the official U+FFFD REPLACEMENT CHARACTER for the builtin Unicode codecs on decoding and '?' on encoding. 'surrogateescape' - replace with private code points U+DCnn. 'xmlcharrefreplace' - Replace with the appropriate XML character reference (only for encoding). 'backslashreplace' - Replace with backslashed escape sequences. 'namereplace' - Replace with \N{...} escape sequences (only for encoding). The set of allowed values can be extended via register_error. strictcCstdS)a# Encodes the object input and returns a tuple (output object, length consumed). errors defines the error handling to apply. It defaults to 'strict' handling. The method may not store state in the Codec instance. Use StreamWriter for codecs which have to keep state in order to make encoding efficient. The encoder must be able to handle zero length input and return an empty object of the output object type in this situation. N)NotImplementedError)r9inputerrorsr:r:r;r#sz Codec.encodecCstdS)a Decodes the object input and returns a tuple (output object, length consumed). input must be an object which provides the bf_getreadbuf buffer slot. Python strings, buffer objects and memory mapped files are examples of objects providing this slot. errors defines the error handling to apply. It defaults to 'strict' handling. The method may not store state in the Codec instance. Use StreamReader for codecs which have to keep state in order to make decoding efficient. The decoder must be able to handle zero length input and return an empty object of the output object type in this situation. N)rD)r9rErFr:r:r;r$sz Codec.decodeN)rC)rC)rAr=r>rBr#r$r:r:r:r;rqs c@s<eZdZdZdddZdddZdd Zd d Zd d ZdS)rz An IncrementalEncoder encodes an input in multiple steps. The input can be passed piece by piece to the encode() method. The IncrementalEncoder remembers the state of the encoding process between calls to encode(). rCcCs||_d|_dS)z Creates an IncrementalEncoder instance. The IncrementalEncoder may use different error handling schemes by providing the errors keyword argument. See the module docstring for a list of possible values. N)rFbuffer)r9rFr:r:r;__init__szIncrementalEncoder.__init__FcCstdS)zA Encodes input and returns the resulting object. N)rD)r9rEfinalr:r:r;r#szIncrementalEncoder.encodecCsdS)z: Resets the encoder to the initial state. Nr:)r9r:r:r;resetszIncrementalEncoder.resetcCsdS)z: Return the current state of the encoder. rr:)r9r:r:r;getstateszIncrementalEncoder.getstatecCsdS)zl Set the current state of the encoder. state must have been returned by getstate(). Nr:)r9stater:r:r;setstateszIncrementalEncoder.setstateN)rC)F) rAr=r>rBrIr#rKrLrNr:r:r:r;rs  c@sDeZdZdZdddZddZddd Zd d Zd d ZddZ dS)BufferedIncrementalEncoderz This subclass of IncrementalEncoder can be used as the baseclass for an incremental encoder if the encoder must keep some of the output in a buffer between calls to encode(). rCcCstj||d|_dS)NrG)rrIrH)r9rFr:r:r;rIs z#BufferedIncrementalEncoder.__init__cCstdS)N)rD)r9rErFrJr:r:r;_buffer_encodesz)BufferedIncrementalEncoder._buffer_encodeFcCs0|j|}|j||j|\}}||d|_|S)N)rHrPrF)r9rErJdataresultconsumedr:r:r;r#s z!BufferedIncrementalEncoder.encodecCstj|d|_dS)NrG)rrKrH)r9r:r:r;rKs z BufferedIncrementalEncoder.resetcCs |jpdS)Nr)rH)r9r:r:r;rLsz#BufferedIncrementalEncoder.getstatecCs|pd|_dS)NrG)rH)r9rMr:r:r;rNsz#BufferedIncrementalEncoder.setstateN)rC)F) rAr=r>rBrIrPr#rKrLrNr:r:r:r;rOs  rOc@s<eZdZdZdddZdddZdd Zd d Zd d ZdS)rz An IncrementalDecoder decodes an input in multiple steps. The input can be passed piece by piece to the decode() method. The IncrementalDecoder remembers the state of the decoding process between calls to decode(). rCcCs ||_dS)z Create an IncrementalDecoder instance. The IncrementalDecoder may use different error handling schemes by providing the errors keyword argument. See the module docstring for a list of possible values. N)rF)r9rFr:r:r;rIszIncrementalDecoder.__init__FcCstdS)z@ Decode input and returns the resulting object. N)rD)r9rErJr:r:r;r$ szIncrementalDecoder.decodecCsdS)z9 Reset the decoder to the initial state. Nr:)r9r:r:r;rKszIncrementalDecoder.resetcCsdS)a  Return the current state of the decoder. This must be a (buffered_input, additional_state_info) tuple. buffered_input must be a bytes object containing bytes that were passed to decode() that have not yet been converted. additional_state_info must be a non-negative integer representing the state of the decoder WITHOUT yet having processed the contents of buffered_input. In the initial state and after reset(), getstate() must return (b"", 0). r)rTrr:)r9r:r:r;rLs zIncrementalDecoder.getstatecCsdS)z Set the current state of the decoder. state must have been returned by getstate(). The effect of setstate((b"", 0)) must be equivalent to reset(). Nr:)r9rMr:r:r;rN&szIncrementalDecoder.setstateN)rC)F) rAr=r>rBrIr$rKrLrNr:r:r:r;rs  c@sDeZdZdZdddZddZddd Zd d Zd d ZddZ dS)BufferedIncrementalDecoderz This subclass of IncrementalDecoder can be used as the baseclass for an incremental decoder if the decoder must be able to handle incomplete byte sequences. rCcCstj||d|_dS)NrT)rrIrH)r9rFr:r:r;rI4s z#BufferedIncrementalDecoder.__init__cCstdS)N)rD)r9rErFrJr:r:r;_buffer_decode9sz)BufferedIncrementalDecoder._buffer_decodeFcCs0|j|}|j||j|\}}||d|_|S)N)rHrVrF)r9rErJrQrRrSr:r:r;r$>s z!BufferedIncrementalDecoder.decodecCstj|d|_dS)NrT)rrKrH)r9r:r:r;rKFs z BufferedIncrementalDecoder.resetcCs |jdfS)Nr)rH)r9r:r:r;rLJsz#BufferedIncrementalDecoder.getstatecCs|d|_dS)Nr)rH)r9rMr:r:r;rNNsz#BufferedIncrementalDecoder.setstateN)rC)F) rAr=r>rBrIrVr$rKrLrNr:r:r:r;rU.s  rUc@sTeZdZdddZddZddZdd Zdd d Zefd dZ ddZ ddZ dS)rrCcCs||_||_dS)aw Creates a StreamWriter instance. stream must be a file-like object open for writing. The StreamWriter may use different error handling schemes by providing the errors keyword argument. These parameters are predefined: 'strict' - raise a ValueError (or a subclass) 'ignore' - ignore the character and continue with the next 'replace'- replace with a suitable replacement character 'xmlcharrefreplace' - Replace with the appropriate XML character reference. 'backslashreplace' - Replace with backslashed escape sequences. 'namereplace' - Replace with \N{...} escape sequences. The set of allowed parameter values can be extended via register_error. N)streamrF)r9rWrFr:r:r;rI[szStreamWriter.__init__cCs"|j||j\}}|jj|dS)z> Writes the object's contents encoded to self.stream. N)r#rFrWwrite)r9objectrQrSr:r:r;rXtszStreamWriter.writecCs|jdj|dS)z[ Writes the concatenated list of strings to the stream using .write(). rGN)rXjoin)r9listr:r:r; writelines{szStreamWriter.writelinescCsdS)a5 Flushes and resets the codec buffers used for keeping state. Calling this method should ensure that the data on the output is put into a clean state, that allows appending of new fresh data without having to rescan the whole stream to recover state. Nr:)r9r:r:r;rKs zStreamWriter.resetrcCs*|jj|||dkr&|dkr&|jdS)Nr)rWseekrK)r9offsetwhencer:r:r;r]szStreamWriter.seekcCs ||j|S)z? Inherit all other methods from the underlying stream. )rW)r9r3getattrr:r:r; __getattr__szStreamWriter.__getattr__cCs|S)Nr:)r9r:r:r; __enter__szStreamWriter.__enter__cCs|jjdS)N)rWclose)r9typevaluetbr:r:r;__exit__szStreamWriter.__exit__N)rC)r) rAr=r>rIrXr\rKr]r`rarbrgr:r:r:r;rYs   c@seZdZeZdddZd ddZd#dd Zd$d d Zd%ddZ ddZ d&ddZ ddZ ddZ efddZddZddZd S)'rrCcCs.||_||_d|_|j|_|j|_d|_dS)a Creates a StreamReader instance. stream must be a file-like object open for reading. The StreamReader may use different error handling schemes by providing the errors keyword argument. These parameters are predefined: 'strict' - raise a ValueError (or a subclass) 'ignore' - ignore the character and continue with the next 'replace'- replace with a suitable replacement character 'backslashreplace' - Replace with backslashed escape sequences; The set of allowed parameter values can be extended via register_error. rTN)rWrF bytebuffercharbuffertype_empty_charbuffer charbuffer linebuffer)r9rWrFr:r:r;rIs  zStreamReader.__init__cCstdS)N)rD)r9rErFr:r:r;r$szStreamReader.decodeFc CsL|jr|jj|j|_d|_|dkr(|}x|dkrBt|j|krBP|dkrV|jj}n |jj|}|j|}|srPy|j||j \}}Wn`t k r}zD|r|j|d|j |j \}}|j dd} t| dkr؂nWYdd}~XnX||d|_|j|7_|s*Pq*W|dkr*|j} |j|_n|jd|} |j|d|_| S)a Decodes data from the stream self.stream and returns the resulting object. chars indicates the number of decoded code points or bytes to return. read() will never return more data than requested, but it might return less, if there is not enough available. size indicates the approximate maximum number of decoded bytes or code points to read for decoding. The decoder can modify this setting as appropriate. The default value -1 indicates to read and decode as much as possible. size is intended to prevent having to decode huge files in one step. If firstline is true, and a UnicodeDecodeError happens after the first line terminator in the input only the first line will be returned, the rest of the input will be kept until the next call to read(). The method should use a greedy read strategy, meaning that it should read as much data as is allowed within the definition of the encoding and the given size, e.g. if optional encoding endings or state markers are available on the stream, these should be read too. NrT)keependsrm) rlrjrZrklenrWreadrhr$rFUnicodeDecodeErrorstart splitlines) r9sizechars firstlinenewdatarQnewchars decodedbytesexclinesrRr:r:r;rpsD       zStreamReader.readNTc Cs|jrP|jd}|jd=t|jdkr8|jd|_d|_|sL|jddd}|S|pVd}|j}xr|j|dd}|rt|tr|jd st|t r|jd r||jddd 7}||7}|jdd}|rt|dkr:|d}|d=t|dkr|d|j7<||_d|_n|d|j|_|s8|jddd}P|d}|djddd}||kr|jj |dd|j|_|r|}n|}P| s|dk r|r| r|jddd}P|d krb|d 9}qbW|S)z Read one line from the input stream and return the decoded data. size, if given, is passed as size argument to the read() method. rrmNF)rnHT)rv  )rtrui@) rlrorkrsrjrp isinstancestrendswithbytesrZ) r9rtrnlinereadsizerQr{ line0withendline0withoutendr:r:r;readlines^       zStreamReader.readlinecCs|j}|j|S)aS Read all lines available on the input stream and return them as a list. Line breaks are implemented using the codec's decoder method and are included in the list entries. sizehint, if given, is ignored since there is no efficient way to finding the true end-of-line. )rprs)r9sizehintrnrQr:r:r; readlines]s zStreamReader.readlinescCsd|_|j|_d|_dS)z Resets the codec buffers used for keeping state. Note that no stream repositioning should take place. This method is primarily intended to be able to recover from decoding errors. rTN)rhrjrkrl)r9r:r:r;rKls zStreamReader.resetrcCs|jj|||jdS)zp Set the input stream's current position. Resets the codec buffers used for keeping state. N)rWr]rK)r9r^r_r:r:r;r]yszStreamReader.seekcCs|j}|r|StdS)z4 Return the next decoded line from the input stream.N)r StopIteration)r9rr:r:r;__next__szStreamReader.__next__cCs|S)Nr:)r9r:r:r;__iter__szStreamReader.__iter__cCs ||j|S)z? Inherit all other methods from the underlying stream. )rW)r9r3r`r:r:r;raszStreamReader.__getattr__cCs|S)Nr:)r9r:r:r;rbszStreamReader.__enter__cCs|jjdS)N)rWrc)r9rdrerfr:r:r;rgszStreamReader.__exit__)rC)rCrr)rrF)NT)NT)r)rAr=r>rrirIr$rprrrKr]rrr`rarbrgr:r:r:r;rs   P K   c@seZdZdZdZd!ddZd#ddZd$d d Zd%d d ZddZ ddZ ddZ ddZ ddZ d&ddZefddZddZdd Zd S)'ra StreamReaderWriter instances allow wrapping streams which work in both read and write modes. The design is such that one can use the factory functions returned by the codec.lookup() function to construct the instance. unknownrCcCs(||_||||_||||_||_dS)aR Creates a StreamReaderWriter instance. stream must be a Stream-like object. Reader, Writer must be factory functions or classes providing the StreamReader, StreamWriter interface resp. Error handling is done in the same way as defined for the StreamWriter/Readers. N)rWreaderwriterrF)r9rWReaderWriterrFr:r:r;rIs   zStreamReaderWriter.__init__rmcCs |jj|S)N)rrp)r9rtr:r:r;rpszStreamReaderWriter.readNcCs |jj|S)N)rr)r9rtr:r:r;rszStreamReaderWriter.readlinecCs |jj|S)N)rr)r9rr:r:r;rszStreamReaderWriter.readlinescCs t|jS)z4 Return the next decoded line from the input stream.)nextr)r9r:r:r;rszStreamReaderWriter.__next__cCs|S)Nr:)r9r:r:r;rszStreamReaderWriter.__iter__cCs |jj|S)N)rrX)r9rQr:r:r;rXszStreamReaderWriter.writecCs |jj|S)N)rr\)r9r[r:r:r;r\szStreamReaderWriter.writelinescCs|jj|jjdS)N)rrKr)r9r:r:r;rKs zStreamReaderWriter.resetrcCs6|jj|||jj|dkr2|dkr2|jjdS)Nr)rWr]rrKr)r9r^r_r:r:r;r]s zStreamReaderWriter.seekcCs ||j|S)z? Inherit all other methods from the underlying stream. )rW)r9r3r`r:r:r;raszStreamReaderWriter.__getattr__cCs|S)Nr:)r9r:r:r;rbszStreamReaderWriter.__enter__cCs|jjdS)N)rWrc)r9rdrerfr:r:r;rgszStreamReaderWriter.__exit__)rCr)r)N)N)r)rAr=r>rBencodingrIrprrrrrXr\rKr]r`rarbrgr:r:r:r;rs       c@seZdZdZdZdZdddZd ddZd!d d Zd"d d Z ddZ ddZ ddZ ddZ ddZefddZddZddZd S)#raB StreamRecoder instances translate data from one encoding to another. They use the complete set of APIs returned by the codecs.lookup() function to implement their task. Data written to the StreamRecoder is first decoded into an intermediate format (depending on the "decode" codec) and then written to the underlying stream using an instance of the provided Writer class. In the other direction, data is read from the underlying stream using a Reader instance and then encoded and returned to the caller. rrCcCs4||_||_||_||||_||||_||_dS)a Creates a StreamRecoder instance which implements a two-way conversion: encode and decode work on the frontend (the data visible to .read() and .write()) while Reader and Writer work on the backend (the data in stream). You can use these objects to do transparent transcodings from e.g. latin-1 to utf-8 and back. stream must be a file-like object. encode and decode must adhere to the Codec interface; Reader and Writer must be factory functions or classes providing the StreamReader and StreamWriter interfaces resp. Error handling is done in the same way as defined for the StreamWriter/Readers. N)rWr#r$rrrF)r9rWr#r$rrrFr:r:r;rIs   zStreamRecoder.__init__rmcCs"|jj|}|j||j\}}|S)N)rrpr#rF)r9rtrQ bytesencodedr:r:r;rp"s zStreamRecoder.readNcCs6|dkr|jj}n |jj|}|j||j\}}|S)N)rrr#rF)r9rtrQrr:r:r;r(s   zStreamRecoder.readlinecCs(|jj}|j||j\}}|jddS)NT)rn)rrpr#rFrs)r9rrQrr:r:r;r1s zStreamRecoder.readlinescCs t|j}|j||j\}}|S)z4 Return the next decoded line from the input stream.)rrr#rF)r9rQrr:r:r;r7s zStreamRecoder.__next__cCs|S)Nr:)r9r:r:r;r>szStreamRecoder.__iter__cCs|j||j\}}|jj|S)N)r$rFrrX)r9rQ bytesdecodedr:r:r;rXAszStreamRecoder.writecCs(dj|}|j||j\}}|jj|S)NrG)rZr$rFrrX)r9r[rQrr:r:r;r\Fs zStreamRecoder.writelinescCs|jj|jjdS)N)rrKr)r9r:r:r;rKLs zStreamRecoder.resetcCs ||j|S)z? Inherit all other methods from the underlying stream. )rW)r9r3r`r:r:r;raQszStreamRecoder.__getattr__cCs|S)Nr:)r9r:r:r;rbXszStreamRecoder.__enter__cCs|jjdS)N)rWrc)r9rdrerfr:r:r;rg[szStreamRecoder.__exit__)rCr)r)N)N)rAr=r>rB data_encoding file_encodingrIrprrrrrXr\rKr`rarbrgr:r:r:r;rs    rrCrmcCsV|dk rd|kr|d}tj|||}|dkr2|St|}t||j|j|}||_|S)a> Open an encoded file using the given mode and return a wrapped version providing transparent encoding/decoding. Note: The wrapped version will only accept the object format defined by the codecs, i.e. Unicode objects for most builtin codecs. Output is also codec dependent and will usually be Unicode as well. Underlying encoded files are always opened in binary mode. The default file mode is 'r', meaning to open the file in read mode. encoding specifies the encoding which is to be used for the file. errors may be given to define the error handling. It defaults to 'strict' which causes ValueErrors to be raised in case an encoding error occurs. buffering has the same meaning as for the builtin open() API. It defaults to line buffered. The returned wrapped file object provides an extra attribute .encoding which allows querying the used encoding. This attribute is only available if an encoding was specified as parameter. Nb)builtinsrrrr7r6r)filenamemoderrF bufferingfileinfosrwr:r:r;r`scCsF|dkr |}t|}t|}t||j|j|j|j|}||_||_|S)a Return a wrapped version of file which provides transparent encoding translation. Data written to the wrapped file is decoded according to the given data_encoding and then encoded to the underlying file using file_encoding. The intermediate data type will usually be Unicode but depends on the specified codecs. Bytes read from the file are decoded using file_encoding and then passed back to the caller encoded using data_encoding. If file_encoding is not given, it defaults to data_encoding. errors may be given to define the error handling. It defaults to 'strict' which causes ValueErrors to be raised in case an encoding error occurs. The returned wrapped file object provides two extra attributes .data_encoding and .file_encoding which reflect the given parameters of the same name. The attributes can be used for introspection by Python programs. N)rrr#r$r7r6rr)rrrrF data_info file_infosrr:r:r;rs cCs t|jS)z Lookup up the codec for the given encoding and return its encoder function. Raises a LookupError in case the encoding cannot be found. )rr#)rr:r:r;rscCs t|jS)z Lookup up the codec for the given encoding and return its decoder function. Raises a LookupError in case the encoding cannot be found. )rr$)rr:r:r;rscCst|j}|dkrt||S)z Lookup up the codec for the given encoding and return its IncrementalEncoder class or factory function. Raises a LookupError in case the encoding cannot be found or the codecs doesn't provide an incremental encoder. N)rr4 LookupError)rencoderr:r:r;rs cCst|j}|dkrt||S)z Lookup up the codec for the given encoding and return its IncrementalDecoder class or factory function. Raises a LookupError in case the encoding cannot be found or the codecs doesn't provide an incremental decoder. N)rr5r)rdecoderr:r:r;r s cCs t|jS)z Lookup up the codec for the given encoding and return its StreamReader class or factory function. Raises a LookupError in case the encoding cannot be found. )rr7)rr:r:r;r!scCs t|jS)z Lookup up the codec for the given encoding and return its StreamWriter class or factory function. Raises a LookupError in case the encoding cannot be found. )rr6)rr:r:r;r"scksLt||f|}x |D]}|j|}|r|VqW|jdd}|rH|VdS)z Encoding iterator. Encodes the input strings from the iterator using an IncrementalEncoder. errors and kwargs are passed through to the IncrementalEncoder constructor. rGTN)rr#)iteratorrrFkwargsrrEoutputr:r:r;r%s     cksLt||f|}x |D]}|j|}|r|VqW|jdd}|rH|VdS)z Decoding iterator. Decodes the input strings from the iterator using an IncrementalDecoder. errors and kwargs are passed through to the IncrementalDecoder constructor. rTTN)r r$)rrrFrrrErr:r:r;r&s     cCsdd|DS)z make_identity_dict(rng) -> dict Return a dictionary where elements of the rng sequence are mapped to themselves. cSsi|] }||qSr:r:).0ir:r:r; "sz&make_identity_dict..r:)rngr:r:r;make_identity_dictsrcCs8i}x.|jD]"\}}||kr(|||<qd||<qW|S)a Creates an encoding map from a decoding map. If a target mapping in the decoding map occurs multiple times, then that target is mapped to None (undefined mapping), causing an exception when encountered by the charmap codec during translation. One example where this happens is cp875.py which decodes multiple character to \u001a. N)items) decoding_mapmkvr:r:r;make_encoding_map$s   rignorereplacexmlcharrefreplacebackslashreplace namereplace__main__zlatin-1zutf-8)rNrCrm)NrC)rC)rC)s     B("1+IzWn * &         reprlib.cpython-36.pyc000064400000012432152462730460010644 0ustar003 \ @sdZdddgZddlZddlmZyddlmZWn ek rRddlmZYnXd d dZ Gd ddZ d d Z e Z e j Z dS)zGRedo the builtin repr() (representation) but with limits on most sizes.Reprreprrecursive_reprN)islice) get_ident...csfdd}|S)zGDecorator to make a repr function return fillvalue for a recursive callcsXtfdd}td|_td|_td|_td|_tdi|_|S)Nc sBt|tf}|krSj|z |}Wdj|X|S)N)idradddiscard)selfkeyresult) fillvalue repr_running user_function/usr/lib64/python3.6/reprlib.pywrappers   z.decorating_function..wrapper __module____doc____name__ __qualname____annotations__)setgetattrrrrrr)rr)r)rrrdecorating_functions    z+recursive_repr..decorating_functionr)rrr)rrr s c@s~eZdZddZddZddZddd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZddZdS) rcCsFd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ dS)N() maxlevelmaxtuplemaxlistmaxarraymaxdictmaxset maxfrozensetmaxdeque maxstringmaxlongmaxother)r rrr__init__)sz Repr.__init__cCs|j||jS)N)repr1r!)r xrrrr6sz Repr.reprcCsVt|j}d|kr$|j}dj|}t|d|rFt|d|||S|j||SdS)N _repr_)typersplitjoinhasattrr repr_instance)r r.leveltypenamepartsrrrr-9s  z Repr.repr1c st|}|dkr|rd}nX|d|jfddt||D} ||krT| jddj| }|dkrr|rr||}d|||fS)Nrz...csg|]}|qSrr).0elem)newlevelr-rr Jsz'Repr._repr_iterable..z, z%s%s%s)lenr-rappendr4) r r.r7leftrightmaxitertrailnspiecesr)r>r-r_repr_iterableCs    zRepr._repr_iterablecCs|j||dd|jdS)N(),)rIr")r r.r7rrr repr_tuplePszRepr.repr_tuplecCs|j||dd|jS)N[])rIr#)r r.r7rrr repr_listSszRepr.repr_listcCs,|sd|jSd|j}|j|||d|jS)Nz array('%s')z array('%s', [z]))typecoderIr$)r r.r7headerrrr repr_arrayVs  zRepr.repr_arraycCs$|sdSt|}|j||dd|jS)Nzset(){})_possibly_sortedrIr&)r r.r7rrrrepr_set\sz Repr.repr_setcCs$|sdSt|}|j||dd|jS)Nz frozenset()z frozenset({z}))rVrIr')r r.r7rrrrepr_frozensetbs  zRepr.repr_frozensetcCs|j||dd|jS)Nzdeque([z]))rIr()r r.r7rrr repr_dequeiszRepr.repr_dequec Cst|}|dkrdS|dkr dS|d}|j}g}xBtt||jD].}|||}||||} |jd|| fqDW||jkr|jddj|} d| fS) Nrz{}z{...}r;z%s: %sz...z, z{%s})r@r-rrVr%rAr4) r r.r7rFr>r-rHr keyreprvalreprrGrrr repr_dictls    zRepr.repr_dictcCstj|d|j}t||jkrtd|jdd}td|jd|}tj|d||t||d}|d|d|t||d}|S)Nrz...)builtinsrr)r@max)r r.r7rGijrrrrepr_str{s&$z Repr.repr_strcCshtj|}t||jkrdtd|jdd}td|jd|}|d|d|t||d}|S)Nrr]r^z...)r_rr@r*r`)r r.r7rGrarbrrrrepr_ints  $z Repr.repr_intc Csytj|}Wn$tk r2d|jjt|fSXt||jkrtd|jdd}td|jd|}|d|d|t||d}|S)Nz<%s instance at %#x>rr]r^z...) r_r Exception __class__rrr@r+r`)r r.r7rGrarbrrrr6s$zRepr.repr_instanceN)r:)rrrr,rr-rIrMrPrSrWrXrYr\rcrdr6rrrrr's   c Cs&yt|Stk r t|SXdS)N)sortedrelist)r.rrrrVsrV)r)r__all__r_ itertoolsr_threadr ImportErrorZ _dummy_threadrrrVaReprrrrrrs   s glob.cpython-36.opt-2.pyc000064400000006404152462730460011072 0ustar003 \@sddlZddlZddlZdddgZddddZddddZd d Zd d Zd dZddZ ddZ ddZ ddZ ddZ ejdZejdZddZddZdd Zd!dZdS)"NglobiglobescapeF) recursivecCstt||dS)N)r)listr)pathnamerr/usr/lib64/python3.6/glob.pyr s cCs$t||d}|r t|r t|}|S)NF)_iglob _isrecursivenext)rritsrrr rs  ccstjj|\}}t|sF|r0tjj|rB|Vntjj|rB|VdS|s|rjt|rjt|||EdHnt|||EdHdS||krt|rt ||d}n|g}t|r|rt|rt}qt}nt }x2|D]*}x$||||D]}tjj ||VqWqWdS)NT) ospathsplit has_magiclexistsisdirr _glob2_glob1r _glob0join)rrdironlydirnamebasenamedirsZ glob_in_dirnamerrr r 's0     r cCs0tt||}t|s$dd|D}tj||S)Ncss|]}t|s|VqdS)N) _ishidden).0xrrr Rsz_glob1..)r_iterdirrfnmatchfilter)rpatternrnamesrrr rOsrcCs8|stjj|r4|gSntjjtjj||r4|gSgS)N)rrrrr)rrrrrr rUs  rcCs t||dS)NF)r)rr%rrr glob0bsr'cCs t||dS)NF)r)rr%rrr glob1esr(ccs"|ddVt||EdHdS)Nr) _rlistdir)rr%rrrr rksrccs|s"t|trttjd}ntj}yXtj|D}x<|D]4}y| sJ|jrR|jVWq6tk rhYq6Xq6WWdQRXWntk rdSXdS)NASCII) isinstancebytesrcurdirscandiris_dirrOSError)rrr entryrrr r"rs    r"ccshtt||}xT|D]L}t|s|V|r8tjj||n|}x"t||D]}tjj||VqHWqWdS)N)rr"rrrrr))rrr&r ryrrr r)s r)z([*?[])s([*?[])cCs(t|trtj|}n tj|}|dk S)N)r+r,magic_check_bytessearch magic_check)rmatchrrr rs   rcCs |ddkS)Nr...)r7r9r)rrrr rsrcCst|tr|dkS|dkSdS)Ns**z**)r+r,)r%rrr r s r cCs<tjj|\}}t|tr(tjd|}n tjd|}||S)Ns[\1]z[\1])rr splitdriver+r,r3subr5)rZdriverrr rs   )rrer#__all__rrr rrr'r(rr"r)compiler5r3rrr rrrrr s&  (   dummy_threading.cpython-36.opt-2.pyc000064400000001333152462730460013323 0ustar003 \ @sddlmZddlZdZdZdZzdekr6edZdZeded<dekr\edZdZed=dekrvedZ dZed=ddl Z eded <ed=eded <ed=dd l Tdd l m Z Wdereed<[[ere ed<[ [ereed<[ned=[[[XdS) )modulesNF_threadT _dummy_thread threadingZ_threading_local_dummy_threadingZ_dummy__threading_local)*)__all__) sysrZ sys_modulesrZholding_threadZholding_threadingZholding__threading_localZ held_threadZheld_threadingZheld__threading_localrrrr r '/usr/lib64/python3.6/dummy_threading.py sN    _bootlocale.cpython-36.opt-1.pyc000064400000001672152462730460012432 0ustar003 \ @sddZddlZddlZejjdr,d ddZn4y ejWnek rTd ddZYn Xd ddZdS) zA minimal subset of the locale module used at interpreter startup (imported by the _io module), in order to reduce startup time. Don't import directly from third-party code; use the `locale` module instead! NwinTcCs tjdS)N)_localeZ_getdefaultlocale) do_setlocaler#/usr/lib64/python3.6/_bootlocale.pygetpreferredencoding srcCsddl}|j|S)Nr)localer)rr rrrrscCs$tjtj}| r tjdkr d}|S)NdarwinzUTF-8)r nl_langinfoCODESETsysplatform)rresultrrrrs )T)T)T)__doc__r rr startswithrr AttributeErrorrrrrs   smtpd.cpython-36.opt-2.pyc000064400000057002152462730460011276 0ustar003 \@sZddlZddlZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z m Z dddddgZejdZd ZGd d d Zead Zd ZdZd$ddZGdddejZGdddejZGdddeZGdddeZGdddeZGdddZddZ e!dkrVe Z"e"j#Z#de#krle#j$dZ%e&e#de%e'e(dgZ)e#e%ddZ#nddl*Z)e+e)e#Z,e,e"j-e"j.fe"j/e"j0fe"j1e"j2dZ3e"j4r2y ddl5Z5Wn.e6k re7dej8d ej9dYnXe5j:d!d"Z;yej4e;Wn.ek rTYnXdS)%N)warn) get_addr_specget_angle_addr SMTPChannel SMTPServerDebuggingServer PureProxy MailmanProxyzPython SMTP proxy version 0.3c@seZdZddZddZdS)DevnullcCsdS)N)selfmsgr r /usr/lib64/python3.6/smtpd.pywritefsz Devnull.writecCsdS)Nr )r r r rflushgsz Devnull.flushN)__name__ __module__ __qualname__rrr r r rr esr  z, icCs4ttttjd|r&t|tjdtj|dS)N)file)print__doc__globalssysstderrexit)coder r r rusagepsrc@seZdZdZdZdZejefddZe ddZ e dd d fd d Z d d Z ddZe ddZejddZe ddZejddZe ddZejddZe ddZejddZe ddZejddZe dd Zejd!d Ze d"d#Zejd$d#Ze d%d&Zejd'd&Ze d(d)Zejd*d)Ze d+d,Zejd-d,Ze d.d/Zejd0d/Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Zd;d<Z d=d>Z!d?d@Z"dAdBZ#dCdDZ$dEdFZ%dGdHZ&dIdJZ'dKdLZ(dMdNZ)dOdPZ*dQdRZ+dS)SrricCs|S)Nr )xr r r|szSMTPChannel.c Cs*yt|jjStk r$|jSXdS)N)maxcommand_size_limitsvalues ValueErrorcommand_size_limit)r r r rmax_command_size_limit~sz"SMTPChannel.max_command_size_limitNFc Cstjj|||d||_||_||_||_||_||_|rF|rFt d|rdd|_ d|_ d|_ t |_nd|_ d|_ td|_ d |_|jd|_d |_|jjtj|_y|j|_Wn:tk r}z|j|jd tjkrdSd}~XnXtd t |jt!d |j"d|jt#fdS)N)mapzFdecode_data and enable_SMTPUTF8 cannot be set to True at the same timerz .s . FrzPeer:)rz 220 %s %s)$asynchat async_chat__init__ smtp_serverconnaddrdata_size_limitenable_SMTPUTF8 _decode_datar% _emptystring_linesep_dotsepNEWLINE_newlineord_set_rset_state seen_greeting extended_smtpr#clearsocketZgetfqdnfqdnZ getpeernamepeerOSErrorcloseargserrnoZENOTCONNrrepr DEBUGSTREAMpush __version__) r Zserverr1r2r3r(r4 decode_dataerrr r rr/s@   zSMTPChannel.__init__cCs.|j|_d|_g|_d|_d|_|jddS)NFrs )COMMAND smtp_statemailfromrcpttosrequire_SMTPUTF8 num_bytesset_terminator)r r r r_set_post_data_states z SMTPChannel._set_post_data_statecCs|jd|_g|_dS)Nr)rT received_datareceived_lines)r r r rr<szSMTPChannel._set_rset_statecCstdtd|jS)NzTAccess to __server attribute on SMTPChannel is deprecated, use 'smtp_server' instead)rDeprecationWarningr0)r r r r__serverszSMTPChannel.__servercCstdtd||_dS)NzRSetting __server attribute on SMTPChannel is deprecated, set 'smtp_server' insteadrW)rrXr0)r valuer r rrYscCstdtd|jS)NzUAccess to __line attribute on SMTPChannel is deprecated, use 'received_lines' insteadrW)rrXrV)r r r r__lineszSMTPChannel.__linecCstdtd||_dS)NzSSetting __line attribute on SMTPChannel is deprecated, set 'received_lines' insteadrW)rrXrV)r rZr r rr[scCstdtd|jS)NzRAccess to __state attribute on SMTPChannel is deprecated, use 'smtp_state' insteadrW)rrXrN)r r r r__stateszSMTPChannel.__statecCstdtd||_dS)NzPSetting __state attribute on SMTPChannel is deprecated, set 'smtp_state' insteadrW)rrXrN)r rZr r rr\scCstdtd|jS)NzXAccess to __greeting attribute on SMTPChannel is deprecated, use 'seen_greeting' insteadrW)rrXr=)r r r r __greetingszSMTPChannel.__greetingcCstdtd||_dS)NzVSetting __greeting attribute on SMTPChannel is deprecated, set 'seen_greeting' insteadrW)rrXr=)r rZr r rr]scCstdtd|jS)NzSAccess to __mailfrom attribute on SMTPChannel is deprecated, use 'mailfrom' insteadrW)rrXrO)r r r r __mailfromszSMTPChannel.__mailfromcCstdtd||_dS)NzQSetting __mailfrom attribute on SMTPChannel is deprecated, set 'mailfrom' insteadrW)rrXrO)r rZr r rr^scCstdtd|jS)NzQAccess to __rcpttos attribute on SMTPChannel is deprecated, use 'rcpttos' insteadrW)rrXrP)r r r r __rcpttosszSMTPChannel.__rcpttoscCstdtd||_dS)NzOSetting __rcpttos attribute on SMTPChannel is deprecated, set 'rcpttos' insteadrW)rrXrP)r rZr r rr_scCstdtd|jS)NzTAccess to __data attribute on SMTPChannel is deprecated, use 'received_data' insteadrW)rrXrU)r r r r__dataszSMTPChannel.__datacCstdtd||_dS)NzRSetting __data attribute on SMTPChannel is deprecated, set 'received_data' insteadrW)rrXrU)r rZr r rr`scCstdtd|jS)NzKAccess to __fqdn attribute on SMTPChannel is deprecated, use 'fqdn' insteadrW)rrXrA)r r r r__fqdn szSMTPChannel.__fqdncCstdtd||_dS)NzISetting __fqdn attribute on SMTPChannel is deprecated, set 'fqdn' insteadrW)rrXrA)r rZr r rrascCstdtd|jS)NzKAccess to __peer attribute on SMTPChannel is deprecated, use 'peer' insteadrW)rrXrB)r r r r__peerszSMTPChannel.__peercCstdtd||_dS)NzISetting __peer attribute on SMTPChannel is deprecated, set 'peer' insteadrW)rrXrB)r rZr r rrbscCstdtd|jS)NzKAccess to __conn attribute on SMTPChannel is deprecated, use 'conn' insteadrW)rrXr1)r r r r__conn szSMTPChannel.__conncCstdtd||_dS)NzISetting __conn attribute on SMTPChannel is deprecated, set 'conn' insteadrW)rrXr1)r rZr r rrc%scCstdtd|jS)NzKAccess to __addr attribute on SMTPChannel is deprecated, use 'addr' insteadrW)rrXr2)r r r r__addr+szSMTPChannel.__addrcCstdtd||_dS)NzISetting __addr attribute on SMTPChannel is deprecated, set 'addr' insteadrW)rrXr2)r rZr r rrd0scCs&tjj|t|d|jrdnddS)Nz zutf-8ascii)r-r.rIbytesrQ)r r r r rrI7s zSMTPChannel.pushcCs|d}|j|jkr|j}n|j|jkr*|j}|r<|j|krr#r&getattrrgr3splitr7r8rir:rUrBrOrProrpr0process_messagerT) r lineZszicommandargZmax_szmethodrktextrEkwargsZstatusr r rfound_terminatorLsd        zSMTPChannel.found_terminatorcCsH|s|jddS|jr&|jddS|j||_|jd|jdS)Nz501 Syntax: HELO hostnamez503 Duplicate HELO/EHLOz250 %s)rIr=r<rA)r r{r r r smtp_HELOs  zSMTPChannel.smtp_HELOcCs|s|jddS|jr&|jddS|j||_d|_|jd|j|jrr|jd|j|jdd7<|js|jd|jr|jd |jdd 7<|jd dS) Nz501 Syntax: EHLO hostnamez503 Duplicate HELO/EHLOTz250-%sz 250-SIZE %sMAILz 250-8BITMIMEz 250-SMTPUTF8 z250 HELP) rIr=r<r>rAr3r#r5r4)r r{r r r smtp_EHLOs&    zSMTPChannel.smtp_EHLOcCs|r|jdn |jddS)Nz501 Syntax: NOOPz250 OK)rI)r r{r r r smtp_NOOPs zSMTPChannel.smtp_NOOPcCs|jd|jdS)Nz221 Bye)rIZclose_when_done)r r{r r r smtp_QUITs zSMTPChannel.smtp_QUITcCs0t|}|d|j|kr,||djSdS)Nr)rhrsrt)r keywordr{Zkeylenr r r_strip_command_keywordsz"SMTPChannel._strip_command_keywordcCsF|sdS|jjdr$t|\}}n t|\}}|s<||fS|j|fS)Nr<)rr)lstrip startswithrrZ addr_spec)r r{addressrestr r r_getaddrs zSMTPChannel._getaddrcCsNi}xD|D]<}|jd\}}}|j s2|r6| r6dS|r>|nd||<q W|S)N=T) partitionisalnum)r paramsresultZparameqrZr r r _getparamss zSMTPChannel._getparamscCs|rd}|j}|dkr$|jdq|dkr8|jdq|dkr^d}|jrR||7}|j|q|dkrd }|jrx||7}|j|q|d kr|jd q|d kr|jd q|dkr|jdq|dkr|jdq|dkr|jdq|jdn |jddS)Nz [SP ]ZEHLOz250 Syntax: EHLO hostnameZHELOz250 Syntax: HELO hostnamerz 250 Syntax: MAIL FROM:
ZRCPTz250 Syntax: RCPT TO:
rgz250 Syntax: DATAZRSETz250 Syntax: RSETZNOOPz250 Syntax: NOOPZQUITz250 Syntax: QUITZVRFYz250 Syntax: VRFY
zD501 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFYzD250 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFY)rsrIr>)r r{ZextendedZlc_argr r r r smtp_HELPs:          zSMTPChannel.smtp_HELPcCs@|r2|j|\}}|r"|jdq<|jd|n |jddS)NzB252 Cannot VRFY user, but will accept message and attempt deliveryz502 Could not VRFY %sz501 Syntax: VRFY
)rrI)r r{rrr r r smtp_VRFYs  zSMTPChannel.smtp_VRFYcCs|js|jddStd|tdd}|jr4|d7}|dkrJ|j|dS|jd|}|j|\}}|sv|j|dS|j r|r|j|dS|jr|jddS|jj |_ |j |j }|dkr|j|dS|j s|j dd }|dkr|jd dS|jr>|j d d }|dkr&d|_n|d k r>|jddS|j dd}|r|jsh|j|dS|jrt||jkr|jddSt|jdkr|jddS||_td|jtd|jddS)Nz503 Error: send HELO firstz ===> MAIL)rz 501 Syntax: MAIL FROM:
z [SP ]zFROM:z503 Error: nested MAIL commandZBODY7BIT8BITMIMEz1501 Error: BODY can only be one of 7BIT, 8BITMIMEZSMTPUTF8FTz&501 Error: SMTPUTF8 takes no argumentsZSIZEz:552 Error: message size exceeds fixed maximum message sizerz:555 MAIL FROM parameters not recognized or not implementedzsender:z250 OK)rr)r=rIrrHr>rrrOrsrvrorr5popr4rQisdigitr3intrhkeys)r r{ syntaxerrrrZbodysmtputf8sizer r r smtp_MAILsh                     zSMTPChannel.smtp_MAILcCs|js|jddStd|td|js6|jddSd}|jrH|d7}|dkr^|j|dS|jd|}|j|\}}|s|j|dS|j r|r|j|dS|jj |_ |j |j }|dkr|j|dSt |j dkr|jd dS|jj|td |jtd|jd dS) Nz503 Error: send HELO firstz ===> RCPT)rz503 Error: need MAIL commandz501 Syntax: RCPT TO:
z [SP ]zTO:rz8555 RCPT TO parameters not recognized or not implementedzrecips:z250 OK)r=rIrrHrOr>rrrsrvrprrhrrPri)r r{rrrr r r smtp_RCPT7s@           zSMTPChannel.smtp_RCPTcCs(|r|jddS|j|jddS)Nz501 Syntax: RSETz250 OK)rIr<)r r{r r r smtp_RSETZs  zSMTPChannel.smtp_RSETcCsZ|js|jddS|js(|jddS|r:|jddS|j|_|jd|jddS)Nz503 Error: send HELO firstz503 Error: need RCPT commandz501 Syntax: DATAs . z#354 End data with .)r=rIrPrgrNrS)r r{r r r smtp_DATAas    zSMTPChannel.smtp_DATAcCs|jddS)Nz502 EXPN not implemented)rI)r r{r r r smtp_EXPNpszSMTPChannel.smtp_EXPN),rrrrMrgr& collections defaultdictr#propertyr'DATA_SIZE_DEFAULTr/rTr<Z_SMTPChannel__serversetterZ_SMTPChannel__lineZ_SMTPChannel__stateZ_SMTPChannel__greetingZ_SMTPChannel__mailfromZ_SMTPChannel__rcpttosZ_SMTPChannel__dataZ_SMTPChannel__fqdnZ_SMTPChannel__peerZ_SMTPChannel__connZ_SMTPChannel__addrrIrmrrrrrrrrrrrrrrrr r r rrws` &            >   # 6#c@s2eZdZeZedddfddZddZddZdS) rNFc Cs||_||_||_||_||_|r.|r.tdtjj||dyNt j |dt j i}|j |dd|dd|j |j||jdWn|jYn(Xtd|jjtjtj||ftddS) NzFdecode_data and enable_SMTPUTF8 cannot be set to True at the same time)r(typerrz0%s started at %s Local addr: %s Remote addr:%s)r)Z _localaddr _remoteaddrr3r4r5r%asyncore dispatcherr/r@Z getaddrinfoZ SOCK_STREAMZ create_socketZset_reuse_addrZbindZlistenrDr __class__rtimectimerH)r Z localaddrZ remoteaddrr3r(r4rKZ gai_resultsr r rr/xs*  zSMTPServer.__init__cCs6tdt|td|j||||j|j|j|j}dS)NzIncoming connection from %s)r)rrGrH channel_classr3Z_mapr4r5)r r1r2Zchannelr r rhandle_acceptedszSMTPServer.handle_acceptedcKstdS)N)NotImplementedError)r rBrOrPrkr~r r rrwszSMTPServer.process_message) rrrrrrr/rrwr r r rrts  c@seZdZddZddZdS)rcCsrd}|j}x`|D]X}|rP| rPd|d}t|tsDt|jd}t|d}t|tsbt|}t|qWdS)NrzX-Peer: rzutf-8) splitlines isinstancerjrGencoder)r rBrkZ inheaderslinesrxZ peerheaderr r r_print_message_contents     z&DebuggingServer._print_message_contentcKsXtd|r@|jdr&td|d|jdr@td|d|j||tddS)Nz%---------- MESSAGE FOLLOWS ----------rozmail options: %srpzrcpt options: %s z%------------ END MESSAGE ------------)rgetr)r rBrOrPrkr~r r rrws   zDebuggingServer.process_messageN)rrrrrwr r r rrscs,eZdZfddZddZddZZS)rcs.d|kr|drtdtt|j||dS)Nr4z$PureProxy does not support SMTPUTF8.)r%superrr/)r rEr~)rr rr/szPureProxy.__init__c Csh|jd}d}x|D]}|sP|d7}qW|j|d|dtj|}|j|||}td|tddS)Nrrrz X-Peer: %szwe got some refusals:)r)rvinsertr9rq_deliverrrH) r rBrOrPrkrryrxrefusedr r rrws    zPureProxy.process_messagec Csddl}i}yB|j}|j|jd|jdz|j|||}Wd|jXWn|jk r}ztdtd|j }WYdd}~Xnjt |j fk r}zHtd|j tdt |dd }t |dd} x|D]} || f|| <qWWYdd}~XnX|S) Nrrzgot SMTPRecipientsRefused)rZgotZ smtp_codeZ smtp_errorignore)smtplibZSMTPZconnectrZsendmailquitZSMTPRecipientsRefusedrrHZ recipientsrCZ SMTPExceptionrru) r rOrPrkrrseZerrcodeerrmsgrr r rrs$    "zPureProxy._deliver)rrrr/rwr __classcell__r r )rrrs cs$eZdZfddZddZZS)r cs.d|kr|drtdtt|j||dS)Nr4z'MailmanProxy does not support SMTPUTF8.)r%rrr/)r rEr~)rr rr/ szMailmanProxy.__init__cCs:ddlm}ddlm}ddlm}ddlm}g} x~|D]v} | jjdd} | jd} t| dkrhq:| d} t| dkr| d }nd }|j |  s:|d!krq:| j | | |fq:Wx| D]\} } }|j | qWt ddj |td|r|j|||}t d|tdi}||}|j|}|jds2||d<|jdsPtjtj|d<x| D]\} } }t d| td|j| }|s|j| dd}||| <|d kr|j|d dn|d kr|j|d dnh|d kr|j|d dnN|d kr|j|d dn4|d"krV|dkrd|d<nd |d<|j|d dqVWdS)#Nr)StringIO)Utils)Message)MailList@-rWrradminownerrequestrqleavezforwarding recips:rn)rzwe got refusals:fromZFromZdateZDatezsending message to)lock)tolist)Ztoadmin)Ztoowner)Z torequestZ subscribeZSubjectZ unsubscribe)rrrrrqr)rqr)iorZMailmanrrrlowerrvrhZ list_existsriremoverrqrHrrrrZEnqueue)r rBrOrPrkrrrrZ listnamesZrcptZlocalpartsZlistnamerzrZmlistsrr Zmlistr r rrwsd                    zMailmanProxy.process_message)rrrr/rwrr r )rrr s c@seZdZdZdZdZdZdS)OptionsTrNF)rrrsetuid classname size_limitr4r r r rr_src !Csty.tjtjdddddddddd g\}}Wn.tjk r\}ztd|WYdd}~XnXt}x|D]\}}|d'krtd qj|d(krtttjd qj|d)krd|_ qj|d*kr||_ qj|d+krtj a qj|d,krd|_ qj|d-krjyt|}||_Wqjtd|tj dtjdYqjXqjWt|dkr@d}d}nPt|dkr\|d }d}n4t|d kr||d }|d}ntdd!tj||jd"} | d krtdd#||d| |_yt|| dd|_Wn$tk rtdd$|YnX|jd"} | d kr"tdd%||d| |_yt|| dd|_Wn$tk rntdd&|YnX|S).Nrz nVhc:s:duzclass=Znosetuidversionhelpzsize=debugr-h--helpr-V --version-n --nosetuidF-c--class-d--debug-u --smtputf8T-s--sizezInvalid size: )rzlocalhost:8025z localhost:25rWzInvalid arguments: %s:zBad local spec: %szBad local port: %szBad remote spec: %szBad remote port: %s)rr)rr)rr)rr)rr)rr)rr)getoptrargverrorrrrrJrrrrrHr4rrrh COMMASPACErqrr localhost localportr% remotehost remoteport) ZoptsrEroptionsoptr{Zint_sizeZ localspecZ remotespecryr r r parseargsfsp         r__main__r)r)r4z7Cannot import module "pwd"; try running with -n option.)rnobodyrWz3Cannot setuid "nobody"; try running with -n option.)r)?rosrFrrr@rr-rwarningsrZemail._header_value_parserrr__all__rZprogramrJr rHr9rrrr.rrrrrr rrrrrrfindZlastdot __import__rlocalsmodrruZclass_rrrrrr4proxyrpwd ImportErrorrrrgetpwnamrPermissionErrorZloopKeyboardInterruptr r r rPsv   M-SB        compileall.cpython-36.pyc000064400000020130152462730460011320 0ustar003 \]/@sdZddlZddlZddlZddlZddlZddlmZdddgZ ddd Z dd dZ dd dZ dddZ ddZedkree ZejedS)aModule/script to byte-compile all .py files to .pyc files. When called as a script with arguments, this compiles the directories given as arguments recursively; the -l option prevents it from recursing into directories. Without arguments, if compiles all modules on sys.path, without recursing into subdirectories. (Even though it should do so for packages -- for now, you'll have to deal with packages separately.) See module py_compile for details of the actual byte-compilation. N)partial compile_dir compile_file compile_path ccs |dkrt|tjrtj|}|s0tdj|ytj|}Wn.tk rl|dkrdtdj|g}YnX|jx|D]}|dkrq|tj j ||}|dk rtj j ||}nd}tj j |s|Vq||dkr||tj kr||tj kr|tj j |r|tj j| r|t|||d|dEdHq|WdS)NzListing {!r}...zCan't list {!r} __pycache__r)ddir maxlevelsquiet) isinstanceosPathLikefspathprintformatlistdirOSErrorsortpathjoinisdircurdirpardirislink _walk_dir)dirr r r namesnamefullnamedfiler""/usr/lib64/python3.6/compileall.pyrs0    rFr c Csd} |dk rP|dkrtdn2|dkrPyddlm} Wntk rNd}YnXt||||d} d} |dk r|dkr| dk r|pd}| |d0} | jtt||||||d | } t| dd } WdQRXn&x$| D]}t|||||||sd } qW| S) aByte-compile all modules in the given directory tree. Arguments (only dir is required): dir: the directory to byte-compile maxlevels: maximum recursion level (default 10) ddir: the directory that will be prepended to the path to the file as it is compiled into each byte-code file. force: if True, force compilation, even if timestamps are up-to-date quiet: full output with False or 0, errors only with 1, no output with 2 legacy: if True, produce legacy pyc paths instead of PEP 3147 paths optimize: optimization level or -1 for level of the interpreter workers: maximum number of parallel workers Nrz%workers must be greater or equal to 0r )ProcessPoolExecutor)r r r T)Z max_workers)r forcerxr legacyoptimize)defaultF) ValueErrorZconcurrent.futuresr$ ImportErrorrmaprrmin)rr r r%r&r r'r(workersr$filessuccessZexecutorZresultsfiler"r"r#r2s6     cCsd}|dkr"t|tjr"tj|}tjj|}|dk rFtjj||} nd} |dk rd|j|} | rd|Stjj|r|r|d} nB|dkr|dkr|nd} t j j || d} n t j j |} tjj | } |dd|dd}}|d kr|sXyTt tj|j}tjd t j j|}t| d }|jd }WdQRX||kr>|SWntk rVYnX|sltdj|ytj|| | d|d}Wntjk r}zdd}|dkr|S|rtdj|n tddd|jjtjjdd}|j tjj}t|WYdd}~Xn~t!t"tfk rv}zLd}|dkr2|S|rHtdj|n tdddt|j#j$d|WYdd}~XnX|dkrd}|S)a Byte-compile one file. Arguments (only fullname is required): fullname: the file to byte-compile ddir: if given, the directory name compiled in to the byte-code file. force: if True, force compilation, even if timestamps are up-to-date quiet: full output with False or 0, errors only with 1, no output with 2 legacy: if True, produce legacy pyc paths instead of PEP 3147 paths optimize: optimization level or -1 for level of the interpreter TrNcrr ) optimizationz.pyz<4slrbzCompiling {!r}...)r(Fz*** Error compiling {!r}...z*** )endbackslashreplace)errors:r<)%r rrrrbasenamersearchisfile importlibutilcache_from_sourcedirnameintstatst_mtimestructZpack MAGIC_NUMBERopenreadrrr py_compilecompilePyCompileErrormsgencodesysstdoutencodingdecode SyntaxError UnicodeError __class____name__)r r r%r&r r'r(r0rr!ZmocfileoptZ cache_dirheadtailmtimeZexpectZchandleZactualokerrrNer"r"r#rbsx                  $ c CsXd}xNtjD]D}| s |tjkr6|r6|dkrPtdq |oNt||d||||d}q W|S)awByte-compile all module on sys.path. Arguments (all optional): skip_curdir: if true, skip current directory (default True) maxlevels: max recursion level (default 0) force: as for compile_dir() (default False) quiet: as for compile_dir() (default 0) legacy: as for compile_dir() (default False) optimize: as for compile_dir() (default -1) TrzSkipping current directoryN)r r'r()rPrrrrr)Z skip_curdirr r%r r'r(r0rr"r"r#rs    c Cszddl}|jdd}|jdddddd d |jd td d d|jddddd|jdddddd|jddddd|jdddddd |jd!d"d#dd$d |jd%d&d'd(d)|jd*d+d,d-d.|jd/d0d1td2d3|j}|j}|jrddl}|j|j|_|j dk r|j }n|j }|j ryJ|j d4kr4t j nt|j $}x|D]}|j|jqFWWdQRXWn2tk r|jd5krtd6j|j d7SX|jdk r|jpd|_d8}y|r4xj|D]b} tjj| rt| |j|j|j|j|js*d7}n*t| ||j|j|j|j|j|jd9sd7}qW|St|j|j|jd:SWn*tk rt|jd5krptd;d7SXd8S) s$    / R [ wave.cpython-36.pyc000064400000042737152462730460010162 0ustar003 \-E@sdZddlZdddddgZGdddeZd ZdZddlZddlZddl Z dd l m Z ddl m Z e ddZGdddZGdddZdddZeZdS)a$ Stuff to parse WAVE files. Usage. Reading WAVE files: f = wave.open(file, 'r') where file is either the name of a file or an open file pointer. The open file pointer must have methods read(), seek(), and close(). When the setpos() and rewind() methods are not used, the seek() method is not necessary. This returns an instance of a class with the following public methods: getnchannels() -- returns number of audio channels (1 for mono, 2 for stereo) getsampwidth() -- returns sample width in bytes getframerate() -- returns sampling frequency getnframes() -- returns number of audio frames getcomptype() -- returns compression type ('NONE' for linear samples) getcompname() -- returns human-readable version of compression type ('not compressed' linear samples) getparams() -- returns a namedtuple consisting of all of the above in the above order getmarkers() -- returns None (for compatibility with the aifc module) getmark(id) -- raises an error since the mark does not exist (for compatibility with the aifc module) readframes(n) -- returns at most n frames of audio rewind() -- rewind to the beginning of the audio stream setpos(pos) -- seek to the specified position tell() -- return the current position close() -- close the instance (make it unusable) The position returned by tell() and the position given to setpos() are compatible and have nothing to do with the actual position in the file. The close() method is called automatically when the class instance is destroyed. Writing WAVE files: f = wave.open(file, 'w') where file is either the name of a file or an open file pointer. The open file pointer must have methods write(), tell(), seek(), and close(). This returns an instance of a class with the following public methods: setnchannels(n) -- set the number of channels setsampwidth(n) -- set the sample width setframerate(n) -- set the frame rate setnframes(n) -- set the number of frames setcomptype(type, name) -- set the compression type and the human-readable compression type setparams(tuple) -- set all parameters at once tell() -- return current position in output file writeframesraw(data) -- write audio frames without pathing up the file header writeframes(data) -- write audio frames and patch up the file header close() -- patch up the file header and close the output file You should set the parameters before the first writeframesraw or writeframes. The total number of frames does not need to be set, but when it is set to the correct value, the header does not have to be patched up. It is best to first set all parameters, perhaps possibly the compression type, and then write audio frames using writeframesraw. When all frames have been written, either call writeframes(b'') or close() to patch up the sizes in the header. The close() method is called automatically when the class instance is destroyed. NopenopenfpError Wave_read Wave_writec@s eZdZdS)rN)__name__ __module__ __qualname__r r /usr/lib64/python3.6/wave.pyrNsbhi)Chunk) namedtuple _wave_paramsz7nchannels sampwidth framerate nframes comptype compnamec@seZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,S)-raPVariables used in this class: These variables are available to the user though appropriate methods of this class: _file -- the open file with methods read(), close(), and seek() set through the __init__() method _nchannels -- the number of audio channels available through the getnchannels() method _nframes -- the number of audio frames available through the getnframes() method _sampwidth -- the number of bytes per audio sample available through the getsampwidth() method _framerate -- the sampling frequency available through the getframerate() method _comptype -- the AIFF-C compression type ('NONE' if AIFF) available through the getcomptype() method _compname -- the human-readable AIFF-C compression type available through the getcomptype() method _soundpos -- the position in the audio stream available through the tell() method, set through the setpos() method These variables are used internally only: _fmt_chunk_read -- 1 iff the FMT chunk has been read _data_seek_needed -- 1 iff positioned correctly in audio file for readframes() _data_chunk -- instantiation of a chunk class for the DATA chunk _framesize -- size of one frame in the file c Csd|_d|_t|dd|_|jjdkr0td|jjddkrHtdd|_d|_xd|_ yt|jdd}Wnt k rPYnX|j}|d kr|j |d|_n2|d kr|jstd ||_|j |j |_d|_ P|jqVW|j s|j rtd dS) Nr)Z bigendiansRIFFz file does not start with RIFF idsWAVEznot a WAVE filer sfmt sdatazdata chunk before fmt chunkz#fmt chunk and/or data chunk missing)_convert _soundposr_fileZgetnamerreadZ_fmt_chunk_read _data_chunk_data_seek_neededEOFError_read_fmt_chunkZ chunksize _framesize_nframesskip)selffilechunkZ chunknamer r r initfp}s:  zWave_read.initfpc CsRd|_t|tr"tj|d}||_y|j|Wn|jrF|jYnXdS)Nrb)_i_opened_the_file isinstancestrbuiltinsrr"close)rfr r r __init__s  zWave_read.__init__cCs |jdS)N)r()rr r r __del__szWave_read.__del__cCs|S)Nr )rr r r __enter__szWave_read.__enter__cGs |jdS)N)r()rargsr r r __exit__szWave_read.__exit__cCs|jS)N)r)rr r r getfpszWave_read.getfpcCsd|_d|_dS)Nr r)rr)rr r r rewindszWave_read.rewindcCs"d|_|j}|rd|_|jdS)N)rr$r()rr r r r r(s zWave_read.closecCs|jS)N)r)rr r r tellszWave_read.tellcCs|jS)N) _nchannels)rr r r getnchannelsszWave_read.getnchannelscCs|jS)N)r)rr r r getnframesszWave_read.getnframescCs|jS)N) _sampwidth)rr r r getsampwidthszWave_read.getsampwidthcCs|jS)N) _framerate)rr r r getframerateszWave_read.getframeratecCs|jS)N) _comptype)rr r r getcomptypeszWave_read.getcomptypecCs|jS)N) _compname)rr r r getcompnameszWave_read.getcompnamecCs*t|j|j|j|j|j|jS)N)rr3r6r8r4r:r<)rr r r getparamss zWave_read.getparamscCsdS)Nr )rr r r getmarkersszWave_read.getmarkerscCs tddS)Nzno marks)r)ridr r r getmarkszWave_read.getmarkcCs*|dks||jkrtd||_d|_dS)Nrzposition not in ranger )rrrr)rposr r r setposszWave_read.setposcCs|jr8|jjdd|j|j}|r2|jj|dd|_|dkrDdS|jj||j}|jdkrxtjdkrxt j ||j}|j r|r|j |}|jt ||j |j|_|S)Nrr big)rrseekrrrr5sys byteorderaudioopbyteswaprlenr2)rnframesrAdatar r r readframess   zWave_read.readframescCsztjd|jd\}|_|_}}|tkrNtjd|jdd}|dd|_ntd|f|j|j|_d |_ d |_ dS) Nzr@rBrMrr r r r r^s, c@seZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Zd:S);raVariables used in this class: These variables are user settable through appropriate methods of this class: _file -- the open file with methods write(), close(), tell(), seek() set through the __init__() method _comptype -- the AIFF-C compression type ('NONE' in AIFF) set through the setcomptype() or setparams() method _compname -- the human-readable AIFF-C compression type set through the setcomptype() or setparams() method _nchannels -- the number of audio channels set through the setnchannels() or setparams() method _sampwidth -- the number of bytes per audio sample set through the setsampwidth() or setparams() method _framerate -- the sampling frequency set through the setframerate() or setparams() method _nframes -- the number of audio frames written to the header set through the setnframes() or setparams() method These variables are used internally only: _datalength -- the size of the audio samples written to the header _nframeswritten -- the number of frames actually written _datawritten -- the size of the audio samples actually written c CsRd|_t|tr"tj|d}||_y|j|Wn|jrF|jYnXdS)Nwb)r$r%r&r'rr"r()rr)r r r r*#s  zWave_write.__init__cCs@||_d|_d|_d|_d|_d|_d|_d|_d|_d|_ dS)NrF) rrr2r5r7r_nframeswritten _datawritten _datalength_headerwritten)rr r r r r"/szWave_write.initfpcCs |jdS)N)r()rr r r r+;szWave_write.__del__cCs|S)Nr )rr r r r,>szWave_write.__enter__cGs |jdS)N)r()rr-r r r r.AszWave_write.__exit__cCs(|jrtd|dkrtd||_dS)Nz0cannot change parameters after starting to writer zbad # of channels)rYrr2)r nchannelsr r r setnchannelsGs zWave_write.setnchannelscCs|jstd|jS)Nznumber of channels not set)r2r)rr r r r3NszWave_write.getnchannelscCs0|jrtd|dks|dkr&td||_dS)Nz0cannot change parameters after starting to writer rzbad sample width)rYrr5)rrUr r r setsampwidthSs zWave_write.setsampwidthcCs|jstd|jS)Nzsample width not set)r5r)rr r r r6ZszWave_write.getsampwidthcCs0|jrtd|dkrtdtt||_dS)Nz0cannot change parameters after starting to writerzbad frame rate)rYrintroundr7)r framerater r r setframerate_s zWave_write.setframeratecCs|jstd|jS)Nzframe rate not set)r7r)rr r r r8fszWave_write.getframeratecCs|jrtd||_dS)Nz0cannot change parameters after starting to write)rYrr)rrKr r r setnframeskszWave_write.setnframescCs|jS)N)rX)rr r r r4pszWave_write.getnframescCs.|jrtd|dkrtd||_||_dS)Nz0cannot change parameters after starting to writerRzunsupported compression type)rR)rYrr9r;)rcomptypecompnamer r r setcomptypess zWave_write.setcomptypecCs|jS)N)r9)rr r r r:{szWave_write.getcomptypecCs|jS)N)r;)rr r r r<~szWave_write.getcompnamecCsV|\}}}}}}|jrtd|j||j||j||j||j||dS)Nz0cannot change parameters after starting to write)rYrr]r^rbrcrf)rZparamsr\rUrarKrdrer r r setparamss    zWave_write.setparamscCs>|j s|j s|j r tdt|j|j|j|j|j|jS)Nznot all parameters set)r2r5r7rrrr9r;)rr r r r=szWave_write.getparamscCs tddS)Nzsetmark() not supported)r)rr?rAnamer r r setmarkszWave_write.setmarkcCs tddS)Nzno marks)r)rr?r r r r@szWave_write.getmarkcCsdS)Nr )rr r r r>szWave_write.getmarkerscCs|jS)N)rX)rr r r r1szWave_write.tellcCst|ttfst|jd}|jt|t||j|j}|j rN|j |}|jdkrpt j dkrpt j ||j}|jj||jt|7_|j||_dS)NBr rD)r%bytes bytearray memoryviewcast_ensure_header_writtenrJr5r2rrFrGrHrIrwriterYrX)rrLrKr r r writeframesraws  zWave_write.writeframesrawcCs"|j||j|jkr|jdS)N)rqrZrY _patchheader)rrLr r r writeframess  zWave_write.writeframesc CsXz2|jr0|jd|j|jkr&|j|jjWdd|_|j}|rRd|_|jXdS)Nr)rrorZrYrrflushr$r()rr r r r r(s  zWave_write.closecCs>|js:|jstd|js"td|js0td|j|dS)Nz# channels not specifiedzsample width not specifiedzsampling rate not specified)r[r2rr5r7 _write_header)rZdatasizer r r rosz!Wave_write._ensure_header_writtencCs|j s t|jjd|js0||j|j|_|j|j|j|_y|jj|_ Wnt t fk rrd|_ YnX|jjt j dd|jdddt|j|j|j|j|j|j|j|jdd |j dk r|jj|_|jjt j d |jd |_dS) NsRIFFzr1rqrsr(rorurrr r r r r s:     cCsJ|dkrt|dr|j}nd}|dkr.t|S|dkr>t|StddS) Nmoder#rwrWz$mode must be 'r', 'rb', 'w', or 'wb')rr#)rrW)hasattrr~rrr)r)r~r r r rs )Nr rNr)N)rVr'__all__ ExceptionrrTZ _array_fmtsrHrSrFr!r collectionsrrrrrrr r r r Hs$  ,d io.cpython-36.opt-1.pyc000064400000006475152462730460010565 0ustar003 \ @sldZdZdddddddd d d d d ddddddgZddlZddlZddlmZmZmZmZm Z m Z m Z m Z m Z mZmZmZmZejZde_dZdZdZGdddejejdZGdddejeZGdd d ejeZGdddejeZej e x"e e e eefD]Z!ej e!qWxe efD]Z!ej e!q W[!yddlm"Z"Wne#k r\Yn Xej e"dS) aThe io module provides the Python interfaces to stream handling. The builtin open function is defined in this module. At the top of the I/O hierarchy is the abstract base class IOBase. It defines the basic interface to a stream. Note, however, that there is no separation between reading and writing to streams; implementations are allowed to raise an OSError if they do not support a given operation. Extending IOBase is RawIOBase which deals simply with the reading and writing of raw bytes to a stream. FileIO subclasses RawIOBase to provide an interface to OS files. BufferedIOBase deals with buffering on a raw byte stream (RawIOBase). Its subclasses, BufferedWriter, BufferedReader, and BufferedRWPair buffer streams that are readable, writable, and both respectively. BufferedRandom provides a buffered interface to random access streams. BytesIO is a simple stream of in-memory bytes. Another IOBase subclass, TextIOBase, deals with the encoding and decoding of streams into text. TextIOWrapper, which extends it, is a buffered text interface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO is an in-memory stream for text. Argument names are not part of the specification, and only the arguments of open() are intended to be used as keyword arguments. data: DEFAULT_BUFFER_SIZE An int containing the default buffer size used by the module's buffered I/O classes. open() uses the file's blksize (as obtained by os.stat) if possible. zGuido van Rossum , Mike Verdone , Mark Russell , Antoine Pitrou , Amaury Forgeot d'Arc , Benjamin Peterson BlockingIOErroropenIOBase RawIOBaseFileIOBytesIOStringIOBufferedIOBaseBufferedReaderBufferedWriterBufferedRWPairBufferedRandom TextIOBase TextIOWrapperUnsupportedOperationSEEK_SETSEEK_CURSEEK_ENDN) DEFAULT_BUFFER_SIZErrrrrrr r r r IncrementalNewlineDecoderrioc@seZdZejjZdS)rN)__name__ __module__ __qualname___io_IOBase__doc__rr/usr/lib64/python3.6/io.pyrHs) metaclassc@seZdZejjZdS)rN)rrrr _RawIOBaserrrrr rKsc@seZdZejjZdS)rN)rrrr_BufferedIOBaserrrrr rNsc@seZdZejjZdS)r N)rrrr _TextIOBaserrrrr r Qs)_WindowsConsoleIO)$r __author____all__rabcrrrrrrrr r r r rr OpenWrapperrrrrrABCMetarr"rr#rr$r registerklassr% ImportErrorrrrr "s<  <   imghdr.cpython-36.opt-1.pyc000064400000010070152462730460011412 0ustar003 \@s2dZddlmZdgZd%ddZgZddZejedd Zejed d Z eje d d Z eje ddZ eje ddZ eje ddZ eje ddZejeddZejeddZejeddZejeddZejeddZejed d!Zd"d#Zed$kr.edS)&z|rptdddl}|j|jj|d}t||dqtdqt|ddd|jj ytt |Wqt k rtd YqXqWdS) Nrz/: )endzrecursing down:*z*** directory (use -r) ***:z*** not found ***) r4ospathisdirprintglobjoinr6stdoutflushrOSError)listr;Ztoplevelr4rAfilenamerEnamesrrrr6s"    r6__main__)N)__doc__rAr__all__rr rappendrrr"r#r)r*r+r,r-r.r1r2r<r6__name__rrrrsD                hmac.cpython-36.opt-1.pyc000064400000013577152462730460011067 0ustar003 i@sdZddlZddlmZddlZddlZddl Z e dde dDZ e dde dDZ dZGdd d Zd d ZGd d d e jZejreZdddZdS)zxHMAC (Keyed-Hashing for Message Authentication) Python module. Implements the HMAC algorithm as described by RFC 2104. N)_compare_digestccs|]}|dAVqdS)\N).0xrr/usr/lib64/python3.6/hmac.py srccs|]}|dAVqdS)6Nr)rrrrrr sc@sReZdZdZdZdddZeddZdd Zd d Z d d Z ddZ ddZ dS)HMACz~RFC 2104 HMAC class. Also complies with RFC 4231. This supports the API for Cryptographic Hash Functions (PEP 247). @Ncsftjrtdt|ttfs0tdt|jdkrLt j dt dt j tr\|_n,ttrxdfdd |_ndfd d |_|j|_|j|_|jj|_t|jd r|jj}|d krt j d ||jftd|j}nt j d|jtd|j}||_t||kr|j|j}|j|d}|jj|jt|jj|jt|dk rb|j|dS)a1Create a new HMAC object. key: key for the keyed hash object. msg: Initial input for the hash, if provided. digestmod: A module supporting PEP 247. *OR* A hashlib constructor returning a new hash object. *OR* A hash name suitable for hashlib.new(). Defaults to hashlib.md5. Implicit default to hashlib.md5 is deprecated and will be removed in Python 3.6. Note: key and msg must be a bytes or bytearray objects. z*This class is not available in FIPS mode. zUse hmac.new().z,key: expected bytes or bytearray, but got %rNz;szHMAC.__init__..cs j|S)N)r)r)rrrr=s block_sizez:block_size of %d seems too small; using our default of %d.zszHMAC.hexdigest)NN) r __module__ __qualname____doc__r*r6propertyr7r/r:r=r-r>rrrrr s A    r cCsX|dkrtdt|tr"|jSt|r2|d}t|tjsFtd|jjj ddS)Nz.'digestmod' argument is mandatory in FIPS moderz6Only OpenSSL hashlib hashes are accepted in FIPS mode._-) rrr%lowerr#rZHASHrr7replace)rrrr_get_openssl_names  rGc@seZdZdddZdS) HMAC_opensslNcCsLt|ttfs tdt|jt|}tjj |||d}|rH|j ||S)Nz,key: expected bytes or bytearray, but got %r)r) rrrrrrrG _hmacopensslr r9r/)clsr4r5rr7resultrrrr9s zHMAC_openssl.__new__)NN)rr?r@r9rrrrrHsrHcCs t|||S)aVCreate a new hashing object and return it. key: The starting key for the hash. msg: if available, will immediately be hashed into the object's starting state. You can now feed arbitrary strings into the object using its update() method, and can ask for the hash value at any time by calling its digest() method. )r )r4r5rrrrrs r)NN)rAwarningsr _operatorrZcompare_digestZhashlibrrrIrranger1r2r(r rGrHrrrrrrs z poplib.cpython-36.pyc000064400000032164152462730460010476 0ustar003 i: @sldZddlZddlZddlZyddlZdZWnek rDdZYnXddgZGdddeZ dZ d Z d Z d Z e e Zd ZGd ddZerGdddeZejdedkrhddlZeejdZeejejejdejejdejej\ZZxXededD]FZ ej!e \Z"Z#Z$ede xe#D]Z%ede%qd5d6Z#d7d8Z$d9d:Z%d?d;d<Z&dS)@raPThis class supports both the minimal and optional command sets. Arguments can be strings or integers (where appropriate) (e.g.: retr(1) and retr('1') both work equally well. Minimal Command Set: USER name user(name) PASS string pass_(string) STAT stat() LIST [msg] list(msg = None) RETR msg retr(msg) DELE msg dele(msg) NOOP noop() RSET rset() QUIT quit() Optional Commands (some servers support these): RPOP name rpop(name) APOP name digest apop(name, digest) TOP msg n top(msg, n) UIDL [msg] uidl(msg = None) CAPA capa() STLS stls() UTF8 utf8() Raises one exception: 'error_proto'. Instantiate with: POP3(hostname, port=110) NB: the POP protocol locks the mailbox from user authorization until QUIT, so be sure to get in, suck the messages, and quit, each time you access the mailbox. POP is a line-based protocol, which means large mail messages consume lots of python cycles reading them line-by-line. If it's available on your mail server, use IMAP4 instead, it doesn't suffer from the two problems above. zUTF-8cCs@||_||_d|_|j||_|jjd|_d|_|j|_ dS)NFrbr) hostport_tls_established_create_socketsockmakefilefile _debugging_getrespwelcome)selfr rtimeoutrrr__init__as z POP3.__init__cCstj|j|jf|S)N)socketZcreate_connectionr r)rrrrrrkszPOP3._create_socketcCs,|jdkrtdt||jj|tdS)Nz*put*)rprintreprrZsendallCRLF)rlinerrr_putlinens z POP3._putlinecCsB|jrtdt|t||j}tjd|r4td|j|dS)Nz*cmd*s[-]z*Control characters not allowed in commands) rrrbytesencodingresearch ValueErrorr )rrrrr_putcmdus   z POP3._putcmdcCs|jjtd}t|tkr$td|jdkr)cCs\t||j}|jj|j}|s&tdddl}|jd|}|j|j }|j d||fS)a Authorisation - only possible if server has supplied a timestamp in initial greeting. Args: user - mailbox user; password - mailbox password. NB: mailbox is locked by server from here to 'quit()' z!-ERR APOP not supported by serverrNrz APOP %s %s) r!r" timestampmatchrrhashlibgroupZmd5Z hexdigestr8)rr=ZpasswordZsecretmrPZdigestrrrapop;s z POP3.apopcCs|jd||fS)zRetrieve message header of message number 'which' and first 'howmuch' lines of message body. Result is in form ['response', ['line', ...], octets]. z TOP %s %s)r9)rrBZhowmuchrrrtopPszPOP3.topcCs |dk r|jd|S|jdS)zReturn message digest (unique id) list. If 'which', result contains unique id for that message in the form 'response mesgnum uid', otherwise result is the list ['response', ['mesgnum uid', ...], octets] NzUIDL %sZUIDL)r8r9)rrBrrruidlYsz POP3.uidlcCs |jdS)zITry to enter UTF-8 mode (see RFC 6856). Returns server response. ZUTF8)r8)rrrrutf8esz POP3.utf8c Cstdd}i}y8|jd}|d}x |D]}||\}}|||<q&WWn*tk rn}ztdWYdd}~XnX|S)aReturn server capabilities (RFC 2449) as a dictionary >>> c=poplib.POP3('localhost') >>> c.capa() {'IMPLEMENTATION': ['Cyrus', 'POP3', 'server', 'v2.2.12'], 'TOP': [], 'LOGIN-DELAY': ['0'], 'AUTH-RESP-CODE': [], 'EXPIRE': ['NEVER'], 'USER': [], 'STLS': [], 'PIPELINING': [], 'UIDL': [], 'RESP-CODES': []} >>> Really, according to RFC 2449, the cyrus folks should avoid having the implementation split into multiple arguments... cSs"|jdj}|d|ddfS)Nasciirr)decoder?)rZlstrrr _parsecapxszPOP3.capa.._parsecapZCAPArz!-ERR CAPA not supported by serverN)r9r) rrYcapsr2ZrawcapsZcaplineZcapnmZcapargsZ_errrrrcapaks    z POP3.capacCsxts td|jrtd|j}d|kr2td|dkrBtj}|jd}|j|j|j d|_|jj d|_ d|_|S) z{Start a TLS session on the active connection as specified in RFC 2595. context - a ssl.SSLContext z-ERR TLS support missingz$-ERR TLS session already establishedZSTLSz!-ERR STLS not supported by serverN)server_hostnamer T) HAVE_SSLrrr[ssl_create_stdlib_contextr8 wrap_socketrr rr)rcontextrZr2rrrstlss  z POP3.stls)N)N)N)'rrr__doc__r" POP3_PORTr_GLOBAL_DEFAULT_TIMEOUTrrr r&r/rr7r8r9r:r<r=r>rAr6rCrDrErFrHrGrMr#compilerNrSrTrUrVr[rbrrrrr2s@+       c@s8eZdZdZeddejdfddZddZd ddZ dS) POP3_SSLaPOP3 client class over SSL connection Instantiate with: POP3_SSL(hostname, port=995, keyfile=None, certfile=None, context=None) hostname - the hostname of the pop3 over ssl server port - port number keyfile - PEM formatted file that contains your private key certfile - PEM formatted certificate chain file context - a ssl.SSLContext See the methods of the parent class POP3 for more documentation. NcCs|dk r|dk rtd|dk r0|dk r0td|dk s@|dk rVddl}|jdtd||_||_|dkrxtj||d}||_t j ||||dS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadr')certfilekeyfile) r%warningswarnDeprecationWarningrirhr^r_rarr)rr rrirhrrarjrrrrszPOP3_SSL.__init__cCs"tj||}|jj||jd}|S)N)r\)rrrar`r )rrrrrrrs  zPOP3_SSL._create_socketcCs tddS)zThe method unconditionally raises an exception since the STLS command doesn't make any sense on an already established SSL/TLS session. z$-ERR TLS session already establishedN)r)rrirhrarrrrbsz POP3_SSL.stls)NNN) rrrrc POP3_SSL_PORTrrerrrbrrrrrgs  rg__main__rr'z Message %d:z z-----------------------)'rcrJr#rr^r] ImportError__all__ Exceptionrrdrmr-ZLFrr+rrgr5rsysargvarr:r=r>r6rAZnumMsgsZ totalSizerangeirCheadermsgr.rrHrrrrsJ  n0      bz2.cpython-36.opt-2.pyc000064400000014123152462730460010641 0ustar003 \0 @sddddddgZdZddlmZdd lZdd lZdd lZdd lZydd l m Z Wn e k rpdd l m Z YnXdd l mZmZdZd Zd ZGdddejZdddZdddZddZd S)BZ2File BZ2CompressorBZ2Decompressoropencompress decompressz%Nadeem Vawda )rN)RLock)rrc@seZdZd(ddZddZedd Zd d Zd d ZddZ ddZ d)ddZ d+ddZ d-ddZ ddZd/ddZd1ddZd d!Zd"d#Zejfd$d%Zd&d'ZdS)2rrN cCsTt|_d|_d|_t|_|dk r.tjdtd|ko@dknsNt d|dkr`d}t }nb|dkr|d }t }t ||_ nF|dkrd }t }t ||_ n*|dkrd}t }t ||_ nt d|ft|tttjfrt|||_d|_||_n.t|dst|dr||_||_ntd|jt krJtj|jttd}tj||_nd|_dS)NFz)Use of 'buffering' argument is deprecatedr r z%compresslevel must be between 1 and 9r rbwwbxxbaabzInvalid mode: %rTreadwritez6filename must be a str, bytes, file or PathLike object)Ztrailing_errorr)r r r)rr)rr)rr)r_lock_fp_closefp _MODE_CLOSED_modewarningswarnDeprecationWarning ValueError _MODE_READ _MODE_WRITEr _compressor isinstancestrbytesosPathLike _builtin_openhasattr TypeError _compressionZDecompressReaderrOSErrorioBufferedReader_buffer_pos)selffilenamemode buffering compresslevelZ mode_coderawr7/usr/lib64/python3.6/bz2.py__init__+sL      zBZ2File.__init__cCs|j|jtkrdSz<|jtkr.|jjn"|jtkrP|jj|j j d|_ Wdz|j rf|jjWdd|_d|_ t|_d|_XXWdQRXdS)NF) rrrr r/closer!rrr"flushr)r1r7r7r8r:ps      z BZ2File.closecCs |jtkS)N)rr)r1r7r7r8closedszBZ2File.closedcCs|j|jjS)N)_check_not_closedrfileno)r1r7r7r8r>szBZ2File.filenocCs|jo|jjS)N)readabler/seekable)r1r7r7r8r@szBZ2File.seekablecCs|j|jtkS)N)r=rr )r1r7r7r8r?szBZ2File.readablecCs|j|jtkS)N)r=rr!)r1r7r7r8writableszBZ2File.writablerc Cs&|j|j|jj|SQRXdS)N)r_check_can_readr/peek)r1nr7r7r8rCsz BZ2File.peekr c Cs&|j|j|jj|SQRXdS)N)rrBr/r)r1sizer7r7r8rsz BZ2File.readc Cs4|j$|j|dkrtj}|jj|SQRXdS)Nr)rrBr-DEFAULT_BUFFER_SIZEr/read1)r1rEr7r7r8rGs z BZ2File.read1c Cs&|j|j|jj|SQRXdS)N)rrBr/readinto)r1br7r7r8rHszBZ2File.readintoc CsJt|ts$t|dstd|j}|j|j|jj|SQRXdS)N __index__zInteger argument expected) r#intr)r*rJrrBr/readline)r1rEr7r7r8rLs  zBZ2File.readlinec CsJt|ts$t|dstd|j}|j|j|jj|SQRXdS)NrJzInteger argument expected) r#rKr)r*rJrrBr/ readlines)r1rEr7r7r8rMs  zBZ2File.readlinesc CsL|j<|j|jj|}|jj||jt|7_t|SQRXdS)N)rZ_check_can_writer"rrrr0len)r1dataZ compressedr7r7r8rs   z BZ2File.writec Cs |jtjj||SQRXdS)N)rr+ BaseStream writelines)r1seqr7r7r8rQszBZ2File.writelinesc Cs(|j|j|jj||SQRXdS)N)rZ_check_can_seekr/seek)r1offsetwhencer7r7r8rSsz BZ2File.seekc Cs4|j$|j|jtkr$|jjS|jSQRXdS)N)rr=rr r/tellr0)r1r7r7r8rVs   z BZ2File.tell)r Nr )r)rWrW)rWrW)rWrW)rW)__name__ __module__ __qualname__r9r:propertyr<r>r@r?rArCrrGrHrLrMrrQr-SEEK_SETrSrVr7r7r7r8r s" E     rr cCsd|kr d|krPtd|fn0|dk r0td|dk r@td|dk rPtd|jdd}t|||d}d|krtj||||S|SdS) NtrIzInvalid mode: %rz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary moder )r5)rreplacerr- TextIOWrapper)r2r3r5encodingerrorsnewlineZbz_modeZ binary_filer7r7r8r!s cCst|}|j||jS)N)rrr;)rOr5compr7r7r8rJsc Csjg}xZ|r^t}y|j|}Wntk r<|r6PnYnX|j||jsVtd|j}qWdj|S)NzACompressed data ended before the end-of-stream marker was reached)rrr,appendeofrZ unused_datajoin)rOZresultsZdecompresr7r7r8rUs  )rr NNN)r )__all__ __author__builtinsrr(r-r&rr+Z threadingr ImportErrorZdummy_threadingZ_bz2rrrr r!rPrrrr7r7r7r8s,   ( symbol.cpython-36.pyc000064400000004727152462730460010522 0ustar003 \G@sdZdZdZdZdZdZdZdZdZd Z d Z d Z d Z d Z dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Z d!Z!d"Z"d#Z#d$Z$d%Z%d&Z&d'Z'd(Z(d)Z)d*Z*d+Z+d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1d2Z2d3Z3d4Z4d5Z5d6Z6d7Z7d8Z8d9Z9d:Z:d;Z;dZ>d?Z?d@Z@dAZAdBZBdCZCdDZDdEZEdFZFdGZGdHZHdIZIdJZJdKZKdLZLdMZMdNZNdOZOdPZPdQZQdRZRdSZSdTZTdUZUdVZViZWx6eXeYjZD]$\Z[Z\e]e\e]dWkrpe[eWe\<qpWdXdYZ^e_dZkre^d[S)\z;Non-terminal symbols of Python grammar (from "graminit.h").iiiiiiiii i i i i iiiiiiiiiiiiiiiiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9i:i;i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUcCs:ddl}ddl}t|jdkr.|jddg|_|jdS)NrzInclude/graminit.hz Lib/symbol.py)systokenlenargv_main)rrr /usr/lib64/python3.6/symbol.pyrks r__main__N)`__doc__Z single_inputZ file_inputZ eval_inputZ decoratorZ decoratorsZ decoratedZ async_funcdefZfuncdefZ parametersZ typedargslistZtfpdefZ varargslistZvfpdefZstmtZ simple_stmtZ small_stmtZ expr_stmtZ annassignZtestlist_star_exprZ augassignZdel_stmtZ pass_stmtZ flow_stmtZ break_stmtZ continue_stmtZ return_stmtZ yield_stmtZ raise_stmtZ import_stmtZ import_nameZ import_fromZimport_as_nameZdotted_as_nameZimport_as_namesZdotted_as_namesZ dotted_nameZ global_stmtZ nonlocal_stmtZ assert_stmtZ compound_stmtZ async_stmtZif_stmtZ while_stmtZfor_stmtZtry_stmtZ with_stmtZ with_itemZ except_clauseZsuiteZtestZ test_nocondZlambdefZlambdef_nocondZor_testZand_testZnot_testZ comparisonZcomp_opZ star_exprexprZxor_exprZand_exprZ shift_exprZ arith_exprZtermZfactorZpowerZ atom_exprZatomZ testlist_compZtrailerZ subscriptlistZ subscriptZsliceopZexprlistZtestlistZdictorsetmakerZclassdefZarglistZargumentZ comp_iterZcomp_forZcomp_ifZ encoding_declZ yield_exprZ yield_argZsym_namelistglobalsitems_nameZ_valuetyper__name__r r r r s  stat.cpython-36.pyc000064400000007415152462730460010165 0ustar003 \ @s"dZdZdZdZdZdZdZdZdZd Z d Z d d Z d dZ dZ dZdZdZdZdZdZddZddZddZddZddZd d!Zd"d#Zd$Zd%ZeZd&Zd'Zd(Z d)Z!d*Z"d'Z#d(Z$d)Z%d+Z&d,Z'd-Z(d Z)dZ*dZ+dZ,dZ-dZ.dZ/dZ0d Z1d-Z2d,Z3dZ4d.Z5d/Z6d0Z7d1Z8d2Z9ed3fed4fed5fe d6fed7fed8ffe#d9ffe$d:ffe%eBd;fedfed?fe-d=fff Z:d@dAZ;d,Zd-Z?dZ@dZAdZBd(ZCdZDd/ZEdZFdZGd%ZHd&ZIdZJd'ZKd.ZLy ddBlMTWneNk rYnXdCS)DzoConstants/functions for interpreting results of os.stat() and os.lstat(). Suggested usage: from stat import *  cCs|d@S)zMReturn the portion of the file's mode that can be set by os.chmod(). i)moder r /usr/lib64/python3.6/stat.pyS_IMODEsrcCs|d@S)zLReturn the portion of the file's mode that describes the file type. ir )r r r r S_IFMTsri@i i`iiiicCs t|tkS)z(Return True if mode is from a directory.)rS_IFDIR)r r r r S_ISDIR.srcCs t|tkS)zsrcCs t|tkS)z,Return True if mode is from a symbolic link.)rS_IFLNK)r r r r S_ISLNKBsrcCs t|tkS)z%Return True if mode is from a socket.)rS_IFSOCK)r r r r S_ISSOCKFsriii@i8 iiiii l-bdcprwsSxtTcCsPg}x@tD]8}x2|D] \}}||@|kr|j|PqW|jdq Wdj|S)z;Convert a file's mode to a string of the form '-rwxrwxrwx'.r%)_filemode_tableappendjoin)r Zpermtablebitcharr r r filemodes   r8)*N)O__doc__ST_MODEST_INOST_DEVST_NLINKST_UIDST_GIDST_SIZEST_ATIMEST_MTIMEST_CTIMErrrrrrrrrrrrrrrrS_ISUIDS_ISGIDS_ENFMTS_ISVTXS_IREADS_IWRITES_IEXECS_IRWXUS_IRUSRS_IWUSRS_IXUSRS_IRWXGS_IRGRPS_IWGRPS_IXGRPS_IRWXOS_IROTHS_IWOTHS_IXOTH UF_NODUMP UF_IMMUTABLE UF_APPEND UF_OPAQUE UF_NOUNLINK UF_COMPRESSED UF_HIDDEN SF_ARCHIVED SF_IMMUTABLE SF_APPEND SF_NOUNLINK SF_SNAPSHOTr2r8FILE_ATTRIBUTE_ARCHIVEFILE_ATTRIBUTE_COMPRESSEDFILE_ATTRIBUTE_DEVICEFILE_ATTRIBUTE_DIRECTORYFILE_ATTRIBUTE_ENCRYPTEDFILE_ATTRIBUTE_HIDDENFILE_ATTRIBUTE_INTEGRITY_STREAMFILE_ATTRIBUTE_NORMAL"FILE_ATTRIBUTE_NOT_CONTENT_INDEXEDFILE_ATTRIBUTE_NO_SCRUB_DATAFILE_ATTRIBUTE_OFFLINEFILE_ATTRIBUTE_READONLYFILE_ATTRIBUTE_REPARSE_POINTFILE_ATTRIBUTE_SPARSE_FILEFILE_ATTRIBUTE_SYSTEMFILE_ATTRIBUTE_TEMPORARYFILE_ATTRIBUTE_VIRTUAL_stat ImportErrorr r r r s      shelve.cpython-36.pyc000064400000022364152462730460010500 0ustar003 \C!@sdZddlmZmZddlmZddlZddddgZGd d d ejZ Gd ddejZ Gd dde Z Gd dde Z dddZ dS)a Manage shelves of pickled objects. A "shelf" is a persistent, dictionary-like object. The difference with dbm databases is that the values (not the keys!) in a shelf can be essentially arbitrary Python objects -- anything that the "pickle" module can handle. This includes most class instances, recursive data types, and objects containing lots of shared sub-objects. The keys are ordinary strings. To summarize the interface (key is a string, data is an arbitrary object): import shelve d = shelve.open(filename) # open, with (g)dbm filename -- no suffix d[key] = data # store data at key (overwrites old data if # using an existing key) data = d[key] # retrieve a COPY of the data at key (raise # KeyError if no such key) -- NOTE that this # access returns a *copy* of the entry! del d[key] # delete data stored at key (raises KeyError # if no such key) flag = key in d # true if the key exists list = d.keys() # a list of all existing keys (slow!) d.close() # close it Dependent on the implementation, closing a persistent dictionary may or may not be necessary to flush changes to disk. Normally, d[key] returns a COPY of the entry. This needs care when mutable entries are mutated: for example, if d[key] is a list, d[key].append(anitem) does NOT modify the entry d[key] itself, as stored in the persistent mapping -- it only modifies the copy, which is then immediately discarded, so that the append has NO effect whatsoever. To append an item to d[key] in a way that will affect the persistent mapping, use: data = d[key] data.append(anitem) d[key] = data To avoid the problem with mutable entries, you may pass the keyword argument writeback=True in the call to shelve.open. When you use: d = shelve.open(filename, writeback=True) then d keeps a cache of all entries you access, and writes them all back to the persistent mapping when you call d.close(). This ensures that such usage as d[key].append(anitem) works as intended. However, using keyword argument writeback=True may consume vast amount of memory for the cache, and it may make d.close() very slow, if you access many of d's entries after opening it in this way: d has no way to check which of the entries you access are mutable and/or which ones you actually mutate, so it must cache, and write back at close, all of the entries that you access. You can call d.sync() to write back all the entries in the cache, and empty the cache (d.sync() also synchronizes the persistent dictionary on disk, if feasible). )Pickler Unpickler)BytesIONShelf BsdDbShelfDbfilenameShelfopenc@s8eZdZdZddZeZZZZZ Z ddZ dS) _ClosedDictz>Marker for a closed dict. Access attempts raise a ValueError.cGs tddS)Nz!invalid operation on closed shelf) ValueError)selfargsr /usr/lib64/python3.6/shelve.pyclosedEsz_ClosedDict.closedcCsdS)Nzr )r r r r__repr__Isz_ClosedDict.__repr__N) __name__ __module__ __qualname____doc__r__iter____len__ __getitem__ __setitem__ __delitem__keysrr r r rr Bsr c@s|eZdZdZdddZddZd d Zd d Zd d dZddZ ddZ ddZ ddZ ddZ ddZddZddZdS)!rzBase class for shelf implementations. This is initialized with a dictionary-like object. See the module's __doc__ string for an overview of the interface. NFutf-8cCs.||_|dkrd}||_||_i|_||_dS)N)dict _protocol writebackcache keyencoding)r rprotocolrr!r r r__init__TszShelf.__init__ccs&x |jjD]}|j|jVq WdS)N)rrdecoder!)r kr r rr^szShelf.__iter__cCs t|jS)N)lenr)r r r rrbsz Shelf.__len__cCs|j|j|jkS)N)encoder!r)r keyr r r __contains__eszShelf.__contains__cCs|j|j|jkr||S|S)N)r'r!r)r r(defaultr r rgethsz Shelf.getc CsZy|j|}WnFtk rTt|j|j|j}t|j}|jrP||j|<YnX|S)N) r KeyErrorrrr'r!rloadr)r r(valuefr r rrms zShelf.__getitem__cCsF|jr||j|<t}t||j}|j||j|j|j|j <dS)N) rr rrrdumpgetvaluerr'r!)r r(r.r/pr r rrws    zShelf.__setitem__c Cs6|j|j|j=y |j|=Wntk r0YnXdS)N)rr'r!r r,)r r(r r rrs  zShelf.__delitem__cCs|S)Nr )r r r r __enter__szShelf.__enter__cCs |jdS)N)close)r typer. tracebackr r r__exit__szShelf.__exit__cCsf|jdkrdSz0|jy|jjWntk r:YnXWdy t|_Wnd|_YnXXdS)N)rsyncr4AttributeErrorr )r r r rr4s   z Shelf.closecCst|dsdS|jdS)Nr)hasattrr4)r r r r__del__s z Shelf.__del__cCsX|jr>|jr>d|_x|jjD]\}}|||<qWd|_i|_t|jdrT|jjdS)NFTr8)rr itemsr:rr8)r r(entryr r rr8s   z Shelf.sync)NFr)N)rrrrr#rrr)r+rrrr3r7r4r;r8r r r rrMs   c@sBeZdZdZdddZddZd d Zd d Zd dZddZ dS)raShelf implementation using the "BSD" db interface. This adds methods first(), next(), previous(), last() and set_location() that have no counterpart in [g]dbm databases. The actual database must be opened using one of the "bsddb" modules "open" routines (i.e. bsddb.hashopen, bsddb.btopen or bsddb.rnopen) and passed to the constructor. See the module's __doc__ string for an overview of the interface. NFutf-8cCstj|||||dS)N)rr#)r rr"rr!r r rr#szBsdDbShelf.__init__cCs0|jj|\}}t|}|j|jt|jfS)N)r set_locationrr$r!rr-)r r(r.r/r r rr?szBsdDbShelf.set_locationcCs.t|j\}}t|}|j|jt|jfS)N)nextrrr$r!rr-)r r(r.r/r r rr@szBsdDbShelf.nextcCs.|jj\}}t|}|j|jt|jfS)N)rpreviousrr$r!rr-)r r(r.r/r r rrAszBsdDbShelf.previouscCs.|jj\}}t|}|j|jt|jfS)N)rfirstrr$r!rr-)r r(r.r/r r rrBszBsdDbShelf.firstcCs.|jj\}}t|}|j|jt|jfS)N)rlastrr$r!rr-)r r(r.r/r r rrCszBsdDbShelf.last)NFr>) rrrrr#r?r@rArBrCr r r rrs  c@seZdZdZdddZdS)rzShelf implementation using the "dbm" generic dbm interface. This is initialized with the filename for the dbm database. See the module's __doc__ string for an overview of the interface. cNFcCs$ddl}tj||j||||dS)Nr)dbmrr#r)r filenameflagr"rrEr r rr#szDbfilenameShelf.__init__)rDNF)rrrrr#r r r rrsrDFcCst||||S)aOpen a persistent dictionary for reading and writing. The filename parameter is the base filename for the underlying database. As a side-effect, an extension may be added to the filename and more than one file may be created. The optional flag parameter has the same interpretation as the flag parameter of dbm.open(). The optional protocol parameter specifies the version of the pickle protocol. See the module's __doc__ string for an overview of the interface. )r)rFrGr"rr r rrs )rDNF)rpicklerrior collections__all__MutableMappingr rrrrr r r r9s   b+ gzip.cpython-36.opt-1.pyc000064400000037544152462730460011130 0ustar003 \nO@sdZddlZddlZddlZddlZddlZddlZddlZddlZddddgZ d\Z Z Z Z Zd\ZZdddZddZGdddZGdddejZGdddejZdddZddZddZedkredS)zFunctions that read and write gzipped files. The user of the file doesn't have to worry about the compression, but random access is not allowed.NGzipFileopencompress decompressrb cCsd|kr d|krPtd|fn0|dk r0td|dk r@td|dk rPtd|jdd}t|tttjfr|t|||}n,t|d st|d rtd|||}nt d d|krt j ||||S|SdS) a Open a gzip-compressed file in binary or text mode. The filename argument can be an actual filename (a str or bytes object), or an existing file object to read from or write to. The mode argument can be "r", "rb", "w", "wb", "x", "xb", "a" or "ab" for binary mode, or "rt", "wt", "xt" or "at" for text mode. The default mode is "rb", and the default compresslevel is 9. For binary mode, this function is equivalent to the GzipFile constructor: GzipFile(filename, mode, compresslevel). In this case, the encoding, errors and newline arguments must not be provided. For text mode, a GzipFile object is created, and wrapped in an io.TextIOWrapper instance with the specified encoding, error handling behavior, and line ending(s). tbzInvalid mode: %rNz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary modereadwritez1filename must be a str or bytes object, or a file) ValueErrorreplace isinstancestrbytesosPathLikerhasattr TypeErrorio TextIOWrapper)filenamemode compresslevelencodingerrorsnewlineZgz_modeZ binary_filer#/usr/lib64/python3.6/gzip.pyrs$ cCs|jtjd|dS)Nz|jdkr||_n|jt|8_dSt|j|_d|_dS)Nr)r/r+r,r-)r0r2r#r#r$r2]s   z_PaddedFile.prependcCsd|_d|_|jj|S)N)r/r+r.seek)r0Zoffr#r#r$r5fsz_PaddedFile.seekcCsdS)NTr#)r0r#r#r$seekableksz_PaddedFile.seekableN)r*)r*) __name__ __module__ __qualname____doc__r3rr2r5r6r#r#r#r$r)Es   r)c@seZdZdZdZd-ddZeddZedd Zd d Z d d Z ddZ ddZ d/ddZ d1ddZddZeddZddZejfddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zejfd)d*Zd3d+d,ZdS)4ra The GzipFile class simulates most of the methods of a file object with the exception of the truncate() method. This class only supports opening files in binary mode. If you need to open a compressed file in text mode, use the gzip.open() function. Nr cCs2|r"d|ksd|kr"tdj||r6d|kr6|d7}|dkrTtj||pJd}|_|dkr|t|dd}t|ttfsd}n t j |}|dkrt|d d}|j d rt |_ t|}tj||_||_nN|j drt|_ |j|tj|tjtj tjd|_||_ntdj|||_|j tkr.|jdS)aGConstructor for the GzipFile class. At least one of fileobj and filename must be given a non-trivial value. The new class instance is based on fileobj, which can be a regular file, an io.BytesIO object, or any other object which simulates a file. It defaults to None, in which case filename is opened to provide a file object. When fileobj is not None, the filename argument is only used to be included in the gzip file header, which may include the original filename of the uncompressed file. It defaults to the filename of fileobj, if discernible; otherwise, it defaults to the empty string, and in this case the original filename is not included in the header. The mode argument can be any of 'r', 'rb', 'a', 'ab', 'w', 'wb', 'x', or 'xb' depending on whether the file will be read or written. The default is the mode of fileobj if discernible; otherwise, the default is 'rb'. A mode of 'r' is equivalent to one of 'rb', and similarly for 'w' and 'wb', 'a' and 'ab', and 'x' and 'xb'. The compresslevel argument is an integer from 0 to 9 controlling the level of compression; 1 is fastest and produces the least compression, and 9 is slowest and produces the most compression. 0 is no compression at all. The default is 9. The mtime argument is an optional numeric timestamp to be written to the last modification time field in the stream when compressing. If omitted or None, the current time is used. r UzInvalid mode: {!r}rNr namerrrwaxr)r>r?r@)rformatbuiltinsr myfileobjgetattrrrrrfspath startswithREADr _GzipReaderrBufferedReaderr+r<WRITE _init_writezlibZ compressobjZDEFLATED MAX_WBITSZ DEF_MEM_LEVELr _write_mtimefileobj_write_gzip_header)r0rrrrOmtimerawr#r#r$r3{s>#         zGzipFile.__init__cCsBddl}|jdtd|jtkr<|jdddkr<|jdS|jS)Nrzuse the name attributerz.gz)warningswarnDeprecationWarningrrJr<)r0rUr#r#r$rs  zGzipFile.filenamecCs |jjjS)z0Last modification time read from stream, or None)r+rR _last_mtime)r0r#r#r$rQszGzipFile.mtimecCs.t|j}d|dddtt|dS)Nz)reprrOhexid)r0sr#r#r$__repr__s zGzipFile.__repr__cCs.||_tjd|_d|_g|_d|_d|_dS)Nr*r)r<rLcrc32crcr4Zwritebufbufsizeoffset)r0rr#r#r$rKs  zGzipFile._init_writec Cs|jjd|jjdytjdd}|o|ddk}|r.|dd}|s8dg}x|D]}|r|dkrltddtjjd}tjj}q|d dd krtd t|q@t|d}t j|ddd }n>|dkrtjj}tdd tjjd}nt j|d}t|d d }x |j d }|sP|j |qW|tjjk r"|j |tjjk r@|j q@WdS)Nrrz-d-rr )rrrOrSz.gzzfilename doesn't end in .gz:rirTrT) sysargvrstdinbufferstdoutprintr\rrBrrr)argsrargr1grr#r#r$_tests<       r__main__)rrrr r )rr)r r NNN)r )r:r%rrprrLrBrZ _compression__all__ZFTEXTrrrnrrGrJrr(r)Z BaseStreamrZDecompressReaderrHrrrr7r#r#r#r$s,   +)  &sysconfig.cpython-36.opt-1.pyc000064400000037035152462730460012156 0ustar003 i,a @sdZddlZddlZddlmZmZdddddd d d d d dg Zdddddddddddddddddddddddddddd d d!d!d"d#d$d%d&d&d'd(d)d*d$d%d+d+d,d,d-d*d$d%d.ZdoZej j dZ d6ej dd7Z d8ej dd7ZejjejZejjejZejjejZejjejZdadZd9d:ZejrPejjeejZn eejZej d;krej!j"dpreejj#eeeZd>ej$kreej$d>Zd?d@Z%e&edAdZ'e'rej d;kre'j!j"dqrejjejje'Z'drdCdDZ(e(dEZ)e)r0x&dsD]Z*dHee*d3<dIee*dJ<qWdKdLZ+dMdNZ,dOdPZ-dQdRZ.dSdTZ/dtdUdVZ0dWdZ1dXdYZ2dZd[Z3d\d]Z4d^d_Z5dud`dZ6dadZ7dbd Z8dcd Z9e.ddEfddd Z:e.ddEfdedZ;dfdZdid Z?djdkZ@dldmZAeBdnkreAdS)vz-Access to Python's configuration information.N)pardirrealpathget_config_h_filenameget_config_varget_config_varsget_makefile_filenameget_pathget_path_names get_paths get_platformget_python_versionget_scheme_namesparse_config_hz/{installed_base}/lib64/python{py_version_short}z){platbase}/lib64/python{py_version_short}z1{base}/lib/python{py_version_short}/site-packagesz7{platbase}/lib64/python{py_version_short}/site-packagesz;{installed_base}/include/python{py_version_short}{abiflags}z?{installed_platbase}/include/python{py_version_short}{abiflags}z {base}/binz{base})stdlib platstdlibpurelibplatlibinclude platincludescriptsdataz{installed_base}/lib/pythonz{base}/lib/pythonz{installed_base}/include/pythonz{installed_base}/Libz {base}/Libz{base}/Lib/site-packagesz{installed_base}/Includez{base}/Scriptsz#{userbase}/Python{py_version_nodot}z1{userbase}/Python{py_version_nodot}/site-packagesz+{userbase}/Python{py_version_nodot}/Includez+{userbase}/Python{py_version_nodot}/Scriptsz {userbase})rrrrrrrz){userbase}/lib64/python{py_version_short}z5{userbase}/lib/python{py_version_short}/site-packagesz7{userbase}/lib64/python{py_version_short}/site-packagesz+{userbase}/include/python{py_version_short}z{userbase}/binz{userbase}/lib/pythonz#{userbase}/lib/python/site-packagesz{userbase}/include) posix_prefix posix_homentnt_user posix_userosx_framework_userrrrrrrrz%d.%dz%d%dc Cs"yt|Stk r|SXdS)N)rOSError)pathr !/usr/lib64/python3.6/sysconfig.py_safe_realpathcsr"r\pcbuild\win32\pcbuild\amd64Z_PYTHON_PROJECT_BASEcCs.x(dD] }tjjtjj|d|rdSqWdS)N Setup.dist Setup.localModulesTF)r%r&)osrisfilejoin)dfnr r r!_is_python_source_dirxs r-_homeFcCs|rtrttSttS)N) _sys_homer- _PROJECT_BASE) check_homer r r!is_python_buildsr2Trrz{srcdir}/Includez{projectbase}/.rcCsdy |jf|Stk r^y|jftjStk rX}ztd|WYdd}~XnXYnXdS)Nz{%s})formatKeyErrorr(environAttributeError)s local_varsvarr r r! _subst_varss r:cCs4|j}x&|jD]\}}||kr$q|||<qWdS)N)keysitems) target_dict other_dict target_keyskeyvaluer r r! _extend_dicts rBcCsfi}|dkri}t|txDt|jD]4\}}tjdkrHtjj|}tjjt ||||<q*W|S)Nposixr)rCr) rBr_INSTALL_SCHEMESr<r(namer expandusernormpathr:)schemevarsresr@rAr r r! _expand_varss   rKcCstjdkrdStjS)NrCr)r(rEr r r r!_get_default_schemes rLcCstjjdd}dd}tjdkrBtjjdp.d}|r8|S||dStjdkr|td }|r||r`|S|dd |d tjdd S|r|S|dd SdS)NPYTHONUSERBASEcWstjjtjj|S)N)r(rrFr*)argsr r r!joinusersz_getuserbase..joinuserrAPPDATA~PythondarwinPYTHONFRAMEWORKLibraryz%d.%drz.local)r(r5getrEsysplatformr version_info)env_baserObase frameworkr r r! _getuserbases"    r]cCsZddl}|jd}|jd}|jd}|dkr2i}i}i}t|dd}|j} WdQRXx| D]} | jds`| jd kr|q`|j| } | r`| jd d \} } | j} | jd d }d |kr| || <q`y t | } Wn$t k r| jd d || <Yq`X| || <q`Wt |j }d}x t |dkrxt|D]}||}|j|}|j|}|rv|rv|j|jkrp|n|} n|r|n|} | dk r| jd } d}| |krt|| }n| |krd}nx| tjkrtj| }n`| |kr0|jdr |dd|kr d }n$d| |krd}nt|d| }n d || <}|r|| jd}|d| j||}d |kr~|||<n~y t |}Wn"t k r|j||<Yn X|||<|j||jdr|dd|kr|dd}||kr|||<n|||<|j|q,WqWx.|jD]"\}} t| tr&| j||<q&W|j||S)zParse a Makefile-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. rNz"([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)z\$\(([A-Za-z][A-Za-z0-9_]*)\)z\${([A-Za-z][A-Za-z0-9_]*)}surrogateescape)errors#rz$$$CFLAGSLDFLAGSCPPFLAGSTFPY_)rdrerf)recompileopen readlines startswithstripmatchgroupreplaceint ValueErrorlistr;lentuplesearchstartstrr(r5endremover< isinstanceupdate)filenamerIri _variable_rx _findvar1_rx _findvar2_rxdonenotdoneflineslinemnvtmpv variablesrenamed_variablesrErAm1m2founditemafterkr r r!_parse_makefiles                                 rcCsdtrtjjtptdSttdr0dttj f}nd}ttj drP|dtj j 7}tjjt d|dS)z Return the path of the Makefile.Makefileabiflagsz config-%s%sconfig _multiarchz-%sr) _PYTHON_BUILDr(rr*r/r0hasattrrW_PY_VERSION_SHORTrimplementationrr)config_dir_namer r r!rLs  c Cs(tjjddjtjtjttjdddS)N_PYTHON_SYSCONFIGDATA_NAMEz+_sysconfigdata_{abi}_{platform}_{multiarch}rra)abirX multiarch) r(r5rVr3rWrrXgetattrrr r r r!_get_sysconfigdata_nameYs rc ,Csddl}i}t}yt||WnJtk rj}z.d|}t|drR|d|j}t|WYdd}~XnXt}y"t|}t||WdQRXWnJtk r}z.d|}t|dr|d|j}t|WYdd}~XnXt r|d|d<t }dt j kr$ddl }|j|} || _| t j|<d ttf} tt d rF| d 7} tj| d d tjj| |d} t| ddd(}|jd|jd|j||dWdQRXtdddd}|j| WdQRXdS)z;Generate the Python module containing build-time variables.rNz.invalid Python installation: unable to open %sstrerrorz (%s)LDSHARED BLDSHAREDrSzbuild/lib.%s-%sgettotalrefcountz-pydebugT)exist_okz.pywutf8)encodingzB# system configuration generated and used by the sysconfig module zbuild_time_vars = )streamzpybuilddir.txtascii)pprintrrrrrrrkrrrrWrXtypes ModuleTypebuild_time_varsmodulesr rr(makedirsrr*write) rrImakefileemsgconfig_hrrErmodule pybuilddirdestfiler r r!_generate_posix_varsbsL          rcCs0t}t|ttdgd}|j}|j|dS)z7Initialize the module as appropriate for POSIX systems.rrN)r __import__globalslocalsrr})rIrE_temprr r r! _init_posixsrcCsVtd|d<td|d<td|d<d|d<d |d <t|d <tjjttj|d <d S)z+Initialize the module as appropriate for NTrLIBDESTr BINLIBDESTr INCLUDEPYz.pyd EXT_SUFFIXz.exeEXEVERSIONBINDIRN)r_PY_VERSION_SHORT_NO_DOTr(rdirnamer"rW executable)rIr r r!_init_non_posixs   rc Cs|dkr i}ddl}|jd}|jd}xx|j}|s8P|j|}|r|jdd\}}y t|}Wntk rvYnX|||<q*|j|}|r*d||jd<q*W|S)zParse a config.h-style file. A dictionary containing name/value pairs is returned. If an optional dictionary is passed in as the second argument, it is used instead of a new dictionary. Nrz"#define ([A-Z][A-Za-z0-9_]+) (.*) z&/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/ rbr)rirjreadlinerorprrrs) fprIri define_rxundef_rxrrrrr r r!rs*      cCsBtr,tjdkr"tjjtptd}q4tp(t}ntd}tjj|dS)zReturn the path of pyconfig.h.rPCrz pyconfig-64.h)rr(rErr*r/r0r)inc_dirr r r!rs   cCs tttS)z,Return a tuple containing the schemes names.)rvsortedrDr r r r!r scCstS)z*Return a tuple containing the paths names.) _SCHEME_KEYSr r r r!r scCs|rt||St|SdS)zReturn a mapping containing an install scheme. ``scheme`` is the install scheme name. If not provided, it will return the default scheme for the current platform. N)rKrD)rHrIexpandr r r!r s cCst||||S)z[Return a path corresponding to the scheme. ``scheme`` is the install scheme name. )r )rErHrIrr r r!rsc Gs|tdkrFiattd<ttd<ttd<ttd<ttd<ttd<ttd<ttd <ttd <ttd <yt j td <Wnt k rd td <YnXt j dkrttt j dkrtttjd}|dk r|td<ttd<tjdt}t j dkrtrt jjt}t jj||}nt jjt}t|td<t jdkrFddl}|jt|rtg}x|D]}|jtj|qVW|StSdS)anWith no arguments, return a dictionary of all configuration variables relevant for the current platform. On Unix, this means every variable defined in Python's installed Makefile; On Windows it's a much smaller set. With arguments, return a list of values that result from looking up each argument in the configuration variable dictionary. Nprefix exec_prefix py_versionpy_version_shortpy_version_nodotinstalled_baser[installed_platbaseplatbase projectbaserrarrCrSOuserbasesrcdirrSr) _CONFIG_VARS_PREFIX _EXEC_PREFIX _PY_VERSIONrr _BASE_PREFIX_BASE_EXEC_PREFIXr0rWrr6r(rErrrVr]rrrrr*r"rX _osx_supportcustomize_config_varsappend)rNrrr[rvalsrEr r r!rsP           cCs*|dkrddl}|jdtdtj|S)zReturn the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name) rrNz SO is deprecated, use EXT_SUFFIXr)warningswarnDeprecationWarningrrV)rErr r r!rPscCstjdkrnd}tjj|}|d)kr(tjStjjd|}tj|t||j}|dkr\dS|dkrhdStjStjd ksttd  rtjSd tj krtj d Stj \}}}}}|jj d d }|j dd}|j d d}|dddkrd||fS|dddkrV|ddkrd}dt |dd|ddf}ddd} |d| tj 7}n|dd d!krtd||fS|ddd"krd#|||fS|dd$d%krd%}ddl} | jd&} | j|} | r| j}n2|dd$d'krddl} | jt|||\}}}d(|||fS)*aReturn a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and platform-specific built distributions. Typically includes the OS name and version and the architecture (as supplied by 'os.uname()'), although the exact information included depends on the OS; eg. for IRIX the architecture isn't particularly important (IRIX only runs on SGI hardware), but for Linux the kernel version isn't particularly important. Examples of returned values: linux-i586 linux-alpha (?) solaris-2.6-sun4u irix-5.3 irix64-6.2 Windows will return one of: win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc) win-ia64 (64bit Windows on Itanium) win32 (all others - specifically, sys.platform is returned) For other non-POSIX platforms, currently just returns 'sys.platform'. rz bit (rb)amd64z win-amd64itaniumzwin-ia64rCuname_PYTHON_HOST_PLATFORM/ra _-Nlinuxz%s-%ssunosr5solarisz%d.%srhr32bit64bit)ilz.%sirixaixz%s-%s.%scygwinz[\d.]+rSz%s-%s-%s)r(rErWversionfindrXrulowerrr5rrqrrmaxsizerirjrorprget_platform_osxr)rijlookosnamehostreleasermachinebitnessrirel_rerrr r r!r \sZ             cCstS)N)rr r r r!r scCsJxDtt|jD]0\}\}}|dkr2td|td||fqWdS)Nrz%s: z %s = "%s") enumeraterr<print)titlerindexr@rAr r r! _print_dicts rcCsfdtjkrtdStdttdttdtttdtttdt dS)z*Display all information sysconfig detains.z--generate-posix-varsNzPlatform: "%s"zPython version: "%s"z!Current installation scheme: "%s"Paths Variables) rWargvrrr r rLrr rr r r r!_mains  r__main__)rrrrrrr)r#r$)r#r$)F)rr)N)N)C__doc__r(rWZos.pathrr__all__rDrrsplitrrYrrrrGrr base_prefixrrrbase_exec_prefixrr _USER_BASEr"rrr0getcwdrErendswithr*r5r-rr/r2rrHr:rBrKrLr]rrrrrrrrr r r rrrr r rr__name__r r r r!s           |  ?   M [ types.cpython-36.pyc000064400000020013152462730460010343 0ustar003 \" @sdZddlZddZeeZeddZeejZeejZ eej Z ddZ ee Z d d ZeZeeZejd d ZeZeeZGd ddZeejZeeZegjZeeZyeWn:ek rejdZeeZeejZ dZ[YnXeejZ!eej"Z#[[[ [[fddfddZ$fdfddZ%ddZ&GdddZ'ddl(Z)ddl*j+Z,GdddZ-ddZ.dde/DZ0dS)zO Define names for built-in types that aren't directly accessible as a builtin. NcCsdS)Nrrr/usr/lib64/python3.6/types.py_f srcCsdS)Nrrrrr srccs dVdS)Nrrrrr_gsrcsdS)Nrrrrr_csrcCs dVdS)Nrrrrr_agsr c@seZdZddZdS)_CcCsdS)Nr)selfrrr_m!sz_C._mN)__name__ __module__ __qualname__r rrrrr sr cCs2t|||\}}}|dk r"||||||f|S)zBCreate a class object dynamically using the appropriate metaclass.N) prepare_class)namebaseskwds exec_bodymetansrrr new_class9srcCs~|dkri}nt|}d|kr*|jd}n|r||_||_||_|p|j|_|dk|_tt|dd|_dS)N__isabstractmethod__F)fgetfsetfdel__doc__ overwrite_docboolgetattrr')r r(r)r*docrrr__init__}s   zDynamicClassAttribute.__init__cCs6|dkr|jr|Stn|jdkr,td|j|S)Nzunreadable attribute)r'AttributeErrorr()r instance ownerclassrrr__get__s zDynamicClassAttribute.__get__cCs"|jdkrtd|j||dS)Nzcan't set attribute)r)r1)r r2valuerrr__set__s zDynamicClassAttribute.__set__cCs |jdkrtd|j|dS)Nzcan't delete attribute)r*r1)r r2rrr __delete__s z DynamicClassAttribute.__delete__cCs8|jr |jnd}t|||j|j|p(|j}|j|_|S)N)r,r+rr)r*)r r(fdocresultrrrgetterszDynamicClassAttribute.gettercCs$t||j||j|j}|j|_|S)N)rr(r*r+r,)r r)r9rrrsetterszDynamicClassAttribute.settercCs$t||j|j||j}|j|_|S)N)rr(r)r+r,)r r*r9rrrdeleterszDynamicClassAttribute.deleter)NNNN)N) r rrr+r0r4r6r7r:r;r<rrrrr&qs  r&c@seZdZddZddZddZddZed d Zed d Z ed dZ eddZ eZ e Z e Ze ZddZddZeZdS)_GeneratorWrappercCs2||_|jtk|_t|dd|_t|dd|_dS)Nr r)_GeneratorWrapper__wrapped __class__ GeneratorType_GeneratorWrapper__isgenr.r r)r genrrrr0s z_GeneratorWrapper.__init__cCs |jj|S)N)r>send)r valrrrrCsz_GeneratorWrapper.sendcGs|jj|f|S)N)r>throw)r tprestrrrrEsz_GeneratorWrapper.throwcCs |jjS)N)r>close)r rrrrHsz_GeneratorWrapper.closecCs|jjS)N)r>gi_code)r rrrrIsz_GeneratorWrapper.gi_codecCs|jjS)N)r>gi_frame)r rrrrJsz_GeneratorWrapper.gi_framecCs|jjS)N)r> gi_running)r rrrrKsz_GeneratorWrapper.gi_runningcCs|jjS)N)r> gi_yieldfrom)r rrrrLsz_GeneratorWrapper.gi_yieldfromcCs t|jS)N)nextr>)r rrr__next__sz_GeneratorWrapper.__next__cCs|jr |jS|S)N)rAr>)r rrr__iter__sz_GeneratorWrapper.__iter__N)r rrr0rCrErHpropertyrIrJrKrLcr_codecr_frame cr_runningcr_awaitrNrO __await__rrrrr=s    r=cststdjtkrtddjtkrjj}|d@r@S|d@rj}t|j|j |j |j |jdB|j |j |j|j|j|j|j|j|j|j_Stjfdd}|S) z2Convert regular generator function to a coroutine.z$types.coroutine() expects a callable__code__Ni csT||}|jtks*|jtkr.|jjd@r.|St|tjrPt|tj rPt |S|S)NrX) r? CoroutineTyper@rIco_flagsr_collections_abc Generator Coroutiner=)argskwargscoro)funcrrwrappeds   zcoroutine..wrapped)callabler"r? FunctionTyper.CodeTyperVrZ co_argcountco_kwonlyargcount co_nlocals co_stacksizeco_code co_constsco_names co_varnames co_filenameco_nameco_firstlineno co_lnotab co_freevars co_cellvars _functoolswraps)rarZcorbr)rar coroutines(   rwcCs g|]}|dddkr|qS)Nr_r).0nrrr sr{)1r+sysrrrd LambdaTyperVre__dict__MappingProxyTypeimplementationSimpleNamespacerr@rrYrHr AsyncGeneratorTyper r MethodTypelenBuiltinFunctionTypeappendBuiltinMethodType ModuleTyper"exc_infotb TracebackTypetb_frame FrameTypeGetSetDescriptorType __globals__MemberDescriptorTyperrrr& functoolsrtcollections.abcabcr[r=rwglobals__all__rrrrsR             : %7fractions.cpython-36.opt-1.pyc000064400000043774152462730460012151 0ustar003 \W\@sdZddlmZddlZddlZddlZddlZddlZddgZddZ ddZ ej j Z ej jZejd ejejBZGd ddejZdS) z+Fraction, infinite-precision, real numbers.)DecimalNFractiongcdcCsfddl}|jdtdt|tko0t|knr\|p<|dkrPtj|| Stj||St||S)zCalculate the Greatest Common Divisor of a and b. Unless b==0, the result will have the same sign as b (so that when b is divided by it, the result comes out positive). rNz6fractions.gcd() is deprecated. Use math.gcd() instead.)warningswarnDeprecationWarningtypeintmathr_gcd)abrr!/usr/lib64/python3.6/fractions.pyrs   cCsx|r|||}}qW|S)Nr)r rrrrr sr aC \A\s* # optional whitespace at the start, then (?P[-+]?) # an optional sign, then (?=\d|\.\d) # lookahead for digit or .digit (?P\d*) # numerator (possibly empty) (?: # followed by (?:/(?P\d+))? # an optional denominator | # or (?:\.(?P\d*))? # an optional fractional part (?:E(?P[-+]?\d+))? # and optional exponent ) \s*\Z # and optional whitespace to finish cseZdZdZdSZdTddfdd Zed d Zed d ZdUddZ e ddZ e ddZ ddZ ddZddZddZeeej\ZZddZeeej\ZZdd Zeeej\ZZd!d"Zeeej\ZZ d#d$Z!d%d&Z"d'd(Z#d)d*Z$d+d,Z%d-d.Z&d/d0Z'd1d2Z(d3d4Z)d5d6Z*d7d8Z+d9d:Z,dVd;d<Z-d=d>Z.d?d@Z/dAdBZ0dCdDZ1dEdFZ2dGdHZ3dIdJZ4dKdLZ5dMdNZ6dOdPZ7dQdRZ8Z9S)Wra]This class implements rational numbers. In the two-argument form of the constructor, Fraction(8, 6) will produce a rational number equivalent to 4/3. Both arguments must be Rational. The numerator defaults to 0 and the denominator defaults to 1 so that Fraction(3) == 3 and Fraction() == 0. Fractions can also be constructed from: - numeric strings similar to those accepted by the float constructor (for example, '-2.3' or '1e10') - strings of the form '123/456' - float and Decimal instances - other Rational instances (including integers) _numerator _denominatorrNT) _normalizec sRtt|j|}|dkrdt|tkr6||_d|_|St|tj rV|j |_|j |_|St|t t frx|j\|_|_|St|trZtj|}|dkrtd|t|jdpd}|jd}|rt|}nvd}|jd}|rdt|}||t|}||9}|jd } | rBt| } | d kr4|d| 9}n|d| 9}|jd d krb| }ntd nft|tkot|knrn@t|tj rt|tj r|j |j |j |j }}ntd|d krtd||rBt|tkot|knr(tj||} |d kr2| } n t||} || }|| }||_||_|S)aConstructs a Rational. Takes a string like '3/2' or '1.5', another Rational instance, a numerator/denominator pair, or a float. Examples -------- >>> Fraction(10, -8) Fraction(-5, 4) >>> Fraction(Fraction(1, 7), 5) Fraction(1, 35) >>> Fraction(Fraction(1, 7), Fraction(2, 3)) Fraction(3, 14) >>> Fraction('314') Fraction(314, 1) >>> Fraction('-35/4') Fraction(-35, 4) >>> Fraction('3.1415') # conversion from numeric string Fraction(6283, 2000) >>> Fraction('-47e-2') # string may include a decimal exponent Fraction(-47, 100) >>> Fraction(1.47) # direct construction from float (exact conversion) Fraction(6620291452234629, 4503599627370496) >>> Fraction(2.25) Fraction(9, 4) >>> Fraction(Decimal('1.47')) Fraction(147, 100) Nz Invalid literal for Fraction: %rZnum0denomdecimal exprZsign-z2argument should be a string or a Rational instancez+both arguments should be Rational instanceszFraction(%s, 0))superr__new__r r rr isinstancenumbersRational numerator denominatorfloatras_integer_ratiostr_RATIONAL_FORMATmatch ValueErrorgrouplen TypeErrorZeroDivisionErrorr rr ) clsr r!rselfmrrZscalerg) __class__rrrTsr            $   $   zFraction.__new__cCsDt|tjr||St|ts8td|j|t|jf||jS)zConverts a finite float to a rational number, exactly. Beware that Fraction.from_float(0.3) != Fraction(3, 10). z.%s.from_float() only takes floats, not %r (%s))rrIntegralr"r*__name__r r#)r,frrr from_floats   zFraction.from_floatcCsVddlm}t|tjr&|t|}n$t||sJtd|j|t|jf||j S)zAConverts a finite Decimal instance to a rational number, exactly.r)rz2%s.from_decimal() only takes Decimals, not %r (%s)) rrrrr1r r*r2r r#)r,Zdecrrrr from_decimals   zFraction.from_decimal@Bc Cs|dkrtd|j|kr"t|Sd\}}}}|j|j}}xP||}|||} | |kr\P|||||| f\}}}}||||}}q>W|||} t|| ||| |} t||} t| |t| |kr| S| SdS)aWClosest Fraction to self with denominator at most max_denominator. >>> Fraction('3.141592653589793').limit_denominator(10) Fraction(22, 7) >>> Fraction('3.141592653589793').limit_denominator(100) Fraction(311, 99) >>> Fraction(4321, 8765).limit_denominator(10000) Fraction(4321, 8765) rz$max_denominator should be at least 1rN)rrrr)r'rrrabs) r-Zmax_denominatorZp0Zq0Zp1Zq1ndr Zq2kZbound1Zbound2rrrlimit_denominators&      zFraction.limit_denominatorcCs|jS)N)r)r rrrr szFraction.numeratorcCs|jS)N)r)r rrrr!szFraction.denominatorcCsd|jj|j|jfS)z repr(self)z %s(%s, %s))r0r2rr)r-rrr__repr__szFraction.__repr__cCs(|jdkrt|jSd|j|jfSdS)z str(self)rz%s/%sN)rr$r)r-rrr__str__s  zFraction.__str__csTfdd}djd|_j|_fdd}djd|_j|_||fS)aGenerates forward and reverse operators given a purely-rational operator and a function from the operator module. Use this like: __op__, __rop__ = _operator_fallbacks(just_rational_op, operator.op) In general, we want to implement the arithmetic operations so that mixed-mode operations either call an implementation whose author knew about the types of both arguments, or convert both to the nearest built in type and do the operation there. In Fraction, that means that we define __add__ and __radd__ as: def __add__(self, other): # Both types have numerators/denominator attributes, # so do the operation directly if isinstance(other, (int, Fraction)): return Fraction(self.numerator * other.denominator + other.numerator * self.denominator, self.denominator * other.denominator) # float and complex don't have those operations, but we # know about those types, so special case them. elif isinstance(other, float): return float(self) + other elif isinstance(other, complex): return complex(self) + other # Let the other type take over. return NotImplemented def __radd__(self, other): # radd handles more types than add because there's # nothing left to fall back to. if isinstance(other, numbers.Rational): return Fraction(self.numerator * other.denominator + other.numerator * self.denominator, self.denominator * other.denominator) elif isinstance(other, Real): return float(other) + float(self) elif isinstance(other, Complex): return complex(other) + complex(self) return NotImplemented There are 5 different cases for a mixed-type addition on Fraction. I'll refer to all of the above code that doesn't refer to Fraction, float, or complex as "boilerplate". 'r' will be an instance of Fraction, which is a subtype of Rational (r : Fraction <: Rational), and b : B <: Complex. The first three involve 'r + b': 1. If B <: Fraction, int, float, or complex, we handle that specially, and all is well. 2. If Fraction falls back to the boilerplate code, and it were to return a value from __add__, we'd miss the possibility that B defines a more intelligent __radd__, so the boilerplate should return NotImplemented from __add__. In particular, we don't handle Rational here, even though we could get an exact answer, in case the other type wants to do something special. 3. If B <: Fraction, Python tries B.__radd__ before Fraction.__add__. This is ok, because it was implemented with knowledge of Fraction, so it can handle those instances before delegating to Real or Complex. The next two situations describe 'b + r'. We assume that b didn't know about Fraction in its implementation, and that it uses similar boilerplate code: 4. If B <: Rational, then __radd_ converts both to the builtin rational type (hey look, that's us) and proceeds. 5. Otherwise, __radd__ tries to find the nearest common base ABC, and fall back to its builtin type. Since this class doesn't subclass a concrete type, there's no implementation to fall back to, so we need to try as hard as possible to return an actual value, or the user will get a TypeError. csPt|ttfr||St|tr0t||St|trHt||StSdS)N)rr rr"complexNotImplemented)r r)fallback_operatormonomorphic_operatorrrforwardvs   z-Fraction._operator_fallbacks..forward__csZt|tjr||St|tjr4t|t|St|tjrRt|t|StSdS)N)rrrZRealr"Complexr>r?)rr )r@rArrreverses    z-Fraction._operator_fallbacks..reverseZ__r)r2__doc__)rAr@rBrEr)r@rAr_operator_fallbacks&sP  zFraction._operator_fallbackscCs,|j|j}}t|j||j|||S)za + b)r!rr )r rdadbrrr_addsz Fraction._addcCs,|j|j}}t|j||j|||S)za - b)r!rr )r rrHrIrrr_subsz Fraction._subcCst|j|j|j|jS)za * b)rr r!)r rrrr_mulsz Fraction._mulcCst|j|j|j|jS)za / b)rr r!)r rrrr_divs z Fraction._divcCstj||S)za // b)r floor)r rrrr __floordiv__szFraction.__floordiv__cCstj||S)za // b)r rN)rr rrr __rfloordiv__szFraction.__rfloordiv__cCs||}|||S)za % br)r rdivrrr__mod__szFraction.__mod__cCs||}|||S)za % br)rr rQrrr__rmod__szFraction.__rmod__cCst|tjr|jdkr|j}|dkr>t|j||j|ddS|jdkrft|j| |j| ddSt|j | |j | ddSqt|t|Sn t||SdS)za ** b If b is not an integer, the result will be a float or complex since roots are generally irrational. If b is an integer, the result will be rational. rrF)rN) rrrr!r rrrr")r rZpowerrrr__pow__s         zFraction.__pow__cCs\|jdkr|jdkr||jSt|tjr b)rmrngt)r rrrr__gt__fszFraction.__gt__cCs|j|tjS)za <= b)rmrnle)r rrrr__le__jszFraction.__le__cCs|j|tjS)za >= b)rmrnge)r rrrr__ge__nszFraction.__ge__cCs |jdkS)za != 0r)r)r rrr__bool__rszFraction.__bool__cCs|jt|ffS)N)r0r$)r-rrr __reduce__xszFraction.__reduce__cCs t|tkr|S|j|j|jS)N)r rr0rr)r-rrr__copy__{s zFraction.__copy__cCs t|tkr|S|j|j|jS)N)r rr0rr)r-memorrr __deepcopy__s zFraction.__deepcopy__)rr)rN)r6)N):r2 __module__ __qualname__rF __slots__r classmethodr4r5r;propertyr r!r<r=rGrJrnadd__add____radd__rKsub__sub____rsub__rLmul__mul____rmul__rMtruediv __truediv__ __rtruediv__rOrPrRrSrTrUrVrWrXrYrZr[r^rerjrmrprrrtrvrwrxryr{ __classcell__rr)r0rr<sVm  7  k )rFrrr rrnresys__all__rr hash_infomodulusrbinfrccompileVERBOSE IGNORECASEr%rrrrrrs  tty.cpython-36.opt-1.pyc000064400000002062152462730460010762 0ustar003 \o@sLdZddlTddgZdZdZdZdZdZd Zd Z e fd dZ e fd dZ d S)zTerminal utilities.)*setraw setcbreakcCst|}|tttBtBtBtB@|t<|tt@|t<|t t t B@|t <|t t B|t <|t ttBtBtB@|t <d|tt<d|tt<t|||dS)zPut terminal into a raw mode.rrN) tcgetattrIFLAGZBRKINTZICRNLZINPCKZISTRIPZIXONOFLAGZOPOSTCFLAGZCSIZEZPARENBZCS8LFLAGECHOICANONZIEXTENZISIGCCVMINVTIME tcsetattr)fdwhenmoder/usr/lib64/python3.6/tty.pyrs"  cCsFt|}|tttB@|t<d|tt<d|tt<t|||dS)z Put terminal into a cbreak mode.rrN)r rrrrrrr)rrrrrrrs   N) __doc__Ztermios__all__r r rrZISPEEDZOSPEEDrZ TCSAFLUSHrrrrrrs _sysconfigdata_dm_linux_x86_64-linux-gnu.cpython-36.opt-2.pyc000064400000056413152462730460020012 0ustar003 iu@sdddddddddddd d dd d d dddddddddddddddddddddddd dd!d"d#d$d%dddd&d'd d(d)d*d&d+dd!dddd,d-ddddddd.d&d&d&d&dd&dd&d&d&d&d&dddddddddd&dd&d&d&d&d&d&d&d&dd&d&d&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&dd&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&dd&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&ddd&d&dd&dddd&d&d&ddd&d&dddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&dd&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&d&d&d&d&d&ddd&d&dd&d&ddd&d&d&d&d&d&d&dddddd&dd&d&ddddddd&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd d/ddd0d1d0d0d2d3d4d d5d6dd7dd d8ddd9dd:d;ddd d d?d@dAdBdd+ddCdDdddEddddddd&dFdGdHddIdJd dKdLd&dMd dNdddddddd dOdPdQd dRdSdd ddTd&ddd ddUddddVdWd d ddXd&dYdZdd[d6d\d]dd&d&d&dd^d_d`dadbd9dddcd?dddddedfdgdfdedgdededfded]dededededfd&dhdidjd&dkdlddmd:d&d&dddddnddodpdqdd&dd ddrd&d&dsdtdd&d&d&dddd&d&d&ddudvdtdwdxdxdtdyZdzS){Zdmarrcsz!-Wno-unused-result -Wsign-comparez-IObjects -IInclude -IPythonz/usr/binz/usr/lib64/python3.6z-L. -lpython3.6dmzOgcc -pthread -shared -Wl,-z,relro -Wl,-z,now -g -Wl,-z,relro -Wl,-z,now -gpythonzx86_64-redhat-linux-gnu\z gcc -pthreadz-fPICav-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvz?configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.ina-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapva=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-typez-Wl,-z,relro -Wl,-z,now -gz-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -ga'--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-ipv6' '--enable-shared' '--with-computed-gotos=yes' '--with-dbmliborder=gdbm:ndbm:bdb' '--with-system-expat' '--with-system-ffi' '--enable-loadable-sqlite-extensions' '--with-dtrace' '--with-lto' '--with-ssl-default-suites=openssl' '--with-valgrind' '--without-ensurepip' '--with-pydebug' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS= -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv ' 'LDFLAGS= -Wl,-z,relro -Wl,-z,now -g ' 'CPPFLAGS=' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'z /usr/includez/usr/include/python3.6dm:zLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/debugz/bin/shz.sozcpython-36dm-x86_64-linux-gnuz&Parser Objects Python Modules Programsz9/builddir/build/BUILD/Python-3.6.8/Tools/gdb/libpython.pyz"/* Don't use ncurses extensions */z-szInclude Lib MisczGLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/debug ./pythonzLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/debug ./python /builddir/build/BUILD/Python-3.6.8/Tools/scripts/run_tests.pyizPython/thread.ozIpython3.6 /builddir/build/BUILD/Python-3.6.8/Tools/scripts/update_file.pyz3.6z"/builddir/build/BUILD/Python-3.6.8z)xml xml/dom xml/etree xml/parsers xml/saxz./builddir/build/BUILD/Python-3.6.8/build/debugz /usr/sharez/usr(ABIFLAGSAC_APPLE_UNIVERSAL_BUILDAIX_GENUINE_CPLUSPLUSANDROID_API_LEVELARARFLAGS BASECFLAGS BASECPPFLAGS BASEMODLIBSBINDIR BINLIBDEST BLDLIBRARY BLDSHAREDBUILDEXE BUILDPYTHONBUILD_GNU_TYPE BYTESTR_DEPSCCCCSHAREDCFLAGSCFLAGSFORSHAREDCFLAGS_ALIASING CONFIGFILESCONFIGURE_CFLAGSCONFIGURE_CFLAGS_NODISTCONFIGURE_CPPFLAGSCONFIGURE_LDFLAGSCONFIGURE_LDFLAGS_NODIST CONFIG_ARGSCONFINCLUDEDIR CONFINCLUDEPYCOREPYTHONPATH COVERAGE_INFOCOVERAGE_REPORTCOVERAGE_REPORT_OPTIONSCPPFLAGSCXXDESTDIRSDESTLIBDESTPATH DESTSHAREDDFLAGSDIRMODEDISTDISTDIRS DISTFILES DLINCLDIR DLLLIBRARY"DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754DOUBLE_IS_BIG_ENDIAN_IEEE754DOUBLE_IS_LITTLE_ENDIAN_IEEE754DTRACE DTRACE_DEPSDTRACE_HEADERS DTRACE_OBJS DYNLOADFILE ENABLE_IPV6 ENSUREPIPEXEEXEMODEEXTRAMACHDEPPATH EXTRATESTOPTS EXTRA_CFLAGS EXT_SUFFIXFILEMODEFLOCK_NEEDS_LIBBSDGETPGRP_HAVE_ARGGETTIMEOFDAY_NO_TZ GITBRANCHGITTAG GITVERSIONGNULD HAVE_ACCEPT4 HAVE_ACOSH HAVE_ADDRINFO HAVE_ALARMHAVE_ALIGNED_REQUIRED HAVE_ALLOCA_H HAVE_ALTZONE HAVE_ASINHHAVE_ASM_TYPES_H HAVE_ATANHHAVE_BIND_TEXTDOMAIN_CODESETHAVE_BLUETOOTH_BLUETOOTH_HHAVE_BLUETOOTH_HHAVE_BROKEN_MBSTOWCSHAVE_BROKEN_NICEHAVE_BROKEN_PIPE_BUFHAVE_BROKEN_POLLHAVE_BROKEN_POSIX_SEMAPHORESHAVE_BROKEN_PTHREAD_SIGMASKHAVE_BROKEN_SEM_GETVALUEHAVE_BROKEN_UNSETENVHAVE_BUILTIN_ATOMIC HAVE_CHFLAGS HAVE_CHOWN HAVE_CHROOT HAVE_CLOCKHAVE_CLOCK_GETRESHAVE_CLOCK_GETTIMEHAVE_CLOCK_SETTIMEHAVE_COMPUTED_GOTOS HAVE_CONFSTR HAVE_CONIO_H HAVE_COPYSIGN HAVE_CRYPT_H HAVE_CTERMIDHAVE_CTERMID_RHAVE_CURSES_FILTER HAVE_CURSES_HHAVE_CURSES_HAS_KEYHAVE_CURSES_IMMEDOKHAVE_CURSES_IS_PADHAVE_CURSES_IS_TERM_RESIZEDHAVE_CURSES_RESIZETERMHAVE_CURSES_RESIZE_TERMHAVE_CURSES_SYNCOKHAVE_CURSES_TYPEAHEADHAVE_CURSES_USE_ENVHAVE_CURSES_WCHGATHAVE_DECL_ISFINITEHAVE_DECL_ISINFHAVE_DECL_ISNANHAVE_DECL_RTLD_DEEPBINDHAVE_DECL_RTLD_GLOBALHAVE_DECL_RTLD_LAZYHAVE_DECL_RTLD_LOCALHAVE_DECL_RTLD_NODELETEHAVE_DECL_RTLD_NOLOADHAVE_DECL_RTLD_NOWHAVE_DECL_TZNAMEHAVE_DEVICE_MACROS HAVE_DEV_PTC HAVE_DEV_PTMX HAVE_DIRECT_HHAVE_DIRENT_D_TYPE HAVE_DIRENT_H HAVE_DIRFD HAVE_DLFCN_H HAVE_DLOPEN HAVE_DUP2 HAVE_DUP3HAVE_DYNAMIC_LOADING HAVE_ENDIAN_H HAVE_EPOLLHAVE_EPOLL_CREATE1HAVE_ERF HAVE_ERFC HAVE_ERRNO_H HAVE_EXECV HAVE_EXPM1HAVE_FACCESSAT HAVE_FCHDIR HAVE_FCHMOD HAVE_FCHMODAT HAVE_FCHOWN HAVE_FCHOWNAT HAVE_FCNTL_HHAVE_FDATASYNCHAVE_FDOPENDIR HAVE_FEXECVE HAVE_FINITE HAVE_FLOCK HAVE_FORK HAVE_FORKPTYHAVE_FPATHCONF HAVE_FSEEK64 HAVE_FSEEKO HAVE_FSTATAT HAVE_FSTATVFS HAVE_FSYNC HAVE_FTELL64 HAVE_FTELLO HAVE_FTIMEHAVE_FTRUNCATE HAVE_FUTIMENS HAVE_FUTIMESHAVE_FUTIMESATHAVE_GAI_STRERROR HAVE_GAMMAHAVE_GCC_ASM_FOR_MC68881HAVE_GCC_ASM_FOR_X64HAVE_GCC_ASM_FOR_X87HAVE_GCC_UINT128_THAVE_GETADDRINFOHAVE_GETC_UNLOCKEDHAVE_GETENTROPYHAVE_GETGROUPLISTHAVE_GETGROUPSHAVE_GETHOSTBYNAMEHAVE_GETHOSTBYNAME_RHAVE_GETHOSTBYNAME_R_3_ARGHAVE_GETHOSTBYNAME_R_5_ARGHAVE_GETHOSTBYNAME_R_6_ARGHAVE_GETITIMERHAVE_GETLOADAVG HAVE_GETLOGINHAVE_GETNAMEINFOHAVE_GETPAGESIZEHAVE_GETPEERNAME HAVE_GETPGID HAVE_GETPGRP HAVE_GETPIDHAVE_GETPRIORITY HAVE_GETPWENTHAVE_GETRANDOMHAVE_GETRANDOM_SYSCALLHAVE_GETRESGIDHAVE_GETRESUID HAVE_GETSID HAVE_GETSPENT HAVE_GETSPNAMHAVE_GETTIMEOFDAY HAVE_GETWDHAVE_GLIBC_MEMMOVE_BUG HAVE_GRP_HHAVE_HSTRERROR HAVE_HTOLE64 HAVE_HYPOT HAVE_IEEEFP_HHAVE_IF_NAMEINDEXHAVE_INET_ATONHAVE_INET_PTONHAVE_INITGROUPSHAVE_INTTYPES_H HAVE_IO_HHAVE_IPA_PURE_CONST_BUG HAVE_KILL HAVE_KILLPG HAVE_KQUEUEHAVE_LANGINFO_HHAVE_LARGEFILE_SUPPORT HAVE_LCHFLAGS HAVE_LCHMOD HAVE_LCHOWN HAVE_LGAMMA HAVE_LIBDL HAVE_LIBDLD HAVE_LIBIEEEHAVE_LIBINTL_HHAVE_LIBREADLINEHAVE_LIBRESOLVHAVE_LIBSENDFILEHAVE_LIBUTIL_H HAVE_LINK HAVE_LINKATHAVE_LINUX_CAN_BCM_HHAVE_LINUX_CAN_HHAVE_LINUX_CAN_RAW_FD_FRAMESHAVE_LINUX_CAN_RAW_HHAVE_LINUX_NETLINK_HHAVE_LINUX_RANDOM_HHAVE_LINUX_TIPC_H HAVE_LOCKF HAVE_LOG1P HAVE_LOG2HAVE_LONG_DOUBLE HAVE_LSTAT HAVE_LUTIMES HAVE_MAKEDEV HAVE_MBRTOWC HAVE_MEMMOVE HAVE_MEMORY_H HAVE_MEMRCHR HAVE_MKDIRAT HAVE_MKFIFO HAVE_MKFIFOAT HAVE_MKNOD HAVE_MKNODAT HAVE_MKTIME HAVE_MMAP HAVE_MREMAPHAVE_NCURSES_H HAVE_NDIR_HHAVE_NETPACKET_PACKET_H HAVE_NET_IF_H HAVE_NICE HAVE_OPENAT HAVE_OPENPTY HAVE_PATHCONF HAVE_PAUSE HAVE_PIPE2 HAVE_PLOCK HAVE_POLL HAVE_POLL_HHAVE_POSIX_FADVISEHAVE_POSIX_FALLOCATE HAVE_PREAD HAVE_PRLIMITHAVE_PROCESS_HHAVE_PROTOTYPESHAVE_PTHREAD_ATFORKHAVE_PTHREAD_CONDATTR_SETCLOCKHAVE_PTHREAD_DESTRUCTORHAVE_PTHREAD_HHAVE_PTHREAD_INITHAVE_PTHREAD_KILLHAVE_PTHREAD_SIGMASK HAVE_PTY_H HAVE_PUTENV HAVE_PWRITE HAVE_READLINKHAVE_READLINKAT HAVE_READV HAVE_REALPATH HAVE_RENAMEATHAVE_RL_APPEND_HISTORYHAVE_RL_CALLBACKHAVE_RL_CATCH_SIGNAL#HAVE_RL_COMPLETION_APPEND_CHARACTER'HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOKHAVE_RL_COMPLETION_MATCHES"HAVE_RL_COMPLETION_SUPPRESS_APPENDHAVE_RL_PRE_INPUT_HOOKHAVE_RL_RESIZE_TERMINAL HAVE_ROUNDHAVE_SCHED_GET_PRIORITY_MAX HAVE_SCHED_HHAVE_SCHED_RR_GET_INTERVALHAVE_SCHED_SETAFFINITYHAVE_SCHED_SETPARAMHAVE_SCHED_SETSCHEDULER HAVE_SELECTHAVE_SEM_GETVALUE HAVE_SEM_OPENHAVE_SEM_TIMEDWAITHAVE_SEM_UNLINK HAVE_SENDFILE HAVE_SETEGID HAVE_SETEUID HAVE_SETGIDHAVE_SETGROUPSHAVE_SETHOSTNAMEHAVE_SETITIMERHAVE_SETLOCALE HAVE_SETPGID HAVE_SETPGRPHAVE_SETPRIORITY HAVE_SETREGIDHAVE_SETRESGIDHAVE_SETRESUID HAVE_SETREUID HAVE_SETSID HAVE_SETUID HAVE_SETVBUF HAVE_SHADOW_HHAVE_SIGACTIONHAVE_SIGALTSTACKHAVE_SIGINTERRUPT HAVE_SIGNAL_HHAVE_SIGPENDING HAVE_SIGRELSEHAVE_SIGTIMEDWAIT HAVE_SIGWAITHAVE_SIGWAITINFO HAVE_SNPRINTFHAVE_SOCKADDR_ALGHAVE_SOCKADDR_SA_LENHAVE_SOCKADDR_STORAGEHAVE_SOCKETPAIR HAVE_SPAWN_H HAVE_SSIZE_T HAVE_STATVFSHAVE_STAT_TV_NSECHAVE_STAT_TV_NSEC2HAVE_STDARG_PROTOTYPES HAVE_STDINT_H HAVE_STDLIB_HHAVE_STD_ATOMIC HAVE_STRDUP HAVE_STRFTIMEHAVE_STRINGS_H HAVE_STRING_H HAVE_STRLCPYHAVE_STROPTS_HHAVE_STRUCT_PASSWD_PW_GECOSHAVE_STRUCT_PASSWD_PW_PASSWDHAVE_STRUCT_STAT_ST_BIRTHTIMEHAVE_STRUCT_STAT_ST_BLKSIZEHAVE_STRUCT_STAT_ST_BLOCKSHAVE_STRUCT_STAT_ST_FLAGSHAVE_STRUCT_STAT_ST_GENHAVE_STRUCT_STAT_ST_RDEVHAVE_STRUCT_TM_TM_ZONE HAVE_SYMLINKHAVE_SYMLINKAT HAVE_SYNC HAVE_SYSCONFHAVE_SYSEXITS_HHAVE_SYS_AUDIOIO_HHAVE_SYS_BSDTTY_HHAVE_SYS_DEVPOLL_HHAVE_SYS_DIR_HHAVE_SYS_ENDIAN_HHAVE_SYS_EPOLL_HHAVE_SYS_EVENT_HHAVE_SYS_FILE_HHAVE_SYS_IOCTL_HHAVE_SYS_KERN_CONTROL_HHAVE_SYS_LOADAVG_HHAVE_SYS_LOCK_HHAVE_SYS_MKDEV_HHAVE_SYS_MODEM_HHAVE_SYS_NDIR_HHAVE_SYS_PARAM_HHAVE_SYS_POLL_HHAVE_SYS_RANDOM_HHAVE_SYS_RESOURCE_HHAVE_SYS_SELECT_HHAVE_SYS_SENDFILE_HHAVE_SYS_SOCKET_HHAVE_SYS_STATVFS_HHAVE_SYS_STAT_HHAVE_SYS_SYSCALL_HHAVE_SYS_SYSMACROS_HHAVE_SYS_SYS_DOMAIN_HHAVE_SYS_TERMIO_HHAVE_SYS_TIMES_HHAVE_SYS_TIME_HHAVE_SYS_TYPES_HHAVE_SYS_UIO_H HAVE_SYS_UN_HHAVE_SYS_UTSNAME_HHAVE_SYS_WAIT_HHAVE_SYS_XATTR_HHAVE_TCGETPGRPHAVE_TCSETPGRP HAVE_TEMPNAMHAVE_TERMIOS_H HAVE_TERM_H HAVE_TGAMMA HAVE_TIMEGM HAVE_TIMES HAVE_TMPFILE HAVE_TMPNAM HAVE_TMPNAM_R HAVE_TM_ZONE HAVE_TRUNCATE HAVE_TZNAME HAVE_UCS4_TCL HAVE_UNAME HAVE_UNISTD_H HAVE_UNLINKAT HAVE_UNSETENVHAVE_USABLE_WCHAR_T HAVE_UTIL_HHAVE_UTIMENSAT HAVE_UTIMES HAVE_UTIME_H HAVE_WAIT3 HAVE_WAIT4 HAVE_WAITID HAVE_WAITPID HAVE_WCHAR_H HAVE_WCSCOLL HAVE_WCSFTIME HAVE_WCSXFRM HAVE_WMEMCMPHAVE_WORKING_TZSET HAVE_WRITEVHAVE_ZLIB_COPY HAVE__GETPTY HOST_GNU_TYPEINCLDIRSTOMAKE INCLUDEDIR INCLUDEPYINSTALL INSTALL_DATAINSTALL_PROGRAMINSTALL_SCRIPTINSTALL_SHARED INSTSONAMEIO_HIO_OBJS LDCXXSHAREDLDFLAGSLDLAST LDLIBRARY LDLIBRARYDIRLDSHARED LDVERSIONLIBCLIBDESTLIBDIRLIBFFI_INCLUDEDIRLIBM LIBOBJDIRLIBOBJSLIBPCLIBPLLIBRARY LIBRARY_OBJSLIBRARY_OBJS_OMIT_FROZENLIBS LIBSUBDIRSLINKCC LINKFORSHAREDLIPO_32BIT_FLAGS LLVM_PROF_ERRLLVM_PROF_FILELLVM_PROF_MERGERLN LOCALMODLIBSLOG1P_DROPS_ZERO_SIGNMACHDEP MACHDEPPATH MACHDEP_OBJS MACHDESTLIBMACOSX_DEPLOYMENT_TARGETMAINCCMAJOR_IN_MKDEVMAJOR_IN_SYSMACROS MAKESETUPMANDIRMKDIR_PMODLIBSMODNAMESMODOBJS MODULE_OBJS MULTIARCHMULTIARCH_CPPFLAGSMVWDELCH_IS_EXPRESSION NO_AS_NEEDED OBJECT_OBJSOPTOTHER_LIBTOOL_OPTPACKAGE_BUGREPORT PACKAGE_NAMEPACKAGE_STRINGPACKAGE_TARNAME PACKAGE_URLPACKAGE_VERSIONPARSER_HEADERS PARSER_OBJSPGENPGENOBJSPGOBJSPGO_PROF_GEN_FLAGPGO_PROF_USE_FLAGPLATDIRPOBJSPOSIX_SEMAPHORES_NOT_ENABLED PROFILE_TASKPTHREAD_SYSTEM_SCHED_SUPPORTED PY3LIBRARYPYLONG_BITS_IN_DIGITPYTHONPYTHONFRAMEWORKPYTHONFRAMEWORKDIRPYTHONFRAMEWORKINSTALLDIRPYTHONFRAMEWORKPREFIX PYTHONPATHPYTHON_FOR_BUILDPYTHON_FOR_REGENPYTHON_HEADERS PYTHON_OBJS PY_CFLAGSPY_CFLAGS_NODISTPY_COERCE_C_LOCALEPY_CORE_CFLAGSPY_CORE_LDFLAGS PY_CPPFLAGSPY_FORMAT_SIZE_T PY_LDFLAGSPY_LDFLAGS_NODISTPY_SSL_DEFAULT_CIPHERSPY_SSL_DEFAULT_CIPHER_STRINGPY_WARN_ON_C_LOCALEPy_DEBUGPy_ENABLE_SHAREDPy_HASH_ALGORITHM QUICKTESTOPTSREADELF RESSRCDIR RETSIGTYPE RUNSHARED SCRIPTDIRSETPGRP_HAVE_ARGSGI_ABISHELLSHLIBS SHLIB_SUFFIXSIGNED_RIGHT_SHIFT_ZERO_FILLSSITEPATH SIZEOF_DOUBLE SIZEOF_FLOAT SIZEOF_FPOS_T SIZEOF_INT SIZEOF_LONGSIZEOF_LONG_DOUBLESIZEOF_LONG_LONG SIZEOF_OFF_T SIZEOF_PID_TSIZEOF_PTHREAD_T SIZEOF_SHORT SIZEOF_SIZE_T SIZEOF_TIME_TSIZEOF_UINTPTR_T SIZEOF_VOID_PSIZEOF_WCHAR_T SIZEOF__BOOLSOABISRCDIRS SRC_GDB_HOOKS STDC_HEADERSSTRICT_SYSV_CURSES STRIPFLAGSUBDIRS SUBDIRSTOOSYSLIBSSYS_SELECT_WITH_SYS_TIMETANH_PRESERVES_ZERO_SIGNTCLTK_INCLUDES TCLTK_LIBSTESTOPTSTESTPATH TESTPYTHONTESTPYTHONOPTS TESTRUNNER TESTTIMEOUT THREADOBJTIMEMODULE_LIBTIME_WITH_SYS_TIMETM_IN_SYS_TIME UNICODE_DEPS UNIVERSALSDK UPDATE_FILEUSE_COMPUTED_GOTOS USE_INLINEVERSIONVPATHWANT_SIGFPE_HANDLERWINDOW_HAS_FLAGSWITH_DOC_STRINGS WITH_DTRACE WITH_DYLD WITH_LIBINTLWITH_NEXT_FRAMEWORK WITH_PYMALLOC WITH_THREAD WITH_VALGRINDX87_DOUBLE_ROUNDING XMLLIBSUBDIRS abs_builddir abs_srcdir datarootdir exec_prefixprefixsrcdirN)build_time_varsrr@/usr/lib64/python3.6/_sysconfigdata_dm_linux_x86_64-linux-gnu.pys *pkgutil.cpython-36.opt-2.pyc000064400000025373152462730460011634 0ustar003 \CS @stddlmZddlmZddlZddlZddlZddlZddl Zddl Z ddl m Z ddl Z ddddd d d d d dddg ZeddZde_ddZddZd*dd Zd+dd Zed,ddZd-ddZejejjeddZGdd d ZGd d d Zy.ddlZdd!lmZd.d"d#ZejeeWne k r<YnXd$dZ!d/d%dZ"d&dZ#d'dZ$d(dZ%d)d Z&dS)0) namedtuple)singledispatchN) ModuleType get_importeriter_importers get_loader find_loader walk_packages iter_modulesget_data ImpImporter ImpLoader read_code extend_path ModuleInfozmodule_finder name ispkgz.A namedtuple with minimal info about a module.c CsLy |j}Wn4tk r>|j|}|dkr0dStjj||SX||SdS)N) find_specAttributeError find_module importlibutilspec_from_loader)findernamerloaderr/usr/lib64/python3.6/pkgutil.py _get_specs  rcCs6ddl}|jd}|tjjkr"dS|jd|j|S)Nr)marshalreadrr MAGIC_NUMBERload)streamrmagicrrrr(s    c #sifddxt||D]}|V|jryt|jWnNtk r\|dk rX||jYqtk r|dk r~||jnYqXttj|jddpg}fdd|D}t ||jd|EdHqWdS)NcSs||kr dSd||<dS)NTr)pmrrrseenRszwalk_packages..seen__path__csg|]}|s|qSrr).0r&)r(rr isz!walk_packages...) r ispkg __import__r ImportError Exceptiongetattrsysmodulesr )pathprefixonerrorinfor)r(rr 5s   ccsf|dkrt}n tt|}i}xB|D]:}x4t||D]&\}}||kr4d||<t|||Vq4Wq$WdS)N)rmapriter_importer_modulesr)r4r5Z importersyieldedirr-rrrr ns   cCst|dsgS|j|S)Nr )hasattrr )importerr5rrrr:s r:c cs0|jdkstjj|j rdSi}ddl}ytj|j}Wntk rRg}YnX|jx|D]}|j|}|dksb||krqbtjj|j|}d}| otjj|od|kr|}ytj|} Wntk rg} YnXx&| D]}|j|} | dkrd}PqWqb|rbd|krbd||<|||fVqbWdS)Nr__init__Fr,Tr8) r4osisdirinspectlistdirOSErrorsort getmodulenamejoin) r>r5r;rB filenamesfnmodnamer4r- dircontentssubnamerrr_iter_file_finder_moduless<       rMc Cs.tjtjdttjdaWdQRXdS)Nignoreimp)warningscatch_warnings simplefilterDeprecationWarningr import_modulerOrrrr _import_imps  rUc@s*eZdZd ddZd ddZd ddZdS) r NcCstjdtt||_dS)Nz5This emulation is deprecated, use 'importlib' instead)rPwarnrSrUr4)selfr4rrrr?szImpImporter.__init__c Cs~|jdd}||kr$|jdkr$dS|jdkr4d}ntjj|jg}ytj||\}}}Wntk rndSXt||||S)Nr,r8)splitr4r@realpathrOrr/r )rWfullnamer4rLfilefilenameetcrrrrs zImpImporter.find_moduler%c cs0|jdkstjj|j rdSi}ddl}ytj|j}Wntk rRg}YnX|jx|D]}|j|}|dksb||krqbtjj|j|}d}| otjj|od|kr|}ytj|} Wntk rg} YnXx&| D]}|j|} | dkrd}PqWqb|rbd|krbd||<|||fVqbWdS)Nrr?Fr,Tr8) r4r@rArBrCrDrErFrG) rWr5r;rBrHrIrJr4r-rKrLrrrr s<       zImpImporter.iter_modules)N)N)r%)__name__ __module__ __qualname__r?rr rrrrr s  c@sjeZdZdZZddZddZddZdd Zd d Z d d Z dddZ dddZ ddZ dddZdS)r NcCs.tjdtt||_||_||_||_dS)Nz5This emulation is deprecated, use 'importlib' instead)rPrVrSrUr\r]r[r^)rWr[r\r]r^rrrr?szImpLoader.__init__c Cs:|jztj||j|j|j}Wd|jr4|jjX|S)N)_reopenrO load_moduler\r]r^close)rWr[modrrrrcs  zImpLoader.load_modulec Cst|d }|jSQRXdS)Nrb)openr )rWpathnamer\rrrr "s zImpLoader.get_datacCsT|jrP|jjrP|jd}|tjkr2t|jd|_n|tjtjfkrPt|jd|_dS)Nrrf) r\closedr^rO PY_SOURCErgr] PY_COMPILED C_EXTENSION)rWmod_typerrrrb&s   zImpLoader._reopencCs0|dkr|j}n||jkr,td|j|f|S)Nz,Loader for module %s cannot handle module %s)r[r/)rWr[rrr _fix_name.s  zImpLoader._fix_namecCs|j|}|jdtjkS)Nri)rpr^rO PKG_DIRECTORY)rWr[rrr is_package6s zImpLoader.is_packagec Cs|j|}|jdkr|jd}|tjkrD|j|}t||jd|_nJ|tjkrv|j zt |j |_Wd|j j Xn|tj kr|jj|_|jS)Nriexec)rpcoder^rOrl get_sourcecompiler]rmrbrr\rdrq _get_delegateget_code)rWr[rosourcerrrrx:s       zImpLoader.get_codec Cs|j|}|jdkr|jd}|tjkrP|jz|jj|_Wd|jjXnd|tj krt j j |j ddrt|j ddd}|j|_WdQRXn|tjkr|jj|_|jS)Nrir8rjrXrX)rpryr^rOrlrbr\r rdrmr@r4existsr]rgrqrwru)rWr[rofrrrruKs      zImpLoader.get_sourcecCst|j}t|d}|jS)Nr?)r r]rr)rWrspecrrrrw]s  zImpLoader._get_delegatecCsH|j|}|jd}|tjkr*|jjS|tjtjtjfkrD|j SdS)Nri) rpr^rOrqrw get_filenamerlrmrnr])rWr[rorrrr}bs    zImpLoader.get_filename)N)N)N)r_r`rartryr?rcr rbrprrrxrurwr}rrrrr s    ) zipimporterc csttj|j}|j}t|}i}ddl}x|D]}|j|s@q0||djt j }t|dkr|djdr|d|krd||d<||ddfVt|dkrq0|j |d}|dkrq0|r0d|kr0||kr0d||<||dfVq0WdS) Nrrir8z __init__.pyTr?r,F) sorted zipimport_zip_directory_cachearchiver5lenrB startswithrYr@seprF) r>r5Zdirlist_prefixZplenr;rBrIrJrrriter_zipimport_modulesps*     rcCsnytj|}WnZtk rhxDtjD]6}y||}tjj||PWq&tk rZYq&Xq&Wd}YnX|S)N)r2path_importer_cacheKeyError path_hooks setdefaultr/)Z path_itemr> path_hookrrrrs    ccs|jdrdj|}t|d|krV|jdd}tj|}t|dd}|dkrhdSntjEdHtj }x|D]}t |VqnWdS)Nr,z'Relative module name {!r} not supportedrr)) rformatr/ rpartitionrrTr1r2 meta_pathr4r)r[msgZpkg_nameZpkgr4itemrrrrs      cCsn|tjkr tj|}|dkr dSt|trb|}t|dd}|dk rF|St|dddkrZdS|j}n|}t|S)N __loader____spec__)r2r3 isinstancerr1r_r)Zmodule_or_namemodulerr[rrrrs    cCs|jdrdj|}t|ytjj|}WnFttttfk rr}z"d}t|j|t |||WYdd}~XnX|dk r|j SdS)Nr,z'Relative module name {!r} not supportedz,Error while finding loader for {!r} ({}: {})) rrr/rrrr TypeError ValueErrortyper)r[rr|Zexrrrrs  *cCst|ts|S|d}|dd}|jd\}}}|rbytj|j}Wqhttfk r^|SXntj}x:|D]0}t|t sqpt |}|dk rg} t |dr|j |} | dk r| j pg} nt |dr|j|\}} x| D]} | |kr|j| qWtjj||} tjj| rpy t| } Wn8tk rT}ztjjd| |fWYdd}~XqpX| Bx:| D]2}|jd}| sb|jdrqb|j|qbWWdQRXqpW|S)Nz.pkgr,rrzCan't open %s: %s  #)rlistrr2r3r)rrr4strrr=rsubmodule_search_locationsrappendr@rGisfilergrDstderrwriterstripr)r4rZ sname_pkgZparent_package_Z final_nameZ search_pathdirrportionsr|ZportionZpkgfiler{rlinerrrrsP!            cCstjj|}|dkrdS|j}|dks2t|d r6dStjj|pLtjj |}|dksbt|d rfdS|j d}|j dt j j|jt j j|}|j|S)Nr __file__/r)rrrrr=r2r3get _bootstrap_loadrYinsertr@r4dirnamerrGr )packageZresourcer|rrepartsZ resource_namerrrr Rs     )Nr%N)Nr%)r%)r%)r%)r%)' collectionsr functoolsrZ simplegenericrimportlib.utilimportlib.machineryr@Zos.pathr2typesrrP__all__r__doc__rrr r r:rMregister machinery FileFinderrUr r rr~rr/rrrrrr rrrrsP     9   ( Jc   ^_compat_pickle.cpython-36.opt-2.pyc000064400000014556152462730460013127 0ustar003 \-"C@sdddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d**Zddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddi!Zd ZyeWnek rYn Xed 7ZxeD]Zdefedef<q*Wd ZxeD]ZdQefedef<qPWeddejDZ eddejDZ ej dddddd"d"dEdEdEd(ddd e j dd(d/dddej d d ddddddie j ddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-i d.Z xe D]Zd/e def<qzWd0Z xe D]Zd1e def<qWdS(2builtinscopyregZqueueZ socketserverZ configparserreprlibtkinter.filedialogtkinter.simpledialogztkinter.colorchooserztkinter.commondialogztkinter.dialogz tkinter.dndz tkinter.fontztkinter.messageboxztkinter.scrolledtextztkinter.constantsz tkinter.tixz tkinter.ttkZtkinterZ _markupbasewinreg_threadZ _dummy_threadzdbm.bsdzdbm.dumbzdbm.ndbmzdbm.gnuz xmlrpc.client xmlrpc.serverz http.clientz html.entitiesz html.parserz http.cookieszhttp.cookiejar http.serverz test.support subprocess urllib.parsezurllib.robotparserurllib.requestdbmzcollections.abc)* __builtin__Zcopy_regZQueueZ SocketServerZ ConfigParserreprZ tkFileDialogZtkSimpleDialogZtkColorChooserZtkCommonDialogZDialogZTkdndZtkFontZ tkMessageBoxZ ScrolledTextZ TkconstantsZTixZttkZTkinterZ markupbase_winregZthreadZ dummy_threadZdbhashZdumbdbmr gdbmZ xmlrpclibZSimpleXMLRPCServerZhttplibZhtmlentitydefsZ HTMLParserZCookieZ cookielibZBaseHTTPServerztest.test_supportZcommandsZurlparseZ robotparserurllib2ZanydbmZ_abcollrxrangerangereduce functoolsinternsysunichrchrunicodestrlongint itertoolsizipzipimapmapifilterfilter ifilterfalse filterfalse izip_longest zip_longestUserDictIterableUserDict collectionsUserList UserStringwhichdb_socketfromfdsocket_multiprocessing Connectionmultiprocessing.connectionmultiprocessing.processProcessmultiprocessing.contextmultiprocessing.forkingPopenmultiprocessing.popen_forkurllibContentTooShortError urllib.error getproxies pathname2url quote_plusquote unquote_plusunquote url2pathname urlcleanup urlencodeurlopen urlretriever HTTPErrorURLErrorArithmeticErrorAssertionErrorAttributeError BaseException BufferError BytesWarningDeprecationWarningEOFErrorEnvironmentError ExceptionFloatingPointError FutureWarning GeneratorExitIOError ImportError ImportWarningIndentationError IndexErrorKeyErrorKeyboardInterrupt LookupError MemoryError NameErrorNotImplementedErrorOSError OverflowErrorPendingDeprecationWarningReferenceError RuntimeErrorRuntimeWarning StopIteration SyntaxError SyntaxWarning SystemError SystemExitTabError TypeErrorUnboundLocalErrorUnicodeDecodeErrorUnicodeEncodeError UnicodeErrorUnicodeTranslateErrorUnicodeWarning UserWarning ValueErrorWarningZeroDivisionError WindowsError exceptionsAuthenticationErrorBufferTooShort ProcessError TimeoutErrorZmultiprocessingccs|]\}}||fVqdS)N).0kvrr&/usr/lib64/python3.6/_compat_pickle.py srccs|]\}}||fVqdS)Nr)rrrrrrrspicklezxml.etree.ElementTreeio) ZcPickleZ _elementtree FileDialog SimpleDialogDocXMLRPCServerSimpleHTTPServer CGIHTTPServerr*r-r.r/StringIOZ cStringIObz2r)Z_bz2Z_dbm _functoolsZ_gdbm_pickle basestring StandardError _socketobject SocketTyperrLoadFileDialogSaveFileDialogr ServerHTMLDocrXMLRPCDocGeneratorDocXMLRPCRequestHandlerDocCGIXMLRPCRequestHandlerSimpleHTTPRequestHandlerrCGIHTTPRequestHandlerrBrokenPipeErrorChildProcessErrorConnectionAbortedErrorConnectionErrorConnectionRefusedErrorConnectionResetErrorFileExistsErrorFileNotFoundErrorInterruptedErrorIsADirectoryErrorNotADirectoryErrorPermissionErrorProcessLookupErrorModuleNotFoundErrorN)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr )rr!)rr")rr#)rr$)rr%)rr&)rr')rr()rr))r*r+)r,r*)r-r-)r,r-)r.r.)r,r.)r/r/)r r/)r0r1)r2r1)r3r4)r5r4)r6r7)r8r7)r9r:)r;r:)r<r=)r>r=)r<r?)r r?)r<r@)r r@)r<rA)r rA)r<rB)r rB)r<rC)r rC)r<rD)r rD)r<rE)r rE)r<rF)r rF)r<rG)r rG)r<rH)r rH)r<rI)r rI)rrJ)r>rJ)rrK)r>rK)/rLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrz)r{)r}r~rr)rr)rr)r|r)rrU)r*r*)r,r*)r2r)r2r)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)r r)rr)r r)rr)r0r2)r2r)rrrrrrrrrrrrrr)r|rd)r)r|rZ)ZIMPORT_MAPPINGZ NAME_MAPPINGZPYTHON2_EXCEPTIONSr{rbZexcnameZMULTIPROCESSING_EXCEPTIONSdictitemsZREVERSE_IMPORT_MAPPINGZREVERSE_NAME_MAPPINGupdateZPYTHON3_OSERROR_EXCEPTIONSZPYTHON3_IMPORTERROR_EXCEPTIONSrrrr s        macpath.cpython-36.opt-2.pyc000064400000010431152462730460011557 0ustar003 \S @s.dZdZdZdZdZdZdZdZddlZddl Tddl Z ddl Tdd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'g Z d(d)Z d*dZ d+d Zd,d Zd-d Zd.d Ze jje_d/d Zd0dZd1dZd2d3Zd4dZd5dZd6dZd7dZGd8d9d9eZd:dZd;dZd:z::. NzDev:Null)*normcaseisabsjoin splitdrivesplitsplitextbasenamedirname commonprefixgetsizegetmtimegetatimegetctimeislinkexistslexistsisdirisfile expanduser expandvarsnormpathabspathcurdirpardirseppathsepdefpathaltsepextsepdevnullrealpathsupports_unicode_filenamescCst|trdSdSdS)N:r) isinstancebytes)pathr*/usr/lib64/python3.6/macpath.py _get_colons r,cCs(t|ttfs tdj|jj|jS)Nz2normcase() argument must be str or bytes, not '{}')r'r(str TypeErrorformat __class____name__lower)r)r*r*r+r#s cCs t|}||ko|dd|kS)N)r,)scolonr*r*r+r*sc Gsyt|}|}|s"|dd|xl|D]d}| s:t|r@|}q(|dd|kr\|dd}||krl||}|dd|kr||}||}q(W|Stttfk rtjd|f|YnXdS)Nrr3r)r,rr.AttributeError BytesWarning genericpath_check_arg_types)r4pr5r)tr*r*r+r5s(   cCst|}||kr |dd|fSd}x0tt|D] }|||d|kr2|d}q2W|d|d||d}}|r||kr||}||fS)Nrr3)r,rangelen)r4r5colir)filer*r*r+r Ls  cCs.t|trtj|dtdStj|tttSdS)Nr&.)r'r(r9 _splitextr!rr")r;r*r*r+r \s cCs|dd|fS)Nrr*)r;r*r*r+r cscCs t|dS)Nr)r )r4r*r*r+r oscCs t|dS)Nr3)r )r4r*r*r+r pscCs*t|s dSt|}t|dko(|d S)NFr3)rr r>)r4 componentsr*r*r+ismountrsrFc Cs*yddl}|jj|ddSdSdS)NrrDF) Carbon.FileFileZResolveAliasFile)r4Carbonr*r*r+rxs c Cs(ytj|}Wntk r"dSXdS)NFT)oslstatOSError)r)str*r*r+rs cCs|S)Nr*)r)r*r*r+rscCs|S)Nr*)r)r*r*r+rsc@s eZdZdS) norm_errorN)r1 __module__ __qualname__r*r*r*r+rNsrNcCst|}||kr||S|j|}d}x`|t|dkr|| r|||dr||dkrr||d|d=|d}qtdq(|d}q(W|j|}|dd|krt|dkr||t|kr|dd}|S)Nr3z+Cannot use :: immediately after volume namerDr6r6)r,r r>rNr)r4r5compsr@r*r*r+rs      , cCs6t|s.t|trtj}ntj}t||}t|S)N)rr'r(rJgetcwdbgetcwdrr)r)cwdr*r*r+rs    cCst|}y ddl}Wntk r(|SX|s2|St|}|j|}|d|}xR|ddD]B}t||}y|jj|ddj}Wq^|jj k rYq^Xq^W|S)Nrr3) rrG ImportErrorr,r rrHZFSResolveAliasFileZ as_pathnameError)r)rIr5rEcr*r*r+r$s"     T)"rrr"rrr r!r#rJstatr9__all__r,rrrr r rC__doc__r r r rFrrrr ExceptionrNrrr$r%r*r*r*r+sJ         shutil.cpython-36.pyc000064400000074265152462730460010531 0ustar003 i}A@sdZddlZddlZddlZddlZddlZddlZyddlZ[dZWne k r^dZYnXyddl Z [ dZ Wne k rdZ YnXyddl Z [ dZ Wne k rdZ YnXyddlmZWne k rdZYnXyddlmZWne k r dZYnXddd d d d d ddddddddddddddddddgZGd ddeZGd!ddeZGd"ddeZGd#ddeZGd$d%d%eZGd&d'd'eZdd*dZd+d,Zdd-d.dZdd-d/d Zeed0rdd-d1d2Z nd3d2Z dd-d4d Z!dd-d5d Z"dd-d6d Z#d7dZ$dde#dfd8d Z%d9d:Z&d;d<Z'ej(ejej)ej*hej+ko~ej,ej-ko~ejej.kZ/dd=dZ0e/e0_1d>d?Z2e#fd@dZ3dAdBZ4dCdDZ5dEdFZ6ddHdIZ7ddJdKZ8dLe7dgdNfiZ9ere7dgdOfe9dP<e8gdQfe9dR<e re7dgdTfe9dU<e r0e7dgdWfe9dX<dYdZ:dd[dZ;d\dZd_d`Z?ddadZ@dbdZAdcddZBdedfZCddgdhdiZDdjgeDgdNfdkgeCgdQfdlZEerdmdngeDgdOfeEdP<e rdodpgeDgdTfeEdU<e rdqdrgeDgdWfeEdX<dsdtZFdddgdudZGeedvr\ejHdwejIdxdyZJdzeJjK_d{eJjL_d|eJjM_d}dwZNn2ejOd~krddlPZPejHdwejIdxdyZJddwZNdddZQdddZRejSejTBdfddZUdS)zUtility functions for copying and archiving files and directory trees. XXX The functions here don't copy the resource fork or other metadata on Mac. NTF)getpwnam)getgrnam copyfileobjcopyfilecopymodecopystatcopycopy2copytreemovermtreeErrorSpecialFileError ExecError make_archiveget_archive_formatsregister_archive_formatunregister_archive_formatget_unpack_formatsregister_unpack_formatunregister_unpack_formatunpack_archiveignore_patternschownwhichget_terminal_size SameFileErrorc@s eZdZdS)r N)__name__ __module__ __qualname__r r /usr/lib64/python3.6/shutil.pyr 7sc@seZdZdZdS)rz5Raised when source and destination are the same file.N)rrr__doc__r r r r!r:sc@seZdZdZdS)rz|Raised when trying to do a kind of operation (e.g. copying) which is not supported on a special file (e.g. a named pipe)N)rrrr"r r r r!r=sc@seZdZdZdS)rz+Raised when a command could not be executedN)rrrr"r r r r!rAsc@seZdZdZdS) ReadErrorz%Raised when an archive cannot be readN)rrrr"r r r r!r#Dsr#c@seZdZdZdS) RegistryErrorzVRaised when a registry operation with the archiving and unpacking registries failsN)rrrr"r r r r!r$Gsr$icCs$x|j|}|sP|j|qWdS)z=copy data from file-like object fsrc to file-like object fdstN)readwrite)fsrcfdstZlengthZbufr r r!rLs  c CsXttjdr0ytjj||Stk r.dSXtjjtjj|tjjtjj|kS)NsamefileF)hasattrospathr*OSErrornormcaseabspath)srcdstr r r! _samefileTs r3)follow_symlinkscCst||rtdj||xL||gD]@}ytj|}Wntk rJYq$Xtj|jr$td|q$W| rtj j |rtj tj ||n6t |d&}t |d}t||WdQRXWdQRX|S)zCopy data from src to dst. If follow_symlinks is not set and src is a symbolic link, a new symlink will be created instead of copying the file it points to. z{!r} and {!r} are the same filez`%s` is a named piperbwbN)r3rformatr,statr.S_ISFIFOst_moderr-islinksymlinkreadlinkopenr)r1r2r4fnstr(r)r r r!r`s    cCsz| r>tjj|r>tjj|r>ttdr8tjtj}}q\dSnttdrXtjtj}}ndS||}||tj|j dS)zCopy mode bits from src to dst. If follow_symlinks is not set, symlinks aren't followed if and only if both `src` and `dst` are symlinks. If `lchmod` isn't available (e.g. Linux) this method does nothing. lchmodNchmod) r,r-r;r+lstatrAr8rBS_IMODEr:)r1r2r4Z stat_funcZ chmod_funcr@r r r!r}s   listxattrcCsytj||d}Wn4tk rF}z|jtjtjfkr8dSd}~XnXxn|D]f}y&tj|||d}tj||||dWqNtk r}z|jtjtjtjfkrWYdd}~XqNXqNWdS)zCopy extended filesystem attributes from `src` to `dst`. Overwrite existing attributes. If `follow_symlinks` is false, symlinks won't be followed. )r4N) r,rEr.errnoENOTSUPZENODATAgetxattrsetxattrZEPERM)r1r2r4namesenamevaluer r r! _copyxattrs  rNcOsdS)Nr )argskwargsr r r!rNsc s6ddddd|p,tjj|o*tjj| }|r@fdd}n fdd}|d||d }tj|j}|d ||j|jf|dy|d |||d Wntk rYnXt |d r$y|d ||j |d WnPt k r"}z2x*dD] }t t |r|j t t |krPqWWYdd}~XnXt|||d dS)aCopy file metadata Copy the permission bits, last access time, last modification time, and flags from `src` to `dst`. On Linux, copystat() also copies the "extended attributes" where possible. The file contents, owner, and group are unaffected. `src` and `dst` are path names given as strings. If the optional flag `follow_symlinks` is not set, symlinks aren't followed if and only if both `src` and `dst` are symlinks. N)nsr4cWsdS)Nr )rQr4rOr r r!_nopszcopystat.._nopcs tt|S)N)getattrr,)rL)rRr r!lookupszcopystat..lookupcstt|}|tjkr|SS)N)rSr,supports_follow_symlinks)rLr?)rRr r!rTs  r8)r4utimerBst_flagsZchflags EOPNOTSUPPrG)rXrG)r,r-r;r8rDr: st_atime_ns st_mtime_nsNotImplementedErrorr+rWr.rFrSrN) r1r2r4ZfollowrTr@modewhyerrr )rRr!rs,      cCsBtjj|r"tjj|tjj|}t|||dt|||d|S)a3Copy data and mode bits ("cp src dst"). Return the file's destination. The destination may be a directory. If follow_symlinks is false, symlinks won't be followed. This resembles GNU's "cp -P src dst". If source and destination are the same file, a SameFileError will be raised. )r4)r,r-isdirjoinbasenamerr)r1r2r4r r r!rs cCsBtjj|r"tjj|tjj|}t|||dt|||d|S)a1Copy data and metadata. Return the file's destination. Metadata is copied with copystat(). Please see the copystat function for more information. The destination may be a directory. If follow_symlinks is false, symlinks won't be followed. This resembles GNU's "cp -P src dst". )r4)r,r-r_r`rarr)r1r2r4r r r!r s csfdd}|S)zFunction that can be used as copytree() ignore parameter. Patterns is a sequence of glob-style patterns that are used to exclude filescs,g}xD]}|jtj||q Wt|S)N)extendfnmatchfilterset)r-rJ ignored_namespattern)patternsr r!_ignore_patternss z)ignore_patterns.._ignore_patternsr )rhrir )rhr!r s cCstj|}|dk r|||}nt}tj|g}xB|D]8} | |krJq:tjj|| } tjj|| } ytjj| rtj| } |rtj| | t | | | dn ignored_names Since copytree() is called recursively, the callable will be called once for each directory that is copied. It returns a list of names relative to the `src` directory that should not be copied. The optional copy_function argument is a callable that will be used to copy each file. It will be called with the source path and the destination path as arguments. By default, copy2() is used, but any function that supports the same signature (like copy()) can be used. N)r4rZwinerror)r,listdirremakedirsr-r`r;r=r<rexistsr_r r rbrOr.appendstrrS)r1r2symlinksignore copy_functionZignore_dangling_symlinksrJrferrorsrLZsrcnameZdstnamelinktor^r]r r r!r sL$           *&c$CsLytjj|rtdWn(tk r@|tjj|tjdSXg}ytj|}Wn&tk rz|tj|tjYnXx|D]}tjj||}ytj|j }Wntk rd}YnXt j |rt ||qytj |Wqtk r |tj |tjYqXqWytj|Wn(tk rF|tj|tjYnXdS)Nz%Cannot call rmtree on a symbolic linkr)r,r-r;r.sysexc_inforjr`rCr:r8S_ISDIR_rmtree_unsafeunlinkrmdir)r-onerrorrJrLfullnamer\r r r!rwqs6      rwc 0Csg}ytj|}Wn:tk rL}z||_|tj|tjWYdd}~XnXx|D]x}tjj||}ytj||dd}|j }Wntk rd}YnXtj |rytj |tj |d} Wn&tk r|tj |tjYnXztjj |tj| rJt| ||ytj||dWn(tk rF|tj|tjYnXn8y tdWn*tk r|tjj|tjYnXWdtj| XqVytj||dWqVtk r|tj|tjYqVXqVWdS)NF)dir_fdr4r)r|z%Cannot call rmtree on a symbolic link)r,rjr.filenamertrur-r`r8r:rvr>O_RDONLYsamestatfstat_rmtree_safe_fdryr;closerx) topfdr-rzrJr^rLr{orig_str\dirfdr r r!rsD$     rc!Cs^|rdd}n|dkrdd}trPt|tr8tj|}ytj|}Wn&tk rl|tj|tjdSXytj |tj }Wn&tk r|tj|tjdSXztj j |tj |rt|||ytj|Wn(tk r|tj|tjYnXn8y tdWn*tk r<|tj j|tjYnXWdtj|Xn t||SdS)aRecursively delete a directory tree. If ignore_errors is set, errors are ignored; otherwise, if onerror is set, it is called to handle the error with arguments (func, path, exc_info) where func is platform and implementation dependent; path is the argument to that function that caused it to fail; and exc_info is a tuple returned by sys.exc_info(). If ignore_errors is false and onerror is None, an exception is raised. cWsdS)Nr )rOr r r!rzszrmtree..onerrorNcWsdS)Nr )rOr r r!rzsz%Cannot call rmtree on a symbolic link)_use_fd_functions isinstancebytesr,fsdecoderC Exceptionrtrur>r~r-rrrryr.r;rrw)r- ignore_errorsrzrfdr r r!r s<      cCs&tjjtjjpd}tjj|j|S)N)r,r-sepaltseprarstrip)r-rr r r! _basenamesrc Cs|}tjj|rTt||r*tj||dStjj|t|}tjj|rTtd|ytj||Wnt k rtjj |rtj |}tj ||tj |nTtjj|rt||rtd||ft|||ddt|n|||tj |YnX|S)a+Recursively move a file or directory to another location. This is similar to the Unix "mv" command. Return the file or directory's destination. If the destination is a directory or a symlink to a directory, the source is moved inside the directory. The destination path must not already exist. If the destination already exists but is not a directory, it may be overwritten depending on os.rename() semantics. If the destination is on our current filesystem, then rename() is used. Otherwise, src is copied to the destination and then removed. Symlinks are recreated under the new name if os.rename() fails because of cross filesystem renames. The optional `copy_function` argument is a callable that will be used to copy the source or it will be delegated to `copytree`. By default, copy2() is used, but any function that supports the same signature (like copy()) can be used. A lot more could be done here... A look at a mv.c shows a lot of the issues this implementation glosses over. Nz$Destination path '%s' already existsz.Cannot move a directory '%s' into itself '%s'.T)rqro)r,r-r_r3renamer`rrlr r.r;r=r<rx _destinsrcr r )r1r2rqZreal_dstrsr r r!r s2              cCsVtjj|}tjj|}|jtjjs2|tjj7}|jtjjsL|tjj7}|j|S)N)r,r-r0endswithr startswith)r1r2r r r!r8s    rc CsNtdks|dkrdSy t|}Wntk r8d}YnX|dk rJ|dSdS)z"Returns a gid, given a group name.N)rKeyError)rLresultr r r!_get_gidAs  rc CsNtdks|dkrdSy t|}Wntk r8d}YnX|dk rJ|dSdS)z"Returns an uid, given a user name.Nr)rr)rLrr r r!_get_uidMs  rgzipc s"|dkrd}nDtr |dkr d}n2tr2|dkr2d}n trD|dkrDd}ntdj|d dl} |rfd |nd} |d | } tjj| } | rtjj |  r|dk r|j d | |stj | |dk r|j d t t fdd} |s| j| d|}z|j|| dWd|jX| S)aCreate a (possibly compressed) tar file from all the files under 'base_dir'. 'compress' must be "gzip" (the default), "bzip2", "xz", or None. 'owner' and 'group' can be used to define an owner and a group for the archive that is being built. If not provided, the current owner and group will be used. The output tar file will be named 'base_name' + ".tar", possibly plus the appropriate compression extension (".gz", ".bz2", or ".xz"). Returns the output filename. NrrZgzbzip2bz2xzzCbad value for 'compress', or compression format not supported : {0}r.z.tarz creating %szCreating tar archivecs,dk r|_|_dk r(|_|_|S)N)gidZgnameuiduname)Ztarinfo)rgroupownerrr r! _set_uid_gidsz#_make_tarball.._set_uid_gidzw|%s)rd)_ZLIB_SUPPORTED_BZ2_SUPPORTED_LZMA_SUPPORTED ValueErrorr7tarfiler,r-dirnamerlinforkrrr>addr) base_namebase_dircompressverbosedry_runrrloggerZtar_compressionrZ compress_extZ archive_name archive_dirrtarr )rrrrr! _make_tarballYs<          rc Cs|ddl}|d}tjj|}|rPtjj| rP|dk rB|jd||sPtj||dk rf|jd|||sx|j|d|jd}tjj |} | tj kr|j | | |dk r|jd| xtj |D]\} } } xFt | D]:} tjj tjj| | } |j | | |dk r|jd| qWxT| D]L} tjj tjj| | } tjj| r|j | | |dk r|jd| qWqWWdQRX|S) zCreate a zip file from all the files under 'base_dir'. The output zip file will be named 'base_name' + ".zip". Returns the name of the output zip file. rNz.zipz creating %sz#creating '%s' and adding '%s' to itw)Z compressionz adding '%s')zipfiler,r-rrlrrkZipFileZ ZIP_DEFLATEDnormpathcurdirr'walksortedr`isfile)rrrrrrZ zip_filenamerZzfr-dirpathZdirnames filenamesrLr r r! _make_zipfiles@             rrrzuncompressed tar filezgzip'ed tar-fileZgztarzZIP fileziprzbzip2'ed tar-fileZbztarrzxz'ed tar-fileZxztarcCsddtjD}|j|S)zReturns a list of supported formats for archiving and unarchiving. Each element of the returned sequence is a tuple (name, description) cSsg|]\}}||dfqS)rr ).0rLregistryr r r! sz'get_archive_formats..)_ARCHIVE_FORMATSitemssort)formatsr r r!rs rcCsz|dkr g}t|s td|t|ttfs6tdx0|D](}t|ttf s\t|dkr|dk r$|jd|tjj|}|s>tj||dkrLtj}||d} y t|} Wn tk rt d|YnX| d} x| dD]\} }|| | <qW|dkr|| d<|| d <z| ||f| }Wd|dk r|dk r|jd | tj| X|S) aCreate an archive file (eg. zip or tar). 'base_name' is the name of the file to create, minus any format-specific extension; 'format' is the archive format: one of "zip", "tar", "gztar", "bztar", or "xztar". Or any other registered format. 'root_dir' is a directory that will be the root directory of the archive; ie. we typically chdir into 'root_dir' before creating the archive. 'base_dir' is the directory where we start archiving from; ie. 'base_dir' will be the common prefix of all files and directories in the archive. 'root_dir' and 'base_dir' both default to the current directory. Returns the name of the archive file. 'owner' and 'group' are used when creating a tar archive. By default, uses the current owner and group. Nzchanging into '%s')rrzunknown archive format '%s'rrrrzchanging back to '%s') r,getcwddebugr-r0chdirrrrr)rr7Zroot_dirrrrrrrZsave_cwdrP format_infofuncargvalr}r r r!rs6        cCsddtjD}|j|S)zReturns a list of supported formats for unpacking. Each element of the returned sequence is a tuple (name, extensions, description) cSs"g|]\}}||d|dfqS)rr )rrLrr r r!r6sz&get_unpack_formats..)_UNPACK_FORMATSrr)rr r r!r0s c Csvi}x.tjD]"\}}x|dD] }|||<q WqWx,|D]$}||kr:d}t||||fq:Wt|srtddS)z+Checks what gets registered as an unpacker.rz!%s is already registered for "%s"z*The registered function must be a callableN)rrr$rr) extensionsrrZexisting_extensionsrLrext extensionmsgr r r!_check_unpack_options;s rcCs,|dkr g}t|||||||ft|<dS)aMRegisters an unpack format. `name` is the name of the format. `extensions` is a list of extensions corresponding to the format. `function` is the callable that will be used to unpack archives. The callable will receive archives to unpack. If it's unable to handle an archive, it needs to raise a ReadError exception. If provided, `extra_args` is a sequence of (name, value) tuples that will be passed as arguments to the callable. description can be provided to describe the format, and will be returned by the get_unpack_formats() function. N)rr)rLrrrrr r r!rMs cCs t|=dS)z*Removes the pack format from the registry.N)r)rLr r r!rcscCs&tjj|}tjj|s"tj|dS)z1Ensure that the parent directory of `path` existsN)r,r-rr_rk)r-rr r r!_ensure_directorygs  rc Csddl}|j|std||j|}zx|jD]}|j}|jds4d|krRq4tjj |f|j d}|spq4t ||j ds4|j |j}t|d}z|j|Wd|j~Xq4WWd|jXdS)z+Unpack zip `filename` to `extract_dir` rNz%s is not a zip file/z..r6)rZ is_zipfiler#rZinfolistr}rr,r-r`splitrrr&r>r'r) r} extract_dirrrrrLtargetdatafr r r!_unpack_zipfilems*       r)rdcCs\ddl}y|j|}Wn"|jk r8td|YnXz|j||dWd|jXdS)zAUnpack tar/tar.gz/tar.bz2/tar.xz `filename` to `extract_dir` rNz/%s is not a compressed or uncompressed tar file)rd)rr>ZTarErrorr#Z extractallr)r}rrdrZtarobjr r r!_unpack_tarfilesrz.tarz.zip)rrz.tar.gzz.tgzz.tar.bz2z.tbz2z.tar.xzz.txzcCs:x4tjD](\}}x|dD]}|j|r|SqWq WdS)Nr)rrr)r}rLrrr r r!_find_unpack_formats   rc Cs|dkrtj}|dkri}nd|i}|dk ry t|}Wn"tk r\tdj|YnX|d}|||ft|d|nRt|}|dkrtdj|t|d}tt|d}|j ||||f|dS)a]Unpack an archive. `filename` is the name of the archive. `extract_dir` is the name of the target directory, where the archive is unpacked. If not provided, the current working directory is used. `format` is the archive format: one of "zip", "tar", "gztar", "bztar", or "xztar". Or any other registered format. If not provided, unpack_archive will use the filename extension and see if an unpacker was registered for that extension. In case none is found, a ValueError is raised. If `filter` is given, it is passed to the underlying extraction function. NrdzUnknown unpack format '{0}'rrzUnknown archive format '{0}') r,rrrrr7dictrr#update)r}rr7rdZ filter_kwargsrrrPr r r!rs&   statvfs disk_usageZusageztotal used freezTotal space in byteszUsed space in byteszFree space in bytescCs@tj|}|j|j}|j|j}|j|j|j}t|||S)zReturn disk usage statistics about the given path. Returned value is a named tuple with attributes 'total', 'used' and 'free', which are the amount of total, used and free space, in bytes. )r,rf_bavailf_frsizef_blocksf_bfree_ntuple_diskusage)r-r@freetotalusedr r r!rs    ntcCs"tj|\}}||}t|||S)zReturn disk usage statistics about the given path. Returned values is a named tuple with attributes 'total', 'used' and 'free', which are the amount of total, used and free space, in bytes. )rZ _getdiskusager)r-rrrr r r!rscCs|dkr|dkrtd|}|}|dkr.d}n(t|trVt|}|dkrVtdj||dkrdd}n(t|tst|}|dkrtdj|tj |||dS)zChange owner user and group of the given path. user and group can be the uid/gid or the user/group names, and in that case, they are converted to their respective uid/gid. Nzuser and/or group must be setrzno such user: {!r}zno such group: {!r}r) rrrnr LookupErrorr7intrr,r)r-userrZ_userZ_groupr r r!r s"  PcCsyttjd}Wnttfk r.d}YnXyttjd}Wnttfk r^d}YnX|dksp|dkrytjtjj}Wn$t tt fk rtj |}YnX|dkr|j }|dkr|j }tj ||fS)aGet the size of the terminal window. For each of the two dimensions, the environment variable, COLUMNS and LINES respectively, is checked. If the variable is defined and the value is a positive integer, it is used. When COLUMNS or LINES is not defined, which is the common case, the terminal connected to sys.__stdout__ is queried by invoking os.get_terminal_size. If the terminal size cannot be successfully queried, either because the system doesn't support querying, or because we are not connected to a terminal, the value given in fallback parameter is used. Fallback defaults to (80, 24) which is the default size used by many terminal emulators. The value returned is a named tuple of type os.terminal_size. ZCOLUMNSrZLINES)rr,environrrrrt __stdout__filenoAttributeErrorr. terminal_sizecolumnslines)Zfallbackrrsizer r r!r(s$  c s"dd}tjjr&||r"SdS|dkr>tjjdtj}|sFdS|jtj}tj dkrtj |krt|j dtj tjjddjtj}t fd d |Drg}q‡fd d |D}ng}t }xT|D]L}tjj|}||kr|j|x(|D] } tjj|| } || |r| SqWqWdS) a3Given a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file. `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or can be overridden with a custom search path. cSs&tjj|o$tj||o$tjj| S)N)r,r-rlaccessr_)r?r\r r r! _access_checkbszwhich.._access_checkNPATHZwin32rZPATHEXTrc3s |]}jj|jVqdS)N)lowerr)rr)cmdr r! szwhich..csg|] }|qSr r )rr)r r r!rszwhich..)r,r-rrgetdefpathrpathseprtplatformrinsertanyrer/rr`) r r\r-rZpathextfilesseendirZnormdirZthefilerLr )r r!rUs8            @)r)FN)rrrNNN)rrN)rN)rr)rr)rr)Nr)NNrrNNN)Nr)NN)NNrr)r)Vr"r,rtr8rc collectionsrFzlibr ImportErrorrrZlzmarpwdrZgrpr__all__r.r rrrr#rr$rr3rrr+rNrrr rr rwrr>rxrysupports_dir_fdrj supports_fdrUrr Zavoids_symlink_attacksrr rrrrrrrrrrrrrrrrrrrrrm namedtuplerrrrrrLrrrF_OKX_OKrr r r r!s          :  Y!,   5 8    @ -     6  "       /        -keyword.cpython-36.pyc000064400000003347152462730460010676 0ustar003 \!@svdZddgZddddddd d d d d ddddddddddddddddddd d!d"d#g!ZeejZd$d%Zed&krred'S)(zKeywords (from "graminit.c") This file is automatically generated; please don't muck it up! To update the symbols in this file, 'cd' to the top directory of the python source tree after building the interpreter and run: ./python Lib/keyword.py iskeywordkwlistFalseNoneTrueandasassertbreakclasscontinuedefdelelifelseexceptfinallyforfromglobalifimportinislambdanonlocalnotorpassraisereturntrywhilewithyieldcCs|ddl}ddl}|jdd}|r*|dp,d}t|dkrD|d}nd}t|dd}|j}WdQRX|r|dt|djdnd}t|T}|jd}g} x>|D]6} d | kr|j| } | r| j d | j dd |qWWdQRX| j y0|j d |d} |j d |} | || | <Wn,t k rR|jjd|jdYnXt|ddd}|j|WdQRXdS)NzPython/graminit.czLib/keyword.py)newline z "([^"]+)"z{1, "z 'z',z#--start keywords--z#--end keywords--z'target does not contain format markers w)sysreargvlenopen readlinesstripcompilesearchappendgroupsortindex ValueErrorstderrwriteexit writelines)r*r+argsiptfileoptfilefpformatnlstrproglineslinematchstartendrH/usr/lib64/python3.6/keyword.pymain7s6 $    * rJ__main__N)__doc____all__r frozenset __contains__rrJ__name__rHrHrHrI sL &numbers.cpython-36.opt-2.pyc000064400000017767152462730460011640 0ustar003 \(@sddlmZmZdddddgZGdddedZGd ddeZejeGd ddeZeje Gd ddeZ Gd dde Z e je d S))ABCMetaabstractmethodNumberComplexRealRationalIntegralc@seZdZfZdZdS)rN)__name__ __module__ __qualname__ __slots____hash__rr/usr/lib64/python3.6/numbers.pyr s) metaclassc@seZdZfZeddZddZeeddZeeddZ ed d Z ed d Z ed dZ eddZ ddZddZeddZeddZeddZeddZeddZedd Zed!d"Zed#d$Zed%d&Zd'S)(rcCsdS)Nr)selfrrr __complex__-szComplex.__complex__cCs|dkS)Nrr)rrrr__bool__1szComplex.__bool__cCstdS)N)NotImplementedError)rrrrreal5sz Complex.realcCstdS)N)r)rrrrimag>sz Complex.imagcCstdS)N)r)rotherrrr__add__GszComplex.__add__cCstdS)N)r)rrrrr__radd__LszComplex.__radd__cCstdS)N)r)rrrr__neg__QszComplex.__neg__cCstdS)N)r)rrrr__pos__VszComplex.__pos__cCs || S)Nr)rrrrr__sub__[szComplex.__sub__cCs | |S)Nr)rrrrr__rsub___szComplex.__rsub__cCstdS)N)r)rrrrr__mul__cszComplex.__mul__cCstdS)N)r)rrrrr__rmul__hszComplex.__rmul__cCstdS)N)r)rrrrr __truediv__mszComplex.__truediv__cCstdS)N)r)rrrrr __rtruediv__rszComplex.__rtruediv__cCstdS)N)r)rexponentrrr__pow__wszComplex.__pow__cCstdS)N)r)rbaserrr__rpow__|szComplex.__rpow__cCstdS)N)r)rrrr__abs__szComplex.__abs__cCstdS)N)r)rrrr conjugateszComplex.conjugatecCstdS)N)r)rrrrr__eq__szComplex.__eq__N)r r r r rrrpropertyrrrrrrrrrrr r!r#r%r&r'r(rrrrr s,              c@seZdZfZeddZeddZeddZeddZed$d d Z d d Z ddZ eddZ eddZ eddZeddZeddZeddZddZeddZed d!Zd"d#Zd S)%rcCstdS)N)r)rrrr __float__szReal.__float__cCstdS)N)r)rrrr __trunc__s zReal.__trunc__cCstdS)N)r)rrrr __floor__szReal.__floor__cCstdS)N)r)rrrr__ceil__sz Real.__ceil__NcCstdS)N)r)rZndigitsrrr __round__szReal.__round__cCs||||fS)Nr)rrrrr __divmod__szReal.__divmod__cCs||||fS)Nr)rrrrr __rdivmod__szReal.__rdivmod__cCstdS)N)r)rrrrr __floordiv__szReal.__floordiv__cCstdS)N)r)rrrrr __rfloordiv__szReal.__rfloordiv__cCstdS)N)r)rrrrr__mod__sz Real.__mod__cCstdS)N)r)rrrrr__rmod__sz Real.__rmod__cCstdS)N)r)rrrrr__lt__sz Real.__lt__cCstdS)N)r)rrrrr__le__sz Real.__le__cCs tt|S)N)complexfloat)rrrrrszReal.__complex__cCs| S)Nr)rrrrrsz Real.realcCsdS)Nrr)rrrrrsz Real.imagcCs| S)Nr)rrrrr'szReal.conjugate)N)r r r r rr*r+r,r-r.r/r0r1r2r3r4r5r6rr)rrr'rrrrrs&             c@s8eZdZfZeeddZeeddZddZdS)rcCstdS)N)r)rrrr numeratorszRational.numeratorcCstdS)N)r)rrrr denominatorszRational.denominatorcCs |j|jS)N)r9r:)rrrrr*szRational.__float__N) r r r r r)rr9r:r*rrrrr s c@seZdZfZeddZddZed$ddZedd Zed d Z ed d Z eddZ eddZ eddZ eddZeddZeddZeddZeddZddZed d!Zed"d#ZdS)%rcCstdS)N)r)rrrr__int__+szIntegral.__int__cCst|S)N)int)rrrr __index__0szIntegral.__index__NcCstdS)N)r)rr"modulusrrrr#4s zIntegral.__pow__cCstdS)N)r)rrrrr __lshift__?szIntegral.__lshift__cCstdS)N)r)rrrrr __rlshift__DszIntegral.__rlshift__cCstdS)N)r)rrrrr __rshift__IszIntegral.__rshift__cCstdS)N)r)rrrrr __rrshift__NszIntegral.__rrshift__cCstdS)N)r)rrrrr__and__SszIntegral.__and__cCstdS)N)r)rrrrr__rand__XszIntegral.__rand__cCstdS)N)r)rrrrr__xor__]szIntegral.__xor__cCstdS)N)r)rrrrr__rxor__bszIntegral.__rxor__cCstdS)N)r)rrrrr__or__gszIntegral.__or__cCstdS)N)r)rrrrr__ror__lszIntegral.__ror__cCstdS)N)r)rrrr __invert__qszIntegral.__invert__cCs tt|S)N)r8r<)rrrrr*wszIntegral.__float__cCs| S)Nr)rrrrr9{szIntegral.numeratorcCsdS)Nr)rrrrr:szIntegral.denominator)N)r r r r rr;r=r#r?r@rArBrCrDrErFrGrHrIr*r)r9r:rrrrr&s&             N) abcrr__all__rrregisterr7rr8rrr<rrrrsp u _pprint.cpython-36.opt-1.pyc000064400000036633152462730460011471 0ustar003 \|Q @sdZddlZddlZddlZddlZddlm Z dddddd gZ d!d d ddZ d"d d ddZ ddZddZddZGdddZddZGdd d ZddZeeeeeeeeedhZddZd#ddZ ddZ!e"d kre dS)$a/Support to pretty-print lists, tuples, & dictionaries recursively. Very simple, but useful, especially in debugging data structures. Classes ------- PrettyPrinter() Handle pretty-printing operations onto a stream using a configured set of formatting parameters. Functions --------- pformat() Format a Python object into a pretty-printed representation. pprint() Pretty-print a Python object to a stream [default is sys.stdout]. saferepr() Generate a 'standard' repr()-like value, but protect against recursive data structures. N)StringIOpprintpformat isreadable isrecursivesaferepr PrettyPrinterPF)compactcCs t|||||d}|j|dS)zAPretty-print a Python object to a stream [default is sys.stdout].)streamindentwidthdepthr N)rr)objectr r rrr Zprinterr/usr/lib64/python3.6/pprint.pyr/scCst||||dj|S)z= 0Nzdepth must be > 0zwidth must be != 0) int ValueError_depth_indent_per_level_width_stream_sysstdoutbool_compact)rr rrr r rrrrcszPrettyPrinter.__init__cCs&|j||jddid|jjddS)Nr )_formatr+write)rrrrrrszPrettyPrinter.pprintcCs"t}|j||ddid|jS)Nr) _StringIOr1getvalue)rrZsiorrrrszPrettyPrinter.pformatcCs|j|idddS)Nrr)format)rrrrrrszPrettyPrinter.isrecursivecCs |j|idd\}}}|o| S)Nr)r5)rrsreadable recursiverrrrszPrettyPrinter.isreadablec Cst|}||kr.|jt|d|_d|_dS|j|||}|j||} t|| kr|jj t |j d} | dk rd||<| |||||||d||=dSt |t rd||<|j||||||d||=dS|j|dS)NTFr )rr2 _recursion _recursive _readable_reprr*len _dispatchgetr__repr__ isinstancedict _pprint_dict) rrr r allowancecontextlevelobjidrep max_widthprrrr1s,    zPrettyPrinter._formatc Csj|j}|d|jdkr*||jddt|}|r^t|jtd} |j| |||d|||ddS)N{r  )key})r2r)r=sorteditemsr%_format_dict_items) rrr r rDrErFr2ZlengthrPrrrrCs zPrettyPrinter._pprint_dictcCslt|s|jt|dS|j}|j|jd|jt|j||t|jd|d|||jddS)N(r ))r=r2repr __class__rr1listrP)rrr r rDrErFclsrrr_pprint_ordered_dictsz"PrettyPrinter._pprint_ordered_dictcCs0|jd|j||||d|||jddS)N[r ])r2 _format_items)rrr r rDrErFrrr _pprint_lists zPrettyPrinter._pprint_listcCsH|jdt|dkrdnd}|j||||t||||j|dS)NrRr z,)rS)r2r=r[)rrr r rDrErFendcharrrr _pprint_tuples  zPrettyPrinter._pprint_tuplec Cst|s|jt|dS|j}|tkr8|jdd}n&|j|jdd}|t|jd7}t|td}|j||||t||||j|dS)NrKrNz({z})r )rM) r=r2rTrUsetrrOrr[) rrr r rDrErFtypr]rrr _pprint_sets  zPrettyPrinter._pprint_setcCs|j}t|s|t|dSg}|jd} |dkrD|d7}|d7}|j|} } xt| D]\} } t| }| t| dkr| |8} t|| kr|j|q\tjd| }|j | }d}xtt|D]h\}}||}|t|dkr| t| dkr||8}tt||kr&|r |jt||}q|}qW|r\|jt|q\Wt|dkr^||dS|dkrp|dx8t|D],\} }| dkr|dd|||qzW|dkr|d dS) NTr z\S*\s*rRrr0rLrS) r2r=rT splitlinesr* enumerateappendrefindallpop)rrr r rDrErFr2ZchunkslinesZ max_width1rIilinerHpartsZ max_width2currentjpart candidaterrr _pprint_strsT         zPrettyPrinter._pprint_strc Cs|j}t|dkr"|t|dS|dk}|rF|d7}|d7}|dd} x:t||j||D]$} || || | s^dd|} q^W|r|ddS)Nr rRrbr0rLrS)r2r=rT_wrap_bytes_reprr*) rrr r rDrErFr2ZparensdelimrHrrr _pprint_bytes's"  zPrettyPrinter._pprint_bytescCs>|j}|d|jt|||d|d||d|ddS)Nz bytearray( r rS)r2rubytes)rrr r rDrErFr2rrr_pprint_bytearray<s zPrettyPrinter._pprint_bytearraycCs8|jd|j|j||d|d|||jddS)Nz mappingproxy( r rS)r2r1copy)rrr r rDrErFrrr_pprint_mappingproxyEs z"PrettyPrinter._pprint_mappingproxycCs|j}||j7}dd|}t|d} xrt|D]f\} \} } | | k} |j| ||}|||d|j| ||t|d| r|nd||| s2||q2WdS)Nz, rLr z: r)r2r)r=rdr<r1)rrPr r rDrErFr2delimnlZ last_indexrjrMentlastrHrrrrQMs    z PrettyPrinter._format_dict_itemscCsN|j}||j7}|jdkr,||jdddd|}d} |j|d} } t|} y t| } Wntk rvdSXd}x|sH| }y t| } Wn(tk rd}| |8} | |8} YnX|jr|j|||}t|d}| |kr| } | r|} | |kr| |8} || d} ||q~|| |} |j ||||r<|nd||q~WdS) Nr rLz, rbFTrz, ) r2r)r*iternext StopIterationr/r<r=r1)rrPr r rDrErFr2r|rtrrIitZnext_entr~r}rHwrrrr[^sN         zPrettyPrinter._format_itemscCs4|j||j|j|\}}}|s&d|_|r0d|_|S)NFT)r5rzr(r;r:)rrrErFrTr7r8rrrr<s zPrettyPrinter._reprcCst||||S)zFormat object for a specific context, returning a string and flags indicating whether the representation is 'readable' and whether the object represents a recursive construct. )r)rrrE maxlevelsrFrrrr5szPrettyPrinter.formatc Cst|s|jt|dS|j|j||}|j}|t|jd7}|jd|j|d|f|j||||d|||jddS)Nr z %s(%s, %srLrS)r=r2rTr<default_factoryrUrrC) rrr r rDrErFZrdfrWrrr_pprint_default_dictsz"PrettyPrinter._pprint_default_dictc Cst|s|jt|dS|j}|j|jd|jdkrN|j|jdd|j}|j|||t|jd|d|||jddS)Nz({r rLrz}))r=r2rTrUrr) most_commonrQ) rrr r rDrErFrWrPrrr_pprint_counters zPrettyPrinter._pprint_counterc Cst|js|jt|dS|j}|j|jd|t|jd7}xrt|jD]d\}} |t|jdkr|j| |||d|||jdqP|j| ||d|||jdd|qPWdS)NrRr rSz, rL)r=mapsr2rTrUrrdr1) rrr r rDrErFrWrjmrrr_pprint_chain_maps  zPrettyPrinter._pprint_chain_mapc Cst|s|jt|dS|j}|j|jd|t|jd7}|jd|jdkrz|j||||d|||jdn:|j|||d|||j|j||}|jdd||fdS)NrRr rYrz])z], %smaxlen=%s)rL)r=r2rTrUrmaxlenr[r<) rrr r rDrErFrWZrmlrrr _pprint_deques    zPrettyPrinter._pprint_dequecCs|j|j|||||ddS)Nr )r1data)rrr r rDrErFrrr_pprint_user_dictszPrettyPrinter._pprint_user_dictcCs|j|j|||||ddS)Nr )r1r)rrr r rDrErFrrr_pprint_user_listszPrettyPrinter._pprint_user_listcCs|j|j|||||ddS)Nr )r1r)rrr r rDrErFrrr_pprint_user_stringsz!PrettyPrinter._pprint_user_string)r r NN)2rr r!rrrrrr1r>rCrBr@rX _collections OrderedDictr\rVr^tuplerar_ frozensetrqrrurwrx bytearrayr{_typesMappingProxyTyperQr[r<r5r defaultdictrCounterrChainMaprdequerUserDictrUserListr UserStringrrrrrbsZ&      1    )       cCst|}|tkrt|ddfSt|dd}t|to<|tjkr8|sHdSt|}|rj||krjdd||kfS||krt|ddfSd||<d}d}g} | j } |d7}t } t |j t d} xf| D]^\} }| | |||\}}}| ||||\}}}| d||f|o |o |}|s|rd}qW||=d d j| ||fSt|trP|tjksht|trd|tjkrdt|tr|s~dSd }n"t|dkrd }n|sdSd}t|}|r||kr|dd||kfS||krt|ddfSd||<d}d}g} | j } |d7}x>|D]6}t ||||\}}}| ||s:d}|rd}qW||=|d j| ||fSt|}||o~|jd dfS)NTFr@{}z{...}r )rMz%s: %sz{%s}z, []z[%s]z(%s,)()z(%s)z...<)rTF)rTF)rTF)r_builtin_scalarsrTgetattr issubclassrBr@rr9rerrOrPr%joinrVrr= startswith)rrErrFr`rrGr7r8Z componentsrerrPkvZkreprZ kreadableZkrecurZvreprZ vreadableZvrecurr5oZoreprZ oreadableZorecurrHrrrrs|       rcCsdt|jt|fS)Nz)rrr)rrrrr91sr9cCsddl}|dkr,dd ddgddd fgd }t}|j}t|idd|j}|j||j}td ||td ||dS)Nrstringr rrr)iz _safe_repr:zpformat:)r r)timerrrprint)rrrJZt1Zt2Zt3rrr _perfcheck6s rccsd}t|dd}xhtdt|dD]T}|||d}||}||krR||8}tt||krv|rpt|V|}q&|}q&W|rt|VdS)Nrrr)r=rangerT)rrrDrmr~rjrorprrrrsCs rs__main__)Nr r N)r r N)N)#r" collectionsrrfsysr,typesriorr3__all__rrrrrrr%rrrrrwrr&floatcomplexr.rrr9rrsrrrrr#s6   D locale.cpython-36.opt-1.pyc000064400000102377152462730460011413 0ustar003 \-]@sdZddlZddlZddlZddlZddlZddlmZddl Z dddddd d d d d dddddddddddddgZ ddZ ddZ y ddl TWnLek rd Zd!Zd"ZdZd#Zd$Zd%Zd&ZeZd'd Zdd(dZYnXd ekre Zd ekre ZeZiZe j ed)d Zd*d+Z!dd-d.Z"d/d0Z#ej$d1Z%dd2dZ&dd3d4Z'dd5dZ(dd7dZ)d8d Zd9d:Z*e+fd;dZ,dZ.eZ/d?d@Z0dAdBZ1dCdZ2dDdEZ3dFdGZ4ddJdZ5efdKdZ6ddLdZefdMd Z7ej8j9dNr ddOdZ:n8ye;Wn"ee=j?D]"\Z@ZAe@jBdqdrZ@e=jCe@eAqWdsdsdsdtdudvdwdwdxdydzdzd{d|d}d~d~dddddddddddddddddddd~ddddddddddddddddddddddddddddddddddddRddRdRd{ddRdRddddddddd{ddddddddddddddddddddddddddddddddddddddddddd{ddddddddddddddddddd{dddddddd{dd{dRd{dddddddddddddddddddddddddddd̐dddddddddddddd d d d dd d d d d d d d dddddddddddddddddd͐dddddddddddddddddddd d d d!d"d#d$d%d&d&d'd(d&d&d%d%d{dd{dd{dd)d*d)d)d+d+d+ddd,d-d-d-d.d.d-d-d-d-d-d/d/d/d0d/d1d2d3d3d4d5d5d6d6d6d7d6d6d8d8d9d:d;d;d<d<d=d>d?d@dAdBdCdDdDdEdEdDdBdBdFdFdGdHdIdIdJdKdLdMdNdNdOdPdQdQdRdRdSdTdUdUdVdVdWdWdXdYdddZd[d\d]d^d_dǐd`ddǐdadadbdcdbdbdbdbdddddededcdcdadfdfdgdhdididjdkdkdldmdndodpdqdpdrdrdsdsdsdtdudRdRdvdvdwdtdudtdxdydzdzdzd{d{d|dzd}d~d~ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddÐdÐdĐdĐdŐdƐdǐdȐdȐdɐdɐdʐdːddd͐dddϐdϐdАdѐddddҐdҐdӐLZDdԐdՐd֐dאdؐdِdڐdېdܐdݐdސdߐdddddddddddddddddddddddddddddddddddddddddddd d d d d dddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdedfdgdhdidjdkdldmdldndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dddddddddddddddddddddddddddddddZEddZFyeWne int. Compares two strings according to the locale. )abrr/usr/lib64/python3.6/locale.py_strcoll!srcCs|S)z\ strxfrm(string) -> string. Returns a string that behaves for cmp locale-aware. r)srrr_strxfrm'sr)*cCs,dgddddgdddddddddddddS)zd localeconv() -> dict. Returns numeric and monetary locale-specific parameters. r!.)groupingcurrency_symbol n_sign_posn p_cs_precedes n_cs_precedes mon_groupingn_sep_by_space decimal_point negative_sign positive_signp_sep_by_spaceint_curr_symbol p_sign_posn thousands_sepmon_thousands_sep frac_digitsmon_decimal_pointint_frac_digitsrrrrrr ?s$cCs|dkrtddS)zd setlocale(integer,string=None) -> string. Activates/queries locale processing. Nr(Cz*_locale emulation only supports "C" locale)Nr(r<)r)categoryvaluerrrrWscCst}tr|jt|S)N) _localeconv_override_localeconvupdate)drrrr ls ccsPd}xF|D]>}|tkrdS|dkr>|dkr2tdx |Vq4W|V|}q WdS)Nrzinvalid grouping)r ValueError)r*Z last_intervalintervalrrr_grouping_intervalszs  rEFc Cst}||rdpd}||r dp"d}|s2|dfS|d dkr\|j}|t|d}|}nd}d}g}xNt|D]B} | s|d d kr|}d}P|j|| d|d| }qrW|r|j||j||j||t|t|dfS) Nr8r7r/r*rr& r( 0123456789rH)r rstriplenrEappendreversejoin) rmonetaryconvr7r*strippedZ right_spacesZ left_spacesgroupsrDrrr_groups0  rRcCsld}x$|r(||dkr(|d7}|d8}qWt|d}x$|rZ||dkrZ|d8}|d8}q8W|||dS)NrrFr&)rJ)rZamountZlposZrposrrr_strip_paddings   rSzG%(?:\((?P.*?)\))?(?P[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]cGsHtj|}| s$t|jt|kr4tdt|t||||f|S)zReturns the locale-aware substitution of a %? specifier (percent). additional is for format strings which contain one or more '*' modifiers.zHformat() must be given exactly one %%char format specifier, %s not valid) _percent_rematchrJgrouprCrepr_format)percentr>r*rN additionalrUrrrrs   c Gs|r||f|}n||}|d dkr~d}|jd}|rRt|d|d\|d<}t|r^dp`d}|j|}|rt||}n2|d dkrd}|rt||d\}}|rt||}|S) Nr&ZeEfFgGrr))rNr:r1ZdiurHrH)splitrRr rMrS) rYr>r*rNrZZ formattedZsepspartsr1rrrrXs(       rXc Csttj|}tjd|}t|tjrlg}x|D]6}|jddkrP|jdq0|jt |j||q0Wnt|t s||f}g}d}xz|D]r}|jd dkr|jdq|jdj d}|jt |j|||df||d|d||d|7}qWt |}||S) zFormats a string in the same way that the % formatting would use, but takes the current locale into account. Grouping is applied if the third parameter is true.z%sr&%rZ modifiersr FrHrH) listrTfinditersub isinstance collectionsMappingrVrKrtuplecountrX) fvalr*ZpercentsZnew_fZnew_valZperciZ starcountrrrrs0        Tc Csft}||rdpd}|dkr&tdtd|t||dd}d|d }|r||rXd pZd }||d krld pnd}||d krdpd} |r|| rdpd|}n|| rdpd|}||d krdpd} ||d krdpd} | d krd|d}n`| dkr| |}nL| dkr|| }n8| dkr2|jd| }n | dkrJ|jd | }n| |}|jddjd dS)zIFormats val according to the currency settings in the current locale.r;r9r!z9Currency formatting is not possible using the 'C' locale.z%%.%ifT)rN<>r5r+rr.r-r0r4rFr(r,r6r2r3()r&r'r#r%)r rCrabsreplace) rgZsymbolr*Z internationalrOZdigitsrZsmbZprecedesZ separatedZsign_posZsignrrrrs6       cCs td|S)z8Convert float to string, taking the locale into account.z%.12g)r)rgrrrr+scCs:t}|d}|r|j|d}|d}|r6|j|d}|S)zHParses a string as a normalized number according to the locale settings.r7r(r1r))r rn)stringrOtsZddrrr delocalize/s  rqcCs |t|S)zi>iLi:iiziNi|iPiPiaiiiiHici)iiiiFikikik iiii;$i;i;i;i;i; i; i;i;iOi iiii[ili2ii$i i i i i i i i i $i (i ,i 0i 4i 8i <i @i Di Hi Li Pi TiAiiiZi(i_iIiDiJiiQiQiiBii"i.i i iCiCi*iRii4iixiji5c Csi}|fdd}||d=tdtddt\}}td|pDdtd |pRdttd tddxL|jD]@\}}t|d t|\}}td |pdtd |pdtqzWttdtddtxP|jD]D\}}t|d t|\}}td |pdtd |p"dtqWyttdWn$tdtdtdYnpXttdtddxR|jD]F\}}t|d t|\}}td |pdtd |pdtqWdS)z Test function. cSs4x.tjD] \}}|dddkr |||<q WdS)Nr#ZLC_)globalsitems) categorieskvrrr_init_categoriessz'_print_locale.._init_categoriesrz4Locale defaults as determined by getdefaultlocale():ryHz Language: z (undefined)z Encoding: zLocale settings on startup:z...z Language: z Encoding: z,Locale settings after calling resetlocale():r(zNOTE:z9setlocale(LC_ALL, "") does not support the default localez&given in the OS environment variables.z4Locale settings after calling setlocale(LC_ALL, ""):N)rurrrrrr)rrZlangencnamer=rrr _print_locale{sV              r LC_MESSAGES__main__zLocale aliasing:zNumber formatting:)N)F)FF)FF)F)TFFrrrr)r)N)T)T)T)J__doc__rr{Zencodings.aliasesrerbbuiltinsrr functools__all__rrrrrrrrrrrrrCrr rrr r r?r@wrapsrErRrScompilerTrrXrrrqfloatr r rwrrrrrrrrrr startswithrCODESET NameErrorrsortedrrrrn setdefaultrrrrK__name__rurrrr s4            " -  S 5    " }  :    operator.cpython-36.pyc000064400000033133152462730460011041 0ustar003 \o*6@s(dZddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6g6Zd7d8lmZd9d&Zd:d#Zd;d Zdd Z d?d-Z d@d5Z dAdZ dBdZdCdZdDdZdEdZdFd ZdGdZdHdZeZdId%ZdJd)ZdKd*ZdLd'ZdMd,ZdNd.ZdOd/ZdPd0ZdQd1ZdRd3ZdSd4ZdTd6Z dUdZ!dVdZ"dWdZ#dXdZ$dYd Z%dZdZ&d[d2Z'dqd\d$Z(Gd]ddZ)Gd^d d Z*Gd_d(d(Z+d`dZ,dadZ-dbdZ.dcdZ/dddZ0dedZ1dfdZ2dgdZ3dhdZ4didZ5djdZ6dkdZ7dld!Z8dmd"Z9y d7dnl:TWne;k rbYnXd7dol:mZeZeZ?e Z@e ZAe ZBeZCeZDeZEeZFeZGeZHeZIeZJeZKeZLeZMeZNeZOeZPeZQeZReZSeZTe ZUe!ZVe"ZWe$ZXe%ZYe'ZZe,Z[e-Z\e.Z]e/Z^e0Z_e1Z`e2Zae3Zbe4Zce5Zde6Zee7Zfe8Zge9ZhdpS)ras Operator Interface This module exports a set of functions corresponding to the intrinsic operators of Python. For example, operator.add(x, y) is equivalent to the expression x+y. The function names are those used for special methods; variants without leading and trailing '__' are also provided for convenience. This is the pure Python implementation of the module. absaddand_ attrgetterconcatcontainscountOfdelitemeqfloordivgegetitemgtiaddiandiconcat ifloordivilshiftimatmulimodimulindexindexOfinvinvertioripowirshiftis_is_notisub itemgetteritruedivixorle length_hintlshiftltmatmul methodcallermodmulnenegnot_or_pospowrshiftsetitemsubtruedivtruthxor)rcCs||kS)zSame as a < b.)abr8r8 /usr/lib64/python3.6/operator.pyr&scCs||kS)zSame as a <= b.r8)r9r:r8r8r;r#scCs||kS)zSame as a == b.r8)r9r:r8r8r;r #scCs||kS)zSame as a != b.r8)r9r:r8r8r;r+'scCs||kS)zSame as a >= b.r8)r9r:r8r8r;r +scCs||kS)zSame as a > b.r8)r9r:r8r8r;r /scCs| S)zSame as not a.r8)r9r8r8r;r-5scCs |rdSdS)z*Return True if a is true, False otherwise.TFr8)r9r8r8r;r59scCs||kS)zSame as a is b.r8)r9r:r8r8r;r=scCs||k S)zSame as a is not b.r8)r9r:r8r8r;rAscCst|S)zSame as abs(a).)_abs)r9r8r8r;rGscCs||S)zSame as a + b.r8)r9r:r8r8r;rKscCs||@S)zSame as a & b.r8)r9r:r8r8r;rOscCs||S)zSame as a // b.r8)r9r:r8r8r;r SscCs|jS)zSame as a.__index__().) __index__)r9r8r8r;rWscCs|S)z Same as ~a.r8)r9r8r8r;r[scCs||>S)zSame as a << b.r8)r9r:r8r8r;r%`scCs||S)zSame as a % b.r8)r9r:r8r8r;r)dscCs||S)zSame as a * b.r8)r9r:r8r8r;r*hscCs||S)zSame as a @ b.r8)r9r:r8r8r;r'lscCs| S)z Same as -a.r8)r9r8r8r;r,pscCs||BS)zSame as a | b.r8)r9r:r8r8r;r.tscCs| S)z Same as +a.r8)r9r8r8r;r/xscCs||S)zSame as a ** b.r8)r9r:r8r8r;r0|scCs||?S)zSame as a >> b.r8)r9r:r8r8r;r1scCs||S)zSame as a - b.r8)r9r:r8r8r;r3scCs||S)zSame as a / b.r8)r9r:r8r8r;r4scCs||AS)zSame as a ^ b.r8)r9r:r8r8r;r6scCs(t|ds dt|j}t|||S)z%Same as a + b, for a and b sequences. __getitem__z!'%s' object can't be concatenated)hasattrtype__name__ TypeError)r9r:msgr8r8r;rs cCs||kS)z(Same as b in a (note reversed operands).r8)r9r:r8r8r;rscCs&d}x|D]}||kr |d7}q W|S)z)Return the number of times b occurs in a.r7r8)r9r:countir8r8r;rs   cCs ||=dS)zSame as del a[b].Nr8)r9r:r8r8r;rscCs||S)z Same as a[b].r8)r9r:r8r8r;r scCs.x(t|D]\}}||kr |Sq WtddS)z!Return the first index of b in a.z$sequence.index(x): x not in sequenceN) enumerate ValueError)r9r:rFjr8r8r;rscCs |||<dS)zSame as a[b] = c.Nr8)r9r:cr8r8r;r2scCst|ts dt|j}t|yt|Stk r<YnXyt|j}Wntk r`|SXy ||}Wntk r|SX|tkr|St|tsdt|j}t||dkrd}t ||S)a2 Return an estimate of the number of items in obj. This is useful for presizing containers when building from an iterable. If the object supports len(), the result will be exact. Otherwise, it may over- or under-estimate by an arbitrary amount. The result will be an integer >= 0. z/'%s' object cannot be interpreted as an integerz'__length_hint__ must be integer, not %sr7z$__length_hint__() should return >= 0) isinstanceintr@rArBlen__length_hint__AttributeErrorNotImplementedrH)objdefaultrCZhintvalr8r8r;r$s4     c@s4eZdZdZd ZddZddZdd Zd d Zd S)raV Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter('name'), the call f(r) returns r.name. After g = attrgetter('name', 'date'), the call g(r) returns (r.name, r.date). After h = attrgetter('name.first', 'name.last'), the call h(r) returns (r.name.first, r.name.last). _attrs_callcsn|s.funccstfddDS)Nc3s|]}|VqdS)Nr8).0getter)rQr8r; sz4attrgetter.__init__..func..)tuple)rQ)getters)rQr;rZs) rKstrrBrTsplitrUr^mapr)selfattrZattrsrZr8)r_rYr;__init__s     zattrgetter.__init__cCs |j|S)N)rU)rcrQr8r8r;__call__szattrgetter.__call__cCs$d|jj|jjdjtt|jfS)Nz %s.%s(%s)z, ) __class__ __module__ __qualname__joinrbreprrT)rcr8r8r;__repr__szattrgetter.__repr__cCs |j|jfS)N)rgrT)rcr8r8r; __reduce__szattrgetter.__reduce__N)rTrU) rArhri__doc__ __slots__rerfrlrmr8r8r8r;rs c@s4eZdZdZd ZddZddZdd Zd d Zd S)r z Return a callable object that fetches the given item(s) from its operand. After f = itemgetter(2), the call f(r) returns r[2]. After g = itemgetter(2, 5, 3), the call g(r) returns (r[2], r[5], r[3]) _itemsrUcsFs f|_fdd}||_n"f|_fdd}||_dS)Ncs|S)Nr8)rQ)itemr8r;rZsz!itemgetter.__init__..funccstfddDS)Nc3s|]}|VqdS)Nr8)r[rF)rQr8r;r]sz4itemgetter.__init__..func..)r^)rQ)items)rQr;rZs)rprU)rcrqrrrZr8)rqrrr;res  zitemgetter.__init__cCs |j|S)N)rU)rcrQr8r8r;rfszitemgetter.__call__cCs$d|jj|jjdjtt|jfS)Nz %s.%s(%s)z, )rgrhrArjrbrkrp)rcr8r8r;rl szitemgetter.__repr__cCs |j|jfS)N)rgrp)rcr8r8r;rm%szitemgetter.__reduce__N)rprU) rArhrirnrorerfrlrmr8r8r8r;r s  c@s4eZdZdZdZddZddZd d Zd d Zd S)r(z Return a callable object that calls the given method on its operand. After f = methodcaller('name'), the call f(r) returns r.name(). After g = methodcaller('name', 'date', foo=1), the call g(r) returns r.name('date', foo=1). _name_args_kwargscOsVt|dkrd}t||d}|d|_t|jts>td|dd|_||_dS)Nz9methodcaller needs at least one argument, the method namer7rDzmethod name must be a string)rMrBrsrKr`rtru)argskwargsrCrcr8r8r;re1s   zmethodcaller.__init__cCst||j|j|jS)N)rWrsrtru)rcrQr8r8r;rf<szmethodcaller.__call__cCsTt|jg}|jtt|j|jdd|jjDd|jj|jj dj |fS)Ncss|]\}}d||fVqdS)z%s=%rNr8)r[kvr8r8r;r]Bsz(methodcaller.__repr__..z %s.%s(%s)z, ) rkrsextendrbrtrurrrgrhrArj)rcrwr8r8r;rl?s  zmethodcaller.__repr__cCsD|js|j|jf|jfSddlm}||j|jf|j|jfSdS)Nr7)partial)rurgrsrt functoolsr|)rcr|r8r8r;rmGs zmethodcaller.__reduce__N)rsrtru) rArhrirnrorerfrlrmr8r8r8r;r((s  cCs ||7}|S)zSame as a += b.r8)r9r:r8r8r;rQscCs ||M}|S)zSame as a &= b.r8)r9r:r8r8r;rVscCs,t|ds dt|j}t|||7}|S)z&Same as a += b, for a and b sequences.r>z!'%s' object can't be concatenated)r?r@rArB)r9r:rCr8r8r;r[s  cCs ||}|S)zSame as a //= b.r8)r9r:r8r8r;rcscCs ||K}|S)zSame as a <<= b.r8)r9r:r8r8r;rhscCs ||;}|S)zSame as a %= b.r8)r9r:r8r8r;rmscCs ||9}|S)zSame as a *= b.r8)r9r:r8r8r;rrscCs ||}|S)zSame as a @= b.r8)r9r:r8r8r;rwscCs ||O}|S)zSame as a |= b.r8)r9r:r8r8r;r|scCs ||C}|S)zSame as a **= b.r8)r9r:r8r8r;rscCs ||L}|S)zSame as a >>= b.r8)r9r:r8r8r;rscCs ||8}|S)zSame as a -= b.r8)r9r:r8r8r;rscCs ||}|S)zSame as a /= b.r8)r9r:r8r8r;r!scCs ||N}|S)zSame as a ^= b.r8)r9r:r8r8r;r"s)*)rnN)r7)irn__all__builtinsrr<r&r#r r+r r r-r5rrrrr rrrr%r)r*r'r,r.r/r0r1r3r4r6rrrrr rr2r$rr r(rrrrrrrrrrrrr!r" _operator ImportError__lt____le____eq____ne____ge____gt____not____abs____add____and__ __floordiv__r=__inv__ __invert__ __lshift____mod____mul__ __matmul____neg____or____pos____pow__ __rshift____sub__ __truediv____xor__ __concat__ __contains__ __delitem__r> __setitem____iadd____iand__ __iconcat__ __ifloordiv__ __ilshift____imod____imul__ __imatmul____ior____ipow__ __irshift____isub__ __itruediv____ixor__r8r8r8r; s    )')  sunau.cpython-36.opt-2.pyc000064400000030076152462730460011304 0ustar003 \F@sddlmZeddZdZdZdZdZdZd Zd Z d Z d Z d Z dZ dZdZdZeeeeeegZGdddeZddZddZGdddZGdddZdddZeZdS) ) namedtuple _sunau_paramsz7nchannels sampwidth framerate nframes comptype compnameidns.lc@s eZdZdS)ErrorN)__name__ __module__ __qualname__rr/usr/lib64/python3.6/sunau.pyrsrcCs<d}x2tdD]&}|jd}|s$t|dt|}qW|S)Nrrr)rangereadEOFErrorord)filexiZbyterrr _read_u32s rcCsJg}x2tdD]&}t|d\}}|jdt||}qW|jt|dS)Nrrr)rdivmodinsertintwritebytes)rrdatardmrrr _write_u32s r'c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)S)*Au_readcCs@t|tdkr,ddl}|j|d}d|_nd|_|j|dS)NrrbTF)typebuiltinsopen_openedinitfp)selffr,rrr__init__s  zAu_read.__init__cCs|jr|jdS)N)_fileclose)r0rrr__del__szAu_read.__del__cCs|S)Nr)r0rrr __enter__szAu_read.__enter__cGs |jdS)N)r4)r0argsrrr__exit__szAu_read.__exit__c Cs||_d|_tt|}|tkr(tdtt||_|jdkrHtd|jdkrZtdt||_|jtkrzt|j|_tt||_ |j t krtd|j t t fkrd|_ d |_nj|j tkrd |_|_ nR|j tkrd|_|_ n:|j tkrd |_|_ n"|j tkrd |_|_ ntd tt||_tt||_|j|j|_|jdkr~|j|jd|_|jjd \|_}}nd|_y|j|_Wn ttfk rd|_YnXdS)Nrzbad magic numberr zheader size too smalldzheader size ridiculously largezencoding not (yet) supportedrrrrzunknown encoding)r3 _soundposr!rAUDIO_FILE_MAGICrZ _hdr_size _data_sizeAUDIO_UNKNOWN_SIZE _encoding_simple_encodingsAUDIO_FILE_ENCODING_MULAW_8AUDIO_FILE_ENCODING_ALAW_8 _sampwidth _framesizeAUDIO_FILE_ENCODING_LINEAR_8AUDIO_FILE_ENCODING_LINEAR_16AUDIO_FILE_ENCODING_LINEAR_24AUDIO_FILE_ENCODING_LINEAR_32 _framerate _nchannelsr_info partitiontell _data_posAttributeErrorOSError)r0rmagic_rrrr/sP            zAu_read.initfpcCs|jS)N)r3)r0rrrgetfpsz Au_read.getfpcCs|jS)N)rK)r0rrr getnchannelsszAu_read.getnchannelscCs|jS)N)rD)r0rrr getsampwidthszAu_read.getsampwidthcCs|jS)N)rJ)r0rrr getframerateszAu_read.getframeratecCs(|jtkrtS|jtkr$|j|jSdS)Nr)r>r?r@rArE)r0rrr getnframess    zAu_read.getnframescCs$|jtkrdS|jtkrdSdSdS)NULAWALAWNONE)r@rBrC)r0rrr getcomptypes   zAu_read.getcomptypecCs$|jtkrdS|jtkrdSdSdS)NzCCITT G.711 u-lawzCCITT G.711 A-lawznot compressed)r@rBrC)r0rrr getcompnames   zAu_read.getcompnamecCs*t|j|j|j|j|j|jS)N)rrUrVrWrXr\r])r0rrr getparamss zAu_read.getparamscCsdS)Nr)r0rrr getmarkersszAu_read.getmarkerscCs tddS)Nzno marks)r)r0idrrrgetmarkszAu_read.getmarkcCsp|jtkrl|tkr|jj}n|jj||j}|jt||j7_|jtkrhddl }|j ||j }|SdS)Nr) r@rAr?r3rrEr<lenrBaudioopZulaw2linrD)r0nframesr$rcrrr readframes s   zAu_read.readframescCs*|jdkrtd|jj|jd|_dS)Nz cannot seekr)rOrQr3seekr<)r0rrrrewinds zAu_read.rewindcCs|jS)N)r<)r0rrrrNsz Au_read.tellcCsP|dks||jkrtd|jdkr.td|jj|j||j||_dS)Nrzposition not in rangez cannot seek)rXrrOrQr3rfrEr<)r0posrrrsetpos!s  zAu_read.setposcCs"|j}|rd|_|jr|jdS)N)r3r.r4)r0rrrrr4)s z Au_read.closeN)rrrr2r5r6r8r/rTrUrVrWrXr\r]r^r_rarergrNrir4rrrrr(s( , r(c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3S)4Au_writecCs@t|tdkr,ddl}|j|d}d|_nd|_|j|dS)Nr)rwbTF)r+r,r-r.r/)r0r1r,rrrr22s  zAu_write.__init__cCs|jr|jd|_dS)N)r3r4)r0rrrr5;szAu_write.__del__cCs|S)Nr)r0rrrr6@szAu_write.__enter__cGs |jdS)N)r4)r0r7rrrr8CszAu_write.__exit__cCsF||_d|_d|_d|_d|_t|_d|_d|_d|_ d|_ d|_ dS)Nrr;rY) r3rJrKrDrEr?_nframes_nframeswritten _datawritten _datalengthrL _comptype)r0rrrrr/FszAu_write.initfpcCs(|jrtd|dkrtd||_dS)Nz0cannot change parameters after starting to writerrrz"only 1, 2, or 4 channels supported)rrr)rmrrK)r0 nchannelsrrr setnchannelsSs zAu_write.setnchannelscCs|jstd|jS)Nznumber of channels not set)rKr)r0rrrrUZszAu_write.getnchannelscCs(|jrtd|dkrtd||_dS)Nz0cannot change parameters after starting to writerrrrzbad sample width)rrrr)rmrrD)r0 sampwidthrrr setsampwidth_s zAu_write.setsampwidthcCs|jstd|jS)Nzsample width not specified)rJrrD)r0rrrrVfszAu_write.getsampwidthcCs|jrtd||_dS)Nz0cannot change parameters after starting to write)rmrrJ)r0 frameraterrr setframeratekszAu_write.setframeratecCs|jstd|jS)Nzframe rate not set)rJr)r0rrrrWpszAu_write.getframeratecCs(|jrtd|dkrtd||_dS)Nz0cannot change parameters after starting to writerz# of frames cannot be negative)rmrrl)r0rdrrr setnframesus zAu_write.setnframescCs|jS)N)rm)r0rrrrX|szAu_write.getnframescCs|dkr||_ntddS)Nr[rYzunknown compression type)r[rY)rpr)r0r+namerrr setcomptypeszAu_write.setcomptypecCs|jS)N)rp)r0rrrr\szAu_write.getcomptypecCs$|jdkrdS|jdkrdSdSdS)NrYzCCITT G.711 u-lawrZzCCITT G.711 A-lawznot compressed)rp)r0rrrr]s   zAu_write.getcompnamecCsH|\}}}}}}|j||j||j||j||j||dS)N)rrrtrvrwry)r0ZparamsrqrsrurdZcomptypeZcompnamerrr setparamss     zAu_write.setparamscCs*t|j|j|j|j|j|jS)N)rrUrVrWrXr\r])r0rrrr^s zAu_write.getparamscCs|jS)N)rm)r0rrrrNsz Au_write.tellcCs~t|ttfst|jd}|j|jdkrDddl}|j||j }t ||j }|j j ||j||_|jt ||_dS)NBrYr) isinstancer# bytearray memoryviewcast_ensure_header_writtenrprcZlin2ulawrDrbrEr3r"rmrn)r0r$rcrdrrrwriteframesraws   zAu_write.writeframesrawcCs.|j||j|jks"|j|jkr*|jdS)N)rrmrlrorn _patchheader)r0r$rrr writeframess   zAu_write.writeframesc Cs^|jrZz6|j|j|jks(|j|jkr0|j|jjWd|j}d|_|jrX|j XdS)N) r3rrmrlrornrflushr.r4)r0rrrrr4s  zAu_write.closecCs<|js8|jstd|js"td|js0td|jdS)Nz# of channels not specifiedzsample width not specifiedzframe rate not specified)rmrKrrDrJ _write_header)r0rrrrszAu_write._ensure_header_writtenc Cs|jdkrl|jdkr t}d|_q|jdkr6t}d|_q|jdkrLt}d|_q|jdkrbt}d|_qtdn|jdkrt}d|_ntd|j|j |_t |j t dt |j}|d d @}t |j ||jtkrt}n |j|j}y|j j|_Wn ttfk rd|_YnXt |j |||_t |j |t |j |jt |j |j |j j|j|j jd |t |jd dS) Nr[rrrrzinternal errorrYr r r:r i)rprDrFrErGrHrIrrBrKr'r3r=rbrLrlr?rN_form_length_posrPrQrorJr")r0encodingZ header_sizeZlengthrrrrsJ               zAu_write._write_headercCsH|jdkrtd|jj|jt|j|j|j|_|jjdddS)Nz cannot seekrr)rrQr3rfr'rnro)r0rrrrs  zAu_write._patchheaderN)rrrr2r5r6r8r/rrrUrtrVrvrWrwrXryr\r]rzr^rNrrr4rrrrrrrrj0s2    *rjNcCsJ|dkrt|dr|j}nd}|dkr.t|S|dkr>t|StddS) Nmoder*rwrkz$mode must be 'r', 'rb', 'w', or 'wb')rr*)rrk)hasattrrr(rjr)r1rrrrr-s r-)N) collectionsrrr=rBrFrGrHrIZAUDIO_FILE_ENCODING_FLOATZAUDIO_FILE_ENCODING_DOUBLEZAUDIO_FILE_ENCODING_ADPCM_G721ZAUDIO_FILE_ENCODING_ADPCM_G722Z AUDIO_FILE_ENCODING_ADPCM_G723_3Z AUDIO_FILE_ENCODING_ADPCM_G723_5rCr?rA Exceptionrrr'r(rjr-Zopenfprrrrjs>  Q tarfile.cpython-36.opt-1.pyc000064400000222125152462730460011574 0ustar003 i'@sBdZdZdZdZdZdZddlmZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZy ddlZWnek rdZYnXy ddlZWnek rdZYnXeefZyeef7ZWnek rYnXd d d d d ddddddddddgZdZdZdZdZedZ dZ!dZ"dZ#dZ$d Z%d!Z&dZ'd"Z(d#Z)d$Z*d%Z+d&Z,d'Z-d(Z.d)Z/d*Z0d+Z1d,Z2d-Z3d.Z4dZ5d/Z6d0Z7e6Z8e&e'e(e)e,e-e.e*e+e/e0e1f Z9e&e'e.e1fZ:e/e0e1fZ;dZe>e>e?e?e?d9Z@e jAd:krd;ZBne jCZBdd?ZEd@dAZFdBe8fdCdDZGdEdFZHdedfdGdHZIdIdJZJdKdLZKGdMd d eLZMGdNddeMZNGdOd d eMZOGdPddeMZPGdQddeMZQGdRddeMZRGdSdTdTeRZSGdUdVdVeRZTGdWdXdXeRZUGdYdZdZeRZVGd[d\d\eRZWGd]d^d^ZXGd_d`d`ZYGdadbdbeZZ[GdcddddeZZ\Gdedfdfe j]Z^GdgdhdheMZ_Gdidjdje_Z`Gdkdldle_ZaGdmdndne_ZbGdodpdpe_ZcGdqdrdre_ZdGdsdtdte_Zee_eeNfZfddudvZgdwdxZhdydzZid{d|Zjeheiejd}ZkeZZlejmd~ZnGdd d eZZoGdd d eZZpdd ZqepjZddZresdkr>erdS)z,Read from and write to tar format archives. z0.9.0u"Lars Gustäbel (lars@gustaebel.de)z5$Date: 2011-02-25 17:42:01 +0200 (Fri, 25 Feb 2011) $z?$Id: tarfile.py 88586 2011-02-25 15:42:01Z marc-andre.lemburg $u4Gustavo Niemeyer, Niels Gustäbel, Richard Townsend.)openNTarFileTarInfo is_tarfileTarError ReadErrorCompressionError StreamError ExtractError HeaderErrorENCODING USTAR_FORMAT GNU_FORMAT PAX_FORMATDEFAULT_FORMATrTz/etc/python/tarfile.cfgisustar sustar00d01234567LKSxgXpathlinkpathsizemtimeuidgidunamegname)ZatimeZctimer(r)r*r'ntzutf-8cCs8|dkrtd|j||}|d||t|tS)z8Convert a string to a null-terminated bytes object. Nzmetadata cannot contain None) ValueErrorencodelenNUL)slengthencodingerrorsr6/usr/lib64/python3.6/tarfile.pystns r8cCs*|jd}|dkr|d|}|j||S)z8Convert a null-terminated bytes object to a string. rr#N)finddecode)r2r4r5pr6r6r7ntss  r=c Cs|dd krfd}x0tt|dD]}|dK}|||d7}q"W|ddkrdt|d| }n@y"t|dd}t|jpd d}Wntk rtd YnX|S) z/Convert a number field to a python number. rr#asciistrict0zinvalid header)r>r?)ranger0r=intstripr.InvalidHeaderError)r2nir6r6r7ntis   rKr@cCst|}d|ko"d|dknrDtd|d|fdt}n|tkrd|d |kopd|dknr|dkrtdg}ntdg}d||}x6t|dD]}|jd|d@|dL}qWntd |S) z/Convert a python number to a number field. rr@r#z%0*orBrAr>r?zoverflow in number field)rFbytesr1r bytearrayrEinsertr.)rIdigitsformatr2rJr6r6r7itns  2   rQcCs0dttjd|}dttjd|}||fS)aCalculate the checksum for a member's header by summing up all characters except for the chksum field which is treated as if it was filled with spaces. According to the GNU tar sources, some tars (Sun and NeXT) calculate chksum with signed char, which will be different if there are chars in the buffer with the high bit set. So we calculate two checksums, unsigned and signed. rAZ 148B8x356BZ 148b8x356b)sumstructZ unpack_from)bufZunsigned_chksumZ signed_chksumr6r6r7 calc_chksumss rUc Cs|pd}|dkrdS|dkr.tj|||dSt||\}}x8t|D],}|j|}t||krh|d|j|qFW|dkr|j|}t||kr|d|j|dS)zjCopy length bytes from fileobj src to fileobj dst. If length is None, copy the entire content. irNzunexpected end of datai@)shutil copyfileobjdivmodrEreadr0write) srcdstr3 exceptionbufsizeblocks remainderbrTr6r6r7rXs$     rXcCs ddl}|jdtdtj|S)z/Deprecated in this location; use stat.filemode.rNz$deprecated in favor of stat.filemoder$)warningswarnDeprecationWarningstatfilemode)modercr6r6r7rgsrgcCs8ttjdd}|dk r(|j|dj|}t|dddS)Nr4backslashreplace )end)getattrsysstdoutr/r;print)r2r4r6r6r7 _safe_printsrpc@seZdZdZdS)rzBase exception.N)__name__ __module__ __qualname____doc__r6r6r6r7rsc@seZdZdZdS)r z%General exception for extract errors.N)rqrrrsrtr6r6r6r7r !sc@seZdZdZdS)rz&Exception for unreadable tar archives.N)rqrrrsrtr6r6r6r7r$sc@seZdZdZdS)rz.Exception for unavailable compression methods.N)rqrrrsrtr6r6r6r7r'sc@seZdZdZdS)r z=Exception for unsupported operations on stream-like TarFiles.N)rqrrrsrtr6r6r6r7r *sc@seZdZdZdS)r z!Base exception for header errors.N)rqrrrsrtr6r6r6r7r -sc@seZdZdZdS)EmptyHeaderErrorzException for empty headers.N)rqrrrsrtr6r6r6r7ru0sruc@seZdZdZdS)TruncatedHeaderErrorz Exception for truncated headers.N)rqrrrsrtr6r6r6r7rv3srvc@seZdZdZdS)EOFHeaderErrorz"Exception for end of file headers.N)rqrrrsrtr6r6r6r7rw6srwc@seZdZdZdS)rHzException for invalid headers.N)rqrrrsrtr6r6r6r7rH9srHc@seZdZdZdS)SubsequentHeaderErrorz3Exception for missing and invalid extended headers.N)rqrrrsrtr6r6r6r7rx<srxc@s0eZdZdZddZddZddZdd Zd S) _LowLevelFilezLow-level file object. Supports reading and writing. It is used instead of a regular file object for streaming access. cCsFtjtjtjBtjBd|}ttdr2|tjO}tj||d|_dS)N)rwO_BINARYi) osO_RDONLYO_WRONLYO_CREATO_TRUNChasattrr|rfd)selfnamerhr6r6r7__init__Is   z_LowLevelFile.__init__cCstj|jdS)N)r}closer)rr6r6r7rRsz_LowLevelFile.closecCstj|j|S)N)r}rZr)rr'r6r6r7rZUsz_LowLevelFile.readcCstj|j|dS)N)r}r[r)rr2r6r6r7r[Xsz_LowLevelFile.writeN)rqrrrsrtrrrZr[r6r6r6r7ryCs  ryc@steZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ dddZ dddZ ddZddZdS)_StreamaClass that serves as an adapter between TarFile and a stream-like object. The stream-like object only needs to have a read() or write() method and is accessed blockwise. Use of gzip or bzip2 compression is possible. A stream-like object could be for example: sys.stdin, sys.stdout, a socket, a tape device etc. _Stream is intended to be used only internally. c Csd|_|dkrt||}d|_|dkr6t|}|j}|pt|j|jkrL|jj|jd|j|j|jd|_qWdS)z]Write string s to the stream if a whole new block is ready to be written. N)rTr0r_rr[)rr2r6r6r7Z__writesz_Stream.__writec Cs|jr dSd|_z|jdkr:|jdkr:|j|jj7_|jdkr|jr|jj|jd|_|jdkr|jjtj d|j |jjtj d|j d@Wd|j s|jj XdS) z[Close the _Stream object. No operation should be done on it afterwards. NTr{rrrzd|fg}d|_g|_d}|j}xT|D]L\}}||kr~|jj d||df|jj d||||f||7}||}qZW||jkr|jj d||jdfdS)NrrFT) roffsetr'positionrlrr map_indexmapr)rrrr'Z blockinfoZlastposZrealposr6r6r7rus(   z_FileInFile.__init__cCsdS)Nr6)rr6r6r7rsz_FileInFile.flushcCsdS)NTr6)rr6r6r7readablesz_FileInFile.readablecCsdS)NFr6)rr6r6r7writablesz_FileInFile.writablecCs |jjS)N)rseekable)rr6r6r7rsz_FileInFile.seekablecCs|jS)z*Return the current file position. )r)rr6r6r7rsz_FileInFile.tellcCs|tjkr tt|d|j|_nj|tjkr\|dkrFt|j|d|_qt|j||j|_n.|tjkrtt|j||jd|_ntd|jS)z(Seek to a position in the file. rzInvalid argument) ioSEEK_SETminmaxr'rSEEK_CURSEEK_ENDr.)rrwhencer6r6r7rs   z_FileInFile.seekc Cs|dkr|j|j}nt||j|j}d}x|dkr xZ|j|j\}}}}||jkob|knrlPq:|jd7_|jt|jkr:d|_q:Wt|||j}|r|jj||j||jj|}t||krt d||7}n |t |7}||8}|j|7_q.W|S)z!Read data from the file. Nrrr#zunexpected end of data) r'rrrrr0rrrZrr1) rr'rTdatastartstoprr3rbr6r6r7rZs.      z_FileInFile.readcCs&|jt|}||dt|<t|S)N)rZr0)rrbrTr6r6r7readintosz_FileInFile.readintocCs d|_dS)NT)r)rr6r6r7rsz_FileInFile.close)N)N)rqrrrsrtrrrrrrrrrrZrrr6r6r6r7ros  rcseZdZfddZZS) ExFileObjectcs&t|j|j|j|j}tj|dS)N)rr offset_datar'sparsesuperr)rtarfiletarinfor) __class__r6r7rs  zExFileObject.__init__)rqrrrsr __classcell__r6r6)rr7rsrc@s eZdZdS) FilterErrorN)rqrrrsr6r6r6r7rsrcseZdZfddZZS)AbsolutePathErrorcs ||_tjd|jddS)Nzmember z has an absolute path)rrrr)rr)rr6r7rszAbsolutePathError.__init__)rqrrrsrrr6r6)rr7rsrcseZdZfddZZS)OutsideDestinationErrorcs.||_||_tj|jd|dddS)Nz would be extracted to z, z which is outside the destination)r_pathrrr)rrr%)rr6r7rsz OutsideDestinationError.__init__)rqrrrsrrr6r6)rr7rsrcseZdZfddZZS)SpecialFileErrorcs||_tj|jddS)Nz is a special file)rrrr)rr)rr6r7rszSpecialFileError.__init__)rqrrrsrrr6r6)rr7rsrcseZdZfddZZS)AbsoluteLinkErrorcs||_tj|jddS)Nz! is a symlink to an absolute path)rrrr)rr)rr6r7rszAbsoluteLinkError.__init__)rqrrrsrrr6r6)rr7rsrcseZdZfddZZS)LinkOutsideDestinationErrorcs.||_||_tj|jd|dddS)Nz would link to z, z which is outside the destination)rrrrr)rrr%)rr6r7rsz$LinkOutsideDestinationError.__init__)rqrrrsrrr6r6)rr7rsrcseZdZfddZZS)LinkFallbackErrorcs2||_||_tjd|jdd|ddS)Nzlink z would be extracted as a zcopy of z, which was rejected)rrrrr)rrr%)rr6r7rszLinkFallbackError.__init__)rqrrrsrrr6r6)rr7rsrcCs$i}|j}tjj|tjjd}|jdtjfrH|jjdtj}|d<tjj|r\t |tjjtjj ||tjjd}tjj ||g|krt |||j }|dk r|d@}|r|js|jr|d@s|dM}|dO}n|js|jrd}nt|||j kr||d<|r |jdk r,d|d <|jdk r@d|d <|jdk rTd|d <|jdk rhd|d <|js||jr tjj|jrt|tjj|j}||jkr||d <|jrtjj |tjj||j}ntjj ||j}tjj|tjjd}tjj ||g|kr t|||S)N)rC/ri@Iirhr)r*r+r,linknamei)rr}r%realpath ALLOW_MISSINGrseplstripisabsrr commonpathrrhisregislnkisdirissymrr)r*r+r,rrnormpathdirnamer)member dest_pathZfor_data new_attrsrZ target_pathrhZ normalizedr6r6r7_get_filtered_attrssd                rcCs|S)Nr6)rrr6r6r7fully_trusted_filterTsrcCs(t||d}|r$|jf|ddiS|S)NFdeep)rr)rrrr6r6r7 tar_filterWs rcCs(t||d}|r$|jf|ddiS|S)NTrF)rr)rrrr6r6r7 data_filter]s r)Z fully_trustedrrs([0-9]{1,20}) c@seZdZdZdmZdnddZddZddZeeeZ ddZ dd Z ee e Z d!d"Z eeeeeeeed#ed$ d%d&Zd'd(Zeed)fd*d+Zd,d-Zd.d/Zd0d1Zed2d3Zd4d5Zed6d7Zed8d9Zed:d;Zedd?Zed@dAZ dBdCZ!dDdEZ"dFdGZ#dHdIZ$dJdKZ%dLdMZ&dNdOZ'dPdQZ(dRdSZ)dTdUZ*dVdWZ+dXdYZ,dZd[Z-d\d]Z.d^d_Z/d`daZ0dbdcZ1dddeZ2dfdgZ3dhdiZ4djdkZ5dlS)oraInformational class which holds the details about an archive member given by a tar header block. TarInfo objects are returned by TarFile.getmember(), TarFile.getmembers() and TarFile.gettarinfo() and are usually created internally. rrhr)r*r'r(chksumtyperr+r,devmajordevminorrr pax_headersrr_sparse_structs _link_targetrcCsj||_d|_d|_d|_d|_d|_d|_t|_d|_ d|_ d|_ d|_ d|_ d|_d|_d|_i|_dS)zXConstruct a TarInfo object. name is the optional name of the member. irrN)rrhr)r*r'r(rREGTYPErrr+r,rrrrrr)rrr6r6r7rs"zTarInfo.__init__cCs|jS)N)r)rr6r6r7_getpathszTarInfo._getpathcCs ||_dS)N)r)rrr6r6r7_setpathszTarInfo._setpathcCs|jS)N)r)rr6r6r7 _getlinkpathszTarInfo._getlinkpathcCs ||_dS)N)r)rrr6r6r7 _setlinkpathszTarInfo._setlinkpathcCsd|jj|jt|fS)Nz<%s %r at %#x>)rrqrid)rr6r6r7__repr__szTarInfo.__repr__T) rr(rhrr)r*r+r,r_KEEPc Cs| rtj|} n tj|} || k r(|| _|| k r6|| _|| k rD|| _|| k rR|| _|| k r`|| _|| k rn|| _|| k r||| _|| k r|| _ | S)zGReturn a deep copy of self with the given attributes replaced. ) copydeepcopyrr(rhrr)r*r+r,) rrr(rhrr)r*r+r,rr resultr6r6r7rs(  zTarInfo.replacecCs|jdkrd}n |jd@}|j||j|j|j|j|j|j|j|j |j |j |j d }|dt kr~|djd r~|dd7<|S)z9Return the TarInfo's attributes as a dictionary. Ni) rrhr)r*r'r(rrrr+r,rrrrr)rhrr)r*r'r(rrrr+r,rrDIRTYPEr)rrhinfor6r6r7get_infos&   zTarInfo.get_infosurrogateescapecCs~|j}x(|jD]\}}|dkrtd|qW|tkrH|j|||S|tkr^|j|||S|tkrr|j||StddS)ztdt|dd}|t|krbt d|}t |dd|||_ t|dd |_ t|d d |_ t|d d |_t|d d |_t|d d|_||_|dd |_t |d d|||_t |dd|||_t |dd|||_t|dd|_t|dd|_t |dd||}|jtkr|j jdrt|_|jtkr6d}g}xrtdD]f} y0t|||d} t||d|d} Wntk rPYnX|j| | f|d7}qWt|d} t|dd} || | f|_ |j!rN|j j"d|_ |rp|jt#krp|d|j |_ |S)zAConstruct a TarInfo object from a 512 byte bytes object. rz empty headerztruncated headerzend of file headerz bad checksumrlt|ii i)iIiQiYirirr$iii)$r0rurrvcountr1rwrKrUrHr=rrhr)r*r'r(rrrr+r,rrAREGTYPErrGNUTYPE_SPARSErEr.rboolrrrstrip GNU_TYPES)r1rTr4r5robjrrstructsrJrnumbytes isextendedorigsizer6r6r7frombufsZ       zTarInfo.frombufcCs8|jjt}|j||j|j}|jjt|_|j|S)zOReturn the next TarInfo object from TarFile object tarfile. ) rrZrrRr4r5rr _proc_member)r1rrTrMr6r6r7 fromtarfile s zTarInfo.fromtarfilecCsT|jttfkr|j|S|jtkr,|j|S|jtttfkrF|j |S|j |SdS)zYChoose the right processing method depending on the type and call it. N) rr"r! _proc_gnulongrI _proc_sparser.r0SOLARIS_XHDTYPE _proc_pax _proc_builtin)rrr6r6r7rS!s    zTarInfo._proc_membercCsR|jj|_|j}|js$|jtkr4||j|j7}||_|j |j |j |j |S)zfProcess a builtin type or an unknown type which will be treated as a regular file. ) rrrrrSUPPORTED_TYPES_blockr'r_apply_pax_inforr4r5)rrrr6r6r7rY.s zTarInfo._proc_builtinc Cs|jj|j|j}y|j|}Wntk r>tdYnX|j|_|jt krft ||j |j |_ n|jtkrt ||j |j |_|S)zSProcess the blocks that hold a GNU longname or longlink member. z missing or bad subsequent header)rrZr[r'rTr rxrrr"r=r4r5rr!r)rrrTnextr6r6r7rU?s  zTarInfo._proc_gnulongc Cs|j\}}}|`x|r|jjt}d}xvtdD]j}y0t|||d}t||d|d} Wntk rzPYnX|r| r|j|| f|d7}q0Wt|d}qW||_ |jj |_ |j |j |j |_||_ |S)z8Process a GNU sparse header plus extra headers. rr$rFi)rrrZrrErKr.rrJrrrr[r'r) rrrNrPrQrTrrJrrOr6r6r7rVUs(    zTarInfo._proc_sparsec Cs|jj|j|j}|jtkr&|j}n |jj}d}d}g}x0t||koV||dkrnt j ||}|srt dyt |j d}Wntk rt dYnX|dkrt d||t|krt d|jd|d} ||jdd| } | jd\} } } | s"| dks"|| dkr*t d|j|| | f| dkrd|dkrd| d kr`|j}nd }||7}q@W|dkr~d }x`|D]X\}} } |j| d d |j}|tkr|j| ||j|j}n|j| d d |j}|||<qWy|j|}Wntk r td YnXd |kr&|j||nFd |kr>|j||n.|jddkrl|jddkrl|j||||jttfkr|j ||j|j|j!|_!d|kr|j"}|j#s|jt$kr||j|j7}||_!|S)zVProcess an extended or global header as described in POSIX.1-2008. rNzinvalid headerr#r;rs hdrcharsetsBINARYzutf-8z missing or bad subsequent headerzGNU.sparse.mapzGNU.sparse.sizezGNU.sparse.major1zGNU.sparse.minorrDr')%rrZr[r'rr0rr r0_header_length_prefix_rematchrHrFgroupr.rrk partitionrr4_decode_pax_fieldr5PAX_NAME_FIELDSrTr rx_proc_gnusparse_01_proc_gnusparse_00r5_proc_gnusparse_10r.rWr\rrrrZ)rrrTrrr4 raw_headersrbr3Zheader_value_end_offsetZkeyword_and_valueZ raw_keywordZequalsZ raw_valuer=rr]rr6r6r7rXqsx                 zTarInfo._proc_paxc Csg}g}x|D]\}}}|dkrVy|jt|jWqtk rRtdYqXq|dkry|jt|jWqtk rtdYqXqWtt|||_dS)z?Process a GNU tar extended sparse header, version 0.0. sGNU.sparse.offsetzinvalid headersGNU.sparse.numbytesN)rrFr;r.rHlistzipr)rr]rjZoffsetsrO_r=rr6r6r7rhszTarInfo._proc_gnusparse_00cCs@dd|djdD}tt|ddd|ddd|_dS)z?Process a GNU tar extended sparse header, version 0.1. cSsg|] }t|qSr6)rF).0xr6r6r7 sz.TarInfo._proc_gnusparse_01..zGNU.sparse.map,Nr$r#)r3rkrlr)rr]rrr6r6r7rgszTarInfo._proc_gnusparse_01cCsd}g}|jjt}|jdd\}}t|}xJt||dkrvd|krV||jjt7}|jdd\}}|jt|q.W|jj|_t t |ddd|ddd|_ dS)z?Process a GNU tar extended sparse header, version 1.0. Nr<r#r$) rrZrr3rFr0rrrrkrlr)rr]rrZfieldsrrTZnumberr6r6r7ris  zTarInfo._proc_gnusparse_10c Csx|jD]\}}|dkr(t|d|q |dkrBt|dt|q |dkr\t|dt|q |tkr |tkryt||}Wntk rd}YnX|dkr|jd}t|||q W|j|_dS) zoReplace fields with supplemental information from a previous pax extended or global header. zGNU.sparse.namer%zGNU.sparse.sizer'zGNU.sparse.realsizerrN) rsetattrrF PAX_FIELDSPAX_NUMBER_FIELDSr.rKr r)rrr4r5r=rr6r6r7r\s"  zTarInfo._apply_pax_infoc Cs.y |j|dStk r(|j||SXdS)z1Decode a single field from a pax record. rCN)r;UnicodeDecodeError)rrr4Zfallback_encodingZfallback_errorsr6r6r7re,s zTarInfo._decode_pax_fieldcCs2|dkrtdt|t\}}|r*|d7}|tS)z_Round up a byte count by BLOCKSIZE and return it, e.g. _block(834) => 1024. rzinvalid offsetr#)rHrYr)rrGr`rar6r6r7r[4s zTarInfo._blockcCs |jtkS)N)r REGULAR_TYPES)rr6r6r7r@sz TarInfo.isregcCs|jS)N)r)rr6r6r7isfileBszTarInfo.isfilecCs |jtkS)N)rr)rr6r6r7rDsz TarInfo.isdircCs |jtkS)N)rSYMTYPE)rr6r6r7rFsz TarInfo.issymcCs |jtkS)N)rLNKTYPE)rr6r6r7rHsz TarInfo.islnkcCs |jtkS)N)rr6)rr6r6r7ischrJsz TarInfo.ischrcCs |jtkS)N)rr7)rr6r6r7isblkLsz TarInfo.isblkcCs |jtkS)N)rFIFOTYPE)rr6r6r7isfifoNszTarInfo.isfifocCs |jdk S)N)r)rr6r6r7issparsePszTarInfo.issparsecCs|jtttfkS)N)rr6r7r|)rr6r6r7isdevRsz TarInfo.isdevN)rrhr)r*r'r(rrrr+r,rrrrrrrrr)r)6rqrrrsrt __slots__rrrpropertyr%rrr&r r rrrr rrrr classmethodr2r staticmethodrr9r r-rRrTrSrYrUrVrXrhrgrir\rer[rrwrrrrzr{r}r~rr6r6r6r7rssf    1  *  3 ?  z c @seZdZdZdZdZdZdZeZ e Z dZ e ZeZdZdkdd Zedddefd d Zedld d ZedmddZednddZedoddZdddddZddZddZddZd d!Zdpd"d#Zdqdd%d&d'Z drdd(d)d*Z!dsd+d,Z"d-d.Z#dtddd0d1d2Z$d3d4Z%duddd0d6d7Z&d8d9Z'dvd:d;Z(dd?Z*d@dAZ+dwdddBdCdDZ,dEdFZ-dGdHZ.dIdJZ/dKdLZ0dMdNZ1dOdPZ2dQdRZ3dSdTZ4dUdVZ5dWdXZ6dYdZZ7dxd[d\Z8d]d^Z9dyd_d`Z:dadbZ;dcddZdidjZ?dS)zrz=The TarFile Class provides an interface to tar archives. rFr#NrzrcCsddddd}||krtd||_|||_|sj|jdkrVtjj| rVd|_d|_t||j}d |_n@|d krt|d rt |j t t fr|j }t|d r|j|_d |_|rtjj |nd |_ ||_|d k r||_|d k r||_|d k r||_|d k r||_|d k r||_| |_| d k r4|jtkr4| |_ni|_| d k rJ| |_| d k rZ| |_| |_d |_g|_d |_|jj|_i|_y|jdkrd |_ |j!|_ |jdkr8x|jj"|jy|jj#|}|jj$|WnTt%k r|jj"|jPYn0t&k r0}zt't |WYd d }~XnXqW|jdkrd |_|jr|jj(|jj)}|jj*||jt+|7_Wn&|js|jj,d |_YnXd S)aOpen an (uncompressed) tar archive `name'. `mode' is either 'r' to read from an existing archive, 'a' to append data to an existing file or 'w' to create a new file overwriting an existing one. `mode' defaults to 'r'. If `fileobj' is given, it is used for reading or writing data. If it can be determined, `mode' is overridden by `fileobj's mode. `fileobj' is not closed, when TarFile is closed. rbzr+bwbZxb)rzar{roz!mode must be 'r', 'a', 'w' or 'x'rr{FNrrhTrzro)rr{ro)-r.rh_moder}r%exists bltn_openrrr*rr,rLabspathrrPr dereference ignore_zerosr4r5rrdebug errorlevel copybufsizermembers_loadedrrinodes firstmemberr]rrTrrwr rr2r r[r0r)rrrhrrPrrrr4r5rrrrZmodeserTr6r6r7rrs             $   zTarFile.__init__c s| r| rtd|dkrfdd}xttj|dD]b}tj|}|dk r\|j} y||d|f|Sttfk r|dk r|j| w8Yq8Xq8Wtdnd |kr |jd d \} }| pd} |pd }|jkrtj|}n td |||| |f|Sd |kr|jd d \} }| p.d} |p8d }| dkrLtdt || |||} y|| | f|} Wn| j YnXd| _ | S|dkrj |||f|StddS)aOpen a tar archive for reading, writing or appending. Return an appropriate TarFile class. mode: 'r' or 'r:*' open for reading with transparent compression 'r:' open for reading exclusively uncompressed 'r:gz' open for reading with gzip compression 'r:bz2' open for reading with bzip2 compression 'r:xz' open for reading with lzma compression 'a' or 'a:' open for appending, creating the file if necessary 'w' or 'w:' open for writing without compression 'w:gz' open for writing with gzip compression 'w:bz2' open for writing with bzip2 compression 'w:xz' open for writing with lzma compression 'x' or 'x:' create a tarfile exclusively without compression, raise an exception if the file is already created 'x:gz' create a gzip compressed tarfile, raise an exception if the file is already created 'x:bz2' create a bzip2 compressed tarfile, raise an exception if the file is already created 'x:xz' create an lzma compressed tarfile, raise an exception if the file is already created 'r|*' open a stream of tar blocks with transparent compression 'r|' open an uncompressed stream of tar blocks for reading 'r|gz' open a gzip compressed stream of tar blocks 'r|bz2' open a bzip2 compressed stream of tar blocks 'r|xz' open an lzma compressed stream of tar blocks 'w|' open an uncompressed stream for writing 'w|gz' open a gzip compressed stream for writing 'w|bz2' open a bzip2 compressed stream for writing 'w|xz' open an lzma compressed stream for writing znothing to openrzr:*csj|dkS)Ntaropen) OPEN_METH)r)r1r6r7not_compressed sz$TarFile.open..not_compressed)keyNz%file could not be opened successfully:r#rzunknown compression type %r|r{zmode must be 'r' or 'w'Frrozundiscernible mode)rzr)rzr{)rr{ro) r.sortedrrlrrrrr3rrrr) r1rrhrr_kwargsrrfuncZ saved_posrgstreamrr6)r1r7rsP%             z TarFile.opencKs |dkrtd||||f|S)zCOpen uncompressed tar archive name for reading or writing. rzrr{roz!mode must be 'r', 'a', 'w' or 'x')rzrr{ro)r.)r1rrhrrr6r6r7r<szTarFile.taropenrcKs|d krtdyddl}|jWn ttfk rBtdYnXy|j||d||}Wn.tk r|dk r|dkrtd YnXy|j|||f|}WnBtk r|j |dkrtd Yn|j YnXd |_ |S) zkOpen gzip compressed tar archive name for reading or writing. Appending is not allowed. rzr{rozmode must be 'r', 'w' or 'x'rNzgzip module is not availablerbznot a gzip fileF)rzr{ro) r.gzipZGzipFilerAttributeErrorrrrrrr)r1rrhr compresslevelrrrr6r6r7gzopenDs2 zTarFile.gzopencKs|d krtdy ddl}Wntk r8tdYnX|j|pD|||d}y|j|||f|}WnFttfk r|j|dkrt d Yn|jYnXd |_ |S) zlOpen bzip2 compressed tar archive name for reading or writing. Appending is not allowed. rzr{rozmode must be 'r', 'w' or 'x'rNzbz2 module is not available)rznot a bzip2 fileF)rzr{ro) r.rrrZBZ2FilerrEOFErrorrrr)r1rrhrrrrrr6r6r7bz2openfs(  zTarFile.bz2opencKs|d krtdy ddl}Wntk r8tdYnX|j|pD|||d}y|j|||f|}WnH|jtfk r|j|dkrt d Yn|jYnXd |_ |S) zkOpen lzma compressed tar archive name for reading or writing. Appending is not allowed. rzr{rozmode must be 'r', 'w' or 'x'rNzlzma module is not available)presetznot an lzma fileF)rzr{ro) r.rrrZLZMAFilerrrrrr)r1rrhrrrrrr6r6r7xzopens& zTarFile.xzopenrrrr)rrrrc Cs|jr dSd|_z`|jdkrn|jjttd|jtd7_t|jt\}}|dkrn|jjtt|Wd|j s|jj XdS) zlClose the TarFile. In write-mode, two finishing zero blocks are appended to the archive. NTrr{ror$r)rr{ro) rrhrr[r1rrrY RECORDSIZErr)rr`rar6r6r7rs z TarFile.closecCs"|j|}|dkrtd||S)aReturn a TarInfo object for member `name'. If `name' can not be found in the archive, KeyError is raised. If a member occurs more than once in the archive, its last occurrence is assumed to be the most up-to-date version. Nzfilename %r not found) _getmemberKeyError)rrrr6r6r7 getmembers  zTarFile.getmembercCs|j|js|j|jS)zReturn the members of the archive as a list of TarInfo objects. The list has the same order as the members in the archive. )_checkr_loadr)rr6r6r7 getmembersszTarFile.getmemberscCsdd|jDS)zReturn the members of the archive as a list of their names. It has the same order as the list returned by getmembers(). cSsg|] }|jqSr6)r)rnrr6r6r7rpsz$TarFile.getnames..)r)rr6r6r7getnamesszTarFile.getnamesc Csp|jd|dk r|j}|dkr$|}tjj|\}}|jtjd}|jd}|j}||_ |dkrt tdr|j rtj |}qtj |}ntj|j}d}|j}t j|r|j|jf} |j r|jdkr| |jkr||j| krt} |j| }nt} | drx||j| <nht j|r"t} nVt j|r4t} nDt j|rPt} tj|}n(t j|rbt } nt j!|rtt"} ndS||_||_#|j$|_%|j&|_'| tkr|j(|_)nd|_)|j*|_+| |_,||_-t.ryt.j/|j%d|_0Wnt1k rYnXt2r*yt2j3|j'd|_4Wnt1k r(YnX| t t"fkrlt tdrlt td rltj5|j6|_7tj8|j6|_9|S) aCreate a TarInfo object from the result of os.stat or equivalent on an existing file. The file is either named by `name', or specified as a file object `fileobj' with a file descriptor. If given, `arcname' specifies an alternative name for the file in the archive, otherwise, the name is taken from the 'name' attribute of 'fileobj', or the 'name' argument. The name should be a text string. awxNrlstatrr#rmajorminor):rrr}r% splitdriverrrrrrrrrffstatfilenost_modeS_ISREGst_inost_devst_nlinkrryrS_ISDIRrS_ISFIFOr|S_ISLNKrxreadlinkS_ISCHRr6S_ISBLKr7rhst_uidr)st_gidr*st_sizer'st_mtimer(rrpwdgetpwuidr+rgrpZgetgrgidr,rst_rdevrrr) rrarcnamerZdrvrZstatresrZstmdinoderr6r6r7 gettarinfos~                 zTarFile.gettarinfoT)rcCs0|j|dkr|}x|D] }|r|jdkr:tdnttj|jtd|jpX|j|jpb|jf|j sz|j rtdd|j |j fntd|j |jdkrtdntdtj|jdd t|j|jrd nd |r"|jr td |j|jr"td |jtqWdS)aPrint a table of contents to sys.stdout. If `verbose' is False, only the names of the members are printed. If it is True, an `ls -l'-like output is produced. `members' is optional and must be a subset of the list returned by getmembers(). Nz ??????????z%s/%sz%10sz%d,%dz%10dz????-??-?? ??:??:??z%d-%02d-%02d %02d:%02d:%02drrrz-> zlink to )rrhrprfrgr+r)r,r*rzr{rrr'r(rZ localtimerrrrrro)rverboserrr6r6r7rk>s2      z TarFile.list)filterc Csv|jd|dkr|}|dk rPddl}|jdtd||rP|jdd|dS|jdk rtjj||jkr|jdd|dS|jd||j ||}|dkr|jdd |dS|dk r||}|dkr|jdd|dS|j rt |d }|j ||WdQRXnd|j rh|j ||rrxHtj|D].}|jtjj||tjj|||||d q4Wn |j |dS) a~Add the file `name' to the archive. `name' may be any type of file (directory, fifo, symbolic link, etc.). If given, `arcname' specifies an alternative name for the file in the archive. Directories are added recursively by default. This can be avoided by setting `recursive' to False. `exclude' is a function that should return True for each filename to be excluded. `filter' is a function that expects a TarInfo object argument and returns the changed TarInfo object, if it returns None the TarInfo object will be excluded from the archive. rNrzuse the filter argument insteadr$ztarfile: Excluded %rztarfile: Skipped %rr#ztarfile: Unsupported type %rr)r)rrcrdre_dbgrr}r%rrrraddfilerlistdiraddr) rrr recursiveZexcluderrcrfr6r6r7rdsB       z TarFile.addcCs|jdtj|}|j|j|j|j}|jj||jt |7_|j }|dk rt ||j|j |dt |j t\}}|dkr|jjtt||d7}|j|t7_|jj|dS)aAdd the TarInfo object `tarinfo' to the archive. If `fileobj' is given, it should be a binary file, and tarinfo.size bytes are read from it and added to the archive. You can create TarInfo objects directly, or by using gettarinfo(). rN)r_rr#)rr rrPr4r5rr[rr0rrXr'rYrr1rr)rrrrTr_r`rar6r6r7rs   zTarFile.addfilec"CsH|dkr|j}|dkrtjjd}|dkry tt}Wntk rNYnBXddl}|jddd}||j |WdQRX|jdddd}|ry t |}Wn&t k rt d|d dYnX||_|St rtjdttStSt|trtd|St|r|Syt |St k rBt d|d dYnXdS)NZ PYTHON_TARFILE_EXTRACTION_FILTERr#)Z interpolationZcomment_prefixesrr)Zfallbackzfilter z not foundz4The default behavior of tarfile extraction has been z$changed to disallow common exploits z(including CVE-2007-4559). z1By default, absolute/parent paths are disallowed z and some mode bits are cleared. z/See https://access.redhat.com/articles/7004769 zfor more details.z#String names are not supported for z2TarFile.extraction_filter. Use a function such as ztarfile.data_filter directly.)rzXThe default behavior of tarfile extraction has been changed to disallow common exploits zsThe default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). zThe default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). By default, absolute/parent paths are disallowed zThe default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). By default, absolute/parent paths are disallowed and some mode bits are cleared. zThe default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). By default, absolute/parent paths are disallowed and some mode bits are cleared. See https://access.redhat.com/articles/7004769 aThe default behavior of tarfile extraction has been changed to disallow common exploits (including CVE-2007-4559). By default, absolute/parent paths are disallowed and some mode bits are cleared. See https://access.redhat.com/articles/7004769 for more details.zUString names are not supported for TarFile.extraction_filter. Use a function such as zrString names are not supported for TarFile.extraction_filter. Use a function such as tarfile.data_filter directly.)extraction_filterr}environr5r_CONFIG_FILENAMEFileNotFoundError configparserZ ConfigParserZ read_file_NAMED_FILTERSrr._RH_SAFER_DEFAULTrcrdRuntimeWarningrrr*r, TypeErrorcallable)rrrfilerZconfr6r6r7_get_filter_functionsR       zTarFile._get_filter_function.) numeric_ownerrc"Csg}|j|}|dkr|}xT|D]L}|j|||\}} |dkr@q |jrR|j| |j|||j ||dq W|jddddx$|D]} yy|| |}Wn4tk r} z|j| t| wWYdd} ~ XnX|dkr|j| dwt j j ||j } yt j | } Wn$tk r.|j|dwYnXtj| jsL|j|d w|j|| |d |j|| |j|| Wqtk r} z|j| WYdd} ~ XqXqWdS) aExtract all members from the archive to the current working directory and set owner, modification time and permissions on directories afterwards. `path' specifies a different directory to extract to. `members' is optional and must be a subset of the list returned by getmembers(). If `numeric_owner` is True, only the numbers for user/group names are used and not the names. The `filter` function will be called on each member just before extraction. It can return a changed TarInfo or None to skip the member. String names of common filters are accepted. N) set_attrsrfilter_functioncSs|jS)N)r)rr6r6r7 sz$TarFile.extractall..T)rreversezexcluded by filterZmissingznot a directory)r)r_get_extract_tarinforr _extract_onesort_FILTER_ERRORS_log_no_directory_fixupreprr}r%rrrrrfrrchownutimechmodr _handle_nonfatal_error)rr%rrrZ directoriesrrr unfilteredexcdirpathrrr6r6r7 extractallsP       zTarFile.extractallcCs|jdd|j|fdS)Nr$z(tarfile: Not fixing up directory %r (%s))rr)rrreasonr6r6r7r4 szTarFile._log_no_directory_fixuprc Cs8|j|}|j|||\}}|dk r4|j||||dS)aExtract a member from the archive to the current working directory, using its full name. Its file information is extracted as accurately as possible. `member' may be a filename or a TarInfo object. You can specify a different directory using `path'. File attributes (owner, mtime, mode) are set unless `set_attrs' is False. If `numeric_owner` is True, only the numbers for user/group names are used and not the names. The `filter` function will be called before extraction. It can return a changed TarInfo or None to skip the member. String names of common filters are accepted. N)rrr) rrr%rrrrrrr6r6r7extract8 s  zTarFile.extractcCst|tr|j|}n|}d}y|||}WnZttfk r\}z|j|WYdd}~Xn,tk r}z|j|WYdd}~XnX|dkr|jdd|j dS|j rt j |}t j j||j|_||fS)zGet (filtered, unfiltered) TarInfos from *member* *member* might be a string. Return (None, None) if not found. Nr$ztarfile: Excluded %r)NN)r*r,rrr_handle_fatal_errorr rrrrr r}r%rrr)rrrr%rfilteredrr6r6r7rL s"   zTarFile._get_extract_tarinfocCs|jdy&|j|tjj||j||||dWnVtk r\}z|j|WYdd}~Xn,tk r}z|j |WYdd}~XnXdS)zExtract from filtered tarinfo to disk. filter_function is only used when extracting a *different* member (e.g. as fallback to creating a symlink) rz)rrrextraction_rootN) r_extract_memberr}r%rrrrr r)rrr%rrrrr6r6r7rj s  zTarFile._extract_onecCs"|jdkrn|jdd|dS)z=Handle non-fatal error (ExtractError) according to errorlevelr#z tarfile: %sN)rr)rrr6r6r7r~ s zTarFile._handle_nonfatal_errorcCsn|jdkrn\t|trP|jdkr6|jdd|jqj|jdd|j|jfn|jddt|j|fdS)z1Handle "fatal" error according to self.errorlevelrNr#z tarfile: %sztarfile: %s %rztarfile: %s %s)rr*rfilenamerstrerrorrrq)rrr6r6r7r s   zTarFile._handle_fatal_errorcCs|jdt|tr |j|}n|}|js6|jtkrB|j||S|jsR|j rzt|j t rht dq~|j |j|SndSdS)zExtract a member from the archive as a file object. `member' may be a filename or a TarInfo object. If `member' is a regular file or a link, an io.BufferedReader object is returned. Otherwise, None is returned. rzz'cannot extract (sym)link as file objectN)rr*r,rrrrZ fileobjectrrrrr extractfile_find_link_target)rrrr6r6r7r s      zTarFile.extractfile)rrcCs\|jd}|jdtj}tjj|}|r@tjj| r@tj||jsP|j rj|j dd|j |j fn|j d|j |j r|j||n|jr|j||n~|jr|j||nh|js|jr|j||nJ|js|j r|j||||dn&|jtkr|j||n |j|||rX|j||||j sX|j|||j||dS)zExtract the filtered TarInfo object tarinfo to a physical file called targetpath. filter_function is only used when extracting a *different* member (e.g. as fallback to creating a symlink) rr#z%s -> %s)rrN)rKrr}rr%rrmakedirsrrrrrrmakefilermakedirr}makefiforzr{makedevmakelink_with_filterrrZ makeunknownrrr)rr targetpathrrrrZ upperdirsr6r6r7r s:        zTarFile._extract_memberc Cs@y&|jdkrtj|n tj|dWntk r:YnXdS)z,Make a directory called targetpath. Ni)rhr}mkdirFileExistsError)rrrr6r6r7r s   zTarFile.makedircCs|j}|j|j|j}t|df}|jdk rrx,|jD]"\}}|j|t|||t|q6W|j|j|j nt|||jt|WdQRXdS)z'Make a file called targetpath. rN) rrrrrrrXrr'truncate)rrrsourcer_targetrr'r6r6r7r s      zTarFile.makefilecCs"|j|||jdd|jdS)zYMake a file from a TarInfo object with an unknown type at targetpath. r#z9tarfile: Unknown file type %r, extracted as regular file.N)rrr)rrrr6r6r7r s zTarFile.makeunknowncCs"ttdrtj|ntddS)z'Make a fifo called targetpath. mkfifozfifo not supported by systemN)rr}rr )rrrr6r6r7r s  zTarFile.makefifocCsnttd sttd r td|j}|dkr2d}|jrF|tjO}n |tjO}tj||tj |j |j dS)zzFilter for extraction)metavarchoicesr/z-lz--list zShow listing of a tarfile)r0r/z-ez --extract+ zExtract tarfile into target dir)nargsr0r/z-cz--createzCreate tarfile from sourcesz-tz--testzTest if a tarfile is validr#z&--filter is only valid for extraction rz)rz{!r} is a tar archive.z{!r} is not a tar archive. zr:*)rr$)r%rrz{!r} file is extracted.z+{!r} file is extracted into {!r} directory.rrr)z.gzz.tgzz.xzz.txzz.bz2z.tbzz.tbz2z.tb2zw:r{z{!r} file created.)r2r4)r6r7)argparseArgumentParser add_argumentrZadd_mutually_exclusive_group parse_argsrrexitZtestrrrrormr%rrPrkrr0r}curdirZ format_helprZcreatepopr%splitextr)r8r+parserrcargsr\rZtfr=r'Ztar_namermZextZ compressionsZtar_modeZ tar_files file_namer6r6r7main` s                  rC__main__)r%r&r'r(r)r*r+r,)T)trtversion __author__Z__date__Z __cvsid__ __credits__builtinsrrrmr}rrWrfrrSr rercrrrrNotImplementedErrorrr NameError__all__rrr1rrrrrrr4rrHryrxr6r7rr|ZCONTTYPEr"r!rIr.r0rWr rrrrZrvrLrsrfr+rFrtrr getfilesystemencodingr8r=rKrQrUrXrgrp Exceptionrr rrr r rurvrwrHrxryrobjectrrBufferedReaderrrrrrrrrrrrrrrr compilerarrrrCrqr6r6r6r7s&         wh   D h b string.cpython-36.opt-1.pyc000064400000017436152462730460011463 0ustar003 \. @sdZddddddddd d d d g Zd dlZdZdZdZeeZdZeddZdZ dZ eee eZ dddZ d dl Zd dlmZGdddeZGdd d edZGdd d ZdS)anA collection of string constants. Public module variables: whitespace -- a string containing all ASCII whitespace ascii_lowercase -- a string containing all ASCII lowercase letters ascii_uppercase -- a string containing all ASCII uppercase letters ascii_letters -- a string containing all ASCII letters digits -- a string containing all ASCII decimal digits hexdigits -- a string containing all ASCII hexadecimal digits octdigits -- a string containing all ASCII octal digits punctuation -- a string containing all ASCII punctuation characters printable -- a string containing all ASCII characters considered printable ascii_lettersascii_lowercaseascii_uppercasecapwordsdigits hexdigits octdigits printable punctuation whitespace FormatterTemplateNz ZabcdefghijklmnopqrstuvwxyzZABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789ZabcdefZABCDEFZ01234567z !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~cCs|pdjdd|j|DS)acapwords(s [,sep]) -> string Split the argument into words using split, capitalize each word using capitalize, and join the capitalized words using join. If the optional second argument sep is absent or None, runs of whitespace characters are replaced by a single space and leading and trailing whitespace are removed, otherwise sep is used to split and join the words.  css|]}|jVqdS)N) capitalize).0xr/usr/lib64/python3.6/string.py 0szcapwords..)joinsplit)sseprrrr%s )ChainMapcs eZdZdZfddZZS)_TemplateMetaclassa/ %(delim)s(?: (?P%(delim)s) | # Escape sequence of two delimiters (?P%(id)s) | # delimiter and a Python identifier {(?P%(id)s)} | # delimiter and a braced identifier (?P) # Other ill-formed delimiter exprs ) csXtt|j|||d|kr$|j}ntjtj|j|jd}tj||j tj B|_dS)Npattern)Zdelimid) superr__init__r_reescape delimiter idpatterncompileflagsVERBOSE)clsnamebasesZdctr) __class__rrrAs  z_TemplateMetaclass.__init__)__name__ __module__ __qualname__rr __classcell__rr)r*rr7src@s>eZdZdZdZdZejZddZ ddZ dd Z d d Z d S) r z.A string class for supporting $-substitutions.$z(?-i:[_a-zA-Z][_a-zA-Z0-9]*)cCs ||_dS)N)template)selfr0rrrrXszTemplate.__init__cCsd|jd}|jd|jdd}|s.d}d}n"|tdj|dd}t|}td||fdS)NinvalidT)keependsz.Invalid placeholder in string: line %d, col %d)startr0 splitlineslenr ValueError)r1moilinescolnolinenorrr_invalid]s zTemplate._invalidcsl|s td|^}t|dkr(td|s2|n|rFt||dn|dfdd}jj|jS)Nz>descriptor 'substitute' of 'Template' object needs an argumentr4zToo many positional argumentsr csd|jdp|jd}|dk r(t|S|jddk r<jS|jddk rTj|tdjdS)Nnamedbracedescapedr2z#Unrecognized named group in pattern)groupstrr"r@r:r)r;rA)mappingr1rrconvertws  z$Template.substitute..convert) TypeErrorr9 _ChainMaprsubr0)argskwsrGr)rFr1r substituteis  zTemplate.substitutecsl|s td|^}t|dkr(td|s2|n|rFt||dn|dfdd}jj|jS)NzCdescriptor 'safe_substitute' of 'Template' object needs an argumentr4zToo many positional argumentsr c s||jdp|jd}|dk rBy t|Stk r@|jSX|jddk rVjS|jddk rl|jStdjdS)NrArBrCr2z#Unrecognized named group in pattern)rDrEKeyErrorr"r:r)r;rA)rFr1rrrGs  z)Template.safe_substitute..convert)rHr9rIrrJr0)rKrLrGr)rFr1rsafe_substitutes  zTemplate.safe_substituteN) r+r,r-__doc__r"r#r IGNORECASEr%rr@rMrOrrrrr Ms ) metaclassc@sVeZdZddZddZdddZdd Zd d Zd d ZddZ ddZ ddZ dS)r c Osz|s td|^}}y |^}}WnJtk rjd|kr\|jd}ddl}|jdtddn tddYnX|j|||S)Nz;descriptor 'format' of 'Formatter' object needs an argument format_stringr z9Passing 'format_string' as keyword argument is deprecated) stacklevelz@format() missing 1 required positional argument: 'format_string')rHr:popwarningswarnDeprecationWarningvformat)rKkwargsr1rSrWrrrformats    zFormatter.formatcCs.t}|j||||d\}}|j||||S)NrT)set_vformatcheck_unused_args)r1rSrKr[ used_argsresult_rrrrZszFormatter.vformatr c Cs|dkrtdg}x|j|D]\}} } } |r:|j|| dk r | dkrl|dkrZtdt|} |d7}n| jr|rtdd}|j| ||\} } |j| |j| | } |j| ||||d|d\} }|j|j | | q Wdj ||fS)Nr zMax string recursion exceededr5FzJcannot switch from manual field specification to automatic field numberingr4)auto_arg_index) r:parseappendrEisdigit get_fieldadd convert_fieldr^ format_fieldr)r1rSrKr[r`Zrecursion_depthrcraZ literal_text field_name format_spec conversionobjZarg_usedrrrr^s4     zFormatter._vformatcCst|tr||S||SdS)N) isinstanceint)r1keyrKr[rrr get_values zFormatter.get_valuecCsdS)Nr)r1r`rKr[rrrr_szFormatter.check_unused_argscCs t||S)N)r\)r1valuerlrrrrjszFormatter.format_fieldcCsN|dkr |S|dkrt|S|dkr,t|S|dkrs&     `tracemalloc.cpython-36.pyc000064400000041517152462730460011501 0ustar003 \A@sddlmZmZddlmZddlZddlZddlZddl Z ddl Tddl m Z m Z ddZ Gdd d ZGd d d Zd d ZeGdddZeGdddeZddZGdddZGdddeZddZGdddZGdddeZGdddeZGd d!d!Zd"d#ZdS)$)SequenceIterable)total_orderingN)*)_get_object_traceback _get_tracescCszxtd D]l}t|dkr:|dkr:|r.d||fSd||fSt|dksN|dkrj|r^d ||fSd ||fS|d }qWdS)NBKiBMiBGiBTiBdz%+.1f %sz%.1f %s iz%+.0f %sz%.0f %s)rr r r r i()abs)sizeZsignZunitr#/usr/lib64/python3.6/tracemalloc.py _format_size s     rc@sDeZdZdZdZddZddZd d Zd d Zd dZ ddZ dS) StatisticzS Statistic difference on memory allocations between two Snapshot instance. tracebackrcountcCs||_||_||_dS)N)rrr)selfrrrrrr__init__%szStatistic.__init__cCst|j|j|jfS)N)hashrrr)rrrr__hash__*szStatistic.__hash__cCs$|j|jko"|j|jko"|j|jkS)N)rrr)rotherrrr__eq__-s  zStatistic.__eq__cCsBd|jt|jd|jf}|jr>|j|j}|dt|d7}|S)Nz%s: size=%s, count=%iFz , average=%s)rrrr)rtextaveragerrr__str__2s   zStatistic.__str__cCsd|j|j|jfS)Nz))rrr)rrrr__repr__<szStatistic.__repr__cCs|j|j|jfS)N)rrr)rrrr _sort_key@szStatistic._sort_keyN)rrr) __name__ __module__ __qualname____doc__ __slots__rrrrr r!rrrrrs rc@sDeZdZdZdZddZd d Zd d Zd dZddZ ddZ dS) StatisticDiffzd Statistic difference on memory allocations between an old and a new Snapshot instance. rr size_diffr count_diffcCs"||_||_||_||_||_dS)N)rrr(rr))rrrr(rr)rrrrKs zStatisticDiff.__init__cCst|j|j|j|j|jfS)N)rrrr(rr))rrrrrRszStatisticDiff.__hash__cCs<|j|jko:|j|jko:|j|jko:|j|jko:|j|jkS)N)rrr(rr))rrrrrrVs     zStatisticDiff.__eq__cCsPd|jt|jdt|jd|j|jf}|jrL|j|j}|dt|d7}|S)Nz %s: size=%s (%s), count=%i (%+i)FTz , average=%s)rrrr(rr))rrrrrrr]s    zStatisticDiff.__str__cCsd|j|j|j|j|jfS)Nz9)rrr(rr))rrrrr is zStatisticDiff.__repr__cCs t|j|jt|j|j|jfS)N)rr(rr)rr)rrrrr!ns  zStatisticDiff._sort_keyN)rrr(rr)) r"r#r$r%r&rrrrr r!rrrrr'Ds r'cCsg}xp|jD]d\}}|j|d}|dk rPt||j|j|j|j|j|j}nt||j|j|j|j}|j|qWx6|jD]*\}}t|d|j d|j }|j|qW|S)Nr)itemspopr'rrappend) old_group new_group statisticsrstatZpreviousrrr_compare_grouped_statsts  r1c@s\eZdZdZdZddZeddZeddZd d Z d d Z d dZ ddZ ddZ dS)Framez Frame of a traceback. _framecCs ||_dS)N)r3)rframerrrrszFrame.__init__cCs |jdS)Nr)r3)rrrrfilenameszFrame.filenamecCs |jdS)N)r3)rrrrlinenosz Frame.linenocCs |j|jkS)N)r3)rrrrrrsz Frame.__eq__cCs |j|jkS)N)r3)rrrrr__lt__sz Frame.__lt__cCs t|jS)N)rr3)rrrrrszFrame.__hash__cCsd|j|jfS)Nz%s:%s)r5r7)rrrrrsz Frame.__str__cCsd|j|jfS)Nz)r5r7)rrrrr szFrame.__repr__N)r3)r"r#r$r%r&rpropertyr5r7rr8rrr rrrrr2s  r2c@sfeZdZdZdZddZddZddZd d Zd d Z d dZ ddZ ddZ ddZ dddZdS) Tracebackz` Sequence of Frame instances sorted from the most recent frame to the oldest frame. _framescCstj|||_dS)N)rrr;)rframesrrrrs zTraceback.__init__cCs t|jS)N)lenr;)rrrr__len__szTraceback.__len__cCs4t|tr"tdd|j|DSt|j|SdS)Ncss|]}t|VqdS)N)r2).0tracerrr sz(Traceback.__getitem__..) isinstanceslicetupler;r2)rindexrrr __getitem__s zTraceback.__getitem__cCs |j|jkS)N)r3r;)rr4rrr __contains__szTraceback.__contains__cCs t|jS)N)rr;)rrrrrszTraceback.__hash__cCs |j|jkS)N)r;)rrrrrrszTraceback.__eq__cCs |j|jkS)N)r;)rrrrrr8szTraceback.__lt__cCs t|dS)Nr)str)rrrrrszTraceback.__str__cCsdt|fS)Nz)rD)rrrrr szTraceback.__repr__NcCsng}|dk r|dkr|SxP|d|D]@}|jd|j|jftj|j|jj}|r&|jd|q&W|S)Nrz File "%s", line %sz %s)r,r5r7 linecachegetlinestrip)rlimitlinesr4linerrrformatszTraceback.format)r;)N)r"r#r$r%r&rr>rFrGrrr8rr rOrrrrr:sr:cCs t|}|dk rt|SdSdS)z Get the traceback where the Python object *obj* was allocated. Return a Traceback instance. Return None if the tracemalloc module is not tracing memory allocations or did not trace the allocation of the object. N)rr:)objr<rrrget_object_tracebacksrQc@s`eZdZdZdZddZeddZeddZed d Z d d Z d dZ ddZ ddZ dS)Tracez" Trace of a memory block. _tracecCs ||_dS)N)rS)rr@rrrrszTrace.__init__cCs |jdS)Nr)rS)rrrrdomainsz Trace.domaincCs |jdS)Nr6)rS)rrrrrsz Trace.sizecCst|jdS)N)r:rS)rrrrrszTrace.tracebackcCs |j|jkS)N)rS)rrrrrrsz Trace.__eq__cCs t|jS)N)rrS)rrrrr szTrace.__hash__cCsd|jt|jdfS)Nz%s: %sF)rrr)rrrrr sz Trace.__str__cCsd|jt|jd|jfS)Nz'F)rTrrr)rrrrr szTrace.__repr__N)rS)r"r#r$r%r&rr9rTrrrrrr rrrrrRs   rRc@s<eZdZddZddZddZddZd d Zd d Zd S)_TracescCstj|||_dS)N)rr_traces)rtracesrrrrs z_Traces.__init__cCs t|jS)N)r=rW)rrrrr>sz_Traces.__len__cCs4t|tr"tdd|j|DSt|j|SdS)Ncss|]}t|VqdS)N)rR)r?r@rrrrA sz&_Traces.__getitem__..)rBrCrDrWrR)rrErrrrFs z_Traces.__getitem__cCs |j|jkS)N)rSrW)rr@rrrrG$sz_Traces.__contains__cCs |j|jkS)N)rW)rrrrrr'sz_Traces.__eq__cCs dt|S)Nz)r=)rrrrr *sz_Traces.__repr__N) r"r#r$rr>rFrGrr rrrrrVs rVcCs&tjj|}|jdr"|dd}|S)Nz.pycr6)ospathnormcaseendswith)r5rrr_normalize_filename.s   r^c@seZdZddZddZdS) BaseFiltercCs ||_dS)N) inclusive)rr`rrrr6szBaseFilter.__init__cCstdS)N)NotImplementedError)rr@rrr_match9szBaseFilter._matchN)r"r#r$rrbrrrrr_5sr_csJeZdZdfdd ZeddZddZd d Zd d Zd dZ Z S)FilterNFcs2tj|||_t||_||_||_||_dS)N)superrr`r^_filename_patternr7 all_framesrT)rr`filename_patternr7rfrT) __class__rrr>s   zFilter.__init__cCs|jS)N)re)rrrrrgGszFilter.filename_patterncCs6t|}tj||jsdS|jdkr(dS||jkSdS)NFT)r^fnmatchrer7)rr5r7rrr_match_frame_implKs  zFilter._match_frame_implcCs|j|||j AS)N)rjr`)rr5r7rrr _match_frameTszFilter._match_framecsHjr,tfdd|Dr"jSj Sn|d\}}j||SdS)Nc3s|]\}}j||VqdS)N)rj)r?r5r7)rrrrAYsz*Filter._match_traceback..r)rfanyr`rk)rrr5r7r)rr_match_tracebackWs    zFilter._match_tracebackcCsD|\}}}|j|}|jdk r@|jr2|o0||jkS|p>||jkS|S)N)rmrTr`)rr@rTrrresrrrrbbs   z Filter._match)NFN) r"r#r$rr9rgrjrkrmrb __classcell__rr)rhrrc=s    rccs0eZdZfddZeddZddZZS) DomainFiltercstj|||_dS)N)rdr_domain)rr`rT)rhrrrns zDomainFilter.__init__cCs|jS)N)rq)rrrrrTrszDomainFilter.domaincCs|\}}}||jk|j AS)N)rTr`)rr@rTrrrrrrbvs zDomainFilter._match)r"r#r$rr9rTrbrorr)rhrrpms  rpc@sXeZdZdZddZddZeddZdd Zd d Z d d Z dddZ dddZ dS)SnapshotzB Snapshot of traces of memory blocks allocated by Python. cCst||_||_dS)N)rVrXtraceback_limit)rrXrsrrrrs zSnapshot.__init__c Cs*t|d}tj||tjWdQRXdS)z1 Write the snapshot into a file. wbN)openpickledumpZHIGHEST_PROTOCOL)rr5fprrrrws z Snapshot.dumpc Cs t|d }tj|SQRXdS)z. Load a snapshot from a file. rbN)rurvload)r5rxrrrrzs z Snapshot.loadcs@|rtfdd|DsdS|r.Fc3s|]}|j VqdS)N)rb)r?r{)r@rrrAsT)rl)rinclude_filtersexclude_filtersr@r)r@r _filter_traces    zSnapshot._filter_tracecst|tstdt|j|rnggx(|D] }|jrDj|q.j|q.WfddjjD}n jjj }t |j S)z Create a new Snapshot instance with a filtered traces sequence, filters is a list of Filter or DomainFilter instances. If filters is an empty list, return a new Snapshot instance with a copy of the traces. z)filters must be a list of filters, not %scsg|]}j|r|qSr)r~)r?r@)r}r|rrr sz*Snapshot.filter_traces..) rBr TypeErrortyper"r`r,rXrWcopyrrrs)rfiltersr{Z new_tracesr)r}r|rr filter_tracess    zSnapshot.filter_tracesc Cs|dkrtd|f|r.|d kr.td|i}i}|sx|jjD]}|\}}}y ||} WnZtk r|dkr~|} n(|dkr|dd} n|dddff} t| } | ||<YnXy(|| } | j|7_| jd7_WqFtk r t| |d|| <YqFXqFWnx|jjD]}|\}}}x|D]} y || } WnFtk r|dkrd| f} n| ddff} t| } | || <YnXy(|| } | j|7_| jd7_Wn&tk rt| |d|| <YnXq0WqW|S) Nrr5r7zunknown key_type: %rz/cumulative mode cannot by used with key type %rr6r)rr5r7)r7r5) ValueErrorrXrWKeyErrorr:rrr) rkey_type cumulativeZstatsZ tracebacksr@rTrZtrace_tracebackrr<r0r4rrr _group_bysX       "zSnapshot._group_byFcCs,|j||}t|j}|jdtjd|S)zd Group statistics by key_type. Return a sorted list of Statistic instances. T)reversekey)rlistvaluessortrr!)rrrZgroupedr/rrrr/s  zSnapshot.statisticscCs6|j||}|j||}t||}|jdtjd|S)z Compute the differences with an old snapshot old_snapshot. Get statistics as a sorted list of StatisticDiff instances, grouped by group_by. T)rr)rr1rr'r!)rZ old_snapshotrrr.r-r/rrr compare_tos    zSnapshot.compare_toN)F)F) r"r#r$r%rrw staticmethodrzr~rrr/rrrrrrr{s  3 rrcCs$tstdt}t}t||S)zI Take a snapshot of traces of memory blocks allocated by Python. zLthe tracemalloc module must be tracing memory allocations to take a snapshot)Z is_tracing RuntimeErrorrZget_traceback_limitrr)rXrsrrr take_snapshots r) collectionsrr functoolsrrirIZos.pathrZrvZ _tracemallocrrrrr'r1r2r:rQrRrVr^r_rcrprrrrrrrs0 &0# 5%0 struct.cpython-36.opt-2.pyc000064400000000472152462730460011472 0ustar003 \@s8ddddddddgZdd lTdd lmZdd lmZd S) ZcalcsizeZpackZ pack_intoZunpackZ unpack_fromZ iter_unpackZStructerror)*) _clearcache)__doc__N)__all__Z_structrrrr/usr/lib64/python3.6/struct.pys  pkgutil.cpython-36.opt-1.pyc000064400000037607152462730460011636 0ustar003 \CS @sxdZddlmZddlmZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z ddlZdddd d d d d ddddg ZeddZde_ddZddZd+dd Zd,dd Zed-ddZd.ddZejejjeddZGd d d ZGd!ddZy.ddlZdd"lmZd/d#d$ZejeeWne k r@YnXd%dZ!d0d&dZ"d'dZ#d(d Z$d)dZ%d*d Z&dS)1zUtilities to support packages.) namedtuple)singledispatchN) ModuleType get_importeriter_importers get_loader find_loader walk_packages iter_modulesget_data ImpImporter ImpLoader read_code extend_path ModuleInfozmodule_finder name ispkgz.A namedtuple with minimal info about a module.c CsLy |j}Wn4tk r>|j|}|dkr0dStjj||SX||SdS)z'Return the finder-specific module spec.N) find_specAttributeError find_module importlibutilspec_from_loader)findernamerloaderr/usr/lib64/python3.6/pkgutil.py _get_specs  rcCs6ddl}|jd}|tjjkr"dS|jd|j|S)Nr)marshalreadrr MAGIC_NUMBERload)streamrmagicrrrr(s    c #sifddxt||D]}|V|jryt|jWnNtk r\|dk rX||jYqtk r|dk r~||jnYqXttj|jddpg}fdd|D}t ||jd|EdHqWdS)aYields ModuleInfo for all modules recursively on path, or, if path is None, all accessible modules. 'path' should be either None or a list of paths to look for modules in. 'prefix' is a string to output on the front of every module name on output. Note that this function must import all *packages* (NOT all modules!) on the given path, in order to access the __path__ attribute to find submodules. 'onerror' is a function which gets called with one argument (the name of the package which was being imported) if any exception occurs while trying to import a package. If no onerror function is supplied, ImportErrors are caught and ignored, while all other exceptions are propagated, terminating the search. Examples: # list all modules python can access walk_packages() # list all submodules of ctypes walk_packages(ctypes.__path__, ctypes.__name__+'.') cSs||kr dSd||<dS)NTr)pmrrrseenRszwalk_packages..seenN__path__csg|]}|s|qSrr).0r&)r(rr isz!walk_packages...) r ispkg __import__r ImportError Exceptiongetattrsysmodulesr )pathprefixonerrorinfor)r(rr 5s   ccsf|dkrt}n tt|}i}xB|D]:}x4t||D]&\}}||kr4d||<t|||Vq4Wq$WdS)aYields ModuleInfo for all submodules on path, or, if path is None, all top-level modules on sys.path. 'path' should be either None or a list of paths to look for modules in. 'prefix' is a string to output on the front of every module name on output. N)rmapriter_importer_modulesr)r4r5Z importersyieldedirr-rrrr ns   cCst|dsgS|j|S)Nr )hasattrr )importerr5rrrr:s r:c cs0|jdkstjj|j rdSi}ddl}ytj|j}Wntk rRg}YnX|jx|D]}|j|}|dksb||krqbtjj|j|}d}| otjj|od|kr|}ytj|} Wntk rg} YnXx&| D]}|j|} | dkrd}PqWqb|rbd|krbd||<|||fVqbWdS)Nr__init__Fr,Tr8) r4osisdirinspectlistdirOSErrorsort getmodulenamejoin) r>r5r;rB filenamesfnmodnamer4r- dircontentssubnamerrr_iter_file_finder_moduless<       rMc Cs.tjtjdttjdaWdQRXdS)Nignoreimp)warningscatch_warnings simplefilterDeprecationWarningr import_modulerOrrrr _import_imps  rUc@s.eZdZdZd ddZd ddZd dd ZdS) r aPEP 302 Finder that wraps Python's "classic" import algorithm ImpImporter(dirname) produces a PEP 302 finder that searches that directory. ImpImporter(None) produces a PEP 302 finder that searches the current sys.path, plus any modules that are frozen or built-in. Note that ImpImporter does not currently support being used by placement on sys.meta_path. NcCstjdtt||_dS)Nz5This emulation is deprecated, use 'importlib' instead)rPwarnrSrUr4)selfr4rrrr?szImpImporter.__init__c Cs~|jdd}||kr$|jdkr$dS|jdkr4d}ntjj|jg}ytj||\}}}Wntk rndSXt||||S)Nr,r8)splitr4r@realpathrOrr/r )rWfullnamer4rLfilefilenameetcrrrrs zImpImporter.find_moduler%c cs0|jdkstjj|j rdSi}ddl}ytj|j}Wntk rRg}YnX|jx|D]}|j|}|dksb||krqbtjj|j|}d}| otjj|od|kr|}ytj|} Wntk rg} YnXx&| D]}|j|} | dkrd}PqWqb|rbd|krbd||<|||fVqbWdS)Nrr?Fr,Tr8) r4r@rArBrCrDrErFrG) rWr5r;rBrHrIrJr4r-rKrLrrrr s<       zImpImporter.iter_modules)N)N)r%)__name__ __module__ __qualname____doc__r?rr rrrrr s   c@sneZdZdZdZZddZddZddZd d Z d d Z d dZ dddZ dddZ ddZdddZdS)r zBPEP 302 Loader that wraps Python's "classic" import algorithm NcCs.tjdtt||_||_||_||_dS)Nz5This emulation is deprecated, use 'importlib' instead)rPrVrSrUr\r]r[r^)rWr[r\r]r^rrrr?szImpLoader.__init__c Cs:|jztj||j|j|j}Wd|jr4|jjX|S)N)_reopenrO load_moduler\r]r^close)rWr[modrrrrds  zImpLoader.load_modulec Cst|d }|jSQRXdS)Nrb)openr )rWpathnamer\rrrr "s zImpLoader.get_datacCsT|jrP|jjrP|jd}|tjkr2t|jd|_n|tjtjfkrPt|jd|_dS)Nrrg) r\closedr^rO PY_SOURCErhr] PY_COMPILED C_EXTENSION)rWmod_typerrrrc&s   zImpLoader._reopencCs0|dkr|j}n||jkr,td|j|f|S)Nz,Loader for module %s cannot handle module %s)r[r/)rWr[rrr _fix_name.s  zImpLoader._fix_namecCs|j|}|jdtjkS)Nrj)rqr^rO PKG_DIRECTORY)rWr[rrr is_package6s zImpLoader.is_packagec Cs|j|}|jdkr|jd}|tjkrD|j|}t||jd|_nJ|tjkrv|j zt |j |_Wd|j j Xn|tj kr|jj|_|jS)Nrjexec)rqcoder^rOrm get_sourcecompiler]rnrcrr\rerr _get_delegateget_code)rWr[rpsourcerrrry:s       zImpLoader.get_codec Cs|j|}|jdkr|jd}|tjkrP|jz|jj|_Wd|jjXnd|tj krt j j |j ddrt|j ddd}|j|_WdQRXn|tjkr|jj|_|jS)Nrjr8rkrXrX)rqrzr^rOrmrcr\r rernr@r4existsr]rhrrrxrv)rWr[rpfrrrrvKs      zImpLoader.get_sourcecCst|j}t|d}|jS)Nr?)r r]rr)rWrspecrrrrx]s  zImpLoader._get_delegatecCsH|j|}|jd}|tjkr*|jjS|tjtjtjfkrD|j SdS)Nrj) rqr^rOrrrx get_filenamermrnror])rWr[rprrrr~bs    zImpLoader.get_filename)N)N)N)r_r`rarbrurzr?rdr rcrqrsryrvrxr~rrrrr s    ) zipimporterc csttj|j}|j}t|}i}ddl}x|D]}|j|s@q0||djt j }t|dkr|djdr|d|krd||d<||ddfVt|dkrq0|j |d}|dkrq0|r0d|kr0||kr0d||<||dfVq0WdS) Nrrjr8z __init__.pyTr?r,F) sorted zipimport_zip_directory_cachearchiver5lenrB startswithrYr@seprF) r>r5Zdirlist_prefixZplenr;rBrIrJrrriter_zipimport_modulesps*     rcCsnytj|}WnZtk rhxDtjD]6}y||}tjj||PWq&tk rZYq&Xq&Wd}YnX|S)zRetrieve a finder for the given path item The returned finder is cached in sys.path_importer_cache if it was newly created by a path hook. The cache (or part of it) can be cleared manually if a rescan of sys.path_hooks is necessary. N)r2path_importer_cacheKeyError path_hooks setdefaultr/)Z path_itemr> path_hookrrrrs    ccs|jdrdj|}t|d|krV|jdd}tj|}t|dd}|dkrhdSntjEdHtj }x|D]}t |VqnWdS)aYield finders for the given module name If fullname contains a '.', the finders will be for the package containing fullname, otherwise they will be all registered top level finders (i.e. those on both sys.meta_path and sys.path_hooks). If the named module is in a package, that package is imported as a side effect of invoking this function. If no module name is specified, all top level finders are produced. r,z'Relative module name {!r} not supportedrr)N) rformatr/ rpartitionrrTr1r2 meta_pathr4r)r[msgZpkg_nameZpkgr4itemrrrrs      cCsn|tjkr tj|}|dkr dSt|trb|}t|dd}|dk rF|St|dddkrZdS|j}n|}t|S)zGet a "loader" object for module_or_name Returns None if the module cannot be found or imported. If the named module is not already imported, its containing package (if any) is imported, in order to establish the package __path__. N __loader____spec__)r2r3 isinstancerr1r_r)Zmodule_or_namemodulerr[rrrrs    cCs|jdrdj|}t|ytjj|}WnFttttfk rr}z"d}t|j|t |||WYdd}~XnX|dk r|j SdS)zFind a "loader" object for fullname This is a backwards compatibility wrapper around importlib.util.find_spec that converts most failures to ImportError and only returns the loader rather than the full spec r,z'Relative module name {!r} not supportedz,Error while finding loader for {!r} ({}: {})N) rrr/rrrr TypeError ValueErrortyper)r[rr}Zexrrrrs  *cCst|ts|S|d}|dd}|jd\}}}|rbytj|j}Wqhttfk r^|SXntj}x:|D]0}t|t sqpt |}|dk rg} t |dr|j |} | dk r| j pg} nt |dr|j|\}} x| D]} | |kr|j| qWtjj||} tjj| rpy t| } Wn8tk rT}ztjjd| |fWYdd}~XqpX| Bx:| D]2}|jd}| sb|jdrqb|j|qbWWdQRXqpW|S) aExtend a package's path. Intended use is to place the following code in a package's __init__.py: from pkgutil import extend_path __path__ = extend_path(__path__, __name__) This will add to the package's __path__ all subdirectories of directories on sys.path named after the package. This is useful if one wants to distribute different parts of a single logical package as multiple directories. It also looks for *.pkg files beginning where * matches the name argument. This feature is similar to *.pth files (see site.py), except that it doesn't special-case lines starting with 'import'. A *.pkg file is trusted at face value: apart from checking for duplicates, all entries found in a *.pkg file are added to the path, regardless of whether they are exist the filesystem. (This is a feature.) If the input path is not a list (as is the case for frozen packages) it is returned unchanged. The input path is not modified; an extended copy is returned. Items are only appended to the copy at the end. It is assumed that sys.path is a sequence. Items of sys.path that are not (unicode or 8-bit) strings referring to existing directories are ignored. Unicode items of sys.path that cause errors when used as filenames may cause this function to raise an exception (in line with os.path.isdir() behavior). z.pkgNr,rrzCan't open %s: %s  #)rlistrr2r3r)rrr4strrr=rsubmodule_search_locationsrappendr@rGisfilerhrDstderrwriterstripr)r4rZ sname_pkgZparent_package_Z final_nameZ search_pathdirrportionsr}ZportionZpkgfiler|rlinerrrrsP!            cCstjj|}|dkrdS|j}|dks2t|d r6dStjj|pLtjj |}|dksbt|d rfdS|j d}|j dt j j|jt j j|}|j|S)afGet a resource from a package. This is a wrapper round the PEP 302 loader get_data API. The package argument should be the name of a package, in standard module format (foo.bar). The resource argument should be in the form of a relative filename, using '/' as the path separator. The parent directory name '..' is not allowed, and nor is a rooted name (starting with a '/'). The function returns a binary string, which is the contents of the specified resource. For packages located in the filesystem, which have already been imported, this is the rough equivalent of d = os.path.dirname(sys.modules[package].__file__) data = open(os.path.join(d, resource), 'rb').read() If the package cannot be located or loaded, or it uses a PEP 302 loader which does not support get_data(), then None is returned. Nr __file__/r)rrrrr=r2r3get _bootstrap_loadrYinsertr@r4dirnamerrGr )packageZresourcer}rrfpartsZ resource_namerrrr Rs     )Nr%N)Nr%)r%)r%)r%)r%)'rb collectionsr functoolsrZ simplegenericrimportlib.utilimportlib.machineryr@Zos.pathr2typesrrP__all__rrrr r r:rMregister machinery FileFinderrUr r rrrr/rrrrrr rrrrsR     9   ( Jc   ^shutil.cpython-36.opt-2.pyc000064400000047115152462730460011463 0ustar003 i}A@sddlZddlZddlZddlZddlZddlZyddlZ[dZWnek rZdZYnXyddl Z [ dZ Wnek rdZ YnXyddl Z [ dZ Wnek rdZ YnXyddl mZWnek rdZYnXyddlmZWnek rdZYnXdddd d d d d dddddddddddddddddgZGdddeZGd ddeZGd!ddeZGd"ddeZGd#d$d$eZGd%d&d&eZdd)dZd*d+Zdd,d-dZdd,d.dZeed/rdd,d0d1Znd2d1Zdd,d3d Z dd,d4d Z!dd,d5d Z"d6dZ#dde"dfd7d Z$d8d9Z%d:d;Z&ej'ejej(ej)hej*kozej+ej,kozejej-kZ.ddZ1e"fd?d Z2d@dAZ3dBdCZ4dDdEZ5ddGdHZ6ddIdJZ7dKe6dgdMfiZ8ere6dgdNfe8dO<e7gdPfe8dQ<e re6dgdSfe8dT<e r,e6dgdVfe8dW<dXdZ9ddZdZ:d[dZ;dd\dZdd`dZ?dadZ@dbdcZAdddeZBddfdgdhZCdigeCgdMfdjgeBgdPfdkZDerdldmgeCgdNfeDdO<e rdndogeCgdSfeDdT<e rdpdqgeCgdVfeDdW<drdsZEdddfdtdZFeedurXejGdvejHdwdxZIdyeIjJ_KdzeIjL_Kd{eIjM_Kd|dvZNn2ejOd}krddlPZPejGdvejHdwdxZId~dvZNdddZQdddZRejSejTBdfddZUdS)NTF)getpwnam)getgrnam copyfileobjcopyfilecopymodecopystatcopycopy2copytreemovermtreeErrorSpecialFileError ExecError make_archiveget_archive_formatsregister_archive_formatunregister_archive_formatget_unpack_formatsregister_unpack_formatunregister_unpack_formatunpack_archiveignore_patternschownwhichget_terminal_size SameFileErrorc@s eZdZdS)r N)__name__ __module__ __qualname__r r /usr/lib64/python3.6/shutil.pyr 7sc@s eZdZdS)rN)rrrr r r r!r:sc@s eZdZdS)rN)rrrr r r r!r=sc@s eZdZdS)rN)rrrr r r r!rAsc@s eZdZdS) ReadErrorN)rrrr r r r!r"Dsr"c@s eZdZdS) RegistryErrorN)rrrr r r r!r#Gsr#icCs$x|j|}|sP|j|qWdS)N)readwrite)fsrcfdstZlengthZbufr r r!rLs  c CsXttjdr0ytjj||Stk r.dSXtjjtjj|tjjtjj|kS)NsamefileF)hasattrospathr)OSErrornormcaseabspath)srcdstr r r! _samefileTs r2)follow_symlinkscCst||rtdj||xL||gD]@}ytj|}Wntk rJYq$Xtj|jr$td|q$W| rtj j |rtj tj ||n6t |d&}t |d}t||WdQRXWdQRX|S)Nz{!r} and {!r} are the same filez`%s` is a named piperbwb)r2rformatr+statr-S_ISFIFOst_moderr,islinksymlinkreadlinkopenr)r0r1r3fnstr'r(r r r!r`s    cCsz| r>tjj|r>tjj|r>ttdr8tjtj}}q\dSnttdrXtjtj}}ndS||}||tj|j dS)Nlchmodchmod) r+r,r:r*lstatr@r7rAS_IMODEr9)r0r1r3Z stat_funcZ chmod_funcr?r r r!r}s   listxattrcCsytj||d}Wn4tk rF}z|jtjtjfkr8dSd}~XnXxn|D]f}y&tj|||d}tj||||dWqNtk r}z|jtjtjtjfkrWYdd}~XqNXqNWdS)N)r3) r+rDr-errnoENOTSUPZENODATAgetxattrsetxattrZEPERM)r0r1r3namesenamevaluer r r! _copyxattrs  rMcOsdS)Nr )argskwargsr r r!rMsc s6ddddd|p,tjj|o*tjj| }|r@fdd}n fdd}|d||d}tj|j}|d ||j|jf|dy|d |||dWntk rYnXt |d r$y|d ||j |dWnPt k r"}z2x*dD] }t t |r|j t t |krPqWWYdd}~XnXt|||ddS)N)nsr3cWsdS)Nr )rPr3rNr r r!_nopszcopystat.._nopcs tt|S)N)getattrr+)rK)rQr r!lookupszcopystat..lookupcstt|}|tjkr|SS)N)rRr+supports_follow_symlinks)rKr>)rQr r!rSs  r7)r3utimerAst_flagsZchflags EOPNOTSUPPrF)rWrF)r+r,r:r7rCr9 st_atime_ns st_mtime_nsNotImplementedErrorr*rVr-rErRrM) r0r1r3ZfollowrSr?modewhyerrr )rQr!rs,      cCsBtjj|r"tjj|tjj|}t|||dt|||d|S)N)r3)r+r,isdirjoinbasenamerr)r0r1r3r r r!rs cCsBtjj|r"tjj|tjj|}t|||dt|||d|S)N)r3)r+r,r^r_r`rr)r0r1r3r r r!r s csfdd}|S)Ncs,g}xD]}|jtj||q Wt|S)N)extendfnmatchfilterset)r,rI ignored_namespattern)patternsr r!_ignore_patternss z)ignore_patterns.._ignore_patternsr )rgrhr )rgr!r s cCstj|}|dk r|||}nt}tj|g}xB|D]8} | |krJq:tjj|| } tjj|| } ytjj| rtj| } |rtj| | t | | | dn.onerrorcWsdS)Nr )rNr r r!rysz%Cannot call rmtree on a symbolic link)_use_fd_functions isinstancebytesr+fsdecoderB Exceptionrsrtr=r}r,r~rrrxr-r:rrv)r, ignore_errorsryrfdr r r!r s<      cCs&tjjtjjpd}tjj|j|S)N)r+r,sepaltsepr`rstrip)r,rr r r! _basenamesrc Cs|}tjj|rTt||r*tj||dStjj|t|}tjj|rTtd|ytj||Wnt k rtjj |rtj |}tj ||tj |nTtjj|rt||rtd||ft|||ddt|n|||tj |YnX|S)Nz$Destination path '%s' already existsz.Cannot move a directory '%s' into itself '%s'.T)rprn)r+r,r^r2renamer_rrkr r-r:r<r;rw _destinsrcr r )r0r1rpZreal_dstrrr r r!r s2              cCsVtjj|}tjj|}|jtjjs2|tjj7}|jtjjsL|tjj7}|j|S)N)r+r,r/endswithr startswith)r0r1r r r!r8s    rc CsNtdks|dkrdSy t|}Wntk r8d}YnX|dk rJ|dSdS)N)rKeyError)rKresultr r r!_get_gidAs  rc CsNtdks|dkrdSy t|}Wntk r8d}YnX|dk rJ|dSdS)Nr)rr)rKrr r r!_get_uidMs  rgzipc s"|dkrd}nDtr |dkr d}n2tr2|dkr2d}n trD|dkrDd}ntdj|ddl} |rfd |nd} |d | } tjj| } | rtjj |  r|dk r|j d | |stj | |dk r|j d t t fd d} |s| j| d|}z|j|| dWd|jX| S)NrrZgzbzip2bz2xzzCbad value for 'compress', or compression format not supported : {0}r.z.tarz creating %szCreating tar archivecs,dk r|_|_dk r(|_|_|S)N)gidZgnameuiduname)Ztarinfo)rgroupownerrr r! _set_uid_gidsz#_make_tarball.._set_uid_gidzw|%s)rc)_ZLIB_SUPPORTED_BZ2_SUPPORTED_LZMA_SUPPORTED ValueErrorr6tarfiler+r,dirnamerkinforjrrr=addr) base_namebase_dircompressverbosedry_runrrloggerZtar_compressionrZ compress_extZ archive_name archive_dirrtarr )rrrrr! _make_tarballYs<          rc Cs|ddl}|d}tjj|}|rPtjj| rP|dk rB|jd||sPtj||dk rf|jd|||sx|j|d|jd}tjj |} | tj kr|j | | |dk r|jd| xtj |D]\} } } xFt | D]:} tjj tjj| | } |j | | |dk r|jd| qWxT| D]L} tjj tjj| | } tjj| r|j | | |dk r|jd| qWqWWdQRX|S)Nrz.zipz creating %sz#creating '%s' and adding '%s' to itw)Z compressionz adding '%s')zipfiler+r,rrkrrjZipFileZ ZIP_DEFLATEDnormpathcurdirr&walksortedr_isfile)rrrrrrZ zip_filenamerZzfr,dirpathZdirnames filenamesrKr r r! _make_zipfiles@             rrrzuncompressed tar filezgzip'ed tar-fileZgztarzZIP fileziprzbzip2'ed tar-fileZbztarrzxz'ed tar-fileZxztarcCsddtjD}|j|S)NcSsg|]\}}||dfqS)rr ).0rKregistryr r r! sz'get_archive_formats..)_ARCHIVE_FORMATSitemssort)formatsr r r!rs rcCsz|dkr g}t|s td|t|ttfs6tdx0|D](}t|ttf s\t|dkr|dk r$|jd|tjj|}|s>tj||dkrLtj}||d} y t|} Wn tk rt d|YnX| d} x| dD]\} }|| | <qW|dkr|| d<|| d<z| ||f| }Wd|dk r|dk r|jd | tj| X|S) Nzchanging into '%s')rrzunknown archive format '%s'rrrrzchanging back to '%s') r+getcwddebugr,r/chdirrrrr)rr6Zroot_dirrrrrrrZsave_cwdrO format_infofuncargvalr|r r r!rs6        cCsddtjD}|j|S)NcSs"g|]\}}||d|dfqS)rr )rrKrr r r!r6sz&get_unpack_formats..)_UNPACK_FORMATSrr)rr r r!r0s c Csvi}x.tjD]"\}}x|dD] }|||<q WqWx,|D]$}||kr:d}t||||fq:Wt|srtddS)Nrz!%s is already registered for "%s"z*The registered function must be a callable)rrr#rr) extensionsrrZexisting_extensionsrKrext extensionmsgr r r!_check_unpack_options;s rcCs,|dkr g}t|||||||ft|<dS)N)rr)rKrrrrr r r!rMs cCs t|=dS)N)r)rKr r r!rcscCs&tjj|}tjj|s"tj|dS)N)r+r,rr^rj)r,rr r r!_ensure_directorygs  rc Csddl}|j|std||j|}zx|jD]}|j}|jds4d|krRq4tjj |f|j d}|spq4t ||j ds4|j |j}t|d}z|j|Wd|j~Xq4WWd|jXdS)Nrz%s is not a zip file/z..r5)rZ is_zipfiler"rZinfolistr|rr+r,r_splitrrr%r=r&r) r| extract_dirrrrrKtargetdatafr r r!_unpack_zipfilems*       r)rccCs\ddl}y|j|}Wn"|jk r8td|YnXz|j||dWd|jXdS)Nrz/%s is not a compressed or uncompressed tar file)rc)rr=ZTarErrorr"Z extractallr)r|rrcrZtarobjr r r!_unpack_tarfilesrz.tarz.zip)rrz.tar.gzz.tgzz.tar.bz2z.tbz2z.tar.xzz.txzcCs:x4tjD](\}}x|dD]}|j|r|SqWq WdS)Nr)rrr)r|rKrrr r r!_find_unpack_formats   rc Cs|dkrtj}|dkri}nd|i}|dk ry t|}Wn"tk r\tdj|YnX|d}|||ft|d|nRt|}|dkrtdj|t|d}tt|d}|j ||||f|dS)NrczUnknown unpack format '{0}'rrzUnknown archive format '{0}') r+rrrrr6dictrr"update)r|rr6rcZ filter_kwargsrrrOr r r!rs&   statvfs disk_usageZusageztotal used freezTotal space in byteszUsed space in byteszFree space in bytescCs@tj|}|j|j}|j|j}|j|j|j}t|||S)N)r+rf_bavailf_frsizef_blocksf_bfree_ntuple_diskusage)r,r?freetotalusedr r r!rs    ntcCs"tj|\}}||}t|||S)N)rZ _getdiskusager)r,rrrr r r!rscCs|dkr|dkrtd|}|}|dkr.d}n(t|trVt|}|dkrVtdj||dkrdd}n(t|tst|}|dkrtdj|tj |||dS)Nzuser and/or group must be setrzno such user: {!r}zno such group: {!r}r) rrrmr LookupErrorr6intrr+r)r,userrZ_userZ_groupr r r!r s"  PcCsyttjd}Wnttfk r.d}YnXyttjd}Wnttfk r^d}YnX|dksp|dkrytjtjj}Wn$t tt fk rtj |}YnX|dkr|j }|dkr|j }tj ||fS)NZCOLUMNSrZLINES)rr+environrrrrs __stdout__filenoAttributeErrorr- terminal_sizecolumnslines)Zfallbackrrsizer r r!r(s$  c s"dd}tjjr&||r"SdS|dkr>tjjdtj}|sFdS|jtj}tj dkrtj |krt|j dtj tjjddjtj}t fdd |Drg}q‡fd d |D}ng}t }xT|D]L}tjj|}||kr|j|x(|D] } tjj|| } || |r| SqWqWdS) NcSs&tjj|o$tj||o$tjj| S)N)r+r,rkaccessr^)r>r[r r r! _access_checkbszwhich.._access_checkPATHZwin32rZPATHEXTrc3s |]}jj|jVqdS)N)lowerr)rr)cmdr r! szwhich..csg|] }|qSr r )rr)r r r!rszwhich..)r+r,rrgetdefpathrpathseprsplatformrinsertanyrdr.rr_) r r[r,rZpathextfilesseendirZnormdirZthefilerKr )r r!rUs8            @)r)FN)rrrNNN)rrN)rN)rr)rr)rr)Nr)NNrrNNN)Nr)NN)NNrr)r)Vr+rsr7rb collectionsrEzlibr ImportErrorrrZlzmarpwdrZgrpr__all__r-r rrrr"rr#rr2rrr*rMrrr rr rvrr=rwrxsupports_dir_fdri supports_fdrTrr Zavoids_symlink_attacksrr rrrrrrrrrrrrrrrrrrrrrl namedtuplerr__doc__rrrrKrrrF_OKX_OKrr r r r!s          :  Y!,   5 8    @ -     6  "       /        -dummy_threading.cpython-36.opt-1.pyc000064400000002120152462730460013315 0ustar003 \ @sdZddlmZddlZdZdZdZzdekr:edZdZeded<dekr`edZ dZed=d ekrzed Z dZed =ddl Z eded <ed=ed ed <ed =dd l Tdd l m Z Wdere ed<[ [ere ed <[ [ereed<[ned=[[[XdS)aaFaux ``threading`` version using ``dummy_thread`` instead of ``thread``. The module ``_dummy_threading`` is added to ``sys.modules`` in order to not have ``threading`` considered imported. Had ``threading`` been directly imported it would have made all subsequent imports succeed regardless of whether ``_thread`` was available which is not desired. )modulesNF_threadT _dummy_thread threadingZ_threading_local_dummy_threadingZ_dummy__threading_local)*)__all__)__doc__sysrZ sys_modulesrZholding_threadZholding_threadingZholding__threading_localZ held_threadZheld_threadingZheld__threading_localrrrr r '/usr/lib64/python3.6/dummy_threading.pysP    ftplib.cpython-36.opt-2.pyc000064400000044173152462730460011434 0ustar003 i! @sRddlZddlZddlmZddddddgZd Zd Zd ZGd d d eZGdddeZ GdddeZ GdddeZ GdddeZ ee efZdZdZGdddZy ddlZWnek rdZYn0XejZGdddeZejdee eejfZdaddZdaddZddZddZdd Z d(d#d$Z!d%d&Z"e#d'krNe"dS))N)_GLOBAL_DEFAULT_TIMEOUTFTP error_reply error_temp error_perm error_proto all_errorsi c@s eZdZdS)ErrorN)__name__ __module__ __qualname__rr/usr/lib64/python3.6/ftplib.pyr 9sr c@s eZdZdS)rN)r r rrrrrr:sc@s eZdZdS)rN)r r rrrrrr;sc@s eZdZdS)rN)r r rrrrrr<sc@s eZdZdS)rN)r r rrrrrr=sz s c@seZdZdZdZeZeZdZ dZ dZ dZ dZ dZddddedfddZd d Zd d Zd\ddZddZddZeZddZddZddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Z d(d)Z!d*d+Z"d,d-Z#d.d/Z$d0d1Z%d]d2d3Z&d^d4d5Z'd_d6d7Z(d`d9d:Z)dad;d<Z*dbd=d>Z+dcd?d@Z,dAdBZ-dCdDZ.dEdFZ/dgfdGdHZ0dIdJZ1dKdLZ2dMdNZ3dOdPZ4dQdRZ5dSdTZ6dUdVZ7dWdXZ8dYdZZ9dS)drrNr zlatin-1FcCs0||_||_|r,|j||r,|j|||dS)N)source_addresstimeoutconnectlogin)selfhostuserpasswdacctrrrrr__init__rs  z FTP.__init__cCs|S)Nr)rrrr __enter__{sz FTP.__enter__cGsN|jdk rJz*y |jWnttfk r0YnXWd|jdk rH|jXdS)N)sockquitOSErrorEOFErrorclose)rargsrrr__exit__s    z FTP.__exit__icCs|dkr||_|dkr||_|dkr*||_|dk r8||_tj|j|jf|j|jd|_|jj|_|jj d|j d|_ |j |_ |j S)Nrri)rr)encodingi)rportrrsocketcreate_connectionrZfamilyafmakefiler%filegetrespwelcome)rrr&rrrrrrs   z FTP.connectcCs|jrtd|j|j|jS)Nz *welcome*) debuggingprintsanitizer-)rrrr getwelcomeszFTP.getwelcomecCs ||_dS)N)r.)rlevelrrrset_debuglevelszFTP.set_debuglevelcCs ||_dS)N) passiveserver)rvalrrrset_pasvsz FTP.set_pasvcCsJ|dddkrBt|jd}|ddd|d||d}t|S)Npass PASS z *>r9r8)lenrstriprepr)rsirrrr0s$z FTP.sanitizecCsRd|ksd|krtd|t}|jdkr:td|j||jj|j|jdS)N  z4an illegal newline character should not be containedr z*put*) ValueErrorCRLFr.r/r0rsendallencoder%)rlinerrrputlines  z FTP.putlinecCs$|jrtd|j||j|dS)Nz*cmd*)r.r/r0rG)rrFrrrputcmdsz FTP.putcmdcCs|jj|jd}t||jkr.td|j|jdkrHtd|j||sPt|ddt krn|dd}n|ddt kr|dd}|S) Nr zgot more than %d bytesz*get*rJrK) r+readlinemaxliner;r r.r/r0r rC)rrFrrrgetlines  z FTP.getlinecCsd|j}|dddkr`|dd}x:|j}|d|}|dd|kr&|dddkr&Pq&W|S)N-rA)rN)rrFcodeZnextlinerrr getmultilines  zFTP.getmultilinecCsp|j}|jrtd|j||dd|_|dd}|d krD|S|dkrTt||dkrdt|t|dS) Nz*resp*rOr 12345>rUrVrT)rSr.r/r0Zlastresprrr)rrespcrrrr,s z FTP.getrespcCs$|j}|dddkr t||S)Nr rU)r,r)rrYrrrvoidrespsz FTP.voidrespcCsTdt}|jdkr"td|j||jj|t|j}|dddkrPt||S) NsABORr z *put urgent*rO426225226>r\r^r]) B_CRLFr.r/r0rrDMSG_OOBrSr)rrFrYrrraborts z FTP.abortcCs|j||jS)N)rHr,)rcmdrrrsendcmds z FTP.sendcmdcCs|j||jS)N)rHr[)rrbrrrvoidcmds z FTP.voidcmdcCsB|jd}t|dt|dg}||}ddj|}|j|S)N.zPORT ,)splitr=joinrd)rrr&ZhbytesZpbytesbytesrbrrrsendports  z FTP.sendportcCsbd}|jtjkrd}|jtjkr$d}|dkr4tddt||t|dg}ddj|}|j|S)Nrr rIzunsupported address familyrzEPRT |)r)r'AF_INETZAF_INET6rr=rird)rrr&r)Zfieldsrbrrrsendeprt$s  z FTP.sendeprtc Csd}d}xtjdd|jtjdtjD]j}|\}}}}}ytj|||}|j|Wn8tk r} z| }|rt|jd}w$WYdd} ~ XnXPq$W|dkr|dk r|ntd|jd|j d} |j j d} |jtj kr|j | | } n |j | | } |jtk r|j|j|S)Nrz!getaddrinfo returns an empty listr )r'Z getaddrinfor)Z SOCK_STREAMZ AI_PASSIVEZbindrr!ZlistenZ getsocknamerrmrkrnrr settimeout) rerrrresr)ZsocktypeprotoZ canonnameZsa_r&rrYrrrmakeport1s6       z FTP.makeportcCs\|jtjkr:t|jd\}}|jr*|}qT|jjd}nt|jd|jj\}}||fS)NPASVrZEPSV) r)r'rmparse227rctrust_server_pasv_ipv4_addressrZ getpeernameparse229)rZuntrusted_hostr&rrrrmakepasvQs z FTP.makepasvc Cs6d}|jr|j\}}tj||f|j|jd}yL|dk rF|jd||j|}|ddkrd|j}|ddkrxt|Wn|j YnXn|j r}|dk r|jd||j|}|ddkr|j}|ddkrt||j \}} |jt k r |j |jWdQRX|dddkr.t|}||fS)N)rzREST %srrUrTrO150)r4ryr'r(rrrcr,rr!rtZacceptrroparse150) rrbrestsizerr&connrYrZsockaddrrrr ntransfercmd]s<             zFTP.ntransfercmdcCs|j||dS)Nr)r)rrbr|rrr transfercmdszFTP.transfercmdcCs|sd}|sd}|sd}|dkr0|d kr0|d}|jd|}|ddkrX|jd|}|ddkrr|jd |}|dd krt||S) NZ anonymousrrQz anonymous@zUSER rrVzPASS zACCT rU>rrQ)rcr)rrrrrYrrrrs    z FTP.login c Csb|jd|j||>}x|j|}|s*P||qWtdk rPt|trP|jWdQRX|jS)NzTYPE I)rdrZrecv _SSLSocket isinstanceunwrapr[)rrbcallback blocksizer|r~datarrr retrbinarys   zFTP.retrbinarycCs|dkr t}|jd}|j|}|jd|jd}x|j|jd}t||jkrbtd|j|j dkrzt dt ||sP|d dt kr|dd }n|d ddkr|dd }||q6Wt dk rt|t r|jWdQRXWdQRX|jS) NzTYPE Ar$)r%r zgot more than %d bytesrIz*retr*rArJrJrKrK) print_linercrr*r%rLrMr;r r.r/r=rCrrrr[)rrbrrYr~fprFrrr retrliness*      z FTP.retrlinesc Csp|jd|j||L}x*|j|}|s*P|j||r||qWtdk r^t|tr^|jWdQRX|jS)NzTYPE I)rdrreadrDrrrr[)rrbrrrr|r~bufrrr storbinarys    zFTP.storbinaryc Cs|jd|j|}x||j|jd}t||jkrDtd|j|sJP|ddtkrz|dtkrr|dd}|t}|j||r||qWtdk rt |tr|j WdQRX|j S)NzTYPE Ar zgot more than %d bytesrIrJrKrK) rdrrLrMr;r r_rDrrrr[)rrbrrr~rrrr storlines s$     z FTP.storlinescCsd|}|j|S)NzACCT )rd)rZpasswordrbrrrr+szFTP.acctcGs4d}x|D]}|d|}q Wg}|j||j|S)NZNLST )rappend)rr"rbargfilesrrrnlst0s  zFTP.nlstcGsld}d}|ddr>t|dtdkr>|dd|d}}x|D]}|rD|d|}qDW|j||dS) NZLISTr rrrKrKrKrK)typer)rr"rbfuncrrrrdir9s  zFTP.dirc cs|r|jddj|d|r*d|}nd}g}|j||jxh|D]`}|jtjd\}}}i} x6|ddjdD] } | jd\} }} | | | j<qxW|| fVqFWdS) Nz OPTS MLST ;zMLSD %sZMLSDrr =rK) rcrirrr<rC partitionrhlower) rpathZfactsrblinesrFZ facts_foundrsnameentryZfactkeyvaluerrrmlsdHs   zFTP.mlsdcCs0|jd|}|ddkr"t||jd|S)NzRNFR rrVzRNTO )rcrrd)rZfromnameZtonamerYrrrrenameds z FTP.renamecCs.|jd|}|dddkr"|St|dS)NzDELE rO250200>rr)rcr)rfilenamerYrrrdeleteksz FTP.deletecCsn|dkrPy |jdStk rL}z|jddddkr<WYdd}~Xq\Xn |dkr\d}d|}|j|S) Nz..ZCDUPrrO500rrezCWD )rdrr")rdirnamemsgrbrrrcwdss zFTP.cwdcCs:|jd|}|dddkr6|ddj}t|SdS)NzSIZE rOZ213)rcstripint)rrrYr>rrrr}szFTP.sizecCs$|jd|}|jdsdSt|S)NzMKD 257r)rd startswithparse257)rrrYrrrmkds zFTP.mkdcCs|jd|S)NzRMD )rd)rrrrrrmdszFTP.rmdcCs |jd}|jdsdSt|S)NZPWDrr)rdrr)rrYrrrpwds  zFTP.pwdcCs|jd}|j|S)NZQUIT)rdr!)rrYrrrrs zFTP.quitc CsDz |j}d|_|dk r|jWd|j}d|_|dk r>|jXdS)N)r+r!r)rr+rrrrr!s z FTP.close)rrrN)N)N)rrr)rN)N)rNN)N):r r rr.rFTP_PORTr&MAXLINErMrr+r-r4r%rwrrrr#rr1r3debugr6r0rGrHrNrSr,r[rarcrdrkrnrtryrrrrrrrrrrrrrrr}rrrrr!rrrrrJsj      7    #      c @sjeZdZejZdddddddedf ddZdddZdd Z d d Z d d Z ddZ dddZ ddZdS)FTP_TLSrNc Cs|dk r|dk rtd|dk r0|dk r0td|dk s@|dk rVddl} | jdtd||_||_|dkr|tj|j||d}||_ d|_ t j ||||||| dS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadrI)certfilekeyfileF) rBwarningswarnDeprecationWarningrrsslZ_create_stdlib_context ssl_versioncontext_prot_prr) rrrrrrrrrrrrrrrs"zFTP_TLS.__init__TcCs,|rt|jtj r|jtj||||S)N)rrr SSLSocketauthrr)rrrrZsecurerrrrsz FTP_TLS.logincCsft|jtjrtd|jtjkr.|jd}n |jd}|jj |j|j d|_|jj d|j d|_ |S)NzAlready using TLSzAUTH TLSzAUTH SSL)server_hostnamer$)moder%)rrrrrBrPROTOCOL_SSLv23rdr wrap_socketrr*r%r+)rrYrrrrs     z FTP_TLS.authcCs0t|jtjstd|jd}|jj|_|S)Nz not using TLSZCCC)rrrrrBrdr)rrYrrrcccs   z FTP_TLS.ccccCs|jd|jd}d|_|S)NzPBSZ 0zPROT PT)rdr)rrYrrrprot_p s  zFTP_TLS.prot_pcCs|jd}d|_|S)NzPROT CF)rdr)rrYrrrprot_cs zFTP_TLS.prot_ccCs2tj|||\}}|jr*|jj||jd}||fS)N)r)rrrrrr)rrbr|r~r}rrrr$s  zFTP_TLS.ntransfercmdcCs8dt}|jj||j}|dddkr4t||S)NsABORrOr\r]r^>r\r^r])r_rrDrSr)rrFrYrrrra+s  z FTP_TLS.abort)rrrT)N)r r rrrrrrrrrrrrrarrrrrs!    rcCs\|dddkrt|tdkrt |d}||fS) NrOZ227rz#(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)rerPr7) r_227_rerrrsearchrgroupsrir)rYrrZnumbersrr&rrrrvNs rvcCs|dddkrt||jd}|dkr2t||jd|d}|dkrRt|||d||dkrrt|||d|j||d}t|dkrt||d}t|d}||fS)NrOZ229(r)r r7)rfindrrhr;r)rYZpeerleftrightpartsrr&rrrrxbs    rxcCs|dddkrt||dddkr,dSd}d}t|}xJ||kr||}|d}|dkr|||ksr||dkrtP|d}||}q>W|S)NrOrr7z "rr ")rr;)rYrr?nrZrrrrxs   rcCs t|dS)N)r/)rFrrrrsrrIc Cs|s|}d|}|j||j|t|jd\}}|j|||jd|}|dddkrdt|jd|}|ddd krt|j|jdS) NzTYPE ruzSTOR rO125rzzRETR >rrz>rrz)rdrvrcrkrr[) sourceZ sourcenametargetZ targetnamerZ sourcehostZ sourceportZtreplyZsreplyrrrftpcps   rc Csttjdkr"ttjtjdddl}d}d}x"tjddkrT|d}tjd=q4Wtjddddkrtjddd}tjd=tjd}t|}|j |d}}}y|j|}Wn(t k r|dk rtj j dYn:Xy|j |\}}}Wn"tk rtj j dYnX|j|||xtjddD]} | ddd krf|j| ddnt| dddkrd } | ddr| d | dd} |j| } n0| d kr|j|j n|jd | tjj dq'sN   k  |  9 sched.cpython-36.pyc000064400000014646152462730460010304 0ustar003 \o@sdZddlZddlZddlmZy ddlZWnek rHddlZYnXddlmZ dgZ GdddeddZ d e j_d e j _d e j _d e j_d e j_eZGdddZdS)aA generally useful event scheduler class. Each instance of this class manages its own queue. No multi-threading is implied; you are supposed to hack that yourself, or use a single instance per application. Each instance is parametrized with two functions, one that is supposed to return the current time, one that is supposed to implement a delay. You can implement real-time scheduling by substituting time and sleep from built-in module time, or you can implement simulated time by writing your own functions. This can also be used to integrate scheduling with STDWIN events; the delay function is allowed to modify the queue. Time can be expressed as integers or floating point numbers, as long as it is consistent. Events are specified by tuples (time, priority, action, argument, kwargs). As in UNIX, lower priority numbers mean higher priority; in this way the queue can be maintained as a priority queue. Execution of the event means calling the action function, passing it the argument sequence in "argument" (remember that in Python, multiple function arguments are be packed in a sequence) and keyword parameters in "kwargs". The action function may be an instance method so it has another way to reference private data (besides global variables). N) namedtuple) monotonic schedulerc@s8eZdZgZddZddZddZddZd d Zd S) EventcCs|j|jf|j|jfkS)N)timepriority)sor /usr/lib64/python3.6/sched.py__eq__'sz Event.__eq__cCs|j|jf|j|jfkS)N)rr)rr r r r __lt__(sz Event.__lt__cCs|j|jf|j|jfkS)N)rr)rr r r r __le__)sz Event.__le__cCs|j|jf|j|jfkS)N)rr)rr r r r __gt__*sz Event.__gt__cCs|j|jf|j|jfkS)N)rr)rr r r r __ge__+sz Event.__ge__N) __name__ __module__ __qualname__ __slots__r r rrrr r r r r%s rz(time, priority, action, argument, kwargszaNumeric type compatible with the return value of the timefunc function passed to the constructor.zSEvents scheduled for the same time will be executed in the order of their priority.z?Executing the event means executing action(*argument, **kwargs)zGargument is a sequence holding the positional arguments for the action.zDkwargs is a dictionary holding the keyword arguments for the action.c@s^eZdZeejfddZfefddZfefddZ ddZ d d Z dd d Z e ddZdS)rcCs g|_tj|_||_||_dS)zGInitialize a new instance, passing the time and delay functionsN)_queue threadingRLock_locktimefunc delayfunc)selfrrr r r __init__<s zscheduler.__init__c Cs@|tkr i}t|||||}|jtj|j|WdQRX|S)zEnter a new event in the queue at an absolute time. Returns an ID for the event which can be used to remove it, if necessary. N) _sentinelrrheapqheappushr)rrractionargumentkwargseventr r r enterabsDs zscheduler.enterabscCs|j|}|j|||||S)z{A variant that specifies the time as a relative time. This is actually the more commonly used interface. )rr$)rdelayrr r!r"rr r r enterRs zscheduler.enterc Cs.|j|jj|tj|jWdQRXdS)zRemove an event from the queue. This must be presented the ID as returned by enter(). If the event is not in the queue, this raises ValueError. N)rrremoverheapify)rr#r r r cancel[s zscheduler.cancelc Cs|j |j SQRXdS)z!Check whether the queue is empty.N)rr)rr r r emptyfszscheduler.emptyTc Cs|j}|j}|j}|j}tj}x||>|s,P|d\}}} } } |} || krRd} n d} ||WdQRX| r|sx|| S||| q | | | |dq WdS)aExecute events until the queue is empty. If blocking is False executes the scheduled events due to expire soonest (if any) and then return the deadline of the next scheduled call in the scheduler. When there is a positive delay until the first event, the delay function is called and the event is left in the queue; otherwise, the event is removed from the queue and executed (its action function is called, passing it the argument). If the delay function returns prematurely, it is simply restarted. It is legal for both the delay function and the action function to modify the queue or to raise an exception; exceptions are not caught but the scheduler's state remains well-defined so run() may be called again. A questionable hack is added to allow other threads to run: just after an event is executed, a delay of 0 is executed, to avoid monopolizing the CPU when other threads are also runnable. rTFN)rrrrrheappop)rZblockinglockqrrpoprrr r!r"Znowr%r r r runks* z scheduler.runc Cs:|j|jdd}WdQRXtttj|gt|S)zAn ordered list of upcoming events. Events are named tuples with fields for: time, priority, action, arguments, kwargs N)rrlistmaprr+len)rZeventsr r r queues zscheduler.queueN)T)rrr_timerZsleeprrr$r&r)r*r/propertyr3r r r r r:s   2)__doc__rr collectionsrr ImportErrorZdummy_threadingrr4__all__rrr r!r"objectrrr r r r s"    gettext.cpython-36.pyc000064400000033567152462730460010705 0ustar003 \T@sdZddlZddlZddlZddlZddlZddlZddlZddlm Z dddddd d d d d dddddddgZ ej j ej ddZejdejejBZddZddZdPZd)d*eed+DZd,d-d.d/ZdRd0d1Zd2d3Zd4d5Zd6d7ZGd8ddZGd9ddeZdSd;dZiZdTda$dVd?d Z%dWd@d Z&dXdAd Z'dBd Z(dCdZ)dDdZ*dEdZ+dFdZ,dGdZ-dHdZ.dIdZ/e Z0dS)YaInternationalization and localization support. This module provides internationalization (I18N) and localization (L10N) support for your Python programs by providing an interface to the GNU gettext message catalog library. I18N refers to the operation by which a program is made aware of multiple languages. L10N refers to the adaptation of your program, once internationalized, to the local language and cultural habits. N)ENOENTNullTranslationsGNUTranslationsCatalogfind translationinstall textdomainbindtextdomainbind_textdomain_codesetdgettext dngettextgettextlgettext ldgettext ldngettext lngettextngettextZsharelocalea (?P[ \t]+) | # spaces and horizontal tabs (?P[0-9]+\b) | # decimal integer (?Pn\b) | # only n is allowed (?P[()]) | (?P[-*/%+?:]|[>, # <=, >=, ==, !=, &&, ||, # ? : # unary and bitwise ops # not allowed (?P\w+|.) # invalid token ccsTxHtjt|D]8}|j}|dkr"q|j|}|dkr@td||VqWdVdS)NZ WHITESPACESZINVALIDz invalid token in plural form: %s)refinditer_token_pattern lastgroupgroup ValueError)pluralZmoZkindvaluer/usr/lib64/python3.6/gettext.py _tokenizeTs   r cCs|rtd|StdSdS)Nz#unexpected token in plural form: %szunexpected end of plural form)r)rrrr_error_s r!||&&==!=<><=>=+-*/%cCs i|]\}}|D] }||qqSrr).0iZopsoprrr msr2orandz//)z||z&&r-c Csd}t|}x|dkr(|d7}t|}qW|dkr\t|\}}d||f}|dkrtdnP|dkrrd ||f}n:yt|d }Wntk rt|dYnXd ||f}t|}d }xh|tkr t|}||krP|dkr|dkrd|}tj||}t||d\} }d||| f}|}qW||ko6dknrFd|}|dkr|dkrt|d\} }|dkrzt|t|\} }d| || f}|dkrd|}||fS)Nr!znot (z%s(%s))z%unbalanced parenthesis in plural formnz%s%s z%s%ddz(%s)r3z%s %s %s?r:z%s if %s else %s)r<r=)r<r=)next_parserintr! _binary_ops _c2py_opsget) tokensZpriorityresultnexttoksubrjr0r1rightZif_trueZif_falserrrrApsP           rAc Cs:y t|}Wn(tk r4td|jjfdYnX|S)Nz'Plural value must be an integer, got %s)round TypeError __class____name__)r9r0rrr_as_ints  rPc Cst|dkrtdy~tt|\}}|r2t|d}x>|D]6}|dkrb|d7}|dkrrtdq<|dkr<|d8}qt|D]\}}!t |!||||f<qWnt |||t ||<| d7} | d7} qWdS)z8Override this method to support alternative .mo formats.namercSs t|dkS)Nr3)rB)r9rrrUsz(GNUTranslations._parse..z4Iz>IIzBad magic numberzBad version number zFile is corrupt r?r3 z content-typezcharset=z plural-forms;zplural=ascii)structunpackgetattr_catalogrreadrSLE_MAGICBE_MAGICOSErrorrVERSIONSstrr]splitdecodestriplowerrfrgrX enumerate)"rjrkrfilenameZcatalogZbufZbuflenmagicrZmsgcountZ masteridxZtransidxZiiZ major_versionZ minor_versionr0ZmlenZmoffZmendZtlenZtoffZtendmsgrtZlastkZb_itemitemkvrrvrrrsxrrrrANsr                     zGNUTranslations._parsecCsRt}|jj||}||kr2|jr.|jj|S|}|jrD|j|jS|jtjS)N) objectrrErirrhrprrq)rjromissingrtrrrrs  zGNUTranslations.lgettextc Csvy|j||j|f}Wn<tk rT|jr>|jj|||S|dkrL|}n|}YnX|jrh|j|jS|jtjS)Nr3) rrKeyErrorrirrhrprrq)rjrrrsr9rtrrrrs  zGNUTranslations.lngettextcCs6t}|jj||}||kr2|jr.|jj|S|S|S)N)rrrErir)rjrorrtrrrrs zGNUTranslations.gettextc CsZy|j||j|f}Wn<tk rT|jr>|jj|||S|dkrL|}n|}YnX|S)Nr3)rrrrir)rjrrrsr9rtrrrrs zGNUTranslations.ngettextN)rr3) rOr~rrrrrrArrrrrrrrrBsT  Fc Cs|dkr t}|dkrTg}x(dD] }tjj|}|r|jd}PqWd|krT|jdg}x0|D](}x"t|D]}||krl|j|qlWq^W|rg} nd} xL|D]D}|dkrPtjj||dd|} tjj | r|r| j| q| SqW| S) NLANGUAGELC_ALL LC_MESSAGESLANGr?Cz%s.mo)rrrr) _default_localedirosenvironrErr^repathjoinexists) domain localedir languagesallZenvarrdZnelangsZlangZnelangrGmofilerrrrs8        c Cs|dkr t}t|||dd}|s6|r*tSttd|d}x|D]|}|tjj|f} tj | } | dkrt |d} tj | || } WdQRXt j | } |r| j ||dkr| }q@|j| q@W|S)NT)rz$No translation file found for domainrb)rrrrrrrabspath _translationsrEopen setdefaultcopyrxrm) rrrZclass_rnrcZmofilesrGrkeytrkrrrrs*      cCst||d|d}|j|dS)NT)rnrc)rr)rrrcr}rrrrrsZmessagescCs|dk r |atS)N)_current_domain)rrrrr 'scCs|dk r|t|<tj|tS)N) _localedirsrEr)rrrrrr .scCs|dk r|t|<tj|S)N)_localecodesetsrE)rrcrrrr 5sc Cs@y t|tj|dtj|d}Wntk r4|SX|j|S)N)rc)rrrErrr)rrorrrrr <s c CsRtj|}yt|tj|d|d}Wn"tk rF|j|pBtjSX|j|S)N)rc) rrErrrrprrqr)rrorcrrrrrDs  c CsTy t|tj|dtj|d}Wn$tk rD|dkr<|S|SYnX|j|||S)N)rcr3)rrrErrr)rrrrsr9rrrrr Ls c Cshtj|}yt|tj|d|d}Wn4tk rX|dkrB|}n|}|j|pTtjSX|j|||S)N)rcr3) rrErrrrprrqr)rrrrsr9rcrrtrrrrWs cCs tt|S)N)r r)rorrrrcscCs tt|S)N)rr)rorrrrfscCstt|||S)N)r r)rrrsr9rrrriscCstt|||S)N)rr)rrrsr9rrrrlsr"r#r$r%r&r'r(r)r*r+r,r-r.)rrrrrr)r)NNF)NNNFN)NNN)N)N)N)1__doc__rriorrrsyserrnor__all__rr base_prefixrcompileVERBOSEDOTALLrr r!rCrrDrArPrXrerrrrrrrrrr r r r rr rrrrrrrrrr s^&8         1$*K &       trace.cpython-36.opt-2.pyc000064400000040156152462730460011247 0ustar003 \=p @s(ddgZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Zy ddlZWn"ek rejZddZYnXddZd dZd ZGd d d Zd dZddZGdddZddZddZdddZddZGdddZddZedkr$edS)TraceCoverageResultsN) monotoniccCstjddS)N)syssettracerr/usr/lib64/python3.6/trace.py _unsettraceEsr cCstj|tj|dS)N) threadingrr)funcrrr _settraceHs r cCstjdtjddS)N)rrr rrrrr Ls z#pragma NO COVERc@seZdZdddZddZdS)_IgnoreNcCs:|s tnt||_|sgn dd|D|_ddi|_dS)NcSsg|]}tjj|qSr)ospathnormpath).0drrr Usz$_Ignore.__init__..z)set_mods_dirs_ignore)selfmodulesdirsrrr__init__Ss z_Ignore.__init__cCs||jkr|j|S||jkr,d|j|<dSx*|jD] }|j|dr4d|j|<dSq4W|dkrnd|j|<dSx,|jD]"}|j|tjrvd|j|<dSqvWd|j|<dS)Nr.r)rr startswithrrsep)rfilename modulenamemodrrrrnamesYs$          z _Ignore.names)NN)__name__ __module__ __qualname__rr#rrrrr Rs r cCs tjj|}tjj|\}}|S)N)rrbasenamesplitext)rbaser extrrr_modnames r+cCstjj|}d}xJtjD]@}tjj|}|j|r|t|tjkrt|t|kr|}qW|rv|t|dd}n|}tjj|\}}|jtjd}tj r|jtj d}tjj |\}}|j dS)Nrr) rrnormcaserrlenr splitdrivereplacealtsepr(lstrip)rZ comparepathZlongestdirr)Zdriver r*rrr _fullmodnames    r4c@s:eZdZdddZddZddZdd d Zdd d ZdS)rNcCs||_|jdkri|_|jj|_||_|jdkr8i|_|jj|_||_|jdkrZi|_|jj|_||_||_|jry@t|jd}tj |\}}}WdQRX|j |j |||Wn@t t tfk r}ztd|j|ftjdWYdd}~XnXdS)NrbzSkipping counts file %r: %s)file)countscopyZcounter calledfuncscallersinfileoutfileopenpickleloadupdate __class__OSErrorEOFError ValueErrorprintrstderr)rr7r9r;r:r<ferrrrrrs,      zCoverageResults.__init__cCs|jdo|jdS)N<>)rendswith)rr rrris_ignored_filenamesz#CoverageResults.is_ignored_filenamec Csz|j}|j}|j}|j}|j}|j}x$|D]}|j|d||||<q*Wx|D] }d||<qPWx|D] }d||<qfWdS)Nrr)r7r9r:get) rotherr7r9r:Z other_countsZother_calledfuncsZ other_callerskeyrrrr@s    zCoverageResults.updateTFc!Cs|jrDttd|j}x(t|D]\}}}td|||fq$W|jrttdd}} xvt|jD]h\\} } } \} }}| |krttd| d| }d} | | kr| | krtd| | } td| | ||fqlWi}x8|jD].\}}|j|i}||<|j||f||<qWi}x$|jD]\}}|j|r@q&|jdrX|dd}|dkrt j j t j j |}t |}n$|}t j j|st j|t|}|rt|}ni}tj|}t j j||d }t|d }tj|j\}}WdQRX|j|||||\}}|r&|r&td ||}||||f||<q&W|r|rtd x2t|D]&}||\}}}}td||q`W|jry&tj|j|j|jft|jdd Wn6tk r} ztd| tj dWYdd} ~ XnXdS)Nzfunctions called:z*filename: %s, modulename: %s, funcname: %szcalling relationships:r,z***z -->z %s.%s -> %s.%sz.pycrz.coverr5dzlines cov% module (path)z%5d %3d%% %s (%s)wbz"Can't save counts files because %s)r6)!r9rEsortedr:r7rMitemsrLrKrrdirnameabspathr+existsmakedirsr4_find_executable_linenos linecachegetlinesjoinr=tokenizedetect_encodingreadlinewrite_results_fileintr<r>dumprBrrF)!rZ show_missingsummarycoverdirZcallsr r!funcnameZlastfileZ lastcfileZpfileZpmodZpfunccfileZcmodZcfuncZper_filelineno lines_hitZsumscountr3lnotabsourceZ coverpathfpencoding_n_hitsn_linesZpercentmrHrrr write_resultss|              zCoverageResults.write_resultsc Csyt|d|d}Wn6tk rH}ztd||ftjdd Sd}~XnXd}d} |xt|dD]r\} } | |kr|jd|| | d7} |d7}n.| |krt| kr|jd|d7}n |jd |j| jd qdWWdQRX| |fS) Nw)rmz3trace: Could not open %r for writing: %s - skipping)r6rrz%5d: z>>>>>> z )rr) r=rBrErrF enumeratewritePRAGMA_NOCOVER expandtabs) rrlinesrjrhrmr<rHrprorglinerrrr`5s(    z"CoverageResults.write_results_file)NNNNN)TFN)N)r$r%r&rrLr@rrr`rrrrrs   [cCs0i}x&tj|D]\}}||krd||<qW|S)Nr)disZfindlinestarts)codestrslinenosrnrgrrr_find_lines_from_codeUs  rcCs8t||}x(|jD]}tj|r|jt||qW|S)N)r co_constsinspectZiscoder@ _find_lines)r|r}r~crrrr_s    rc Csi}tj}t||dr}tj|j}x^|D]V\}}}} } |tjkr||tjkr||\} } | \} }xt| | dD] }d||<qlW|}q*WWdQRX|S)N)rmr)tokenINDENTr=r]generate_tokensr_STRINGrange)r rmrZ prev_ttyperGtokZttypeZtstrstartendrzZslineZscolZelineZecolirrr _find_stringsks    rcCsy(tj|}|j}|j}WdQRXWn6tk r^}ztd||ftjdiSd}~XnXt||d}t ||}t ||S)Nz%Not printing coverage data for %r: %s)r6exec) r]r=readrmrBrErrFcompilerr)r rGprogrmrHr|r}rrrrYs   rYc @seZdZddddffdddf ddZddZdd d Zd d Zd dZddZddZ ddZ ddZ ddZ ddZ ddZdS)rrrNFc Cs||_||_t|||_i|_i|_d|_||_i|_i|_ i|_ d|_ | rTt |_ |rb|j |_nZ|rp|j|_nL|r|r|j|_|j|_n2|r|j|_|j|_n|r|j|_|j|_nd|_dS)Nrr)r;r<r ignorer7Zpathtobasename donothingtrace _calledfuncs_callers _caller_cache start_time_timeglobaltrace_trackcallers globaltraceglobaltrace_countfuncsglobaltrace_ltlocaltrace_trace_and_count localtracelocaltrace_tracelocaltrace_count) rrir countfuncs countcallers ignoremods ignoredirsr;r<timingrrrrs6      zTrace.__init__cCs ddl}|j}|j|||dS)Nr)__main____dict__runctx)rcmdrdictrrrrunsz Trace.runc CsL|dkr i}|dkri}|js(t|jzt|||Wd|jsFtXdS)N)rr rrr )rrglobalslocalsrrrrs z Trace.runctxc Os<d}|jstj|jz|||}Wd|js6tjdX|S)N)rrrr)rr argskwresultrrrrunfuncs  z Trace.runfuncc Cs|j}|j}|rt|}nd}|j}d}||jkrL|j|dk r|j|}nd|j|<ddtj|D}t|dkrddtj|dD}t|dkrddtj|dD} t| dkr| dj}||j|<|dk rd||f}|||fS)NcSsg|]}tj|r|qSr)rZ isfunction)rrGrrrrsz1Trace.file_module_function_of..rcSsg|]}t|tr|qSr) isinstancer)rrrrrrsrcSsg|]}t|dr|qS) __bases__)hasattr)rrrrrrsz%s.%s) f_code co_filenamer+co_namergcZ get_referrersr.r$) rframer|r r!reZclsnameZfuncsZdictsclassesrrrfile_module_function_ofs,          zTrace.file_module_function_ofcCs0|dkr,|j|}|j|j}d|j||f<dS)Ncallr)rf_backr)rrwhyarg this_funcZ parent_funcrrrrs  zTrace.globaltrace_trackcallerscCs |dkr|j|}d|j|<dS)Nrr)rr)rrrrrrrrrs zTrace.globaltrace_countfuncscCsj|dkrf|j}|jjdd}|rbt|}|dk rf|jj||}|sf|jrZtd||jf|j SndSdS)Nr__file__z! --- modulename: %s, funcname: %s) r f_globalsrMr+rr#rrErr)rrrrr|r r!Z ignore_itrrrrszTrace.globaltrace_ltcCs|dkr~|jj}|j}||f}|jj|dd|j|<|jrTtdt|jddtj j |}td||t j ||fdd|j S) Nrzrrz%.2f )rz %s(%d): %sr,)rrf_linenor7rMrrErrrr'rZgetliner)rrrrr rgrObnamerrrr2s z Trace.localtrace_trace_and_countcCsd|dkr^|jj}|j}|jr4tdt|jddtjj|}td||t j ||fdd|j S)Nrzz%.2fr)rz %s(%d): %sr,) rrrrrErrrr'rZrr)rrrrr rgrrrrrAs zTrace.localtrace_tracecCs<|dkr6|jj}|j}||f}|jj|dd|j|<|jS)Nrzrr)rrrr7rMr)rrrrr rgrOrrrrNs zTrace.localtrace_countcCst|j|j|j|j|jdS)N)r;r<r9r:)rr7r;r<rr)rrrrresultsVs z Trace.results)NN)r$r%r&rrrrrrrrrrrrrrrrrs 0  )   c stj}|jdddd|jdd}|jddd d d |jd d d dd |jddd dd |jddd dd |jd}|j}|jddd dd |jddd dd |jdddd|jd d!d"d|jd#d$d d%d |jd&d'd d(d |jd)d*d d+d |jd,d-}|jd.d/gd0d1|jd2d/gd3d1|jd4d5d6d7|jd8tjd9d7|j}|jrd:d;jt j f}t j j t jf|t j j t jf|fdd?|jD|_fd@d?|jD|_|jr|js|jdAt|j|jdB}|j|j|j|jSt|j|j|j|jgs*|jdC|jrL|jsB|jrL|jdD|jrh|j rh|jdE|jdkr~|jdF|jf|jt _ t j j!|jt j dG<t"|j|j|j|j|j|j|j|j|j#dH }yJt$|j}t%|j&|jdI}WdQRX|jdJdddK} |j'|| | WnPt(k rT} zt j)dLt j dG| fWYdd} ~ Xnt*k rhYnX|j+}|j,s|j|j|j|jdS)MNz --versionversionz trace 2.0)actionrz Main optionsz(One of these (or --report) must be givenz-cz--count store_truezCount the number of times each line is executed and write the counts to .cover for each module executed, in the module's directory. See also --coverdir, --file, --no-report below.)rhelpz-tz--tracez3Print each line to sys.stdout before it is executedz-lz --listfuncszKeep track of which functions are executed at least once and write the results to sys.stdout after the program exits. Cannot be specified alongside --trace or --count.z-Tz --trackcallsz^Keep track of caller/called pairs and write the results to sys.stdout after the program exits.Z Modifiersz-rz--reportzGenerate a report from a counts file; does not execute any code. --file must specify the results file to read, which must have been created in a previous run with --count --file=FILEz-Rz --no-reportz^Do not generate the coverage report files. Useful if you want to accumulate over several runs.z-fz--filez+File to accumulate counts over several runs)rz-Cz --coverdirzDirectory where the report files go. The coverage report for . will be written to file //.coverz-mz --missingz?Annotate executable lines that were not executed with ">>>>>> "z-sz --summaryz\Write a brief summary for each file to sys.stdout. Can only be used with --count or --reportz-gz--timingzQPrefix each line with the time since the program started. Only used while tracingZFilterszCan be specified multiple timesz--ignore-moduleappendzqIgnore the given module(s) and its submodules (if it is a package). Accepts comma separated list of module names.)rdefaultrz --ignore-dirzWIgnore files in the given directory (multiple directories can be joined by os.pathsep).r ?zfile to run as main program)nargsr argumentszarguments to the programlibzpython{0.major}.{0.minor}cs4tjjtjj|}|jdjd}tjj|S)Nz$prefixz $exec_prefix)rr expanduser expandvarsr0r)s) _exec_prefix_prefixrrparse_ignore_dirszmain..parse_ignore_dircSs$g|]}|jdD] }|jqqS),)splitstrip)rrr"rrrrszmain..cs&g|]}|jtjD] }|qqSr)rrpathsep)rrr)rrrrsz-r/--report requires -f/--file)r;r<zLmust specify one of --trace, --count, --report, --listfuncs, or --trackcallsz8cannot specify both --listfuncs and (--trace or --count)z3--summary can only be used with --count or --reportz3filename is missing: required with the main optionsr)rrrrr;r<rrr)rr$ __package__ __cached__zCannot run file %r because: %s)-argparseArgumentParser add_argumentZadd_argument_groupZadd_mutually_exclusive_groupZ REMAINDER parse_argsZ ignore_dirformatr version_inforrr\ base_prefixbase_exec_prefixZ ignore_moduleZreportr6errorrrrZmissingrcrdanyrriZ listfuncsZ trackcallsr rargvrUrrr=rrrrBexit SystemExitrZ no_report) parserZgrpZ_grpZoptsZrel_pathrtrlr|ZglobsrHr)rrrrmain\s                       (rr)N) __all__rrZrrerrr]rrr{r>Ztimerrr ImportErrorrr r rwr r+r4rrrrrYrrr$rrrr2sF  2/  M base64.cpython-36.pyc000064400000041245152462730460010275 0ustar003 \O@sdZddlZddlZddlZddddddd d d d d dddddddgZeefZddZdCddZ dDddZ ddZ ddZ ej ddZej ddZddZddZd Zdadad!d ZdEd"d Zd#d ZdFd$d Zdadad%Zd&ZdGd'd(Zddddd)d*dZddd+d,d-dZd.Z da!da"da#dHd/d Z$d0dZ%d1Z&e&d2d3Z'd4dZ(d5dZ)d6d7Z*d8dZ+d9d:Z,d;dZ-dd?Z/d@dAZ0e1dBkre/dS)IzDBase16, Base32, Base64 (RFC 3548), Base85 and Ascii85 data encodingsNencodedecode encodebytes decodebytes b64encode b64decode b32encode b32decode b16encode b16decode b85encode b85decode a85encode a85decodestandard_b64encodestandard_b64decodeurlsafe_b64encodeurlsafe_b64decodecCsxt|tr2y |jdStk r0tdYnXt|tr@|Sy t|jStk rrtd|j j dYnXdS)Nasciiz4string argument should contain only ASCII charactersz>argument should be a bytes-like object or ASCII string, not %r) isinstancestrrUnicodeEncodeError ValueError bytes_types memoryviewtobytes TypeError __class____name__)sr /usr/lib64/python3.6/base64.py_bytes_from_decode_data"s    r"cCsDtj|dd}|dk r@t|dks.tt||jtjd|S|S)a*Encode the bytes-like object s using Base64 and return a bytes object. Optional altchars should be a byte string of length 2 which specifies an alternative alphabet for the '+' and '/' characters. This allows an application to e.g. generate url or filesystem safe Base64 strings. F)newlineNs+/)binascii b2a_base64lenAssertionErrorrepr translatebytes maketrans)raltcharsencodedr r r!r3s FcCsht|}|dk rBt|}t|dks0tt||jtj|d}|r^tjd| r^t j dt j |S)anDecode the Base64 encoded bytes-like object or ASCII string s. Optional altchars must be a bytes-like object or ASCII string of length 2 which specifies the alternative alphabet used instead of the '+' and '/' characters. The result is returned as a bytes object. A binascii.Error is raised if s is incorrectly padded. If validate is False (the default), characters that are neither in the normal base-64 alphabet nor the alternative alphabet are discarded prior to the padding check. If validate is True, these non-alphabet characters in the input result in a binascii.Error. Nr$s+/s^[A-Za-z0-9+/]*={0,2}$zNon-base64 digit found) r"r'r(r)r*r+r,rematchr%Error a2b_base64)rr-Zvalidater r r!rAs cCst|S)zrEncode bytes-like object s using the standard Base64 alphabet. The result is returned as a bytes object. )r)rr r r!rZscCst|S)aQDecode bytes encoded with the standard Base64 alphabet. Argument s is a bytes-like object or ASCII string to decode. The result is returned as a bytes object. A binascii.Error is raised if the input is incorrectly padded. Characters that are not in the standard alphabet are discarded prior to the padding check. )r)rr r r!rass+/s-_cCst|jtS)zEncode bytes using the URL- and filesystem-safe Base64 alphabet. Argument s is a bytes-like object to encode. The result is returned as a bytes object. The alphabet uses '-' instead of '+' and '_' instead of '/'. )rr*_urlsafe_encode_translation)rr r r!roscCst|}|jt}t|S)aDecode bytes using the URL- and filesystem-safe Base64 alphabet. Argument s is a bytes-like object or ASCII string to decode. The result is returned as a bytes object. A binascii.Error is raised if the input is incorrectly padded. Characters that are not in the URL-safe base-64 alphabet, and are not a plus '+' or slash '/', are discarded prior to the padding check. The alphabet uses '-' instead of '+' and '_' instead of '/'. )r"r*_urlsafe_decode_translationr)rr r r!rxs  s ABCDEFGHIJKLMNOPQRSTUVWXYZ234567csBtdkr,ddtDfddDadt|tsBt|j}t|d}|rb|dd|}t}tj }t}xjt dt|dD]V}||||dd}|||d ?||d ?d @||d ?d @||d @7}qW|d krd|dd<nF|dkr d|dd<n.|dkr$d|dd<n|dkr:d|dd<t |S)zKEncode the bytes-like object s using Base32 and return a bytes object. NcSsg|]}t|fqSr )r+).0ir r r! szb32encode..csg|]}D] }||q qSr r )r5ab)b32tabr r!r7srbigi s======r$s====s====i) _b32tab2 _b32alphabetrrrrr' bytearrayint from_bytesranger+)rleftoverr.rMZb32tab2r6cr )r:r!rs4   *    c CstdkrddttDat|}t|dr8tjd|dk rvt|}t|dks`tt||j t j dd|}|r|j }t|}|j d }|t|}t}t}xtd t|dD]n}|||d}d } y"x|D]} | d >|| } qWWn"tk rtjd dYnX|| jd d 7}qW|dsB|dkrLtjd|r|r| d |K} | jd d } dd |d} | d| |dd<t |S)aZDecode the Base32 encoded bytes-like object or ASCII string s. Optional casefold is a flag specifying whether a lowercase alphabet is acceptable as input. For security purposes, the default is False. RFC 3548 allows for optional mapping of the digit 0 (zero) to the letter O (oh), and for optional mapping of the digit 1 (one) to either the letter I (eye) or letter L (el). The optional argument map01 when not None, specifies which letter the digit 1 should be mapped to (when map01 is not None, the digit 0 is always mapped to the letter O). For security purposes the default is None, so that 0 and 1 are not allowed in the input. The result is returned as a bytes object. A binascii.Error is raised if the input is incorrectly padded or if there are non-alphabet characters present in the input. NcSsi|]\}}||qSr r )r5kvr r r! szb32decode..zIncorrect paddingrAs01OrErr;zNon-base32 digit foundr=rDrCrB+>rrArDrCrB)_b32rev enumeraterJr"r'r%r1r(r)r*r+r,upperrstriprKrNKeyErrorto_bytes) rcasefoldZmap01lZpadcharsdecodedZb32revr6ZquantaaccrPZlastrOr r r!r sB         cCstj|jS)zKEncode the bytes-like object s using Base16 and return a bytes object. )r%ZhexlifyrZ)rr r r!r scCs4t|}|r|j}tjd|r*tjdtj|S)aDecode the Base16 encoded bytes-like object or ASCII string s. Optional casefold is a flag specifying whether a lowercase alphabet is acceptable as input. For security purposes, the default is False. The result is returned as a bytes object. A binascii.Error is raised if s is incorrectly padded or if there are non-alphabet characters present in the input. s [^0-9A-F]zNon-base16 digit found)r"rZr/searchr%r1Z unhexlify)rr^r r r!r s   s<~s~>c st|tst|j}t| d}|r4|d|}tjdt|dj|}fdd|D}|r| r|d dkrdd |d <|d d| |d<d j|S)NrCr<z!%dIcsRg|]J}r| rdn6r&|dkr&dn&|d|dd|dqS)zi yi^ Ui9r )r5Zword)charschars2foldnuls foldspacesr r!r7!sz_85encode..rArcrr;rHrHrHrH) rrrrr'structStructZunpackjoin) r9rfrgpadrhripaddingZwordschunksr )rfrgrhrir! _85encodes     rq)riwrapcolrnadobecstdkr*ddtddDaddtDat|tt|d||rHtrt|rVdnd fd dtd tD}|rt|ddkr|jd d j||rt 7S)aEncode bytes-like object b using Ascii85 and return a bytes object. foldspaces is an optional flag that uses the special short sequence 'y' instead of 4 consecutive spaces (ASCII 0x20) as supported by 'btoa'. This feature is not supported by the "standard" Adobe encoding. wrapcol controls whether the output should have newline (b'\n') characters added to it. If this is non-zero, each output line will be at most this many characters long. pad controls whether the input is padded to a multiple of 4 before encoding. Note that the btoa implementation always pads. adobe controls whether the encoded byte sequence is framed with <~ and ~>, which is used by the Adobe implementation. NcSsg|]}t|fqSr )r+)r5r6r r r!r7Dsza85encode..!vcSsg|]}tD] }||q qSr ) _a85chars)r5r8r9r r r!r7EsTr$rAcsg|]}||qSr r )r5r6)resultrrr r!r7Msrrj rH) rvrN _a85chars2rq _A85STARTmaxr'appendrm_A85END)r9rirrrnrsrpr )rwrrr!r/s"   s )rirs ignorecharsc Cst|}|rH|jts$tdjt|jtr<|dd}n |dd}tjdj }g}|j }g}|j }|j } x|dD]} d| kodknr|| t |d krrd} x|D]} d | | d } qWy||| Wn"tj k rtd dYnX| qz| dkr0|r&td|dqz|rX| dkrX|rNtd|dqz| |krfqzqztd| qzWdj|} dt |} | r| d| } | S)aDecode the Ascii85 encoded bytes-like object or ASCII string b. foldspaces is a flag that specifies whether the 'y' short sequence should be accepted as shorthand for 4 consecutive spaces (ASCII 0x20). This feature is not supported by the "standard" Adobe encoding. adobe controls whether the input sequence is in Adobe Ascii85 format (i.e. is framed with <~ and ~>). ignorechars should be a byte string containing characters to ignore from the input. This should only contain whitespace characters, and by default contains all whitespace characters in ASCII. The result is returned as a bytes object. z1Ascii85 encoded byte sequences must end with {!r}r$Nz!IurC!rr;rertzAscii85 overflowrczz inside Ascii85 5-tuplesrdzy inside Ascii85 5-tuples zNon-Ascii85 digit found: %crjrsuuuurtuzy)r"endswithr}rformat startswithrzrkrlpackr|clearr'errorrm)r9rirsr~packIr`Zdecoded_appendZcurrZ curr_appendZ curr_clearxrarwror r r!rXsV           sU0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~cCs2tdkr$ddtDaddtDat|tt|S)zEncode bytes-like object b in base85 format and return a bytes object. If pad is true, the input is padded with b'\0' so its length is a multiple of 4 bytes before encoding. NcSsg|]}t|fqSr )r+)r5r6r r r!r7szb85encode..cSsg|]}tD] }||q qSr ) _b85chars)r5r8r9r r r!r7s)r _b85alphabet _b85chars2rq)r9rnr r r!r s c CsZtdkr0dgdaxttD]\}}|t|<qWt|}t| d}|d|}g}tjdj}xtdt|dD]}|||d}d}y"x|D]}|dt|}qWWnJt k rx2t|D]&\}}t|dkrt d||dqWYnXy|j ||Wqttj k r2t d |dYqtXqtWd j |} |rV| d| } | S) zqDecode the base85-encoded bytes-like object or ASCII string b The result is returned as a bytes object. Nr;~z!Irrez#bad base85 character at position %dz+base85 overflow in hunk starting at byte %drj)_b85decrYrr"r'rkrlrrNrrr|rrm) r9r6rProoutrchunkrajrwr r r!r s<       LrCrDcCs`xZ|jt}|sPx0t|tkrB|jtt|}|s8P||7}qWtj|}|j|qWdS)z1Encode a file; input and output are binary files.N)read MAXBINSIZEr'r%r&write)inputoutputrnsliner r r!rs   cCs,x&|j}|sPtj|}|j|qWdS)z1Decode a file; input and output are binary files.N)readliner%r2r)rrrrr r r!rs  cCsy t|}Wn8tk rD}zd|jj}t||WYdd}~XnX|jdkrjd|j|jjf}t||jdkrd|j|jjf}t|dS) Nz"expected bytes-like object, not %srPr9Bz-expected single byte elements, not %r from %srAz(expected 1-D data, not %d-D data from %s)rPr9r)rrrrrndim)rmerrmsgr r r!_input_type_checks    rcCsPt|g}x8tdt|tD]$}|||t}|jtj|qWdj|S)zVEncode a bytestring into a bytes object containing multiple lines of base-64 data.rrj)rrNr'rr|r%r&rm)rpiecesr6rr r r!r s cCsddl}|jdtdt|S)zLegacy alias of encodebytes().rNzAencodestring() is a deprecated alias since 3.1, use encodebytes()r$)warningswarnDeprecationWarningr)rrr r r! encodestringsrcCst|tj|S)z8Decode a bytestring of base-64 data into a bytes object.)rr%r2)rr r r!rscCsddl}|jdtdt|S)zLegacy alias of decodebytes().rNzHdecodestring() is a deprecated alias since Python 3.1, use decodebytes()r$)rrrr)rrr r r! decodestring$src Csddl}ddl}y|j|jddd\}}WnP|jk r~}z2|j|_t|td|jd|jdWYdd}~XnXt}xF|D]>\}}|dkrt}|dkrt }|d krt }|d krt dSqW|o|dd krt |dd }|||jj WdQRXn||j j |jj dS) zSmall main programrNrAZdeutzusage: %s [-d|-e|-u|-t] [file|-] -d, -u: decode -e: encode (default) -t: encode and decode string 'Aladdin:open sesame'r$z-ez-dz-uz-t-rb)sysgetoptargvrstderrstdoutprintexitrrtestopenbufferstdin) rrZoptsargsrfuncor8fr r r!main.s0rcCsHd}tt|t|}tt|t|}tt|||ksDtdS)NsAladdin:open sesame)rr)rrr()Zs0s1s2r r r!rHs   r__main__)N)NF)FN)F)FFF)F)2__doc__r/rkr%__all__r+rKrr"rrrrr,r3r4rrrJrIrXrr r r rvryrzr}rqrrrrrrr r Z MAXLINESIZErrrrrrrrrrrr r r r!sh     & C  )H -      genericpath.cpython-36.opt-2.pyc000064400000006164152462730460012443 0ustar003 i @sddlZddlZdddddddd d d d d g ZddZdd ZddZddZddZddZddZ ddZ dd Z dd Z dd Z ddZddZejGdd d ZdS)N commonprefixexistsgetatimegetctimegetmtimegetsizeisdirisfilesamefile sameopenfilesamestat ALLOW_MISSINGc Cs(ytj|Wntk r"dSXdS)NFT)osstatOSError)pathr#/usr/lib64/python3.6/genericpath.pyrs c Cs0ytj|}Wntk r"dSXtj|jS)NF)rrrS_ISREGst_mode)rstrrrr s c Cs0ytj|}Wntk r"dSXtj|jS)NF)rrrS_ISDIRr)srrrrr's cCs tj|jS)N)rrst_size)filenamerrrr0scCs tj|jS)N)rrst_mtime)rrrrr5scCs tj|jS)N)rrst_atime)rrrrr:scCs tj|jS)N)rrst_ctime)rrrrr?scCsl|sdSt|dttfs*tttj|}t|}t|}x,t|D] \}}|||krD|d|SqDW|S)Nr) isinstancelisttuplemaprfspathminmax enumerate)ms1s2icrrrrEs cCs|j|jko|j|jkS)N)st_inost_dev)r(r)rrrr Ws cCstj|}tj|}t||S)N)rrr )f1f2r(r)rrrr ^s  cCstj|}tj|}t||S)N)rfstatr )fp1fp2r(r)rrrr gs  cCs|j|}|r"|j|}t||}|j|}||kr~|d}x@||kr||||d|krr|d|||dfS|d7}q>W||ddfS)Nr)rfindr%)psepaltsepextsepsepIndex altsepIndexdotIndex filenameIndexrrr _splitextus      r=cGsbd}}xB|D]:}t|tr"d}qt|tr2d}qtd||jjfdqW|r^|r^tdddS)NFTz*%s() argument must be str or bytes, not %rz.Can't mix strings and bytes in path components)rstrbytes TypeError __class____name__)funcnameargshasstrhasbytesrrrr_check_arg_typess   rGc@seZdZddZddZdS)r cCsdS)Nzos.path.ALLOW_MISSINGr)selfrrr__repr__szALLOW_MISSING.__repr__cCs|jjS)N)rArB)rHrrr __reduce__szALLOW_MISSING.__reduce__N)rB __module__ __qualname__rIrJrrrrr s)rr__all__rr rrrrrrr r r r=rGobject__new__r rrrrs$      signal.cpython-36.pyc000064400000004725152462730460010470 0ustar003 \K@s ddlZddlTddlmZddlmZeZej de ddej de d dd ekrlej d e d dd dZ ddZ eej ddZ eejddZd ekreejdd Zejje_dekreejddZdekreejddZeje_[[dS)N)*)wraps)IntEnumSignalscCs(|jr|jdr|jd p&|jdS)NZSIGZSIG_ZCTRL_)isupper startswith)namer /usr/lib64/python3.6/signal.py sr HandlerscCs|dkS)NSIG_DFLSIG_IGN)r rr )rr r r r spthread_sigmaskZSigmaskscCs|dkS)N SIG_BLOCK SIG_UNBLOCK SIG_SETMASK)rrrr )rr r r r sc Cs"y||Stk r|SXdS)zsConvert a numeric value to an IntEnum member. If it's not a known member, return the numeric value itself. N) ValueError)valueZ enum_klassr r r _int_to_enumsrc Cs&yt|Sttfk r |SXdS)zmConvert an IntEnum member to a numeric value. If it's not an IntEnum member return the value itself. N)intr TypeError)rr r r _enum_to_int#srcCstjt|t|}t|tS)N)_signalsignalrrr ) signalnumhandlerr r r r-srcCstj|}t|tS)N)r getsignalrr )rrr r r r3s rcCstj||}tdd|DS)Ncss|]}t|tVqdS)N)rr).0xr r r =sz"pthread_sigmask..)rrset)ZhowmaskZsigs_setr r r r:s  sigpendingcCstj}tdd|DS)Ncss|]}t|tVqdS)N)rr)rrr r r r Eszsigpending..)rr#r!)Zsigsr r r r#BssigwaitcCstj|}t|tS)N)rr$rr)ZsigsetZretsigr r r r$Is )r functoolsrZ_wrapsenumrZ_IntEnumglobalsZ_globals_convert__name__rrrrr__doc__r#r$r r r r s6         pty.cpython-36.opt-2.pyc000064400000005702152462730460010763 0ustar003 \@sddlmZddlZddlZdddgZdZdZdZdZddZd d Z d d Z d dZ ddZ ddZ ddZeefddZeefddZdS))selectNopenptyforkspawnc Cs<ytjSttfk r YnXt\}}t|}||fS)N)osrAttributeErrorOSError_open_terminal slave_open) master_fd slave_nameslave_fdr/usr/lib64/python3.6/pty.pyrs c CsLytj\}}Wnttfk r(YnXtj|}tj|||fStS)N)rrr r ttynamecloser )r rrrrr master_open!s  rc Cslx^dD]V}xPdD]H}d||}ytj|tj}Wntk rHwYnX|d||fSWqWtddS)NZpqrstuvwxyzPQRSTZ0123456789abcdefz/dev/ptyz/dev/ttyzout of pty devices)ropenO_RDWRr )xyZpty_namefdrrrr 1s   r cCsntj|tj}yddlm}m}Wntk r6|SXy|||d|||dWntk rhYnX|S)Nr)ioctlI_PUSHZptemZldterm)rrrZfcntlrr ImportErrorr )Ztty_nameresultrrrrrr =s r cCsytj\}}Wnttfk r(Yn4X|tkrTy tjWntk rRYnX||fSt\}}tj}|tkrtjtj|tj |t tj |t tj |t |t krtj|tj tjt tj}tj|n tj|||fS)N)rforkptyr r CHILDsetsidrrrdup2 STDIN_FILENO STDOUT_FILENO STDERR_FILENOrrr)pidrr rZtmp_fdrrrrOs0         cCs&x |r tj||}||d}qWdS)N)rwrite)rdatanrrr_writenws r)cCs tj|dS)Ni)rread)rrrr_read}sr+cCsz|tg}xlt|gg\}}}||krH||}|s<|j|n tjt|t|kr |t}|sh|jtq t||q WdS)N)r"rremoverr&r#r))r master_read stdin_readZfdsZrfdsZwfdsZxfdsr'rrr_copys   r/cCst|tdkr|f}t\}}|tkr s    (numbers.cpython-36.pyc000064400000027560152462730460010670 0ustar003 \(@sdZddlmZmZdddddgZGddded ZGd ddeZejeGd ddeZ e je Gd dde Z Gd dde Z e je dS)z~Abstract Base Classes (ABCs) for numbers, according to PEP 3141. TODO: Fill out more detailed documentation on the operators.)ABCMetaabstractmethodNumberComplexRealRationalIntegralc@seZdZdZfZdZdS)rzAll numbers inherit from this class. If you just want to check if an argument x is a number, without caring what kind, use isinstance(x, Number). N)__name__ __module__ __qualname____doc__ __slots____hash__rr/usr/lib64/python3.6/numbers.pyr s) metaclassc@seZdZdZfZeddZddZeeddZ eedd Z ed d Z ed d Z eddZ eddZddZddZeddZeddZeddZeddZeddZed d!Zed"d#Zed$d%Zed&d'Zd(S))raaComplex defines the operations that work on the builtin complex type. In short, those are: a conversion to complex, .real, .imag, +, -, *, /, abs(), .conjugate, ==, and !=. If it is given heterogenous arguments, and doesn't have special knowledge about them, it should fall back to the builtin complex type as described below. cCsdS)zsz Complex.imagcCstdS)z self + otherN)r)rotherrrr__add__GszComplex.__add__cCstdS)z other + selfN)r)rrrrr__radd__LszComplex.__radd__cCstdS)z-selfN)r)rrrr__neg__QszComplex.__neg__cCstdS)z+selfN)r)rrrr__pos__VszComplex.__pos__cCs || S)z self - otherr)rrrrr__sub__[szComplex.__sub__cCs | |S)z other - selfr)rrrrr__rsub___szComplex.__rsub__cCstdS)z self * otherN)r)rrrrr__mul__cszComplex.__mul__cCstdS)z other * selfN)r)rrrrr__rmul__hszComplex.__rmul__cCstdS)z5self / other: Should promote to float when necessary.N)r)rrrrr __truediv__mszComplex.__truediv__cCstdS)z other / selfN)r)rrrrr __rtruediv__rszComplex.__rtruediv__cCstdS)zBself**exponent; should promote to float or complex when necessary.N)r)rexponentrrr__pow__wszComplex.__pow__cCstdS)z base ** selfN)r)rbaserrr__rpow__|szComplex.__rpow__cCstdS)z7Returns the Real distance from 0. Called for abs(self).N)r)rrrr__abs__szComplex.__abs__cCstdS)z$(x+y*i).conjugate() returns (x-y*i).N)r)rrrr conjugateszComplex.conjugatecCstdS)z self == otherN)r)rrrrr__eq__szComplex.__eq__N)r r r r r rrrpropertyrrrrrrrrrr r!r"r$r&r'r(r)rrrrr s.              c@seZdZdZfZeddZeddZeddZedd Z ed%d d Z d dZ ddZ eddZ eddZeddZeddZeddZeddZddZedd Zed!d"Zd#d$Zd S)&rzTo Complex, Real adds the operations that work on real numbers. In short, those are: a conversion to float, trunc(), divmod, %, <, <=, >, and >=. Real also provides defaults for the derived operations. cCstdS)zTAny Real can be converted to a native float object. Called for float(self).N)r)rrrr __float__szReal.__float__cCstdS)aGtrunc(self): Truncates self to an Integral. Returns an Integral i such that: * i>0 iff self>0; * abs(i) <= abs(self); * for any Integral j satisfying the first two conditions, abs(i) >= abs(j) [i.e. i has "maximal" abs among those]. i.e. "truncate towards 0". N)r)rrrr __trunc__s zReal.__trunc__cCstdS)z$Finds the greatest Integral <= self.N)r)rrrr __floor__szReal.__floor__cCstdS)z!Finds the least Integral >= self.N)r)rrrr__ceil__sz Real.__ceil__NcCstdS)zRounds self to ndigits decimal places, defaulting to 0. If ndigits is omitted or None, returns an Integral, otherwise returns a Real. Rounds half toward even. N)r)rZndigitsrrr __round__szReal.__round__cCs||||fS)zdivmod(self, other): The pair (self // other, self % other). Sometimes this can be computed faster than the pair of operations. r)rrrrr __divmod__szReal.__divmod__cCs||||fS)zdivmod(other, self): The pair (self // other, self % other). Sometimes this can be computed faster than the pair of operations. r)rrrrr __rdivmod__szReal.__rdivmod__cCstdS)z)self // other: The floor() of self/other.N)r)rrrrr __floordiv__szReal.__floordiv__cCstdS)z)other // self: The floor() of other/self.N)r)rrrrr __rfloordiv__szReal.__rfloordiv__cCstdS)z self % otherN)r)rrrrr__mod__sz Real.__mod__cCstdS)z other % selfN)r)rrrrr__rmod__sz Real.__rmod__cCstdS)zRself < other < on Reals defines a total ordering, except perhaps for NaN.N)r)rrrrr__lt__sz Real.__lt__cCstdS)z self <= otherN)r)rrrrr__le__sz Real.__le__cCs tt|S)z(complex(self) == complex(float(self), 0))complexfloat)rrrrrszReal.__complex__cCs| S)z&Real numbers are their real component.r)rrrrrsz Real.realcCsdS)z)Real numbers have no imaginary component.rr)rrrrrsz Real.imagcCs| S)zConjugate is a no-op for Reals.r)rrrrr(szReal.conjugate)N)r r r r r rr+r,r-r.r/r0r1r2r3r4r5r6r7rr*rrr(rrrrrs(            c@s<eZdZdZfZeeddZeeddZddZ dS) rz6.numerator and .denominator should be in lowest terms.cCstdS)N)r)rrrr numeratorszRational.numeratorcCstdS)N)r)rrrr denominatorszRational.denominatorcCs |j|jS)a float(self) = self.numerator / self.denominator It's important that this conversion use the integer's "true" division rather than casting one side to float before dividing so that ratios of huge integers convert without overflowing. )r:r;)rrrrr+szRational.__float__N) r r r r r r*rr:r;r+rrrrr sc@seZdZdZfZeddZddZed%ddZed d Z ed d Z ed dZ eddZ eddZ eddZeddZeddZeddZeddZeddZdd Zed!d"Zed#d$ZdS)&rz@Integral adds a conversion to int and the bit-string operations.cCstdS)z int(self)N)r)rrrr__int__+szIntegral.__int__cCst|S)z6Called whenever an index is needed, such as in slicing)int)rrrr __index__0szIntegral.__index__NcCstdS)a4self ** exponent % modulus, but maybe faster. Accept the modulus argument if you want to support the 3-argument version of pow(). Raise a TypeError if exponent < 0 or any argument isn't Integral. Otherwise, just implement the 2-argument version described in Complex. N)r)rr#modulusrrrr$4s zIntegral.__pow__cCstdS)z self << otherN)r)rrrrr __lshift__?szIntegral.__lshift__cCstdS)z other << selfN)r)rrrrr __rlshift__DszIntegral.__rlshift__cCstdS)z self >> otherN)r)rrrrr __rshift__IszIntegral.__rshift__cCstdS)z other >> selfN)r)rrrrr __rrshift__NszIntegral.__rrshift__cCstdS)z self & otherN)r)rrrrr__and__SszIntegral.__and__cCstdS)z other & selfN)r)rrrrr__rand__XszIntegral.__rand__cCstdS)z self ^ otherN)r)rrrrr__xor__]szIntegral.__xor__cCstdS)z other ^ selfN)r)rrrrr__rxor__bszIntegral.__rxor__cCstdS)z self | otherN)r)rrrrr__or__gszIntegral.__or__cCstdS)z other | selfN)r)rrrrr__ror__lszIntegral.__ror__cCstdS)z~selfN)r)rrrr __invert__qszIntegral.__invert__cCs tt|S)zfloat(self) == float(int(self)))r9r=)rrrrr+wszIntegral.__float__cCs| S)z"Integers are their own numerators.r)rrrrr:{szIntegral.numeratorcCsdS)z!Integers have a denominator of 1.r)rrrrr;szIntegral.denominator)N)r r r r r rr<r>r$r@rArBrCrDrErFrGrHrIrJr+r*r:r;rrrrr&s(             N)r abcrr__all__rrregisterr8rr9rrr=rrrrsp u _pdb.cpython-36.opt-2.pyc000064400000076344152462730460010726 0ustar003 \"@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z Gddde Zdddddd d d d g Zd dZddZddZGdddeZdZGdddejejZedk r^d dddddddddd d!d"d#d$d%d&d'dd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6g"Zx*eD]"Zeeed7ejjd87Zq(Weejj7Z[[dHd9dZdId:dZ d;dZ!dd Z$d?dZ%d@Z&dAdBZ'dCd Z(dDZ)dEdFZ*e+dGkrddl,Z,e,j*dS)KNc@s eZdZdS)RestartN)__name__ __module__ __qualname__rr/usr/lib64/python3.6/pdb.pyrUsrrunpmPdbrunevalrunctxruncall set_trace post_mortemhelpcCsxtjdtj|}y t|}Wntk r4dSX|4x,t|ddD]\}}|j|rJ|||fSqJWWdQRXdS)Nzdef\s+%s\s*[(])start)recompileescapeopenOSError enumeratematch)funcnamefilenameZcrefplinenolinerrr find_function\s  rcCsXtj|\}}tj|r,|j|jkr,|dfStj|r>|dfStj||d|dfS)Nr)inspectZ findsourceZisframe f_globalsf_localsZismoduleZgetblock)objlinesrrrrgetsourcelinesis  r%cCs8ttj|}|jx|D]\}}||kr|SqWdS)Nr)listdisZfindlinestartsreverse)codeZlastiZ linestartsirrrr lasti2linenors r+c@seZdZddZdS)_rstrcCs|S)Nr)selfrrr__repr__}sz_rstr.__repr__N)rrrr.rrrrr,{sr,z -> c@seZdZdZdddZddZd d Zd d Zd dZddZ ddZ ddZ ddZ ddZ ddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6ZeZdd8d9Zd:d;ZeZ eZ!eZ"dd?Z%d@dAZ&dBdCZ'eZ(dDdEZ)eZ*dFdGZ+eZ,dHdIZ-eZ.dJdKZ/e/Z0eZ1eZ2dLdMZ3e3Z4e3Z5dNdOZ6dPdQZ7e7Z8dRdSZ9e9Z:dTdUZ;e;ZdXdYZ?e?Z@dZd[ZAeAZBd\d]ZCeCZDd^d_ZEeEZFZGd`daZHeHZIdbdcZJeZKdddeZLeLZMeLZNdfdgZOdhdiZPePZQdjdkZReRZSdldmZTddndoZUdpdqZVdrdsZWeZXeZYeZZdtduZ[e[Z\dvdwZ]e]Z^dxdyZ_eZ`fdfdzd{Zad|d}ZbeZcd~dZdeZeddZfddZgddZhddZiddZjddZkddddddgZlddZmenfddZoddZpepZqddZrddZsddZtddZudS)r NtabFTc $CsJtjj||dtjj|||||r,d|_d|_i|_i|_d|_ d|_ i|_ yddl }|j dWntk rzYnXd|_||_g|_|r(dtjkrtjd}y.ttjj|d} |jj| WdQRXWntk rYnXy$td} |jj| WdQRXWntk r&YnXi|_i|_i|_d|_d|_dS) N)skiprz(Pdb) Fz `@#$%^&*()=+[{]}\|;:'",<>?HOMEz.pdbrc)bdbBdb__init__cmdCmdZ use_rawinputpromptaliases displaying mainpyfile_wait_for_mainpyfile tb_linenoreadlineZset_completer_delims ImportError allow_kbdintnosigintrcLinesosenvironrpathjoinextendrcommandscommands_dopromptcommands_silentcommands_defining commands_bnum) r- completekeystdinstdoutr0rAZreadrcr>ZenvHomeZrcFilerrrr5sH   z Pdb.__init__cCs*|jr t|jd|j|j|dS)Nz- Program interrupted. (Use 'cont' to resume).)r@KeyboardInterruptmessageset_stepr)r-Zsignumframerrrsigint_handlers  zPdb.sigint_handlercCstjj||jdS)N)r3r4resetforget)r-rrrrUs z Pdb.resetcCs&d|_g|_d|_d|_|jjdS)Nr)rstackcurindexcurframer=clear)r-rrrrVs z Pdb.forgetcCsl|j|j||\|_|_x*|rFt|jj|j}||j|j<|j }qW|j|jd|_ |j j |_ |j S)Nr)rVZ get_stackrWrXr+tb_framef_codetb_lastir=tb_nextrYr"curframe_locals execRcLines)r-ftbrrrrsetups   z Pdb.setupcCsh|js dS|j}|jg|_xD|rb|jj}|r |ddkr |j|r |jt|7_dSq WdS)Nr#T)rBr(popstriponecmdreversed)r-rBrrrrr`s  zPdb.execRcLinescCs.|jr dS|j|r*|jd|j|ddS)Nz--Call--)r<Z stop_hererQ interaction)r-rSZ argument_listrrr user_calls   z Pdb.user_callcCsH|jr.|j|j|jjks$|jdkr(dSd|_|j|rD|j|ddS)NrF)r<r;canonicr\ co_filenamef_lineno bp_commandsri)r-rSrrr user_lines  z Pdb.user_linecCst|ddr|j|jkr|j}d|_|j}|j|dx|j|D]}|j|qBW||_|j|sv|j|j|j |j |r|j |j dSdS)N currentbpFrr) getattrrprHlastcmdrcrgrJprint_stack_entryrWrXrI_cmdlooprV)r-rSrpZ lastcmd_backrrrrrns      zPdb.bp_commandscCs.|jr dS||jd<|jd|j|ddS)N __return__z --Return--)r<r"rQri)r-rSZ return_valuerrr user_returns   zPdb.user_returncCsj|jr dS|\}}}||f|jd<| r4|tkr4dnd}|jd|tj||djf|j||dS)NZ __exception__z Internal r1z%s%sr)r<r" StopIterationrQ tracebackformat_exception_onlyrfri)r-rSexc_infoexc_type exc_value exc_tracebackprefixrrruser_exception's zPdb.user_exceptionc CsDx>yd|_|jd|_PWqtk r:|jdYqXqWdS)NTFz--KeyboardInterrupt--)r@cmdlooprPrQ)r-rrrrt;sz Pdb._cmdloopcCsb|jj|j}|r^xJ|jD]>\}}|j|}||k r||kr|||<|jd|||fqWdS)Nzdisplay %s: %r [old: %r])r:getrYitems_getval_exceptrQ)r-r:exprZoldvalueZnewvaluerrrpreloopHs z Pdb.preloopcCsZtjrtjtjtjdt_|j||r4|jdS|j|j|j|j |jdS)N) r _previous_sigint_handlersignalSIGINTrcrVrsrWrXrt)r-rSryrrrriUs zPdb.interactioncCs|dk r|jt|dS)N)rQrepr)r-r#rrr displayhookcszPdb.displayhookc Cs|dddkr|dd}|j}|jj}ydt|ddd}tj}tj}tj}z(|jt_|jt_|jt_t|||Wd|t_|t_|t_XWn4tj dd}|j t j |dj YnXdS)Nr! zZsinglerw)r_rYr!rsysrOrNrexecr{errorryrzrf) r-rlocalsglobalsr)Z save_stdoutZ save_stdinZsave_displayhookr{rrrdefaultks(  z Pdb.defaultcCs|js |S|j}xx|d|jkr|j|d}d}x0|ddD] }|jdt||}|d7}qDW|jddj|dd}|j}qW|ddkr|jd}|dkr||ddj}|jj ||d|j }|S) Nrr%z%* aliasz;;r) rfsplitr9replacestrrFfindlstripcmdqueueappendrstrip)r-rargsZiiZtmpArgZmarkernextrrrprecmds&     z Pdb.precmdcCs"|jstjj||S|j|SdS)N)rKr6r7rghandle_command_def)r-rrrrrgsz Pdb.onecmdc Cs|j|\}}}|sdS|dkr0d|j|j<dS|dkrBg|_dS|j|j}|rf|j|d|n |j|yt|d|}Wntk r|j}YnX|j |j krd|j |j<g|_dSdS)NZsilentTendrrdo_F) Z parselinerJrLrrHrrqAttributeErrorrrcommands_resumingrI)r-rr6argZcmdlistfuncrrrrs,      zPdb.handle_command_defcCst||jddS)N)file)printrO)r-msgrrrrQsz Pdb.messagecCstd||jddS)Nz***)r)rrO)r-rrrrrsz Pdb.errorc Cs|jjdrgSy|j||||}Wntk r>g}YnXtj|d}xP|D]H}tjj|rt|j|dqTtjj |rT|j jdrT|j|dqTW|S) N:,*/.py.pyw)rr)rr) rfendswith_complete_expression ExceptionglobrCrEisdirrisfilelower)r-textrbegidxendidxZretglobsfnrrr_complete_locations   zPdb._complete_locationcsfddttjjDS)Ncs.g|]&\}}|dk rt|jrt|qS)N)r startswith).0r*bp)rrr sz*Pdb._complete_bpnumber..)rr3 Breakpoint bpbynumber)r-rrrrr)rr_complete_bpnumberszPdb._complete_bpnumberc s|js gS|jjj}|j|jdkrjdy0|d}xddD]}t||}qPWWnttfk r|gSXdj dddfddt |DSfdd|j DSdS) N.rrcs"g|]}|jdr|qS)rrw)r)rn)dottedrrrrsz,Pdb._complete_expression..csg|]}|jr|qSr)r)rr)rrrrsrwrw) rYr!copyupdater_rrqKeyErrorrrFdirkeys)r-rrrrnsr#partr)rrrrrs    zPdb._complete_expressioncCs(|sttjjd}n"y t|}Wn|jddS||_||jkrf|j||j||j |f}nd}g|j|<d|j|<d|j |<|j }d|_ d|_ zzy |j Wnht k r|r|d|j|<|d|j|<|d|j |<n|j|=|j|=|j |=|jdYnXWdd|_ ||_ XdS) Nrz.Usage: commands [bnum] ... endTFz(com) rrz1command definition aborted, old commands restored)lenr3rrintrrLrHrIrJr8rKrrP)r-rZbnumZold_command_defsZ prompt_backrrr do_commandss@%       zPdb.do_commandsrcCs@|s<|jr8|jdx"tjjD]}|r|j|jqWdSd}d}d}|jd}|dkr~||ddj}|d|j}|j d}d} |dkr|d|j}|j |} | s|j d|dS| }||ddj}y t |}Wn$t k r|j d|dSXny t |}Wnt k ryt||jj|j} Wn|} YnXy.t| drl| j} | j} | j} | j}| j}Wn@|j|\} }}| s|j d |dS| } t |}YnXYnX|s|j}|j||}|r<|j||||| }|r|j |n*|j||d }|jd |j|j|jfdS) Nz!Num Type Disp Enb Whererrrrz%r not found from sys.pathzBad lineno: %s__func__zJThe specified object %r is not a function or was not found along sys.path.zBreakpoint %d at %s:%drw) breaksrQr3rrZbpformatrrrrfind lookupmodulerr ValueErrorevalrYr!r_hasattrr__code__co_nameco_firstlinenorllineinfo defaultFile checklineZ set_break get_breaksnumberrr)r-rZ temporaryrrrcondZcommaZcolonrrarr)oklnrerrrrrdo_breakTs~             z Pdb.do_breakcCs"|jjj}|dkr|jr|j}|S)Nz)rYr\rlr;)r-rrrrrs zPdb.defaultFilecCs|j|ddS)Nr)r)r-rrrr do_tbreaksz Pdb.do_tbreakc Csd}|jd}t|dkr(|dj}nt|dkrB|dj}n|S|dkrR|S|jd}|ddkr~|d=t|dkr~|S|j}t|dkr|d}n|j|d}|r|}|d}t||} | p|S) N'rrr1rr-)NNN)rrrfrrr) r-Z identifierZfailedZidstringidpartsZfnameitemraZanswerrrrrs.         z Pdb.lineinfocCst|dr|jjnd}tj|||}|s6|jddS|j}| sp|ddksp|dddksp|dddkr~|jddS|S) NrYz End of filerrdrz"""z'''zBlank or comment)rrYr! linecachegetlinerQrfr)r-rrrrrrrrs   z Pdb.checklinecCsl|j}x^|D]V}y|j|}Wn,tk rL}z|j|WYdd}~XqX|j|jd|qWdS)Nz Enabled %s)rget_bpbynumberrrenablerQ)r-rrr*rrrrr do_enables z Pdb.do_enablecCsl|j}x^|D]V}y|j|}Wn,tk rL}z|j|WYdd}~XqX|j|jd|qWdS)Nz Disabled %s)rrrrdisablerQ)r-rrr*rrrrr do_disable s zPdb.do_disablecCs|jdd}y |d}Wntk r0d}YnXy|j|dj}WnHtk rf|jdYnXtk r}z|j|WYdd}~Xn.X||_|s|jd|jn|jd|jdS)NrrrzBreakpoint number expectedz#Breakpoint %d is now unconditional.z$New condition set for breakpoint %d.) r IndexErrorrrfrrrrQr)r-rrrrrrrr do_condition!s   zPdb.do_conditioncCs|j}yt|dj}Wnd}YnXy|j|dj}WnHtk rb|jdYnvtk r}z|j|WYdd}~XnLX||_|dkr|dkrd|}nd}|jd||j fn|jd|j dS)NrrzBreakpoint number expectedz %d crossingsz 1 crossingz%Will ignore next %s of breakpoint %d.z-Will stop next time breakpoint %d is reached.) rrrfrrrrignorerQr)r-rrcountrrZcountstrrrr do_ignore<s(   z Pdb.do_ignorec !Cs|sxy td}Wntk r(d}YnX|jj}|d krtddtjjD}|jx|D]}|jd|q^WdSd|kr|j d}|d|}||d d}y t |}Wnt k rd |}YnX|j ||}|j ||}|r|j|nx|D]}|jd|qWdS|j} xd| D]\}y|j|}Wn.t k rl}z|j|WYdd}~XnX|j||jd|q,WdS) NzClear all breaks? noyyescSsg|] }|r|qSrr)rrrrrrmsz Pdb.do_clear..z Deleted %srrzInvalid line number (%s))rr)inputEOFErrorrfrr3rrZclear_all_breaksrQrrrrZ clear_breakrrrZclear_bpbynumber) r-rZreplyZbplistrr*rrrZ numberlistrrrdo_clear_sF              z Pdb.do_clearcCs |jdS)N)print_stack_trace)r-rrrrdo_wheresz Pdb.do_wherecCs>||_|j|jd|_|jj|_|j|j|jd|_dS)Nr)rXrWrYr"r_rsr)r-rrrr _select_frames  zPdb._select_framec Csx|jdkr|jddSyt|p"d}Wn"tk rJ|jd|dSX|dkrZd}ntd|j|}|j|dS)Nrz Oldest framerzInvalid frame count (%s))rXrrrmaxr)r-rrnewframerrrdo_ups  z Pdb.do_upc Cs|jdt|jkr"|jddSyt|p,d}Wn"tk rT|jd|dSX|dkrnt|jd}ntt|jd|j|}|j|dS)Nrz Newest framezInvalid frame count (%s)r)rXrrWrrrminr)r-rrrrrrdo_downs z Pdb.do_downc Csf|rPy t|}Wn"tk r2|jd|dSX||jjkrT|jddSnd}|j|j|dS)NzError in argument: %rz7"until" line number is smaller than current line numberr)rrrrYrmZ set_until)r-rrrrrdo_untils   z Pdb.do_untilcCs |jdS)Nr)rR)r-rrrrdo_stepsz Pdb.do_stepcCs|j|jdS)Nr)Zset_nextrY)r-rrrrdo_nexts z Pdb.do_nextcCs<|r4ddl}tjdd}|j|t_|tjdd<tdS)Nrr)shlexrargvrr)r-rr Zargv0rrrdo_runs  z Pdb.do_runcCs|j|jdS)Nr)Z set_returnrY)r-rrrr do_returns z Pdb.do_returnc Cs>|js2ytjtj|jt_Wntk r0YnX|jdS)Nr)rArrrTr rrZ set_continue)r-rrrr do_continueszPdb.do_continuecCs|jdt|jkr"|jddSy t|}Wntk rL|jdYnnXy:||j_|j|jd|f|j|j<|j|j|jWn0tk r}z|jd|WYdd}~XnXdS)Nrz)You can only jump within the bottom framez)The 'jump' command requires a line numberrzJump failed: %s) rXrrWrrrrYrmrs)r-rerrrdo_jump"s   z Pdb.do_jumpcCsztjd|jj}|j}t|j|j|j}d|j j |_ |j dtj |j |||f|j dtj|j|j|_dS)Nz(%s) zENTERING RECURSIVE DEBUGGERzLEAVING RECURSIVE DEBUGGER)rsettracerYr!r_r rMrNrOr8rfrQ call_tracingrZtrace_dispatchrr)r-rrrprrrdo_debug?s    z Pdb.do_debugcCsd|_|jdS)NTr)_user_requested_quitset_quit)r-rrrrdo_quitRsz Pdb.do_quitcCs|jdd|_|jdS)Nr1Tr)rQrr)r-rrrrdo_EOF]s z Pdb.do_EOFcCs|jj}|j}|j}|jd@r&|d}|jd@r8|d}xJt|D]>}|j|}||krp|jd|||fqB|jd|fqBWdS)Nrz%s = %rz%s = *** undefined ***)rYr\r_ co_argcountco_flagsrange co_varnamesrQ)r-rcodictrr*namerrrdo_argsfs   z Pdb.do_argscCs.d|jkr |jt|jdn |jddS)NruzNot yet returned!)r_rQrr)r-rrrr do_retvalws z Pdb.do_retvalc CsNyt||jj|jStjdd}|jtj|dj YnXdS)Nrrrw) rrYr!r_rr{rryrzrf)r-rr{rrr_getvals z Pdb._getvalc Cshy.|dkrt||jj|jSt||j|jSWn4tjdd}tj|dj }t d|SdS)Nrrz** raised %s **rw) rrYr!r_r"rr{ryrzrfr,)r-rrSr{rrrrrszPdb._getval_exceptc Cs*y|jt|j|Wn YnXdS)N)rQrr%)r-rrrrdo_pszPdb.do_pc Cs,y|jtj|j|Wn YnXdS)N)rQpprintZpformatr%)r-rrrrdo_ppsz Pdb.do_ppcCsdd|_d}|r|dkry^d|krX|jd\}}t|j}t|j}||krr||}nt|j}td|d}Wqtk r|jd|dSXn0|jdks|dkrtd|jj d}n |jd}|dkr|d}|jj j }|j |}yZt j||jj}|j||d||||jt|t||_t||krF|jdWntk r^YnXdS) Nr&rrrzError in argument: %r z[EOF])rrrrrfrrrrrYrmr\rlget_file_breaksrgetlinesr! _print_linesrrrQrP)r-rZlastfirstr breaklistr$rrrdo_lists>        z Pdb.do_listcCsh|jjj}|j|}yt|j\}}Wn*tk rP}z|j|dSd}~XnX|j||||jdS)N)rYr\rlr+r%rrr-)r-rrr/r$rrrrr do_longlists   zPdb.do_longlistcCsjy|j|}Wn dSyt|\}}Wn.ttfk rX}z|j|dSd}~XnX|j||dS)N)r%r%r TypeErrorrr-)r-rr#r$rrrrr do_sources z Pdb.do_sourcec Cs|r|j}|jj|d }nd }}xt||D]|\}}t|jd} t| dkrX| d7} ||krj| d7} n| d7} ||kr| d7} n||kr| d7} |j| d|jq.WdS) NrrrrBz->z>> rwrw) rmr=rrrrjustrrQr) r-r$rrrSZcurrent_linenoZ exc_linenorrsrrrr-s    zPdb._print_linescCsy|j|}Wn dSd}y |j}Wntk r<YnX|rV|jd|jdSy |jj}Wntk rvYnX|r|jd|jdS|jtkr|jd|j|j fdS|jt|dS)Nz Function %sz Method %sz Class %s.%s) r%rrrQrr __class__typerr)r-rvaluer)rrr do_whatiss.   z Pdb.do_whatiscCsp|s<|jdx\|jj|jijD]}|jd|q$Wn0|j|}||jj|ji|<|jd||fdS)NzCurrently displaying:z%s: %rzdisplay %s: %r)rQr:rrYrr setdefault)r-rrvalrrr do_display4s  zPdb.do_displayc CsT|r@y|jj|ji|=WqPtk r<|jd|YqPXn|jj|jddS)Nznot displaying %s)r:rrYrrre)r-rrrr do_undisplayGs zPdb.do_undisplaycsfdd|jj|jiDS)Ncsg|]}|jr|qSr)r)rr)rrrrWsz*Pdb.complete_undisplay..)r:rrY)r-rrrrr)rrcomplete_undisplayVszPdb.complete_undisplaycCs*|jjj}|j|jtjd|ddS)Nz *interactive*)Zlocal)rYr!rrr_r)interact)r-rrrrr do_interactZs  zPdb.do_interactcCs|j}t|dkrLt|jj}x$|D]}|jd||j|fq(WdS|d|jkrt|dkr|jd|d|j|dfndj|dd|j|d<dS)Nrz%s = %srr)rrsortedr9rrQrF)r-rrrrrrrdo_aliasds  "z Pdb.do_aliascCs6|j}t|dkrdS|d|jkr2|j|d=dS)Nr)rrr9)r-rrrrr do_unaliass  zPdb.do_unaliascsfdd|jDS)Ncsg|]}|jr|qSr)r)ra)rrrrsz(Pdb.complete_unalias..)r9)r-rrrrr)rrcomplete_unaliasszPdb.complete_unaliasrr r rrrc Cs8yx|jD]}|j|q WWntk r2YnXdS)N)rWrsrP)r- frame_linenorrrrs  zPdb.print_stack_tracecCs6|\}}||jkrd}nd}|j||j||dS)Nz> z )rYrQZformat_stack_entry)r-rHZ prompt_prefixrSrrrrrrss  zPdb.print_stack_entrycCs|stjj||Sy}xtjj |rtj |}qWtjj||}tjj|r|SqWdS)Nrr1z.py) rCrEisabsexistsrFrrkr;splitextislinkreadlink)r-rrarootZextdirnamefullnamerrrrs"   zPdb.lookupmodulec Cstddl}|jj|jjd|tdd|_|j||_d|_t |d}d|j |jf}WdQRX|j |dS)Nr__main__)r__file__ __builtins__TFrbzexec(compile(%r, %r, 'exec'))) rW__dict__rZrrYr<rkr;rrreadr)r-rrWr statementrrr _runscripts    zPdb._runscript)r/NNNFT)r)N)vrrrrr5rTrUrVrcr`rjrornrvrrtrrirrrrgrrQrrrrrZcomplete_commandsrrZdo_bZcomplete_breakZ complete_brZcomplete_tbreakrrrZcomplete_enablerZcomplete_disablerZcomplete_conditionrZcomplete_ignorerZdo_clZcomplete_clearZ complete_clrZdo_wZdo_btrrZdo_urZdo_drZdo_untr Zdo_sr Zdo_nr Z do_restartrZdo_rrZdo_cZdo_contrZdo_jrZcomplete_debugrZdo_qZdo_exitrr#Zdo_ar$Zdo_rvr%rr&r(Zcomplete_printZ complete_pZ complete_ppr0Zdo_lr1Zdo_llr3Zcomplete_sourcer-r;Zcomplete_whatisr>Zcomplete_displayr?r@rBrDrErGrr line_prefixrsrIZdo_hrMrNrr^rrrrr s /     M ]!!.    1 ! #    whereZdownZupbreakZtbreakrZrrrZ conditionrHsteprZuntilZjumpreturnZretvalcontinuer&ZlonglistrrZppZwhatissourceZdisplayZ undisplayrArZunaliasdebugquitrz cCstj|||dS)N)r r)r]rrrrrr#scCstj|||S)N)r r )Z expressionrrrrrr &scCst|||dS)N)r)r]rrrrrr )scOstj||S)N)r r )rkwdsrrrr -scCstjtjjdS)N)r rr _getframef_backrrrrr0scCsB|dkrtjd}|dkr$tdt}|j|jd|dS)NrzAA valid traceback must be passed if no exception is being handled)rr{rr rUri)trrrrr5s cCsttjdS)N)rrlast_tracebackrrrrr Cszimport x; x.main()cCs ttdS)N)rTESTCMDrrrrtestKsrncCsddl}|jtdS)Nr)pydocZpagerrL)rorrrrOsausage: pdb.py [-c command] ... pyfile [arg] ... Debug the Python program given by pyfile. Initial commands are read from .pdbrc files in your home directory and in the current directory, if they exist. Commands supplied with -c are executed after commands from .pdbrc files. To let the script run until an exception occurs, use "-c continue". To let the script run up to a given line X in the debugged file, use "-c 'until X'".c Csddl}|jtjdddddg\}}|s>tttjdg}x<|D]4\}}|dkrjtttjqH|dkrH|j|qHW|d}tjj |std |d tjd|tjdd<tjj |tjd<t }|j j |xy|j||jrPtd Wqtk r0td |dtddj|Yqtk r`tdddttjdYqtk rtjtjdYqtjtdtdtjd}|jd|td|dYqXqWdS)Nrrzhc:--helpz --command=r-h-c --commandzError:zdoes not existz*The program finished and will be restartedZ Restartingzwith arguments:r5rz/The program exited via sys.exit(). Exit status:)rz2Uncaught exception. Entering post mortem debuggingz1Running 'cont' or 'step' will restart the programz#Post mortem debugger finished. The z will be restarted)rqrp)rrrs)getoptrr r_usageexitrrCrErPrUr rBrGr^rrrF SystemExitr{ SyntaxErrorry print_excri) rtZoptsrrHoptZoptargr;pdbrkrrrmain`sV             r|rW)NN)NN)N)-rCrrr6r3r'r)rr'rr ryrrr__all__rr%r+rr,r_r4r7r rLZ _help_orderZ_commandrqrfrMrr r r rrr rmrnrrur|rr{rrrrFsr      "    < pathlib.cpython-36.opt-1.pyc000064400000117556152462730460011604 0ustar003 i@s$ddlZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z mZmZmZddlmZddlmZmZmZmZmZmZmZddlmZdZd d d d d dgZdZ dZ!dZ"ddZ#Gddde$Z%Gddde%Z&Gddde%Z'e&Z(e'Z)GdddZ*Gddde*Z+e+Z,ddZ-e.ed rTej/e-Z-Gd!d"d"Z0Gd#d$d$Z1Gd%d&d&e0Z2Gd'd(d(e0Z3Gd)d*d*e0Z4Gd+d,d,e Z5Gd-d d e$Z6ej7j8e6Gd.d d e6Z9Gd/d d e6Z:Gd0d d e6Z;Gd1d d e;e9Zssz_WindowsFlavour.azr7ccs|]}t|VqdS)N)rB)rCr5rrrrDtsAZz\\?\ZCONZPRNZAUXZNULcCsh|] }d|qS)zCOM%dr)rCirrr zsz_WindowsFlavour. cCsh|] }d|qS)zLPT%dr)rCrIrrrrJ{sc Csb|dd}|dd}||krP||krP|j|\}}|dd}|dd}nd}|dd}||kov||kov||kr|j|d}|dkr|j||d}||dkr|dkrt|}|r||d||||ddfS|d||||ddfSd} } |dkr<||jkr<|dd} |dd}|}||krT|} |j|}|| | |fS) Nrr7r%:rO)_split_extended_pathfindlen drive_letterslstrip) r#r4r!firstsecondprefixZthirdindexZindex2r1r2rrrr*s6      "    z_WindowsFlavour.splitrootcCs|jS)N)lower)r#srrrr8sz_WindowsFlavour.casefoldcCsdd|DS)NcSsg|] }|jqSr)rY)rCprrr sz2_WindowsFlavour.casefold_parts..r)r#r0rrrcasefold_partssz_WindowsFlavour.casefold_partscCsXd}|j|rP|dd}|dd}|jdrP||dd7}d|dd}||fS)Nr%zUNC\rMr?) startswith)r#rZZ ext_prefixrWrrrrPs    z$_WindowsFlavour._split_extended_pathcCs6|sdS|djdrdS|djddj|jkS)NFrz\\r7r&rO)r_ partitionupperreserved_names)r#r0rrr is_reserveds z_WindowsFlavour.is_reservedcCsd|j}t|dkrJ|ddkrJ|jddjd}d|t|jdfSdt|jjdSdS)NrLr7rNr@z file:///%s/%szutf-8zfile:)driverRas_posixrTurlquote_from_bytesencode)r#pathrdrestrrrmake_uris z_WindowsFlavour.make_uric Csdtjkrtjd}n`dtjkr,tjd}nJdtjkrnytjd}Wntk r\d}YnX|tjd}ntd|rtjd|kr|j|f\}}}|d tjdkrtd |||d <|s|r|||j|dd}n |j|}|S) NHOMEZ USERPROFILEZHOMEPATHZ HOMEDRIVEr%zCan't determine home directoryZUSERNAMEr7z%Can't determine home directory for %rrOrO)osenvironKeyError RuntimeErrorr6r")r#usernameuserhomer1r2r0rrr gethomedirs,       z_WindowsFlavour.gethomedirN)r:r;r<r!r'has_drvntpathpathmodrlname is_supportedsetrangeordrSZext_namespace_prefixrbr*r8r]rPrcrjrrrrrrr>gs" "& '   r>c@sZeZdZdZdZdZeZej dkZ efddZ ddZ d d Z d d Zd dZddZdS) _PosixFlavourr@r%FrAcCsV|rH|d|krH|j|}t|t|dkr.wrapped) functoolswraps staticmethod)rrr)rr _wrap_strfunc3sz_NormalAccessor._wrap_strfunccstjfdd}t|S)Ncst|t|f|S)N)r)ZpathobjAZpathobjBr)rrrr:sz5_NormalAccessor._wrap_binary_strfunc..wrapped)rrr)rrr)rr_wrap_binary_strfunc9sz$_NormalAccessor._wrap_binary_strfunclchmodcCs tddS)Nz%lchmod() not available on this system)NotImplementedError)r#rmoderrrrNsz_NormalAccessor.lchmodsymlinkFcCs tddS)Nz)os.symlink() not available on this system)r)r#srcdsttarget_is_directoryrrrr^sz_NormalAccessor.symlinkcCs tj|S)N)rlreadlink)r#rhrrrresz_NormalAccessor.readlinkN)F)r:r;r<rrrlstatlstatopenlistdirscandirchmodhasattrrmkdirunlinkrmdirrenamer)rutimergetcwdrrh expanduserrealpathrrrrr1s0                 rcCsP|d}|dd}|dkr"t}n$d|kr4tdnt|rBt}nt}|||S)Nrr7z**z:Invalid pattern: '**' can only be an entire path component)_RecursiveWildcardSelector ValueErrorr_WildcardSelector_PreciseSelector) pattern_partsr child_partsclsrrr_make_selectorvs  r lru_cachec@s eZdZdZddZddZdS) _SelectorzYA selector matches a specific glob pattern part against the children of a given path.cCs.||_|rt||_d|_nt|_d|_dS)NTF)rr successordironly_TerminatingSelector)r#rrrrr$s  z_Selector.__init__cCs<t|}|j}|j}|jj}||s,tgS|j||||S)zuIterate over all child paths of `parent_path` matched by this selector. This can contain parent_path itself.)typeis_direxists _accessorriter _select_from)r# parent_pathZpath_clsrrrrrr select_fromsz_Selector.select_fromN)r:r;r<r=r$rrrrrrs rc@seZdZddZdS)rccs |VdS)Nr)r#rrrrrrrrsz!_TerminatingSelector._select_fromN)r:r;r<rrrrrrsrc@seZdZddZddZdS)rcCs||_tj||dS)N)rvrr$)r#rvrrrrr$sz_PreciseSelector.__init__c cs^yD|j|j}|jr|n||rBx |jj||||D] }|Vq4WWntk rXdSXdS)N)_make_child_relpathrvrrrPermissionError)r#rrrrrhr[rrrrs z_PreciseSelector._select_fromN)r:r;r<r$rrrrrrsrc@seZdZddZddZdS)rcCs"tjtj||_tj||dS)N)recompilefnmatch translaterrr$)r#rrrrrr$sz_WildcardSelector.__init__c csy||jj}t||}xb|D]Z}|j s0|jr|j}||} |jj| r|j|} x |j j | |||D] } | VqhWqWWnt k rdSXdS)N) _flavourr8listrrrvrmatchrrrr) r#rrrrcfentriesentryrvZ casefoldedrhr[rrrrs    z_WildcardSelector._select_fromN)r:r;r<r$rrrrrrsrc@s$eZdZddZddZddZdS)rcCstj||dS)N)rr$)r#rrrrrr$sz#_RecursiveWildcardSelector.__init__c csz|VyZt||}xH|D]@}|jr|j r|j|j}x|j|||D] }|VqLWqWWntk rtdSXdS)N)rr is_symlinkrrv_iterate_directoriesr)r#rrrrrrhr[rrrrs   z/_RecursiveWildcardSelector._iterate_directoriesc csyjt}zT|jj}xF|j|||D]4}x.|||||D]}||kr6|V|j|q6Wq"WWd|jXWntk r~dSXdS)N)rxrrraddclearr) r#rrrrZyieldedZsuccessor_selectZstarting_pointr[rrrrsz'_RecursiveWildcardSelector._select_fromN)r:r;r<r$rrrrrrrs rc@s4eZdZdZdZddZdd Zd d Zd d ZdS) _PathParentszvThis object provides sequence-like access to the logical ancestors of a path. Don't try to construct it yourself._pathcls_drv_root_partscCs&t||_|j|_|j|_|j|_dS)N)rrrrr)r#rhrrrr$s z_PathParents.__init__cCs(|js |jrt|jdSt|jSdS)Nr7)rrrRr)r#rrr__len__s z_PathParents.__len__cCs@|dks|t|krt||jj|j|j|jd| dS)Nrr7)rR IndexErrorr_from_parsed_partsrrr)r#idxrrr __getitem__sz_PathParents.__getitem__cCsdj|jjS)Nz <{}.parents>)formatrr:)r#rrr__repr__ sz_PathParents.__repr__N)rrrr) r:r;r<r= __slots__r$rrrrrrrrs rc@seZdZdZdZZd d Zd d Zed dZed[ddZ ed\ddZ eddZ ddZ ddZ ddZddZddZd d!Zd"d#Zd$d%Zed&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zeedd4d5Zeedd6d5Zed7d8Zed9d:Z ed;d<Z!ed=d>Z"ed?d@Z#dAdBZ$dCdDZ%dEdFZ&edGdHZ'dIdJZ(dKdLZ)dMdNZ*edOdPZ+edQdRZ,dSdTZ-dUdVZ.dWdXZ/dYS)]ra|Base class for manipulating paths without I/O. PurePath represents a filesystem path and offers operations which don't imply any actual filesystem I/O. Depending on your system, instantiating a PurePath will return either a PurePosixPath or a PureWindowsPath object. You can also instantiate either of these classes directly, regardless of your system. rrr_str_hash_pparts_cached_cpartscGs$|tkrtjdkrtnt}|j|S)zConstruct a PurePath from one or several strings and or existing PurePath objects. The strings and path objects are combined so as to yield a canonicalized path, which is incorporated into the new PurePath object. rA)rrlrvrr _from_parts)rrrrr__new__szPurePath.__new__cCs|jt|jfS)N) __class__tupler)r#rrr __reduce__&szPurePath.__reduce__cCshg}xV|D]N}t|tr$||j7}q tj|}t|trH|jt|q tdt|q W|j j |S)NzNargument should be a str object or an os.PathLike object returning str, not %r) isinstancerrrlfspathrr, TypeErrorrrr6)rrr0rErrr _parse_args+s     zPurePath._parse_argsTcCs<tj|}|j|\}}}||_||_||_|r8|j|S)N)objectrrrrr_init)rrinitr#r1r2r0rrrr?s zPurePath._from_partscCs,tj|}||_||_||_|r(|j|S)N)rrrrrr)rr1r2r0rr#rrrrLs zPurePath._from_parsed_partscCs4|s|r$|||jj|ddS|jj|SdS)Nr7)rr")rr1r2r0rrr_format_parsed_partsVszPurePath._format_parsed_partscCsdS)Nr)r#rrrr]szPurePath._initcCs@|j|\}}}|jj|j|j|j|||\}}}|j|||S)N)rrr9rrrr)r#rr1r2r0rrr _make_childaszPurePath._make_childc Cs<y|jStk r6|j|j|j|jp,d|_|jSXdS)z[Return the string representation of the path, suitable for passing to system calls.r&N)rAttributeErrorrrrr)r#rrr__str__gs  zPurePath.__str__cCst|S)N)r)r#rrr __fspath__qszPurePath.__fspath__cCs|j}t|j|jdS)zNReturn the string representation of the path with forward (/) slashes.r@)rrr)r!)r#frrrretszPurePath.as_posixcCstjt|S)zaReturn the bytes representation of the path. This is only recommended to use under Unix.)rlfsencoder)r#rrr __bytes__zszPurePath.__bytes__cCsdj|jj|jS)Nz{}({!r}))rrr:re)r#rrrrszPurePath.__repr__cCs|jstd|jj|S)z Return the path as a 'file' URI.z.relative path can't be expressed as a file URI) is_absoluterrrj)r#rrras_uriszPurePath.as_uric Cs2y|jStk r,|jj|j|_|jSXdS)N)rrrr]r)r#rrr_cpartss zPurePath._cpartscCs&t|tstS|j|jko$|j|jkS)N)rrNotImplementedrr)r#otherrrr__eq__s zPurePath.__eq__c Cs2y|jStk r,tt|j|_|jSXdS)N)rrhashrr)r#rrr__hash__s zPurePath.__hash__cCs(t|t s|j|jk rtS|j|jkS)N)rrrrr)r#rrrr__lt__szPurePath.__lt__cCs(t|t s|j|jk rtS|j|jkS)N)rrrrr)r#rrrr__le__szPurePath.__le__cCs(t|t s|j|jk rtS|j|jkS)N)rrrrr)r#rrrr__gt__szPurePath.__gt__cCs(t|t s|j|jk rtS|j|jkS)N)rrrrr)r#rrrr__ge__szPurePath.__ge__z.The drive prefix (letter or UNC path), if any.)doczThe root of the path, if any.cCs|j|j}|S)z/The concatenation of the drive and root, or ''.)rr)r#anchorrrrrs zPurePath.anchorcCs.|j}t||js|jrdndkr&dS|dS)z!The final path component, if any.r7rr%rO)rrRrr)r#r0rrrrvsz PurePath.namecCsD|j}|jd}d|ko*t|dknr<||dSdSdS)z*The final component's last suffix, if any.r&rr7Nr%)rvrfindrR)r#rvrIrrrsuffixs    zPurePath.suffixcCs:|j}|jdrgS|jd}dd|jdddDS)z1A list of the final component's suffixes, if any.r&cSsg|] }d|qS)r&r)rCrrrrr\sz%PurePath.suffixes..r7N)rvendswithrTr+)r#rvrrrsuffixess   zPurePath.suffixescCsD|j}|jd}d|ko*t|dknr<|d|S|SdS)z0The final path component, minus its last suffix.r&rr7N)rvrrR)r#rvrIrrrstems    z PurePath.stemcCs|jstd|f|jj|f\}}}| sZ|d|jj|jjgksZ|sZ|sZt|dkrftd||j|j|j |j dd|gS)z-Return a new path with the file name changed.z%r has an empty namer7zInvalid name %rNrOrO) rvrrr6r!r'rRrrrr)r#rvr1r2r0rrr with_names  zPurePath.with_namecCs|j}|j|ks |jr,|j|kr,td||r<|jd sD|dkrPtd||j}|shtd|f|j}|s|||}n|dt| |}|j|j |j |j dd|gS)zReturn a new path with the file suffix changed. If the path has no suffix, add given suffix. If the given suffix is an empty string, remove the suffix from the path. zInvalid suffix %rr&z%r has an empty nameNr7rO) rr!r'rr_rvrrRrrrr)r#rrrvZ old_suffixrrr with_suffixs    zPurePath.with_suffixc Gs|s td|j}|j}|j}|r8||g|dd}n|}|j|\}}}|rf||g|dd} n|} t| } |jj} | dkr|p|n| |d| | | kr|j|||} t dj t |t | |j d| dkr|nd|| dS)zReturn the relative path to another path identified by the passed arguments. If the operation is not possible (because this is not a subpath of the other path), raise ValueError. zneed at least one argumentr7Nrz{!r} does not start with {!r}r%) rrrrrrRrr]rrrrr) r#rr0r1r2Z abs_partsZto_drvZto_rootZto_partsZ to_abs_partsnrZ formattedrrr relative_tos( (zPurePath.relative_toc Cs.y|jStk r(t|j|_|jSXdS)zZAn object providing sequence-like access to the components in the filesystem path.N)rrrr)r#rrrr0"s  zPurePath.partscGs |j|S)zCombine this path with one or several arguments, and return a new path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored). )r)r#rrrrjoinpath.szPurePath.joinpathcCs |j|fS)N)r)r#keyrrr __truediv__6szPurePath.__truediv__cCs|j|g|jS)N)rr)r#rrrr __rtruediv__9szPurePath.__rtruediv__cCs@|j}|j}|j}t|dkr*|s&|r*|S|j|||ddS)zThe logical parent of the path.r7NrO)rrrrRr)r#r1r2r0rrrparent<s zPurePath.parentcCst|S)z*A sequence of this path's logical parents.)r)r#rrrparentsFszPurePath.parentscCs|js dS|jj pt|jS)zSTrue if the path is absolute (has both a root and, if applicable, a drive).F)rrrsboolr)r#rrrrKszPurePath.is_absolutecCs|jj|jS)zaReturn True if the path contains one of the special names reserved by the system, if any.)rrcr)r#rrrrcRszPurePath.is_reservedc Cs|jj}||}|jj|f\}}}|s0td|rF|||jkrFdS|r\|||jkr\dS|j}|sj|rt|t|kr~dS|dd}nt|t|krdSx.tt |t |D]\}}t j ||sdSqWdS)zE Return True if this path matches the given pattern. z empty patternFr7NT) rr8r6rrrrrRzipr(rZ fnmatchcase) r#Z path_patternrr1r2Z pat_partsr0r4rrrrrWs( zPurePath.matchN)rrrrrrr)T)T)0r:r;r<r=rrr classmethodrrrrrrrrrerrrpropertyrrrrrrrrrdr2rrvrrrrrrr0rr r r r rrcrrrrrrs^            c@seZdZdZeZfZdS)rzPurePath subclass for non-Windows systems. On a POSIX system, instantiating a PurePath should return this object. However, you can also instantiate it directly on any system. N)r:r;r<r=_posix_flavourrrrrrrrusc@seZdZdZeZfZdS)rzPurePath subclass for Windows systems. On a Windows system, instantiating a PurePath should return this object. However, you can also instantiate it directly on any system. N)r:r;r<r=_windows_flavourrrrrrrrsc@seZdZdZdaZddZdbddZd d Zd d Zd dZ ddZ dcddZ ddddZ e ddZe ddZddZddZdd Zd!d"Zd#d$Zded&d'Zd(d)Zd*d+Zd,d-Zdgd0d1Zd2d3Zdhd4d5Zd6d7Zdid8d9Zdjd;d<Zdkd=d>Zd?d@Z dAdBZ!dCdDZ"dEdFZ#dGdHZ$dIdJZ%dKdLZ&dldMdNZ'dOdPZ(dQdRZ)dSdTZ*dUdVZ+dWdXZ,dYdZZ-d[d\Z.d]d^Z/d_d`Z0dS)mraPurePath subclass that can make system calls. Path represents a filesystem path but unlike PurePath, also offers methods to do system calls on path objects. Depending on your system, instantiating a Path will return either a PosixPath or a WindowsPath object. You can also instantiate a PosixPath or WindowsPath directly, but cannot instantiate a WindowsPath on a POSIX system or vice versa. r_closedcOsL|tkrtjdkrtnt}|j|dd}|jjs@td|j f|j |S)NrAF)rz$cannot instantiate %r on your system) rrlrvrrrrrwrr:r)rrkwargsr#rrrrs z Path.__new__NcCs"d|_|dk r|j|_nt|_dS)NF)rr_normal_accessor)r#templaterrrrs z Path._initcCs|j|g}|j|j|j|S)N)rrrr)r#r4r0rrrrs zPath._make_child_relpathcCs|jr|j|S)N)r _raise_closed)r#rrr __enter__szPath.__enter__cCs d|_dS)NT)r)r#tvtbrrr__exit__sz Path.__exit__cCs tddS)NzI/O operation on closed path)r)r#rrrrszPath._raise_closedcCs|jj|||S)N)rr)r#rvflagsrrrr_openersz Path._openercCs|jr|j|jj|||S)zm Open the file pointed by this path and return a file descriptor, as os.open() does. )rrrr)r#rrrrr _raw_openszPath._raw_opencCs |tjS)zjReturn a new path pointing to the current working directory (as returned by os.getcwd()). )rlr)rrrrcwdszPath.cwdcCs||jjdS)zrReturn a new path pointing to the user's home directory (as returned by os.path.expanduser('~')). N)rrr)rrrrhomesz Path.homec CsB|j}y |j}Wntk r2tj|}YnXtjj||S)zoReturn whether other_path is the same or not as this file (as returned by os.path.samefile()). )rrrlrhsamestat)r#Z other_pathstZother_strrrsamefiles  z Path.samefileccsL|jr|jx8|jj|D](}|dkr*q|j|V|jr|jqWdS)zyIterate over the files in this directory. Does not yield any result for the special paths '.' and '..'. r&..N>r&r')rrrrr)r#rvrrriterdirs z Path.iterdirccsl|stdj||jj|}|jj|f\}}}|s:|rBtdtt|}x|j|D] }|VqZWdS)zIterate over this subtree and yield all existing files (of any kind, including directories) matching the given pattern. zUnacceptable pattern: {!r}z%Non-relative patterns are unsupportedN) rrrr8r6rrrr)r#patternr1r2rselectorr[rrrglobs  z Path.globccs^|jj|}|jj|f\}}}|s(|r0tdtdt|}x|j|D] }|VqLWdS)zRecursively yield all existing files (of any kind, including directories) matching the given pattern, anywhere in this subtree. z%Non-relative patterns are unsupported**N)r,)rr8r6rrrr)r#r)r1r2rr*r[rrrrglobs z Path.rglobcCsD|jr|j|jr|S|jtjg|jdd}|j|d|S)aReturn an absolute version of this path. This function works even if the path doesn't point to anything. No normalization is done, i.e. all '.' and '..' will be kept along. Use resolve() to get the canonical path to a file. F)r)r)rrrrrlrrr)r#objrrrabsolutes z Path.absoluteFcCs|jr|jdd}y|jj||d}Wn,tk rV}z||WYdd}~XnX|j|f}|sy |jWn*tk r}z||WYdd}~XnX|S)z Make the path absolute, resolving all symlinks on the way and also normalizing it (for example turning slashes into backslashes under Windows). cSs0t|dd}|jtks|tkr,td|jdS)NwinerrorrzSymlink loop from %r)getattrerrnor_WINERROR_CANT_RESOLVE_FILENAMErofilename)er0rrr check_eloop*s z!Path.resolve..check_eloop)strictN)rrrrOSErrorrr)r#r7r6rZr5r[rrrresolve!s  z Path.resolvecCs |jj|S)zh Return the result of the stat() system call on this path, like os.stat() does. )rr)r#rrrr?sz Path.statcCsddl}|j|jjjS)z: Return the login name of the file owner. rN)r}r~rst_uidZpw_name)r#r}rrrownerFsz Path.ownercCsddl}|j|jjjS)z8 Return the group name of the file gid. rN)grpZgetgrgidrst_gidZgr_name)r#r<rrrgroupMsz Path.grouprr7c Cs,|jr|jtjt|||||||jdS)z| Open the file pointed by this path and return a file object, as the built-in open() function does. )opener)rriorrr)r#r bufferingencodingerrorsnewlinerrrrTsz Path.openc Cs |jdd }|jSQRXdS)zK Open the file in bytes mode, read it, and close the file. rb)rN)rread)r#rrrr read_bytes_szPath.read_bytesc Cs$|jd||d }|jSQRXdS)zJ Open the file in text mode, read it, and close the file. r?)rrCrDN)rrG)r#rCrDrrrr read_textfszPath.read_textc Cs*t|}|jdd }|j|SQRXdS)zO Open the file in bytes mode, write to it, and close the file. wb)rN) memoryviewrwrite)r#dataZviewrrrr write_bytesmszPath.write_bytesc Cs@t|tstd|jj|jd||d }|j|SQRXdS)zN Open the file in text mode, write to it, and close the file. zdata must be str, not %sw)rrCrDN)rrrrr:rrL)r#rMrCrDrrrr write_textvs   zPath.write_textTc Csr|jr|j|r>y|jj|dWntk r8YnXdStjtjB}|sX|tjO}|j ||}tj |dS)zS Create this file with the given access mode, if it doesn't exist. N) rrrrr8rlO_CREATO_WRONLYO_EXCLr!close)r#rexist_okrfdrrrtouchs   z Path.touchc Cs|jr|jy|jj||Wnjtk rf| s@|j|krB|jjddd|j|d|dYn&tk r| s|j rYnXdS)z< Create a new directory at this given path. T)r rUFN)rrrrFileNotFoundErrorr r8r)r#rr rUrrrrsz Path.mkdircCs |jr|j|jj||dS)zF Change the permissions of the path, like os.chmod(). N)rrrr)r#rrrrrsz Path.chmodcCs |jr|j|jj||dS)z Like chmod(), except if the path points to a symlink, the symlink's permissions are changed, rather than its target's. N)rrrr)r#rrrrrsz Path.lchmodcCs|jr|j|jj|dS)zd Remove this file or link. If the path is a directory, use rmdir() instead. N)rrrr)r#rrrrsz Path.unlinkcCs|jr|j|jj|dS)zF Remove this directory. The directory must be empty. N)rrrr)r#rrrrsz Path.rmdircCs|jr|j|jj|S)z Like stat(), except if the path points to a symlink, the symlink's status information is returned, rather than its target's. )rrrr)r#rrrrsz Path.lstatcCs |jr|j|jj||dS)z5 Rename this path to the given path. N)rrrr)r#targetrrrrsz Path.renamecCs |jr|j|jj||dS)zo Rename this path to the given path, clobbering the existing destination if it exists. N)rrrr))r#rYrrrr)sz Path.replacecCs"|jr|j|jj|||dS)z Make this path a symlink pointing to the given path. Note the order of arguments (self, target) is the reverse of os.symlink's. N)rrrr)r#rYrrrr symlink_toszPath.symlink_tocCsBy |jWn0tk r<}z|jttfkr.dSd}~XnXdS)z+ Whether this path exists. FNT)rr8r2rr)r#r5rrrrs z Path.existscCsDyt|jjStk r>}z|jttfkr0dSd}~XnXdS)z3 Whether this path is a directory. FN)r rst_moder8r2rr)r#r5rrrrs z Path.is_dircCsDyt|jjStk r>}z|jttfkr0dSd}~XnXdS)zq Whether this path is a regular file (also True for symlinks pointing to regular files). FN)r rr[r8r2rr)r#r5rrris_file s z Path.is_filecCsDyt|jjStk r>}z|jttfkr0dSd}~XnXdS)z7 Whether this path is a symbolic link. FN)r rr[r8r2rr)r#r5rrrrs zPath.is_symlinkcCsDyt|jjStk r>}z|jttfkr0dSd}~XnXdS)z6 Whether this path is a block device. FN)r rr[r8r2rr)r#r5rrris_block_device$s zPath.is_block_devicecCsDyt|jjStk r>}z|jttfkr0dSd}~XnXdS)z: Whether this path is a character device. FN)rrr[r8r2rr)r#r5rrris_char_device1s zPath.is_char_devicecCsDyt|jjStk r>}z|jttfkr0dSd}~XnXdS)z. Whether this path is a FIFO. FN)rrr[r8r2rr)r#r5rrris_fifo>s z Path.is_fifocCsDyt|jjStk r>}z|jttfkr0dSd}~XnXdS)z0 Whether this path is a socket. FN)r rr[r8r2rr)r#r5rrr is_socketKs zPath.is_socketcCsb|jp |j r^|jr^|jddddkr^|jj|jddd}|j|g|jddS|S)zl Return a new path with expanded ~ and ~user constructs (as returned by os.path.expanduser) rNr7~)rrrrrrr)r#ZhomedirrrrrXs zPath.expanduser)rr)N)r)r )FrO)r?rONNN)NN)NN)rT)r FF)F)1r:r;r<r=rrrrrrrrr!rr"r#r&r(r+r-r/r9rr;r>rrHrIrNrPrWrrrrrrrr)rZrrr\rr]r^r_r`rrrrrrs^                      c@seZdZdZfZdS)rzsPath subclass for non-Windows systems. On a POSIX system, instantiating a Path should return this object. N)r:r;r<r=rrrrrrdsc@s$eZdZdZfZddZddZdS)rzqPath subclass for Windows systems. On a Windows system, instantiating a Path should return this object. cCs tddS)Nz*Path.owner() is unsupported on this system)r)r#rrrr;rszWindowsPath.ownercCs tddS)Nz*Path.group() is unsupported on this system)r)r#rrrr>uszWindowsPath.groupN)r:r;r<r=rr;r>rrrrrks)>rrrArtrlrrr- collectionsr contextlibrr2rrrroperatorrrr r r r r rrZ urllib.parserrfZsupports_symlinks__all__Z_WINERROR_NOT_READYZ_WINERROR_INVALID_NAMEr3rrr r>r{rrrrrrrrrrrrrrrPathLikeregisterrrrrrrrrrsd   $  ? 6>  %f   [datetime.cpython-36.opt-2.pyc000064400000126262152462730460011750 0ustar003 \r@ @s ddlZddlZddlZddZdZdZdZd]dddd dd ddd dd dg Z d^gZ dZ x&e ddD]Z e j e e e 7Z qbW[ [ d d Zd d ZddZddZddZedZedZedZddZddddddddd d!d"d#d$g Zdd%d&d'd(d)d*d+gZd,d-Zd_d/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Zd;d<Z d=d>Z!d?d@Z"dAdBZ#GdCdDdDZ$e$d`e$_%e$dEdFdGdGdHdIe$_&e$ddJe$_'GdKdLdLZ(e(Z)e(ddde(_%e(ddMde(_&e$ddNe(_'GdOdPdPZ*e*Z+GdQdRdRZeZ,eddde_%edFdGdGdHe_&e$ddJe_'GdSdTdTe(Z-e-ddde-_%e-ddMddFdGdGdHe-_&e$ddJe-_'dUdVZ.GdWdXdXe*Z/e/j0e$de/_1e/j0e/j2e/_%e/j0e/j3e/_&e-dYdde/j1dZZ4y dd[l5TWne6k rYnPX[[ [ [[[[4[[[[[[ [![[[["[)[[[[[[.[[[[,[+[[[#dd\l5m7Z7dS)aNcCs||kr dS||krdSdS)Nr)xyrr /usr/lib64/python3.6/datetime.py_cmp srri'i۹7cCs$|ddko"|ddkp"|ddkS)Nrdir)yearrrr_is_leap%srcCs(|d}|d|d|d|dS)Nrimr r ir)rrrrr_days_before_year)srcCs|dkrt|rdSt|S)N)r_DAYS_IN_MONTH)rmonthrrr_days_in_month.srcCst||dkot|S)Nr)_DAYS_BEFORE_MONTHr)rrrrr_days_before_month5srcCs t||}t|t|||S)N)rrr)rrdaydimrrr_ymd2ord:s riec Cs|d8}t|t\}}|dd}t|t\}}t|t\}}t|d\}}||d|d|7}|dkst|dkr|dddfS|dko|d kp|dk}|d d ?}t||d ko|}||kr|d8}|t||d ko|8}||8}|||dfS) Nriimr r r 2rr)divmod_DI400Y_DI100Y_DI4Yrr) nZn400rZn100Zn4Zn1ZleapyearrZ precedingrrr_ord2ymdSs"  r&ZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDecZMonZTueZWedZThuZFriZSatZSunc Cs>t|||dd}t|||}tj|||||||||f S)N)rr_timeZ struct_time) rmdhhmmssZdstflagZwdayZdnumrrr_build_struct_timesr/autoc Cstdddddd}|dkr&|r dnd }n|d kr6|d }y ||}Wntk r^td YnX|j||||SdS) Nz{:02d}z {:02d}:{:02d}z{:02d}:{:02d}:{:02d}z{:02d}:{:02d}:{:02d}.{:03d}z{:02d}:{:02d}:{:02d}.{:06d})hoursminutesseconds milliseconds microsecondsr0r5r3r4izUnknown timespec value)KeyError ValueErrorformat)r,r-r.ustimespecZspecsfmtrrr _format_times r<cCsd}d}d}g}|j}dt|}} xj|| kr||} |d7}| dkr|| kr|||} |d7}| dkr|dkrdt|dd}|j|n| dkr|dkrd}t|d r|j} | dk rd } | jdkr| } d } t| tdd \} }|tdd }d| | |f}|j|n^| dkrj|dkr^d}t|dr^|j}|dk r^|j dd}|j|n|d|| n|dq(|| q(Wdj |}t j ||S)Nrr%fz%06d microsecondz utcoffset+-)r1)r2z %c%02d%02dZtznamez%%) appendlengetattrhasattrrBdaysr! timedeltarFreplacejoinr)strftime)objectr8 timetupleZfreplaceZzreplaceZZreplaceZ newformatpushir%Zchoffsetsignhr*srrr_wrap_strftimes\                    rXcCs(|dk r$t|t r$tdt|dS)Nz4tzinfo.tzname() must return None or string, not '%s') isinstancestr TypeErrortype)namerrr _check_tznamesr^cCsv|dkr dSt|ts*td|t|f|jr@td||ftd |ko\tdknsrtd||fdS)Nz3tzinfo.%s() must return None or timedelta, not '%s'z9tzinfo.%s() must return a whole number of seconds, got %srzN%s()=%s, must be strictly between -timedelta(hours=24) and timedelta(hours=24))rYrLr[r\r5r7)r]rTrrr_check_utc_offsets  "r_c Csxt|tr|St|tsly |j}Wntk r8Yn"Xt|trH|Stdt|jtdt|jtddS)Nz"__int__ returned non-int (type %s)z$an integer is required (got type %s)z$integer argument expected, got float)rYintfloat__int__AttributeErrorr[r\__name__)valuerrr_check_int_fields    rfcCst|}t|}t|}t|ko*tknsBtdttf|d|koTdknsdtd|t||}d|ko|knstd|||||fS)Nzyear must be in %d..%drrzmonth must be in 1..12zday must be in 1..%d)rfMINYEARMAXYEARr7r)rrrrrrr_check_date_fieldss  ricCst|}t|}t|}t|}d|ko2dknsBtd|d|koTdknsdtd|d|kovdknstd|d|kodknstd||d krtd ||||||fS) Nrzhour must be in 0..23;zminute must be in 0..59zsecond must be in 0..59i?Bz microsecond must be in 0..999999rzfold must be either 0 or 1)rr)rfr7)hourminutesecondr?foldrrr_check_time_fields$s     rpcCs |dk rt|t rtddS)Nz4tzinfo argument must be None or of a tzinfo subclass)rYtzinfor[)tzrrr_check_tzinfo_arg5srscCs tdt|jt|jfdS)Nzcan't compare '%s' to '%s')r[r\rd)rrrrr _cmperror9srtcCsRt||\}}|d9}|dkr&||kn||k}|sF||krN|ddkrN|d7}|S)Nrrr)r!)abqrZgreater_than_halfrrr_divide_and_round=s ryc@seZdZdAZdBddZdd Zd d Zd d ZeddZ eddZ eddZ ddZ e Z ddZddZddZddZddZd d!ZeZd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Z d:d;Z!dd?Z#d@S)CrL_days_seconds _microseconds _hashcodercCsd}} } ||d7}||d|d7}||d7}t|trttj|\} }tj| d\} } t| } t|}nd} |}t|trtj|\}}t|}|| 7}n| }t|d\}}||7}| t|7} |d }t|trt||}t|d \}}t|d\}}||7}| |7} n@t|}t|d \}}t|d\}}||7}| |7} t||}t|d \}} | |7} t| d\}} ||7}t|d krtd |t j |}||_ | |_ | |_ d|_|S)Nrr(<iig8@g @grg.Ai@Biɚ;z$timedelta # of days is too large: %drg@iQiQiQiQr)rYra_mathmodfr`r!roundabs OverflowErrorrP__new__rzr{r|r})clsrKr3r5r4r2r1Zweeksr+rWr9ZdayfracZdaysecondsfracZdaysecondswholeZ secondsfracZusdoubleselfrrrrdsZ             ztimedelta.__new__cCs`|jr&d|jj|jj|j|j|jfS|jrHd|jj|jj|j|jfSd|jj|jj|jfS)Nz%s.%s(%d, %d, %d)z %s.%s(%d, %d)z %s.%s(%d))r| __class__ __module__ __qualname__rzr{)rrrr__repr__s  ztimedelta.__repr__cCsdt|jd\}}t|d\}}d|||f}|jrLdd}d||j|}|jr`|d|j}|S)Nr~z %d:%02d:%02dcSs|t|dkrdpdfS)NrrWrA)r)r%rrrpluralsz!timedelta.__str__..pluralz %d day%s, z.%06d)r!r{rzr|)rr-r.r,rWrrrr__str__sztimedelta.__str__cCs|jd|jd|jdS)NiQ r'i@Bi@B)rKr3r5)rrrr total_secondssztimedelta.total_secondscCs|jS)N)rz)rrrrrKsztimedelta.dayscCs|jS)N)r{)rrrrr3sztimedelta.secondscCs|jS)N)r|)rrrrr5sztimedelta.microsecondscCs2t|tr.t|j|j|j|j|j|jStS)N)rYrLrzr{r|NotImplemented)rotherrrr__add__s    ztimedelta.__add__cCs2t|tr.t|j|j|j|j|j|jStS)N)rYrLrzr{r|r)rrrrr__sub__s    ztimedelta.__sub__cCst|tr| |StS)N)rYrLr)rrrrr__rsub__s  ztimedelta.__rsub__cCst|j |j |j S)N)rLrzr{r|)rrrr__neg__sztimedelta.__neg__cCs|S)Nr)rrrr__pos__sztimedelta.__pos__cCs|jdkr| S|SdS)Nr)rz)rrrr__abs__s ztimedelta.__abs__cCs`t|tr(t|j||j||j|St|tr\|j}|j\}}tddt |||St S)Nr) rYr`rLrzr{r|ra_to_microsecondsas_integer_ratioryr)rrusecrurvrrr__mul__#s     ztimedelta.__mul__cCs|jd|jd|jS)Nrii@BiQ)rzr{r|)rrrrr2sztimedelta._to_microsecondscCsNt|ttfstS|j}t|tr0||jSt|trJtdd||SdS)Nr)rYr`rLrr)rrrrrr __floordiv__6s   ztimedelta.__floordiv__cCs~t|tttfstS|j}t|tr2||jSt|trNtddt||St|trz|j\}}tddt|||SdS)Nr)rYr`rarLrrryr)rrrrurvrrr __truediv__?s     ztimedelta.__truediv__cCs*t|tr&|j|j}tdd|StS)Nr)rYrLrr)rrrxrrr__mod__Ks  ztimedelta.__mod__cCs4t|tr0t|j|j\}}|tdd|fStS)Nr)rYrLr!rr)rrrwrxrrr __divmod__Qs  ztimedelta.__divmod__cCs t|tr|j|dkSdSdS)NrF)rYrLr)rrrrr__eq__Zs ztimedelta.__eq__cCs&t|tr|j|dkSt||dS)Nr)rYrLrrt)rrrrr__le__`s ztimedelta.__le__cCs&t|tr|j|dkSt||dS)Nr)rYrLrrt)rrrrr__lt__fs ztimedelta.__lt__cCs&t|tr|j|dkSt||dS)Nr)rYrLrrt)rrrrr__ge__ls ztimedelta.__ge__cCs&t|tr|j|dkSt||dS)Nr)rYrLrrt)rrrrr__gt__rs ztimedelta.__gt__cCst|j|jS)N)r _getstate)rrrrrrxsztimedelta._cmpcCs|jdkrt|j|_|jS)Nrr)r}hashr)rrrr__hash__|s ztimedelta.__hash__cCs|jdkp|jdkp|jdkS)Nr)rzr{r|)rrrr__bool__s  ztimedelta.__bool__cCs|j|j|jfS)N)rzr{r|)rrrrrsztimedelta._getstatecCs|j|jfS)N)rr)rrrr __reduce__sztimedelta.__reduce__N)rzr{r|r})rrrrrrr)$rdrr __slots__rrrrpropertyrKr3r5r__radd__rrrrrr__rmul__rrrrrrrrrrrrrrrrrrrrLQsB d          rLiɚ;rjrki?B)rKr1r2r3r5)r5c@s$eZdZdBZdCddZedd Zed d Zed d ZddZ ddZ ddZ ddZ ddZ e ZeddZeddZeddZddZd d!ZdDd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3ZeZd4d5Zd6d7Z d8d9Z!d:d;Z"dd?Z$d@dAZ%dS)Edate_year_month_dayr}Nc Cs|dkrt|ttfrt|dkrdt|ddko@dknrt|tr|y|jd}Wntk rztdYnXtj |}|j |d|_ |St |||\}}}tj |}||_ ||_||_d |_ |S) Nr rrrrlatin1znFailed to encode latin1 string when unpickling a date object. pickle.load(data, encoding='latin1') is assumed.rr)rYbytesrZrHordencodeUnicodeEncodeErrorr7rPr_date__setstater}rirrr)rrrrrrrrrs($     z date.__new__c Cs(tj|\ }}}}}}}} } ||||S)N)r) localtime) rtrr*r+r,r-r.weekdayjdaydstrrr fromtimestampszdate.fromtimestampcCstj}|j|S)N)r)timer)rrrrrtodaysz date.todaycCst|\}}}||||S)N)r&)rr%rr*r+rrr fromordinalszdate.fromordinalcCs d|jj|jj|j|j|jfS)Nz%s.%s(%d, %d, %d))rrrrrr)rrrrrs z date.__repr__cCs.|jdpd}dt|t|j|j|jfS)Nr(z%s %s %2d 00:00:00 %04d) toordinal _DAYNAMES _MONTHNAMESrrr)rrrrrctimes z date.ctimecCst|||jS)N)rXrQ)rr;rrrrO sz date.strftimecCs:t|tstdt|jt|dkr2|j|St|S)Nzmust be str, not %sr)rYrZr[r\rdrHrO)rr;rrr __format__ s    zdate.__format__cCsd|j|j|jfS)Nz%04d-%02d-%02d)rrr)rrrr isoformats zdate.isoformatcCs|jS)N)r)rrrrr"sz date.yearcCs|jS)N)r)rrrrr'sz date.monthcCs|jS)N)r)rrrrr,szdate.daycCst|j|j|jddddS)Nrrr)r/rrr)rrrrrQ4szdate.timetuplecCst|j|j|jS)N)rrrr)rrrrr9szdate.toordinalcCs:|dkr|j}|dkr|j}|dkr*|j}t||||S)N)rrrr\)rrrrrrrrMAsz date.replacecCst|tr|j|dkStS)Nr)rYrrr)rrrrrrMs z date.__eq__cCst|tr|j|dkStS)Nr)rYrrr)rrrrrrRs z date.__le__cCst|tr|j|dkStS)Nr)rYrrr)rrrrrrWs z date.__lt__cCst|tr|j|dkStS)Nr)rYrrr)rrrrrr\s z date.__ge__cCst|tr|j|dkStS)Nr)rYrrr)rrrrrras z date.__gt__cCsB|j|j|j}}}|j|j|j}}}t|||f|||fS)N)rrrr)rrrr*r+Zy2m2Zd2rrrrfsz date._cmpcCs|jdkrt|j|_|jS)Nrr)r}rr)rrrrrls z date.__hash__cCsFt|trB|j|j}d|ko*tknr:tj|StdtS)Nrzresult out of range) rYrLrrK _MAXORDINALrrrr)rrorrrrts   z date.__add__cCsDt|tr|t|j St|tr@|j}|j}t||StS)N)rYrLrKrrr)rrdays1days2rrrrs   z date.__sub__cCs|jddS)Nr'r()r)rrrrrsz date.weekdaycCs|jdpdS)Nr()r)rrrr isoweekdayszdate.isoweekdaycCs|j}t|}t|j|j|j}t||d\}}|dkr^|d8}t|}t||d\}}n$|dkr|t|dkr|d7}d}||d|dfS)Nr(rr4)r_isoweek1mondayrrrr!)rr week1mondayrZweekrrrr isocalendars zdate.isocalendarcCs&t|jd\}}t|||j|jgfS)N)r!rrrr)ryhiylorrrrszdate._getstatecCs"|\}}|_|_|d||_dS)Nr)rrr)rstringrrrrr __setstateszdate.__setstatecCs|j|jfS)N)rr)rrrrrszdate.__reduce__)rrrr})NN)NNN)&rdrrrr classmethodrrrrrrOrrrrrrrrQrrMrrrrrrrrrrrrrrrrrrrrrsB "          rr)rKc@s8eZdZfZddZddZddZddZd d Zd S) rqcCs tddS)Nz&tzinfo subclass must override tzname())NotImplementedError)rdtrrrrFsz tzinfo.tznamecCs tddS)Nz)tzinfo subclass must override utcoffset())r)rrrrrrBsztzinfo.utcoffsetcCs tddS)Nz#tzinfo subclass must override dst())r)rrrrrrsz tzinfo.dstcCst|tstd|j|k r$td|j}|dkrd?Zd@dAZdBdCZdDdEZ d S)Mr_hour_minute_second _microsecond_tzinfor}_foldrN)rocCst|ttfrt|dkrt|ddd@dkrt|trhy|jd}Wntk rftdYnXtj |}|j ||p~dd|_ |St |||||\}}}}}t |tj |}||_||_||_||_||_d |_ ||_|S) Nr'rrrrznFailed to encode latin1 string when unpickling a time object. pickle.load(data, encoding='latin1') is assumed.rr)rYrrZrHrrrr7rPr_time__setstater}rprsrrrrrr)rrlrmrnr?rqrorrrrr#s0     z time.__new__cCs|jS)N)r)rrrrrlKsz time.hourcCs|jS)N)r)rrrrrmPsz time.minutecCs|jS)N)r)rrrrrnUsz time.secondcCs|jS)N)r)rrrrr?Zsztime.microsecondcCs|jS)N)r)rrrrrq_sz time.tzinfocCs|jS)N)r)rrrrrodsz time.foldcCs$t|tr|j|dddkSdSdS)NT) allow_mixedrF)rYrr)rrrrrrls z time.__eq__cCs&t|tr|j|dkSt||dS)Nr)rYrrrt)rrrrrrrs z time.__le__cCs&t|tr|j|dkSt||dS)Nr)rYrrrt)rrrrrrxs z time.__lt__cCs&t|tr|j|dkSt||dS)Nr)rYrrrt)rrrrrr~s z time.__ge__cCs&t|tr|j|dkSt||dS)Nr)rYrrrt)rrrrrrs z time.__gt__Fc Cs|j}|j}d}}||kr"d}n|j}|j}||k}|rht|j|j|j|jf|j|j|j|jfS|dksx|dkr|rdStd|jd|j|tdd}|jd|j|tdd} t||j|jf| |j|jfS)NTrz$cannot compare naive and aware timesr~r)r2) rrBrrrrrr[rL) rrrmytzottzmyoffotoff base_compareZmyhhmmZothhmmrrrrs*  z time._cmpcCs|jdkr|jr|jdd}n|}|j}|sBt|jd|_nztt|j|j d|tdd\}}|tdd}d|kodknrtt |||j |j |_nt|||j |j f|_|jS) Nrr)ro)r1r2)r1)r2rr) r}rorMrBrrr!rLrlrmrrnr?)rrtzoffrVr*rrrrs z time.__hash__:cCsx|j}|dk rt|jdkr&d}| }nd}t|tdd\}}t|tdd\}}d||||f}|rt|d|j7}|S) NrrDrCr)r1)r2z %s%02d%s%02dz:%02d)rBrKr!rLr3)rsepoffrUr,r-r.rrr_tzstrs z time._tzstrcCs|jdkrd|j|jf}n|jdkr2d|j}nd}d|jj|jj|j|j|f}|jdk rx|dd d|jd}|jr|dd d }|S) Nrz, %d, %dz, %drAz%s.%s(%d, %d%s)rz , tzinfo=%r)z , fold=1)rr) rrrrrrrrr)rrWrrrrs    z time.__repr__r0cCs0t|j|j|j|j|}|j}|r,||7}|S)N)r<rrrrr)rr:rWrrrrrrs  ztime.isoformatc Cs(ddd|j|j|jdddf }t|||S)Nilrrr)rrrrX)rr;rQrrrrOs  z time.strftimecCs:t|tstdt|jt|dkr2|j|St|S)Nzmust be str, not %sr)rYrZr[r\rdrHrO)rr;rrrrs    ztime.__format__cCs(|jdkrdS|jjd}td||S)NrB)rrBr_)rrTrrrrBs    ztime.utcoffsetcCs&|jdkrdS|jjd}t||S)N)rrFr^)rr]rrrrFs   z time.tznamecCs(|jdkrdS|jjd}td||S)Nr)rrr_)rrTrrrrs   ztime.dstTcCsl|dkr|j}|dkr|j}|dkr*|j}|dkr8|j}|dkrF|j}|dkrT|j}t|||||||dS)NT)ro)rlrmrnr?rqrr\)rrlrmrnr?rqrorrrrM,sz time.replacercCspt|jd\}}t|d\}}|j}|jr:|dkr:|d7}t||j|j|||g}|jdkrb|fS||jfSdS)Nrr)r!rrrrrrr)rprotocolus2us3us1rV basestaterrrr?s   ztime._getstatecCsv|dk rt|t rtd|\}|_|_}}}|dkrJd|_|d|_n d|_||_|d>|Bd>|B|_||_dS)Nzbad tzinfo state argrrrr) rY _tzinfo_classr[rrrrrr)rrrqrVrrrrrrrLs ztime.__setstatecCst|j|fS)N)rr)rrrrr __reduce_ex__Ysztime.__reduce_ex__cCs |jdS)Nr)r)rrrrr\sztime.__reduce__)rrrrrr}r)rrrrN)F)r)r0)NNNNT)r)!rdrrrrrrlrmrnr?rqrorrrrrrrrrrrrOrrBrFrrMrrrrrrrrr s<(               rc@seZdZejejZdaddddZeddZedd Z ed d Z ed d Z eddZ eddZ eddZedbddZeddZedcddZeddZeddddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zdeddd-d.Zd/d0Zdfd1d2Zd3d4Zdgd7d8Zd9d:Zd;d<Z ed=d>Z!d?d@Z"dAdBZ#dCdDZ$dEdFZ%dGdHZ&dIdJZ'dKdLZ(dMdNZ)dhdPdQZ*dRdSZ+e+Z,dTdUZ-dVdWZ.didYdZZ/d[d\Z0d]d^Z1d_d`Z2dS)jrNr)roc  Cst|ttfrt|dkrdt|ddd@kotj|dd\}}}}}}t||||||tddS)Nr'rr)r)rrrL)urr*r+r,r-r.)epochrrlocalszdatetime._mktime..localiQ)rrLromaxr) rrrrruZu1Zt1Zu2rvZt2r)rr_mktimes(    zdatetime._mktimecCs0|jdkr |j}||jdS|tjSdS)Ng.A)rrr?_EPOCHr)rrWrrr timestamp2s zdatetime.timestampcCsT|j}|r||8}|j|j|j}}}|j|j|j}}}t||||||dS)Nr)rBrrrrlrmrnr/)rrTrr*r+r,r-r.rrr utctimetuple:s zdatetime.utctimetuplecCst|j|j|jS)N)rrrr)rrrrrCsz datetime.datecCst|j|j|j|j|jdS)N)ro)rrlrmrnr?ro)rrrrrGsz datetime.timecCs t|j|j|j|j|j|jdS)N)ro)rrlrmrnr?rro)rrrrtimetzKszdatetime.timetzc  Cs|dkr|j}|dkr|j}|dkr*|j}|dkr8|j}|dkrF|j}|dkrT|j}|dkrb|j}|dkrp|j}| dkr~|j} t |||||||||| d S)NT)ro) rrrrlrmrnr?rqror\) rrrrrlrmrnr?rqrorrrrMPs(zdatetime.replacec Cs|jdkr|j}n|ttdd}tj|}t|dd}y|j}|j}WnDt k r|ttj |dd}tj d|}t ||}YnXt t|d|}|S)Nr)r3r'z%Z) rqrrrLr)rrZ tm_gmtoffZtm_zonercrrOtimezone)rZtsZlocaltmrZgmtoffZzonerrrrrr_local_timezoneis     zdatetime._local_timezonecCs|dkr|j}nt|ts$td|j}|dkrF|j}|j|}n,|j|}|dkrr|jddj}|j|}||kr~|S||j|d}|j|S)Nz)tz argument must be an instance of tzinfo)rq)rrYrqr[rBrMr)rrrrZmyoffsetrrrr astimezone|s      zdatetime.astimezonecCs:|jdpd}dt|t|j|j|j|j|j|jfS)Nr(z%s %s %2d %02d:%02d:%02d %04d) rrrrrrrrr)rrrrrrs zdatetime.ctimeTr0c Csd|j|j|j|ft|j|j|j|j|}|j}|dk r|j dkrTd}| }nd}t |t dd\}}t |t dd\}}|d|||f7}|r|d |j 7}|S) Nz%04d-%02d-%02d%crrDrCr)r1)r2z %s%02d:%02dz:%02d) rrrr<rrrrrBrKr!rLr3) rrr:rWrrUr,r-r.rrrrs  zdatetime.isoformatcCs|j|j|j|j|j|j|jg}|ddkr2|d =|d dkrD|d =d|jj|jj dj t t |f}|j dk r|dd d|j d}|jr|dd d}|S)Nrrz %s.%s(%s)z, z , tzinfo=%rrz , fold=1)rrrrrr)rrrrrrrrrrrNmaprZrr)rLrWrrrrs    zdatetime.__repr__cCs |jddS)N )r)r)rrrrrszdatetime.__str__cCsddl}|j|||S)Nr) _strptimeZ_strptime_datetime)rZ date_stringr8rrrrstrptimeszdatetime.strptimecCs(|jdkrdS|jj|}td||S)NrB)rrBr_)rrTrrrrBs    zdatetime.utcoffsetcCs&|jdkrdS|jj|}t||S)N)rrFr^)rr]rrrrFs   zdatetime.tznamecCs(|jdkrdS|jj|}td||S)Nr)rrr_)rrTrrrrs   z datetime.dstcCs2t|tr|j|dddkSt|ts*tSdSdS)NT)rrF)rYrrrr)rrrrrrs   zdatetime.__eq__cCs4t|tr|j|dkSt|ts&tSt||dS)Nr)rYrrrrrt)rrrrrrs   zdatetime.__le__cCs4t|tr|j|dkSt|ts&tSt||dS)Nr)rYrrrrrt)rrrrrrs   zdatetime.__lt__cCs4t|tr|j|dkSt|ts&tSt||dS)Nr)rYrrrrrt)rrrrrrs   zdatetime.__ge__cCs4t|tr|j|dkSt|ts&tSt||dS)Nr)rYrrrrrt)rrrrrr's   zdatetime.__gt__Fc Cs|j}|j}d}}||kr"d}nT|j}|j}|rn||j|j djkrRdS||j|j djkrndS||k}|rt|j|j|j|j|j |j |j f|j|j|j|j|j |j |j fS|dks|dkr|rdSt d||}|j dkrdS|odpdS)NT)rorz(cannot compare naive and aware datetimesrrr)rrBrMrorrrrrrrrr[rK) rrrrrrrrZdiffrrrr/s8     z datetime._cmpc Cst|tstSt|j|j|j|j|jd}||7}t|j d\}}t|d\}}d|j koft knrt j tj|j t||||j|jdStddS)N)r1r2r3r5ir~r)rqzresult out of range)rYrLrrrrrrr!r3rKrrrrrrr5rr)rrrrlZremrmrnrrrrTs    zdatetime.__add__c Cst|ts"t|tr|| StS|j}|j}|j|jd|jd}|j|jd|jd}t|||||j|j}|j |j kr|S|j }|j }||kr|S|dks|dkrt d|||S)Nr~iz(cannot mix naive and timezone-aware time) rYrrLrrrrrrrrBr[) rrrrZsecs1Zsecs2baserrrrrris(    zdatetime.__sub__cCs|jdkr|jr|jdd}n|}|j}|dkrFt|jd|_nDt|j|j|j }|j d|j d|j }tt |||j||_|jS)Nrr)roir~r)r}rorMrBrrrrrrrlrmrnrLr?)rrrrKr3rrrrs zdatetime.__hash__rc Cst|jd\}}t|jd\}}t|d\}}|j}|jrJ|dkrJ|d7}t||||j|j|j|j |||g }|j dkr~|fS||j fSdS)Nrrr) r!rrrrrrrrrr) rrrrrrrr*rrrrrs    zdatetime._getstatec Cs|dk rt|t rtd|\ }}}|_|_|_|_}}}|dkrVd|_|d|_n d|_||_|d||_ |d>|Bd>|B|_ ||_ dS)Nzbad tzinfo state argrrrrrr) rYrr[rrrrrrrrr) rrrqrrr*rrrrrrrs  zdatetime.__setstatecCs|j|j|fS)N)rr)rrrrrrszdatetime.__reduce_ex__cCs |jdS)Nr)r)rrrrrszdatetime.__reduce__)NNrrrrN)N)N)T)NNNNNNNT)N)rr0)F)r)3rdrrrrrrrrlrmrnr?rqrorrrr r r rrQrrrrrMrrrrrrr rBrFrrrrrrrrrrrrrrrrrrrresh #       ,     #   "    % rcCs8d}t|dd}|dd}||}||kr4|d7}|S)Nrrr'r()r)rZTHURSDAYZfirstdayZ firstweekdayrrrrrs  rc@seZdZdZeZefddZed ddZdd Z d d Z d d Z ddZ ddZ ddZddZddZddZedddZe ZeddZdS)!r_offset_namecCst|tstd||jkr,|s&|jSd}nt|ts>td|j|koT|jknsbtd|j dksz|j ddkrtd|j ||S)Nzoffset must be a timedeltazname must be a stringzYoffset must be a timedelta strictly between -timedelta(hours=24) and timedelta(hours=24).rr~zAoffset must be a timedelta representing a whole number of minutes) rYrLr[_OmittedrrZ _minoffset _maxoffsetr7r5r3_create)rrTr]rrrrs   ztimezone.__new__NcCstj|}||_||_|S)N)rqrr"r#)rrTr]rrrrr's ztimezone._createcCs|jdkr|jfS|j|jfS)N)r#r")rrrrrs ztimezone.__getinitargs__cCst|tkrdS|j|jkS)NF)r\rr")rrrrrrs ztimezone.__eq__cCs t|jS)N)rr")rrrrrsztimezone.__hash__cCsL||jkrdS|jdkr0d|jj|jj|jfSd|jj|jj|j|jfS)Nzdatetime.timezone.utcz %s.%s(%r)z %s.%s(%r, %r))rr#rrrr")rrrrrs   ztimezone.__repr__cCs |jdS)N)rF)rrrrrsztimezone.__str__cCs$t|ts|dkr|jStddS)Nz8utcoffset() argument must be a datetime instance or None)rYrr"r[)rrrrrrB sztimezone.utcoffsetcCs:t|ts|dkr.|jdkr(|j|jS|jStddS)Nz5tzname() argument must be a datetime instance or None)rYrr#_name_from_offsetr"r[)rrrrrrFs   ztimezone.tznamecCs"t|ts|dkrdStddS)Nz2dst() argument must be a datetime instance or None)rYrr[)rrrrrrsz timezone.dstcCs2t|tr&|j|k rtd||jStddS)Nzfromutc: dt.tzinfo is not selfz6fromutc() argument must be a datetime instance or None)rYrrqr7r"r[)rrrrrrs    ztimezone.fromutcrjrk)r1r2cCsT|sdS|tdkr d}| }nd}t|tdd\}}|tdd}dj|||S) NZUTCrrDrCr)r1)r2zUTC{}{:02d}:{:02d})rLr!r8)rrUr1restr2rrrr(*s ztimezone._name_from_offset)r"r#)N)rdrrrrPr$rrr'rrrrrrBrFrrrLr&r% staticmethodr(rrrrrs"   ri)rq)*)__doc__rr)r0i6e)8rr)ZmathrrrrgrhrrrZdbmrrGrrrrrr"r#r$r&rrr/r<rXr^r_rfrirprsrtryrLrrZ resolutionrr rqrr rrrr'rr%r&rZ _datetime ImportErrorr,rrrrs    ? :  ?    , DW V  pG      pdb.cpython-36.pyc000064400000132020152462730460007746 0ustar003 \"@sdZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z GdddeZddddd d d d d g ZddZddZddZGdddeZdZGdddejejZedk rbd ddddddddd d!d"d#d$d%d&d'd(dd)d*d+d,d-d.d/d0d1d2d3d4d5d6d7g"Zx*eD]"Zeeed8ejjd97Zq,Weejj7Z[[dId:dZdJd;dZ dd Z#dKd?d Z$d@dZ%dAZ&dBdCZ'dDd Z(dEZ)dFdGZ*e+dHkrddl,Z,e,j*dS)La The Python Debugger Pdb ======================= To use the debugger in its simplest form: >>> import pdb >>> pdb.run('') The debugger's prompt is '(Pdb) '. This will stop in the first function call in . Alternatively, if a statement terminated with an unhandled exception, you can use pdb's post-mortem facility to inspect the contents of the traceback: >>> >>> import pdb >>> pdb.pm() The commands recognized by the debugger are listed in the next section. Most can be abbreviated as indicated; e.g., h(elp) means that 'help' can be typed as 'h' or 'help' (but not as 'he' or 'hel', nor as 'H' or 'Help' or 'HELP'). Optional arguments are enclosed in square brackets. Alternatives in the command syntax are separated by a vertical bar (|). A blank line repeats the previous command literally, except for 'list', where it lists the next 11 lines. Commands that the debugger doesn't recognize are assumed to be Python statements and are executed in the context of the program being debugged. Python statements can also be prefixed with an exclamation point ('!'). This is a powerful way to inspect the program being debugged; it is even possible to change variables or call functions. When an exception occurs in such a statement, the exception name is printed but the debugger's state is not changed. The debugger supports aliases, which can save typing. And aliases can have parameters (see the alias help entry) which allows one a certain level of adaptability to the context under examination. Multiple commands may be entered on a single line, separated by the pair ';;'. No intelligence is applied to separating the commands; the input is split at the first ';;', even if it is in the middle of a quoted string. If a file ".pdbrc" exists in your home directory or in the current directory, it is read in and executed as if it had been typed at the debugger prompt. This is particularly useful for aliases. If both files exist, the one in the home directory is read first and aliases defined there can be overridden by the local file. This behavior can be disabled by passing the "readrc=False" argument to the Pdb constructor. Aside from aliases, the debugger is not directly programmable; but it is implemented as a class from which you can derive your own debugger class, which you can make as fancy as you like. Debugger commands ================= Nc@seZdZdZdS)RestartzBCauses a debugger to be restarted for the debugged python program.N)__name__ __module__ __qualname____doc__rr/usr/lib64/python3.6/pdb.pyrUsrrunpmPdbrunevalrunctxruncall set_trace post_mortemhelpcCsxtjdtj|}y t|}Wntk r4dSX|4x,t|ddD]\}}|j|rJ|||fSqJWWdQRXdS)Nzdef\s+%s\s*[(])start)recompileescapeopenOSError enumeratematch)funcnamefilenameZcrefplinenolinerrr find_function\s  r cCsXtj|\}}tj|r,|j|jkr,|dfStj|r>|dfStj||d|dfS)Nr)inspectZ findsourceZisframe f_globalsf_localsZismoduleZgetblock)objlinesrrrrgetsourcelinesis  r&cCs8ttj|}|jx|D]\}}||kr|SqWdS)Nr)listdisZfindlinestartsreverse)codeZlastiZ linestartsirrrr lasti2linenors r,c@seZdZdZddZdS)_rstrz#String that doesn't quote its repr.cCs|S)Nr)selfrrr__repr__}sz_rstr.__repr__N)rrrrr/rrrrr-{sr-z -> c@seZdZdZdddZddZd d Zd d Zd dZddZ ddZ ddZ ddZ ddZ ddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6ZeZdd8d9Zd:d;ZeZ eZ!eZ"dd?Z%d@dAZ&dBdCZ'eZ(dDdEZ)eZ*dFdGZ+eZ,dHdIZ-eZ.dJdKZ/e/Z0eZ1eZ2dLdMZ3e3Z4e3Z5dNdOZ6dPdQZ7e7Z8dRdSZ9e9Z:dTdUZ;e;ZdXdYZ?e?Z@dZd[ZAeAZBd\d]ZCeCZDd^d_ZEeEZFZGd`daZHeHZIdbdcZJeZKdddeZLeLZMeLZNdfdgZOdhdiZPePZQdjdkZReRZSdldmZTddndoZUdpdqZVdrdsZWeZXeZYeZZdtduZ[e[Z\dvdwZ]e]Z^dxdyZ_eZ`fdfdzd{Zad|d}ZbeZcd~dZdeZeddZfddZgddZhddZiddZjddZkddddddgZlddZmenfddZoddZpepZqddZrddZsddZtddZudS)r NtabFTc $CsJtjj||dtjj|||||r,d|_d|_i|_i|_d|_ d|_ i|_ yddl }|j dWntk rzYnXd|_||_g|_|r(dtjkrtjd}y.ttjj|d} |jj| WdQRXWntk rYnXy$td} |jj| WdQRXWntk r&YnXi|_i|_i|_d|_d|_dS) N)skiprz(Pdb) Fz `@#$%^&*()=+[{]}\|;:'",<>?HOMEz.pdbrc)bdbBdb__init__cmdCmdZ use_rawinputpromptaliases displaying mainpyfile_wait_for_mainpyfile tb_linenoreadlineZset_completer_delims ImportError allow_kbdintnosigintrcLinesosenvironrpathjoinextendrcommandscommands_dopromptcommands_silentcommands_defining commands_bnum) r. completekeystdinstdoutr1rBZreadrcr?ZenvHomeZrcFilerrrr6sH   z Pdb.__init__cCs*|jr t|jd|j|j|dS)Nz- Program interrupted. (Use 'cont' to resume).)rAKeyboardInterruptmessageset_stepr)r.Zsignumframerrrsigint_handlers  zPdb.sigint_handlercCstjj||jdS)N)r4r5resetforget)r.rrrrVs z Pdb.resetcCs&d|_g|_d|_d|_|jjdS)Nr)rstackcurindexcurframer>clear)r.rrrrWs z Pdb.forgetcCsl|j|j||\|_|_x*|rFt|jj|j}||j|j<|j }qW|j|jd|_ |j j |_ |j S)Nr)rWZ get_stackrXrYr,tb_framef_codetb_lastir>tb_nextrZr#curframe_locals execRcLines)r.ftbrrrrsetups   z Pdb.setupcCsh|js dS|j}|jg|_xD|rb|jj}|r |ddkr |j|r |jt|7_dSq WdS)Nr#T)rCr)popstriponecmdreversed)r.rCrrrrras  zPdb.execRcLinescCs.|jr dS|j|r*|jd|j|ddS)znThis method is called when there is the remote possibility that we ever need to stop in this function.Nz--Call--)r=Z stop_hererR interaction)r.rTZ argument_listrrr user_calls   z Pdb.user_callcCsH|jr.|j|j|jjks$|jdkr(dSd|_|j|rD|j|ddS)z;This function is called when we stop or break at this line.rNF)r=r<canonicr] co_filenamef_lineno bp_commandsrj)r.rTrrr user_lines  z Pdb.user_linecCst|ddr|j|jkr|j}d|_|j}|j|dx|j|D]}|j|qBW||_|j|sv|j|j|j |j |r|j |j dSdS)zCall every command that was set for the current active breakpoint (if there is one). Returns True if the normal interaction function must be called, False otherwise. currentbpFrNr) getattrrqrIlastcmdrdrhrKprint_stack_entryrXrYrJ_cmdlooprW)r.rTrqZ lastcmd_backrrrrros      zPdb.bp_commandscCs.|jr dS||jd<|jd|j|ddS)z7This function is called when a return trap is set here.N __return__z --Return--)r=r#rRrj)r.rTZ return_valuerrr user_returns   zPdb.user_returncCsj|jr dS|\}}}||f|jd<| r4|tkr4dnd}|jd|tj||djf|j||dS)zoThis function is called if an exception occurs, but only if we are to stop at or just below this level.NZ __exception__z Internal r2z%s%sr)r=r# StopIterationrR tracebackformat_exception_onlyrgrj)r.rTexc_infoexc_type exc_value exc_tracebackprefixrrruser_exception's zPdb.user_exceptionc CsDx>yd|_|jd|_PWqtk r:|jdYqXqWdS)NTFz--KeyboardInterrupt--)rAcmdlooprQrR)r.rrrru;sz Pdb._cmdloopcCsb|jj|j}|r^xJ|jD]>\}}|j|}||k r||kr|||<|jd|||fqWdS)Nzdisplay %s: %r [old: %r])r;getrZitems_getval_exceptrR)r.r;exprZoldvalueZnewvaluerrrpreloopHs z Pdb.preloopcCsZtjrtjtjtjdt_|j||r4|jdS|j|j|j|j |jdS)N) r _previous_sigint_handlersignalSIGINTrdrWrtrXrYru)r.rTrzrrrrjUs zPdb.interactioncCs|dk r|jt|dS)z{Custom displayhook for the exec in default(), which prevents assignment of the _ variable in the builtins. N)rRrepr)r.r$rrr displayhookcszPdb.displayhookc Cs|dddkr|dd}|j}|jj}ydt|ddd}tj}tj}tj}z(|jt_|jt_|jt_t|||Wd|t_|t_|t_XWn4tj dd}|j t j |dj YnXdS)Nr! zZsinglerx)r`rZr"rsysrPrOrexecr|errorrzr{rg) r.rlocalsglobalsr*Z save_stdoutZ save_stdinZsave_displayhookr|rrrdefaultks(  z Pdb.defaultcCs|js |S|j}xx|d|jkr|j|d}d}x0|ddD] }|jdt||}|d7}qDW|jddj|dd}|j}qW|ddkr|jd}|dkr||d dj}|jj ||d|j }|S) z*Handle alias expansion and ';;' separator.rrN%z%* aliasz;;r) rgsplitr:replacestrrGfindlstripcmdqueueappendrstrip)r.rargsZiiZtmpArgZmarkernextrrrprecmds&     z Pdb.precmdcCs"|jstjj||S|j|SdS)zInterpret the argument as though it had been typed in response to the prompt. Checks whether this line is typed at the normal prompt or in a breakpoint command list definition. N)rLr7r8rhhandle_command_def)r.rrrrrhsz Pdb.onecmdc Cs|j|\}}}|sdS|dkr0d|j|j<dS|dkrBg|_dS|j|j}|rf|j|d|n |j|yt|d|}Wntk r|j}YnX|j |j krd|j |j<g|_dSdS) z8Handles one command line during command list definition.NZsilentTendrrdo_F) Z parselinerKrMrrIrrrAttributeErrorrrcommands_resumingrJ)r.rr7argZcmdlistfuncrrrrs,      zPdb.handle_command_defcCst||jddS)N)file)printrP)r.msgrrrrRsz Pdb.messagecCstd||jddS)Nz***)r)rrP)r.rrrrrsz Pdb.errorc Cs|jjdrgSy|j||||}Wntk r>g}YnXtj|d}xP|D]H}tjj|rt|j|dqTtjj |rT|j jdrT|j|dqTW|S) N:,*/.py.pyw)rr)rr) rgendswith_complete_expression ExceptionglobrDrFisdirrisfilelower)r.textrbegidxendidxZretglobsfnrrr_complete_locations   zPdb._complete_locationcsfddttjjDS)Ncs.g|]&\}}|dk rt|jrt|qS)N)r startswith).0r+bp)rrr sz*Pdb._complete_bpnumber..)rr4 Breakpoint bpbynumber)r.rrrrr)rr_complete_bpnumberszPdb._complete_bpnumberc s|js gS|jjj}|j|jdkrjdy0|d}xddD]}t||}qPWWnttfk r|gSXdj dddfddt |DSfdd|j DSdS) N.rrcs"g|]}|jdr|qS)rrx)r)rn)dottedrrrrsz,Pdb._complete_expression..csg|]}|jr|qSr)r)rr)rrrrsrxrx) rZr"copyupdater`rrrKeyErrorrrGdirkeys)r.rrrrnsr$partr)rrrrrs    zPdb._complete_expressioncCs(|sttjjd}n"y t|}Wn|jddS||_||jkrf|j||j||j |f}nd}g|j|<d|j|<d|j |<|j }d|_ d|_ zzy |j Wnht k r|r|d|j|<|d|j|<|d|j |<n|j|=|j|=|j |=|jd YnXWdd|_ ||_ XdS) a4commands [bpnumber] (com) ... (com) end (Pdb) Specify a list of commands for breakpoint number bpnumber. The commands themselves are entered on the following lines. Type a line containing just 'end' to terminate the commands. The commands are executed when the breakpoint is hit. To remove all commands from a breakpoint, type commands and follow it immediately with end; that is, give no commands. With no bpnumber argument, commands refers to the last breakpoint set. You can use breakpoint commands to start your program up again. Simply use the continue command, or step, or any other command that resumes execution. Specifying any command resuming execution (currently continue, step, next, return, jump, quit and their abbreviations) terminates the command list (as if that command was immediately followed by end). This is because any time you resume execution (even with a simple next or step), you may encounter another breakpoint -- which could have its own command list, leading to ambiguities about which list to execute. If you use the 'silent' command in the command list, the usual message about stopping at a breakpoint is not printed. This may be desirable for breakpoints that are to print a specific message and then continue. If none of the other commands print anything, you will see no sign that the breakpoint was reached. rz.Usage: commands [bnum] ... endNTFz(com) rrz1command definition aborted, old commands restored)lenr4rrintrrMrIrJrKr9rLrrQ)r.rZbnumZold_command_defsZ prompt_backrrr do_commandss@%       zPdb.do_commandsrcCs@|s<|jr8|jdx"tjjD]}|r|j|jqWdSd}d}d}|jd}|dkr~||ddj}|d|j}|j d}d} |dkr|d|j}|j |} | s|j d|dS| }||ddj}y t |}Wn$t k r|j d|dSXny t |}Wnt k ryt||jj|j} Wn|} YnXy.t| d rl| j} | j} | j} | j}| j}Wn@|j|\} }}| s|j d |dS| } t |}YnXYnX|s|j}|j||}|r<|j||||| }|r|j |n*|j||d }|jd |j|j|jfdS) ab(reak) [ ([filename:]lineno | function) [, condition] ] Without argument, list all breaks. With a line number argument, set a break at this line in the current file. With a function name, set a break at the first executable line of that function. If a second argument is present, it is a string specifying an expression which must evaluate to true before the breakpoint is honored. The line number may be prefixed with a filename and a colon, to specify a breakpoint in another file (probably one that hasn't been loaded yet). The file is searched for on sys.path; the .py suffix may be omitted. z!Num Type Disp Enb WhereNrrrrz%r not found from sys.pathzBad lineno: %s__func__zJThe specified object %r is not a function or was not found along sys.path.zBreakpoint %d at %s:%drx) breaksrRr4rrZbpformatrrrrfind lookupmodulerr ValueErrorevalrZr"r`hasattrr__code__co_nameco_firstlinenormlineinfo defaultFile checklineZ set_break get_breaksnumberrr)r.rZ temporaryrrrcondZcommaZcolonrrbrr*oklnrerrrrrdo_breakTs~             z Pdb.do_breakcCs"|jjj}|dkr|jr|j}|S)zProduce a reasonable default.z)rZr]rmr<)r.rrrrrs zPdb.defaultFilecCs|j|ddS)ztbreak [ ([filename:]lineno | function) [, condition] ] Same arguments as break, but sets a temporary breakpoint: it is automatically deleted when first hit. rN)r)r.rrrr do_tbreaksz Pdb.do_tbreakc Csd}|jd}t|dkr(|dj}nt|dkrB|dj}n|S|dkrR|S|jd}|ddkr~|d=t|dkr~|S|j}t|dkr|d}n|j|d}|r|}|d}t||} | p|S) N'rrr2rr.)NNN)rrrgrrr ) r.Z identifierZfailedZidstringidpartsZfnameitemrbZanswerrrrrs.         z Pdb.lineinfocCst|dr|jjnd}tj|||}|s6|jddS|j}| sp|ddksp|dddksp|dddkr~|jd dS|S) zCheck whether specified line seems to be executable. Return `lineno` if it is, 0 if not (e.g. a docstring, comment, blank line or EOF). Warning: testing is not comprehensive. rZNz End of filerrerz"""z'''zBlank or comment)rrZr" linecachegetlinerRrgr)r.rrrrrrrrs   z Pdb.checklinecCsl|j}x^|D]V}y|j|}Wn,tk rL}z|j|WYdd}~XqX|j|jd|qWdS)zenable bpnumber [bpnumber ...] Enables the breakpoints given as a space separated list of breakpoint numbers. Nz Enabled %s)rget_bpbynumberrrenablerR)r.rrr+rrrrr do_enables z Pdb.do_enablecCsl|j}x^|D]V}y|j|}Wn,tk rL}z|j|WYdd}~XqX|j|jd|qWdS)aNdisable bpnumber [bpnumber ...] Disables the breakpoints given as a space separated list of breakpoint numbers. Disabling a breakpoint means it cannot cause the program to stop execution, but unlike clearing a breakpoint, it remains in the list of breakpoints and can be (re-)enabled. Nz Disabled %s)rrrrdisablerR)r.rrr+rrrrr do_disable s zPdb.do_disablecCs|jdd}y |d}Wntk r0d}YnXy|j|dj}WnHtk rf|jdYnXtk r}z|j|WYdd}~Xn.X||_|s|jd|jn|jd|jdS)a#condition bpnumber [condition] Set a new condition for the breakpoint, an expression which must evaluate to true before the breakpoint is honored. If condition is absent, any existing condition is removed; i.e., the breakpoint is made unconditional. rrNrzBreakpoint number expectedz#Breakpoint %d is now unconditional.z$New condition set for breakpoint %d.) r IndexErrorrrgrrrrRr)r.rrrrrrrr do_condition!s   zPdb.do_conditioncCs|j}yt|dj}Wnd}YnXy|j|dj}WnHtk rb|jdYnvtk r}z|j|WYdd}~XnLX||_|dkr|dkrd|}nd}|jd||j fn|jd|j dS) aignore bpnumber [count] Set the ignore count for the given breakpoint number. If count is omitted, the ignore count is set to 0. A breakpoint becomes active when the ignore count is zero. When non-zero, the count is decremented each time the breakpoint is reached and the breakpoint is not disabled and any associated condition evaluates to true. rrzBreakpoint number expectedNz %d crossingsz 1 crossingz%Will ignore next %s of breakpoint %d.z-Will stop next time breakpoint %d is reached.) rrrgrrrrignorerRr)r.rrcountrrZcountstrrrr do_ignore<s(   z Pdb.do_ignorec !Cs|sxy td}Wntk r(d}YnX|jj}|d krtddtjjD}|jx|D]}|jd|q^WdSd |kr|j d }|d|}||d d}y t |}Wnt k rd |}YnX|j ||}|j ||}|r|j|nx|D]}|jd|qWdS|j} xd| D]\}y|j|}Wn.t k rl}z|j|WYdd}~XnX|j||jd|q,WdS) a=cl(ear) filename:lineno cl(ear) [bpnumber [bpnumber...]] With a space separated list of breakpoint numbers, clear those breakpoints. Without argument, clear all breaks (but first ask confirmation). With a filename:lineno argument, clear all breaks at that line in that file. zClear all breaks? noyyescSsg|] }|r|qSrr)rrrrrrmsz Pdb.do_clear..z Deleted %sNrrzInvalid line number (%s))rr)inputEOFErrorrgrr4rrZclear_all_breaksrRrrrrZ clear_breakrrrZclear_bpbynumber) r.rZreplyZbplistrr+rrrZ numberlistrrrdo_clear_sF              z Pdb.do_clearcCs |jdS)zw(here) Print a stack trace, with the most recent frame at the bottom. An arrow indicates the "current frame", which determines the context of most commands. 'bt' is an alias for this command. N)print_stack_trace)r.rrrrdo_wheresz Pdb.do_wherecCs`d|kot|jkns"t||_|j|jd|_|jj|_|j|j|jd|_dS)Nr) rrXAssertionErrorrYrZr#r`rtr)r.rrrr _select_frames " zPdb._select_framec Csx|jdkr|jddSyt|p"d}Wn"tk rJ|jd|dSX|dkrZd}ntd|j|}|j|dS)zu(p) [count] Move the current frame count (default one) levels up in the stack trace (to an older frame). rz Oldest frameNrzInvalid frame count (%s))rYrrrmaxr)r.rrnewframerrrdo_ups  z Pdb.do_upc Cs|jdt|jkr"|jddSyt|p,d}Wn"tk rT|jd|dSX|dkrnt|jd}ntt|jd|j|}|j|dS)zd(own) [count] Move the current frame count (default one) levels down in the stack trace (to a newer frame). rz Newest frameNzInvalid frame count (%s)r)rYrrXrrrminr)r.rrrrrrdo_downs z Pdb.do_downc Csf|rPy t|}Wn"tk r2|jd|dSX||jjkrT|jddSnd}|j|j|dS)aNunt(il) [lineno] Without argument, continue execution until the line with a number greater than the current one is reached. With a line number, continue execution until a line with a number greater or equal to that is reached. In both cases, also stop when the current frame returns. zError in argument: %rNz7"until" line number is smaller than current line numberr)rrrrZrnZ set_until)r.rrrrrdo_untils   z Pdb.do_untilcCs |jdS)zs(tep) Execute the current line, stop at the first possible occasion (either in a function that is called or in the current function). r)rS)r.rrrrdo_stepsz Pdb.do_stepcCs|j|jdS)zxn(ext) Continue execution until the next line in the current function is reached or it returns. r)Zset_nextrZ)r.rrrrdo_nexts z Pdb.do_nextcCs<|r4ddl}tjdd}|j|t_|tjdd<tdS)arun [args...] Restart the debugged python program. If a string is supplied it is split with "shlex", and the result is used as the new sys.argv. History, breakpoints, actions and debugger options are preserved. "restart" is an alias for "run". rNr)shlexrargvrr)r.rr Zargv0rrrdo_runs  z Pdb.do_runcCs|j|jdS)zPr(eturn) Continue execution until the current function returns. r)Z set_returnrZ)r.rrrr do_returns z Pdb.do_returnc Cs>|js2ytjtj|jt_Wntk r0YnX|jdS)z]c(ont(inue)) Continue execution, only stop when a breakpoint is encountered. r)rBrrrUr rrZ set_continue)r.rrrr do_continueszPdb.do_continuecCs|jdt|jkr"|jddSy t|}Wntk rL|jdYnnXy:||j_|j|jd|f|j|j<|j|j|jWn0tk r}z|jd|WYdd}~XnXdS)aj(ump) lineno Set the next line that will be executed. Only available in the bottom-most frame. This lets you jump back and execute code again, or jump forward to skip code that you don't want to run. It should be noted that not all jumps are allowed -- for instance it is not possible to jump into the middle of a for loop or out of a finally clause. rz)You can only jump within the bottom frameNz)The 'jump' command requires a line numberrzJump failed: %s) rYrrXrrrrZrnrt)r.rerrrdo_jump"s   z Pdb.do_jumpcCsztjd|jj}|j}t|j|j|j}d|j j |_ |j dtj |j |||f|j dtj|j|j|_dS)zdebug code Enter a recursive debugger that steps through the code argument (which is an arbitrary expression or statement to be executed in the current environment). Nz(%s) zENTERING RECURSIVE DEBUGGERzLEAVING RECURSIVE DEBUGGER)rsettracerZr"r`r rNrOrPr9rgrR call_tracingr Ztrace_dispatchrs)r.rrrprrrdo_debug?s    z Pdb.do_debugcCsd|_|jdS)z[q(uit) exit Quit from the debugger. The program being executed is aborted. Tr)_user_requested_quitset_quit)r.rrrrdo_quitRsz Pdb.do_quitcCs|jdd|_|jdS)z=EOF Handles the receipt of EOF as a command. r2Tr)rRrr)r.rrrrdo_EOF]s z Pdb.do_EOFcCs|jj}|j}|j}|jd@r&|d}|jd@r8|d}xJt|D]>}|j|}||krp|jd|||fqB|jd|fqBWdS)zHa(rgs) Print the argument list of the current function. rz%s = %rz%s = *** undefined ***N)rZr]r` co_argcountco_flagsrange co_varnamesrR)r.rcodictrr+namerrrdo_argsfs   z Pdb.do_argscCs.d|jkr |jt|jdn |jddS)zQretval Print the return value for the last return of a function. rvzNot yet returned!N)r`rRrr)r.rrrr do_retvalws z Pdb.do_retvalc CsNyt||jj|jStjdd}|jtj|dj YnXdS)Nrrrx) rrZr"r`rr|rrzr{rg)r.rr|rrr_getvals z Pdb._getvalc Cshy.|dkrt||jj|jSt||j|jSWn4tjdd}tj|dj }t d|SdS)Nrrz** raised %s **rx) rrZr"r`r#rr|rzr{rgr-)r.rrTr|rrrrrszPdb._getval_exceptc Cs*y|jt|j|Wn YnXdS)z@p expression Print the value of the expression. N)rRrr')r.rrrrdo_pszPdb.do_pc Cs,y|jtj|j|Wn YnXdS)zHpp expression Pretty-print the value of the expression. N)rRpprintZpformatr')r.rrrrdo_ppsz Pdb.do_ppcCsdd|_d}|r|dkry^d|krX|jd\}}t|j}t|j}||krr||}nt|j}td|d}Wqtk r|jd|dSXn0|jdks|dkrtd|jj d}n |jd}|dkr|d}|jj j }|j |}yZt j||jj}|j||d||||jt|t||_t||krF|jd Wntk r^YnXdS) al(ist) [first [,last] | .] List source code for the current file. Without arguments, list 11 lines around the current line or continue the previous listing. With . as argument, list 11 lines around the current line. With one argument, list 11 lines starting at that line. With two arguments, list the given range; if the second argument is less than the first, it is a count. The current line in the current frame is indicated by "->". If an exception is being debugged, the line where the exception was originally raised or propagated is indicated by ">>", if it differs from the current line. r'NrrrzError in argument: %r z[EOF])rsrrrgrrrrrZrnr]rmget_file_breaksrgetlinesr" _print_linesrrrRrQ)r.rZlastfirstr breaklistr%rrrdo_lists>        z Pdb.do_listcCsh|jjj}|j|}yt|j\}}Wn*tk rP}z|j|dSd}~XnX|j||||jdS)z\longlist | ll List the whole source code for the current function or frame. N)rZr]rmr-r&rrr/)r.rrr1r%rrrrr do_longlists   zPdb.do_longlistcCsjy|j|}Wn dSyt|\}}Wn.ttfk rX}z|j|dSd}~XnX|j||dS)z^source expression Try to get source code for the given object and display it. N)r'r&r TypeErrorrr/)r.rr$r%rrrrr do_sources z Pdb.do_sourcec Cs|r|j}|jj|d }nd }}xt||D]|\}}t|jd} t| dkrX| d7} ||krj| d7} n| d7} ||kr| d7} n||kr| d7} |j| d|jq.Wd S) zPrint a range of lines.rrrrBz->z>> Nrxrx) rnr>rrrrjustrrRr) r.r%rrrTZcurrent_linenoZ exc_linenorrsrrrr/s    zPdb._print_linescCsy|j|}Wn dSd}y |j}Wntk r<YnX|rV|jd|jdSy |jj}Wntk rvYnX|r|jd|jdS|jtkr|jd|j|j fdS|jt|dS)z;whatis arg Print the type of the argument. Nz Function %sz Method %sz Class %s.%s) r'rrrRrr __class__typerr)r.rvaluer*rrr do_whatiss.   z Pdb.do_whatiscCsp|s<|jdx\|jj|jijD]}|jd|q$Wn0|j|}||jj|ji|<|jd||fdS)zdisplay [expression] Display the value of the expression if it changed, each time execution stops in the current frame. Without expression, list all display expressions for the current frame. zCurrently displaying:z%s: %rzdisplay %s: %rN)rRr;rrZrr setdefault)r.rrvalrrr do_display4s  zPdb.do_displayc CsT|r@y|jj|ji|=WqPtk r<|jd|YqPXn|jj|jddS)zundisplay [expression] Do not display the expression any more in the current frame. Without expression, clear all display expressions for the current frame. znot displaying %sN)r;rrZrrrf)r.rrrr do_undisplayGs zPdb.do_undisplaycsfdd|jj|jiDS)Ncsg|]}|jr|qSr)r)rr)rrrrWsz*Pdb.complete_undisplay..)r;rrZ)r.rrrrr)rrcomplete_undisplayVszPdb.complete_undisplaycCs*|jjj}|j|jtjd|ddS)zinteract Start an interactive interpreter whose global namespace contains all the (global and local) names found in the current scope. z *interactive*)ZlocalN)rZr"rrr`r*interact)r.rrrrr do_interactZs  zPdb.do_interactcCs|j}t|dkrLt|jj}x$|D]}|jd||j|fq(WdS|d|jkrt|dkr|jd|d|j|dfndj|dd|j|d<dS)acalias [name [command [parameter parameter ...] ]] Create an alias called 'name' that executes 'command'. The command must *not* be enclosed in quotes. Replaceable parameters can be indicated by %1, %2, and so on, while %* is replaced by all the parameters. If no command is given, the current alias for name is shown. If no name is given, all aliases are listed. Aliases may be nested and can contain anything that can be legally typed at the pdb prompt. Note! You *can* override internal pdb commands with aliases! Those internal commands are then hidden until the alias is removed. Aliasing is recursively applied to the first word of the command line; all other words in the line are left alone. As an example, here are two useful aliases (especially when placed in the .pdbrc file): # Print instance variables (usage "pi classInst") alias pi for k in %1.__dict__.keys(): print("%1.",k,"=",%1.__dict__[k]) # Print instance variables in self alias ps pi self rz%s = %sNrr)rrsortedr:rrRrG)r.rrrrrrrdo_aliasds  "z Pdb.do_aliascCs6|j}t|dkrdS|d|jkr2|j|d=dS)z9unalias name Delete the specified alias. rN)rrr:)r.rrrrr do_unaliass  zPdb.do_unaliascsfdd|jDS)Ncsg|]}|jr|qSr)r)ra)rrrrsz(Pdb.complete_unalias..)r:)r.rrrrr)rrcomplete_unaliasszPdb.complete_unaliasrr r rrrc Cs8yx|jD]}|j|q WWntk r2YnXdS)N)rXrtrQ)r. frame_linenorrrrs  zPdb.print_stack_tracecCs6|\}}||jkrd}nd}|j||j||dS)Nz> z )rZrRZformat_stack_entry)r.rJZ prompt_prefixrTrrrrrrts  zPdb.print_stack_entrycCs|stjj||Sy}xtjj |rtj |}qWtjj||}tjj|r|SqWdS)zHelper function for break/clear parsing -- may be overridden. lookupmodule() translates (possibly incomplete) file or module name into an absolute file name. rr2z.pyN) rDrFisabsexistsrGrrlr<splitextislinkreadlink)r.rrbrootZextdirnamefullnamerrrrs"   zPdb.lookupmodulec Cstddl}|jj|jjd|tdd|_|j||_d|_t |d}d|j |jf}WdQRX|j |dS)Nr__main__)r__file__ __builtins__TFrbzexec(compile(%r, %r, 'exec'))) rX__dict__r[rrZr=rlr<rrreadr )r.rrXr statementrrr _runscripts    zPdb._runscript)r0NNNFT)r)N)vrrrrr6rUrVrWrdrarkrprorwrrurrjrrrrhrrRrrrrrZcomplete_commandsrrZdo_bZcomplete_breakZ complete_brZcomplete_tbreakrrrZcomplete_enablerZcomplete_disablerZcomplete_conditionrZcomplete_ignorerZdo_clZcomplete_clearZ complete_clrZdo_wZdo_btrrZdo_ur Zdo_dr Zdo_untr Zdo_sr Zdo_nrZ do_restartrZdo_rrZdo_cZdo_contrZdo_jrZcomplete_debugrZdo_qZdo_exitrr%Zdo_ar&Zdo_rvr'rr(r*Zcomplete_printZ complete_pZ complete_ppr2Zdo_lr3Zdo_llr5Zcomplete_sourcer/r=Zcomplete_whatisr@Zcomplete_displayrArBrDrFrGrIrr line_prefixrtrKZdo_hrNrOrr_rrrrr s /     M ]!!.    1 ! #    whereZdownZupbreakZtbreakr[rrrZ conditionrIsteprZuntilZjumpreturnZretvalcontinuer'ZlonglistrrZppZwhatissourceZdisplayZ undisplayrCrZunaliasdebugquitrz cCstj|||dS)N)r r )r^rrrrrr #scCstj|||S)N)r r )Z expressionrrrrrr &scCst|||dS)N)r )r^rrrrrr )scOstj||S)N)r r)rkwdsrrrr-scCstjtjjdS)N)r rr _getframef_backrrrrr0scCsB|dkrtjd}|dkr$tdt}|j|jd|dS)NrzAA valid traceback must be passed if no exception is being handled)rr|rr rVrj)trrrrr5s cCsttjdS)N)rrlast_tracebackrrrrr Cszimport x; x.main()cCs ttdS)N)r TESTCMDrrrrtestKsrocCsddl}|jtdS)Nr)pydocZpagerr)rprrrrOsausage: pdb.py [-c command] ... pyfile [arg] ... Debug the Python program given by pyfile. Initial commands are read from .pdbrc files in your home directory and in the current directory, if they exist. Commands supplied with -c are executed after commands from .pdbrc files. To let the script run until an exception occurs, use "-c continue". To let the script run up to a given line X in the debugged file, use "-c 'until X'".c Csddl}|jtjdddddg\}}|s>tttjdg}x<|D]4\}}|dkrjtttjqH|dkrH|j|qHW|d}tjj |std |d tjd|tjdd<tjj |tjd<t }|j j |xy|j||jrPtd Wqtk r0td |dtddj|Yqtk r`tdddttjdYqtk rtjtjdYqtjtdtdtjd}|jd|td|dYqXqWdS)Nrrzhc:--helpz --command=r-h-c --commandzError:zdoes not existz*The program finished and will be restartedZ Restartingzwith arguments:r7rz/The program exited via sys.exit(). Exit status:)rz2Uncaught exception. Entering post mortem debuggingz1Running 'cont' or 'step' will restart the programz#Post mortem debugger finished. The z will be restarted)rrrq)rsrt)getoptrrr_usageexitrrDrFrQrVr rCrHr_rrrG SystemExitr| SyntaxErrorrz print_excrj) ruZoptsrrIoptZoptargr<pdbrlrrrmain`sV             r}rX)NN)NN)N)-rrDrrr7r4r(r*rr)rr!rzrrr__all__r r&r,rr-r`r5r8r Z _help_orderZ_commandrrrgrNr r r rrrr rnrorrvr}rr|rrrrBst      "    < rlcompleter.cpython-36.opt-2.pyc000064400000006057152462730460012503 0ustar003 \ @s~ddlZddlZddlZdgZGdddZddZy ddlZWnek rXdZYn"Xej ej ej ddd ZdS) N Completerc@s6eZdZd ddZddZddZdd Zd d ZdS) rNcCs8|rt|t rtd|dkr(d|_n d|_||_dS)Nznamespace must be a dictionaryr) isinstancedict TypeError use_main_ns namespace)selfrr #/usr/lib64/python3.6/rlcompleter.py__init__'s zCompleter.__init__c Cs|jrtj|_|jsB|dkr>tr8tjdtjdSdSndS|dkrld|kr`|j ||_ n |j ||_ y |j |St k rdSXdS)Nr .) r__main____dict__rstrip_readline_availablereadlineZ insert_textZ redisplay attr_matchesmatchesglobal_matches IndexError)r textstater r r completeBs$   zCompleter.completecCst|r|d}|S)N()callable)r valwordr r r _callable_postfixaszCompleter._callable_postfixc Csddl}g}dh}t|}xT|jD]J}|d||kr"|j||dkrR|d}n|dkrb|d }|j|q"Wx^|jtjgD]N}xH|jD]<\}}|d||kr||kr|j||j|j ||qWq~W|S)Nr __builtins__finallytry:FalseNoneTruebreakcontinuepasselse >r"r#>r*r&r)r+r%r(r') keywordlenkwlistaddappendrbuiltinsritemsr ) r rr-rseennrZnspacerr r r rfs(    zCompleter.global_matchescCsnddl}|jd|}|sgS|jdd\}}yt||j}Wntk rPgSXtt|}|jdt |dr|j d|j t |j g}t|} |dkrd} n|dkrd } nd} xx~|D]v} | d| |ko| o| d| d| k rd || f} yt|| } Wntk rYnX|j| | } |j| qW|sH| rJP| dkrZd } qd} qW|j|S) Nrz(\w+(\.\w+)*)\.(\w*)rr! __class__r___z%s.%s)rematchgroupevalr Exceptionsetdirdiscardhasattrr0updateget_class_membersr7r.getattrr r1sort)r rr:mexprattrZ thisobjectZwordsrr5Znoprefixrr;rr r r rsN          zCompleter.attr_matches)N)__name__ __module__ __qualname__r rr rrr r r r r&s  cCs2t|}t|dr.x|jD]}|t|}qW|S)N __bases__)r@rBrMrD)klassZretbaser r r rDs   rDFcCs tjdS)N)r set_completerr r r r srQT) atexitr2r__all__rrDr ImportErrorrrPrregisterr r r r  s  tracemalloc.cpython-36.opt-1.pyc000064400000041517152462730460012440 0ustar003 \A@sddlmZmZddlmZddlZddlZddlZddl Z ddl Tddl m Z m Z ddZ Gdd d ZGd d d Zd d ZeGdddZeGdddeZddZGdddZGdddeZddZGdddZGdddeZGdddeZGd d!d!Zd"d#ZdS)$)SequenceIterable)total_orderingN)*)_get_object_traceback _get_tracescCszxtd D]l}t|dkr:|dkr:|r.d||fSd||fSt|dksN|dkrj|r^d ||fSd ||fS|d }qWdS)NBKiBMiBGiBTiBdz%+.1f %sz%.1f %s iz%+.0f %sz%.0f %s)rr r r r i()abs)sizeZsignZunitr#/usr/lib64/python3.6/tracemalloc.py _format_size s     rc@sDeZdZdZdZddZddZd d Zd d Zd dZ ddZ dS) StatisticzS Statistic difference on memory allocations between two Snapshot instance. tracebackrcountcCs||_||_||_dS)N)rrr)selfrrrrrr__init__%szStatistic.__init__cCst|j|j|jfS)N)hashrrr)rrrr__hash__*szStatistic.__hash__cCs$|j|jko"|j|jko"|j|jkS)N)rrr)rotherrrr__eq__-s  zStatistic.__eq__cCsBd|jt|jd|jf}|jr>|j|j}|dt|d7}|S)Nz%s: size=%s, count=%iFz , average=%s)rrrr)rtextaveragerrr__str__2s   zStatistic.__str__cCsd|j|j|jfS)Nz))rrr)rrrr__repr__<szStatistic.__repr__cCs|j|j|jfS)N)rrr)rrrr _sort_key@szStatistic._sort_keyN)rrr) __name__ __module__ __qualname____doc__ __slots__rrrrr r!rrrrrs rc@sDeZdZdZdZddZd d Zd d Zd dZddZ ddZ dS) StatisticDiffzd Statistic difference on memory allocations between an old and a new Snapshot instance. rr size_diffr count_diffcCs"||_||_||_||_||_dS)N)rrr(rr))rrrr(rr)rrrrKs zStatisticDiff.__init__cCst|j|j|j|j|jfS)N)rrrr(rr))rrrrrRszStatisticDiff.__hash__cCs<|j|jko:|j|jko:|j|jko:|j|jko:|j|jkS)N)rrr(rr))rrrrrrVs     zStatisticDiff.__eq__cCsPd|jt|jdt|jd|j|jf}|jrL|j|j}|dt|d7}|S)Nz %s: size=%s (%s), count=%i (%+i)FTz , average=%s)rrrr(rr))rrrrrrr]s    zStatisticDiff.__str__cCsd|j|j|j|j|jfS)Nz9)rrr(rr))rrrrr is zStatisticDiff.__repr__cCs t|j|jt|j|j|jfS)N)rr(rr)rr)rrrrr!ns  zStatisticDiff._sort_keyN)rrr(rr)) r"r#r$r%r&rrrrr r!rrrrr'Ds r'cCsg}xp|jD]d\}}|j|d}|dk rPt||j|j|j|j|j|j}nt||j|j|j|j}|j|qWx6|jD]*\}}t|d|j d|j }|j|qW|S)Nr)itemspopr'rrappend) old_group new_group statisticsrstatZpreviousrrr_compare_grouped_statsts  r1c@s\eZdZdZdZddZeddZeddZd d Z d d Z d dZ ddZ ddZ dS)Framez Frame of a traceback. _framecCs ||_dS)N)r3)rframerrrrszFrame.__init__cCs |jdS)Nr)r3)rrrrfilenameszFrame.filenamecCs |jdS)N)r3)rrrrlinenosz Frame.linenocCs |j|jkS)N)r3)rrrrrrsz Frame.__eq__cCs |j|jkS)N)r3)rrrrr__lt__sz Frame.__lt__cCs t|jS)N)rr3)rrrrrszFrame.__hash__cCsd|j|jfS)Nz%s:%s)r5r7)rrrrrsz Frame.__str__cCsd|j|jfS)Nz)r5r7)rrrrr szFrame.__repr__N)r3)r"r#r$r%r&rpropertyr5r7rr8rrr rrrrr2s  r2c@sfeZdZdZdZddZddZddZd d Zd d Z d dZ ddZ ddZ ddZ dddZdS) Tracebackz` Sequence of Frame instances sorted from the most recent frame to the oldest frame. _framescCstj|||_dS)N)rrr;)rframesrrrrs zTraceback.__init__cCs t|jS)N)lenr;)rrrr__len__szTraceback.__len__cCs4t|tr"tdd|j|DSt|j|SdS)Ncss|]}t|VqdS)N)r2).0tracerrr sz(Traceback.__getitem__..) isinstanceslicetupler;r2)rindexrrr __getitem__s zTraceback.__getitem__cCs |j|jkS)N)r3r;)rr4rrr __contains__szTraceback.__contains__cCs t|jS)N)rr;)rrrrrszTraceback.__hash__cCs |j|jkS)N)r;)rrrrrrszTraceback.__eq__cCs |j|jkS)N)r;)rrrrrr8szTraceback.__lt__cCs t|dS)Nr)str)rrrrrszTraceback.__str__cCsdt|fS)Nz)rD)rrrrr szTraceback.__repr__NcCsng}|dk r|dkr|SxP|d|D]@}|jd|j|jftj|j|jj}|r&|jd|q&W|S)Nrz File "%s", line %sz %s)r,r5r7 linecachegetlinestrip)rlimitlinesr4linerrrformatszTraceback.format)r;)N)r"r#r$r%r&rr>rFrGrrr8rr rOrrrrr:sr:cCs t|}|dk rt|SdSdS)z Get the traceback where the Python object *obj* was allocated. Return a Traceback instance. Return None if the tracemalloc module is not tracing memory allocations or did not trace the allocation of the object. N)rr:)objr<rrrget_object_tracebacksrQc@s`eZdZdZdZddZeddZeddZed d Z d d Z d dZ ddZ ddZ dS)Tracez" Trace of a memory block. _tracecCs ||_dS)N)rS)rr@rrrrszTrace.__init__cCs |jdS)Nr)rS)rrrrdomainsz Trace.domaincCs |jdS)Nr6)rS)rrrrrsz Trace.sizecCst|jdS)N)r:rS)rrrrrszTrace.tracebackcCs |j|jkS)N)rS)rrrrrrsz Trace.__eq__cCs t|jS)N)rrS)rrrrr szTrace.__hash__cCsd|jt|jdfS)Nz%s: %sF)rrr)rrrrr sz Trace.__str__cCsd|jt|jd|jfS)Nz'F)rTrrr)rrrrr szTrace.__repr__N)rS)r"r#r$r%r&rr9rTrrrrrr rrrrrRs   rRc@s<eZdZddZddZddZddZd d Zd d Zd S)_TracescCstj|||_dS)N)rr_traces)rtracesrrrrs z_Traces.__init__cCs t|jS)N)r=rW)rrrrr>sz_Traces.__len__cCs4t|tr"tdd|j|DSt|j|SdS)Ncss|]}t|VqdS)N)rR)r?r@rrrrA sz&_Traces.__getitem__..)rBrCrDrWrR)rrErrrrFs z_Traces.__getitem__cCs |j|jkS)N)rSrW)rr@rrrrG$sz_Traces.__contains__cCs |j|jkS)N)rW)rrrrrr'sz_Traces.__eq__cCs dt|S)Nz)r=)rrrrr *sz_Traces.__repr__N) r"r#r$rr>rFrGrr rrrrrVs rVcCs&tjj|}|jdr"|dd}|S)Nz.pycr6)ospathnormcaseendswith)r5rrr_normalize_filename.s   r^c@seZdZddZddZdS) BaseFiltercCs ||_dS)N) inclusive)rr`rrrr6szBaseFilter.__init__cCstdS)N)NotImplementedError)rr@rrr_match9szBaseFilter._matchN)r"r#r$rrbrrrrr_5sr_csJeZdZdfdd ZeddZddZd d Zd d Zd dZ Z S)FilterNFcs2tj|||_t||_||_||_||_dS)N)superrr`r^_filename_patternr7 all_framesrT)rr`filename_patternr7rfrT) __class__rrr>s   zFilter.__init__cCs|jS)N)re)rrrrrgGszFilter.filename_patterncCs6t|}tj||jsdS|jdkr(dS||jkSdS)NFT)r^fnmatchrer7)rr5r7rrr_match_frame_implKs  zFilter._match_frame_implcCs|j|||j AS)N)rjr`)rr5r7rrr _match_frameTszFilter._match_framecsHjr,tfdd|Dr"jSj Sn|d\}}j||SdS)Nc3s|]\}}j||VqdS)N)rj)r?r5r7)rrrrAYsz*Filter._match_traceback..r)rfanyr`rk)rrr5r7r)rr_match_tracebackWs    zFilter._match_tracebackcCsD|\}}}|j|}|jdk r@|jr2|o0||jkS|p>||jkS|S)N)rmrTr`)rr@rTrrresrrrrbbs   z Filter._match)NFN) r"r#r$rr9rgrjrkrmrb __classcell__rr)rhrrc=s    rccs0eZdZfddZeddZddZZS) DomainFiltercstj|||_dS)N)rdr_domain)rr`rT)rhrrrns zDomainFilter.__init__cCs|jS)N)rq)rrrrrTrszDomainFilter.domaincCs|\}}}||jk|j AS)N)rTr`)rr@rTrrrrrrbvs zDomainFilter._match)r"r#r$rr9rTrbrorr)rhrrpms  rpc@sXeZdZdZddZddZeddZdd Zd d Z d d Z dddZ dddZ dS)SnapshotzB Snapshot of traces of memory blocks allocated by Python. cCst||_||_dS)N)rVrXtraceback_limit)rrXrsrrrrs zSnapshot.__init__c Cs*t|d}tj||tjWdQRXdS)z1 Write the snapshot into a file. wbN)openpickledumpZHIGHEST_PROTOCOL)rr5fprrrrws z Snapshot.dumpc Cs t|d }tj|SQRXdS)z. Load a snapshot from a file. rbN)rurvload)r5rxrrrrzs z Snapshot.loadcs@|rtfdd|DsdS|r.Fc3s|]}|j VqdS)N)rb)r?r{)r@rrrAsT)rl)rinclude_filtersexclude_filtersr@r)r@r _filter_traces    zSnapshot._filter_tracecst|tstdt|j|rnggx(|D] }|jrDj|q.j|q.WfddjjD}n jjj }t |j S)z Create a new Snapshot instance with a filtered traces sequence, filters is a list of Filter or DomainFilter instances. If filters is an empty list, return a new Snapshot instance with a copy of the traces. z)filters must be a list of filters, not %scsg|]}j|r|qSr)r~)r?r@)r}r|rrr sz*Snapshot.filter_traces..) rBr TypeErrortyper"r`r,rXrWcopyrrrs)rfiltersr{Z new_tracesr)r}r|rr filter_tracess    zSnapshot.filter_tracesc Cs|dkrtd|f|r.|d kr.td|i}i}|sx|jjD]}|\}}}y ||} WnZtk r|dkr~|} n(|dkr|dd} n|dddff} t| } | ||<YnXy(|| } | j|7_| jd7_WqFtk r t| |d|| <YqFXqFWnx|jjD]}|\}}}x|D]} y || } WnFtk r|dkrd| f} n| ddff} t| } | || <YnXy(|| } | j|7_| jd7_Wn&tk rt| |d|| <YnXq0WqW|S) Nrr5r7zunknown key_type: %rz/cumulative mode cannot by used with key type %rr6r)rr5r7)r7r5) ValueErrorrXrWKeyErrorr:rrr) rkey_type cumulativeZstatsZ tracebacksr@rTrZtrace_tracebackrr<r0r4rrr _group_bysX       "zSnapshot._group_byFcCs,|j||}t|j}|jdtjd|S)zd Group statistics by key_type. Return a sorted list of Statistic instances. T)reversekey)rlistvaluessortrr!)rrrZgroupedr/rrrr/s  zSnapshot.statisticscCs6|j||}|j||}t||}|jdtjd|S)z Compute the differences with an old snapshot old_snapshot. Get statistics as a sorted list of StatisticDiff instances, grouped by group_by. T)rr)rr1rr'r!)rZ old_snapshotrrr.r-r/rrr compare_tos    zSnapshot.compare_toN)F)F) r"r#r$r%rrw staticmethodrzr~rrr/rrrrrrr{s  3 rrcCs$tstdt}t}t||S)zI Take a snapshot of traces of memory blocks allocated by Python. zLthe tracemalloc module must be tracing memory allocations to take a snapshot)Z is_tracing RuntimeErrorrZget_traceback_limitrr)rXrsrrr take_snapshots r) collectionsrr functoolsrrirIZos.pathrZrvZ _tracemallocrrrrr'r1r2r:rQrRrVr^r_rcrprrrrrrrs0 &0# 5%0 pickle.cpython-36.opt-2.pyc000064400000111634152462730460011420 0ustar003 \@sddlmZddlmZddlmZmZmZddlmZddl m Z ddl Z ddl m Z ddl mZmZddlZddlZddlZddlZd d d d d ddddg ZeefZdZdddddddgZdZdZGdd d eZGdd d eZGdd d eZGdddeZ ydd l!m"Z"Wne#k r.dZ"YnXd!Z$d"Z%d#Z&d$Z'd%Z(d&Z)d'Z*d(Z+d)Z,d*Z-d+Z.d,Z/d-Z0d.Z1d/Z2d0Z3d1Z4d2Z5d3Z6d4Z7d5Z8d6Z9d7Z:d8Z;d9ZdZAd?ZBd@ZCdAZDdBZEdCZFdDZGdEZHdFZIdGZJdHZKdIZLdJZMdKZNdLZOdMZPdNZQdOZRdPZSdQZTdRZUdSZVdTZWdUZXdVZYdWZZeJeTeUeVgZ[dXZ\dYZ]dZZ^d[Z_d\Z`d]Zad^Zbd_Zcd`ZddaZedbZfdcZgejhdddeeiDGdfdgdgZjGdhdidiZkdjdkZldldmZmdndoZndpdqZoGdrdsdsZpGdtduduZqddvdwdxdyZrddvdwdzd{Zsdvd|d}d~ddZtdvd|d}d~ddZuy0ddlvmZmZmZmwZwmxZxmyZymzZzm{Z{m|Z|Wn4e#k r^epeqZwZxereseteuf\ZyZzZ{Z|YnXddZ}e~dkrddlZejddZejdejddddejdddddejddddejZejre}n>ejsejn,ddlZx"ejD]Ze{eZejeqWdS)) FunctionType)dispatch_table)_extension_registry_inverted_registry_extension_cache)islice)partialN)maxsize)packunpack PickleError PicklingErrorUnpicklingErrorPickler Unpicklerdumpdumpsloadloadsz4.0z1.0z1.1z1.2z1.3z2.0z3.0c@s eZdZdS)r N)__name__ __module__ __qualname__rr/usr/lib64/python3.6/pickle.pyr @sc@s eZdZdS)r N)rrrrrrrr Dsc@s eZdZdS)rN)rrrrrrrrKs c@seZdZddZdS)_StopcCs ||_dS)N)value)selfrrrr__init__Ysz_Stop.__init__N)rrrrrrrrrXsr) PyStringMap(.012FIJKLMNPQRSTUVXabcd}eghijl]opqrst)uGsI01 sI00 BCcCsg|]}tjd|r|qS)z[A-Z][A-Z0-9_]+$)rematch).0xrrr srfc@s:eZdZdZddZddZddZdd d Zd d ZdS)_Framer@icCs||_d|_dS)N) file_write current_frame)rrirrrrsz_Framer.__init__cCstj|_dS)N)ioBytesIOrj)rrrr start_framingsz_Framer.start_framingcCs*|jr&|jjdkr&|jddd|_dS)NrT)force)rjtell commit_frame)rrrr end_framings z_Framer.end_framingFc Cst|jrp|j}|j|jks|rp|j2}t|}|j}|t|td|||WdQRX|jd|j dS)Nzz&Can't get local attribute {!r} on {!r}z Can't get attribute {!r} on {!r})splitAttributeErrorformatgetattr)objnameZsubpathparentrrr _getattributes rc Cszt|dd}|dk r|Sx\ttjjD]J\}}|dks(|dkrBq(yt||d|krZ|SWq(tk rpYq(Xq(WdS)Nr__main__r)rlistsysmodulesitemsrr)rr module_namemodulerrr whichmodules  rcCsh|dkr dS|jd?d}|j|ddd}|dkrd|dkrd|d dkrd|d d @dkrd|dd }|S)NrrrrlittleT) byteordersignedrr) bit_lengthto_bytes)renbytesresultrrr encode_long$s rcCstj|dddS)NrT)rr)int from_bytes)ryrrr decode_longBsrc@sheZdZd7ddddZddZdd Zd d Zd d ZddZd8ddZ ddZ ddZ d9ddZ iZ ddZee ed<ddZee e<ddZee e<ddZee e<d d!Zee e<d"d#Zee e<d$d%Zee e<d&d'Zee e<d(Zd)d*Zd+d,Z e e e!<e"dk re e e"<d-d.Z#d/d0Z$e$e e%<d1d2Z&e&e e'<d:d3d4Z(d5d6Z)e(e e*<e)e e<dS);_PicklerNT) fix_importsc Cs|dkr t}|dkrt}n$d|ko,tkns>tdty |j|_Wntk rftdYnXt|j|_|jj|_i|_ t ||_ |dk|_ d|_ |o|dk|_dS)Nrzpickle protocol must be <= %dz"file must have a 'write' attributerr)DEFAULT_PROTOCOLHIGHEST_PROTOCOL ValueErrorr{ _file_writer TypeErrorrgframermemorprotobinfastr)rfileprotocolrrrrr[s"      z_Pickler.__init__cCs|jjdS)N)rclear)rrrr clear_memosz_Pickler.clear_memocCsrt|dstd|jjf|jdkr<|jttd|j|jdkrP|jj |j ||jt |jj dS)Nrz2Pickler.__init__() was not called by %s.__init__()rzy |jtt|jddWntk r\tdYnXdS)NF)rrrz2persistent IDs in protocol 0 must be ASCII strings) rrr{ BINPERSIDPERSIDrrUnicodeEncodeErrorr )rrrrrrs  z_Pickler.save_persc Cst|tstdt|s"td|j}|j}t|dd} |jdkr| dkr|\} }} t| dsntdj | |dk r| |j k rtd j | |jd kr|| |||| |t n,t | j | f|| }|||f|tn|jdko| d kr\|d } t| dstd |dk r6| |j k r6td|dd}|| |||tn|||||t|dk rt||jkr|t|j|jt|d n |j||dk r|j||dk r|j||dk r|||tdS)Nz'args from save_reduce() must be a tuplez(func from save_reduce() must be callablerr __newobj_ex____new__z#args[0] from {} args has no __new__z(args[0] from {} args has the wrong classr __newobj__rz+args[0] from __newobj__ args has no __new__z0args[0] from __newobj__ args has the wrong classr)rrr callablerr{rrrrr NEWOBJ_EXrrREDUCENEWOBJrrPOPrr_batch_appends_batch_setitemsBUILD) rfuncargsstateZ listitemsZ dictitemsrrr{Z func_nameclskwargsrrrrsd           "      z_Pickler.save_reducecCs|jtdS)N)r{NONE)rrrrr save_nonesz_Pickler.save_nonecCs4|jdkr|j|rtntn|j|r*tntdS)Nr)rr{NEWTRUENEWFALSETRUEFALSE)rrrrr save_bools z_Pickler.save_boolcCs|jr~|dkrN|dkr.|jttd|dS|dkrN|jttd|dSd |ko`dknr~|jttd|dS|jd krt|}t|}|d kr|jt td||n|jt td||dS|jt t |j d d dS)Nrrzdrr)rr{BINFLOATr FLOATrr)rrrrr save_floatsz_Pickler.save_floatcCs|jdkr@|s |jtf|dn|jtjt|ddf|ddSt|}|dkrj|jtt d||nD|dkr|jdkr|jt t d||n|jt t d |||j |dS) Nr)rlatin1rzdSq>WdS)Nrr) rr{rAPPENDiterrr _BATCHSIZErtrAPPENDS)rrrr{reittmprzrrrrs*       z_Pickler._batch_appendscCs<|jr|jtn|jtt|j||j|jdS)N)rr{ EMPTY_DICTrDICTrrr)rrrrr save_dict.s   z_Pickler.save_dictc Cs|j}|j}|js@x(|D] \}}|||||tqWdSt|}xtt||j}t|}|dkr|t x |D]\}}||||qxW|t n(|r|d\}}|||||t||jkrJdSqJWdS)Nrr) rr{rSETITEMr"rrr#rtrSETITEMS) rrrr{kvr%r&rzrrrr;s2     z_Pickler._batch_setitemscCs|j}|j}|jdkr0|jtt|f|ddS|t|j|t|}xXtt ||j }t |}|dkr|t x|D] }||qzW|t ||j krLdSqLWdS)Nr)rr)rr{rrsetr EMPTY_SETrr"rr#rtrADDITEMS)rrrr{r%Zbatchrzitemrrrsave_setZs$     z_Pickler.save_setcCs|j}|j}|jdkr0|jtt|f|ddS|tx|D] }||q>Wt||jkr|t |j |jt|ddS|t |j |dS)Nr)rr) rr{rr frozensetrrrrrr FROZENSETr)rrrr{r1rrrsave_frozensetrs    z_Pickler.save_frozensetc CsT|j}|j}|dkr t|dd}|dkr.|j}t||}y(t|ddtj|}t||\}}Wn,t t t fk rt d|||fYnX||k rt d|||f|j dkrtj||f} | r| dkr|ttd| n0| d kr|ttd | n|ttd | dS|jd d} ||kr4| }|j d kr^|j||j||tn||k rz|jt|| fn|j dkr|tt|ddt|ddn|jrtj} tj} ||f| kr| ||f\}}n|| kr| |}y(|tt|ddt|ddWn*tk rDt d|||j fYnX|j|dS)Nrr)levelz(Can't pickle %r: it's not found as %s.%sz2Can't pickle %r: it's not the same object as %s.%srrzd?Z7e7ee8d<d@dAZ9e9ee:d<dBdCZ;e;eed<dFdGZ?e?ee@d<dHdIZAeAeeBd<dJdKZCeCeeDd<dLdMZEeEeeFd<dNdOZGeGeeHd<dPdQZIeIeeJd<dRdSZKeKeeLd<dTdUZMeMeeNd<dVdWZOeOeePd<dXdYZQeQeeRd<dZd[ZSd\d]ZTeTeeUd<d^d_ZVeVeeWd<d`daZXeXeeYd<dbdcZZeZee[d<dddeZ\e\ee]d<dfdgZ^e^ee_d<dhdiZ`e`eead<djdkZbebeecd<dldmZdedeeed<dndoZfdpdqZgdrdsZheheeid<dtduZjejeekd<dvdwZleleemd<dxdyZneneeod<dzd{Zpepeeqd<d|d}Zrereesd<d~dZteteeud<ddZveveewd<ddZxexeeyd<ddZzezee{d<ddZ|e|ee}d<ddZ~e~eed<ddZeeed<ddZeeed<ddZeeed<ddZeeed<ddZeeed<ddZeeed<ddZeeed<dS) _UnpicklerTASCIIstrict)rencodingerrorscCs2|j|_|j|_i|_||_||_d|_||_dS)Nr) r_file_readliner _file_readrrJrKrr)rrrrJrKrrrrsz_Unpickler.__init__cCst|dstd|jjft|j|j|_|jj|_|jj |_ g|_ g|_ |j j |_ d|_ |j}|j}y*x$|d}|s|t||d|qlWWn"tk r}z|jSd}~XnXdS)NrMz4Unpickler.__init__() was not called by %s.__init__()rr)rrrrr|rMrL _unframerrr metastackstackappendrrEOFErrorrr)rrrkeyZstopinstrrrrs(    z_Unpickler.loadcCs |j}|jj|_|jj|_|S)N)rPrOpoprQ)rrrrrpop_marks  z_Unpickler.pop_markcCs tddS)Nz%unsupported persistent id encountered)r)rrrrrpersistent_load%sz_Unpickler.persistent_loadcCs<|jdd}d|ko tkns2td|||_dS)Nrrzunsupported pickle protocol: %d)rrrr)rrrrr load_proto*s z_Unpickler.load_protorcCs8td|jd\}|tjkr(td||jj|dS)Nz sys.maxsize: %d)r rrr rrNr)rrrrrr1s  z_Unpickler.load_framec CsLy|jddjd}Wntk r6tdYnX|j|j|dS)Nrrz2persistent IDs in protocol 0 must be ASCII stringsr)rdecodeUnicodeDecodeErrorrrQrV)rrrrr load_persid8s  z_Unpickler.load_persidcCs|jj}|j|j|dS)N)rPrTrQrV)rrrrrload_binpersidAs z_Unpickler.load_binpersidcCs|jddS)N)rQ)rrrr load_noneFsz_Unpickler.load_nonecCs|jddS)NF)rQ)rrrr load_falseJsz_Unpickler.load_falsecCs|jddS)NT)rQ)rrrr load_trueNsz_Unpickler.load_truecCsL|j}|tddkrd}n |tddkr4d}n t|d}|j|dS)NrFTr)rrrrrQ)rryvalrrrload_intRs z_Unpickler.load_intcCs|jtd|jdddS)Nztd|jd\}|dkr"td|j|}|jt|dS)NzdrXr)rQr r)rrrr load_binfloatsz_Unpickler.load_binfloatcCs"|jdkr|S|j|j|jSdS)Nr)rJrYrK)rrrrr_decode_strings z_Unpickler._decode_stringcCsl|jdd}t|dkrF|d|dkrF|ddkrF|dd}ntd|j|jtj|ddS) Nrrrs"'z)the STRING opcode argument must be quotedrrr)rrtrrQrkr  escape_decode)rryrrr load_strings (z_Unpickler.load_stringcCs@td|jd\}|dkr"td|j|}|j|j|dS)Nzsz(_Unpickler.load_dict..rr)rUrangertrQ)rdr)rr load_dicts z_Unpickler.load_dictcCs|st|t st|drly ||}Wqvtk rh}z&td|jt|ftjdWYdd}~XqvXn |j|}|j |dS)NZ__getinitargs__zin constructor for %s: %sr) rrrrrrrexc_inforrQ)rklassrrerrrrr _instantiates  0 z_Unpickler._instantiatecCsL|jddjd}|jddjd}|j||}|j||jdS)Nrrrr)rrY find_classrrU)rrrrrrr load_insts z_Unpickler.load_instcCs"|j}|jd}|j||dS)Nr)rUrTr)rrrrrrload_obj!s z_Unpickler.load_objcCs2|jj}|jj}|j|f|}|j|dS)N)rPrTrrQ)rrrrrrr load_newobj(s  z_Unpickler.load_newobjcCs>|jj}|jj}|jj}|j|f||}|j|dS)N)rPrTrrQ)rrrrrrrrload_newobj_ex/s    z_Unpickler.load_newobj_excCsF|jddjd}|jddjd}|j||}|j|dS)Nrzutf-8rr)rrYrrQ)rrrrrrr load_global7s z_Unpickler.load_globalcCsJ|jj}|jj}t|tk s,t|tk r4td|j|j||dS)NzSTACK_GLOBAL requires str)rPrTrrrrQr)rrrrrrload_stack_global>s   z_Unpickler.load_stack_globalcCs|jdd}|j|dS)Nrr)r get_extension)rrArrr load_ext1Fsz_Unpickler.load_ext1cCs td|jd\}|j|dS)Nzrr:rr;rr<rrrrrrrrrDUPrrrrrrrrrrrrrrrr!rr$rr*rr+rr0rrrrrrrrrrrGs$                                                                   rGT)rcCst|||dj|dS)N)r)rr)rrrrrrr_dumpsrcCs(tj}t|||dj||j}|S)N)r)rkrlrrgetvalue)rrrrxresrrr_dumpssrrHrI)rrJrKcCst||||djS)N)rrJrK)rGr)rrrJrKrrr_load srcCs0t|trtdtj|}t||||djS)Nz%Can't load pickle from unicode string)rrJrK)rrrrkrlrGr)srrJrKrrrr_loadss   r) r r rrrrrrrcCsddl}|jS)Nr)doctestZtestmod)rrrr_test*srrz$display contents of the pickle files)Z description pickle_filebr*zthe pickle file)rnargshelpz-tz--test store_truezrun self-test suite)actionrz-vz)run verbosely; only affects self-test run)N)N)typesrcopyregrrrr itertoolsr functoolsrrr Zstructr r rbrkr r@__all__r bytearrayZ bytes_typesZformat_versionZcompatible_formatsrr Exceptionr r rrZorg.python.corer r8rrrrrrrrrrrrrrrrrrrrr!rr?r(r'r$rrrrrrrrrrr*rrr+rrrrrr:r;r<rrrrrrrrr r rrr r/r0r4rr>rrurdirrgr|rrrrrrGrrrr_picklerrrrrrrrargparseArgumentParserparser add_argumentZFileType parse_argsrZtestrZ print_helppprintrxrrrrrs,        $* -0       this.cpython-36.pyc000064400000002363152462730460010156 0ustar003 \@sddZiZx>d D]6Zx0edD]$Zeeddeeeee<qWqWedjddeDdS) aXGur Mra bs Clguba, ol Gvz Crgref Ornhgvshy vf orggre guna htyl. Rkcyvpvg vf orggre guna vzcyvpvg. Fvzcyr vf orggre guna pbzcyrk. Pbzcyrk vf orggre guna pbzcyvpngrq. Syng vf orggre guna arfgrq. Fcnefr vf orggre guna qrafr. Ernqnovyvgl pbhagf. Fcrpvny pnfrf nera'g fcrpvny rabhtu gb oernx gur ehyrf. Nygubhtu cenpgvpnyvgl orngf chevgl. Reebef fubhyq arire cnff fvyragyl. Hayrff rkcyvpvgyl fvyraprq. Va gur snpr bs nzovthvgl, ershfr gur grzcgngvba gb thrff. Gurer fubhyq or bar-- naq cersrenoyl bayl bar --boivbhf jnl gb qb vg. Nygubhtu gung jnl znl abg or boivbhf ng svefg hayrff lbh'er Qhgpu. Abj vf orggre guna arire. Nygubhtu arire vf bsgra orggre guna *evtug* abj. Vs gur vzcyrzragngvba vf uneq gb rkcynva, vg'f n onq vqrn. Vs gur vzcyrzragngvba vf rnfl gb rkcynva, vg znl or n tbbq vqrn. Anzrfcnprf ner bar ubaxvat terng vqrn -- yrg'f qb zber bs gubfr!Aa cCsg|]}tj||qS)dget).0crr/usr/lib64/python3.6/this.py sr N)rr)srr rangeichrprintjoinrrrr s  (secrets.cpython-36.opt-1.pyc000064400000004164152462730460011617 0ustar003 \@sdZddddddddgZd d lZd d lZd d lZd d lmZd d lmZeZ e j Z e j Z d dZ dZdddZdddZdddZd S)zGenerate cryptographically strong pseudo-random numbers suitable for managing secrets such as account authentication, tokens, and similar. See PEP 506 for more information. https://www.python.org/dev/peps/pep-0506/ choice randbelowrandbits SystemRandom token_bytes token_hex token_urlsafecompare_digestN)r)rcCs|dkrtdtj|S)z(Return a random int in the range [0, n).r zUpper bound must be positive.) ValueError_sysrandZ _randbelow)Zexclusive_upper_boundr /usr/lib64/python3.6/secrets.pyrs cCs|dkr t}tj|S)zReturn a random byte string containing *nbytes* bytes. If *nbytes* is ``None`` or not supplied, a reasonable default is used. >>> token_bytes(16) #doctest:+SKIP b'\xebr\x17D*t\xae\xd4\xe3S\xb6\xe2\xebP1\x8b' N)DEFAULT_ENTROPYosurandom)nbytesr r r r#s cCstjt|jdS)a"Return a random text string, in hexadecimal. The string has *nbytes* random bytes, each byte converted to two hex digits. If *nbytes* is ``None`` or not supplied, a reasonable default is used. >>> token_hex(16) #doctest:+SKIP 'f9bf78b9a18ce6d46a0cd2b0b86df9da' ascii)binasciiZhexlifyrdecode)rr r r r1s cCst|}tj|jdjdS)zReturn a random URL-safe text string, in Base64 encoding. The string has *nbytes* random bytes. If *nbytes* is ``None`` or not supplied, a reasonable default is used. >>> token_urlsafe(16) #doctest:+SKIP 'Drmhze6EPcv0fN_81Bj-nA' =r)rbase64Zurlsafe_b64encoderstripr)rtokr r r r>s )N)N)N)__doc____all__rrrZhmacrZrandomrr Z getrandbitsrrrrrrrr r r r s     _pyio.cpython-36.pyc000064400000213334152462730460010330 0ustar003 \!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^inspect.cpython-36.opt-2.pyc000064400000151412152462730460011614 0ustar003 \ @sdZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZddlZddlmZddlmZmZeZx"ejjD]\ZZeede<qWdZd d Zd d Z d dZ!ddZ"ddZ#e$edrddZ%nddZ%e$edr2ddZ&nddZ&ddZ'ddZ(dd Z)d!d"Z*d#d$Z+d%d&Z,d'd(Z-d)d*Z.d+d,Z/d-d.Z0d/d0Z1d1d2Z2d3d4Z3d5d6Z4dd7d8Z5ed9d:Z6d;d<Z7d=d>Z8dd?d@dAZ9dBdCZ:dDdEZ;dFdGZdLdMZ?dNdOZ@dPdQZAddRdSZBiZCiZDddTdUZEdVdWZFdXdYZGGdZd[d[eHZIGd\d]d]ZJd^d_ZKd`daZLdbdcZMdddeZNddgdhZOedidjZPdkdlZQdmdnZRedodpZSdqdrZTedsdtZUdudvZVedwdxZWdydzZXdd{d|ZYd}d~ZZdddfiie[ddddddddeYf ddZ\e[ddddddfddZ]ddZ^ddZ_ddZ`eddZaddZbeddZcdddZdddZeeddecjfZgdddZhdddZiddZjdddZkdddZlemZnddZoddZpddZqddZrddZsenfddZtdZudZvdZwdZxddZyddZzdZ{dZ|dZ}dZ~ddZdd„ZeejZeejZeejdZeeeejfZddńZffddDŽZddɄZdd˄Zdd̈́ZddτZddфZdddԄZdddքZdd؄ZdddٜddۄZGdd݄d݃ZGdd߄d߃ZGdddejZejZejZejZejZejZededededediZejZGdddZGdddZGdddZddddZddZedkredS(Ka-Ping Yee 'Yury Selivanov N) attrgetter) namedtuple OrderedDictZCO_cCs t|tjS)N) isinstancetypes ModuleType)objectr /usr/lib64/python3.6/inspect.pyismodule@srcCs t|tS)N)r type)r r r risclassIsrcCs t|tjS)N)r r MethodType)r r r rismethodQsrcCs:t|st|st|rdSt|}t|do8t|d S)NF__get____set__)rr isfunctionrhasattr)r tpr r rismethoddescriptor[srcCs8t|st|st|rdSt|}t|do6t|dS)NFrr)rrrrr)r rr r risdatadescriptorosrMemberDescriptorTypecCs t|tjS)N)r r r)r r r rismemberdescriptorsrcCsdS)NFr )r r r rrsGetSetDescriptorTypecCs t|tjS)N)r r r)r r r risgetsetdescriptorsrcCsdS)NFr )r r r rrscCs t|tjS)N)r r FunctionType)r r r rrs rcCs tt|st|o|jjt@S)N)boolrr__code__co_flagsZ CO_GENERATOR)r r r risgeneratorfunctionsr#cCs tt|st|o|jjt@S)N)r rrr!r"Z CO_COROUTINE)r r r riscoroutinefunctionsr$cCs tt|st|o|jjt@S)N)r rrr!r"ZCO_ASYNC_GENERATOR)r r r risasyncgenfunctionsr%cCs t|tjS)N)r r AsyncGeneratorType)r r r r isasyncgensr'cCs t|tjS)N)r r GeneratorType)r r r r isgeneratorsr)cCs t|tjS)N)r r CoroutineType)r r r r iscoroutinesr+cCs6t|tjp4t|tjr(t|jjt@p4t|tj j S)N) r r r*r(r gi_coder"ZCO_ITERABLE_COROUTINE collectionsabc Awaitable)r r r r isawaitables  r0cCs t|tjS)N)r r TracebackType)r r r r istracebacksr2cCs t|tjS)N)r r FrameType)r r r risframes r4cCs t|tjS)N)r r CodeType)r r r riscodesr6cCs t|tjS)N)r r BuiltinFunctionType)r r r r isbuiltinsr8cCs t|pt|pt|pt|S)N)r8rrr)r r r r isroutinesr9cCst|tsdS|jt@rdStt|tjs0dSt|dr>dSx&|jj D]\}}t |ddrJdSqJWx@|j D]6}x0t |dfD] }t ||d}t |ddrdSqWqnWdS)NFT__abstractmethods____isabstractmethod__) r r __flags__TPFLAGS_IS_ABSTRACT issubclassr.ABCMetar__dict__itemsgetattr __bases__)r namevaluebaser r r isabstract%s"        rGc Cs&t|r|ft|}nf}g}t}t|}yBx<|jD]2}x,|jjD]\}}t|tj rH|j |qHWq8WWnt k rYnXx|D]} yt || } | |krt Wn:t k rx$|D]}| |jkr|j| } PqWwYnX| s|| r|j | | f|j | qW|jddd|S)NcSs|dS)Nrr )Zpairr r rfszgetmembers..)key)rgetmrosetdirrCr@rAr r DynamicClassAttributeappendAttributeErrorrBaddsort) r Z predicatemroresults processednamesrFkvrIrEr r r getmembers=s:       rX Attributezname kind defining_class objectcCs\t|}tt|}tdd|D}|f|}||}t|}x:|D]2}x,|jjD]\}}t|tjrV|j |qVWqFWg} t } x|D]} d} d} d}| | kry| dkrt dt || } Wn"t k r}zWYdd}~XnXt | d| } | |krd} d}x(|D] }t || d}|| kr|}qWxH|D]@}y|j || }Wntk rhw:YnX|| kr:|}q:W|dk r|} x4|D],}| |jkr|j| }| |kr|} PqW| dkrq| dk r| n|}t|trd}|}n@t|tr d}|}n*t|tr"d}|}nt|r2d }nd }| j t| || || j| qW| S) NcSsg|]}|ttfkr|qSr )rr ).0clsr r r sz(classify_class_attrs..r@z)__dict__ is special, don't want the proxy __objclass__z static methodz class methodpropertymethoddata)rJrtuplerLr@rAr r rMrNrK ExceptionrB __getattr__rO staticmethod classmethodr^r9rYrP)r[rRZmetamroZ class_basesZ all_basesrUrFrVrWresultrTrDZhomeclsZget_objZdict_objexcZlast_clsZsrch_clsZsrch_objobjkindr r rclassify_class_attrsks                          rjcCs|jS)N)__mro__)r[r r rrJsrJ)stopcsdkrdd}n fdd}|}t||i}tj}xD||rz|j}t|}||ksbt||krptdj||||<q8W|S)NcSs t|dS)N __wrapped__)r)fr r r _is_wrapperszunwrap.._is_wrappercst|do| S)Nrm)r)rn)rlr rrosz!wrapper loop when unwrapping {!r})idsysgetrecursionlimitrmlen ValueErrorformat)funcrlrornmemoZrecursion_limitZid_funcr )rlrunwraps     rxcCs|j}t|t|jS)N) expandtabsrslstrip)lineZexpliner r r indentsize sr|cCsRtjj|j}|dkrdSx&|jjdddD]}t||}q0Wt|sNdS|S)N.r)rqmodulesget __module__ __qualname__splitrBr)rvr[rDr r r _findclasssrc Cst|rRxD|jD]:}|tk ry |j}Wntk r<wYnX|dk r|SqWdSt|r|jj}|j}t|rt t ||dd|jkr|}n|j }nt |r|j}t |}|dkst |||k rdSnt |r |j}|j}t|o|jd||jkr|}n|j }nzt|trJ|j}|j}t |}|dksDt |||k rdSn:t|s^t|r|j}|j}t |||k rdSndSxJ|jD]@}yt ||j}Wntk rwYnX|dk r|SqWdS)N__func__r})rrkr __doc__rOrr__name____self__rB __class__rrr8rr r^fgetrrr])rhrFdocrDselfr[rvr r r_finddocsb        rcCsdy |j}Wntk rdSX|dkrNy t|}Wnttfk rLdSXt|ts\dSt|S)N)rrOr TypeErrorr strcleandoc)r rr r rgetdocSs   rc Csy|jjd}Wntk r&dSXtj}x:|ddD]*}t|j}|r.)ospathbasename importlib machinery all_suffixesrQendswith)rZfnamesuffixesZneglenrr r r getmodulenames  rcst|tjjdd}|tjjdd7}tfdd|Dr`tjjdtjj dntfddtjj Dr~dStjj rSt t |dddk rStjkrSdS)Nc3s|]}j|VqdS)N)r)rZs)filenamer r sz getsourcefile..rc3s|]}j|VqdS)N)r)rZr)rr rrs __loader__)rrrDEBUG_BYTECODE_SUFFIXESOPTIMIZED_BYTECODE_SUFFIXESanyrrsplitextSOURCE_SUFFIXESEXTENSION_SUFFIXESexistsrB getmodule linecachecache)r Zall_bytecode_suffixesr )rr getsourcefiles   rcCs,|dkrt|pt|}tjjtjj|S)N)rrrrnormcaseabspath)r _filenamer r r getabsfilesrc Cst|r |St|dr$tjj|jS|dk rD|tkrDtjjt|Syt||}Wntk rfdSX|tkrtjjt|Sxnt tjj D]\\}}t|rt|dr|j }|t j|dkrq|t |<t|}|j t|<ttjj|<qW|tkr tjjt|Stjd}t|ds$dSt||j rLt||j }||krL|Stjd}t||j r~t||j } | |kr~|SdS)Nrr__main__rbuiltins)rrrqrrr modulesbyfilerrlistrAr_filesbymodnamerrrrealpathrB) r rfilemodnamemodulernmainZ mainobjectZbuiltinZ builtinobjectr r rrsD         rc Cst|}|rtj|n$t|}|jdo2|jdszsource code not availablezcould not get source coderz^(\s*)class\s*z\bcrzcould not find class definitionco_firstlinenoz"could not find function definitionz>^(\s*def\s)|(\s*async\s+def\s)|(.*(?yt|\}}Wnttfk r(dSXt|rd}|rR|ddddkrRd}x(|t|krz||jdkrz|d}qTW|t|kr||dddkrg}|}x>|t|kr||dddkr|j||j|d}qWdj|SnH|dkr:t ||}|d}|dkr:||j dddkr:t |||kr:||jj g}|dkr|d}||jj }x\|dddkrt |||kr|g|dd<|d}|dkrP||jj }q|Wx*|r|djdkrg|dd<qWx*|r.|djdkr.g|d d<qWdj|SdS) Nrz#!r#)rrr~r~) rrrrrsstriprNryrr|rz)r rrstartZcommentsendrZcommentr r r getcommentsAsJ  "   $ & rc@s eZdZdS) EndOfBlockN)rrrr r r rrnsrc@seZdZddZddZdS) BlockFindercCs.d|_d|_d|_d|_d|_d|_d|_dS)NrFr)rislambdastartedpassline indecoratordecoratorhasargslast)rr r r__init__rszBlockFinder.__init__cCs&|j rD|j rD|dkr d|_n|d kr<|dkr6d|_d|_d|_n|dkrZ|jrXd|_n|dkrv|jrtd|_d|_n|tjkrd|_|d |_|jrt|jr|j rd|_nr|jrnj|tj kr|j d |_ d|_nL|tj kr|j d |_ |j d kr"tn"|j d kr"|tj tj fkr"tdS) N@Tdefclasslambda()Frr)rrr)rrrrrtokenizeNEWLINErrINDENTrDEDENTCOMMENTNL)rrtokenZsrowcolZerowcolr{r r r tokeneater{sB       zBlockFinder.tokeneaterN)rrrrrr r r rrps rc CsZt}y,tjt|j}x|D]}|j|qWWnttfk rJYnX|d|jS)N) rrgenerate_tokensiter__next__rrIndentationErrorr)rZ blockfindertokensZ_tokenr r rgetblocks rcCsbt|}t|\}}t|r"|j}t|s>t|rF|jjdkrF|dfSt||d|dfSdS)Nzrr) rxrr2rrr4rco_namer)r rrr r rgetsourceliness rcCst|\}}dj|S)Nr)rr)r rrr r r getsources rcCsVg}|jtdddx:|D]2}|j||jf||kr|jt||||qW|S)Nrr)rI)rQrrNrCwalktree)classeschildrenparentrSrr r rrs rFcCsi}g}xn|D]f}|jrbxZ|jD]<}||kr4g||<|||krN||j||r ||kr Pq Wq||kr|j|qWx|D]}||kr~|j|q~Wt||dS)N)rCrNr)runiquerrootsrrr r r getclasstrees"      r Argumentszargs, varargs, varkwcCs t|\}}}}t||||S)N) _getfullargsr)coargsvarargs kwonlyargsvarkwr r rgetargssr c Cst|stdj||j}|j}|j}t|d|}t||||}d}||7}d}|jt@rx|j|}|d}d}|jt @r|j|}||||fS)Nz{!r} is not a code objectrr) r6rru co_argcount co_varnamesco_kwonlyargcountrr" CO_VARARGSCO_VARKEYWORDS) rnargsrUZnkwargsrr steprr r r rrs"    rArgSpeczargs varargs keywords defaultscCsDtjdtddt|\}}}}}}}|s.|r6tdt||||S)Nzhinspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()r) stacklevelzdFunction has keyword-only parameters or annotations, use getfullargspec() API which can support them)warningswarnDeprecationWarninggetfullargspecrtr)rvrrr defaultsr kwonlydefaultsannr r r getargspec s  r FullArgSpeczGargs, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotationsc Cs`yt|ddtd}Wn,tk r@}ztd|WYdd}~XnXg}d}d}g}f}i}f}i} |j|jk rx|j|d<x|jjD]} | j} | j } | t kr|j | nv| t kr|j | | j | jk r|| j f7}nJ| tkr| }n<| tkr|j | | j | jk r| j | | <n| tkr| }| j| jk r| j|| <qW| sBd} |sLd}t|||||| |S)NF)follow_wrapper_chainsskip_bound_argsigclszunsupported callablereturn)_signature_from_callable Signaturerbrreturn_annotationempty parametersvaluesrirD_POSITIONAL_ONLYrN_POSITIONAL_OR_KEYWORDdefault_VAR_POSITIONAL _KEYWORD_ONLY _VAR_KEYWORD annotationr) rvsigexrrr r r annotations kwdefaultsparamrirDr r rrAsT            rArgInfozargs varargs keywords localscCs t|j\}}}t||||jS)N)r rr4f_locals)framerrr r r r getargvaluessr7cCsVt|dddkr t|jddSt|trN|jd|fkr>|jS|jd|jSt|S)NrZtypingztyping.rrr})rBreprreplacer rrr)r.Z base_moduler r rformatannotations r:cst|ddfdd}|S)Nrcs t|S)N)r:)r.)rr r_formatannotationsz5formatannotationrelativeto.._formatannotation)rB)r r;r )rrformatannotationrelativetos  r<cCsd|S)N*r )rDr r rrHsrHcCsd|S)Nz**r )rDr r rrHscCs dt|S)N=)r8)rEr r rrHscCsd|S)Nz -> r )textr r rrHsc s(fdd} g}|r(t|t|}xFt|D]:\}}| |}|rb||krb|| |||}|j|q2W|dk r|j|| |n|r|jd|rx:|D]2}| |}|r||kr|| ||7}|j|qW|dk r|j| | |ddj|d}dkr$|| d7}|S)Ncs(|}|kr$|d|7}|S)Nz: r )argrf)r1r: formatargr rformatargandannotationsz-formatargspec..formatargandannotationr=rz, rr!)rs enumeraterNr)rrr rr rr1rA formatvarargs formatvarkw formatvalueZ formatreturnsr:rBspecsZ firstdefaultrr@specZ kwonlyargrfr )r1r:rAr formatargspecs2     rIcCsd|S)Nr=r )rDr r rrHscCsd|S)Nz**r )rDr r rrHscCs dt|S)Nr>)r8)rEr r rrHsc Cs|||fdd}g} x&tt|D]} | j||| q"W|rZ| j||||||rx| j|||||ddj| dS)NcSs|||||S)Nr )rDlocalsrArFr r rconvertsz formatargvalues..convertrz, r)rrsrNr) rrr rJrArDrErFrKrGrr r rformatargvaluess rLcsfdd|D}t|}|dkr,|d}n>|dkr@dj|}n*dj|dd}|dd=dj||}td |||rzd nd |dkrd nd |fdS)Ncsg|]}|krt|qSr )r8)rZrD)r'r rr\sz&_missing_arguments..rrrz {} and {}z , {} and {}z, z*%s() missing %i required %s argument%s: %s positionalz keyword-onlyrrrN)rsrurr)f_nameZargnamesposr'rUmissingrtailr )r'r_missing_argumentss    rSc st||}tfdd|D}|r:|dk} d|f} n2|rTd} d|t|f} nt|dk} tt|} d} |rd} | |dkrd nd||dkrd ndf} td || | rd nd|| |dkr| rd nd fdS) Ncsg|]}|kr|qSr r )rZr@)r'r rr\sz_too_many..rz at least %dTz from %d to %drz7 positional argument%s (and %d keyword-only argument%s)rz5%s() takes %s positional argument%s but %d%s %s givenZwasZwere)rsrr) rOrZkwonlyrZdefcountZgivenr'ZatleastZ kwonly_givenZpluralr/Z kwonly_sigmsgr )r'r _too_many s$    rUcOs6|d}|dd}t|}|\}}}}} } } |j} i} t|rV|jdk rV|jf|}t|}t|}|rrt|nd}t||}x t|D]}||| ||<qW|rt||d| |<t|| }|ri| |<xd|j D]X\}}||kr|st d| |f|| ||<q|| kr,t d| |f|| |<qW||kr^| r^t | || |||| ||kr|d||}x&|D]}|| kr~t | |d| q~Wx8t |||dD] \}}|| kr||| |<qWd}x>| D]6}|| kr| r|| kr| || |<n|d7}qW|r2t | | d| | S)Nrrz*%s() got an unexpected keyword argument %rz(%s() got multiple values for argument %rTF)rrrrrsrrrarKrArrUrSrC)Zfunc_and_positionalZnamedrvrMrHrrr rr rrrOZ arg2valueZnum_posZnum_argsZ num_defaultsnrZpossible_kwargskwrEZreqr@rQkwargr r r getcallargs!sd                 rY ClosureVarsz"nonlocals globals builtins unboundc Cst|r|j}t|s$tdj||j}|jdkr:i}nddt|j|jD}|j }|j dt j }t |rt|j }i}i}t}xn|jD]d}|dkrqy||||<Wqtk ry||||<Wntk r|j|YnXYqXqWt||||S) Nz'{!r}' is not a Python functioncSsi|]\}}|j|qSr ) cell_contents)rZvarZcellr r r vsz"getclosurevars.. __builtins__NoneTrueFalse)r_r`ra)rrrrrur! __closure__zip co_freevars __globals__rrr@rrKco_namesKeyErrorrPrZ) rvcodeZ nonlocal_varsZ global_nsZ builtin_nsZ global_varsZ builtin_varsZ unbound_namesrDr r rgetclosurevarsas8   ri Tracebackz+filename lineno function code_context indexcCst|r|j}|j}n|j}t|s2tdj|t|p@t|}|dkr|d|d}yt |\}}Wnt k rd}}YqXt dt |t ||}||||}|d|}nd}}t|||jj||S)Nz'{!r} is not a frame or traceback objectrrr)r2 tb_linenorf_linenor4rrurrrrmaxrrsrjrr)r6contextlinenorrrrindexr r r getframeinfos$rqcCs|jS)N)rl)r6r r r getlinenosrr FrameInfor6cCs6g}x,|r0|ft||}|jt||j}qW|S)N)rqrNrsf_back)r6rn framelist frameinfor r rgetouterframess  rwcCs8g}x.|r2|jft||}|jt||j}qW|S)N)rrqrNrstb_next)tbrnrurvr r rgetinnerframess  rzcCsttdrtjdSdS)N _getframer)rrqr{r r r r currentframesr|cCsttjd|S)Nr)rwrqr{)rnr r rstacksr}cCsttjd|S)Nr)rzrqexc_info)rnr r rtracesrcCstjdj|S)Nrk)rr@r)klassr r r_static_getmrosrc Cs8i}ytj|d}Wntk r(YnXtj||tS)Nr@)r __getattribute__rOdictr _sentinel)rhattrZ instance_dictr r r_check_instances rc CsFx@t|D]4}tt|tkr y |j|Stk r<Yq Xq WtS)N)r_shadowed_dictrrr@rg)rrentryr r r _check_classs  rc Cs&y t|Wntk r dSXdS)NFT)rr)rhr r r_is_types  rc Csntjd}x^t|D]R}y|j|d}Wntk r>YqXt|tjko`|jdko`|j|ks|SqWt S)Nr@) rr@rrrgr rrr]r)r dict_attrrZ class_dictr r rrs   rc Cst}t|s>t|}t|}|tks2t|tjkrBt||}n|}t||}|tk r|tk rtt|dtk rtt|dtk r|S|tk r|S|tk r|S||krxDtt|D]4}tt|tkry |j |St k rYqXqW|tk r|St |dS)Nrr) rrrrr rrrrr@rgrO)rhrr*Zinstance_resultrrZ klass_resultrr r rgetattr_statics6     r GEN_CREATED GEN_RUNNING GEN_SUSPENDED GEN_CLOSEDcCs,|jr tS|jdkrtS|jjdkr(tStS)Nrr~) gi_runningrgi_framerf_lastirr) generatorr r rgetgeneratorstateGs   rcCs:t|stdj|t|dd}|dk r2|jjSiSdS)Nz '{!r}' is not a Python generatorr)r)rrurBrr5)rr6r r rgetgeneratorlocalsYs  r CORO_CREATED CORO_RUNNINGCORO_SUSPENDED CORO_CLOSEDcCs,|jr tS|jdkrtS|jjdkr(tStS)Nrr~) cr_runningrcr_framerrrr) coroutiner r rgetcoroutinestateqs   rcCs"t|dd}|dk r|jSiSdS)Nr)rBr5)rr6r r rgetcoroutinelocalss r from_bytesc Cs6yt||}Wntk r"dSXt|ts2|SdS)N)rBrOr _NonUserDefinedCallables)r[Z method_namemethr r r"_signature_get_user_defined_methods  rcCs|j}t|j}|jpf}|jp$i}|r2||}y|j||}Wn6tk rx}zdj|} t| |WYdd}~XnXd} x |jD]\} } y|j | } Wnt k rYnlX| j t kr|j | q| j tkr| |krd} | j| d|| <n|j | jq| j tkr"| j| d|| <| r| j tkrV|| jtd}||| <|j| q| j ttfkrr|j| q| j tkr|j | jqW|j|jdS)Nz+partial object {!r} has incorrect argumentsFT)r*)ri)r&)r&rrArkeywords bind_partialrrurt argumentsrgrir(rr)r9rDr, move_to_endr-r+r') wrapped_sigpartialZ extra_argsZ old_params new_paramsZ partial_argsZpartial_keywordsZbar0rTZtransform_to_kwonly param_namer3Z arg_valueZ new_paramr r r_signature_get_partialsL              rcCsnt|jj}| s&|djttfkr.td|dj}|ttfkrR|dd}n|t k rbtd|j |dS)Nrzinvalid method signaturerzinvalid argument type)r&) rar&r'rir-r,rtr)r(r+r9)r/paramsrir r r_signature_bound_methods  rcCs&t|p$t|p$t|tp$|ttfkS)N)r8rr rrr )rhr r r_signature_is_builtins rcCst| st|rdSt|dd}t|dd}t|dt}t|dt}t|dd}t|tjot|to|dkszt|to|dkst|t ot|t S)NFrr! __defaults____kwdefaults____annotations__) callablerrB_voidr r r5rrar)rhrDrhrr2r1r r r_signature_is_functionlike!s       rcCs<|jd}|dkr|jd}|jd}|jd}|d|S)N,rr:r>rr~)find)rHrPZcposr r r_signature_get_bound_param:s    rcCs$|s|ddfSd}d}dd|jdD}t|j}tj|}d}d}g}|j} d} tj} tj} t|} x|D]} | j | j }}|| kr|dkr|rd}qnd}| d7} qn|d krd}| d}qn|| kr|d kr| }qn|rd}|| ko|d ks| d | ||dkrn| d qnWdj |}|||fS)NcSsg|]}|jdqS)ascii)encode)rZlr r rr\dsz6_signature_strip_non_python_syntax..rFrrTr/$rz,  r) rrrrrNrOP ERRORTOKENnextrstringr) signatureself_parameterlast_positional_onlyrrZ token_streamZ delayed_commaZskip_next_commar?rPZcurrent_parameterrrtrrclean_signaturer r r"_signature_strip_non_python_syntaxQsP       rTcsV|jt|\}}}d|d}ytj|}Wntk rFd}YnXt|tjsbtdj||j d} gj t d}it |dd} | rt jj| d}|r|jt jjddfdd  G fd d d tjffd d } t| jj} t| jj} tj| | dd}|dk r8jnjx.parse_namecsyt|}Wn>tk rLyt|}Wntk rFtYnXYnXt|trbtj|St|ttfrztj |St|t rtj |S|dkrtj |StdS)NTF)TFN) eval NameError RuntimeErrorr rastZStrintfloatZNumbytesZBytesZ NameConstant)rrE) module_dictsys_module_dictr r wrap_values       z&_signature_fromstr..wrap_valuecs$eZdZfddZfddZdS)z,_signature_fromstr..RewriteSymbolicscs`g}|}x"t|tjr*|j|j|j}q Wt|tjs>t|j|jdj t |}|S)Nr}) r rrYrNrrENamerrprreversed)rrarVrE)rr rvisit_Attributes    z<_signature_fromstr..RewriteSymbolics.visit_Attributecst|jtjst|jS)N)r ZctxrZLoadrtrp)rr)rr r visit_Namesz7_signature_fromstr..RewriteSymbolics.visit_NameN)rrrrrr )rr rRewriteSymbolicss rcs|}|krdS|rp|tk rpyj|}tj|}Wntk rR}YnX|kr`dS|k rl|n|}j||ddS)N)r*r.)_emptyZvisitrZ literal_evalrtrN)Z name_nodeZ default_noder*rDo) Parameterrr%invalidrir&rr rps   z_signature_fromstr..p) fillvaluer)ri)r$)'_parameter_clsrrparse SyntaxErrorr ZModulertruZbodyr%r rBrqrrr@copyZNodeTransformerrrr itertools zip_longestPOSITIONAL_ONLYPOSITIONAL_OR_KEYWORDrCrZvarargVAR_POSITIONAL KEYWORD_ONLYrcr Z kw_defaultsrX VAR_KEYWORDrrr9)r[rhrrrrrZprogramrrnZ module_namerrrrrrDr*_selfZ self_isboundZ self_ismoduler ) rrr%rrirr&rrrr_signature_fromstrsj                 rcCsBt|stdj|t|dd}|s4tdj|t||||S)Nz%{!r} is not a Python builtin function__text_signature__z#no signature found for builtin {!r})rrrurBrtr)r[rvrrr r r_signature_from_builtin&s rcCsd}t|s(t|rd}ntdj||j}|j}|j}|j}t|d|}|j }||||} |j } |j } |j } | rt | } nd} g}|| }x4|d|D]$}| j|t}|j|||tdqWxBt||dD].\}}| j|t}|j|||t| |dqW|jt@rH|||}| j|t}|j|||tdxJ| D]B}t}| dk rl| j|t}| j|t}|j|||t|dqNW|jt@r||}|jt@r|d7}||}| j|t}|j|||td||| jdt|d S) NFTz{!r} is not a Python functionr)r.ri)r.rir*rr!)r$__validate_parameters__)rrrrurr!r r rarrrrrsrrrNr)rCr"rr+r,rr-)r[rvZis_duck_functionrZ func_codeZ pos_countZ arg_namesrMZkeyword_only_countZ keyword_onlyr1rr2Zpos_default_countr&Znon_default_countrDr.offsetr*rpr r r_signature_from_function6sj                     r)rrc!Cst|stdj|t|tjrDt|j|||d}|r@t|S|S|rtt |ddd}t|tjrtt||||dSy |j }Wnt k rYn&X|dk rt|t stdj||Sy |j }Wnt k rYnvXt|tjrLt|j|||d}t||d}t|jjd}|jtjkr(|St|jj}|f|} |j| dSt|s`t|rjt||St|rt|||d St|tjrt|j|||d}t||Sd}t|trt t|d } | dk rt| |||d}nJt |d } | dk r t| |||d}n$t |d } | dk r0t| |||d}|dkr:xL|j!ddD]:} y | j"}Wnt k rnYnX|rJt#|||SqJWt|j!kr:|j$t%j$kr|j&t%j&krt't%St(dj|nrt|t)s:t t|d } | dk r:yt| |||d}Wn8t(k r8}zdj|}t(||WYdd}~XnX|dk rV|rRt|S|St|tj*rvdj|}t(|t(dj|dS)Nz{!r} is not a callable object)rrr cSs t|dS)N __signature__)r)rnr r rrHsz*_signature_from_callable..)rlz1unexpected object {!r} in __signature__ attributer)r&)r__call____new__rrz(no signature found for builtin type {!r}zno signature found for {!r}z,no signature found for builtin function {!r}z+callable {!r} is not supported by signature)Nr~)+rrrur r rr"rrrxrrOr#_partialmethod functools partialmethodrvrrar&r'rirrr9rrrrrrrrrkrrrr rrrtrr7)rhrrr r/rrZfirst_wrapped_paramZ sig_paramsrZcallnewZinitrFZtext_sigr0rTr r rr"s                             r"c@s eZdZdS)rN)rrrr r r rrP src@s eZdZdS)rN)rrrr r r rrT src@s(eZdZdZdZdZdZdZddZdS) _ParameterKindrrrcCs|jS)N)_name_)rr r r__str___ sz_ParameterKind.__str__N) rrrrrrrrrr r r rrX s rzpositional-onlyzpositional or keywordzvariadic positionalz keyword-onlyzvariadic keywordc@seZdZd ZeZeZeZ e Z e Z eZeedddZdd Zd d Zed d ZeddZeddZeddZeeeedddZddZddZddZddZdS)!r_name_kind_default _annotation)r*r.c Cs"yt||_Wn$tk r2td|dYnX|tk rf|jttfkrfd}|jt|j}t|||_||_ |tkrtdt |t sdjt |j }t||ddko|ddjr|jtkrd }|jt|j}t|t|_d j|dd}|jstd j|||_dS) Nzvalue z is not a valid Parameter.kindz({} parameters cannot have default valuesz*name is a required attribute for Parameterzname must be a str, not a {}rr}rzLimplicit arguments must be passed as positional or keyword arguments, not {}z implicit{}z"{!r} is not a valid parameter name)rrrtrr+r-ru_get_paramkind_descrrrr rrrrisdigitr)r( isidentifierr)rrDrir*r.rTr r rr s4   zParameter.__init__cCs t||j|jf|j|jdfS)N)rr)rrrrr)rr r r __reduce__ s zParameter.__reduce__cCs|d|_|d|_dS)Nrr)rr)rstater r r __setstate__ s zParameter.__setstate__cCs|jS)N)r)rr r rrD szParameter.namecCs|jS)N)r)rr r rr* szParameter.defaultcCs|jS)N)r)rr r rr. szParameter.annotationcCs|jS)N)r)rr r rri szParameter.kind)rDrir.r*cCsL|tkr|j}|tkr|j}|tkr*|j}|tkr8|j}t|||||dS)N)r*r.)rrrrrr)rrDrir.r*r r rr9 szParameter.replacecCsj|j}|j}|jtk r(dj|t|j}|jtk rDdj|t|j}|tkrVd|}n|t krfd|}|S)Nz{}:{}z{}={}r=z**) rirrrrur:rr8r+r-)rri formattedr r rr s    zParameter.__str__cCsdj|jj|S)Nz <{} "{}">)rurr)rr r r__repr__ szParameter.__repr__cCst|j|j|j|jfS)N)hashrDrir.r*)rr r r__hash__ szParameter.__hash__cCsJ||kr dSt|tstS|j|jkoH|j|jkoH|j|jkoH|j|jkS)NT)r rNotImplementedrrrr)rotherr r r__eq__ s    zParameter.__eq__N)rrrr)rrr __slots__r(rr)rr+rr,rr-rrr%rrr r^rDr*r.rirr9rr r rr r r rrt s((    rc@sdeZdZdZddZeddZedd Zed d Zd d Z ddZ ddZ ddZ ddZ dS)BoundArgumentsr _signature __weakref__cCs||_||_dS)N)rr)rrrr r rr szBoundArguments.__init__cCs|jS)N)r)rr r rr# szBoundArguments.signaturec Cs|g}xn|jjjD]^\}}|jttfkr*Py|j|}Wntk rNPYqX|jtkrf|j |q|j |qWt |S)N) rr&rArir-r,rrgr+extendrNra)rrrr3r@r r rr' s  zBoundArguments.argsc Csi}d}x|jjjD]x\}}|sF|jttfkr6d}n||jkrFd}q|sLqy|j|}Wntk rnYqX|jtkr|j|q|||<qW|S)NFT) rr&rArir-r,rrgupdate)rkwargsZkwargs_startedrr3r@r r rr> s&    zBoundArguments.kwargsc Cs|j}g}x|jjjD]v\}}y|j|||fWqtk r|jtk rX|j}n"|jt krhf}n|jt krxi}nw|j||fYqXqWt ||_dS)N) rrr&rArNrgr*rrir+r-r)rrZ new_argumentsrDr3valr r rapply_defaults\ s    zBoundArguments.apply_defaultscCs2||kr dSt|tstS|j|jko0|j|jkS)NT)r rrrr)rrr r rrx s   zBoundArguments.__eq__cCs|d|_|d|_dS)Nrr)rr)rrr r rr  s zBoundArguments.__setstate__cCs|j|jdS)N)rr)rr)rr r r __getstate__ szBoundArguments.__getstate__cCsDg}x(|jjD]\}}|jdj||qWdj|jjdj|S)Nz{}={!r}z <{} ({})>z, )rrArNrurrr)rrr@rEr r rr  szBoundArguments.__repr__N)rrr)rrrrrr^rrrrrr rr r r r rr s   rc@seZdZd,ZeZeZeZ d-eddddZ e dd Z e d d Z e dd d dZeddZeddZeedddZddZddZddZddddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+ZdS).r#_return_annotation _parametersNT)r$rc Cs|dkrt}n|rt}t}d}xt|D]\}}|j} |j} | |krjd} | jt|t| } t| n| |krzd}| }| ttfkr|j t kr|rd} t| nd}| |krdj| } t| ||| <q,Wntdd|D}t j ||_ ||_dS)NFz7wrong parameter order: {} parameter before {} parameterz-non-default argument follows default argumentTzduplicate parameter name: {!r}css|]}|j|fVqdS)N)rD)rZr3r r rr sz%Signature.__init__..)rr(rCrirDrurrtr)r*rr MappingProxyTyperr) rr&r$rrZtop_kindZ kind_defaultsidxr3rirDrTr r rr s>         zSignature.__init__cCstjdtddt||S)Nz_inspect.Signature.from_function() is deprecated since Python 3.5, use Signature.from_callable()r)r)rrrr)r[rvr r r from_function s zSignature.from_functioncCstjdtddt||S)Nz^inspect.Signature.from_builtin() is deprecated since Python 3.5, use Signature.from_callable()r)r)rrrr)r[rvr r r from_builtin s zSignature.from_builtin)follow_wrappedcCst|||dS)N)r r)r")r[rhr!r r r from_callable szSignature.from_callablecCs|jS)N)r)rr r rr& szSignature.parameterscCs|jS)N)r)rr r rr$ szSignature.return_annotation)r&r$cCs0|tkr|jj}|tkr |j}t|||dS)N)r$)rr&r'rr)rr&r$r r rr9 s  zSignature.replacecCs8tdd|jjD}dd|jjD}|||jfS)Ncss|]}|jtkr|VqdS)N)rir,)rZr3r r rr sz(Signature._hash_basis..cSsi|]}|jtkr||jqSr )rir,rD)rZr3r r rr] sz)Signature._hash_basis..)rar&r'r$)rr kwo_paramsr r r _hash_basis szSignature._hash_basiscCs(|j\}}}t|j}t|||fS)N)r$ frozensetr'r )rrr#r$r r rr ! s zSignature.__hash__cCs*||kr dSt|tstS|j|jkS)NT)r r#rr$)rrr r rr& s  zSignature.__eq__F)rcCst}t|jj}f}t|}xxy t|}Wntk ry t|} Wntk rbPYnX| jtkrrPn| j|kr| jt krd} | j | jd} t | d| f}PnH| jt ks| j tk r| f}Pn*|r| f}Pnd} | j | jd} t | dYq$Xy t|} Wn tk r&t ddYq$X| jt tfkrBt dd| jtkrn|g} | j|t| || j<P| j|krt dj | jdd||| j<q$Wd} xtj||D]} | jt kr| } q| jtkr֐q| j} y|j| }WnHtk r2| r.| jtkr.| j tkr.t dj | ddYn(X| jt krRt dj | jd||| <qW|r| dk r|||| j<nt dj tt|d|j||S)NzA{arg!r} parameter is positional only, but was passed as a keyword)r@z$missing a required argument: {arg!r}ztoo many positional argumentsz$multiple values for argument {arg!r}z*got an unexpected keyword argument {arg!r})rrr&r'r StopIterationrir+rDr(rurr-r*rr,rrarchainrrg_bound_arguments_cls)rrrrrr&Z parameters_exZarg_valsZarg_valr3rTr'Z kwargs_paramrr r r_bind- s                   zSignature._bindcOs|dj|dd|S)Nrr)r))rrr r rbind szSignature.bindcOs|dj|dd|ddS)NrrT)r)r))rrr r rr szSignature.bind_partialcCs t|t|jjfd|jifS)Nr)rrarr'r)rr r rr szSignature.__reduce__cCs|d|_dS)Nr)r)rrr r rr  szSignature.__setstate__cCsdj|jj|S)Nz<{} {}>)rurr)rr r rr  szSignature.__repr__c Csg}d}d}xr|jjD]d}t|}|j}|tkr8d}n|rJ|jdd}|tkrXd}n|tkrr|rr|jdd}|j|qW|r|jddjdj |}|j t k rt |j }|dj|7}|S)NFTrr=z({})z, z -> {}) r&r'rrir(rNr+r,rurr$rr:) rrfZrender_pos_only_separatorZrender_kw_only_separatorr3r riZrenderedZannor r rr s0      zSignature.__str__)rr)N)rrrrrrrr(rr%rrerr r"r^r&r$rr9r$r rr)r*rrr r rr r r rr# s06    r#)r!cCstj||dS)N)r!)r#r")rhr!r r rr srcCsddl}ddl}|j}|jddd|jddddd |j}|j}|jd \}}}y|j|}} WnLtk r} z0d j |t | j | } t | t jd td WYdd} ~ XnX|r|jd} | }x| D]} t|| }qW| j t jkrt dt jd td|jrt dj |t dj t| t dj | j|| krxt dj t| jt| drt dj | jn6yt|\}}Wntk rYnXt dj |t dn t t|dS)Nrr zCThe object to be analysed. It supports the 'module:qualname' syntax)helpz-dz --details store_truez9Display info about the module rather than its source code)actionr+rzFailed to import {} ({}: {}))rrr}z#Can't get info for builtin modules.rz Target: {}z Origin: {}z Cached: {}z Loader: {}__path__zSubmodule search path: {}zLine: {}r)argparserArgumentParser add_argument parse_argsr partition import_modulerbrurrprintrqstderrexitrrBbuiltin_module_namesZdetailsr __cached__r8rrr.rr)r/rparserrtargetZmod_nameZ has_attrsZattrsrhrrgrTpartspart__ror r r_main sV     r?r)rri)N)N)N)F)N)r)r6)r)r)r)r)T)T) __author__r.rZdiscollections.abcr-enumimportlib.machineryrrrrrrqrrr rrroperatorrrrglobalsZmod_dictZCOMPILER_FLAG_NAMESrArVrWr=rrrrrrrrrr#r$r%r'r)r+r0r2r4r6r8r9rGrXrYrjrJrxr|rrrrrrrrrrrrrrbrrrrrrrrr rrrrrr4r7r:r<rrIrLrSrUrYrZrirjrqrr_fieldsrsrwrzr|r}rr rrrrrrrrrrrrrrrrrrrrrZ_WrapperDescriptorallZ_MethodWrapperrr@Z_ClassMethodWrapperr7rrrrrrrrrrrr"rrIntEnumrrr(rr)rr+rr,rr-Z_PARAM_NAME_MAPPING __getitem__rrrr#rr?rr r r rsd            , t$ ;   .I-7      [   (> 5        0   L H  RH k: threading.cpython-36.opt-2.pyc000064400000050361152462730460012115 0ustar003 i@s|ddlZddlZddlmZmZddlm Z ddl m Z ddl mZmZyddlmZWn ek rxddlmZYnXddd d d d d ddddddddddddddgZejZejZejZejZejZy ej Z!Wne"k rdZ!YnXej#Z#[da$da%ddZ&ddZ'eZ(ddZ Gdd d Z)e)Z*Gd!d d Z+Gd"ddZ,Gd#dde,Z-Gd$ddZ.Gd%ddZ/Gd&dde0Z1ej2Z3e3d?d(d)Z4e a5iZ6iZ7e Z8Gd*ddZ9Gd+dde9Z:Gd,d-d-e9Z;Gd.d/d/e9Zd1dZ?e?Z@d2d3ZAd4d ZBdd5lmCZCe;aDd6d7ZEd8d9ZFd:d ZGydd;lmHZIWn"ek rnddZKdS)@N) monotonicsleep) format_exc)WeakSet)islicecount)deque get_ident active_count Conditioncurrent_thread enumerate main_thread TIMEOUT_MAXEventLockRLock SemaphoreBoundedSemaphoreThreadBarrierBrokenBarrierErrorTimer ThreadError setprofilesettracelocal stack_sizecCs|adS)N) _profile_hook)funcr !/usr/lib64/python3.6/threading.pyr2scCs|adS)N) _trace_hook)rr r r!r<scOstdkrt||St||S)N)_CRLock_PyRLock)argskwargsr r r!rJs  c@sReZdZddZddZdddZeZd d Zd d Zd dZ ddZ ddZ dS)_RLockcCst|_d|_d|_dS)Nr)_allocate_lock_block_owner_count)selfr r r!__init__asz_RLock.__init__cCs^|j}yt|j}Wntk r(YnXd|jjr:dnd|jj|jj||j t t |fS)Nz)<%s %s.%s object owner=%r count=%d at %s>lockedZunlocked) r*_activenameKeyErrorr)r. __class__ __module__ __qualname__r+hexid)r,ownerr r r!__repr__fsz_RLock.__repr__TcCsDt}|j|kr"|jd7_dS|jj||}|r@||_d|_|S)Nr9)r r*r+r)acquire)r,blockingtimeoutmercr r r!r:us z_RLock.acquirecCs<|jtkrtd|jd|_}|s8d|_|jjdS)Nzcannot release un-acquired lockr9)r*r RuntimeErrorr+r)release)r,rr r r!r@s  z_RLock.releasecCs |jdS)N)r@)r,tvtbr r r!__exit__sz_RLock.__exit__cCs|jj|\|_|_dS)N)r)r:r+r*)r,stater r r!_acquire_restores z_RLock._acquire_restorecCs<|jdkrtd|j}d|_|j}d|_|jj||fS)Nrzcannot release un-acquired lock)r+r?r*r)r@)r,rr7r r r! _release_saves  z_RLock._release_savecCs |jtkS)N)r*r )r,r r r! _is_ownedsz_RLock._is_ownedN)TrI) __name__r3r4r-r8r: __enter__r@rDrFrGrHr r r r!r'Ws  $ r'c@speZdZdddZddZddZdd Zd d Zd d ZddZ dddZ dddZ dddZ ddZ e ZdS)r NcCs|dkrt}||_|j|_|j|_y |j|_Wntk rDYnXy |j|_Wntk rfYnXy |j|_Wntk rYnXt|_ dS)N) r_lockr:r@rGAttributeErrorrFrH_deque_waiters)r,lockr r r!r-s$   zCondition.__init__cCs |jjS)N)rLrK)r,r r r!rKszCondition.__enter__cGs |jj|S)N)rLrD)r,r%r r r!rDszCondition.__exit__cCsd|jt|jfS)Nz)rLlenrO)r,r r r!r8szCondition.__repr__cCs|jjdS)N)rLr@)r,r r r!rGszCondition._release_savecCs|jjdS)N)rLr:)r,xr r r!rFszCondition._acquire_restorecCs"|jjdr|jjdSdSdS)NrFT)rLr:r@)r,r r r!rHs  zCondition._is_ownedcCs|jstdt}|j|jj||j}d}z|dkrN|jd}nj|dkrt|}d}xR|jd}|rvPt|t|}|dkrPt|d|d}t |qfWn |jd}|S|j ||sy|jj |Wnt k rYnXXdS)Nzcannot wait on un-acquired lockFTrgMb@?g?) rHr?r(r:rOappendrG_timemin_sleeprFremove ValueError)r,r<waiterZ saved_stateZgotitendtimeZdelayZ remainingr r r!waits>     zCondition.waitcCs\d}|}|}xH|sV|dk rD|dkr0t|}n|t}|dkrDP|j||}qW|S)Nr)rUr\)r,Z predicater<r[Zwaittimeresultr r r!wait_forIs    zCondition.wait_forr9c Csj|jstd|j}tt||}|s,dSx8|D]0}|jy|j|Wq2tk r`Yq2Xq2WdS)Nz!cannot notify on un-acquired lock)rHr?rOrN_islicer@rXrY)r,nZ all_waitersZwaiters_to_notifyrZr r r!notify`s  zCondition.notifycCs|jt|jdS)N)rarQrO)r,r r r! notify_allwszCondition.notify_all)N)N)N)r9)rJr3r4r-rKrDr8rGrFrHr\r^rarbZ notifyAllr r r r!r s  B   c@s4eZdZd ddZd ddZeZdd Zd d ZdS)rr9cCs&|dkrtdtt|_||_dS)Nrz$semaphore initial value must be >= 0)rYr r_cond_value)r,valuer r r!r-s zSemaphore.__init__TNc Cs| r|dk rtdd}d}|jjxb|jdkrv|s8P|dk rh|dkrTt|}n|t}|dkrhP|jj|q(W|jd8_d}WdQRX|S)Nz.can't specify timeout for non-blocking acquireFrr9T)rYrcrdrUr\)r,r;r<r>r[r r r!r:s$   zSemaphore.acquirec Cs.|j|jd7_|jjWdQRXdS)Nr9)rcrdra)r,r r r!r@szSemaphore.releasecCs |jdS)N)r@)r,rArBrCr r r!rDszSemaphore.__exit__)r9)TN)rJr3r4r-r:rKr@rDr r r r!rs   - c@seZdZdddZddZdS)rr9cCstj||||_dS)N)rr-_initial_value)r,rer r r!r-s zBoundedSemaphore.__init__c CsB|j2|j|jkrtd|jd7_|jjWdQRXdS)Nz!Semaphore released too many timesr9)rcrdrfrYra)r,r r r!r@s  zBoundedSemaphore.releaseN)r9)rJr3r4r-r@r r r r!rs c@sBeZdZddZddZddZeZddZd d Zdd d Z d S)rcCstt|_d|_dS)NF)r rrc_flag)r,r r r!r-s zEvent.__init__cCs|jjtdS)N)rcr-r)r,r r r!_reset_internal_locksszEvent._reset_internal_lockscCs|jS)N)rg)r,r r r!is_set sz Event.is_setc Cs&|jd|_|jjWdQRXdS)NT)rcrgrb)r,r r r!setsz Event.setc Cs|j d|_WdQRXdS)NF)rcrg)r,r r r!clearsz Event.clearNc Cs,|j|j}|s|jj|}|SQRXdS)N)rcrgr\)r,r<Zsignaledr r r!r\'s  z Event.wait)N) rJr3r4r-rhriZisSetrjrkr\r r r r!rs   c@s|eZdZdddZdddZddZdd Zd d Zd d ZddZ ddZ ddZ e ddZ e ddZe ddZdS)rNcCs.tt|_||_||_||_d|_d|_dS)Nr)r rrc_action_timeout_parties_stater+)r,partiesactionr<r r r!r-Qs zBarrier.__init__cCs|dkr|j}|jb|j|j}|jd7_z&|d|jkrL|jn |j||S|jd8_|jXWdQRXdS)Nr9)rmrc_enterr+rn_release_wait_exit)r,r<indexr r r!r\as   z Barrier.waitcCs,x|jdkr|jjqW|jdkr(tdS)Nr9rrI)rIr9)rorcr\r)r,r r r!rrs   zBarrier._enterc Cs>y"|jr|jd|_|jjWn|jYnXdS)Nr9)rlrorcrb_break)r,r r r!rsszBarrier._releasecs4jjfdd|s"jtjdkr0tdS)Ncs jdkS)Nr)ror )r,r r!szBarrier._wait..r)rcr^rwrro)r,r<r )r,r!rts  z Barrier._waitcCs(|jdkr$|jdkr$d|_|jjdS)Nrr9rI)rIr9)r+rorcrb)r,r r r!rus  z Barrier._exitc CsT|jD|jdkr6|jdkr$d|_q<|jdkr||_n tj|_d|_ d|_ t |_ d|_ d|_tj|_tj|dS)NFT)_targetstrr_name_args_kwargs _daemonicr r_ident _tstate_lockr_started _is_stopped _initialized_sysstderr_stderr _danglingadd)r,grouptargetr0r%r&rr r r!r- s  zThread.__init__cCs(|jj|r|jn d|_d|_dS)NT)rrh_set_tstate_lockrr)r,is_aliver r r!rh7s   zThread._reset_internal_lockscCs^d}|jjrd}|j|jr$d}|jr2|d7}|jdk rJ|d|j7}d|jj|j|fS)NinitialZstartedZstoppedz daemonz %sz <%s(%s, %s)>) rrirrrrr2rJr)r,Zstatusr r r!r8Cs  zThread.__repr__cCs|jstd|jjr tdt|t|<WdQRXyt|jfWn,tk rtt t|=WdQRXYnX|jj dS)Nzthread.__init__() not calledz threads can only be started once) rr?rri_active_limbo_lock_limbo_start_new_thread _bootstrap Exceptionr\)r,r r r!startQs  z Thread.startc Cs.z|jr|j|j|jWd|`|`|`XdS)N)rrr)r,r r r!runjs z Thread.runc Cs2y |jWn |jr&tdkr&dSYnXdS)N)_bootstrap_innerrr)r,r r r!r{s  zThread._bootstrapcCs t|_dS)N)r r)r,r r r! _set_identszThread._set_identcCst|_|jjdS)N) _set_sentinelrr:)r,r r r!rszThread._set_tstate_lockc2CszT|j|j|jjt|t|j<t|=WdQRXtrLt j tt rZt j t zy |j Wntk r|Ynt rt jdk rtd|jtft jdn|jdk rH|j\}}}zxtd|jd|jdtd|jdx6|r$td|jjj|j|jjjf|jd|j}qWtd||f|jdWd~~~XYnXWdXWdt y tt=Wn YnXWdQRXXdS)NzException in thread %s: %s)filezException in thread z2 (most likely raised during interpreter shutdown):z"Traceback (most recent call last):z File "%s", line %s, in %sz%s: %s)rrrrjrr/rrr"rrrrr SystemExitrprintr0 _format_excr _exc_infotb_framef_code co_filename tb_linenoco_nametb_nextr )r,exc_type exc_valueZexc_tbr r r!rsT         zThread._bootstrap_innercCs|j}|dk rd|_d|_dS)NT)rr)r,rPr r r!_stopsz Thread._stopcCsByttt=WdQRXWn tk r<dtjkr8YnXdS)NZdummy_threading)rr/r r1rmodules)r,r r r!_deletes  zThread._deletecCsZ|jstd|jjs td|tkr2td|dkrD|jn|jt|dddS)NzThread.__init__() not calledz'cannot join thread before it is startedzcannot join current threadr)r<)rr?rrir _wait_for_tstate_lockmax)r,r<r r r!joins   z Thread.joinTr9cCs0|j}|dkrn|j||r,|j|jdS)N)rr:r@r)r,blockr<rPr r r!r;s  zThread._wait_for_tstate_lockcCs|jS)N)r)r,r r r!r0Is z Thread.namecCst||_dS)N)rr)r,r0r r r!r0TscCs|jS)N)r)r,r r r!identYs z Thread.identcCs(|js|jj rdS|jd|j S)NF)rrrir)r,r r r!res  zThread.is_alivecCs|jS)N)r)r,r r r!rusz Thread.daemoncCs*|jstd|jjr td||_dS)NzThread.__init__() not calledz)cannot set daemon status of active thread)rr?rrir)r,daemonicr r r!rs  cCs|jS)N)r)r,r r r!isDaemonszThread.isDaemoncCs ||_dS)N)r)r,rr r r! setDaemonszThread.setDaemoncCs|jS)N)r0)r,r r r!getNameszThread.getNamecCs ||_dS)N)r0)r,r0r r r!setNameszThread.setName)NrI)TrI)rJr3r4rrexc_inforr-rhr8rrrrrrrrrrr~r0setterrrZisAliverrrrrr r r r!rs6 , A# &    c@s&eZdZdddZddZddZdS) rNcCsFtj|||_||_|dk r"|ng|_|dk r4|ni|_t|_dS)N)rr-intervalfunctionr%r&rfinished)r,rrr%r&r r r!r-s  zTimer.__init__cCs|jjdS)N)rrj)r,r r r!cancelsz Timer.cancelcCs6|jj|j|jjs(|j|j|j|jjdS)N)rr\rrirr%r&rj)r,r r r!rs z Timer.run)NN)rJr3r4r-rrr r r r!rs c@seZdZddZdS) _MainThreadc CsHtj|ddd|j|jj|jt|t|j<WdQRXdS)NZ MainThreadF)r0r) rr-rrrjrrr/r)r,r r r!r-s  z_MainThread.__init__N)rJr3r4r-r r r r!rsrc@s.eZdZddZddZddZd dd ZdS) _DummyThreadc CsDtj|tddd|jj|jt|t|j<WdQRXdS)NzDummy-%dT)r0r) rr-rrrjrrr/r)r,r r r!r-s  z_DummyThread.__init__cCsdS)Nr )r,r r r!rsz_DummyThread._stopcCsdS)NTr )r,r r r!rsz_DummyThread.is_aliveNcCsdS)Nr )r,r<r r r!rsz_DummyThread.join)N)rJr3r4r-rrrr r r r!rsrc Cs&y ttStk r tSXdS)N)r/r r1rr r r r!r s c Cs tttttSQRXdS)N)rrQr/rr r r r!r scCsttjttjS)N)listr/valuesrr r r r! _enumeratesrc Cs(tttjttjSQRXdS)N)rrr/rrr r r r!r s)rcCs8tj}|jtjt}x|r2|jt}qWdS)N) _main_threadrr@r_pickSomeNonDaemonThreadr)ZtlockrAr r r! _shutdownsrcCs(x"tD]}|j r|jr|SqWdS)N)r rr)rAr r r!r&s rcCstS)N)rr r r r!r,s)_local)rc Cstai}t}|at|tt}|jtxF|D]>}||kr`|jdt }||_ |||<q4|jd|j q4Wt j tj tj|WdQRXdS)NTF)rrr rrjrupdaterrhr rrrrkr/)Z new_activeZcurrentZthreadsZthreadrr r r! _after_fork=s&        r)r)Lsysr_threadZtimerrUrrW tracebackrr _weakrefsetr itertoolsrr_rr+ _collectionsrrN ImportError collections__all__start_new_threadr allocate_lockr(rr errorrrr#rMrrr"rrrr'r$r rrrrr?r__next__rrrr/rrrrrrr Z currentThreadr Z activeCountrr rrrrrrrZ_threading_localrr r r r!s          q9P&O '    chunk.cpython-36.pyc000064400000011446152462730460010321 0ustar003 \1@sdZGdddZdS)aSimple class to read IFF chunks. An IFF chunk (used in formats such as AIFF, TIFF, RMFF (RealMedia File Format)) has the following structure: +----------------+ | ID (4 bytes) | +----------------+ | size (4 bytes) | +----------------+ | data | | ... | +----------------+ The ID is a 4-byte string which identifies the type of chunk. The size field (a 32-bit value, encoded using big-endian byte order) gives the size of the whole chunk, including the 8-byte header. Usually an IFF-type file consists of one or more chunks. The proposed usage of the Chunk class defined here is to instantiate an instance at the start of each chunk and read from the instance until it reaches the end, after which a new instance can be instantiated. At the end of the file, creating a new instance will fail with an EOFError exception. Usage: while True: try: chunk = Chunk(file) except EOFError: break chunktype = chunk.getname() while True: data = chunk.read(nbytes) if not data: pass # do something with data The interface is file-like. The implemented methods are: read, close, seek, tell, isatty. Extra methods are: skip() (called by close, skips to the end of the chunk), getname() (returns the name (ID) of the chunk) The __init__ method has one required argument, a file-like object (including a chunk instance), and one optional argument, a flag which specifies whether or not chunks are aligned on 2-byte boundaries. The default is 1, i.e. aligned. c@sZeZdZdddZddZddZd d Zd d ZdddZddZ dddZ ddZ dS)ChunkTFcCsddl}d|_||_|rd}nd}||_|jd|_t|jdkrFty |j|d|jdd|_ Wn|j k rtYnX|r|j d|_ d|_ y|jj |_ Wnttfk rd|_YnXd|_dS) NF><LT)structclosedalignfileread chunknamelenEOFErrorZ unpack_from chunksizeerror size_readtelloffsetAttributeErrorOSErrorseekable)selfr r Z bigendianZ inclheaderrZstrflagr/usr/lib64/python3.6/chunk.py__init__4s,     zChunk.__init__cCs|jS)z*Return the name (ID) of the current chunk.)r )rrrrgetnameNsz Chunk.getnamecCs|jS)z%Return the size of the current chunk.)r)rrrrgetsizeRsz Chunk.getsizec Cs |jsz |jWdd|_XdS)NT)r skip)rrrrcloseVs z Chunk.closecCs|jrtddS)NzI/O operation on closed fileF)r ValueError)rrrrisatty]sz Chunk.isattyrcCsv|jrtd|jstd|dkr0||j}n|dkrB||j}|dksT||jkrXt|jj|j |d||_dS)zSeek to specified position into the chunk. Default position is 0 (start of chunk). If the file is not seekable, this will result in an error. zI/O operation on closed filez cannot seekrN) r r rrrr RuntimeErrorr seekr)rposwhencerrrr%bs  z Chunk.seekcCs|jrtd|jS)NzI/O operation on closed file)r r r)rrrrrusz Chunk.tellr"cCs|jrtd|j|jkrdS|dkr2|j|j}||j|jkrN|j|j}|jj|}|jt||_|j|jkr|jr|jd@r|jjd}|jt||_|S)zRead at most size bytes from the chunk. If size is omitted or negative, read until the end of the chunk. zI/O operation on closed filerr")r r rrr r rr )rsizedatadummyrrrr zs        z Chunk.readc Cs|jrtd|jrlyB|j|j}|jr:|jd@r:|d}|jj|d|j||_dStk rjYnXx4|j|jkrt d|j|j}|j |}|snt qnWdS)zSkip the rest of the chunk. If you are not interested in the contents of the chunk, this method should be called so that the file points to the start of the next chunk. zI/O operation on closed filer"Ni ) r r rrrr r r%rminr r)rnr+rrrrs"   z Chunk.skipN)TTF)r)r.) __name__ __module__ __qualname__rrrrr!r%rr rrrrrr3s   rN)__doc__rrrrr1sfnmatch.cpython-36.opt-2.pyc000064400000003227152462730460011567 0ustar003 \^ @sfddlZddlZddlZddlZddddgZddZejddd d d Zd dZd dZ ddZ dS)Nfilterfnmatch fnmatchcase translatecCs"tjj|}tjj|}t||S)N)ospathnormcaser)namepatr /usr/lib64/python3.6/fnmatch.pyrs  T)maxsizetypedcCs<t|tr(t|d}t|}t|d}nt|}tj|jS)Nz ISO-8859-1) isinstancebytesstrrrecompilematch)r Zpat_strZres_strresr r r _compile_pattern&s    rcCspg}tjj|}t|}tjtkrDxH|D]}||r(|j|q(Wn(x&|D]}|tjj|rJ|j|qJW|S)N)rrrr posixpathappend)namesr resultrr r r r r0s    cCst|}||dk S)N)r)r r rr r r r@scCsHdt|}}d}x*||kr>||}|d}|dkrB|d}q|dkrT|d}q|dkr.|}||kr~||d kr~|d}||kr||d kr|d}x ||kr||d kr|d}qW||kr|d }n^|||jd d }|d}|dd kr d|dd}n|ddkr d |}d||f}q|tj|}qWd|S)Nr*z.*?.[!]z\[\z\\^z%s[%s]z (?s:%s)\Z)lenreplacerescape)r inrcjZstuffr r r rJs8     ) rrr functools__all__r lru_cacherrrrr r r r  s   bisect.cpython-36.pyc000064400000005166152462730460010464 0ustar003 \# @sZdZd ddZeZd ddZeZdddZdd d Zy dd lTWnek rTYnXdS)zBisection algorithms.NcCsd|dkrtd|dkr t|}x2||krR||d}|||krH|}q"|d}q"W|j||dS)zInsert item x in list a, and keep it sorted assuming a is sorted. If x is already in a, insert it to the right of the rightmost x. Optional args lo (default 0) and hi (default len(a)) bound the slice of a to be searched. rzlo must be non-negativeN) ValueErrorleninsert)axlohimidr /usr/lib64/python3.6/bisect.py insort_rights     rcCsX|dkrtd|dkr t|}x2||krR||d}|||krH|}q"|d}q"W|S)aReturn the index where to insert item x in list a, assuming a is sorted. The return value i is such that all e in a[:i] have e <= x, and all e in a[i:] have e > x. So if x already appears in the list, a.insert(x) will insert just after the rightmost x already there. Optional args lo (default 0) and hi (default len(a)) bound the slice of a to be searched. rzlo must be non-negativeNrr)rr)rrr r r r r r bisect_rights     rcCsd|dkrtd|dkr t|}x2||krR||d}|||krL|d}q"|}q"W|j||dS)zInsert item x in list a, and keep it sorted assuming a is sorted. If x is already in a, insert it to the left of the leftmost x. Optional args lo (default 0) and hi (default len(a)) bound the slice of a to be searched. rzlo must be non-negativeNrr)rrr)rrr r r r r r insort_left/s    rcCsX|dkrtd|dkr t|}x2||krR||d}|||krL|d}q"|}q"W|S)aReturn the index where to insert item x in list a, assuming a is sorted. The return value i is such that all e in a[:i] have e < x, and all e in a[i:] have e >= x. So if x already appears in the list, a.insert(x) will insert just before the leftmost x already there. Optional args lo (default 0) and hi (default len(a)) bound the slice of a to be searched. rzlo must be non-negativeNrr)rr)rrr r r r r r bisect_leftCs    r)*)rN)rN)rN)rN) __doc__rZinsortrZbisectrrZ_bisect ImportErrorr r r r s     _threading_local.cpython-36.pyc000064400000014433152462730460012466 0ustar003 \.@s^dZddlmZddlmZdgZGdddZeddZGd ddZdd l m Z m Z d S) a% Thread-local objects. (Note that this module provides a Python version of the threading.local class. Depending on the version of Python you're using, there may be a faster one available. You should always import the `local` class from `threading`.) Thread-local objects support the management of thread-local data. If you have data that you want to be local to a thread, simply create a thread-local object and use its attributes: >>> mydata = local() >>> mydata.number = 42 >>> mydata.number 42 You can also access the local-object's dictionary: >>> mydata.__dict__ {'number': 42} >>> mydata.__dict__.setdefault('widgets', []) [] >>> mydata.widgets [] What's important about thread-local objects is that their data are local to a thread. If we access the data in a different thread: >>> log = [] >>> def f(): ... items = sorted(mydata.__dict__.items()) ... log.append(items) ... mydata.number = 11 ... log.append(mydata.number) >>> import threading >>> thread = threading.Thread(target=f) >>> thread.start() >>> thread.join() >>> log [[], 11] we get different data. Furthermore, changes made in the other thread don't affect data seen in this thread: >>> mydata.number 42 Of course, values you get from a local object, including a __dict__ attribute, are for whatever thread was current at the time the attribute was read. For that reason, you generally don't want to save these values across threads, as they apply only to the thread they came from. You can create custom local objects by subclassing the local class: >>> class MyLocal(local): ... number = 2 ... def __init__(self, **kw): ... self.__dict__.update(kw) ... def squared(self): ... return self.number ** 2 This can be useful to support default values, methods and initialization. Note that if you define an __init__ method, it will be called each time the local object is used in a separate thread. This is necessary to initialize each thread's dictionary. Now if we create a local object: >>> mydata = MyLocal(color='red') Now we have a default number: >>> mydata.number 2 an initial color: >>> mydata.color 'red' >>> del mydata.color And a method that operates on the data: >>> mydata.squared() 4 As before, we can access the data in a separate thread: >>> log = [] >>> thread = threading.Thread(target=f) >>> thread.start() >>> thread.join() >>> log [[('color', 'red')], 11] without affecting this thread's data: >>> mydata.number 2 >>> mydata.color Traceback (most recent call last): ... AttributeError: 'MyLocal' object has no attribute 'color' Note that subclasses can define slots, but they are not thread local. They are shared across threads: >>> class MyLocal(local): ... __slots__ = 'number' >>> mydata = MyLocal() >>> mydata.number = 42 >>> mydata.color = 'red' So, the separate thread: >>> thread = threading.Thread(target=f) >>> thread.start() >>> thread.join() affects what we see: >>> mydata.number 11 >>> del mydata )ref)contextmanagerlocalc@s,eZdZdZdZddZd d Zd d Zd S) _localimplz#A class managing thread-local dictskeydicts localargs locallock __weakref__cCsdtt||_i|_dS)Nz_threading_local._localimpl.)stridrr)selfr(/usr/lib64/python3.6/_threading_local.py__init__sz_localimpl.__init__cCst}|jt|dS)zPReturn the dict for the current thread. Raises KeyError if none defined.)current_threadrr )r threadrrrget_dictsz_localimpl.get_dictcshi}|j}t}t|}|ffdd }|ffdd }t||t|||j|<|f|j|<|S)z8Create a new dict for the current thread, and return it.cs}|dk r|j|=dS)N)__dict__)_rr)wrthreadrr local_deletedsz-_localimpl.create_dict..local_deletedcs}|dk r|jj|}dS)N)rpop)ridtrdct)wrlocalrrthread_deletedsz._localimpl.create_dict..thread_deleted)rrr rrr)r Z localdictrrrrrr)rrr create_dicts   z_localimpl.create_dictN)rrrr r )__name__ __module__ __qualname____doc__ __slots__rrrrrrrrs rccsvtj|d}y |j}Wn2tk rJ|j}|j\}}|j||YnX|jtj|d|dVWdQRXdS)N _local__implr) object__getattribute__rKeyErrorrrrr __setattr__)r implrargskwrrr_patchs   r,c@s0eZdZd ZddZddZddZd d Zd S) rr$rcOsX|s|r|jtjkrtdtj|}t}||f|_t|_tj|d||j |S)Nz*Initialization arguments are not supportedr$) rr% TypeError__new__rrRLockr r(r)clsr*r+r r)rrrr.s  z local.__new__c Cs t|tj||SQRXdS)N)r,r%r&)r namerrrr&s zlocal.__getattribute__c Cs:|dkrtd|jjt|tj|||SQRXdS)Nrz+%r object attribute '__dict__' is read-only)AttributeError __class__rr,r%r()r r1valuerrrr(s   zlocal.__setattr__c Cs8|dkrtd|jjt|tj||SQRXdS)Nrz+%r object attribute '__dict__' is read-only)r2r3rr,r% __delattr__)r r1rrrr5s   zlocal.__delattr__N)r$r)rr r!r#r.r&r(r5rrrrrs )rr/N) r"weakrefr contextlibr__all__rr,rZ threadingrr/rrrrs   , &mailcap.cpython-36.pyc000064400000016053152462730460010616 0ustar003 ik#@sdZddlZddlZddlZddgZddZejdjZGdd d e Z d dZ d d Z d dZ ddZddZddZddgfddZd#ddZgfddZddZddZd d!Zed"kredS)$z%Mailcap file handling. See RFC 1524.Ngetcaps findmatchcCsd|krd|dfSdSdS)Nlinenor)rr)entryrr/usr/lib64/python3.6/mailcap.pylineno_sort_key s r z[^\xa1-\U0010FFFF\w@+=:,./-]c@seZdZdZdS)UnsafeMailcapInputz)Warning raised when refusing unsafe inputN)__name__ __module__ __qualname____doc__rrrrr sr cCsi}d}xtD]}yt|d}Wntk r8wYnX|t||\}}WdQRXx6|jD]*\}}||kr||||<qb|||||<qbWqW|S)aReturn a dictionary containing the mailcap database. The dictionary maps a MIME type (in all lowercase, e.g. 'text/plain') to a list of dictionaries corresponding to mailcap entries. The list collects all the entries for that MIME type from all available mailcap files. Each dictionary contains key-value pairs for that MIME type, where the viewing command is stored with the key "view". rrN)listmailcapfilesopenOSError_readmailcapfileitems)capsrZmailcapfpZmorecapskeyvaluerrrrs   cCsPdtjkr"tjd}|jtj}n*dtjkr8tjd}nd}|ddddg}|S)z7Return a list of all mailcap files found on the system.ZMAILCAPSHOME.z /.mailcapz /etc/mailcapz/usr/etc/mailcapz/usr/local/etc/mailcap)osenvironsplitpathsep)ZpathstrZmailcapshomerrrr3s    rcCs tjdtdt|d\}}|S)z?Read a mailcap file and return a dictionary keyed by MIME type.z2readmailcapfile is deprecated, use getcaps insteadN)warningswarnDeprecationWarningr)rr_rrrreadmailcapfileEsr%c Csi}x|j}|sP|ddks|jdkr.q|}x4|d ddkrf|j}|sTd}|dd |}q4Wt|\}}|oz|s~q|dk r||d<|d 7}|jd }x$tt|D]}||j||<qWd j|j}||kr||j|q|g||<qW||fS) aRead a mailcap file and return a dictionary keyed by MIME type. Each MIME type is mapped to an entry consisting of a list of dictionaries; the list will contain more than one such dictionary if a given MIME type appears more than once in the mailcap file. Each dictionary contains key-value pairs for that MIME type, where the viewing command is stored with the key "view". r#r Nz\  rr/r*) readlinestrip parselinerrangelenjoinlowerappend) rrrlineZnextlinerfieldstypesjrrrrMs6   rc Csg}dt|}}x.||kr@t|||\}}|j||d}qWt|dkrRdS|d|d|dd}}}d|i}x^|D]V}|jd}|dkr|}d} n$|d|j}||ddj} ||krq| ||<qW||fS) zParse one entry in a mailcap file and return a dictionary. The viewing command is stored as the value with the key "view", and the rest of the fields produce key-value pairs in the dict. rrr Nview=r')NN)r/ parsefieldr2findr,) r3r4infieldrr7restZfkeyZfvaluerrrr-vs*        r-cCsT|}x:||kr>||}|dkr"Pq|dkr4|d}q|d}qW|||j|fS)z/Separate one key-value pair in a mailcap entry.;\r r)r,)r3r;r<startcrrrr9s   r9r7z /dev/nullc Cst|r"d|f}tj|tdSt|||}xd|D]\}d|krnt|d||}|dkrZq4|rntj|dkrnq4t|||||} | dk r4| |fSq4WdS)aFind a match for a mailcap entry. Return a tuple containing the command line, and the mailcap entry used; (None, None) if no match is found. This may invoke the 'test' command of several matching entries before deciding which entry to use. zHRefusing to use mailcap with filename %r. Use a safe temporary filename.Ntestr)NN)NN) _find_unsafer!r"r lookupsubstrsystem) rMIMEtyperfilenameplistmsgentrieserCcommandrrrrs      cslg}||kr|||}|jd}|dd}||krB|||}dk r\fdd|D}t|td}|S)Nr)rz/*csg|]}|kr|qSrr).0rM)rrr szlookup..)r)rsortedr )rrHrrLZ MIMEtypesr)rrrEs     rEc Cs\d}dt|}}xB||krV||}|d}|dkrb|dkrX|||d}|d}||}q||}|d}|dkr||}q|dkr||}q|dkrt|rd|f}tj|tdS||}q|d krH|} x ||kr||d kr|d}qW|| |} |d}t| |} t| r>d | | f}tj|tdS|| }q|d|}qW|S) Nr'rr%r@stz9Refusing to substitute MIME type %r into a shell command.{}z=Refusing to substitute parameter %r (%s) into a shell command)r/rDr!r"r findparam) r=rHrIrJresr;r<rBrKrAnameZparamrrrrFsH              rFcCsF|jd}t|}x,|D]$}|d|j|kr||dSqWdS)Nr8r')r1r/)rYrJr<prrrrWs   rWc Csddl}t}|jdds(t|dSxtdt|jdD]}|j||d}t|dkrjtddS|d}|d}t||d|\}}|stdtqs* ) ) shlex.cpython-36.opt-2.pyc000064400000014474152462730460011300 0ustar003 \2 @sddlZddlZddlZddlmZddlmZdddgZGdddZdd dZ ej d ej j Z d dZd dZedkreejdkreen,ejdZeeZeeeeWdQRXdS)N)deque)StringIOshlexsplitquotec@sbeZdZdddZddZdddZd d Zd d Zd dZddZ dddZ ddZ ddZ dS)rNFcCst|trt|}|dk r(||_||_ntj|_d|_||_|rHd|_nd|_d|_ d|_ |jrn|j d7_ d|_ d|_ d|_ d|_d |_d |_t|_d |_d |_d|_t|_d|_|sd}n |d krd}||_|rt|_|j d7_ |j jtj|}|j j||_ dS)N#Z?abcdfeghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_u|ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞz Fz'"\" rTz();<>|&z~-./*?=) isinstancestrrinstreaminfilesysstdinposixeof commenters wordchars whitespacewhitespace_splitquotesescape escapedquotesstaterpushbacklinenodebugtoken filestacksourcepunctuation_chars_pushback_chars maketransdictfromkeys translate)selfrrrr#tr+/usr/lib64/python3.6/shlex.py__init__sJ zshlex.__init__cCs*|jdkrtdt||jj|dS)Nr zshlex: pushing token )rprintreprr appendleft)r)tokr+r+r, push_tokenDs zshlex.push_tokencCspt|trt|}|jj|j|j|jf||_||_d|_|jrl|dk r\t d|jfnt d|jfdS)Nr zshlex: pushing to file %szshlex: pushing to stream %s) r rrr!r0rrrrr.)r) newstreamnewfiler+r+r, push_sourceJs zshlex.push_sourcecCsD|jj|jj\|_|_|_|jr:td|j|jfd|_dS)Nzshlex: popping to %s, line %dr ) rcloser!popleftrrrr.r)r)r+r+r, pop_sourceXs  zshlex.pop_sourcecCs|jr.|jj}|jdkr*tdt||S|j}|jdk r~x<||jkr||j|j}|rr|\}}|j|||j }qBWx*||j kr|j s|j S|j |j }qW|jdkr||j krtdt|ntd|S)Nr zshlex: popping token z shlex: token=zshlex: token=EOF) rr7rr.r/ read_tokenr" sourcehookr5 get_tokenrr!r8)r)r1rawspecr4r3r+r+r,r;as.          zshlex.get_tokencCsd}d}x\|jr$|jr$|jj}n |jjd}|dkrF|jd7_|jdkrbtd|j|f|jdkrvd|_ Pq |jdkr|sd|_Pqd||j kr|jdkrtd |j s|j r |r Pnq n||j kr|jj |jd7_n|j o||jkrd }||_n||jkr"||_ d |_np||jkr<||_ d |_nV||jkr^|j sV||_ ||_n4|jrt||_ d |_n||_ |j s|j r |r Pnq q |j|jkr|j r,||jkr,|j|jkr,|j}||_n|j |7_ q |j|jkr|sl|jdkrdtdtd||jkr||jkr||kr|j |j7_ |j |7_ ||_q |jdkr |sd|_Pq ||j kr|jdkrtdd|_|j s|j r |r Pnq q ||j krZ|jj |jd7_|j rdd|_|j sR|j r |r Pnq q |jd kr||jkr|j |7_ n ||j kr|jj|d|_Pq |j r||jkr||_q |j r||jkrd }||_q ||jks||jks|jr|j |7_ q |jr&|jj|n |jj||jdkrFtdd|_|j s^|j r |r Pq q q W|j }d|_ |j r| r|dkrd}|jdkr|rtdt|ntd|S)NFr r  z&shlex: in state %r I see character: %rrz+shlex: I see whitespace in whitespace stateacTz shlex: I see EOF in quotes statezNo closing quotationz shlex: I see EOF in escape statezNo escaped characterz%shlex: I see whitespace in word statez&shlex: I see punctuation in word statezshlex: raw token=zshlex: raw token=EOF)rArB)r#r$poprreadrrr.rr rrrreadlinerrrr ValueErrorrappendrr0r/)r)ZquotedZ escapedstateZnextcharresultr+r+r,r9s                               zshlex.read_tokencCsX|ddkr|dd}t|jtrJtjj| rJtjjtjj|j|}|t|dfS)Nrr r r) r rrospathisabsjoindirnameopen)r)r4r+r+r,r:s   zshlex.sourcehookcCs(|dkr|j}|dkr|j}d||fS)Nz"%s", line %d: )rr)r)rrr+r+r, error_leaders zshlex.error_leadercCs|S)Nr+)r)r+r+r,__iter__#szshlex.__iter__cCs|j}||jkrt|S)N)r;r StopIteration)r)r r+r+r,__next__&s zshlex.__next__)NNFF)N)NN) __name__ __module__ __qualname__r-r2r5r8r;r9r:rQrRrTr+r+r+r,rs .    FTcCs$t||d}d|_|sd|_t|S)N)rTr)rrrlist)sZcommentsrZlexr+r+r,r,s  z[^\w@%+=:,./-]cCs,|sdSt|dkr|Sd|jdddS)Nz'''z'"'"') _find_unsafereplace)rYr+r+r,r6s  cCs(x"|j}|sPtdt|qWdS)NzToken: )r;r.r/)ZlexerZttr+r+r, _print_tokensBs r]__main__r )FT)rKrer collectionsrior__all__rrcompileASCIIsearchr[rr]rUlenargvfnrPfr+r+r+r, s$        __future__.cpython-36.pyc000064400000010111152462730460011303 0ustar003 \ @sdZddddddddd g Zd geZd Zd Zd ZdZdZdZdZ dZ dZ GdddZ e d!d"eZ e d#d$eZe d%d&eZe d'd(eZe d)d*eZe d+d,eZe d-d.e Ze d/d0e Ze d1d2e Zd S)3afRecord of phased-in incompatible language changes. Each line is of the form: FeatureName = "_Feature(" OptionalRelease "," MandatoryRelease "," CompilerFlag ")" where, normally, OptionalRelease < MandatoryRelease, and both are 5-tuples of the same form as sys.version_info: (PY_MAJOR_VERSION, # the 2 in 2.1.0a3; an int PY_MINOR_VERSION, # the 1; an int PY_MICRO_VERSION, # the 0; an int PY_RELEASE_LEVEL, # "alpha", "beta", "candidate" or "final"; string PY_RELEASE_SERIAL # the 3; an int ) OptionalRelease records the first release in which from __future__ import FeatureName was accepted. In the case of MandatoryReleases that have not yet occurred, MandatoryRelease predicts the release in which the feature will become part of the language. Else MandatoryRelease records when the feature became part of the language; in releases at or after that, modules no longer need from __future__ import FeatureName to use the feature in question, but may continue to use such imports. MandatoryRelease may also be None, meaning that a planned feature got dropped. Instances of class _Feature have two corresponding methods, .getOptionalRelease() and .getMandatoryRelease(). CompilerFlag is the (bitfield) flag that should be passed in the fourth argument to the builtin function compile() to enable the feature in dynamically compiled code. This flag is stored in the .compiler_flag attribute on _Future instances. These values must match the appropriate #defines of CO_xxx flags in Include/compile.h. No feature line is ever to be deleted from this file. nested_scopes generatorsdivisionabsolute_importwith_statementprint_functionunicode_literalsbarry_as_FLUFLgenerator_stopall_feature_namesi i@iiiiic@s,eZdZddZddZddZddZd S) _FeaturecCs||_||_||_dS)N)optional mandatory compiler_flag)selfZoptionalReleaseZmandatoryReleaserr"/usr/lib64/python3.6/__future__.py__init__Osz_Feature.__init__cCs|jS)zReturn first release in which this feature was recognized. This is a 5-tuple, of the same form as sys.version_info. )r)rrrrgetOptionalReleaseTsz_Feature.getOptionalReleasecCs|jS)zReturn release in which this feature will become mandatory. This is a 5-tuple, of the same form as sys.version_info, or, if the feature was dropped, is None. )r)rrrrgetMandatoryRelease\sz_Feature.getMandatoryReleasecCsdt|j|j|jfS)Nr )reprrrr)rrrr__repr__esz_Feature.__repr__N)__name__ __module__ __qualname__rrrrrrrrr Ns r betaalphafinal N)rrr rr)rrr rr )rrr rr)rr r r!r )rrr rr)r r r rr )rr"r rr)r r r rr )rr"r rr)rr#r rr )rr#r rr)r r r rr )rr#r rr)r r r rr )r rr rr)r r$r rr )r r"r rr)r r%r rr )__doc__r __all__Z CO_NESTEDZCO_GENERATOR_ALLOWEDZCO_FUTURE_DIVISIONZCO_FUTURE_ABSOLUTE_IMPORTZCO_FUTURE_WITH_STATEMENTZCO_FUTURE_PRINT_FUNCTIONZCO_FUTURE_UNICODE_LITERALSZCO_FUTURE_BARRY_AS_BDFLZCO_FUTURE_GENERATOR_STOPr rrrrrrrrr rrrr0s^ uuid.cpython-36.opt-1.pyc000064400000050514152462730460011115 0ustar003 i]@s dZddlZdZddddg\ZZZZeZe Z Gdd d e Z d d Z d d ZddZddZddZddZddZddZddZdZZyddlZddlZddlZdgZejjdsejdxLeD]DZyej ej!j"eZ#Wne$k rwYnXe%e#dre#j&ZPqW[ejd kr@eej'j(j)d!dd"kr@dZy ej*j+Z#WndZ#YnXe,e#d#e,e#d$dZWn YnXd%d&Z-d'd(Z.d)d*Z/da0e.eegZ1e-eeeeegZ2d+d,Z3da4d9d-d.Z5d/d0Z6d1d2Z7d3d4Z8e d5Z9e d6Z:e d7Z;e d8Z>> import uuid # make a UUID based on the host ID and current time >>> uuid.uuid1() # doctest: +SKIP UUID('a8098c1a-f86e-11da-bd1a-00112444be1e') # make a UUID using an MD5 hash of a namespace UUID and a name >>> uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org') UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e') # make a random UUID >>> uuid.uuid4() # doctest: +SKIP UUID('16fd2706-8baf-433b-82eb-8c7fada847da') # make a UUID using a SHA-1 hash of a namespace UUID and a name >>> uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org') UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d') # make a UUID from a string of hex digits (braces and hyphens ignored) >>> x = uuid.UUID('{00010203-0405-0607-0809-0a0b0c0d0e0f}') # convert a UUID to a string of hex digits in standard form >>> str(x) '00010203-0405-0607-0809-0a0b0c0d0e0f' # get the raw 16 bytes of the UUID >>> x.bytes b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f' # make a UUID from a 16-byte string >>> uuid.UUID(bytes=x.bytes) UUID('00010203-0405-0607-0809-0a0b0c0d0e0f') NzKa-Ping Yee zreserved for NCS compatibilityzspecified in RFC 4122z$reserved for Microsoft compatibilityzreserved for future definitionc@seZdZdZd7ddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZeddZeddZeddZedd Zed!d"Zed#d$Zed%d&Zed'd(Zed)d*Zed+d,Zed-d.Zed/d0Zed1d2Zed3d4Zed5d6ZdS)8UUIDaInstances of the UUID class represent UUIDs as specified in RFC 4122. UUID objects are immutable, hashable, and usable as dictionary keys. Converting a UUID to a string with str() yields something in the form '12345678-1234-1234-1234-123456789abc'. The UUID constructor accepts five possible forms: a similar string of hexadecimal digits, or a tuple of six integer fields (with 32-bit, 16-bit, 16-bit, 8-bit, 8-bit, and 48-bit values respectively) as an argument named 'fields', or a string of 16 bytes (with all the integer fields in big-endian order) as an argument named 'bytes', or a string of 16 bytes (with the first three fields in little-endian order) as an argument named 'bytes_le', or a single 128-bit integer as an argument named 'int'. UUIDs have these read-only attributes: bytes the UUID as a 16-byte string (containing the six integer fields in big-endian byte order) bytes_le the UUID as a 16-byte string (with time_low, time_mid, and time_hi_version in little-endian byte order) fields a tuple of the six integer fields of the UUID, which are also available as six individual attributes and two derived attributes: time_low the first 32 bits of the UUID time_mid the next 16 bits of the UUID time_hi_version the next 16 bits of the UUID clock_seq_hi_variant the next 8 bits of the UUID clock_seq_low the next 8 bits of the UUID node the last 48 bits of the UUID time the 60-bit timestamp clock_seq the 14-bit sequence number hex the UUID as a 32-character hexadecimal string int the UUID as a 128-bit integer urn the UUID as a URN as specified in RFC 4122 variant the UUID variant (one of the constants RESERVED_NCS, RFC_4122, RESERVED_MICROSOFT, or RESERVED_FUTURE) version the UUID version number (1 through 5, meaningful only when the variant is RFC_4122) NcCs|||||gjddkr td|dk rl|jddjdd}|jdjdd}t|d krbtd t|d }|dk rt|d krtd |d(dd)|d*d+d,|d-d.d/|dd}|dk rt|d krtdtj|dd}|dk r"t|dkr td|\}}} } } } d|ko.d0kns>tdd|koRd1knsbtdd| kovd2knstdd| kod3knstdd| kod4knstdd| kod5knstd| d>| B} |d>|d>B| d>B| d>B| B}|dk rTd|koDd d>knsTtd |dk rd |kord!knstd"|d7M}|d8O}|d:M}||d&>O}||jd'<dS);amCreate a UUID from either a string of 32 hexadecimal digits, a string of 16 bytes as the 'bytes' argument, a string of 16 bytes in little-endian order as the 'bytes_le' argument, a tuple of six integers (32-bit time_low, 16-bit time_mid, 16-bit time_hi_version, 8-bit clock_seq_hi_variant, 8-bit clock_seq_low, 48-bit node) as the 'fields' argument, or a single 128-bit integer as the 'int' argument. When a string of hex digits is given, curly braces, hyphens, and a URN prefix are all optional. For example, these expressions all yield the same UUID: UUID('{12345678-1234-5678-1234-567812345678}') UUID('12345678123456781234567812345678') UUID('urn:uuid:12345678-1234-5678-1234-567812345678') UUID(bytes='\x12\x34\x56\x78'*4) UUID(bytes_le='\x78\x56\x34\x12\x34\x12\x78\x56' + '\x12\x34\x56\x78\x12\x34\x56\x78') UUID(fields=(0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x567812345678)) UUID(int=0x12345678123456781234567812345678) Exactly one of 'hex', 'bytes', 'bytes_le', 'fields', or 'int' must be given. The 'version' argument is optional; if given, the resulting UUID will have its variant and version set according to RFC 4122, overriding the given 'hex', 'bytes', 'bytes_le', 'fields', or 'int'. NzGone of the hex, bytes, bytes_le, fields, or int arguments must be givenzurn:zuuid:z{}- z$badly formed hexadecimal UUID stringz bytes_le is not a 16-char stringzbytes is not a 16-char stringbig) byteorderzfields is not a 6-tuplerz*field 1 out of range (need a 32-bit value)z*field 2 out of range (need a 16-bit value)z*field 3 out of range (need a 16-bit value)z*field 4 out of range (need an 8-bit value)z*field 5 out of range (need an 8-bit value)0z*field 6 out of range (need a 48-bit value)`P@z*int is out of range (need a 128-bit value)zillegal version numberiiiLintrrrrrliirll l lll) count TypeErrorreplacestriplen ValueErrorint_ from_bytes__dict__)selfhexbytesbytes_lefieldsrversiontime_lowtime_midtime_hi_versionclock_seq_hi_variant clock_seq_lownode clock_seqr//usr/lib64/python3.6/uuid.py__init__jsZ   6    $    z UUID.__init__cCst|tr|j|jkStS)N) isinstancerrNotImplemented)r"otherr/r/r0__eq__s  z UUID.__eq__cCst|tr|j|jkStS)N)r2rrr3)r"r4r/r/r0__lt__s  z UUID.__lt__cCst|tr|j|jkStS)N)r2rrr3)r"r4r/r/r0__gt__s  z UUID.__gt__cCst|tr|j|jkStS)N)r2rrr3)r"r4r/r/r0__le__s  z UUID.__le__cCst|tr|j|jkStS)N)r2rrr3)r"r4r/r/r0__ge__s  z UUID.__ge__cCs t|jS)N)hashr)r"r/r/r0__hash__sz UUID.__hash__cCs|jS)N)r)r"r/r/r0__int__sz UUID.__int__cCsd|jjt|fS)Nz%s(%r)) __class____name__str)r"r/r/r0__repr__sz UUID.__repr__cCs tddS)NzUUID objects are immutable)r)r"namevaluer/r/r0 __setattr__szUUID.__setattr__cCsDd|j}d|dd|dd|dd|dd|ddfS)Nz%032xz%s-%s-%s-%s-%sr r)r)r"r#r/r/r0__str__s z UUID.__str__cCs|jjddS)Nrr )rto_bytes)r"r/r/r0r$sz UUID.bytescCs<|j}|ddd|ddd |d d d |ddS) Nrrr r rrrrrrrr)r$)r"r$r/r/r0r%s(z UUID.bytes_lecCs|j|j|j|j|j|jfS)N)r(r)r*r+r,r-)r"r/r/r0r&s z UUID.fieldscCs |jd?S)Nr)r)r"r/r/r0r(sz UUID.time_lowcCs|jd?d@S)Nri)r)r"r/r/r0r)sz UUID.time_midcCs|jd?d@S)Nri)r)r"r/r/r0r*szUUID.time_hi_versioncCs|jd?d@S)N8)r)r"r/r/r0r+szUUID.clock_seq_hi_variantcCs|jd?d@S)Nr rI)r)r"r/r/r0r,szUUID.clock_seq_lowcCs|jd@d>|jd>B|jBS)Nir r)r*r)r()r"r/r/r0time sz UUID.timecCs|jd@d>|jBS)N?r )r+r,)r"r/r/r0r.s zUUID.clock_seqcCs |jd@S)Nl)r)r"r/r/r0r-sz UUID.nodecCs d|jS)Nz%032x)r)r"r/r/r0r#szUUID.hexcCs dt|S)Nz urn:uuid:)r?)r"r/r/r0urnszUUID.urncCs2|jd@stS|jd@stS|jd@s*tStSdS)Nir i@i lll)r RESERVED_NCSRFC_4122RESERVED_MICROSOFTRESERVED_FUTURE)r"r/r/r0variant s   z UUID.variantcCs |jtkrt|jd?d@SdS)Nr)rQrNr)r"r/r/r0r'+s z UUID.version)NNNNNN)r> __module__ __qualname____doc__r1r5r6r7r8r9r;r<r@rCrFpropertyr$r%r&r(r)r*r+r,rJr.r-r#rLrQr'r/r/r/r0r:s8. O              rc Gsddl}ddl}ddl}|j|}|dkrP|jjd}|j||d}|dkrPdSt|j}d|d<|j|f||j |j |d}|S) Nr/sbin /usr/sbin)pathCLC_ALL)stdoutstderrenv)rWrX) osshutil subprocessZwhichpathsepjoindictenvironPopenPIPEZDEVNULL) commandargsr_r`ra executablerYr^procr/r/r0_popen1s    rlc Csyt|f|j}|sdS|x|jD]z}|jjj}xdtt|D]T}|||krLy*|||}t|jddd} | r| SWqLt t fk rYqLXqLWq*WWdQRXWnt k rYnXdS)N:r) rlsplitr\lowerrstriprangerrrr IndexErrorOSError) rhriZhw_identifiersZ get_indexrklinewordsiwordmacr/r/r0 _find_macDs$   rzcCs0d }x&d D]}td||d d }|r |Sq Wd S)z5Get the hardware address on Unix by running ifconfig.hwaddretheraddress:lladdrr-a-avZifconfigcSs|dS)Nrr/)rwr/r/r0bsz#_ifconfig_getnode..N)r{r|r}r~)rrr)rz)keywordsriryr/r/r0_ifconfig_getnode]s  rcCs tdddgdd}|r|SdS)z/Get the hardware address on Unix by running ip.Ziplinks link/ethercSs|dS)Nrr/)rwr/r/r0risz_ip_getnode..N)rz)ryr/r/r0 _ip_getnodefsrcCsddl}ddl}y|j|j}Wntk r6dSXtdd|j|gdd}|rZ|Stdd|j|gdd}|r||Stdd|jd|gd d}|r|SdS) z0Get the hardware address on Unix by running arp.rNZarpz-ancSsdS)Nrrr/)rwr/r/r0rvsz_arp_getnode..cSs|dS)Nrr/)rwr/r/r0r{sz(%s)cSs|dS)Nr/)rwr/r/r0rs)r_socketZ gethostbynameZ gethostnamertrzfsencode)r_rZip_addrryr/r/r0 _arp_getnodems rcCstdddgddS)z4Get the hardware address on Unix by running lanscan.Zlanscanz-aislan0cSsdS)Nrr/)rwr/r/r0rsz"_lanscan_getnode..)rzr/r/r/r0_lanscan_getnodesrc"Csytdd}|sdS||jjjj}y|jd}Wntk rNdSXxt|jD]j}yL|jj}||}t|dkr|jddkrt |j ddd }|r|SWqXtt fk rYqXXqXWWdQRXWnt k rYnXdS) z4Get the hardware address on Unix by running netstat.Znetstatz-iaNsAddressrmrrnr) rlr\readlinerqroindexrrrrrrsrt)rkrvrwrurxryr/r/r0_netstat_getnodes,   rc Cs ddl}ddl}ddl}dddg}y:ddl}|jd}|jjj|d|jd|j j dWn YnXx|D]}y$|j |j j |dd g|jd d }Wntk rwpYnX|JxB|jD]8}|jd djj} |jd| rt| jdddSqWWdQRXqpWdS)z||kodknr>tjd}t|tt|jdSddl}t|jd}t|dd}tdk r~|tkr~td}|a|dkrddl }|j d }|d @}|d ?d @}|d ?d@} |d@} |d?d@} |dkrt }t||| | | |fddS)aGenerate a UUID from a host ID, sequence number, and the current time. If 'node' is not given, getnode() is used to obtain the hardware address. If 'clock_seq' is given, it is used as the sequence number; otherwise a random 14-bit sequence number is chosen.Nr)r$rgeAdl@'Hw rlrir irIr rK)r&r') rrrrrrrJr_last_timestamprrr) r-r.rrJZ nanosecondsZ timestamprr(r)r*r,r+r/r/r0uuid1Ds,     rcCs<ddlm}||jt|dddj}t|dddd S) zAGenerate a UUID from the MD5 hash of a namespace UUID and a name.r)md5zutf-8F)ZusedforsecurityNrr)r$r')hashlibrr$digestr) namespacerArrr/r/r0uuid3gs   rcCsttjdddS)zGenerate a random UUID.rr)r$r')rr_urandomr/r/r/r0uuid4psrcCs8ddlm}||jt|dj}t|ddddS)zCGenerate a UUID from the SHA-1 hash of a namespace UUID and a name.r)sha1zutf-8Nrr)r$r')rrr$rr)rrArr:r/r/r0uuid5ts rz$6ba7b810-9dad-11d1-80b4-00c04fd430c8z$6ba7b811-9dad-11d1-80b4-00c04fd430c8z$6ba7b812-9dad-11d1-80b4-00c04fd430c8z$6ba7b814-9dad-11d1-80b4-00c04fd430c8)NN)=rUr_ __author__rMrNrOrPrrr$robjectrrlrzrrrrrrrrrrZ ctypes.utilrZ _libnamesr startswithappendZlibnameZCDLLutilZ find_librarylib ExceptionhasattrrunamereleaserorZrpcrt4getattrrrrrrrrrrrrrZ NAMESPACE_DNSZ NAMESPACE_URLZ NAMESPACE_OIDZNAMESPACE_X500r/r/r/r0-szx "           # _sitebuiltins.cpython-36.opt-2.pyc000064400000005541152462730460013025 0ustar003 \+ @s<ddlZGdddeZGdddeZGdddeZdS)Nc@s&eZdZddZddZdddZdS) QuittercCs||_||_dS)N)nameeof)selfrrr%/usr/lib64/python3.6/_sitebuiltins.py__init__szQuitter.__init__cCsd|j|jfS)NzUse %s() or %s to exit)rr)rrrr__repr__szQuitter.__repr__Nc Cs(ytjjWn YnXt|dS)N)sysstdinclose SystemExit)rcoderrr__call__s zQuitter.__call__)N)__name__ __module__ __qualname__rr rrrrrr src@s6eZdZdZfffddZddZddZdd Zd S) _Printercs4ddl||_||_d|_fdd|D|_dS)Nrcs$g|]}D]}jj||q qSr)pathjoin).0dirfilename)filesosrr (sz%_Printer.__init__..)r_Printer__name_Printer__data_Printer__lines_Printer__filenames)rrdatardirsr)rrrr#s  z_Printer.__init__cCs~|jr dSd}xH|jD]>}y$t|d}|j}WdQRXPWqtk rRYqXqW|sb|j}|jd|_t|j|_dS)Nr ) rr openreadOSErrorrsplitlen_Printer__linecnt)rr!rfprrr__setup,s    z_Printer.__setupcCs8|jt|j|jkr$dj|jSd|jfdSdS)Nr$z!Type %s() to see the full %s text)_Printer__setupr)rMAXLINESrr)rrrrr <s z_Printer.__repr__c Cs|jd}d}xy,x&t|||jD]}t|j|q&WWntk rTPYqX||j7}d}x |dkrt|}|dkrfd}qfW|dkrPqWdS)Nz0Hit Return for more, or q (and Return) to quit: rq)r0r1)r.ranger/printr IndexErrorinput)rpromptlinenoikeyrrrrCs"  z_Printer.__call__N)rrrr/rr.r rrrrrrs  rc@seZdZddZddZdS)_HelpercCsdS)NzHType help() for interactive help, or help(object) for help about object.r)rrrrr bsz_Helper.__repr__cOsddl}|j||S)Nr)pydochelp)rargskwdsr;rrrresz_Helper.__call__N)rrrr rrrrrr:Xs r:)r objectrrr:rrrr s;pstats.cpython-36.opt-1.pyc000064400000052543152462730460011471 0ustar003 \g@sfdZddlZddlZddlZddlZddlZddlmZdgZGdddZ GdddZ dd Z d d Z d d Z ddZddZddZddZedkrbddlZy ddlZWnek rYnXGdddejZeejdkrejdZndZyTeeZx"ejddD]ZejeqWedejdej edejdWne!k r`YnXdS)z3Class for printing reports on profiled python code.N) cmp_to_keyStatsc@seZdZdZddddZddZdd Zd d Zd d ZddZ dBdFdJdNdQdTdWdZd]dbdfdidmdqd!Z d"d#Z d$d%Z d&d'Z d(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zdrd9d:Zd;d<Zd=d>ZdS)sraThis class is used for creating reports from data generated by the Profile class. It is a "friend" of that class, and imports data either by direct access to members of Profile class, or by reading in a dictionary that was emitted (via marshal) from the Profile class. The big change from the previous Profiler (in terms of raw functionality) is that an "add()" method has been provided to combine Stats from several distinct profile runs. Both the constructor and the add() method now take arbitrarily many file names as arguments. All the print methods now take an argument that indicates how many lines to print. If the arg is a floating point number between 0 and 1.0, then it is taken as a decimal percentage of the available lines to be printed (e.g., .1 means print 10% of all available lines). If it is an integer, it is taken to mean the number of lines of data that you wish to have printed. The sort_stats() method now processes some additional options (i.e., in addition to the old -1, 0, 1, or 2 that are respectively interpreted as 'stdname', 'calls', 'time', and 'cumulative'). It takes an arbitrary number of quoted strings to select the sort order. For example sort_stats('time', 'name') sorts on the major key of 'internal function time', and on the minor key of 'the name of the function'. Look at the two tables in sort_stats() and get_sort_arg_defs(self) for more examples. All methods return self, so you can string together commands like: Stats('foo', 'goo').strip_dirs().sort_stats('calls'). print_stats(5).print_callers(5) N)streamcGsF|ptj|_t|sd}n|d}|dd}|j||j|dS)Nr)sysstdoutrleninitadd)selfrargsargr/usr/lib64/python3.6/pstats.py__init__As   zStats.__init__c Csd|_g|_d|_d|_d|_d|_d|_t|_i|_ i|_ |j |y |j Wn8t k rtd|jrx|jdnd|jdYnXdS)NrzInvalid timing data %sr)file) all_calleesfilesfcn_listtotal_tt total_calls prim_calls max_name_lenset top_levelstats sort_arg_dict load_statsget_top_level_stats Exceptionprintr)r r rrrr Ks"  z Stats.initcCs|dkri|_dSt|trxt|d}tj||_WdQRXy"tj|}tj |j d|}Wn YnX|g|_ n t |dr|j |j|_i|_|jstd|j|fdS)Nrbz create_statsz.Cannot create or construct a %r object from %r)r isinstancestropenmarshalloadosstattimeZctimest_mtimerhasattrr$ TypeError __class__)r r fZ file_statsrrrr^s(     zStats.load_statscCsx~|jjD]p\}\}}}}}|j|7_|j|7_|j|7_d|kr\|jj|tt||j kr tt||_ q WdS)Njprofilerprofiler)r2rr3) ritemsrrrrr rfunc_std_stringr)r funcccncttctcallersrrrr ts zStats.get_top_level_statscGs|s|Sxt|D]}t|t|kr.t|}|j|j7_|j|j7_|j|j7_|j|j7_x|jD]}|jj|qvW|j |j kr|j |_ d|_ xJ|j j D]<\}}||j kr|j |}nddddif}t |||j |<qWqW|S)Nr)reversedtyperrrrrrr rrrr4add_func_stats)r arg_listitemr6r+Z old_func_statrrrr ~s(    z Stats.addc Cs(t|d}tj|j|WdQRXdS)z:Write the profile data to a file we know how to load back.wbN)r'r(dumpr)r filenamer1rrr dump_statss zStats.dump_statsr call countcumulative time file name line number function namename/file/linerprimitive call count standard name internal time)callsZncallsZcumtime cumulativerrClinemodulenameZnflZpcallsstdnamer,ZtottimecCs|jszi|_}i}xP|jjD]B\}}|}x4|r`|s8P||krJd||<P|||<|dd}q.Wq Wx|D] }||=qlW|jS)z)Expand all abbreviations that are unique.rNrr)rsort_arg_dict_defaultr4)r dictZbad_listwordtupZfragmentrrrget_sort_arg_defss    zStats.get_sort_arg_defscGs"|sd|_|St|dkrFt|dtrFd dddddddi|dg}|j}f}d|_d}x:|D]2}|||d}|j|||d7_d }qbWg}xB|jjD]4\}\}} } } } |j|| | | f|t ||fqW|j t t |j d g|_} x|D]}| j|d qW|S) NrrrYrTr,rRrUrz, )keyrr)rrr%intr^ sort_typerr4appendr5sortr TupleCompcompare)r ZfieldZ sort_arg_defsZ sort_tupleZ connectorr\Z stats_listr6r7r8r9r:r;rtuplerrr sort_statss2   zStats.sort_statscCs|jr|jj|S)N)rreverse)r rrr reverse_orders zStats.reverse_ordercCs|j}i|_}d}x|jD]\}\}}}}} t|} tt| |krTtt| }i} x | jD]\} } | | t| <qbW| |krt|| ||||| f|| <q||||| f|| <qW|j}t|_}x|D]}|jt|qW||_ d|_ d|_ |S)Nr) rr4func_strip_pathrr5r>rrr rrr)r ZoldstatsZnewstatsrr6r7r8r9r:r;ZnewfuncZ newcallersfunc2callerZold_topZnew_toprrr strip_dirss.    zStats.strip_dirsc Cs||jr dSi|_}xb|jjD]T\}\}}}}}||krBi||<x0|jD]$\}} ||krdi||<| |||<qLWq WdS)N)rrr4) r rr6r7r8r9r:r;rkrlrrr calc_calleess zStats.calc_calleesc Cs|}t|trpytj|}Wn&tjk rB|d|7}||fSXg}x|D]}|jt|rN|j|qNWnzt|}t|t rd|kodknrt ||d}|d|}n2t|t rd|ko|knr|}|d|}t|t|kr|dt|t||f7}||fS)Nz# gg?g?rz6 List reduced from %r to %r due to restriction <%r> ) r%r&recompileerrorsearchr5rbrfloatr`)r ZsellistmsgZnew_listZrexr6countrrreval_print_amounts,    "" zStats.eval_print_amountcCs|j}|jr*|jdd}d|jd}nt|jj}d}x|D]}|j|||\}}qBWt|}|spd|fSt||j d|t|jkrd}x(|D] }tt ||krtt |}qW|d|fS)Nz Ordered by:  z! Random listing order was used r)rrR) rrrartrkeysrwrr"rr5)r Zsel_listwidthZ stat_listruZ selectionrvr6rrrget_print_list2s$  zStats.get_print_listcGsx|jD]}t||jdqW|jr0t|jdd}x"|jD]}t|t||jdqcCs tt|j||d|jd|s2t|jddSt|j}d}x|D]}t|}||} t| tr| \} } } } | | krd| | f}n d| f}d|jdd t |t | t | |f}|d }n$d || t |j |d f}|d }t||||jdd}qHWdS) Nr|)r~r)rrz%d/%dz%dz %s %s %s %srPrRrz %s(%r) %srF) r"r5rrsortedryr%rfrjustrf8r)r rsourceZ call_dictZarrowZclistrr6rXrr8r7r9r:ZsubstatsZ left_widthrrrrs*       zStats.print_call_linecCs"tdd|jdtd|jddS)Nz- ncalls tottime percall cumtime percallr|)r~rzfilename:lineno(function))r)r"r)r rrrrszStats.print_titlecCs|j|\}}}}}t|}||kr4|dt|}t|jdd|jdtt|d|jd|dkrxtdd|jdntt||d|jdtt|d|jd|dkrtd d|jdntt||d|jdtt||jddS) N/ r|)r~rrr})rz z )rr&r"rrrr5)r r6r7r8r9r:r;crrrrszStats.print_linerrrr)rrErrrr)rrErrFrr)rrGrrFrr)rrGrHrr)rrIrHrr)rrIrJrr)rrKrHrr)rrIrLrr)rrMrLrrHrrJrrrr)rrNrrrr)rrOrPrr)rrQrrRrr)rrSrrRrr)rrS)r)__name__ __module__ __qualname____doc__rr rr r rDrZr^rgrirmrnrwr{rrrrrrrrrrrr sF     c@s eZdZdZddZddZdS)rdaThis class provides a generic function for comparing any two tuples. Each instance records a list of tuple-indices (from most significant to least significant), and sort direction (ascending or decending) for each tuple-index. The compare functions can then be used as the function argument to the system sort() function when a list of tuples need to be sorted in the instances order.cCs ||_dS)N)comp_select_list)r rrrrrszTupleComp.__init__cCsBx<|jD]2\}}||}||}||kr.| S||kr|SqWdS)Nr)r)r leftrightindex directionlrrrrreszTupleComp.compareN)rrrrrrerrrrrdsrdcCs|\}}}tjj|||fS)N)r*pathbasename) func_namerCrVrXrrrrjs rjcCs|dS)NrRr)r6rrrrsrcCsN|ddd krB|d}|jdr<|jdrz{%s}rz %s:%d(%s))rrr) startswithendswith)rrXrrrr5s r5c Cs@|\}}}}}|\}}} } } |||||| || t| |fS)z3Add together all the stats for two profile entries.) add_callers) targetrr7r8r9r:r;Zt_ccZt_ncZt_ttZt_ctZ t_callersrrrr>sr>cCsi}x|jD]\}}|||<qWxb|jD]V\}}||krzt|trhtddt|||D||<q|||7<q,|||<q,W|S)z*Combine two caller lists in a single list.cSsg|]}|d|dqS)rrr).0irrr szadd_callers..)r4r%rfzip)rrZ new_callersr6rlrrrrs   rcCs"d}x|jD] }||7}qW|S)z@Sum the caller statistics to get total number of calls received.r)r)r;r8rTrrr count_callss rcCsd|S)Nz%8.3fr)xrrrr sr__main__c@seZdZd6ddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5ZdS)7ProfileBrowserNcCs6tjj|d|_d|_tj|_|dk r2|j|dS)Nz% ) cmdCmdrpromptrrrrdo_read)r profilerrrrs  zProfileBrowser.__init__cCs|j}g}x|D]}y|jt|wWntk r>YnXy8t|}|dksZ|dkrjtd|jdw|j|wWntk rYnX|j|qW|jrt|j||ntd|jddS)Nrrz#Fraction argument must be in [0, 1])rzNo statistics object is loaded.) splitrbr` ValueErrorrsr"rrgetattr)r fnrVr Z processedZtermZfracrrrgeneric"s,  zProfileBrowser.genericcCsXtd|jdtd|jdtd|jdtd|jdtd|jdtd|jddS)NzArguments may be:)rz0* An integer maximum number of entries to print.z:* A decimal fractional number between 0 and 1, controllingz- what fraction of selected entries to print.z8* A regular expression; only entries with function namesz that match it are printed.)r"r)r rrr generic_help:s zProfileBrowser.generic_helpcCsd|jrRy|jj|Wq`tk rN}ztd||f|jdWYdd}~Xq`Xntd|jddS)Nz$Failed to load statistics for %s: %s)rzNo statistics object is loaded.r)rr IOErrorr"r)r rVerrrdo_addBs*zProfileBrowser.do_addcCstd|jddS)Nz>Add profile info from given file to current statistics object.)r)r"r)r rrrhelp_addKszProfileBrowser.help_addcCs |jd|S)Nr)r)r rVrrr do_calleesNszProfileBrowser.do_calleescCstd|jd|jdS)Nz6Print callees statistics from the current stat object.)r)r"rr)r rrr help_calleesPszProfileBrowser.help_calleescCs |jd|S)Nr)r)r rVrrr do_callersTszProfileBrowser.do_callerscCstd|jd|jdS)Nz6Print callers statistics from the current stat object.)r)r"rr)r rrr help_callersVszProfileBrowser.help_callerscCstd|jddS)Nr)rr)r"r)r rVrrrdo_EOFZszProfileBrowser.do_EOFcCstd|jddS)NzLeave the profile brower.)r)r"r)r rrrhelp_EOF]szProfileBrowser.help_EOFcCsdS)Nrr)r rVrrrdo_quit`szProfileBrowser.do_quitcCstd|jddS)NzLeave the profile brower.)r)r"r)r rrr help_quitbszProfileBrowser.help_quitcCs|ryt||_Wnjtk rF}zt|jd|jddSd}~Xn8tk r|}zt|jjd||jddSd}~XnX|d|_ n6t |j dkr|j dd}|j |ntd|jddS) Nr)r:z% rRz1No statistics object is current -- cannot reload.r) rrOSErrorr"r rr!r0rrrr)r rVerrrrrres  zProfileBrowser.do_readcCs td|jdtd|jddS)Nz+Read in profile data from a specified file.)rz*Without argument, reload the current file.)r"r)r rrr help_readvszProfileBrowser.help_readcCs$|jr|jjntd|jddS)NzNo statistics object is loaded.)rr)rrir"r)r rVrrr do_reversezs zProfileBrowser.do_reversecCstd|jddS)Nz/Reverse the sort order of the profiling report.)r)r"r)r rrr help_reverseszProfileBrowser.help_reversecs|jstd|jddS|jj|rRtfdd|jDrR|jj|jn@td|jdx0tjj D]"\}}td||df|jdqlWdS) NzNo statistics object is loaded.)rc3s|]}|kVqdS)Nr)rr)abbrevsrr sz)ProfileBrowser.do_sort..z/Valid sort keys (unique prefixes are accepted):z%s -- %srr) rr"rr^allrrgrrZr4)r rVr_rr)rrdo_sorts zProfileBrowser.do_sortcCs td|jdtd|jddS)Nz.Sort profile data according to specified keys.)rz3(Typing `sort' without arguments lists valid keys.))r"r)r rrr help_sortszProfileBrowser.help_sortcsfddtjDS)Ncsg|]}|jr|qSr)r)ra)textrrrsz0ProfileBrowser.complete_sort..)rrZ)r rr r)rr complete_sortszProfileBrowser.complete_sortcCs |jd|S)Nr)r)r rVrrrdo_statsszProfileBrowser.do_statscCstd|jd|jdS)Nz.Print statistics from the current stat object.)r)r"rr)r rrr help_statsszProfileBrowser.help_statscCs$|jr|jjntd|jddS)NzNo statistics object is loaded.)r)rrmr"r)r rVrrrdo_strips zProfileBrowser.do_stripcCstd|jddS)Nzrrrrrreadline ImportErrorrrrargvZ initprofileZbrowserrrr"rZcmdloopKeyboardInterruptrrrrsN     selectors.cpython-36.opt-1.pyc000064400000042443152462730460012154 0ustar003 \K@sdZddlmZmZddlmZmZddlZddlZddl Z d)Z d*Z ddZ edd d d d gZ d e _e jd+krde j_de j_de j_de j_GdddeZGdddedZGdddeZGdddeZeedrGdddeZeed rGd!d"d"eZeed#r"Gd$d%d%eZeed&r>Gd'd(d(eZd(ekrPeZn:d"ekrbeZn(d%ekrteZndekreZneZdS),z|Selectors module. This module allows high-level and efficient I/O multiplexing, built upon the `select` module primitives. )ABCMetaabstractmethod) namedtupleMappingNc Csft|tr|}nsz_SelectorMapping.__init__cCs t|jjS)N)lenr _fd_to_key)rrrr__len__Asz_SelectorMapping.__len__c CsBy|jj|}|jj|Stk r<tdj|dYnXdS)Nz{!r} is not registered)r_fileobj_lookuprKeyErrorr )rrrrrr __getitem__Ds   z_SelectorMapping.__getitem__cCs t|jjS)N)iterrr)rrrr__iter__Ksz_SelectorMapping.__iter__N)__name__ __module__ __qualname____doc__rrr!r#rrrrr;s rc@sneZdZdZedddZeddZdddZedd d Zd d Z d dZ eddZ ddZ ddZ dS) BaseSelectora-Selector abstract base class. A selector supports registering file objects to be monitored for specific I/O events. A file object is a file descriptor or any object with a `fileno()` method. An arbitrary object can be attached to the file object, which can be used for example to store context information, a callback, etc. A selector can use various implementations (select(), poll(), epoll()...) depending on the platform. The default `Selector` class uses the most efficient implementation on the current platform. NcCstdS)a3Register a file object. Parameters: fileobj -- file object or file descriptor events -- events to monitor (bitwise mask of EVENT_READ|EVENT_WRITE) data -- attached data Returns: SelectorKey instance Raises: ValueError if events is invalid KeyError if fileobj is already registered OSError if fileobj is closed or otherwise is unacceptable to the underlying system call (if a system call is made) Note: OSError may or may not be raised N)NotImplementedError)rrrrrrrregister^szBaseSelector.registercCstdS)ajUnregister a file object. Parameters: fileobj -- file object or file descriptor Returns: SelectorKey instance Raises: KeyError if fileobj is not registered Note: If fileobj is registered but has since been closed this does *not* raise OSError (even if the wrapped syscall does) N)r))rrrrr unregisteruszBaseSelector.unregistercCs|j||j|||S)ayChange a registered file object monitored events or attached data. Parameters: fileobj -- file object or file descriptor events -- events to monitor (bitwise mask of EVENT_READ|EVENT_WRITE) data -- attached data Returns: SelectorKey instance Raises: Anything that unregister() or register() raises )r+r*)rrrrrrrmodifys zBaseSelector.modifycCstdS)aqPerform the actual selection, until some monitored file objects are ready or a timeout expires. Parameters: timeout -- if timeout > 0, this specifies the maximum wait time, in seconds if timeout <= 0, the select() call won't block, and will report the currently ready file objects if timeout is None, select() will block until a monitored file object becomes ready Returns: list of (key, events) for ready file objects `events` is a bitwise mask of EVENT_READ|EVENT_WRITE N)r))rtimeoutrrrselectszBaseSelector.selectcCsdS)zmClose the selector. This must be called to make sure that any underlying resource is freed. Nr)rrrrcloseszBaseSelector.closec CsJ|j}|dkrtdy||Stk rDtdj|dYnXdS)zzReturn the key associated to a registered file object. Returns: SelectorKey for this file object NzSelector is closedz{!r} is not registered)get_map RuntimeErrorr r )rrmappingrrrget_keyszBaseSelector.get_keycCstdS)z2Return a mapping of file objects to selector keys.N)r))rrrrr0szBaseSelector.get_mapcCs|S)Nr)rrrr __enter__szBaseSelector.__enter__cGs |jdS)N)r/)rargsrrr__exit__szBaseSelector.__exit__)N)N)N)r$r%r&r'rr*r+r,r.r/r3r0r4r6rrrrr(Os      r() metaclassc@sTeZdZdZddZddZdddZd d Zdd d Zd dZ ddZ ddZ dS)_BaseSelectorImplzBase selector implementation.cCsi|_t||_dS)N)rr_map)rrrrrsz_BaseSelectorImpl.__init__c CsHyt|Stk rBx"|jjD]}|j|kr$|jSq$WYnXdS)alReturn a file descriptor from a file object. This wraps _fileobj_to_fd() to do an exhaustive search in case the object is invalid but we still have it in our map. This is used by unregister() so we can unregister an object that was previously registered even if it is closed. It is also used by _SelectorMapping. N)rr rvaluesrr)rrkeyrrrrs   z!_BaseSelectorImpl._fileobj_lookupNcCsd| s|ttB@r"tdj|t||j|||}|j|jkrTtdj||j||j|j<|S)NzInvalid events: {!r}z"{!r} (FD {}) is already registered) EVENT_READ EVENT_WRITEr r rrrrr )rrrrr;rrrr*s   z_BaseSelectorImpl.registerc Cs@y|jj|j|}Wn$tk r:tdj|dYnX|S)Nz{!r} is not registered)rpoprr r )rrr;rrrr+s z_BaseSelectorImpl.unregisterc Csy|j|j|}Wn$tk r8tdj|dYnX||jkr^|j||j|||}n"||jkr|j|d}||j|j <|S)Nz{!r} is not registered)r) rrr r rr+r*r_replacer)rrrrr;rrrr,s     z_BaseSelectorImpl.modifycCs|jjd|_dS)N)rclearr9)rrrrr/ s z_BaseSelectorImpl.closecCs|jS)N)r9)rrrrr0sz_BaseSelectorImpl.get_mapc Cs$y |j|Stk rdSXdS)zReturn the key associated to a given file descriptor. Parameters: fd -- file descriptor Returns: corresponding key, or None if not found N)rr )rrrrr _key_from_fds  z_BaseSelectorImpl._key_from_fd)N)N) r$r%r&r'rrr*r+r,r/r0rArrrrr8s  r8cs`eZdZdZfddZdfdd ZfddZejd krHdd d Z ne j Z dd d Z Z S)SelectSelectorzSelect-based selector.cstjt|_t|_dS)N)superrset_readers_writers)r) __class__rrr%s zSelectSelector.__init__Ncs@tj|||}|t@r&|jj|j|t@r<|jj|j|S)N)rCr*r<rEaddrr=rF)rrrrr;)rGrrr**s zSelectSelector.registercs,tj|}|jj|j|jj|j|S)N)rCr+rEdiscardrrF)rrr;)rGrrr+2s zSelectSelector.unregisterZwin32cCs$tj||||\}}}|||gfS)N)r.)rrw_r-xrrr_select9szSelectSelector._selectc Cs|dkr dnt|d}g}y|j|j|jg|\}}}Wntk rL|SXt|}t|}xV||BD]J}d}||kr|tO}||kr|tO}|j|}|rh|j |||j @fqhW|S)Nr) maxrNrErFInterruptedErrorrDr<r=rAappendr) rr-readyrJrKrLrrr;rrrr.?s$ zSelectSelector.select)N)N)N) r$r%r&r'rr*r+sysplatformrNr. __classcell__rr)rGrrB"s    rBpollcsDeZdZdZfddZd fdd ZfddZd d d ZZS) PollSelectorzPoll-based selector.cstjtj|_dS)N)rCrr.rV_poll)r)rGrrrZs zPollSelector.__init__NcsLtj|||}d}|t@r&|tjO}|t@r8|tjO}|jj|j||S)Nr) rCr*r<r.POLLINr=POLLOUTrXr)rrrrr; poll_events)rGrrr*^s  zPollSelector.registercstj|}|jj|j|S)N)rCr+rXr)rrr;)rGrrr+hs zPollSelector.unregisterc Cs|dkrd}n|dkrd}ntj|d}g}y|jj|}Wntk rR|SXx^|D]V\}}d}|tj@rz|tO}|tj@r|t O}|j |}|rZ|j |||j @fqZW|S)Nrg@@) mathceilrXrVrPr.rYr=rZr<rArQr)rr-rR fd_event_listreventrr;rrrr.ms(   zPollSelector.select)N)N) r$r%r&r'rr*r+r.rUrr)rGrrWWs   rWepollcsXeZdZdZfddZddZdfdd Zfd d Zdd d Zfd dZ Z S) EpollSelectorzEpoll-based selector.cstjtj|_dS)N)rCrr.r`_epoll)r)rGrrrs zEpollSelector.__init__cCs |jjS)N)rbr )rrrrr szEpollSelector.filenoNc sttj|||}d}|t@r&|tjO}|t@r8|tjO}y|jj|j|Wn"t k rntj |YnX|S)Nr) rCr*r<r.EPOLLINr=EPOLLOUTrbr BaseExceptionr+)rrrrr;Z epoll_events)rGrrr*s   zEpollSelector.registerc s8tj|}y|jj|jWntk r2YnX|S)N)rCr+rbrOSError)rrr;)rGrrr+s  zEpollSelector.unregisterc Cs|dkrd}n |dkrd}ntj|dd}tt|jd}g}y|jj||}Wntk rh|SXx^|D]V\}}d}|tj @r|t O}|tj @r|t O}|j |}|rp|j|||j@fqpW|S)Nrrg@@gMbP?)r\r]rOrrrbrVrPr.rcr=rdr<rArQr) rr-max_evrRr^rr_rr;rrrr.s*   zEpollSelector.selectcs|jjtjdS)N)rbr/rC)r)rGrrr/s zEpollSelector.close)N)N) r$r%r&r'rr r*r+r.r/rUrr)rGrras  radevpollcsXeZdZdZfddZddZdfdd Zfd d Zdd d Zfd dZ Z S)DevpollSelectorzSolaris /dev/poll selector.cstjtj|_dS)N)rCrr.ri_devpoll)r)rGrrrs zDevpollSelector.__init__cCs |jjS)N)rkr )rrrrr szDevpollSelector.filenoNcsLtj|||}d}|t@r&|tjO}|t@r8|tjO}|jj|j||S)Nr) rCr*r<r.rYr=rZrkr)rrrrr;r[)rGrrr*s  zDevpollSelector.registercstj|}|jj|j|S)N)rCr+rkr)rrr;)rGrrr+s zDevpollSelector.unregisterc Cs|dkrd}n|dkrd}ntj|d}g}y|jj|}Wntk rR|SXx^|D]V\}}d}|tj@rz|tO}|tj@r|t O}|j |}|rZ|j |||j @fqZW|S)Nrg@@) r\r]rkrVrPr.rYr=rZr<rArQr)rr-rRr^rr_rr;rrrr.s(   zDevpollSelector.selectcs|jjtjdS)N)rkr/rC)r)rGrrr/s zDevpollSelector.close)N)N) r$r%r&r'rr r*r+r.r/rUrr)rGrrjs   rjkqueuecsXeZdZdZfddZddZdfdd Zfd d Zdd d Zfd dZ Z S)KqueueSelectorzKqueue-based selector.cstjtj|_dS)N)rCrr.rl_kqueue)r)rGrrrs zKqueueSelector.__init__cCs |jjS)N)rnr )rrrrr szKqueueSelector.filenoNc stj|||}y`|t@r@tj|jtjtj}|jj |gdd|t @rntj|jtj tj}|jj |gddWn"t k rtj |YnX|S)Nr)rCr*r<r.keventrKQ_FILTER_READZ KQ_EV_ADDrncontrolr=KQ_FILTER_WRITErer+)rrrrr;kev)rGrrr*s   zKqueueSelector.registercstj|}|jt@rVtj|jtjtj}y|j j |gddWnt k rTYnX|jt @rtj|jtj tj}y|j j |gddWnt k rYnX|S)Nr)rCr+rr<r.rorrpZ KQ_EV_DELETErnrqrfr=rr)rrr;rs)rGrrr+'s      zKqueueSelector.unregisterc Cs|dkr dnt|d}t|j}g}y|jjd||}Wntk rL|SXxb|D]Z}|j}|j}d}|tj krz|t O}|tj kr|t O}|j |} | rT|j| || j@fqTW|S)Nr)rOrrrnrqrPZidentfilterr.rpr<rrr=rArQr) rr-rhrRZkev_listrsrflagrr;rrrr.<s&     zKqueueSelector.selectcs|jjtjdS)N)rnr/rC)r)rGrrr/Rs zKqueueSelector.close)N)N) r$r%r&r'rr r*r+r.r/rUrr)rGrrm s   rmr)rr)r'abcrr collectionsrrr\r.rSr<r=rr version_inforrrrrr(r8rBhasattrrWrarjrmglobalsZDefaultSelectorrrrrsH ~U3 1 G 8 M    _collections_abc.cpython-36.opt-2.pyc000064400000056137152462730460013441 0ustar003 \g@snddlmZmZddlZddddddd d d d d ddddddddddddddgZdZeedZeee Z eeij Z eeij ZeeijZeegZeeegZeeedZeeedd>ZeeeZeed ZeefZeeeZeij Zeij ZeijZeej Z!ed!d"Z"d#d$Z#e#Z#ee#Z$e#j%[#d%d&Z&e&Z&ee&Z'[&d'd(Z(Gd)dded*Z)Gd+dded*Z*Gd,dde*Z+e+j,e$Gd-dded*Z-Gd.dde-Z.Gd/dde.Z/e/j,e'Gd0d d ed*Z0Gd1d d e0Z1e1j,ee1j,e e1j,e e1j,ee1j,ee1j,ee1j,ee1j,ee1j,ee1j,ee1j,ee1j,ee1j,eGd2d d e0Z2Gd3d d e1Z3e3j,e"Gd4d d ed*Z4Gd5dded*Z5Gd6dde4e0e5Z6Gd7dded*Z7Gd8dde6Z8e8j,e9Gd9dde8Z:e:j,eGd:dde6Z;e;j,e!Gd;dde4Ze>j,eGd>dde<Z?e?j,eGd?dde;Z@e@j,eAGd@dde2e6ZBeBj,eCeBj,eDeBj,eeBj,eEGdAddeBZFeFj,eGeFj,e GdBddeBZHeHj,eIeHj,e dS)C)ABCMetaabstractmethodN Awaitable Coroutine AsyncIterable AsyncIteratorAsyncGeneratorHashableIterableIterator Generator ReversibleSized ContainerCallable CollectionSet MutableSetMappingMutableMapping MappingViewKeysView ItemsView ValuesViewSequenceMutableSequence ByteStringzcollections.abciccsdVS)Nr r r (/usr/lib64/python3.6/_collections_abc.py8sr"csdS)Nr r r r r!_coro:sr#cCs dVdS)Nr r r r r!_ag@sr$cGsH|j}x<|D]4}x.|D]"}||jkr|j|dkr6tSPqWtSq WdS)NT)__mro____dict__NotImplemented)CmethodsmromethodBr r r!_check_methodsHs   r-c@s(eZdZfZeddZeddZdS)r cCsdS)Nrr )selfr r r!__hash__XszHashable.__hash__cCs|tkrt|dStS)Nr/)r r-r')clsr(r r r!__subclasshook__\s zHashable.__subclasshook__N)__name__ __module__ __qualname__ __slots__rr/ classmethodr1r r r r!r Ts ) metaclassc@s(eZdZfZeddZeddZdS)rccs dVdS)Nr )r.r r r! __await__gszAwaitable.__await__cCs|tkrt|dStS)Nr8)rr-r')r0r(r r r!r1ks zAwaitable.__subclasshook__N)r2r3r4r5rr8r6r1r r r r!rcs c@s>eZdZfZeddZed ddZddZedd Z dS) rcCstdS)N) StopIteration)r.valuer r r!sendvszCoroutine.sendNcCs4|dkr|dkr||}|dk r,|j|}|dS)N)with_traceback)r.typvaltbr r r!throw}s zCoroutine.throwc Cs4y|jtWnttfk r&Yn XtddS)Nzcoroutine ignored GeneratorExit)r@ GeneratorExitr9 RuntimeError)r.r r r!closes zCoroutine.closecCs|tkrt|ddddStS)Nr8r;r@rC)rr-r')r0r(r r r!r1szCoroutine.__subclasshook__)NN) r2r3r4r5rr;r@rCr6r1r r r r!rrs    c@s(eZdZfZeddZeddZdS)rcCstS)N)r)r.r r r! __aiter__szAsyncIterable.__aiter__cCs|tkrt|dStS)NrD)rr-r')r0r(r r r!r1s zAsyncIterable.__subclasshook__N)r2r3r4r5rrDr6r1r r r r!rs c@s0eZdZfZeddZddZeddZdS)rcstdS)N)StopAsyncIteration)r.r r r! __anext__szAsyncIterator.__anext__cCs|S)Nr )r.r r r!rDszAsyncIterator.__aiter__cCs|tkrt|ddStS)NrFrD)rr-r')r0r(r r r!r1s zAsyncIterator.__subclasshook__N) r2r3r4r5rrFrDr6r1r r r r!rs c@sFeZdZfZddZeddZed ddZdd Ze d d Z dS) rcs|jdIdHS)N)asend)r.r r r!rFszAsyncGenerator.__anext__cstdS)N)rE)r.r:r r r!rGszAsyncGenerator.asendNcs4|dkr|dkr||}|dk r,|j|}|dS)N)r<)r.r=r>r?r r r!athrows zAsyncGenerator.athrowc s:y|jtIdHWnttfk r,Yn XtddS)Nz,asynchronous generator ignored GeneratorExit)rHrArErB)r.r r r!acloses zAsyncGenerator.aclosecCs|tkrt|dddddStS)NrDrFrGrHrI)rr-r')r0r(r r r!r1s zAsyncGenerator.__subclasshook__)NN) r2r3r4r5rFrrGrHrIr6r1r r r r!rs   c@s(eZdZfZeddZeddZdS)r ccsdS)Nr )r.r r r!__iter__szIterable.__iter__cCs|tkrt|dStS)NrJ)r r-r')r0r(r r r!r1s zIterable.__subclasshook__N)r2r3r4r5rrJr6r1r r r r!r s c@s0eZdZfZeddZddZeddZdS)r cCstdS)N)r9)r.r r r!__next__szIterator.__next__cCs|S)Nr )r.r r r!rJ szIterator.__iter__cCs|tkrt|ddStS)NrJrK)r r-r')r0r(r r r!r1s zIterator.__subclasshook__N) r2r3r4r5rrKrJr6r1r r r r!r s c@s(eZdZfZeddZeddZdS)r ccsdS)Nr )r.r r r! __reversed__)szReversible.__reversed__cCs|tkrt|ddStS)NrLrJ)r r-r')r0r(r r r!r1.s zReversible.__subclasshook__N)r2r3r4r5rrLr6r1r r r r!r %s c@sFeZdZfZddZeddZed ddZdd Ze d d Z dS) r cCs |jdS)N)r;)r.r r r!rK9szGenerator.__next__cCstdS)N)r9)r.r:r r r!r;?szGenerator.sendNcCs4|dkr|dkr||}|dk r,|j|}|dS)N)r<)r.r=r>r?r r r!r@Fs zGenerator.throwc Cs4y|jtWnttfk r&Yn XtddS)Nzgenerator ignored GeneratorExit)r@rAr9rB)r.r r r!rCSs zGenerator.closecCs|tkrt|dddddStS)NrJrKr;r@rC)r r-r')r0r(r r r!r1]s zGenerator.__subclasshook__)NN) r2r3r4r5rKrr;r@rCr6r1r r r r!r 5s   c@s(eZdZfZeddZeddZdS)rcCsdS)Nrr )r.r r r!__len__ksz Sized.__len__cCs|tkrt|dStS)NrM)rr-r')r0r(r r r!r1os zSized.__subclasshook__N)r2r3r4r5rrMr6r1r r r r!rgs c@s(eZdZfZeddZeddZdS)rcCsdS)NFr )r.xr r r! __contains__zszContainer.__contains__cCs|tkrt|dStS)NrO)rr-r')r0r(r r r!r1~s zContainer.__subclasshook__N)r2r3r4r5rrOr6r1r r r r!rvs c@seZdZfZeddZdS)rcCs|tkrt|dddStS)NrMrJrO)rr-r')r0r(r r r!r1szCollection.__subclasshook__N)r2r3r4r5r6r1r r r r!rsc@s(eZdZfZeddZeddZdS)rcOsdS)NFr )r.argskwdsr r r!__call__szCallable.__call__cCs|tkrt|dStS)NrR)rr-r')r0r(r r r!r1s zCallable.__subclasshook__N)r2r3r4r5rrRr6r1r r r r!rs c@seZdZfZddZddZddZddZd d Ze d d Z d dZ e Z ddZ ddZeZddZddZddZeZddZdS)rcCs@t|tstSt|t|kr"dSx|D]}||kr(dSq(WdS)NFT) isinstancerr'len)r.otherelemr r r!__le__s  z Set.__le__cCs(t|tstSt|t|ko&|j|S)N)rSrr'rTrW)r.rUr r r!__lt__s z Set.__lt__cCs(t|tstSt|t|ko&|j|S)N)rSrr'rT__ge__)r.rUr r r!__gt__s z Set.__gt__cCs@t|tstSt|t|kr"dSx|D]}||kr(dSq(WdS)NFT)rSrr'rT)r.rUrVr r r!rYs  z Set.__ge__cCs(t|tstSt|t|ko&|j|S)N)rSrr'rTrW)r.rUr r r!__eq__s z Set.__eq__cCs||S)Nr )r0itr r r!_from_iterableszSet._from_iterablecs&t|tstSjfdd|DS)Nc3s|]}|kr|VqdS)Nr ).0r:)r.r r! szSet.__and__..)rSr r'r])r.rUr )r.r!__and__s z Set.__and__cCsx|D]}||krdSqWdS)NFTr )r.rUr:r r r! isdisjoints zSet.isdisjointcCs*t|tstSdd||fD}|j|S)Ncss|]}|D] }|Vq qdS)Nr )r^ser r r!r_szSet.__or__..)rSr r'r])r.rUchainr r r!__or__s z Set.__or__cs:tts"ttstS|j|jfdd|DS)Nc3s|]}|kr|VqdS)Nr )r^r:)rUr r!r_szSet.__sub__..)rSrr r'r])r.rUr )rUr!__sub__s    z Set.__sub__cs:t|ts"t|tstSj|}jfdd|DS)Nc3s|]}|kr|VqdS)Nr )r^r:)r.r r!r_szSet.__rsub__..)rSrr r'r])r.rUr )r.r!__rsub__s    z Set.__rsub__cCs2t|ts"t|tstS|j|}||||BS)N)rSrr r'r])r.rUr r r!__xor__s    z Set.__xor__cCstj}d|d}t|}d|d}||M}x4|D],}t|}|||d>AdAdN}||M}q4W|dd}||M}||kr||d8}|d krd }|S) NriMriM[l4~2i i6i8#)sysmaxsizerThash)r.MAXMASKnhrNhxr r r!_hash s       z Set._hashN)r2r3r4r5rWrXrZrYr[r6r]r`__rand__rare__ror__rfrgrh__rxor__rtr r r r!rs"    c@s`eZdZfZeddZeddZddZddZd d Z d d Z d dZ ddZ ddZ dS)rcCstdS)N)NotImplementedError)r.r:r r r!add:szMutableSet.addcCstdS)N)rx)r.r:r r r!discard?szMutableSet.discardcCs||krt||j|dS)N)KeyErrorrz)r.r:r r r!removeDszMutableSet.removec Cs<t|}y t|}Wntk r,tYnX|j||S)N)iternextr9r{rz)r.r\r:r r r!popJs   zMutableSet.popc Cs,yx |jqWWntk r&YnXdS)N)rr{)r.r r r!clearTs zMutableSet.clearcCsx|D]}|j|qW|S)N)ry)r.r\r:r r r!__ior__\s zMutableSet.__ior__cCs x||D]}|j|q W|S)N)rz)r.r\r:r r r!__iand__aszMutableSet.__iand__cCsV||kr|jn@t|ts&|j|}x*|D]"}||krD|j|q,|j|q,W|S)N)rrSrr]rzry)r.r\r:r r r!__ixor__fs     zMutableSet.__ixor__cCs.||kr|jnx|D]}|j|qW|S)N)rrz)r.r\r:r r r!__isub__ss   zMutableSet.__isub__N)r2r3r4r5rryrzr|rrrrrrr r r r!r,s     c@sReZdZfZeddZdddZddZdd Zd d Z d d Z ddZ dZ dS)rcCstdS)N)r{)r.keyr r r! __getitem__szMapping.__getitem__Nc Cs"y||Stk r|SXdS)N)r{)r.rdefaultr r r!getsz Mapping.getc Cs*y ||Wntk r dSXdSdS)NFT)r{)r.rr r r!rOs  zMapping.__contains__cCst|S)N)r)r.r r r!keyssz Mapping.keyscCst|S)N)r)r.r r r!itemssz Mapping.itemscCst|S)N)r)r.r r r!valuesszMapping.valuescCs&t|tstSt|jt|jkS)N)rSrr'dictr)r.rUr r r!r[s zMapping.__eq__)N) r2r3r4r5rrrrOrrrr[rLr r r r!rs  c@s(eZdZd ZddZddZddZdS) r_mappingcCs ||_dS)N)r)r.mappingr r r!__init__szMappingView.__init__cCs t|jS)N)rTr)r.r r r!rMszMappingView.__len__cCs dj|S)Nz&{0.__class__.__name__}({0._mapping!r}))format)r.r r r!__repr__szMappingView.__repr__N)r)r2r3r4r5rrMrr r r r!rsc@s,eZdZfZeddZddZddZdS)rcCst|S)N)set)r.r\r r r!r]szKeysView._from_iterablecCs ||jkS)N)r)r.rr r r!rOszKeysView.__contains__ccs|jEdHdS)N)r)r.r r r!rJszKeysView.__iter__N)r2r3r4r5r6r]rOrJr r r r!rs c@s,eZdZfZeddZddZddZdS)rcCst|S)N)r)r.r\r r r!r]szItemsView._from_iterablec Cs@|\}}y|j|}Wntk r*dSX||kp:||kSdS)NF)rr{)r.itemrr:vr r r!rOs zItemsView.__contains__ccs$x|jD]}||j|fVqWdS)N)r)r.rr r r!rJs zItemsView.__iter__N)r2r3r4r5r6r]rOrJr r r r!rs  c@s eZdZfZddZddZdS)rcCs2x,|jD]"}|j|}||ks&||krdSqWdS)NTF)r)r.r:rrr r r!rOs   zValuesView.__contains__ccs x|jD]}|j|VqWdS)N)r)r.rr r r!rJs zValuesView.__iter__N)r2r3r4r5rOrJr r r r!rsc@s\eZdZfZeddZeddZeZefddZ ddZ d d Z d d Z dddZ d S)rcCstdS)N)r{)r.rr:r r r! __setitem__ szMutableMapping.__setitem__cCstdS)N)r{)r.rr r r! __delitem__szMutableMapping.__delitem__c Cs<y ||}Wn tk r,||jkr(|SX||=|SdS)N)r{_MutableMapping__marker)r.rrr:r r r!rs  zMutableMapping.popc Cs@ytt|}Wntk r(tYnX||}||=||fS)N)r~r}r9r{)r.rr:r r r!popitem$s zMutableMapping.popitemc Cs,yx |jqWWntk r&YnXdS)N)rr{)r.r r r!r0s zMutableMapping.clearcOs|s td|^}}t|dkr0tdt||r|d}t|trbx^|D]}||||<qLWnDt|drx8|jD]}||||<qvWnx|D]\}}|||<qWx|jD]\}}|||<qWdS)Nz@descriptor 'update' of 'MutableMapping' object needs an argumentrz+update expected at most 1 arguments, got %drr) TypeErrorrTrSrhasattrrr)rPrQr.rUrr:r r r!update8s$      zMutableMapping.updateNc Cs*y||Stk r$|||<YnX|S)N)r{)r.rrr r r! setdefaultSs zMutableMapping.setdefault)N)r2r3r4r5rrrobjectrrrrrrr r r r!rs    c@sFeZdZfZeddZddZddZddZdd d Z d dZ d S)rcCstdS)N) IndexError)r.indexr r r!rkszSequence.__getitem__c cs>d}y x||}|V|d7}qWWntk r8dSXdS)Nrr)r)r.irr r r!rJoszSequence.__iter__cCs&x |D]}||ks||krdSqWdS)NTFr )r.r:rr r r!rOys zSequence.__contains__ccs(x"ttt|D]}||VqWdS)N)reversedrangerT)r.rr r r!rLszSequence.__reversed__rNc Cs|dk r"|dkr"tt||d}|dk r>|dkr>|t|7}|}xT|dksT||kry ||}||ksn||krr|SWntk rPYnX|d7}qDWtdS)Nrr)maxrTr ValueError)r.r:startstoprrr r r!rs  zSequence.indexcstfdd|DS)Nc3s"|]}|ks|krdVqdS)rNr )r^r)r:r r!r_sz!Sequence.count..)sum)r.r:r )r:r!countszSequence.count)rN) r2r3r4r5rrrJrOrLrrr r r r!ras   c@seZdZfZdS)rN)r2r3r4r5r r r r!rsc@sneZdZfZeddZeddZeddZddZd d Z d d Z d dZ dddZ ddZ ddZdS)rcCstdS)N)r)r.rr:r r r!rszMutableSequence.__setitem__cCstdS)N)r)r.rr r r!rszMutableSequence.__delitem__cCstdS)N)r)r.rr:r r r!insertszMutableSequence.insertcCs|jt||dS)N)rrT)r.r:r r r!appendszMutableSequence.appendc Cs,yx |jqWWntk r&YnXdS)N)rr)r.r r r!rs zMutableSequence.clearcCsLt|}x>t|dD].}|||d||||<|||d<qWdS)Nrir)rTr)r.rqrr r r!reverseszMutableSequence.reversecCsx|D]}|j|qWdS)N)r)r.rrr r r!extends zMutableSequence.extendrcCs||}||=|S)Nr )r.rrr r r!rszMutableSequence.popcCs||j|=dS)N)r)r.r:r r r!r|szMutableSequence.removecCs|j||S)N)r)r.rr r r!__iadd__s zMutableSequence.__iadd__Nrk)rk)r2r3r4r5rrrrrrrrrr|rr r r r!rs    )Jabcrrrl__all__r2typer}bytes_iterator bytearraybytearray_iteratorrdict_keyiteratorrdict_valueiteratorrdict_itemiterator list_iteratorrlist_reverseiteratorrrange_iteratorlongrange_iteratorr set_iterator str_iteratortuple_iteratorzip zip_iterator dict_keys dict_values dict_itemsr& mappingproxy generatorr# coroutinerCr$async_generatorr-r rrregisterrrrr r r r rrrrr frozensetrrrrrrrrrtuplestr memoryviewrbytesrlistr r r r! s          ) 0              /   O 2    \ =      A timeit.cpython-36.pyc000064400000026525152462730460010510 0ustar003 \4@sdZddlZddlZddlZddlZddddgZdZdZd Zej Z e Z d Z d d ZGd ddZdde edfddZdde eedfddZdddddZedkrejedS)amTool for measuring execution time of small code snippets. This module avoids a number of common traps for measuring execution times. See also Tim Peters' introduction to the Algorithms chapter in the Python Cookbook, published by O'Reilly. Library usage: see the Timer class. Command line usage: python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [-p] [-h] [--] [statement] Options: -n/--number N: how many times to execute 'statement' (default: see below) -r/--repeat N: how many times to repeat the timer (default 3) -s/--setup S: statement to be executed once initially (default 'pass'). Execution time of this setup statement is NOT timed. -p/--process: use time.process_time() (default is time.perf_counter()) -t/--time: use time.time() (deprecated) -c/--clock: use time.clock() (deprecated) -v/--verbose: print raw timing results; repeat for more digits precision -u/--unit: set the output time unit (usec, msec, or sec) -h/--help: print this usage message and exit --: separate options from statement, use when statement starts with - statement: statement to be timed (default 'pass') A multi-line statement may be given by specifying each line as a separate argument; indented lines are possible by enclosing an argument in quotes and using leading spaces. Multiple -s options are treated similarly. If -n is not given, a suitable number of loops is calculated by trying successive powers of 10 until the total time is at least 0.2 seconds. Note: there is a certain baseline overhead associated with executing a pass statement. It differs between versions. The code here doesn't try to hide it, but you should be aware of it. The baseline overhead can be measured by invoking the program without arguments. Classes: Timer Functions: timeit(string, string) -> float repeat(string, string) -> list default_timer() -> float NTimertimeitrepeat default_timerz i@Bz def inner(_it, _timer{init}): {setup} _t0 = _timer() for _i in _it: {stmt} _t1 = _timer() return _t1 - _t0 cCs|jddd|S)z*Helper to reindent a multi-line statement.  )replace)srcindentr /usr/lib64/python3.6/timeit.pyreindentPsrc@sPeZdZdZddedfddZdddZefdd Ze efd d Z dd d Z dS)raClass for timing execution speed of small code snippets. The constructor takes a statement to be timed, an additional statement used for setup, and a timer function. Both statements default to 'pass'; the timer function is platform-dependent (see module doc string). If 'globals' is specified, the code will be executed within that namespace (as opposed to inside timeit's namespace). To measure the execution time of the first statement, use the timeit() method. The repeat() method is a convenience to call timeit() multiple times and return a list of results. The statements may contain newlines, as long as they don't contain multi-line string literals. passNc Cs||_i}|dkrtn|}d}t|trJt|td|d}t|d}n*t|rl||d<|d7}d}d}ntd t|trt||tdt|d }n&t|r||d <|d 7}d }ntdt j |||d} | |_ t| td} t | |||d|_ dS)z#Constructor. See class doc string.Nexecr_setupz, _setup=_setupz_setup()z&setup is neither a string nor callableZ_stmtz , _stmt=_stmtz_stmt()z%stmt is neither a string nor callable)stmtsetupinitinner)timer_globals isinstancestrcompiledummy_src_namercallable ValueErrortemplateformatr rr) selfrrrglobalsZlocal_nsZ global_nsrZ stmtprefixr coder r r __init__fs6       zTimer.__init__cCsJddl}ddl}|jdk r:t|jd|jjdtf|jt<|j|ddS)aHelper to print a traceback from the timed code. Typical use: t = Timer(...) # outside the try/except try: t.timeit(...) # or t.repeat(...) except: t.print_exc() The advantage over the standard traceback is that source lines in the compiled template will be displayed. The optional file argument directs where the traceback is sent; it defaults to sys.stderr. rNr)file) linecache tracebackr lensplitrcache print_exc)r#r'r(r)r r r r-s   zTimer.print_excc CsBtjd|}tj}tjz|j||j}Wd|r= 0.2. Calls the timeit method with *number* set to successive powers of ten (10, 100, 1000, ...) up to a maximum of one billion, until the time taken is at least 0.2 second, or the maximum is reached. Returns ``(number, time_taken)``. If *callback* is given and is not None, it will be called after each trial with two arguments: ``callback(number, time_taken)``.  g?)r5r)r#callbackr8r3 time_takenr r r autoranges   zTimer.autorange)N)N) __name__ __module__ __qualname____doc__rr&r-default_numberrdefault_repeatrr>r r r r rTs "  rcCst||||j|S)zCConvenience function to create Timer object and call timeit method.)rr)rrrr3r$r r r rscCst||||j||S)zCConvenience function to create Timer object and call repeat method.)rr)rrrrr3r$r r r rs) _wrap_timerc s^|dkrtjdd}ddl}y(|j|dddddd d d d d g \}}Wn2|jk rx}zt|tddSd}~XnXt}dj|pd}d}g}t} d} d} dddd} dx|D]\} }| d9krt|}| d:kr|j || d;kr|| kr|} ntdtj ddS| dkrPt j }| d?kr`t j }| d@kr| rxd7| d7} | dAkrttd*d+dSqWdj|pd}ddl}tjjd|j|dk r||}t|||}|dkr(d}| rfd,d-}y|j|\}}Wn|jdSy|j| |}Wn|jdSt|}| rxtd.d*jfd/d0|Dtd1|d*d+|d|}| dk r| | }n>d2d0| jD}|jd3d4x|D]\}} ||krPqWtd5| ||| ft|}|d|}t|}||d6krZ|d|}ddl}|jd7||| ftd8ddS)BaMain program, used when run as a script. The optional 'args' argument specifies the command line to be parsed, defaulting to sys.argv[1:]. The return value is an exit code to be passed to sys.exit(); it may be None to indicate success. When an exception happens during timing, a traceback is printed to stderr and the return value is 1. Exceptions at other times (including the template compilation) are not caught. '_wrap_timer' is an internal interface used for unit testing. If it is not None, it must be a callable that accepts a timer function and returns another timer function (used for unit testing). Nr:rz n:u:s:r:tcpvhznumber=zsetup=zrepeat=timeclockZprocessverbosezunit=helpz#use -h/--help for command line helprrg@@g.A)usecZmsecZsecr-n--number-s--setup-u--unitz4Unrecognized unit. Please select usec, msec, or sec.)r'-r--repeat-t--time-c--clock-p --process-v --verbose-h--helpr)endcsd}t|j||ddS)Nz#{num} loops -> {secs:.{prec}g} secs)ZnumZsecsZprec)printr")r3r=msg) precisionr r r<@szmain..callbackz raw times:csg|]}d|fqS)z%.*gr ).0x)rar r Oszmain..z %d loops,cSsg|]\}}||fqSr r )rbZunitscaler r r rdUsT)reversezbest of %d: %.*g %s per looprztThe test results are likely unreliable. The worst time (%.*g %s) was more than four times slower than the best time.r)rLrM)rNrO)rPrQ)rRrS)rTrU)rVrW)rXrY)rZr[)r\r])sysargvgetopterrorr_rjoinrDintr6stderrrFrGZ process_timerBospathinsertcurdirrr>r-rminitemssortmaxwarnings warn_explicit UserWarning)argsrEriZoptserrrrr3rrrHZ time_unitZunitsoarnr9r<_r7ZbestrKreZscalesZworstrvr )rar mains                        r~__main__)N)rBr/rgrFr.__all__rrCrDZ perf_counterrr$rr!rrrrr~r?exitr r r r 3s*  ynturl2path.cpython-36.opt-1.pyc000064400000002735152462730460012254 0ustar003 \ @sdZddZddZdS)z3Convert a NT pathname to a file URL and vice versa.cCsddl}ddl}|jdd}d|kr\|dddkr@|dd}|jd}|jjd j|S|jd}t|dks|dd |jkrd |}t ||dd j }|d jd}|d}x$|D]}|r|d |jj|}qW|j do|j dr|d 7}|S)z{OS-specific conversion from a relative URL of the 'file' scheme to a file system path; not recommended for general use.N:|z/////\z Bad URL: r ) string urllib.parsereplacesplitparseZunquotejoinlenZ ascii_lettersOSErrorupperendswith)Zurlr urllib componentscomperrordrivepathr"/usr/lib64/python3.6/nturl2path.py url2pathnames(      rcCsddl}d|krD|dddkr(d|}|jd}|jjdj|S|jd}t|dksjt|ddkrzd |}t||jj|dj}|djd}d |d}x$|D]}|r|d|jj|}qW|S) z{OS-specific conversion from a file system path to a relative URL of the 'file' scheme; not recommended for general use.rNrrz\\rrrz Bad path: z///)r r rZquoterrrr)prrrrrrrrr pathname2url(s"    rN)__doc__rrrrrrs%ftplib.cpython-36.opt-1.pyc000064400000067307152462730460011437 0ustar003 i! @sVdZddlZddlZddlmZdddddd gZd Zd Zd ZGd ddeZ Gddde Z Gddde Z Gddde Z Gddde Z e eefZdZdZGdddZy ddlZWnek rdZYn0XejZGdddeZejde eeejfZdaddZdaddZddZddZ d d!Z!d)d$d%Z"d&d'Z#e$d(krRe#dS)*aSAn FTP client class and some helper functions. Based on RFC 959: File Transfer Protocol (FTP), by J. Postel and J. Reynolds Example: >>> from ftplib import FTP >>> ftp = FTP('ftp.python.org') # connect to host, default port >>> ftp.login() # default, i.e.: user anonymous, passwd anonymous@ '230 Guest login ok, access restrictions apply.' >>> ftp.retrlines('LIST') # list directory contents total 9 drwxr-xr-x 8 root wheel 1024 Jan 3 1994 . drwxr-xr-x 8 root wheel 1024 Jan 3 1994 .. drwxr-xr-x 2 root wheel 1024 Jan 3 1994 bin drwxr-xr-x 2 root wheel 1024 Jan 3 1994 etc d-wxrwxr-x 2 ftp wheel 1024 Sep 5 13:43 incoming drwxr-xr-x 2 root wheel 1024 Nov 17 1993 lib drwxr-xr-x 6 1094 wheel 1024 Sep 13 19:07 pub drwxr-xr-x 3 root wheel 1024 Jan 3 1994 usr -rw-r--r-- 1 root root 312 Aug 1 1994 welcome.msg '226 Transfer complete.' >>> ftp.quit() '221 Goodbye.' >>> A nice test that reveals some of the network dialogue would be: python ftplib.py -d localhost -l -p -l N)_GLOBAL_DEFAULT_TIMEOUTFTP error_reply error_temp error_perm error_proto all_errorsi c@s eZdZdS)ErrorN)__name__ __module__ __qualname__rr/usr/lib64/python3.6/ftplib.pyr 9sr c@s eZdZdS)rN)r r rrrrrr:sc@s eZdZdS)rN)r r rrrrrr;sc@s eZdZdS)rN)r r rrrrrr<sc@s eZdZdS)rN)r r rrrrrr=sz s c@seZdZdZdZdZeZeZ dZ dZ dZ dZ dZdZddddedfdd Zd d Zd d Zd]ddZddZddZeZddZddZddZddZddZdd Zd!d"Zd#d$Zd%d&Z d'd(Z!d)d*Z"d+d,Z#d-d.Z$d/d0Z%d1d2Z&d^d3d4Z'd_d5d6Z(d`d7d8Z)dad:d;Z*dbdd?Z,ddd@dAZ-dBdCZ.dDdEZ/dFdGZ0dgfdHdIZ1dJdKZ2dLdMZ3dNdOZ4dPdQZ5dRdSZ6dTdUZ7dVdWZ8dXdYZ9dZd[Z:dS)erayAn FTP client class. To create a connection, call the class using these arguments: host, user, passwd, acct, timeout The first four arguments are all strings, and have default value ''. timeout must be numeric and defaults to None if not passed, meaning that no timeout will be set on any ftp socket(s) If a timeout is passed, then this is now the default timeout for all ftp socket operations for this instance. Then use self.connect() with optional host and port argument. To download a file, use ftp.retrlines('RETR ' + filename), or ftp.retrbinary() with slightly different arguments. To upload a file, use ftp.storlines() or ftp.storbinary(), which have an open file as argument (see their definitions below for details). The download/upload functions first issue appropriate TYPE and PORT or PASV commands. rNr zlatin-1FcCs0||_||_|r,|j||r,|j|||dS)N)source_addresstimeoutconnectlogin)selfhostuserpasswdacctrrrrr__init__rs  z FTP.__init__cCs|S)Nr)rrrr __enter__{sz FTP.__enter__cGsN|jdk rJz*y |jWnttfk r0YnXWd|jdk rH|jXdS)N)sockquitOSErrorEOFErrorclose)rargsrrr__exit__s    z FTP.__exit__icCs|dkr||_|dkr||_|dkr*||_|dk r8||_tj|j|jf|j|jd|_|jj|_|jj d|j d|_ |j |_ |j S) awConnect to host. Arguments are: - host: hostname to connect to (string, default previous host) - port: port to connect to (integer, default previous port) - timeout: the timeout to set against the ftp socket(s) - source_address: a 2-tuple (host, port) for the socket to bind to as its source address before connecting. rriN)rr)encodingi)rportrrsocketcreate_connectionrZfamilyafmakefiler%filegetrespwelcome)rrr&rrrrrrs   z FTP.connectcCs|jrtd|j|j|jS)z`Get the welcome message from the server. (this is read and squirreled away by connect())z *welcome*) debuggingprintsanitizer-)rrrr getwelcomeszFTP.getwelcomecCs ||_dS)zSet the debugging level. The required argument level means: 0: no debugging output (default) 1: print commands and responses but not body text etc. 2: also print raw lines read and sent before stripping CR/LFN)r.)rlevelrrrset_debuglevelszFTP.set_debuglevelcCs ||_dS)zUse passive or active mode for data transfers. With a false argument, use the normal PORT mode, With a true argument, use the PASV command.N) passiveserver)rvalrrrset_pasvsz FTP.set_pasvcCsJ|dddkrBt|jd}|ddd|d||d}t|S)Npass PASS z *>r9r8)lenrstriprepr)rsirrrr0s$z FTP.sanitizecCsRd|ksd|krtd|t}|jdkr:td|j||jj|j|jdS)N  z4an illegal newline character should not be containedr z*put*) ValueErrorCRLFr.r/r0rsendallencoder%)rlinerrrputlines  z FTP.putlinecCs$|jrtd|j||j|dS)Nz*cmd*)r.r/r0rG)rrFrrrputcmdsz FTP.putcmdcCs|jj|jd}t||jkr.td|j|jdkrHtd|j||sPt|ddt krn|dd}n|ddt kr|dd}|S) Nr zgot more than %d bytesz*get*rJrK) r+readlinemaxliner;r r.r/r0r rC)rrFrrrgetlines  z FTP.getlinecCsd|j}|dddkr`|dd}x:|j}|d|}|dd|kr&|dddkr&Pq&W|S)N-rA)rN)rrFcodeZnextlinerrr getmultilines  zFTP.getmultilinecCsp|j}|jrtd|j||dd|_|dd}|d krD|S|dkrTt||dkrdt|t|dS) Nz*resp*rOr 12345>rUrVrT)rSr.r/r0Zlastresprrr)rrespcrrrr,s z FTP.getrespcCs$|j}|dddkr t||S)z%Expect a response beginning with '2'.Nr rU)r,r)rrYrrrvoidrespsz FTP.voidrespcCsTdt}|jdkr"td|j||jj|t|j}|ddd krPt||S) zAbort a file transfer. Uses out-of-band data. This does not follow the procedure from the RFC to send Telnet IP and Synch; that doesn't seem to work with the servers I've tried. Instead, just send the ABOR command as OOB data.sABORr z *put urgent*NrO426225226>r\r^r]) B_CRLFr.r/r0rrDMSG_OOBrSr)rrFrYrrraborts z FTP.abortcCs|j||jS)z'Send a command and return the response.)rHr,)rcmdrrrsendcmds z FTP.sendcmdcCs|j||jS)z8Send a command and expect a response beginning with '2'.)rHr[)rrbrrrvoidcmds z FTP.voidcmdcCsB|jd}t|dt|dg}||}ddj|}|j|S)zUSend a PORT command with the current host and the given port number. .zPORT ,)splitr=joinrd)rrr&ZhbytesZpbytesbytesrbrrrsendports  z FTP.sendportcCsbd}|jtjkrd}|jtjkr$d}|dkr4tddt||t|dg}ddj|}|j|S)zESend an EPRT command with the current host and the given port number.rr rIzunsupported address familyrzEPRT |)r)r'AF_INETZAF_INET6rr=rird)rrr&r)Zfieldsrbrrrsendeprt$s  z FTP.sendeprtc Csd}d}xtjdd|jtjdtjD]j}|\}}}}}ytj|||}|j|Wn8tk r} z| }|rt|jd}w$WYdd} ~ XnXPq$W|dkr|dk r|ntd|jd|j d} |j j d} |jtj kr|j | | } n |j | | } |jtk r|j|j|S)z3Create a new socket and send a PORT command for it.Nrz!getaddrinfo returns an empty listr )r'Z getaddrinfor)Z SOCK_STREAMZ AI_PASSIVEZbindrr!ZlistenZ getsocknamerrmrkrnrr settimeout) rerrrresr)ZsocktypeprotoZ canonnameZsa_r&rrYrrrmakeport1s6       z FTP.makeportcCs\|jtjkr:t|jd\}}|jr*|}qT|jjd}nt|jd|jj\}}||fS)z (address, port)PASVrZEPSV) r)r'rmparse227rctrust_server_pasv_ipv4_addressrZ getpeernameparse229)rZuntrusted_hostr&rrrrmakepasvQs z FTP.makepasvc Cs6d}|jr|j\}}tj||f|j|jd}yL|dk rF|jd||j|}|ddkrd|j}|ddkrxt|Wn|j YnXn|j r}|dk r|jd||j|}|ddkr|j}|ddkrt||j \}} |jt k r |j |jWdQRX|dddkr.t|}||fS) aInitiate a transfer over the data connection. If the transfer is active, send a port command and the transfer command, and accept the connection. If the server is passive, send a pasv command, connect to it, and start the transfer command. Either way, return the socket for the connection and the expected size of the transfer. The expected size may be None if it could not be determined. Optional `rest' argument can be a string that is sent as the argument to a REST command. This is essentially a server marker used to tell the server to skip over any data up to the given marker. N)rzREST %srrUrTrO150)r4ryr'r(rrrcr,rr!rtZacceptrroparse150) rrbrestsizerr&connrYrZsockaddrrrr ntransfercmd]s<             zFTP.ntransfercmdcCs|j||dS)z0Like ntransfercmd() but returns only the socket.r)r)rrbr|rrr transfercmdszFTP.transfercmdcCs|sd}|sd}|sd}|dkr0|d kr0|d}|jd|}|ddkrX|jd|}|ddkrr|jd |}|dd krt||S) zLogin, default anonymous.Z anonymousrrQz anonymous@zUSER rrVzPASS zACCT rU>rrQ)rcr)rrrrrYrrrrs    z FTP.login c Csb|jd|j||>}x|j|}|s*P||qWtdk rPt|trP|jWdQRX|jS)aRetrieve data in binary mode. A new port is created for you. Args: cmd: A RETR command. callback: A single parameter callable to be called on each block of data read. blocksize: The maximum number of bytes to read from the socket at one time. [default: 8192] rest: Passed to transfercmd(). [default: None] Returns: The response code. zTYPE IN)rdrZrecv _SSLSocket isinstanceunwrapr[)rrbcallback blocksizer|r~datarrr retrbinarys   zFTP.retrbinarycCs|dkr t}|jd}|j|}|jd|jd}x|j|jd}t||jkrbtd|j|j dkrzt dt ||sP|d dt kr|dd }n|d dd kr|dd }||q6Wt dk rt|t r|jWdQRXWdQRX|jS)ahRetrieve data in line mode. A new port is created for you. Args: cmd: A RETR, LIST, or NLST command. callback: An optional single parameter callable that is called for each line with the trailing CRLF stripped. [default: print_line()] Returns: The response code. NzTYPE Ar$)r%r zgot more than %d bytesrIz*retr*rArJrJrKrK) print_linercrr*r%rLrMr;r r.r/r=rCrrrr[)rrbrrYr~fprFrrr retrliness*      z FTP.retrlinesc Csp|jd|j||L}x*|j|}|s*P|j||r||qWtdk r^t|tr^|jWdQRX|jS)a9Store a file in binary mode. A new port is created for you. Args: cmd: A STOR command. fp: A file-like object with a read(num_bytes) method. blocksize: The maximum data size to read from fp and send over the connection at once. [default: 8192] callback: An optional single parameter callable that is called on each block of data after it is sent. [default: None] rest: Passed to transfercmd(). [default: None] Returns: The response code. zTYPE IN)rdrreadrDrrrr[)rrbrrrr|r~bufrrr storbinarys    zFTP.storbinaryc Cs|jd|j|}x||j|jd}t||jkrDtd|j|sJP|ddtkrz|dtkrr|dd}|t}|j||r||qWtdk rt |tr|j WdQRX|j S) ahStore a file in line mode. A new port is created for you. Args: cmd: A STOR command. fp: A file-like object with a readline() method. callback: An optional single parameter callable that is called on each line after it is sent. [default: None] Returns: The response code. zTYPE Ar zgot more than %d bytesrINrJrKrK) rdrrLrMr;r r_rDrrrr[)rrbrrr~rrrr storlines s$     z FTP.storlinescCsd|}|j|S)zSend new account name.zACCT )rd)rZpasswordrbrrrr+szFTP.acctcGs4d}x|D]}|d|}q Wg}|j||j|S)zBReturn a list of files in a given directory (default the current).ZNLST )rappend)rr"rbargfilesrrrnlst0s  zFTP.nlstcGsld}d}|ddr>t|dtdkr>|dd|d }}x|D]}|rD|d|}qDW|j||dS) aList a directory in long form. By default list current directory to stdout. Optional last argument is callback function; all non-empty arguments before it are concatenated to the LIST command. (This *should* only be used for a pathname.)ZLISTNr rrrKrKrKrK)typer)rr"rbfuncrrrrdir9s  zFTP.dirc cs|r|jddj|d|r*d|}nd}g}|j||jxh|D]`}|jtjd\}}}i} x6|dd jdD] } | jd\} }} | | | j<qxW|| fVqFWdS) a<List a directory in a standardized format by using MLSD command (RFC-3659). If path is omitted the current directory is assumed. "facts" is a list of strings representing the type of information desired (e.g. ["type", "size", "perm"]). Return a generator object yielding a tuple of two elements for every file found in path. First element is the file name, the second one is a dictionary including a variable number of "facts" depending on the server and whether "facts" argument has been provided. z OPTS MLST ;zMLSD %sZMLSDrNr =rK) rcrirrr<rC partitionrhlower) rpathZfactsrblinesrFZ facts_foundrsnameentryZfactkeyvaluerrrmlsdHs   zFTP.mlsdcCs0|jd|}|ddkr"t||jd|S)zRename a file.zRNFR rrVzRNTO )rcrrd)rZfromnameZtonamerYrrrrenameds z FTP.renamecCs.|jd|}|dddkr"|St|dS)zDelete a file.zDELE NrO250200>rr)rcr)rfilenamerYrrrdeleteksz FTP.deletecCsn|dkrPy |jdStk rL}z|jddddkr<WYdd}~Xq\Xn |dkr\d}d |}|j|S) zChange to a directory.z..ZCDUPrNrO500rrezCWD )rdrr")rdirnamemsgrbrrrcwdss zFTP.cwdcCs:|jd|}|dddkr6|ddj}t|SdS)zRetrieve the size of a file.zSIZE NrOZ213)rcstripint)rrrYr>rrrr}szFTP.sizecCs$|jd|}|jdsdSt|S)z+Make a directory, return its full pathname.zMKD 257r)rd startswithparse257)rrrYrrrmkds zFTP.mkdcCs|jd|S)zRemove a directory.zRMD )rd)rrrrrrmdszFTP.rmdcCs |jd}|jdsdSt|S)z!Return current working directory.ZPWDrr)rdrr)rrYrrrpwds  zFTP.pwdcCs|jd}|j|S)zQuit, and close the connection.ZQUIT)rdr!)rrYrrrrs zFTP.quitc CsDz |j}d|_|dk r|jWd|j}d|_|dk r>|jXdS)z8Close the connection without assuming anything about it.N)r+r!r)rr+rrrrr!s z FTP.close)rrrN)N)N)rrr)rN)N)rNN)N);r r r__doc__r.rFTP_PORTr&MAXLINErMrr+r-r4r%rwrrrr#rr1r3debugr6r0rGrHrNrSr,r[rarcrdrkrnrtryrrrrrrrrrrrrrrr}rrrrr!rrrrrJsl      7    #      c @sneZdZdZejZdddddddedf ddZdddZ d d Z d d Z d dZ ddZ dddZddZdS)FTP_TLSaA FTP subclass which adds TLS support to FTP as described in RFC-4217. Connect as usual to port 21 implicitly securing the FTP control connection before authenticating. Securing the data connection requires user to explicitly ask for it by calling prot_p() method. Usage example: >>> from ftplib import FTP_TLS >>> ftps = FTP_TLS('ftp.python.org') >>> ftps.login() # login anonymously previously securing control channel '230 Guest login ok, access restrictions apply.' >>> ftps.prot_p() # switch to secure data connection '200 Protection level set to P' >>> ftps.retrlines('LIST') # list directory content securely total 9 drwxr-xr-x 8 root wheel 1024 Jan 3 1994 . drwxr-xr-x 8 root wheel 1024 Jan 3 1994 .. drwxr-xr-x 2 root wheel 1024 Jan 3 1994 bin drwxr-xr-x 2 root wheel 1024 Jan 3 1994 etc d-wxrwxr-x 2 ftp wheel 1024 Sep 5 13:43 incoming drwxr-xr-x 2 root wheel 1024 Nov 17 1993 lib drwxr-xr-x 6 1094 wheel 1024 Sep 13 19:07 pub drwxr-xr-x 3 root wheel 1024 Jan 3 1994 usr -rw-r--r-- 1 root root 312 Aug 1 1994 welcome.msg '226 Transfer complete.' >>> ftps.quit() '221 Goodbye.' >>> rNc Cs|dk r|dk rtd|dk r0|dk r0td|dk s@|dk rVddl} | jdtd||_||_|dkr|tj|j||d}||_ d|_ t j ||||||| dS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadrI)certfilekeyfileF) rBwarningswarnDeprecationWarningrrsslZ_create_stdlib_context ssl_versioncontext_prot_prr) rrrrrrrrrrrrrrrs"zFTP_TLS.__init__TcCs,|rt|jtj r|jtj||||S)N)rrr SSLSocketauthrr)rrrrZsecurerrrrsz FTP_TLS.logincCsft|jtjrtd|jtjkr.|jd}n |jd}|jj |j|j d|_|jj d|j d|_ |S)z2Set up secure control connection by using TLS/SSL.zAlready using TLSzAUTH TLSzAUTH SSL)server_hostnamer$)moder%)rrrrrBrPROTOCOL_SSLv23rdr wrap_socketrr*r%r+)rrYrrrrs     z FTP_TLS.authcCs0t|jtjstd|jd}|jj|_|S)z/Switch back to a clear-text control connection.z not using TLSZCCC)rrrrrBrdr)rrYrrrcccs   z FTP_TLS.ccccCs|jd|jd}d|_|S)zSet up secure data connection.zPBSZ 0zPROT PT)rdr)rrYrrrprot_p s  zFTP_TLS.prot_pcCs|jd}d|_|S)z"Set up clear text data connection.zPROT CF)rdr)rrYrrrprot_cs zFTP_TLS.prot_ccCs2tj|||\}}|jr*|jj||jd}||fS)N)r)rrrrrr)rrbr|r~r}rrrr$s  zFTP_TLS.ntransfercmdcCs8dt}|jj||j}|dddkr4t||S)NsABORrOr\r]r^>r\r^r])r_rrDrSr)rrFrYrrrra+s  z FTP_TLS.abort)rrrT)N)r r rrrrrrrrrrrrrrarrrrrs     rcCs\|dddkrt|tdkrt |d }||fS) zParse the '227' response for a PASV request. Raises error_proto if it does not contain '(h1,h2,h3,h4,p1,p2)' Return ('host.addr.as.numbers', port#) tuple.NrOZ227rz#(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)rerPr7) r_227_rerrrsearchrgroupsrir)rYrrZnumbersrr&rrrrvNs rvcCs|dddkrt||jd}|dkr2t||jd|d}|dkrRt|||d||dkrrt|||d|j||d}t|dkrt||d}t|d}||fS) zParse the '229' response for an EPSV request. Raises error_proto if it does not contain '(|||port|)' Return ('host.addr.as.numbers', port#) tuple.NrOZ229(r)r r7)rfindrrhr;r)rYZpeerleftrightpartsrr&rrrrxbs    rxcCs|dddkrt||dddkr,dSd}d}t|}xJ||kr||}|d}|dkr|||ksr||dkrtP|d}||}q>W|S) zParse the '257' response for a MKD or PWD request. This is a response to a MKD or PWD request: a directory name. Returns the directoryname in the 257 reply.NrOrr7z "rr ")rr;)rYrr?nrZrrrrxs   rcCs t|dS)z+Default retrlines callback to print a line.N)r/)rFrrrrsrrIc Cs|s|}d|}|j||j|t|jd\}}|j|||jd|}|ddd krdt|jd|}|ddd krt|j|jdS) z+Copy file from one FTP-instance to another.zTYPE ruzSTOR NrO125rzzRETR >rrz>rrz)rdrvrcrkrr[) sourceZ sourcenametargetZ targetnamerZ sourcehostZ sourceportZtreplyZsreplyrrrftpcps   rc Csttjdkr"ttjtjdddl}d}d}x"tjddkrT|d}tjd=q4Wtjddddkrtjddd}tjd=tjd}t|}|j |d}}}y|j|}Wn(t k r|dk rtj j dYn:Xy|j |\}}}Wn"tk rtj j d YnX|j|||xtjddD]} | ddd krf|j| ddnt| dddkrd } | ddr| d | dd} |j| } n0| d kr|j|j n|jd| tjj dqsP    k  |  9 uu.cpython-36.opt-2.pyc000064400000006322152462730460010577 0ustar003 \k@s`ddlZddlZddlZdddgZGdddeZd ddZd ddZd d Ze d kr\edS)NErrorencodedecodec@s eZdZdS)rN)__name__ __module__ __qualname__rr/usr/lib64/python3.6/uu.pyr'scCsBg}z|dkrtjj}n`t|trz|dkr8tjj|}|dkrfytj|j }Wnt k rdYnXt |d}|j ||dkrtj j}nt|trt |d}|j ||dkrd}|dkrd}|jd|d@|fjd|jd}x,t|d kr|jtj||jd}qW|jd Wdx|D]}|jq*WXdS) N-rbwbiz begin %o %s iascii-rs end )sysstdinbuffer isinstancestrospathbasenamestatst_modeAttributeErroropenappendstdoutwriterreadlenbinasciiZb2a_uuclose)in_fileout_filenamemode opened_filesdatafrrr r*s>           Fc Cs:g}|dkrtjj}nt|tr4t|d}|j|zxr|j}|sNtd|j dsZq:|j dd}t |dkr:|ddkr:yt |d d PWq:t k rYq:Xq:W|dkr|djd jd }tjj|rtd ||dkrt |d d }|dkr tjj}nNt|trXt|d}ytjj||Wntk rHYnX|}|j||j}x|r|jd dkrytj|} Wnjtjk r} zJ|ddd@ddd} tj|d| } |stjjd| WYdd} ~ XnX|j| |j}qbW|stdWdx|D]} | jq"WXdS)Nr r z'No valid begin line found in input filesbegin rs r z"Cannot overwrite existing file: %sr send ?z Warning: %s zTruncated input file)rrrrrrrreadliner startswithsplitrint ValueErrorrstriprrrexistsrchmodrstripr Za2b_uustderrrr!) r"r#r%quietr&ZhdrZ hdrfieldsfpsr'vnbytesr(rrr rZsf              "   cCs4ddl}|jdd}|jdddddd d |jd d d ddd d |j\}}t|dkrl|jdtjdtjj }tj j }t|dkr|d}t|dkr|d}|j r|j rt |trt|d}nttjddtjdt ||nD|j r&t |tr t|d}nttjddtjdt||dS)Nrz'usage: %prog [-d] [-t] [input [output]])Zusagez-dz--decoderzDecode (instead of encode)?F store_true)desthelpdefaultactionz-tz--texttextz2data is text, encoded format unix-compatible text?r*zincorrect number of argumentsr,r z: cannot do -t to stdoutr z: cannot do -t from stdin)optparseZ OptionParserZ add_option parse_argsrerrorrexitrrrrrFrrrprintargvr)rGparserZoptionsargsinputoutputrrr tests6              rQ__main__)NN)NNF) r rr__all__ ExceptionrrrrQrrrrr !s  0 F&posixpath.cpython-36.pyc000064400000024722152462730460011231 0ustar003 i?'@sfdZdZdZdZdZdZdZdZdZddl Z ddl Z ddl Z ddl Z dd l Td d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0g'Z d1d2Zd3d Zd4d Zd5d Zd6dZd7dZe jje_d8d Zd9dZd:dZd;dZddZdadad?dZd@dZdAd Z dBdCdDd,Z!dEdFZ"e j#dGkZ$dJdHd.Z%dId/Z&dS)KaCommon operations on Posix pathnames. Instead of importing this module directly, import os and refer to this module as os.path. The "os.path" name is an alias for this module on Posix systems; on other systems (e.g. Mac, Windows), os.path provides the same operations in a manner specific to that platform, and is an alias to another module (e.g. macpath, ntpath). Some of this can actually be useful on non-Posix systems too, e.g. for manipulation of the pathname component of URLs. .z../:z:/bin:/usr/binNz /dev/null)*normcaseisabsjoin splitdrivesplitsplitextbasenamedirname commonprefixgetsizegetmtimegetatimegetctimeislinkexistslexistsisdirisfileismount expanduser expandvarsnormpathabspathsamefile sameopenfilesamestatcurdirpardirseppathsepdefpathaltsepextsepdevnullrealpathsupports_unicode_filenamesrelpath commonpath ALLOW_MISSINGcCst|trdSdSdS)N/r) isinstancebytes)pathr1!/usr/lib64/python3.6/posixpath.py_get_sep)s r3cCs.tj|}t|ttfs*tdj|jj|S)z6Normalize case of pathname. Has no effect under Posixz2normcase() argument must be str or bytes, not '{}') osfspathr.r/str TypeErrorformat __class____name__)sr1r1r2r4s   cCstj|}t|}|j|S)zTest whether a path is absolute)r4r5r3 startswith)r;r"r1r1r2r@s c Gstj|}t|}|}yd|s,|dd|xJttj|D]:}|j|rN|}q:| s^|j|rh||7}q:|||7}q:WWn.tttfk rt j d|f|YnX|S)zJoin two or more pathname components, inserting '/' as needed. If any component is an absolute path, all previous path components will be discarded. An empty last part will result in a path that ends with a separator.Nrr) r4r5r3mapr<endswithr7AttributeError BytesWarning genericpath_check_arg_types)apr"r0br1r1r2rKs    cCs`tj|}t|}|j|d}|d|||d}}|rX||t|krX|j|}||fS)zSplit a pathname. Returns tuple "(head, tail)" where "tail" is everything after the final slash. Either part may be empty.N)r4r5r3rfindlenrstrip)rDr"iheadtailr1r1r2r hs  cCs6tj|}t|trd}d}nd}d}tj||d|S)Nr-.rr)r4r5r.r/rA _splitext)rDr"r&r1r1r2r ys  cCstj|}|dd|fS)zJSplit a pathname into drive and path. On Posix, drive is always empty.Nr)r4r5)rDr1r1r2r s cCs,tj|}t|}|j|d}||dS)z)Returns the final component of a pathnamerFN)r4r5r3rG)rDr"rJr1r1r2r s cCsNtj|}t|}|j|d}|d|}|rJ||t|krJ|j|}|S)z-Returns the directory component of a pathnamerFN)r4r5r3rGrHrI)rDr"rJrKr1r1r2r s   c Cs4ytj|}Wnttfk r&dSXtj|jS)z&Test whether a path is a symbolic linkF)r4lstatOSErrorr?statS_ISLNKst_mode)r0str1r1r2rs c Cs(ytj|Wntk r"dSXdS)zCTest whether a path exists. Returns True for broken symbolic linksFT)r4rOrP)r0r1r1r2rs cCsytj|}Wntk r"dSXtj|jr4dSt|trJt|d}n t|d}t |}ytj|}Wntk r~dSX|j }|j }||krdS|j }|j }||krdSdS)z$Test whether a path is a mount pointFs..z..T) r4rOrPrQrRrSr.r/rr(st_devst_ino)r0s1parents2dev1dev2ino1ino2r1r1r2rs.    c Cs4tj|}t|trd}nd}|j|s,|St|}|j|d}|dkrPt|}|dkrdtjkrddl }y|j tj j }Wqt k r|SXqtjd}nRddl }|d|}t|trt|d}y|j|}Wnt k r|SX|j }t|trtj|}d}nd }|j|}|||dp2|S) zOExpand ~ and ~user constructions. If user or $HOME is unknown, do nothing.~~rFrHOMENASCIIr-r)r4r5r.r/r<r3findrHenvironpwdgetpwuidgetuidpw_dirKeyErrorr6getpwnamfsencoderI) r0tilder"rJrduserhomenamepwentrootr1r1r2rsB            c Cs\tj|}t|trVd|kr |Sts:ddl}|jd|jatj}d}d}t tdd}n:d|krb|St s|ddl}|jd |ja t j}d }d }tj }d}x|||}|sP|j d\}}|j d } | j|r| j|r| d d } y.|dkrtjtj tj| } n|| } Wntk r&|}YqX||d} |d|| }t|}|| 7}qW|S)zZExpand shell variables of form $var and ${var}. Unknown variables are left unchanged.$rNs\$(\w+|\{[^}]*\}){}environb$z\$(\w+|\{[^}]*\}){}rF)r4r5r.r/ _varprogbrecompilerasearchgetattr_varprogrcspangroupr<r>rjfsdecoderhrH) r0ryr{startendrcrJmjrmvaluerLr1r1r2rsP          c Cstj|}t|tr&d}d}d}d}nd}d}d}d}||krB|S|j|}|rr|j|d rr|j|d  rrd }|j|}g}xV|D]N}|||fkrq||ks| r| s|r|d |kr|j|q|r|jqW|}|j|}|r|||}|p|S) z0Normalize path, eliminating double slashes, etc.r-rMs..rrz..rFrw) r4r5r.r/r<r appendpopr) r0r"emptydotdotdotinitial_slashescomps new_compscompr1r1r2rRs>          cCs@tj|}t|s8t|tr&tj}ntj}t||}t|S)zReturn an absolute path.) r4r5rr.r/getcwdbgetcwdrr)r0cwdr1r1r2rxs    F)strictcCs,tj|}t|dd||i\}}t|S)zlReturn the canonical path of the specified filename, eliminating any symbolic links encountered in the path.Nr)r4r5 _joinrealpathr)filenamerr0okr1r1r2r(s c Cst|trd}d}d}nd}d}d}tj}|tkr8t}n|rBf}nt}d} t|rb|dd}|}x"|r|j|\} } }| sf| |krqf| |kr|rt |\}} | |krt |||}qf|}qft || } ytj | } Wn|k rd}YnXt j | j}|s | }qf| |krH|| }|dk r(qf|r:tj | nt | |dfSd|| <t|tj| ||\}}|s|t ||dfS||| <qfW|d fS) Nr-rMs..rrz..rFFT)r.r/r4rr,FileNotFoundErrorrPr partitionr rrOrQrRrSrreadlink)r0restrseenr"r r!r ignored_errormaxlinksrm_newpathrTis_linkrr1r1r2rsd           rdarwinc Cs|s tdtj|}t|tr.d}d}d}n d}d}d}|dkrH|}n tj|}ynd d t|j|D}d d t|j|D}tt||g}|gt||||d}|s|St |St t t t fk rtjd ||YnXdS) z#Return a relative version of a pathzno path specifiedrMr-s..rrz..NcSsg|] }|r|qSr1r1).0xr1r1r2 szrelpath..cSsg|] }|r|qSr1r1)rrr1r1r2rsr*) ValueErrorr4r5r.r/rr rHrrr7r?r@DeprecationWarningrArB) r0rr r"r! start_list path_listrJrel_listr1r1r2r*s0   c s2|s tdtttj|}t|dtr4ddnddyƇfdd|D}ytfd d |D\}Wntk rtd d YnXfd d|D}t|}t |}|}x.t |D]"\}}|||kr|d |}PqW|rn d d}|j |St t fk r,tjd|YnXd S)zDGiven a sequence of path names, returns the longest common sub-path.z%commonpath() arg is an empty sequencerr-rMrrcsg|]}|jqSr1)r )rr0)r"r1r2rszcommonpath..c3s|]}|ddkVqdS)NrFr1)rrD)r"r1r2 szcommonpath..z%Can't mix absolute and relative pathsNcsg|]}fdd|DqS)csg|]}|r|kr|qSr1r1)rc)r r1r2rsz)commonpath...r1)rr;)r r1r2rsr+)r+)rtupler=r4r5r.r/setminmax enumeraterr7r?rArB) paths split_pathsrrWrYcommonrJrprefixr1)r r"r2r+s6  )N)'__doc__r r!r&r"r#r$r%r'r4sysrQrA__all__r3rrrr r rNr r r rrrrr}rxrrrr(rplatformr)r*r+r1r1r1r2 sZ           *25& F  )cProfile.cpython-36.pyc000064400000010310152462730460010741 0ustar003 \@szdZdddgZddlZddlZdddZdddZejje_ejje_Gd ddejZd d Z d d Z e dkrve dS)zUPython interface for the 'lsprof' profiler. Compatible with the 'profile' module. runrunctxProfileNcCstjtj|||S)N) _pyprofile_Utilsrr) statementfilenamesortr /usr/lib64/python3.6/cProfile.pyrscCstjtj|||||S)N)rrrr)rglobalslocalsr r r r r rsc@sJeZdZdZdddZddZddZd d Zd d Zd dZ ddZ dS)ra`Profile(timer=None, timeunit=None, subcalls=True, builtins=True) Builds a profiler object using the specified timer function. The default timer is a fast built-in one based on real time. For custom timer functions returning integers, timeunit can be a float specifying a scale (i.e. how long each integer unit is, in seconds). rcCs$ddl}|j|jj|jdS)Nr)pstatsStatsZ strip_dirsZ sort_stats print_stats)selfr rr r r r(szProfile.print_statsc Cs8ddl}t|d}|j|j|j|WdQRXdS)Nrwb)marshalopen create_statsdumpstats)rfilerfr r r dump_stats,s zProfile.dump_statscCs|j|jdS)N)disablesnapshot_stats)rr r r r2szProfile.create_statsc Cs6|j}i|_i}xX|D]P}t|j}|j}||j}|j}|j}i} | |t|j<||||| f|j|<qWx|D]}|j rrt|j}x|j D]} y|t| j} Wnt k rwYnX| j}|| j}| j}| j}|| kr| |} || d7}|| d7}|| d7}|| d7}||||f| |<qWqrWdS)Nrr) ZgetstatsrlabelcodeZ callcountZ reccallcountZ inlinetimeZ totaltimeidZcallsKeyError) rZentriesZ callersdictsentryfuncZncZccZttZctZcallersZsubentryprevr r r r6s>            zProfile.snapshot_statscCsddl}|j}|j|||S)Nr)__main____dict__r)rcmdr'dictr r r r\sz Profile.runc Cs(|jzt|||Wd|jX|S)N)enableexecr)rr)r rr r r ras  zProfile.runctxc Os"|jz |||S|jXdS)N)r+r)rr%argskwr r r runcalljs zProfile.runcallN)r0) __name__ __module__ __qualname____doc__rrrrrrr/r r r r rs & cCs(t|trdd|fS|j|j|jfSdS)N~r) isinstancestr co_filenameco_firstlinenoco_name)r!r r r r ss  r c Cs&ddl}ddl}ddl}ddlm}d}||d}d|_|jdddd dd |jd d d ddt|jj d|j dds|j |j d|j \}}||j dd<t|dkr|d}|jjd|jj|t|d} t| j|d} WdQRX|dddd} t| | d|j|jn|j |S)Nr) OptionParserz@cProfile.py [-o output_file_path] [-s sort] scriptfile [arg] ...)usageFz-oz --outfileoutfilezSave stats to )desthelpdefaultz-sz--sortr z?Sort order when printing to stdout, based on pstats.Stats classr)r>r?r@choicesrrbr,r')__file__r1 __package__ __cached__r0)ossysrZoptparser;Zallow_interspersed_argsZ add_optionsortedrZsort_arg_dict_defaultargvZ print_usageexit parse_argslenpathinsertdirnamercompilereadrr=r ) rFrGrr;r<parserZoptionsr-Zprognamefpr!Zglobsr r r main{s8        rTr'r0)Nr0r0)Nr0) r4__all__Z_lsprofZprofilerrrZProfilerrr rTr1r r r r s     X%lzma.cpython-36.opt-2.pyc000064400000013253152462730460011112 0ustar003 \2$@sdddddddddd d d d d ddddddddddddddddddd d!d"d#g$Zd$d%lZd$d%lZd$d%lZd$d&lTd$d'lmZmZd$d%lZd$Zd(Z d)Z Gd*ddej Z d0d%d1d%d%d%d%d%d,d-d Z ed2d%d%fd.d!Zed%d%fd/d"Zd%S)3Z CHECK_NONEZ CHECK_CRC32Z CHECK_CRC64Z CHECK_SHA256Z CHECK_ID_MAXZ CHECK_UNKNOWNZ FILTER_LZMA1Z FILTER_LZMA2Z FILTER_DELTAZ FILTER_X86Z FILTER_IA64Z FILTER_ARMZFILTER_ARMTHUMBZFILTER_POWERPCZ FILTER_SPARC FORMAT_AUTO FORMAT_XZZ FORMAT_ALONEZ FORMAT_RAWZMF_HC3ZMF_HC4ZMF_BT2ZMF_BT3ZMF_BT4Z MODE_FASTZ MODE_NORMALZPRESET_DEFAULTZPRESET_EXTREMELZMACompressorLZMADecompressorLZMAFile LZMAErroropencompress decompressZis_check_supportedN)*)_encode_filter_properties_decode_filter_propertiesc@seZdZd!dd"dddddZddZed d Zd d Zd dZddZ ddZ d$ddZ d&ddZ d(ddZ d*ddZddZejfddZdd ZdS)+rNrr)formatcheckpresetfiltersc Cs&d|_d|_t|_|dkrL|dkr*td|dk r:td|dkrFt}t}n@|dkr~|dkr`t}t}t ||||d |_ d|_ ntdj |t |tttjfrd|kr|d7}tj|||_d|_||_n*t|dst|dr||_||_ntd|jtkr"tj|jtt||d}tj||_dS)NFrrbrzACannot specify an integrity check when opening a file for readingzICannot specify a preset compression level when opening a file for readingwwbaabxxb)rrrrr zInvalid mode: {!r}bTreadwritez6filename must be a str, bytes, file or PathLike object)Ztrailing_errorrr)rr)rrrrrr)_fp_closefp _MODE_CLOSED_mode ValueErrorr _MODE_READr _MODE_WRITEr _compressor_posr isinstancestrbytesosPathLikebuiltinsrhasattr TypeError _compressionZDecompressReaderrrioBufferedReader_buffer) selffilenamemoderrrrZ mode_coderawr9/usr/lib64/python3.6/lzma.py__init__1sB,    zLZMAFile.__init__cCs|jtkrdSzB|jtkr,|jjd|_n"|jtkrN|jj|jj d|_Wdz|j rd|jjWdd|_d|_ t|_XXdS)NF) r#r"r%r4closer&r rr'flushr!)r5r9r9r:r<s     zLZMAFile.closecCs |jtkS)N)r#r")r5r9r9r:closedszLZMAFile.closedcCs|j|jjS)N)_check_not_closedr fileno)r5r9r9r:r@szLZMAFile.filenocCs|jo|jjS)N)readabler4seekable)r5r9r9r:rBszLZMAFile.seekablecCs|j|jtkS)N)r?r#r%)r5r9r9r:rAszLZMAFile.readablecCs|j|jtkS)N)r?r#r&)r5r9r9r:writableszLZMAFile.writablecCs|j|jj|S)N)_check_can_readr4peek)r5sizer9r9r:rEsz LZMAFile.peekcCs|j|jj|S)N)rDr4r)r5rFr9r9r:rsz LZMAFile.readcCs"|j|dkrtj}|jj|S)Nr )rDr2DEFAULT_BUFFER_SIZEr4read1)r5rFr9r9r:rHszLZMAFile.read1cCs|j|jj|S)N)rDr4readline)r5rFr9r9r:rIszLZMAFile.readlinecCs:|j|jj|}|jj||jt|7_t|S)N)Z_check_can_writer'rr rr(len)r5dataZ compressedr9r9r:rs   zLZMAFile.writecCs|j|jj||S)N)Z_check_can_seekr4seek)r5offsetwhencer9r9r:rLsz LZMAFile.seekcCs"|j|jtkr|jjS|jS)N)r?r#r%r4tellr()r5r9r9r:rOs  z LZMAFile.tell)Nrrr)rr)rr)rr)r)__name__ __module__ __qualname__r;r<propertyr>r@rBrArCrErrHrIrr2SEEK_SETrLrOr9r9r9r:r&s T   r)rrrrencodingerrorsnewlinec Csd|kr d|krPtd|fn0|dk r0td|dk r@td|dk rPtd|jdd} t|| ||||d} d|krtj| |||S| SdS) NtrzInvalid mode: %rz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary mode)rrrr)r$replacerr2 TextIOWrapper) r6r7rrrrrUrVrWZlz_modeZ binary_filer9r9r:rs   cCs t||||}|j||jS)N)rrr=)rKrrrrcompr9r9r:r6sc Csrg}xbt|||}y|j|}Wntk r>|r8PnYnX|j||jsXtd|j}|sPqWdj|S)NzACompressed data ended before the end-of-stream marker was reached)rr rappendeofZ unused_datajoin)rKrZmemlimitrZresultsZdecompresr9r9r:r Bs   )rrr)__all__r.r2r,Z_lzmar r r1r"r%r&Z BaseStreamrrrrrr r9r9r9r: s0   b- os.cpython-36.pyc000064400000071676152462730460007645 0ustar003 \0@sdZddlZddlZddlZddlZejZddddddd d d d d ddddddddgZddZ ddZ dekrdZ dZ ddl Tyddl mZejdWnek rYnXddlZyddl mZWnek rYnXddl Z eje e [ nd ekrd Z d!Z ddlTyddlmZejdWnek r>YnXddlZddlZeje e[yddlmZWnek rYnXned"eejd#<dd$lmZmZmZmZmZmZmZm Z [e d%re!Z"d&d'Z#e$Z%e#d(d)e#d*d+e#d,d-e#d.d/e#d0d1e#d2d3e#d4d5e#d6d7e#d8d9e#d:d;e#dd?e#d@dAe#dBdCe#dBdDe#dEd1e%Z&e$Z%e#d(d)e%Z'e$Z%e#dFdGe#dHd+e#dId-e#dJdKe#dLdMe%j(ee#dNdOe#dPd1e#dQd1e#dRdSe dTr$e dUr$e#dVdTe%Z)e$Z%e#d(d)e#d,d-e#d.d/e#dWdXe#dYd+e dZrte#d[d-e#d2d3e#d\d1e#d]d/e#d.d/e#dEd1e#d^d/e%Z*[%[["[#dZ+d_Z,d`Z-ddcddZ.dedfZ/dgdhZ0ejdddfdhgddjdkZ1ejdke2ehe&krFe3ehe)krFddbddmdndoZ4dpdqZ5ejdoye6Wne7k rhiZ6YnXdrdsZ8dtduZ9dvdwZ:dxdyZ;dzd{ZdddZ?ddl@mAZAGdddeAZByeCZDWne7k rddZDYnXdekrejdyeEZFWne7k rBddZFYnXdekrXejdddZGeGZ6[GdddZHe d kZIejdeIrddZJeBe6jKeJeLeJeLeDeFZM[JdddZNejdddZOeO\ZPZQ[Oe drHe d rHe drHdZRd_ZSZTejdddgddZUddZVddZWddZXddZYejddddge drpddZZddZ[ejddge drddZ\ddZ]ejddgdddZ^GdddZ_ddZ`ddZae dseaZbdeb_cGdddejdZedS)aNOS routines for NT or Posix depending on what system we're on. This exports: - all functions from posix or nt, e.g. unlink, stat, etc. - os.path is either posixpath or ntpath - os.name is either 'posix' or 'nt' - os.curdir is a string representing the current directory (always '.') - os.pardir is a string representing the parent directory (always '..') - os.sep is the (or a most common) pathname separator ('/' or '\\') - os.extsep is the extension separator (always '.') - os.altsep is the alternate pathname separator (None or '/') - os.pathsep is the component separator used in $PATH etc - os.linesep is the line separator in text files ('\r' or '\n' or '\r\n') - os.defpath is the default search path for executables - os.devnull is the file path of the null device ('/dev/null', etc.) Programs that import and use 'os' stand a better chance of being portable between different platforms. Of course, they must then only use functions that are defined by all platforms (e.g., unlink and opendir), and leave all pathname manipulation to os.path (e.g., split and join). NaltsepcurdirpardirseppathseplinesepdefpathnamepathdevnullSEEK_SETSEEK_CURSEEK_ENDfsencodefsdecode get_exec_pathfdopenpopenextsepcCs |tkS)N)globals)r r/usr/lib64/python3.6/os.py_exists%src Cs2y t|jStk r,ddt|DSXdS)NcSsg|]}|ddkr|qS)r_r).0nrrr ,sz%_get_exports_list..)list__all__AttributeErrordir)modulerrr_get_exports_list(s r"posix )*)_exitr&)_have_functionsntz zno os specific module foundzos.path)rrrrrrrr r'cCs"|tkr|tkrtjt|dS)N)_globalsr'_setadd)strfnrrr_adddsr.HAVE_FACCESSATaccess HAVE_FCHMODATchmod HAVE_FCHOWNATchown HAVE_FSTATATstatHAVE_FUTIMESATutime HAVE_LINKATlink HAVE_MKDIRATmkdir HAVE_MKFIFOATmkfifo HAVE_MKNODATmknod HAVE_OPENATopenHAVE_READLINKATreadlink HAVE_RENAMEATrenameHAVE_SYMLINKATsymlink HAVE_UNLINKATunlinkrmdirHAVE_UTIMENSAT HAVE_FCHDIRchdir HAVE_FCHMOD HAVE_FCHOWNHAVE_FDOPENDIRlistdir HAVE_FEXECVEexecveHAVE_FTRUNCATEtruncate HAVE_FUTIMENS HAVE_FUTIMESHAVE_FPATHCONFpathconfstatvfsfstatvfs HAVE_FSTATVFS HAVE_LCHFLAGSZchflags HAVE_LCHMODlchown HAVE_LCHOWN HAVE_LUTIMES HAVE_LSTATZ MS_WINDOWSFcCstj|\}}|s tj|\}}|r~|r~tj| r~yt|||Wntk rXYnXt}t|trrttd}||kr~dSyt||Wn(t k r| stj | rYnXdS)amakedirs(name [, mode=0o777][, exist_ok=False]) Super-mkdir; create a leaf directory and all intermediate ones. Works like mkdir, except that any intermediate path segment (not just the rightmost) will be created if it does not exist. If the target directory already exists, raise an OSError if exist_ok is False. Otherwise no exception is raised. This is recursive. ASCIIN) r splitexistsmakedirsFileExistsErrorr isinstancebytesr<OSErrorisdir)r modeexist_okheadtailcdirrrrrjs$   rjc Cslt|tj|\}}|s(tj|\}}x>|rf|rfy t|Wntk rTPYnXtj|\}}q*WdS)aremovedirs(name) Super-rmdir; remove a leaf directory and all empty intermediate ones. Works like rmdir except that, if the leaf directory is successfully removed, directories corresponding to rightmost path segments will be pruned away until either the whole path is consumed or an error occurs. Errors during this latter phase are ignored -- they generally mean that a directory was not empty. N)rKr rhrn)r rrrsrrr removedirss   ruc Csptj|\}}|r*|r*tj| r*t|t||tj|\}}|rl|rly t|Wntk rjYnXdS)a<renames(old, new) Super-rename; create directories as necessary and delete any left empty. Works like rename, except creation of any intermediate directories needed to make the new pathname good is attempted first. After the rename, directories corresponding to rightmost path segments of the old name will be pruned until either the whole path is consumed or a nonempty directory is found. Note: this function can fail with the new directory structure made if you lack permissions needed to unlink the leaf directory or file. N)r rhrirjrFrurn)oldnewrrrsrrrrenamess  rxTc6cst|}g}g}g}y t|}Wn0tk rP}z|dk rB||dSd}~XnX|xy(y t|} Wntk rPYnXWn0tk r}z|dk r||dSd}~XnXy | j} Wntk rd} YnX| r|j| jn |j| j| r^| r^|rd} n.y | j} Wntk r8d} YnX| } | r^|j| j q^WWdQRX|r|||fVt j t j } }xp|D]6}|||}|s| | rt ||||EdHqWn0x"|D]}t ||||EdHqW|||fVdS)a Directory tree generator. For each directory in the directory tree rooted at top (including top itself, but excluding '.' and '..'), yields a 3-tuple dirpath, dirnames, filenames dirpath is a string, the path to the directory. dirnames is a list of the names of the subdirectories in dirpath (excluding '.' and '..'). filenames is a list of the names of the non-directory files in dirpath. Note that the names in the lists are just names, with no path components. To get a full path (which begins with top) to a file or directory in dirpath, do os.path.join(dirpath, name). If optional arg 'topdown' is true or not specified, the triple for a directory is generated before the triples for any of its subdirectories (directories are generated top down). If topdown is false, the triple for a directory is generated after the triples for all of its subdirectories (directories are generated bottom up). When topdown is true, the caller can modify the dirnames list in-place (e.g., via del or slice assignment), and walk will only recurse into the subdirectories whose names remain in dirnames; this can be used to prune the search, or to impose a specific order of visiting. Modifying dirnames when topdown is false is ineffective, since the directories in dirnames have already been generated by the time dirnames itself is generated. No matter the value of topdown, the list of subdirectories is retrieved before the tuples for the directory and its subdirectories are generated. By default errors from the os.scandir() call are ignored. If optional arg 'onerror' is specified, it should be a function; it will be called with one argument, an OSError instance. It can report the error to continue with the walk, or raise the exception to abort the walk. Note that the filename is available as the filename attribute of the exception object. By default, os.walk does not follow symbolic links to subdirectories on systems that support them. In order to get this functionality, set the optional argument 'followlinks' to true. Caution: if you pass a relative pathname for top, don't change the current working directory between resumptions of walk. walk never changes the current directory, and assumes that the client doesn't either. Example: import os from os.path import join, getsize for root, dirs, files in os.walk('python/Lib/email'): print(root, "consumes", end="") print(sum([getsize(join(root, name)) for name in files]), end="") print("bytes in", len(files), "non-directory files") if 'CVS' in dirs: dirs.remove('CVS') # don't visit CVS directories NFT) fspathscandirrnnext StopIterationis_dirappendr is_symlinkr islinkjoinwalk)toptopdownonerror followlinksdirsnondirs walk_dirs scandir_iterrorentryr} walk_intorrrdirnamenew_pathrrrrs`:             r.)follow_symlinksdir_fdc cst|t st|d r t|}t|d|d}t|t|d}z:|s^tj|j rtt j |t|rtt |||||EdHWdt |XdS)aDirectory tree generator. This behaves exactly like walk(), except that it yields a 4-tuple dirpath, dirnames, filenames, dirfd `dirpath`, `dirnames` and `filenames` are identical to walk() output, and `dirfd` is a file descriptor referring to the directory `dirpath`. The advantage of fwalk() over walk() is that it's safe against symlink races (when follow_symlinks is False). If dir_fd is not None, it should be a file descriptor open to a directory, and top should be relative; top will then be relative to that directory. (dir_fd is always supported for fwalk.) Caution: Since fwalk() yields file descriptors, those are only valid until the next iteration step, so you should dup() them if you want to keep them for a longer period. Example: import os for root, dirs, files, rootfd in os.fwalk('python/Lib/email'): print(root, "consumes", end="") print(sum([os.stat(name, dir_fd=rootfd).st_size for name in files]), end="") print("bytes in", len(files), "non-directory files") if 'CVS' in dirs: dirs.remove('CVS') # don't visit CVS directories __index__F)rr)rN)rlinthasattrryr6rBO_RDONLYstS_ISDIRst_moder samestat_fwalkclose)rrrrrorig_sttopfdrrrfwalks!rc cs|t|}gg}}x|D]}y.tjt||djr>|j|n |j|Wqtk ry$tjt||ddjr||j|Wntk rwYnXYqXqW|r||||fVx|D]}y t|||d} t|t |d} Wn8tk r} z|dk r|| wWYdd} ~ XnXz>|s0t j | t| rRt j ||} t | | |||EdHWdt| XqW|sx||||fVdS)N)rF)rr)rRrrr6rr~rnS_ISLNKrBrr rrrr) rtoppathrrrnamesrrr rdirfderrdirpathrrrrs<      rcGst||dS)zpexecl(file, *args) Execute the executable file with argument list args, replacing the current process. N)execv)fileargsrrrexecl srcGs |d}t||dd|dS)zexecle(file, *args, env) Execute the executable file with argument list args and environment env, replacing the current process. rdNr)rT)rrenvrrrexeclesrcGst||dS)zexeclp(file, *args) Execute the executable file (which is searched for along $PATH) with argument list args, replacing the current process. N)execvp)rrrrrexeclpsrcGs |d}t||dd|dS)zexeclpe(file, *args, env) Execute the executable file (which is searched for along $PATH) with argument list args and environment env, replacing the current process. rdNrr)execvpe)rrrrrrexeclpe srcCst||dS)zexecvp(file, args) Execute the executable file (which is searched for along $PATH) with argument list args, replacing the current process. args may be a list or tuple of strings. N)_execvpe)rrrrrr)srcCst|||dS)zexecvpe(file, args, env) Execute the executable file (which is searched for along $PATH) with argument list args and environment env , replacing the current process. args may be a list or tuple of strings. N)r)rrrrrrr1srcCs|dk rt}||f}nt}|f}t}tj|\}}|rH||f|dSd}}d} t|} tdkrvt|}tt| } x| D]~} tj | |} y|| f|Wq|t k r} z>| }t j d}| j t jkr| j t jkr|dkr| }|} WYdd} ~ Xq|Xq|W|r|j| |j|dS)Nr(re)rTrenvironr rhrr rmaprrnsysexc_infoerrnoENOENTENOTDIRwith_traceback)rrr exec_funcargrestrrrslast_exc saved_excsaved_tb path_listr fullnameetbrrrr<s<      rcCsddl}|dkrt}|j|jdty|jd}Wntk rPd}YnXtry |d}Wnttfk rzYnX|dk rt d|}|dk rt |t rt |}WdQRX|dkrt }|jtS)zReturns the sequence of directories that will be searched for the named executable (similar to a shell) when launching a process. *env* must be an environment variable dict or None. If *env* is None, os.environ will be used. rNignorePATHsPATHz*env cannot contain 'PATH' and b'PATH' keys)warningsrcatch_warnings simplefilter BytesWarningget TypeErrorsupports_bytes_environKeyError ValueErrorrlrmrrrhr)rrr path_listbrrrr_s.     )MutableMappingc@sTeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ dS)_EnvironcCs.||_||_||_||_||_||_||_dS)N) encodekey decodekey encodevalue decodevalueputenvunsetenv_data)selfdatarrrrrrrrr__init__sz_Environ.__init__c Cs>y|j|j|}Wntk r2t|dYnX|j|S)N)rrrr)rkeyvaluerrr __getitem__s z_Environ.__getitem__cCs.|j|}|j|}|j||||j|<dS)N)rrrr)rrrrrr __setitem__s   z_Environ.__setitem__c CsD|j|}|j|y |j|=Wntk r>t|dYnXdS)N)rrrr)rr encodedkeyrrr __delitem__s    z_Environ.__delitem__ccs(t|j}x|D]}|j|VqWdS)N)rrr)rkeysrrrr__iter__s  z_Environ.__iter__cCs t|jS)N)lenr)rrrr__len__sz_Environ.__len__cs$djdjfddjjDS)Nzenviron({{{}}})z, c3s*|]"\}}djj|j|VqdS)z {!r}: {!r}N)formatrr)rrr)rrr sz$_Environ.__repr__..)rrritems)rr)rr__repr__s z_Environ.__repr__cCst|S)N)dict)rrrrcopysz _Environ.copycCs||kr|||<||S)Nr)rrrrrr setdefaultsz_Environ.setdefaultN) __name__ __module__ __qualname__rrrrrrrrrrrrrrs  rcCsdS)Nr)rrrrrsrrcCs t|dS)N)_putenv)rrrrrsrcstdkrLdd}|t}fdd}i}xJtjD]\}}||||<q2Wn(tjfddfdd }}t}t||||ttS) Nr(cSs t|tstdt|j|S)Nzstr expected, not %s)rlr,rtyper)rrrr check_strs z!_createenviron..check_strcs |jS)N)upper)r)encoderrrsz!_createenviron..encodekeycs(t|tstdt|j|jdS)Nzstr expected, not %ssurrogateescape)rlr,rrrr)r)encodingrrrs z_createenviron..encodecs |jdS)Nr)decode)r)rrrrsz_createenviron..decode) r r,rrrgetfilesystemencodingrr _unsetenv)rrrrrrr)rrr_createenvirons"   rcCs tj||S)zGet an environment variable, return None if it doesn't exist. The optional second argument can specify an alternate default. key, default and the result are str.)rr)rdefaultrrrgetenvsrrcCs t|tstdt|j|S)Nzbytes expected, not %s)rlrmrrr)rrrr _check_bytess rcCs tj||S)zGet an environment variable, return None if it doesn't exist. The optional second argument can specify an alternate default. key, default and the result are bytes.)environbr)rrrrrgetenvbsrrcs4tjtjfdd}fdd}||fS)Ncs&t|}t|tr|jS|SdS)aEncode filename (an os.PathLike, bytes, or str) to the filesystem encoding with 'surrogateescape' error handler, return bytes unchanged. On Windows, use 'strict' error handler if the file system encoding is 'mbcs' (which is the default encoding). N)ryrlr,r)filename)rerrorsrrrs  z_fscodec..fsencodecs&t|}t|tr|jS|SdS)aDecode filename (an os.PathLike, bytes, or str) from the filesystem encoding with 'surrogateescape' error handler, return str unchanged. On Windows, use 'strict' error handler if the file system encoding is 'mbcs' (which is the default encoding). N)ryrlrmr)r)rrrrr&s  z_fscodec..fsdecode)rrgetfilesystemencodeerrors)rrr)rrr_fscodecs   rforkspawnvrP_WAITP_NOWAIT P_NOWAITOc Cst|ttfstd| s&|d r.tdt}|sty$|dkrN|||n ||||WqtdYqXnV|tkr|SxHt|d\}}t |rqqt |rt | St |rt |StdqWdS)Nzargv must be a tuple or a listrz"argv first element cannot be emptyz"Not stopped, signaled or exited???)rltuplerrrrr&rwaitpid WIFSTOPPED WIFSIGNALEDWTERMSIG WIFEXITED WEXITSTATUSrn)rprrrfuncpidwpidstsrrr _spawnvefCs.  rcCst|||dtS)aspawnv(mode, file, args) -> integer Execute file with arguments from args in a subprocess. If mode == P_NOWAIT return the pid of the process. If mode == P_WAIT return the process's exit code if it exits normally; otherwise return -SIG, where SIG is the signal that killed it. N)rr)rprrrrrrbscCst||||tS)a:spawnve(mode, file, args, env) -> integer Execute file with arguments from args in a subprocess with the specified environment. If mode == P_NOWAIT return the pid of the process. If mode == P_WAIT return the process's exit code if it exits normally; otherwise return -SIG, where SIG is the signal that killed it. )rrT)rprrrrrrspawnveksrcCst|||dtS)a8spawnvp(mode, file, args) -> integer Execute file (which is looked for along $PATH) with arguments from args in a subprocess. If mode == P_NOWAIT return the pid of the process. If mode == P_WAIT return the process's exit code if it exits normally; otherwise return -SIG, where SIG is the signal that killed it. N)rr)rprrrrrspawnvpwsrcCst||||tS)a\spawnvpe(mode, file, args, env) -> integer Execute file (which is looked for along $PATH) with arguments from args in a subprocess with the supplied environment. If mode == P_NOWAIT return the pid of the process. If mode == P_WAIT return the process's exit code if it exits normally; otherwise return -SIG, where SIG is the signal that killed it. )rr)rprrrrrrspawnvpesrcGs t|||S)aspawnl(mode, file, *args) -> integer Execute file with arguments from args in a subprocess. If mode == P_NOWAIT return the pid of the process. If mode == P_WAIT return the process's exit code if it exits normally; otherwise return -SIG, where SIG is the signal that killed it. )r)rprrrrrspawnlsrcGs|d}t|||dd|S)a:spawnle(mode, file, *args, env) -> integer Execute file with arguments from args in a subprocess with the supplied environment. If mode == P_NOWAIT return the pid of the process. If mode == P_WAIT return the process's exit code if it exits normally; otherwise return -SIG, where SIG is the signal that killed it. rdNrr)r)rprrrrrrspawnlesrcGs t|||S)aWspawnlp(mode, file, *args) -> integer Execute file (which is looked for along $PATH) with arguments from args in a subprocess with the supplied environment. If mode == P_NOWAIT return the pid of the process. If mode == P_WAIT return the process's exit code if it exits normally; otherwise return -SIG, where SIG is the signal that killed it. )r)rprrrrrspawnlpsrcGs|d}t|||dd|S)a]spawnlpe(mode, file, *args, env) -> integer Execute file (which is looked for along $PATH) with arguments from args in a subprocess with the supplied environment. If mode == P_NOWAIT return the pid of the process. If mode == P_WAIT return the process's exit code if it exits normally; otherwise return -SIG, where SIG is the signal that killed it. rdNrr)r)rprrrrrrspawnlpesrrcCst|tstdt||d kr.td||dks>|dkrFtdddl}ddl}|dkr|j|d|j|d}t |j |j |S|j|d|j|d }t |j |j |SdS) Nz&invalid cmd type (%s, expected string)rwzinvalid mode %rrz+popen() does not support unbuffered streamsT)shellstdoutbufsize)r stdinr")rr) rlr,rrr subprocessioPopenPIPE _wrap_close TextIOWrapperr!r#)cmdrp bufferingr$r%procrrrrs$  c@s<eZdZddZddZddZddZd d Zd d Zd S)r(cCs||_||_dS)N)_stream_proc)rstreamr,rrrrsz_wrap_close.__init__cCs8|jj|jj}|dkr dStdkr,|S|d>SdS)Nrr()r-rr.waitr )r returncoderrrrs  z_wrap_close.closecCs|S)Nr)rrrr __enter__sz_wrap_close.__enter__cGs |jdS)N)r)rrrrr__exit__sz_wrap_close.__exit__cCs t|j|S)N)getattrr-)rr rrr __getattr__sz_wrap_close.__getattr__cCs t|jS)N)iterr-)rrrrrsz_wrap_close.__iter__N) rrrrrr3r4r6rrrrrr(s  r(cOs4t|tstdt|ddl}|j|f||S)Nz&invalid fd type (%s, expected integer)r)rlrrrr%rB)fdrkwargsr%rrrrs c Cst|ttfr|St|}y|j|}Wn0tk rXt|drFntd|jYnXt|ttfrl|Stdj |jt|jdS)aaReturn the path representation of a path-like object. If str or bytes is passed in, it is returned unchanged. Otherwise the os.PathLike interface is used to get the path representation. If the path representation is not str or bytes, TypeError is raised. If the provided path is not str, bytes, or os.PathLike, TypeError is raised. __fspath__z/expected str, bytes or os.PathLike object, not z7expected {}.__fspath__() to return str or bytes, not {}N) rlr,rmrr:rrrrr)r path_type path_reprrrr_fspaths r=ryc@s*eZdZdZejddZeddZdS)PathLikezCAbstract base class for implementing the file system path protocol.cCstdS)z9Return the file system path representation of the object.N)NotImplementedError)rrrrr:&szPathLike.__fspath__cCs t|dS)Nr:)r)clssubclassrrr__subclasshook__+szPathLike.__subclasshook__N) rrr__doc__abcabstractmethodr: classmethodrBrrrrr>"sr>)rfF)TNF)rTN)N)N)N)rr)N)rrr)rr)frCrDrrr6rbuiltin_module_namesZ_namesrrr"r rr#r&r~ ImportError posixpathr r'extendr(ZntpathmodulesZos.pathrrrrrrrr rr)r.setr*supports_dir_fdsupports_effective_idsr+ supports_fdsupports_follow_symlinksr r rrjrurxrrBrRrrr NameErrorrrrrrrrr_collections_abcrrrrrrrrrrrrmrrrrrrrr rrrrrrrrrrr(rr=ryrABCr>rrrrs|       (                                             ./     # - 7                       csv.cpython-36.opt-2.pyc000064400000023132152462730460010737 0ustar003 \4?@sHddlZddlmZmZmZmZmZmZmZm Z m Z m Z m Z m Z mZmZddlmZddlmZddlmZdddd d d d d dddddddddddddgZGdd d ZGdd d eZed eGdddeZedeGdddeZed eGd!ddZGd"ddZyeWnek r4eZYnXGd#ddZdS)$N)Error __version__writerreaderregister_dialectunregister_dialect get_dialect list_dialectsfield_size_limit QUOTE_MINIMAL QUOTE_ALLQUOTE_NONNUMERIC QUOTE_NONE__doc__)Dialect) OrderedDict)StringIOr r r rrrrexcel excel_tabr rrrrr Snifferrr DictReader DictWriter unix_dialectc@s@eZdZdZdZdZdZdZdZdZ dZ dZ ddZ ddZ dS)rFNcCs|jtkrd|_|jdS)NT) __class__r_valid _validate)selfr/usr/lib64/python3.6/csv.py__init__+s zDialect.__init__cCs@y t|Wn.tk r:}ztt|WYdd}~XnXdS)N)_Dialect TypeErrorrstr)rerrrr0s zDialect._validate)__name__ __module__ __qualname___namer delimiter quotecharZ escapechar doublequoteskipinitialspacelineterminatorquotingr rrrrrrsc@s$eZdZdZdZdZdZdZeZ dS)r,"TFz N) r%r&r'r)r*r+r,r-r r.rrrrr7s c@seZdZdZdS)r N)r%r&r'r)rrrrrAsz excel-tabc@s$eZdZdZdZdZdZdZeZ dS)rr/r0TF N) r%r&r'r)r*r+r,r-r r.rrrrrFs Zunixc@s@eZdZd ddZddZeddZejd dZd d ZdS) rNrcOs6||_||_||_t||f|||_||_d|_dS)Nr) _fieldnamesrestkeyrestvalrdialectline_num)rf fieldnamesr4r5r6argskwdsrrrr Rs zDictReader.__init__cCs|S)Nr)rrrr__iter__[szDictReader.__iter__c Cs@|jdkr0yt|j|_Wntk r.YnX|jj|_|jS)N)r3nextr StopIterationr7)rrrrr9^s  zDictReader.fieldnamescCs ||_dS)N)r3)rvaluerrrr9hscCs|jdkr|jt|j}|jj|_x|gkr:t|j}q&Wtt|j|}t|j}t|}||krz||d||j<n*||krx |j|dD]}|j||<qW|S)Nr) r7r9r=rrziplenr4r5)rrowdZlfZlrkeyrrr__next__ls     zDictReader.__next__)NNNr) r%r&r'r r<propertyr9setterrErrrrrQs   c@s6eZdZdddZddZdd Zd d Zd d ZdS)rrraisercOsB||_||_|jdkr$td|||_t||f|||_dS)NrHignorez-extrasaction (%s) must be 'raise' or 'ignore')rHrI)r9r5lower ValueError extrasactionr)rr8r9r5rLr6r:r;rrrr s zDictWriter.__init__cCs tt|j|j}|j|dS)N)dictr@r9writerow)rheaderrrr writeheaderszDictWriter.writeheadercsNjdkr8jj}|r8tddjdd|DfddjDS)NrHz(dict contains fields not in fieldnames: z, cSsg|] }t|qSr)repr).0xrrr sz,DictWriter._dict_to_list..c3s|]}j|jVqdS)N)getr5)rRrD)rowdictrrr sz+DictWriter._dict_to_list..)rLkeysr9rKjoin)rrVZ wrong_fieldsr)rVrr _dict_to_lists  zDictWriter._dict_to_listcCs|jj|j|S)N)rrNrZ)rrVrrrrNszDictWriter.writerowcCs|jjt|j|S)N)r writerowsmaprZ)rZrowdictsrrrr[szDictWriter.writerowsN)rrHr)r%r&r'r rPrZrNr[rrrrrs  c@s6eZdZddZd ddZddZdd Zd d ZdS) rcCsdddddg|_dS)Nr/r1; :) preferred)rrrrr szSniffer.__init__NcCsd|j||\}}}}|s(|j||\}}|s4tdGdddt}||_||_|pVd|_||_|S)NzCould not determine delimiterc@seZdZdZdZeZdS)zSniffer.sniff..dialectZsniffedz N)r%r&r'r(r-r r.rrrrr6sr6r0)_guess_quote_and_delimiter_guess_delimiterrrr+r)r*r,)rsample delimitersr*r+r)r,r6rrrsniffs  z Sniffer.sniffcCsg}x0dD](}tj|tjtjB}|j|}|r Pq W|s>dSi}i}d}|j} x|D]} | dd } | | } | r|j| dd || <y| d d } | | } Wntk rwVYnX| r|dks| |kr|j| dd || <y| d d } Wntk rwVYnX| | rV|d 7}qVWt||jd } |rZt||jd }|||k}|d krbd}nd}d}tjdtj || dtj}|j |rd}nd}| |||fS)NI(?P[^\w\n"\'])(?P ?)(?P["\']).*?(?P=quote)(?P=delim)G(?:^|\n)(?P["\']).*?(?P=quote)(?P[^\w\n"\'])(?P ?)G(?P[^\w\n"\'])(?P ?)(?P["\']).*?(?P=quote)(?:$|\n)-(?:^|\n)(?P["\']).*?(?P=quote)(?:$|\n)rFrquotedelimZspace)rDr2z]((%(delim)s)|^)\W*%(quote)s[^%(delim)s\n]*%(quote)s[^%(delim)s\n]*%(quote)s\W*((%(delim)s)|$))rlrjT)rfrgrhri)rFNr) recompileDOTALL MULTILINEfindall groupindexrUKeyErrormaxescapesearch)rdatardZmatchesZrestrZregexpZquotesdelimsZspacesrrmnrDr*rlr,Z dq_regexpr+rrrras`          z"Sniffer._guess_quote_and_delimitercCsttd|jd}ddtdD}tdt|}d}i}i}i}dt|t|} } x| t|krn|d7}xT|| | D]D} x>|D]6} |j| i} | j| }| j|dd| |<| || <qWqWx|jD]} t|| j }t|dkr|dddkrqt|dkrht |dd d || <|j || || d|| dt d d |Df|| <q|d|| <qW|j }t ||}d }d}xt|dkr||krx\|D]T\}}|ddkr|ddkr|d||kr|dks||kr|||<qW|d8}qWt|dkr`t|jd}|dj||djd|k}||fS| } | |7} q\W|szdSt|dkrxF|jD]<}||jkr|dj||djd|k}||fSqWdd|j D}|j|dd}|dj||djd|k}||fS)Nr2cSsg|] }t|qSr)chr)rRcrrrrT.sz,Sniffer._guess_delimiter.. rrkcSs|dS)Nrkr)rSrrrHsz*Sniffer._guess_delimiter..)rDcss|]}|dVqdS)rkNr)rRitemrrrrWMsz+Sniffer._guess_delimiter..g?g?g{Gz?z%c rcSsg|]\}}||fqSrr)rRkvrrrrTws)rr)listfiltersplitrangeminrArUcountrXitemsrtremovesumfloatr`sort)rrwrdasciiZ chunkLengthZ iterationZ charFrequencyZmodesrxstartendlinecharZ metaFrequencyZfreqrZmodeListZtotalZ consistencyZ thresholdrrrlr,rCrrrrbst           zSniffer._guess_delimiterc Cstt||j|}t|}t|}i}xt|D] }d||<q2Wd}x|D]}|dkrZP|d7}t||krpqLxt|jD]x} xJtt t gD]0} y| || PWqt t fk rYqXqWt|| } | || kr~|| dkr| || <q~|| =q~WqLWd} x|j D]~\} } t| tdkrLt|| | krB| d7} n| d8} ns0@       2 modulefinder.cpython-36.pyc000064400000036010152462730460011660 0ustar003 \Y@sdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z e j e j de ddlZWdQRXejdZejdZejdZejdZeefZejZiZdd ZiZd d ZGd d d ZGdddZddZedkry eZWnek re dYnXdS)z3Find modules used by a script, using introspection.Nignore LOAD_CONST IMPORT_NAME STORE_NAME STORE_GLOBALcCstj|gj|dS)N)packagePathMap setdefaultappend)Z packagenamepathr $/usr/lib64/python3.6/modulefinder.pyAddPackagePath sr cCs |t|<dS)N)replacePackageMap)Zoldnamenewnamer r r ReplacePackage+src@seZdZdddZddZdS)ModuleNcCs(||_||_||_d|_i|_i|_dS)N)__name____file____path____code__ globalnames starimports)selfnamefiler r r r __init__1s zModule.__init__cCsLd|jf}|jdk r&|d|jf}|jdk r@|d|jf}|d}|S)Nz Module(%rz, %r))rrr)rsr r r __repr__>s   zModule.__repr__)NN)r __module__ __qualname__rrr r r r r/s rc@seZdZddggfddZddZddZd d Zd d Zd dZd7ddZ d9ddZ ddZ ddZ d:ddZ ddZddZddZd d!Zd ModuleFinderNrcCsB|dkrtj}||_i|_i|_||_d|_||_||_g|_dS)Nr) sysr modules badmodulesdebugindentexcludes replace_pathsprocessed_paths)rr r%r'r(r r r rIszModuleFinder.__init__cGs^||jkrZxt|jD]}tdddqWt|ddx|D]}tt|ddqr?r@)rrAdirrZextrBrCr r r load_fileps   zModuleFinder.load_filer5c Cs\|jdd|||||j||d}|j||\}}|j||}|sF|S|jrX|j||dS)N import_hook)r/)r4determine_parentfind_head_package load_tailrensure_fromlist) rrcallerfromlistr/parentqtailmr r r rJws  zModuleFinder.import_hookcCsP|jdd||| s|dkr.|jdddS|j}|dkr|jrJ|d8}|dkrz|j|}||ksht|jdd||S|jd|krtddj|j dd| }|j|}|jdd||S|jr|j|}||kst|jdd||Sd|kr@|j d}|d|}|j|}|j|ks.t|jdd||S|jdddS) NrKrzdetermine_parent -> Noner5zdetermine_parent ->.zrelative importpath too deep) r6r7rrr#AssertionErrorcount ImportErrorjoinrErfind)rrOr/ZpnamerQr2r r r rKsB           zModuleFinder.determine_parentcCs|jdd||d|kr@|jd}|d|}||dd}n|}d}|r\d|j|f}n|}|j|||}|r|jdd||f||fS|r|}d}|j|||}|r|jdd||f||fS|jdd|td |dS) NrUrLrVr5r:z%s.%szfind_head_package ->z"raise ImportError: No module namedzNo module named )r6findr import_moduler7rY)rrQrr2headrSZqnamerRr r r rLs.  zModuleFinder.find_head_packagecCs|jdd|||}xz|r|jd}|dkr4t|}|d|||dd}}d|j|f}|j|||}|s|jdd|td|qW|jdd ||S) NrUrMrVrr5z%s.%sz"raise ImportError: No module namedzNo module named z load_tail ->)r6r\lenrr]r7rY)rrRrSrTr2r^Zmnamer r r rMs zModuleFinder.load_tailcCs|jdd|||xl|D]d}|dkrF|s||j|}|r||j||dqt||sd|j|f}|j|||}|std|qWdS)NrUrN*r5z%s.%szNo module named )r4find_all_submodulesrNhasattrrr]rY)rrTrP recursivesuballsubnameZsubmodr r r rNs   zModuleFinder.ensure_fromlistc Cs|js dSi}g}|tjjdd7}|tjjdd7}|tjjdd7}x|jD]}ytj|}Wn$tk r|j dd|wVYnXx\|D]T}d}x6|D].}t |} || d|kr|d| }PqW|r|dkr|||<qWqVW|j S)Nr8zcan't list directoryr) r importlib machineryEXTENSION_SUFFIXESSOURCE_SUFFIXESBYTECODE_SUFFIXESrDlistdirOSErrorr4r_keys) rrTr#suffixesrGnamesrmodZsuffnr r r ras.    z ModuleFinder.find_all_submodulescCs|jdd|||y|j|}Wntk r4YnX|jdd||S||jkrb|jdddS|r|jdkr|jdddSy|j||o|j|\}}}Wn"tk r|jddddSXz|j||||}Wd|r|j X|rt ||||jdd||S)NrIr]zimport_module ->zimport_module -> None) r6r#KeyErrorr7r$r find_modulerYr@closesetattr)rZpartnamefqnamerQrTrBrArCr r r r]s6     zModuleFinder.import_modulec Cs|\}}}|jdd||od||tjkrH|j||}|jdd||S|tjkrht|jd|d} nj|tjkryt j j |j} Wn:t k r} z|jddt | |WYdd} ~ XnXtj| } nd} |j|}||_| r |jr|j| } | |_|j| ||jdd||S)Nr8r@rBzload_module -> execzraise ImportError: )r6r>Z PKG_DIRECTORY load_packager7r?compilereadZ PY_COMPILEDrg_bootstrap_external_validate_bytecode_headerrYr0marshalloads add_modulerr(replace_paths_in_coder scan_code) rrwrBrA file_infosuffixmodetyperTcoZ marshal_dataexcr r r r@s2         zModuleFinder.load_modulecCs<||jkri|j|<|r*d|j||j<nd|j|d<dS)Nr5-)r$r)rrrOr r r _add_badmodule4s   zModuleFinder._add_badmodulecCs||jkr|j||dSy|j|||dWn@tk rn}z$|jddt||j||WYdd}~XnX|rx|D]}||jkr|j||q|y|j|||g|dWq|tk r}z0|jddt||d|}|j||WYdd}~Xq|Xq|WdS)N)r/r8z ImportError:rV)r$rrJrYr4r0)rrrOrPr/r4rdfullnamer r r _safe_import_hook<s&      zModuleFinder._safe_import_hookc cs|j}|j}|j}ddtj|D}xt|D]\}\}}|tkrVd||ffVq0|tkr0|dkr0||dd||ddkotknr0|||dd} |||dd} | dkrd| ||ffVq0d| | ||ffVq0q0WdS) NcSs"g|]\}}}|tkr||fqSr ) EXTENDED_ARG).0_opr3r r r Xsz-ModuleFinder.scan_opcodes..storer8r5rabsolute_importrelative_import) co_codeco_names co_constsdisZ_unpack_opargs enumerate STORE_OPSrr) rrcoderpconstsZopargsr2rZopargr/rPr r r scan_opcodesSs 0zModuleFinder.scan_opcodescCs|j}|j}xT||D]F\}}|dkr<|\}d|j|<q|dkr|\}}d} |dk rtd|krfd} dd|D}|j|||dd| r`d} |jr|jj|jd |} | dkr|jj|} | dk r|jj| j|j j| j | j dkrd|j |<n d|j |<q|d krX|\} }}|r4|j|||| dn"|j || d} |j| jd|ddqt |qWx,|j D]"} t| t|rl|j| |qlWdS) Nrr5rrr`cSsg|]}|dkr|qS)r`r )rfr r r rusz*ModuleFinder.scan_code..)r/rVr)rrrrrr#getrupdaterrrK RuntimeErrorr isinstancerr)rrrTrscannerZwhatr1rrPZ have_starZmmr/rQcr r r rhsH          zModuleFinder.scan_codec Cs|jdd||tj|}|r"|}|j|}||_|g|_|jtj|g|_|jd|j\}}}z"|j|||||j dd||S|r|j XdS)Nr8rzrzload_package ->) r6rrrrrrrtr@r7ru)rrwrArrTrBZbufrCr r r rzs  zModuleFinder.load_packagecCs*||jkr|j|St||j|<}|S)N)r#r)rrwrTr r r rs  zModuleFinder.add_modulecCsr|dk r|jd|}n|}||jkr<|jdd|t||dkrf|tjkr`ddddtjffS|j}tj ||S)NrVrIzfind_module -> Excludedr:) rr'r7rYr"builtin_module_namesr>Z C_BUILTINr rt)rrr rQrr r r rts  zModuleFinder.find_modulecCs"ttddtddt|jj}xJ|D]B}|j|}|jrTtdddn tdddtd ||jppd q2W|j\}}|rttd x2|D]*}t|j|j}td |d dj|qW|rttdddtdx2|D]*}t|j|j}td |d dj|qWdS)zPrint a report to stdout, listing the found modules with their paths, as well as modules that are missing, or seem to be missing. z %-25s %sNameFile----Pr*)r+rTz%-25sr:zMissing modules:?z imported fromz, z7Submodules that appear to be missing, but could also bez#global names in the parent package:N)rr)rr) r-sortedr#rnrrany_missing_mayber$rZ)rrnkeyrTmissingmayberZmodsr r r reports0         zModuleFinder.reportcCs|j\}}||S)zReturn a list of modules that appear to be missing. Use any_missing_maybe() if you want to know which modules are certain to be missing, and which *may* be missing. )r)rrrr r r any_missings zModuleFinder.any_missingcCsg}g}x|jD]}||jkr q|jd}|dkr>|j|q||dd}|d|}|jj|}|dk r||j|kr|j|q||jkrq|jr|j|q|j|q|j|qW|j|j||fS)aReturn two lists, one with modules that are certainly missing and one with modules that *may* be missing. The latter names could either be submodules *or* just global names in the package. The reason it can't always be determined is that it's impossible to tell which names are imported when "from module import *" is done with an extension module, short of actually importing it. rVrr5N) r$r'r[r r#rrrsort)rrrrr2rfZpkgnameZpkgr r r rs0           zModuleFinder.any_missing_maybecCstjj|j}}x2|jD](\}}|j|r||t|d}PqW|jr||jkr||krt|j dd||fn|j dd|f|jj |t |j }x8t t|D](}t||t|r|j||||<qWtj|j|j|j|j|j|jt||j|j||j|j|j|j|j S)Nr8zco_filename %r changed to %rz co_filename %r remains unchanged)!rDr normpath co_filenamer( startswithr_r%r)r7r listrr,rrrtypesCodeType co_argcountco_kwonlyargcount co_nlocals co_stacksizeco_flagsrtupler co_varnamesco_nameco_firstlineno co_lnotab co_freevars co_cellvars)rrZ new_filenameZoriginal_filenamerr;rr2r r r rs,        z"ModuleFinder.replace_paths_in_code)NNrr)r)rr)r)N)rrr rr4r6r7r9rHrJrKrLrMrNrar]r@rrrrrzrrtrrrrr r r r r!Gs2   #  1 ".r!cCsddl}y|jtjddd\}}Wn*|jk rP}z t|dSd}~XnXd}d}g}g}xb|D]Z\}} |dkr|d}|dkrd}|dkr|| jtj}|dkrd}|dkrh|j| qhW|sd } n|d} tj dd} tj j | | d<|| } |dkr.td x| D]} td t | qWt | ||} xp|ddD]`}|dkr^d}qH|r|ddd kr| j |ddddgn | j |n | j|qHW| j| | j| S)Nrr5zdmp:qx:z-dz-mz-pz-qz-xzhello.pyzpath:z r8z.*r`r)getoptr"argverrorr-rErDpathsepr r dirnamer.r!rJrHr9r)rZoptsr1r4r%ZdomodsZaddpathZexcludeoaZscriptr itemmfr3r r r test:sX      rr<z [interrupted])!__doc__rZimportlib._bootstrap_externalrgimportlib.machineryrrDr"rZstructwarningscatch_warnings simplefilterDeprecationWarningr>Zopmaprrrrrrrr rrrr!rrrKeyboardInterruptr-r r r r sB      v;  _strptime.cpython-36.pyc000064400000037135152462730460011222 0ustar003 \` @sdZddlZddlZddlZddlmZddlmZddlmZ ddl m Z m ZmZyddlmZWn ek rddlmZYnXgZdd ZGd d d eZGd d d eZeZeadZiaddZ ddZ!dddZ"dddZ#dddZ$dS)aStrptime-related classes and functions. CLASSES: LocaleTime -- Discovers and stores locale-specific time information TimeRE -- Creates regexes for pattern matching a string of text containing time information FUNCTIONS: _getlang -- Figure out what language is being used for the locale strptime -- Calculates the time struct represented by the passed-in string N)compile) IGNORECASE)escape)date timedeltatimezone) allocate_lockcCs tjtjS)N)localeZ getlocaleLC_TIMEr r !/usr/lib64/python3.6/_strptime.py_getlangsr c@sHeZdZdZddZddZddZdd Zd d Zd d Z ddZ dS) LocaleTimeakStores and handles locale-specific information related to time. ATTRIBUTES: f_weekday -- full weekday names (7-item list) a_weekday -- abbreviated weekday names (7-item list) f_month -- full month names (13-item list; dummy value in [0], which is added by code) a_month -- abbreviated month names (13-item list, dummy value in [0], which is added by code) am_pm -- AM/PM representation (2-item list) LC_date_time -- format string for date/time representation (string) LC_date -- format string for date representation (string) LC_time -- format string for time representation (string) timezone -- daylight- and non-daylight-savings timezone representation (2-item list of sets) lang -- Language used by instance (2-item tuple) cCsht|_|j|j|j|j|jt|jkrDtdtj |j ks\tj |j krdtddS)aSet all attributes. Order of methods called matters for dependency reasons. The locale language is set at the offset and then checked again before exiting. This is to make sure that the attributes were not set with a mix of information from more than one locale. This would most likely happen when using threads where one thread calls a locale-dependent function while another thread changes the locale while the function in the other thread is still running. Proper coding would call for locks to prevent changing the locale while locale-dependent code is running. The check here is done in case someone does not think about doing this. Only other possible issue is if someone changed the timezone and did not call tz.tzset . That is an issue for the programmer, though, since changing the timezone is worthless without that call. z$locale changed during initializationz&timezone changed during initializationN) r lang_LocaleTime__calc_weekday_LocaleTime__calc_month_LocaleTime__calc_am_pm_LocaleTime__calc_timezone_LocaleTime__calc_date_time ValueErrortimetznamedaylight)selfr r r __init__4s zLocaleTime.__init__cCs(t|}|r|jddn |jd|S)Nr)listinsertappend)rseqfrontr r r Z__padSs  zLocaleTime.__padcCs4ddtdD}ddtdD}||_||_dS)NcSsg|]}tj|jqSr )calendarZday_abbrlower).0ir r r _sz-LocaleTime.__calc_weekday..cSsg|]}tj|jqSr )r!Zday_namer")r#r$r r r r%`s)range a_weekday f_weekday)rr(r)r r r Z__calc_weekday\szLocaleTime.__calc_weekdaycCs4ddtdD}ddtdD}||_||_dS)NcSsg|]}tj|jqSr )r!Z month_abbrr")r#r$r r r r%fsz+LocaleTime.__calc_month.. cSsg|]}tj|jqSr )r!Z month_namer")r#r$r r r r%gs)r'a_monthf_month)rr+r,r r r Z __calc_monthdszLocaleTime.__calc_monthc CsNg}x>d D]6}tjddd|dddd d f }|jtjd |jq W||_dS) Ni,7Lrz%p)r-r.)r struct_timerstrftimer"am_pm)rr7hour time_tupler r r Z __calc_am_pmks  zLocaleTime.__calc_am_pmc CsXtjd1}dddg}tjd |j|d <tjd |j|d <tjd |j|d<d2|jddf|jddf|jddf|jddf|jd dfd3d4d5d6d7d8d9d:d;d.Z00z%Wz%UZ11) r:r/r0r.r1r2r3r4r)r>r?)r@rA)rBrC)rDrE)rFrG)rHrI)rJrK)rLrM)rNrO)rPrO)rQrR)rSrTrr;r-r<r3r=)rXrYrZ) r:r-r/r-r-r-rWr/r)rr5r6r"r)r,r(r+r7extendrreplace LC_date_timeLC_dateLC_time) rr9Z date_timeZreplacement_pairsoffset directiveZcurrent_formatoldnewZU_Wr r r Z__calc_date_timews4     zLocaleTime.__calc_date_timec Cszy tjWntk r YnXtj|_tj|_tdd|jdjh}|jrft|jdjh}nt}||f|_dS)Nutcgmtrr-)rZtzsetAttributeErrorrr frozensetr"r)rZ no_savingZ has_savingr r r Z__calc_timezones zLocaleTime.__calc_timezoneN) __name__ __module__ __qualname____doc__rZ_LocaleTime__padrrrrrr r r r r!s  -rcs:eZdZdZd fdd ZddZddZd d ZZS) TimeREz4Handle conversion from format directives to regexes.Ncs|r ||_nt|_t}|jddddddddd d d d d ddd|j|jjd|j|jjd|j|jjddd|j|jjddd|j|jj d|jdd|jj Dddd|j d|j dj dd|j d|j|jj|j d |j|jj|j d!|j|jjdS)"z^Create keys/values. Order of execution is important for dependency reasons. z)(?P3[0-1]|[1-2]\d|0[1-9]|[1-9]| [1-9])z(?P[0-9]{1,6})z(?P2[0-3]|[0-1]\d|\d)z(?P1[0-2]|0[1-9]|[1-9])z(?P\d\d\d\d)zG(?P36[0-6]|3[0-5]\d|[1-2]\d\d|0[1-9]\d|00[1-9]|[1-9]\d|0[1-9]|[1-9])z(?P1[0-2]|0[1-9]|[1-9])z(?P[0-5]\d|\d)z(?P6[0-1]|[0-5]\d|\d)z(?P5[0-3]|[0-4]\d|\d)z (?P[0-6])z (?P[1-7])z(?P5[0-3]|0[1-9]|[1-4]\d|\d)z (?P\d\d)z(?P\d\d\d\d)z(?P[+-]\d\d[0-5]\d)Aar-NBbpcss|]}|D] }|Vq qdS)Nr )r#Ztz_namesrVr r r sz"TimeRE.__init__..Zr>)dfHIGjmMSUwuVyYzrmrnrorprqrsr>Wr}cxX) locale_timersuperr_TimeRE__seqToREr)r(r,r+r7r __setitem__ __getitem__r\patternr]r^r_)rrbase) __class__r r rsB zTimeRE.__init__cCsRt|tdd}x|D]}|dkrPqWdSdjdd|D}d||f}d|S) aeConvert a list to a regex string for matching a directive. Want possible matching values to be from longest to shortest. This prevents the possibility of a match occurring for a value that also a substring of a larger value that should have matched (e.g., 'abc' matching when 'abcdef' should have been the match). T)keyreverser|css|]}t|VqdS)N) re_escape)r#Zstuffr r r rrsz#TimeRE.__seqToRE..z (?P<%s>%sz%s))sortedlenjoin)rZ to_convertravalueZregexr r r Z __seqToREs   zTimeRE.__seqToREcCsd}td}|jd|}td}|jd|}xLd|krx|jdd}d||d |d|||f}||dd }q.Wd ||fS) zReturn regex pattern for the format string. Need to make sure that any characters that might be interpreted as regex syntax are escaped. rz([\\.^$*+?\(\){}\[\]|])z\\\1z\s+z\\s+r>r-z%s%s%sNz%s%s) re_compilesubindex)rformatZprocessed_formatZ regex_charsZwhitespace_replacementZdirective_indexr r r rs   zTimeRE.patterncCst|j|tS)z2Return a compiled re object for the format string.)rrr)rrr r r rszTimeRE.compile)N) rhrirjrkrrrr __classcell__r r )rr rls .rlcCslt|ddj}|s,|dd}|dd}d|d}|dkrLd||S|d|d}d||SdS)zCalculate the Julian day based on the year, week of the year, and day of the week, with week_start_day representing whether the week of the year assumes the week starts on Sunday or Monday (6 or 0).r-r&rN) datetime_dateweekday)year week_of_yearZ day_of_weekweek_starts_MonZ first_weekdayZ week_0_lengthZ days_to_weekr r r _calc_julian_from_U_or_Ws    rcCsdt|ddjd}|d||}|dkr\|t|ddj7}|d8}|t|ddj8}||fS)zCalculate the Julian day based on the ISO 8601 year, week, and weekday. ISO weeks start on Mondays, with week 01 being the week containing 4 Jan. ISO week days range from 1 (Monday) to 7 (Sunday). r-r/r&)rZ isoweekday toordinal)iso_yeariso_weekZ iso_weekdayZ correctionZordinalr r r _calc_julian_from_V1sr%a %b %d %H:%M:%S %Yc' Cslx:t||gD]*\}}t|tsd}t|j|t|qWttj}t |j kslt j |j kslt j |j krtatjtj}tttkrtjtj|}|s,ytj|}Wnptk r}z0|jd}|dkrd}~td||fdWYdd}~Xn$tk r"td|dYnX|t|<WdQRX|j|} | sVtd||ft|| jkrtd || jdd} } d } } d}}}}d:}d}d}}d}d}}| j}x|jD]}|d kr t|d } | d kr| d 7} n| d7} q|dkr&t|d} q|dkr@t|d} q|dkrZt|d} q|dkr||jj|dj } q|dkr|j!j|dj } q|dkrt|d} q|dkrt|d}q|dkrBt|d}|jddj }|d|j"dfkr|dkr>d}n"||j"d krT|dkrT|d7}q|dkr\t|d}q|dkrvt|d}q|dkr|d}|ddt|7}t|}q|dkr|j#j|dj }q|d kr|j$j|d j }q|d!krt|d!}|dkrd}n|d 8}q|d"kr@t|d"}|d 8}q|d#krZt|d#}q|d;krt||}|d$krd}nd}n|d&krt|d&}n|d'kr|d'}t|d d(d)t|d(d*}|j%d+rT| }nl|d,kr|d,j }xTt|j&D]F\}} || kr t j dt j d krHt j rH|dz&'%s' is a bad directive in format '%s'Nzstray %% in format '%s'z%time data %r does not match format %rzunconverted data remains: %sr-rDiilrrxrzrorprtrvrwrqr r{r|ru0rWrmrnr~rryr}rrrr/<r-rsrdrezzISO year directive '%G' must be used with the ISO week directive '%V' and a weekday directive ('%A', '%a', '%w', or '%u').z`Day of the year directive '%j' is not compatible with ISO year directive '%G'. Use '%Y' instead.zzISO week directive '%V' must be used with the ISO year directive '%G' and a weekday directive ('%A', '%a', '%w', or '%u').zdISO week directive '%V' is incompatible with the year directive '%Y'. Use the ISO year '%G' instead.Fr3ipTinim)r}r)rdre)2 enumerate isinstancestr TypeErrorrtype _cache_lock _TimeRE_cacherr rrrrrl _regex_cacheclearr_CACHE_MAX_SIZEgetrKeyErrorargsr IndexErrormatchend groupdictkeysintr,rr"r+r7r)r( startswithrrrr!ZisleaprrZ fromordinalrmonthdayr)' data_stringrrargmsgrZ format_regexerrZ bad_directivefoundrrrrr8ZminutesecondfractionrVZtzoffsetrrZweek_of_year_startrZjulianZ found_dictZ group_keyZampmsrZ found_zonerrUZ leap_year_fixrZydayZdatetime_resultrgmtoffr r r _strptimeAsB                                             $           &    rcCs"t||d}tj|dtjS)zIReturn a time struct based on the input string and the format string.rN)rrr5Z_STRUCT_TM_ITEMS)rrttr r r _strptime_time,src Cslt||\}}|dd\}}|dd|f}|dk rdt|d}|rRt||} nt|} || f7}||S)zPReturn a class cls instance based on the input string and the format string.r3NrW)Zseconds)rdatetime_timedeltadatetime_timezone) clsrrrrrrrZtzdeltarVr r r _strptime_datetime2s   r)r)r)r)%rkrr r!rerrrrrZdatetimerrrrrr_threadrZ_thread_allocate_lock ImportErrorZ _dummy_thread__all__r objectrdictrlrrrrrrrrrr r r r  s4   _ l site.cpython-36.opt-1.pyc000064400000037751152462730460011123 0ustar003 iS@s dZddlZddlZddlZddlZejejgadada da ddZ ddZ ddZ d d Zd d Zd.d dZddZddZddZddZd/ddZd0ddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zejj sed+d,Z!e"d-kre!dS)1a Append module search paths for third-party packages to sys.path. **************************************************************** * This module is automatically imported during initialization. * **************************************************************** This will append site-specific paths to the module search path. On Unix (including Mac OSX), it starts with sys.prefix and sys.exec_prefix (if different) and appends lib/python/site-packages. On other platforms (such as Windows), it tries each of the prefixes directly, as well as with lib/site-packages appended. The resulting directories, if they exist, are appended to sys.path, and also inspected for path configuration files. If a file named "pyvenv.cfg" exists one directory above sys.executable, sys.prefix and sys.exec_prefix are set to that directory and it is also checked for site-packages (sys.base_prefix and sys.base_exec_prefix will always be the "real" prefixes of the Python installation). If "pyvenv.cfg" (a bootstrap configuration file) contains the key "include-system-site-packages" set to anything other than "false" (case-insensitive), the system-level prefixes will still also be searched for site-packages; otherwise they won't. All of the resulting site-specific directories, if they exist, are appended to sys.path, and also inspected for path configuration files. A path configuration file is a file whose name has the form .pth; its contents are additional directories (one per line) to be added to sys.path. Non-existing directories (or non-directories) are never added to sys.path; no directory is added to sys.path more than once. Blank lines and lines beginning with '#' are skipped. Lines starting with 'import' are executed. For example, suppose sys.prefix and sys.exec_prefix are set to /usr/local and there is a directory /usr/local/lib/python2.5/site-packages with three subdirectories, foo, bar and spam, and two path configuration files, foo.pth and bar.pth. Assume foo.pth contains the following: # foo package configuration foo bar bletch and bar.pth contains: # bar package configuration bar Then the following directories are added to sys.path, in this order: /usr/local/lib/python2.5/site-packages/bar /usr/local/lib/python2.5/site-packages/foo Note that bletch is omitted because it doesn't exist; bar precedes foo because bar.pth comes alphabetically before foo.pth; and spam is omitted because it is not mentioned in either path configuration file. The readline module is also automatically configured to enable completion for systems that support it. This can be overridden in sitecustomize, usercustomize or PYTHONSTARTUP. Starting Python in isolated mode (-I) disables automatic readline configuration. After these operations, an attempt is made to import a module named sitecustomize, which can perform arbitrary additional site-specific customizations. If this import fails with an ImportError exception, it is silently ignored. Nc GsBtjj|}ytjj|}Wntk r0YnX|tjj|fS)N)ospathjoinabspathOSErrornormcase)pathsdirr /usr/lib64/python3.6/site.pymakepathZs  r cCsxttjjD]~}tt|dddddkr.qytjj|j|_Wnt t t fk r\YnXytjj|j |_ Wqt t t fk rYqXqWdS)zESet all module __file__ and __cached__ attributes to an absolute path __loader__N __module___frozen_importlib_frozen_importlib_external)rr) setsysmodulesvaluesgetattrrrr__file__AttributeErrorr TypeError __cached__)mr r r abs_pathscsrcCsTg}t}x6tjD],}t|\}}||kr|j||j|qW|tjdd<|S)zK Remove duplicate entries from sys.path along with making them absoluteN)rrrr appendadd)L known_pathsr dircaser r r removeduppathsss   r!c CsXt}xLtjD]B}y&tjj|r6t|\}}|j|Wqtk rNwYqXqW|S)zEReturn a set containing all existing file system items from sys.path.)rrrrexistsr rr)ditem_itemcaser r r _init_pathinfos    r'c Csp|dkrt}d}nd}tjj||}yt|d}Wntk rHdSX| xt|D]\}}|jdrrq^yX|jdrt|w^|j }t ||\}} | |krtjj |rt jj ||j| Wq^tk rRtdj|d |t jd d dl} x>| jt jD],} x$| jD]}td |t jd qWqWtd t jd PYq^Xq^WWdQRX|rld}|S)zProcess a .pth file within the site-packages directory: For each line in the file, either combine it with sitedir to a path and add that to known_paths, or execute it if it starts with 'import '. NTFr#import import z"Error processing line {:d} of {}: )filerz z Remainder of file ignored)r*r+)r'rrropenr enumerate startswithexecrstripr r"rrr Exceptionprintformatstderr tracebackformat_exceptionexc_info splitlines) sitedirnamerresetfullnamefnliner r r7recordr r r addpackagesD    rCc Cs|dkrt}d}nd}t|\}}||krBtjj||j|ytj|}Wntk rddSXdd|D}xt |D]}t |||q~W|rd}|S)zTAdd 'sitedir' argument to sys.path if missing and handle .pth files in 'sitedir'NTFcSsg|]}|jdr|qS)z.pth)endswith).0r<r r r szaddsitedir..) r'r rrrrrlistdirrsortedrC)r;rr= sitedircasenamesr<r r r addsitedirs$   rKcCs`tjjr dSttdr4ttdr4tjtjkr4dSttdr\ttdr\tjtjkr\dSdS)a,Check if user site directory is safe for inclusion The function tests for the command line flag (including environment var), process uid/gid equal to effective uid/gid. None: Disabled for security reasons False: Disabled by user (command line option) True: Safe and enabled FgetuidgeteuidNgetgidgetegidT) rflags no_user_sitehasattrrrMrLrOrNr r r r check_enableusersites rScCs$tdk r tSddlm}|datS)zReturns the `user base` directory path. The `user base` directory can be used to store data. If the global variable ``USER_BASE`` is not initialized yet, this function will also set it. Nr)get_config_varuserbase) USER_BASE sysconfigrT)rTr r r getuserbases  rXcCs^t}tdk rtSddlm}tjdkrJddlm}|drJ|ddatS|dd tjatS) zReturns the user-specific site-packages directory path. If the global variable ``USER_SITE`` is not initialized yet, this function will also set it. Nr)get_pathdarwin)rTPYTHONFRAMEWORKpurelibosx_framework_userz%s_user) rX USER_SITErWrYrplatformrTrr<) user_baserYrTr r r getusersitepackagess    racCs$t}tr tjj|r t|||S)zAdd a per user site-package to sys.path Each user has its own python directory with site-packages in the home directory. )raENABLE_USER_SITErrisdirrK)r user_siter r r addusersitepackagess rec Csg}t}|dkrt}x|D]}| s||kr2q|j|tjdkr|jtjj|ddtj ddd|jtjj|ddtj dd dn6|j||jtjj|dd|jtjj|ddtj d krd d l m }|d }|r|jtjjd|dtj dd dqW|S)aReturns a list containing all global site-packages directories. For each directory present in ``prefixes`` (or the global ``PREFIXES``), this function will find its `site-packages` subdirectory depending on the system environment, and will return a list of full paths. N/lib64pythonz site-packageslibz python%d.%drZr)rTr[z/Libraryz%d.%d)rPREFIXESrrseprrrrversion version_infor_rWrT)prefixes sitepackagesseenprefixrT frameworkr r r getsitepackages s4        rucCsFtrdtjkrtjddx&t|D]}tjj|r$t||q$W|S)zAdd site-packages to sys.path '/usr/local' is included in PREFIXES if RPM build is not detected to make packages installed into this location visible. RPM_BUILD_ROOTrz /usr/local) rbrenvironrlinsertrurrcrK)rrpr;r r r addsitepackagesHs   rycCs4tjdkrd}nd}tjd|t_tjd|t_dS)zDefine new builtins 'quit' and 'exit'. These are objects which make the interpreter exit when called. The repr of each object contains a hint at how it works. \zCtrl-Z plus ReturnzCtrl-D (i.e. EOF)quitexitN)rrm _sitebuiltinsQuitterbuiltinsr{r|)eofr r r setquitWs  rcCstjdtjt_tjdddkr2tjddt_ntjddt_gg}}ttdrtj j tj }|j d d g|j tj j |tj|tjgtjd d ||t_dS) z)Set 'copyright' and 'credits' in builtins copyrightNjavacreditsz?Jython is maintained by the Jython developers (www.jython.org).z Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands for supporting Python development. See www.python.org for more information.rz LICENSE.txtLICENSElicensez'See https://www.python.org/psf/license/)r}_Printerrrrr_rrRrrdirnamerextendrpardircurdirr)filesdirsherer r r setcopyrightgs    rcCstjt_dS)N)r}_Helperrhelpr r r r sethelpersrcCsdd}|t_dS)ajEnable default readline configuration on interactive prompts, by registering a sys.__interactivehook__. If the readline module can be imported, the hook will set the Tab key as completion key and register ~/.python_history as history file. This can be overridden in the sitecustomize or usercustomize module, or in a PYTHONSTARTUP file. csddl}yddlddl}Wntk r0dSXtdd}|dk rZd|krZjdn jdy jWntk rYnXjdkrt j j t j j ddyj Wntk rYnXfd d }|j|dS) Nr__doc__libeditzbind ^I rl_completez tab: complete~z.python_historyc s,yjWnttfk r&YnXdS)N)write_history_fileFileNotFoundErrorPermissionErrorr )historyreadliner r write_historyszCenablerlcompleter..register_readline..write_history)atexitr rlcompleter ImportErrorrparse_and_bindread_init_filerget_current_history_lengthrrr expanduserread_history_fileIOErrorregister)rr readline_docrr )rrr register_readlines.      z,enablerlcompleter..register_readlineN)r__interactivehook__)rr r r enablerlcompleters 0rc CsFtj}tjdkr$d|kr$tjd}ntj}tjjtjj|\}}tjj|}dt_ d}ddtjj ||tjj ||fD}|rB|d}d} t |dd `} xX| D]P} d | kr| j d \} }} | j j} | j } | d kr| j} q| d kr| t_ qWWdQRX|t_t_t|tjg| dkr6tjdtjn tjgad a|S)NrZ__PYVENV_LAUNCHER__z pyvenv.cfgcSsg|]}tjj|r|qSr )rrisfile)rEconffiler r r rFszvenv..rtruezutf-8)encoding=zinclude-system-site-packageshomeF)rrwrr_ executablersplitrr_homerr. partitionstriplowerrs exec_prefixryrlrxrb)renvrexe_dirr% site_prefix conf_basenamecandidate_confs virtual_conf system_siter?rAkeyvaluer r r venvs>        rcCsyBy ddl}Wn0tk r>}z|jdkr,nWYdd}~XnXWnRtk r}z6tjjrltjtjntj j d|j j |fWYdd}~XnXdS)z,Run custom site specific code, if available.rN sitecustomizez@Error in sitecustomize; set PYTHONVERBOSE for traceback: %s: %s ) rrr<r3rrPverbose excepthookr9r6write __class____name__)rexcerrr r r execsitecustomizes  rcCsyBy ddl}Wn0tk r>}z|jdkr,nWYdd}~XnXWnRtk r}z6tjjrltjtjntj j d|j j |fWYdd}~XnXdS)z,Run custom user specific code, if available.rN usercustomizez@Error in usercustomize; set PYTHONVERBOSE for traceback: %s: %s ) rrr<r3rrPrrr9r6rrr)rrrr r r execusercustomizes  rcCsftt}t|}tdkr"tat|}t|}ttt t j j sRt ttrbtdS)zAdd standard site-specific directories to the module search path. This function is called automatically when this module is imported, unless the python interpreter was started with the -S flag. N)rr!rrbrSreryrrrrrPisolatedrrr)rr r r mainsrcCs`d}tjdd}|st}t}tdxtjD]}td|fq2Wtdtd|tjj|rfdndftd |tjj|rdndftd ttj d g}d |kr|j t d |kr|j t |r,ttj j|trtj d n6tdkr tj dn tdkr tj dn tj dn0d dl}t|j|tjd tj ftj ddS)Na %s [--user-base] [--user-site] Without arguments print some useful information With arguments print the value of USER_BASE and/or USER_SITE separated by '%s'. Exit codes with --user-base or --user-site: 0 - user site directory is enabled 1 - user site directory is disabled by user 2 - uses site directory is disabled by super user or for security reasons >2 - unknown error r,z sys.path = [z %r,]zUSER_BASE: %r (%s)r"z doesn't existzUSER_SITE: %r (%s)zENABLE_USER_SITE: %rrz --user-basez --user-siteFrkri )rargvrXrar4rrrcrbr|rrVr^pathseprtextwrapdedent)rargsr`rdr bufferrr r r _script6s@           r__main__)N)N)N)#rrrrr}rsrrlrbr^rVr rr!r'rCrKrSrXrareruryrrrrrrrrrPno_siterrr r r r FsB   *  ( ;43 hashlib.cpython-36.opt-2.pyc000064400000012320152462730460011553 0ustar003 i_"$@sfdZd$ZeeZeeZed%ZyddlmZWne k rLddZYnXes`iZ ddZ ddZ esxd&ddZ d'ddZy dd lZeZe ZejejZWn$e k rere Ze ZYnXdd!lmZydd"lmZWne k rYnXxLeD]DZyeeee<Wn*ek rBdd lZejd#eYnXqW[[[[[ ejs`[ [d S)(a3hashlib module - A common interface to many hash functions. new(name, data=b'', **kwargs) - returns a new hash object implementing the given hash function; initializing the hash using the given binary data. Named constructor functions are also available, these are faster than using new(name): md5(), sha1(), sha224(), sha256(), sha384(), sha512(), blake2b(), blake2s(), sha3_224, sha3_256, sha3_384, sha3_512, shake_128, and shake_256. More algorithms may be available on your platform but the above are guaranteed to exist. See the algorithms_guaranteed and algorithms_available attributes to find out what algorithm names can be passed to new(). NOTE: If you want the adler32 or crc32 hash functions they are available in the zlib module. Choose your hash function wisely. Some have known collision weaknesses. sha384 and sha512 will be slow on 32 bit platforms. Hash objects have these methods: - update(data): Update the hash object with the bytes in data. Repeated calls are equivalent to a single call with the concatenation of all the arguments. - digest(): Return the digest of the bytes passed to the update() method so far as a bytes object. - hexdigest(): Like digest() except the digest is returned as a string of double length, containing only hexadecimal digits. - copy(): Return a copy (clone) of the hash object. This can be used to efficiently compute the digests of datas that share a common initial substring. For example, to obtain the digest of the byte string 'Nobody inspects the spammish repetition': >>> import hashlib >>> m = hashlib.md5() >>> m.update(b"Nobody inspects") >>> m.update(b" the spammish repetition") >>> m.digest() b'\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9' More condensed: >>> hashlib.sha224(b"Nobody inspects the spammish repetition").hexdigest() 'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2' md5sha1sha224sha256sha384sha512blake2bblake2ssha3_224sha3_256sha3_384sha3_512 shake_128 shake_256newalgorithms_guaranteedalgorithms_available pbkdf2_hmac) get_fips_modecCsdS)Nrrrr/usr/lib64/python3.6/hashlib.py_hashlib_get_fips_modeIsrc Cst}|j|}|dk r|Sy2|dkrDddl}|j|d<|d<n|dkrjddl}|j|d<|d<n|dkrddl}|j|d<|d <|j|d<|d<n|dkrddl }|j |d <|d <|j |d <|d <nv|dkrddl }|j |d<|j|d<nN|dkrLddl}|j|d<|j|d<|j|d<|j|d<|j|d<|j|d<Wntk rdYnX|j|}|dk r~|Std|dS)NSHA1rrMD5rSHA256rSHA224rSHA512rSHA384rrrr r r r r rzunsupported hash type )rr)rr)rrrr)rrrr)rr>r r r r rr )__builtin_constructor_cacheget_sha1r_md5r_sha256rr_sha512rr_blake2rr_sha3r r r r r r ImportError ValueError) namecache constructorr r!r"r#r$r%rrr__get_builtin_constructorPsL           r+c CsZtjs|dkrt|Sy ttd|}tjs6||Sttfk rTt|SXdS)Nrrrr Zopenssl_>r rrr)_hashlibrr+getattrAttributeErrorr')r(frrr__get_openssl_constructor{sr0cKst||f|S)N)r+)r(datakwargsrrr__py_newsr4c Kstjr(|}dddddddj||}n|d kr@t||f|Sy:|jd d }tj|||d }tjrx||krx|j||Stk rtjrt||SXdS)Nzsha3-224zsha3-256zsha3-384zsha3-512Zshake128Zshake256)r r r r r rrrusedforsecurityT)r5>rr)r,rrr+poprZ _set_namer')r(r2r3Z orig_namer5Zretvalrrr __hash_news,    r7N)r)scryptzcode for hash %s was not found.)rrrrrrrrr r r r r r)rrrr)r1)r1)__doc__Z__always_supportedsetrr__all__r,rrr&rr+r0r4r7rZ __get_hashunionZopenssl_md_meth_namesrr8Z __func_nameglobalsr'ZloggingZ exceptionrrrr6s\+  '     webbrowser.cpython-36.opt-1.pyc000064400000036626152462730460012340 0ustar003 \U@sdZddlZddlZddlZddlZddlZddddddgZGd ddeZiZ gZ dOd dZ dPd dZ dQddZ ddZddZdRddZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdd d eZGd!d"d"eZeZGd#d$d$eZGd%d&d&eZGd'd(d(eZGd)d*d*eZd+d,Zej j d-rleej j d.rej!d/re d/ded/ej!d0re d0ded0ej!d1re d1ded1ej!d2re d2ded2ej!d3re d3ded3ej"dd4d5krGd6d7d7eZ#gZ iZ e d8e#ej$j%ej j d9d:d;Z&x8dd?d@dAe&fD]"Z'ej!e'rhe e'dee'qhWej"dBkrGdCdDdDeZ(GdEdFdFeZ)e dGde)dGdSe dsz'GenericBrowser.open..winT) close_fdsF)rr2sysplatform subprocessPopenwaitOSError)r.r!r"r#cmdlinepr )r!r rs   zGenericBrowser.openN)rT)rr r r1r/rr r r r r|s rc@seZdZdZdddZdS)rzHClass for all browsers which are to be started in the background.rTc sp|jgfdd|jD}y:tjdddkr.r9r:T)r;start_new_sessionF)rr2r<r=r>r?pollrA)r.r!r"r#rBrCr )r!r rs   zBackgroundBrowser.openN)rT)rr r r1rr r r r rsrc@sBeZdZdZdZdZdZddgZdZdZ dZ ddZ d d d Z dS) UnixBrowserz=Parent class for all Unix browsers with remote functionality.NFTz%actionz%sc Csg}|r*|jr*t|}|j|}|r*|g}|jg||}|sD|jrLtj}nd}tj|d||jrd|pfd|dd}|ry|jd} | Stj k rdSXn&|jr|j dkrdSdSn |j SdS)NT)r;stdinstdoutstderrrDF) raise_optsintr backgroundr>DEVNULLr?redirect_stdoutr@ZTimeoutExpiredrE) r.r2Zremoter#Z raise_optoptrBZinoutrCrcr r r _invokes0        zUnixBrowser._invokercs|dkr|jnB|dkr |jn2|dkrB|jdkr:|jqR|jntdd|fdd|jD}dd|D}|j|d |}|sfd d|jD}|j|d d Sd SdS) Nrr r$zBad 'new' parameter to open(); zexpected 0, 1, or 2, got %scs g|]}|jdjdqS)z%sz%action)r5)r6r7)actionr!r r r8sz$UnixBrowser.open..cSsg|] }|r|qSr r )r6r7r r r r8sTcsg|]}|jdqS)z%s)r5)r6r7)r!r r r8sF) remote_actionremote_action_newwinremote_action_newtabr remote_argsrRr2)r.r!r"r#r2Zsuccessr )rSr!r rs$    zUnixBrowser.open)rT) rr r r1rKrMrOrWrTrUrVrRrr r r r rFs#rFc@s(eZdZdZddgZdZdZdZdZdS) Mozillaz$Launcher class for Mozilla browsers.z%actionz%sr-z -new-windowz-new-tabTN) rr r r1rWrTrUrVrMr r r r rXs rXc@s0eZdZdZddgZddgZdZdZdZd Z d S) Netscapez$Launcher class for Netscape browser.z-noraisez-raisez-remotezopenURL(%s%action)r-z ,new-windowz,new-tabTN) rr r r1rKrWrTrUrVrMr r r r rYsrYc@s,eZdZdZddgZddgZdZdZdZd S) Galeonz,Launcher class for Galeon/Epiphany browsers.z-noraiser-z%actionz%sz-nz-wTN) rr r r1rKrWrTrUrMr r r r rZ s rZc@s(eZdZdZddgZdZdZdZdZdS)Chromez)Launcher class for Google Chrome browser.z%actionz%sr-z --new-windowTN) rr r r1rWrTrUrVrMr r r r r[s r[c@s(eZdZdZddgZdZdZdZdZdS)Operaz!Launcher class for Opera browser.z%actionz%sr-z --new-windowTN) rr r r1rWrTrUrVrMr r r r r\"s r\c@s,eZdZdZddgZdZdZdZdZdZ dS) Elinksz#Launcher class for Elinks browsers.z-remotezopenURL(%s%action)r-z ,new-windowz,new-tabFN) rr r r1rWrTrUrVrMrOr r r r r],sr]c@seZdZdZdddZdS) KonquerorzController for the KDE File Manager (kfm, or Konqueror). See the output of ``kfmclient --commands`` for more information on the Konqueror remote-control interface. rTcCs|dkrd}nd}tj}ytjd||gd|||d}Wntk rJYnX|jdSy tjdd|gd|||dd }Wntk rYnX|jdkrdSy tjd d |gd|||dd }Wntk rd SX|jdkSdS) Nr$ZnewTabZopenURL kfmclientT)r;rGrHrI konquerorz--silent)r;rGrHrIrDkfmz-dF)r>rNr?rAr@rE)r.r!r"r#rSdevnullrCr r r rAs:      zKonqueror.openN)rT)rr r r1rr r r r r^:sr^c@s&eZdZddZddZd ddZd S) Grailc Csddl}ddl}ddl}ddl}tjj|jd}|jtj d}tjj||d}|j|}|shdS|j|j |j } xX|D]P} y| j | Wn8t k rytj| Wnt k rYnXYq~X| Sq~WdS)Nrz .grail-unixz-*)globpwdsockettempfiler'r(joinZ gettempdirgetpwuidgetuidZAF_UNIXZ SOCK_STREAMZconnectrAunlink) r.rdrerfrgZtempdiruserfilenameZmaybessfnr r r _find_grail_rcrs*    zGrail._find_grail_rccCs&|j}|sdS|j||jdS)Nrr )rpsendclose)r.rSrnr r r _remotes  z Grail._remoterTcCs&|r|jd|}n|jd|}|S)NzLOADNEW zLOAD )rs)r.r!r"r#okr r r rsz Grail.openN)rT)rr r rprsrr r r r rcnsrccCstjdrtddtddtjkr>tjdr>tddtddtjkrbtjdrbtddtddtjkrtjdrtdttdtjdrtddtdx&dD]}tj|rt|dt|qWx&dD]}tj|rt|dt|qWtjdrtdttdntjdr*tdttdx*dD]"}tj|r0t|dt |q0Wtjdrrtddtdx*d D]"}tj|rxt|dt |qxWtjdrtddt dtjdrtddtdtjdrtdt ddS)!Nzxdg-openZGNOME_DESKTOP_SESSION_IDz gvfs-openz gnome-openZKDE_FULL_SESSIONr_z x-www-browserfirefox iceweaseliceape seamonkeymozilla-firefoxmozilla-firebirdfirebirdmozillanetscaperar`galeonepiphanyZ skipstone google-chromechromechromiumchromium-browseroperaZmosaicZgrail)rurvrwrx)ryrzr{r|r})r~r)rrrr) r%r&rrr'environr^rXrYrZr[r\rc)rr r r register_X_browserssH               rZDISPLAYZTERMz www-browserZlinksZelinksZlynxZw3mr9r:c@seZdZdddZdS)WindowsDefaultrTc Cs,ytj|Wntk r"dSXdSdS)NFT)r'Z startfilerA)r.r!r"r#r r r rs zWindowsDefault.openN)rT)rr r rr r r r rsrzwindows-defaultZ PROGRAMFILESzC:\Program FileszInternet Explorer\IEXPLORE.EXErur{rxr|r}rdarwinc@s"eZdZdZddZd ddZdS) MacOSXa{Launcher class for Aqua browsers on Mac OS X Optionally specify a browser name on instantiation. Note that this will not work for Aqua browsers if the user has moved the application package after installation. If no browser is specified, the default browser, as specified in the Internet System Preferences panel, will be used. cCs ||_dS)N)r)r.rr r r r/&szMacOSX.__init__rTc Csd|krd|}tt|}|jdkr8d|jdd}n<|jdkrHd}n d |d }d |jdd}d |j||f}tjd d}|dkrdS|j||j}| S)N:zfile:defaultzopen location "%s""z%22ZOmniWebr-z toWindow %dr z OpenURL "%s"ztell application "%s" activate %s %s end tell osascriptwF)rLboolrr5r'popenwriterr) r.r!r"r#scriptZtoWindowr+osapiperQr r r r)s       z MacOSX.openN)rT)rr r r1r/rr r r r rs rc@seZdZddZdddZdS) MacOSXOSAScriptcCs ||_dS)N)_name)r.rr r r r/KszMacOSXOSAScript.__init__rTcCsb|jdkrd|jdd}nd|j|jddf}tjdd}|dkrJdS|j||j}| S) Nrzopen location "%s"rz%22z tell application "%s" activate open location "%s" end rrF)rr5r'rrrr)r.r!r"r#rrrQr r r rNs   zMacOSXOSAScript.openN)rT)rr r r/rr r r r rJsrZsafarirrZBROWSERr-c Csddl}dtjd}y|jtjddd\}}WnJ|jk r~}z,t|tjdt|tjdtjdWYdd}~XnXd}x*|D]"\}}|dkrd}q|dkrd}qWt|dkrt|tjdtjd|d}t||td dS) NrzDUsage: %s [-n | -t] url -n: open new window -t: open new tabr Zntd)filez-nz-tr$) getoptr<argverrorprintrIexitlenr) rZusageZoptsr2msgZnew_winoar!r r r main~s(   r__main__)Nr )N)rT)r rrrrrr)2r1r'rr%r<r>__all__ Exceptionrrrrrrrrrobjectr,rrrFrXrYrZr[ZChromiumr\r]r^rcrrr&r=rr(rhZiexplorerrrrpathsepZ _userchoicesreverserBr+rrr r r r s    "N     45B          .     keyword.cpython-36.opt-2.pyc000064400000002733152462730460011634 0ustar003 \!@srddgZdddddddd d d d d ddddddddddddddddddd d!d"g!ZeejZd#d$Zed%krned&S)' iskeywordkwlistFalseNoneTrueandasassertbreakclasscontinuedefdelelifelseexceptfinallyforfromglobalifimportinislambdanonlocalnotorpassraisereturntrywhilewithyieldcCs|ddl}ddl}|jdd}|r*|dp,d}t|dkrD|d}nd}t|dd}|j}WdQRX|r|dt|djdnd}t|T}|jd}g} x>|D]6} d | kr|j| } | r| j d | j dd |qWWdQRX| j y0|j d |d} |j d |} | || | <Wn,t k rR|jjd|jdYnXt|ddd}|j|WdQRXdS)NzPython/graminit.czLib/keyword.py)newline z "([^"]+)"z{1, "z 'z',z#--start keywords--z#--end keywords--z'target does not contain format markers w)sysreargvlenopen readlinesstripcompilesearchappendgroupsortindex ValueErrorstderrwriteexit writelines)r*r+argsiptfileoptfilefpformatnlstrproglineslinematchstartendrH/usr/lib64/python3.6/keyword.pymain7s6 $    * rJ__main__N)__all__r frozenset __contains__rrJ__name__rHrHrHrI sJ &bz2.cpython-36.opt-1.pyc000064400000026024152462730460010643 0ustar003 \0 @sdZddddddgZdZdd lmZdd lZdd lZdd lZdd l Z ydd l m Z Wn e k rtdd l m Z YnXdd lmZmZdZd ZdZGddde jZdddZdddZddZd S)zInterface to the libbzip2 compression library. This module provides a file interface, classes for incremental (de)compression, and functions for one-shot (de)compression. BZ2File BZ2CompressorBZ2Decompressoropencompress decompressz%Nadeem Vawda )rN)RLock)rrc@seZdZdZd)ddZddZed d Zd d Zd dZ ddZ ddZ d*ddZ d,ddZ d.ddZddZd0ddZd2dd Zd!d"Zd#d$Zejfd%d&Zd'd(ZdS)3ra@A file object providing transparent bzip2 (de)compression. A BZ2File can act as a wrapper for an existing file object, or refer directly to a named file on disk. Note that BZ2File provides a *binary* file interface - data read is returned as bytes, and data to be written should be given as bytes. rN cCsTt|_d|_d|_t|_|dk r.tjdtd|ko@dknsNt d|dkr`d }t }nb|dkr|d }t }t ||_ nF|dkrd }t }t ||_ n*|dkrd}t }t ||_ nt d|ft|tttjfrt|||_d|_||_n.t|dst|dr||_||_ntd|jt krJtj|jttd}tj||_nd|_dS)a>Open a bzip2-compressed file. If filename is a str, bytes, or PathLike object, it gives the name of the file to be opened. Otherwise, it should be a file object, which will be used to read or write the compressed data. mode can be 'r' for reading (default), 'w' for (over)writing, 'x' for creating exclusively, or 'a' for appending. These can equivalently be given as 'rb', 'wb', 'xb', and 'ab'. buffering is ignored. Its use is deprecated. If mode is 'w', 'x' or 'a', compresslevel can be a number between 1 and 9 specifying the level of compression: 1 produces the least compression, and 9 (default) produces the most compression. If mode is 'r', the input file may be the concatenation of multiple compressed streams. NFz)Use of 'buffering' argument is deprecatedr r z%compresslevel must be between 1 and 9r rbwwbxxbaabzInvalid mode: %rTreadwritez6filename must be a str, bytes, file or PathLike object)Ztrailing_errorr)r r r)rr)rr)rr)r_lock_fp_closefp _MODE_CLOSED_modewarningswarnDeprecationWarning ValueError _MODE_READ _MODE_WRITEr _compressor isinstancestrbytesosPathLike _builtin_openhasattr TypeError _compressionZDecompressReaderrOSErrorioBufferedReader_buffer_pos)selffilenamemode buffering compresslevelZ mode_coderawr7/usr/lib64/python3.6/bz2.py__init__+sL      zBZ2File.__init__cCs|j|jtkrdSz<|jtkr.|jjn"|jtkrP|jj|j j d|_ Wdz|j rf|jjWdd|_d|_ t|_d|_XXWdQRXdS)zFlush and close the file. May be called more than once without error. Once the file is closed, any other operation on it will raise a ValueError. NF) rrrr r/closer!rrr"flushr)r1r7r7r8r:ps      z BZ2File.closecCs |jtkS)zTrue if this file is closed.)rr)r1r7r7r8closedszBZ2File.closedcCs|j|jjS)z3Return the file descriptor for the underlying file.)_check_not_closedrfileno)r1r7r7r8r>szBZ2File.filenocCs|jo|jjS)z)Return whether the file supports seeking.)readabler/seekable)r1r7r7r8r@szBZ2File.seekablecCs|j|jtkS)z/Return whether the file was opened for reading.)r=rr )r1r7r7r8r?szBZ2File.readablecCs|j|jtkS)z/Return whether the file was opened for writing.)r=rr!)r1r7r7r8writableszBZ2File.writablerc Cs&|j|j|jj|SQRXdS)zReturn buffered data without advancing the file position. Always returns at least one byte of data, unless at EOF. The exact number of bytes returned is unspecified. N)r_check_can_readr/peek)r1nr7r7r8rCsz BZ2File.peekr c Cs&|j|j|jj|SQRXdS)zRead up to size uncompressed bytes from the file. If size is negative or omitted, read until EOF is reached. Returns b'' if the file is already at EOF. N)rrBr/r)r1sizer7r7r8rsz BZ2File.readc Cs4|j$|j|dkrtj}|jj|SQRXdS)zRead up to size uncompressed bytes, while trying to avoid making multiple reads from the underlying stream. Reads up to a buffer's worth of data if size is negative. Returns b'' if the file is at EOF. rN)rrBr-DEFAULT_BUFFER_SIZEr/read1)r1rEr7r7r8rGs z BZ2File.read1c Cs&|j|j|jj|SQRXdS)zRRead bytes into b. Returns the number of bytes read (0 for EOF). N)rrBr/readinto)r1br7r7r8rHszBZ2File.readintoc CsJt|ts$t|dstd|j}|j|j|jj|SQRXdS)a Read a line of uncompressed bytes from the file. The terminating newline (if present) is retained. If size is non-negative, no more than size bytes will be read (in which case the line may be incomplete). Returns b'' if already at EOF. __index__zInteger argument expectedN) r#intr)r*rJrrBr/readline)r1rEr7r7r8rLs  zBZ2File.readlinec CsJt|ts$t|dstd|j}|j|j|jj|SQRXdS)zRead a list of lines of uncompressed bytes from the file. size can be specified to control the number of lines read: no further lines will be read once the total size of the lines read so far equals or exceeds size. rJzInteger argument expectedN) r#rKr)r*rJrrBr/ readlines)r1rEr7r7r8rMs  zBZ2File.readlinesc CsL|j<|j|jj|}|jj||jt|7_t|SQRXdS)zWrite a byte string to the file. Returns the number of uncompressed bytes written, which is always len(data). Note that due to buffering, the file on disk may not reflect the data written until close() is called. N)rZ_check_can_writer"rrrr0len)r1dataZ compressedr7r7r8rs   z BZ2File.writec Cs |jtjj||SQRXdS)zWrite a sequence of byte strings to the file. Returns the number of uncompressed bytes written. seq can be any iterable yielding byte strings. Line separators are not added between the written byte strings. N)rr+ BaseStream writelines)r1seqr7r7r8rQszBZ2File.writelinesc Cs(|j|j|jj||SQRXdS)aChange the file position. The new position is specified by offset, relative to the position indicated by whence. Values for whence are: 0: start of stream (default); offset must not be negative 1: current stream position 2: end of stream; offset must not be positive Returns the new file position. Note that seeking is emulated, so depending on the parameters, this operation may be extremely slow. N)rZ_check_can_seekr/seek)r1offsetwhencer7r7r8rSsz BZ2File.seekc Cs4|j$|j|jtkr$|jjS|jSQRXdS)z!Return the current file position.N)rr=rr r/tellr0)r1r7r7r8rVs   z BZ2File.tell)r Nr )r)rWrW)rWrW)rWrW)rW)__name__ __module__ __qualname____doc__r9r:propertyr<r>r@r?rArCrrGrHrLrMrrQr-SEEK_SETrSrVr7r7r7r8r s$  E     rr cCsd|kr d|krPtd|fn0|dk r0td|dk r@td|dk rPtd|jdd}t|||d }d|krtj||||S|SdS) aOpen a bzip2-compressed file in binary or text mode. The filename argument can be an actual filename (a str, bytes, or PathLike object), or an existing file object to read from or write to. The mode argument can be "r", "rb", "w", "wb", "x", "xb", "a" or "ab" for binary mode, or "rt", "wt", "xt" or "at" for text mode. The default mode is "rb", and the default compresslevel is 9. For binary mode, this function is equivalent to the BZ2File constructor: BZ2File(filename, mode, compresslevel). In this case, the encoding, errors and newline arguments must not be provided. For text mode, a BZ2File object is created, and wrapped in an io.TextIOWrapper instance with the specified encoding, error handling behavior, and line ending(s). trIzInvalid mode: %rNz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary moder )r5)rreplacerr- TextIOWrapper)r2r3r5encodingerrorsnewlineZbz_modeZ binary_filer7r7r8r!s cCst|}|j||jS)zCompress a block of data. compresslevel, if given, must be a number between 1 and 9. For incremental compression, use a BZ2Compressor object instead. )rrr;)rOr5compr7r7r8rJsc Csjg}xZ|r^t}y|j|}Wntk r<|r6PnYnX|j||jsVtd|j}qWdj|S)zjDecompress a block of data. For incremental decompression, use a BZ2Decompressor object instead. zACompressed data ended before the end-of-stream marker was reached)rrr,appendeofrZ unused_datajoin)rOZresultsZdecompresr7r7r8rUs  )rr NNN)r )r[__all__ __author__builtinsrr(r-r&rr+Z threadingr ImportErrorZdummy_threadingZ_bz2rrrr r!rPrrrr7r7r7r8s.   ( dis.cpython-36.opt-2.pyc000064400000024633152462730460010732 0ustar003 \F @sddlZddlZddlZddlZddlTddlmZdddddd d d d d dg eZ[ejejej e e e fZ edZddZdJddddZdKddddZddddddddddd Zd d!Zd"d#Zd$dZd%d&Zddd'd Zejd(d)Zd*ej_d+ej_d,ej_d-ej_d.ej_d/ej _d0ej!_d1ej"_Gd2d d eZ#dd3d4d Z$d5d6Z%d7d8Z&dLd9d:Z'dNdddd?Z)ddd@dAZ*e(Z+dBdCZ,dDd Z-dEd Z.GdFddZ/dGdHZ0e1dIkre0dS)QN)*)__all__ code_infodis disassembledistbdiscofindlinestarts findlabels show_codeget_instructions InstructionBytecode FORMAT_VALUEc Cs6yt||d}Wn tk r0t||d}YnX|S)Nevalexec)compile SyntaxError)sourcenamecr/usr/lib64/python3.6/dis.py _try_compiles r)filecCs>|dkrt|ddSt|dr&|j}t|dr6|j}t|drF|j}t|drt|jj}x|D]n\}}t|t rdt d||dyt ||dWn0t k r}zt d||dWYdd}~XnXt |dqdWnbt|drt ||dnJt|ttfrt||dn,t|tr(t||dnt d t|jdS) N)r__func____code__gi_code__dict__zDisassembly of %s:zSorry:co_codez(don't know how to disassemble %s objects)rhasattrrrrsortedritems isinstance _have_codeprintr TypeErrorrbytes bytearray_disassemble_bytesstr_disassemble_strtype__name__)xrr"rZx1msgrrrr"s6         c CsZ|dkrBy tj}Wntk r.tdYnXx|jr@|j}q2Wt|jj|j|ddS)Nz no last traceback to disassemble)r) syslast_tracebackAttributeError RuntimeErrortb_nextrtb_framef_codetb_lasti)tbrrrrrEs  Z OPTIMIZEDZ NEWLOCALSZVARARGSZ VARKEYWORDSZNESTEDZ GENERATORZNOFREEZ COROUTINEZITERABLE_COROUTINEZASYNC_GENERATOR)  @icCsbg}xRtdD]8}d|>}||@r|jtj|t|||N}|sPqW|jt|dj|S)Nr>r9z, )rangeappendCOMPILER_FLAG_NAMESgethexjoin)flagsnamesiflagrrr pretty_flags_srLcCsht|dr|j}t|dr |j}t|dr0|j}t|trDt|d}t|drR|Stdt|j dS)Nrrrz rz(don't know how to disassemble %s objects) r rrrr#r*rr&r,r-)r.rrr_get_code_objectms      rMcCs tt|S)N)_format_code_inforM)r.rrrr|scCsg}|jd|j|jd|j|jd|j|jd|j|jd|j|jd|j|jdt|j|j r|jdx t |j D]}|jd |qW|j r|jd x t |j D]}|jd |qW|j r|jd x t |j D]}|jd |qW|j rF|jd x"t |j D]}|jd |q.W|jr||jdx"t |jD]}|jd |qdWdj|S)NzName: %szFilename: %szArgument count: %szKw-only arguments: %szNumber of locals: %szStack size: %szFlags: %sz Constants:z%4d: %rzNames:z%4d: %szVariable names:zFree variables:zCell variables: )rCco_name co_filename co_argcountco_kwonlyargcount co_nlocals co_stacksizerLco_flags co_consts enumerateco_names co_varnames co_freevars co_cellvarsrG)colinesZi_cZi_nrrrrNs:     rNcCstt||ddS)N)r)r%r)r]rrrrr s _InstructionzBopname opcode arg argval argrepr offset starts_line is_jump_targetz!Human readable name for operationzNumeric code for operationz6Numeric argument to operation (if any), otherwise Nonez4Resolved arg value (if known), otherwise same as argz0Human readable description of operation argumentz1Start index of operation within bytecode sequencez4Line started by this opcode (if any), otherwise Nonez1True if other code jumps to here, otherwise Falsec@seZdZdddZdS)r FcCsg}|r:|jdk r,d|}|j||jn|jd||rJ|jdn |jd|jrf|jdn |jd|jt|jjd|j|jjd|jdk r|jt|jjd |j r|jd |j d dj |j S) Nz%%%dd z-->z z>>z r;()) starts_linerCis_jump_targetreproffsetrjustopnameljustargargreprrGrstrip)self lineno_widthZmark_as_currentZfieldsZ lineno_fmtrrr _disassembles&      zInstruction._disassembleN)r`F)r- __module__ __qualname__rrrrrrr s) first_linecCsTt|}|j|j}tt|}|dk r4||j}nd}t|j|j|j |j |||S)Nr) rMr\r[dictr co_firstlineno_get_instructions_bytesrrZrYrW)r.rur] cell_names linestarts line_offsetrrrr s    cCs |}|dk r||}|t|fS)N)rh)Z const_indexZ const_listargvalrrr_get_const_infosr}cCs*|}|dk r||}|}nt|}||fS)N)rh)Z name_indexZ name_listr|rnrrr_get_name_infos r~c csxt|}d}xdt|D]V\} } } |dk rH|j| d}|dk rH||7}| |k} d} d}| dk rT| } | tkr~t| |\} }n| tkrt| |\} }n| tkr| d| } dt| }n| t krt| |\} }n| t krt | } | }nn| t krt| |\} }nV| t krTdtttf| d@t| d@f} d | d@}| d rT|rL|d 7}|d 7}tt| | | | || || VqWdS) Nr:zto r`r;r*rhasciir9z, z with format)rr*rhr)r _unpack_opargsrEZhasconstr}Zhasnamer~hasjrelrhZhaslocalZ hascompareZcmp_opZhasfreerr*rboolr rk)codevarnamesrI constantscellsrzr{labelsrfrioprmrgr|rnrrrrxsH         rxr9c Cs<|j|j}tt|}t|j||j|j|j|||ddS)N)r) r\r[rvr r)rrZrYrW)r]lastirryrzrrrrJs  )rr{c Cs||dk } | rdnd} xbt|||||||dD]H} | oF| jdk oF| jdk} | rVt|d| j|k} t| j| | |dq,WdS)Nr`r)r{)r)rxrfrir%rr)rrrrIrrrzrr{Z show_linenorqZinstrZnew_source_lineZis_current_instrrrrr)Qs       r)cCstt|d|ddS)Nz)r)rr)rrrrrr+csr+ccshd}x^tdt|dD]J}||}|tkrP||d|B}|tkrJ|d>nd}nd}|||fVqWdS)Nrr:r9r<)rBlenZ HAVE_ARGUMENTZ EXTENDED_ARG)rZ extended_argrJrrmrrrrisrcCs`g}xVt|D]J\}}}|dk r|tkr6|d|}n|tkr|}nq||kr|j|qW|S)Nr:)rrZhasjabsrC)rrrirrmZlabelrrrr tsccs|jddd}|jddd}d}|j}d}xPt||D]B\}}|rd||kr\||fV|}||7}|dkrt|d8}||7}q:W||kr||fVdS)Nrr:r9r@rA) co_lnotabrwzip)rZbyte_incrementsZline_incrementsZ lastlinenolinenoZaddrZ byte_incrZ line_incrrrrr s   c@sHeZdZdddddZddZddZed d Zd d Zd dZ dS)rN)rucurrent_offsetcCsdt||_}|dkr&|j|_d|_n||_||j|_|j|j|_tt ||_ ||_ ||_ dS)Nr) rMcodeobjrwru _line_offsetr\r[ _cell_namesrvr _linestarts_original_objectr)rpr.rurr]rrr__init__s zBytecode.__init__c Cs*|j}t|j|j|j|j|j|j|jdS)N)r{) rrxrrZrYrWrrr)rpr]rrr__iter__s zBytecode.__iter__cCsdj|jj|jS)Nz{}({!r}))format __class__r-r)rprrr__repr__s zBytecode.__repr__cCs$x|jr|j}qW||jj|jdS)N)r)r4r5r6r7)clsr8rrrfrom_tracebacks zBytecode.from_tracebackcCs t|jS)N)rNr)rprrrinfosz Bytecode.infocCs`|j}|jdk r|j}nd}tj2}t|j|j|j|j|j |j |j ||d |j SQRXdS)Nr9)rrIrrrzr{rr) rrioStringIOr)rrZrYrWrrrgetvalue)rpr]rioutputrrrrs   z Bytecode.dis) r-rsrtrrr classmethodrrrrrrrrs   c Csdddl}|j}|jd|jddd|j}|j}|j}WdQRXt||jjd}t |dS)Nrinfile?-)r,nargsdefaultr) argparseArgumentParser add_argumentZFileType parse_argsrreadrrr)rparserargsrrrrrr_testsr__main__)N)N)NNNNNrr)rr)rNNNNN)2r0types collectionsrZopcoderZ _opcodes_all MethodType FunctionTypeCodeTyper staticmethodr,r$ZopmaprrrrrDrLrMrrNr namedtupler_rk__doc__rmr|rnrirfrgr r r}r~rxrr)r+rrr r rrr-rrrrsv     #3  2 = ipaddress.cpython-36.opt-1.pyc000064400000177050152462730460012132 0ustar003 i/@sdZdZddlZdZdZGdddeZGdd d eZd d Zd=d dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"ZGd#d$d$ZejGd%d&d&eZejGd'd(d(eZGd)d*d*ZGd+d,d,eeZGd-d.d.eZGd/d0d0eeZGd1d2d2Zee_Gd3d4d4ZGd5d6d6eeZGd7d8d8eZ Gd9d:d:eeZ!Gd;d<d<Z"e"e_dS)>zA fast, lightweight IPv4/IPv6 manipulation library in Python. This library is used to create/poke/manipulate IPv4 and IPv6 addresses and networks. z1.0N c@seZdZdZdS)AddressValueErrorz%A Value Error related to the address.N)__name__ __module__ __qualname____doc__r r !/usr/lib64/python3.6/ipaddress.pyrsrc@seZdZdZdS)NetmaskValueErrorz%A Value Error related to the netmask.N)rrrrr r r r r sr cCsTyt|Sttfk r YnXyt|Sttfk rBYnXtd|dS)aTake an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP address. Either IPv4 or IPv6 addresses may be supplied; integers less than 2**32 will be considered to be IPv4 by default. Returns: An IPv4Address or IPv6Address object. Raises: ValueError: if the *address* passed isn't either a v4 or a v6 address z0%r does not appear to be an IPv4 or IPv6 addressN) IPv4Addressrr IPv6Address ValueError)addressr r r ip_addresssrTcCsXy t||Sttfk r"YnXy t||Sttfk rFYnXtd|dS)aTake an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP network. Either IPv4 or IPv6 networks may be supplied; integers less than 2**32 will be considered to be IPv4 by default. Returns: An IPv4Network or IPv6Network object. Raises: ValueError: if the string passed isn't either a v4 or a v6 address. Or if the network has host bits set. z0%r does not appear to be an IPv4 or IPv6 networkN) IPv4Networkrr IPv6Networkr)rstrictr r r ip_network9s  rcCsTyt|Sttfk r YnXyt|Sttfk rBYnXtd|dS)agTake an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP address. Either IPv4 or IPv6 addresses may be supplied; integers less than 2**32 will be considered to be IPv4 by default. Returns: An IPv4Interface or IPv6Interface object. Raises: ValueError: if the string passed isn't either a v4 or a v6 address. Notes: The IPv?Interface classes describe an Address on a particular Network, so they're basically a combination of both the Address and Network classes. z2%r does not appear to be an IPv4 or IPv6 interfaceN) IPv4Interfacerr IPv6Interfacer)rr r r ip_interfaceWsrc Cs.y |jddStk r(tdYnXdS)a`Represent an address as 4 packed bytes in network (big-endian) order. Args: address: An integer representation of an IPv4 IP address. Returns: The integer address packed as 4 bytes in network (big-endian) order. Raises: ValueError: If the integer is negative or too large to be an IPv4 IP address. bigz&Address negative or too large for IPv4N)to_bytes OverflowErrorr)rr r r v4_int_to_packedzs rc Cs.y |jddStk r(tdYnXdS)zRepresent an address as 16 packed bytes in network (big-endian) order. Args: address: An integer representation of an IPv6 IP address. Returns: The integer address packed as 16 bytes in network (big-endian) order. rz&Address negative or too large for IPv6N)rrr)rr r r v6_int_to_packeds  rcCs*t|jd}t|dkr&td||S)zAHelper to split the netmask and raise AddressValueError if needed/zOnly one '/' permitted in %r)strsplitlenr)raddrr r r _split_optional_netmasks  r%ccsRt|}t|}}x.|D]&}|j|jdkr<||fV|}|}qW||fVdS)zFind a sequence of sorted deduplicated IPv#Address. Args: addresses: a list of IPv#Address objects. Yields: A tuple containing the first and last IP addresses in the sequence. N)iternext_ip) addressesitfirstlastipr r r _find_address_ranges    r/cCs$|dkr |St|||d@jS)zCount the number of zero bits on the right hand side. Args: number: an integer. bits: maximum number of bits to count. Returns: The number of zero bits on the right hand side of the number. rr&)min bit_length)Znumberbitsr r r _count_righthand_zero_bitss r3ccst|tot|tstd|j|jkr8td||f||krHtd|jdkrXt}n|jdkrht}ntd|j}|j}|j}x^||krt t ||||dj d}||||f}|V|d|>7}|d|j krPqWdS) aSummarize a network range given the first and last IP addresses. Example: >>> list(summarize_address_range(IPv4Address('192.0.2.0'), ... IPv4Address('192.0.2.130'))) ... #doctest: +NORMALIZE_WHITESPACE [IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/31'), IPv4Network('192.0.2.130/32')] Args: first: the first IPv4Address or IPv6Address in the range. last: the last IPv4Address or IPv6Address in the range. Returns: An iterator of the summarized IPv(4|6) network objects. Raise: TypeError: If the first and last objects are not IP addresses. If the first and last objects are not the same version. ValueError: If the last object is not greater than the first. If the version of the first address is not 4 or 6. z1first and last must be IP addresses, not networksz%%s and %s are not of the same versionz*last IP address must be greater than firstrzunknown IP versionr&N) isinstance _BaseAddress TypeErrorversionrrr_max_prefixlenr)r0r3r1 _ALL_ONES)r,r-r.Zip_bitsZ first_intZlast_intZnbitsnetr r r summarize_address_ranges0         r<ccst|}i}xL|rX|j}|j}|j|}|dkr>|||<q||kr||=|j|qWd}x4t|jD]$}|dk r|j|jkrql|V|}qlWdS)auLoops through the addresses, collapsing concurrent netblocks. Example: ip1 = IPv4Network('192.0.2.0/26') ip2 = IPv4Network('192.0.2.64/26') ip3 = IPv4Network('192.0.2.128/26') ip4 = IPv4Network('192.0.2.192/26') _collapse_addresses_internal([ip1, ip2, ip3, ip4]) -> [IPv4Network('192.0.2.0/24')] This shouldn't be called directly; it is called via collapse_addresses([]). Args: addresses: A list of IPv4Network's or IPv6Network's Returns: A list of IPv4Network's or IPv6Network's depending on what we were passed. N)listpopsupernetgetappendsortedvaluesbroadcast_address)r*Zto_mergesubnetsr;r?Zexistingr-r r r _collapse_addresses_internals$   rFc Cs8g}g}g}x|D]}t|trT|rH|dj|jkrHtd||df|j|q|j|jkr|r|dj|jkrtd||dfy|j|jWqtk r|j|j YqXq|r|dj|jkrtd||df|j|qWt t |}|r,x&t |D]\}}|j t||qWt||S) aCollapse a list of IP objects. Example: collapse_addresses([IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/25')]) -> [IPv4Network('192.0.2.0/24')] Args: addresses: An iterator of IPv4Network or IPv6Network objects. Returns: An iterator of the collapsed IPv(4|6)Network objects. Raises: TypeError: If passed a list of mixed version objects. r&z%%s and %s are not of the same versionrGrGrGrGrG)r5r6_versionr7rA _prefixlenr9r.AttributeErrornetwork_addressrBsetr/extendr<rF)r*ZaddrsZipsZnetsr.r,r-r r r collapse_addresses2s4     rNcCs(t|tr|jSt|tr$|jStS)a2Return a key suitable for sorting between networks and addresses. Address and Network objects are not sortable by default; they're fundamentally different so the expression IPv4Address('192.0.2.0') <= IPv4Network('192.0.2.0/24') doesn't make any sense. There are some times however, where you may wish to have ipaddress sort these for you anyway. If you need to do this, you can use this function as the key= argument to sorted(). Args: obj: either a Network or Address object. Returns: appropriate key. )r5 _BaseNetwork_get_networks_keyr6_get_address_keyNotImplemented)objr r r get_mixed_type_keyhs   rTc@seZdZdZfZeddZeddZeddZedd Z d d Z d d Z e ddZ e ddZe ddZe ddZe ddZddZdS)_IPAddressBasezThe mother class.cCs|jS)z:Return the longhand version of the IP address as a string.)_explode_shorthand_ip_string)selfr r r explodedsz_IPAddressBase.explodedcCst|S)z;Return the shorthand version of the IP address as a string.)r!)rWr r r compressedsz_IPAddressBase.compressedcCs|jS)aIThe name of the reverse DNS pointer for the IP address, e.g.: >>> ipaddress.ip_address("127.0.0.1").reverse_pointer '1.0.0.127.in-addr.arpa' >>> ipaddress.ip_address("2001:db8::1").reverse_pointer '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa' )_reverse_pointer)rWr r r reverse_pointers z_IPAddressBase.reverse_pointercCsdt|f}t|dS)Nz%200s has no version specified)typeNotImplementedError)rWmsgr r r r8sz_IPAddressBase.versioncCsF|dkrd}t|||jf||jkrBd}t|||j|jfdS)Nrz-%d (< 0) is not permitted as an IPv%d addressz2%d (>= 2**%d) is not permitted as an IPv%d address)rrHr:r9)rWrr^r r r _check_int_addresss  z!_IPAddressBase._check_int_addresscCs.t|}||kr*d}t|||||jfdS)Nz6%r (len %d != %d) is not permitted as an IPv%d address)r#rrH)rWrZ expected_lenZ address_lenr^r r r _check_packed_addresss z$_IPAddressBase._check_packed_addresscCs|j|j|?AS)zTurn the prefix length into a bitwise netmask Args: prefixlen: An integer, the prefix length. Returns: An integer. )r:)cls prefixlenr r r _ip_int_from_prefixs z"_IPAddressBase._ip_int_from_prefixc Cs\t||j}|j|}||?}d|>d}||krX|jd}|j|d}d}t|||S)aReturn prefix length from the bitwise netmask. Args: ip_int: An integer, the netmask in expanded bitwise format Returns: An integer, the prefix length. Raises: ValueError: If the input intermingles zeroes & ones r&rz&Netmask pattern %r mixes zeroes & ones)r3r9rr) raip_intZtrailing_zeroesrbZ leading_onesZall_onesZbyteslenZdetailsr^r r r _prefix_from_ip_ints      z"_IPAddressBase._prefix_from_ip_intcCsd|}t|ddS)Nz%r is not a valid netmask)r )raZ netmask_strr^r r r _report_invalid_netmasksz&_IPAddressBase._report_invalid_netmaskc Csjtjj|s|j|y t|}Wntk r@|j|YnXd|koV|jknsf|j||S)a Return prefix length from a numeric string Args: prefixlen_str: The string to be converted Returns: An integer, the prefix length. Raises: NetmaskValueError: If the input is not a valid netmask r)_BaseV4_DECIMAL_DIGITS issupersetrgintrr9)raZ prefixlen_strrbr r r _prefix_from_prefix_strings    z)_IPAddressBase._prefix_from_prefix_stringcCsy|j|}Wntk r,|j|YnXy |j|Stk rLYnX||jN}y |j|Stk r|j|YnXdS)aTurn a netmask/hostmask string into a prefix length Args: ip_str: The netmask/hostmask to be converted Returns: An integer, the prefix length. Raises: NetmaskValueError: If the input is not a valid netmask/hostmask N)_ip_int_from_stringrrgrfrr:)raip_strrer r r _prefix_from_ip_strings   z%_IPAddressBase._prefix_from_ip_stringcCs|jt|ffS)N) __class__r!)rWr r r __reduce__sz_IPAddressBase.__reduce__N)rrrr __slots__propertyrXrYr[r8r_r` classmethodrcrfrgrlrorqr r r r rUs        "rUc@sdeZdZdZfZddZddZddZdd Zd d Z d d Z ddZ ddZ ddZ ddZdS)r6zA generic IP object. This IP class contains the version independent methods which are used by single IP addresses. cCs|jS)N)r))rWr r r __int__&sz_BaseAddress.__int__c Cs2y|j|jko|j|jkStk r,tSXdS)N)r)rHrJrR)rWotherr r r __eq__)s   z_BaseAddress.__eq__cCsFt|tstS|j|jkr*td||f|j|jkrB|j|jkSdS)Nz%%s and %s are not of the same versionF)r5r6rRrHr7r))rWrvr r r __lt__0s     z_BaseAddress.__lt__cCs t|tstS|jt||S)N)r5rkrRrp)rWrvr r r __add__<s z_BaseAddress.__add__cCs t|tstS|jt||S)N)r5rkrRrp)rWrvr r r __sub__As z_BaseAddress.__sub__cCsd|jjt|fS)Nz%s(%r))rprr!)rWr r r __repr__Fsz_BaseAddress.__repr__cCst|j|jS)N)r!_string_from_ip_intr))rWr r r __str__Isz_BaseAddress.__str__cCsttt|jS)N)hashhexrkr))rWr r r __hash__Lsz_BaseAddress.__hash__cCs |j|fS)N)rH)rWr r r rQOsz_BaseAddress._get_address_keycCs|j|jffS)N)rpr))rWr r r rqRsz_BaseAddress.__reduce__N)rrrrrrrurwrxryrzr{r}rrQrqr r r r r6s r6c@sHeZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZeddZeddZeddZeddZed d!Zed"d#Zed$d%Zed&d'Zd(d)Zd*d+Zd,d-ZdBd0d1ZdCd2d3Zed4d5Zed6d7Zed8d9Zed:d;Z edd?Z"ed@dAZ#d/S)DrOz~A generic IP network object. This IP class contains the version independent methods which are used by networks. cCs i|_dS)N)_cache)rWrr r r __init___sz_BaseNetwork.__init__cCsd|jjt|fS)Nz%s(%r))rprr!)rWr r r r{bsz_BaseNetwork.__repr__cCsd|j|jfS)Nz%s/%d)rKrb)rWr r r r}esz_BaseNetwork.__str__ccs<t|j}t|j}x"t|d|D]}|j|Vq$WdS)zGenerate Iterator over usable hosts in a network. This is like __iter__ except it doesn't return the network or broadcast addresses. r&N)rkrKrDrange_address_class)rWnetwork broadcastxr r r hostshs  z_BaseNetwork.hostsccs<t|j}t|j}x"t||dD]}|j|Vq$WdS)Nr&)rkrKrDrr)rWrrrr r r __iter__ts  z_BaseNetwork.__iter__cCslt|j}t|j}|dkr>|||kr0td|j||S|d7}|||krZtd|j||SdS)Nrzaddress out of ranger&)rkrKrD IndexErrorr)rWnrrr r r __getitem__zs    z_BaseNetwork.__getitem__cCs^t|tstS|j|jkr*td||f|j|jkrB|j|jkS|j|jkrZ|j|jkSdS)Nz%%s and %s are not of the same versionF)r5rOrRrHr7rKnetmask)rWrvr r r rxs       z_BaseNetwork.__lt__c CsFy,|j|jko,|j|jko,t|jt|jkStk r@tSXdS)N)rHrKrkrrJrR)rWrvr r r rws   z_BaseNetwork.__eq__cCstt|jt|jAS)N)r~rkrKr)rWr r r rsz_BaseNetwork.__hash__cCsL|j|jkrdSt|trdSt|jt|jkoBt|jkSSdS)NF)rHr5rOrkrKr)rD)rWrvr r r __contains__s   z_BaseNetwork.__contains__cCs(|j|kp&|j|kp&|j|kp&|j|kS)z*Tell if self is partly contained in other.)rKrD)rWrvr r r overlapss   z_BaseNetwork.overlapscCs<|jjd}|dkr8|jt|jt|jB}||jd<|S)NrD)rr@rrkrKhostmask)rWrr r r rDs    z_BaseNetwork.broadcast_addresscCs8|jjd}|dkr4|jt|j|jA}||jd<|S)Nr)rr@rrkrr:)rWrr r r rs   z_BaseNetwork.hostmaskcCsd|j|jfS)Nz%s/%d)rKrI)rWr r r with_prefixlensz_BaseNetwork.with_prefixlencCsd|j|jfS)Nz%s/%s)rKr)rWr r r with_netmasksz_BaseNetwork.with_netmaskcCsd|j|jfS)Nz%s/%s)rKr)rWr r r with_hostmasksz_BaseNetwork.with_hostmaskcCst|jt|jdS)z&Number of hosts in the current subnet.r&)rkrDrK)rWr r r num_addressessz_BaseNetwork.num_addressescCsdt|f}t|dS)Nz%%200s has no associated address class)r\r])rWr^r r r rsz_BaseNetwork._address_classcCs|jS)N)rI)rWr r r rbsz_BaseNetwork.prefixlenccsD|j|jkstd||ft|ts2td||j|jkoH|j|jksZtd||f||krfdS|jd|j|jf}|j \}}x||ko||kr|j|jkr|j|jkr|V|j \}}q|j|jkr|j|jkr|V|j \}}qt d|||fqW||kr|Vn$||kr.|Vnt d|||fdS)aRemove an address from a larger block. For example: addr1 = ip_network('192.0.2.0/28') addr2 = ip_network('192.0.2.1/32') list(addr1.address_exclude(addr2)) = [IPv4Network('192.0.2.0/32'), IPv4Network('192.0.2.2/31'), IPv4Network('192.0.2.4/30'), IPv4Network('192.0.2.8/29')] or IPv6: addr1 = ip_network('2001:db8::1/32') addr2 = ip_network('2001:db8::1/128') list(addr1.address_exclude(addr2)) = [ip_network('2001:db8::1/128'), ip_network('2001:db8::2/127'), ip_network('2001:db8::4/126'), ip_network('2001:db8::8/125'), ... ip_network('2001:db8:8000::/33')] Args: other: An IPv4Network or IPv6Network object of the same type. Returns: An iterator of the IPv(4|6)Network objects which is self minus other. Raises: TypeError: If self and other are of differing address versions, or if other is not a network object. ValueError: If other is not completely contained by self. z%%s and %s are not of the same versionz%s is not a network objectz%s not contained in %sNz%s/%sz3Error performing exclusion: s1: %s s2: %s other: %s) rHr7r5rOrKrDrrprbrEAssertionError)rWrvs1s2r r r address_excludes<$               z_BaseNetwork.address_excludecCs`|j|jkrtd||f|j|jkr,dS|j|jkr other eg: IPv4Network('192.0.2.128/25') > IPv4Network('192.0.2.0/25') IPv6Network('2001:db8::2000/124') > IPv6Network('2001:db8::1000/124') Raises: TypeError if the IP versions are different. z"%s and %s are not of the same typer&rrGrG)rHr7rKr)rWrvr r r compare_networks.s!      z_BaseNetwork.compare_networkscCs|j|j|jfS)zNetwork-only key function. Returns an object that identifies this address' network and netmask. This function is a suitable "key" argument for sorted() and list.sort(). )rHrKr)rWr r r rP^sz_BaseNetwork._get_networks_keyr&Nc cs|j|jkr|VdS|dk rJ||jkr0td|dkr@td||j}|dkrZtd|j|}||jkr~td||ft|j}t|jd}t|jd|?}x(t|||D]}|j||f}|VqWdS)aThe subnets which join to make the current subnet. In the case that self contains only one IP (self._prefixlen == 32 for IPv4 or self._prefixlen == 128 for IPv6), yield an iterator with just ourself. Args: prefixlen_diff: An integer, the amount the prefix length should be increased by. This should not be set if new_prefix is also set. new_prefix: The desired new prefix length. This must be a larger number (smaller prefix) than the existing prefix. This should not be set if prefixlen_diff is also set. Returns: An iterator of IPv(4|6) objects. Raises: ValueError: The prefixlen_diff is too small or too large. OR prefixlen_diff and new_prefix are both set or new_prefix is a smaller number than the current prefix (smaller number means a larger network) Nznew prefix must be longerr&z(cannot set prefixlen_diff and new_prefixrzprefix length diff must be > 0z0prefix length diff %d is invalid for netblock %s) rIr9rrkrKrDrrrp) rWprefixlen_diff new_prefix new_prefixlenstartendstepZnew_addrZcurrentr r r rEhs,       z_BaseNetwork.subnetscCs|jdkr|S|dk rB||jkr(td|dkr8td|j|}|j|}|dkrftd|j|f|jt|jt|j|>@|fS)aThe supernet containing the current network. Args: prefixlen_diff: An integer, the amount the prefix length of the network should be decreased by. For example, given a /24 network and a prefixlen_diff of 3, a supernet with a /21 netmask is returned. Returns: An IPv4 network object. Raises: ValueError: If self.prefixlen - prefixlen_diff < 0. I.e., you have a negative prefix length. OR If prefixlen_diff and new_prefix are both set or new_prefix is a larger number than the current prefix (larger number means a smaller network) rNznew prefix must be shorterr&z(cannot set prefixlen_diff and new_prefixz;current prefixlen is %d, cannot have a prefixlen_diff of %d)rIrrbrprkrKr)rWrrrr r r r?s     z_BaseNetwork.supernetcCs|jjo|jjS)zTest if the address is reserved for multicast use. Returns: A boolean, True if the address is a multicast address. See RFC 2373 2.7 for details. )rK is_multicastrD)rWr r r rs z_BaseNetwork.is_multicastcCs|jjo|jjS)zTest if the address is otherwise IETF reserved. Returns: A boolean, True if the address is within one of the reserved IPv6 Network ranges. )rK is_reservedrD)rWr r r rs z_BaseNetwork.is_reservedcCs|jjo|jjS)zTest if the address is reserved for link-local. Returns: A boolean, True if the address is reserved per RFC 4291. )rK is_link_localrD)rWr r r rsz_BaseNetwork.is_link_localcCs|jjo|jjS)zTest if this address is allocated for private networks. Returns: A boolean, True if the address is reserved per iana-ipv4-special-registry or iana-ipv6-special-registry. )rK is_privaterD)rWr r r rs z_BaseNetwork.is_privatecCs|j S)zTest if this address is allocated for public networks. Returns: A boolean, True if the address is not reserved per iana-ipv4-special-registry or iana-ipv6-special-registry. )r)rWr r r is_globals z_BaseNetwork.is_globalcCs|jjo|jjS)zTest if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 2373 2.5.2. )rKis_unspecifiedrD)rWr r r rs z_BaseNetwork.is_unspecifiedcCs|jjo|jjS)zTest if the address is a loopback address. Returns: A boolean, True if the address is a loopback address as defined in RFC 2373 2.5.3. )rK is_loopbackrD)rWr r r r s z_BaseNetwork.is_loopback)r&N)r&N)$rrrrrr{r}rrrrxrwrrrrsrDrrrrrrrbrrrPrEr?rrrrrrrr r r r rOVs@           N0 5 ) rOc @seZdZdZfZdZdedZedZ edddd d d d d dh Z eZ iZ ddZ eddZeddZeddZeddZddZddZddZedd Zed!d"Zd#S)$rhzyBase IPv4 object. The following methods are used by IPv4 objects in both single IP addresses and networks. rr r& 0123456789rrcCst|S)N)r!)rWr r r rV0sz$_BaseV4._explode_shorthand_ip_stringc Csn||jkrdt|tr|}n.y|j|}Wntk rF|j|}YnXt|j|}||f|j|<|j|S)aMake a (netmask, prefix_len) tuple from the given argument. Argument can be: - an integer (the prefix length) - a string representing the prefix length (e.g. "24") - a string representing the prefix netmask (e.g. "255.255.255.0") )_netmask_cacher5rkrlr ror rc)raargrbrr r r _make_netmask3s  z_BaseV4._make_netmaskcCs||s td|jd}t|dkr.td|ytjt|j|dStk rv}ztd||fdWYdd}~XnXdS)aTurn the given IP string into an integer for comparison. Args: ip_str: A string, the IP ip_str. Returns: The IP ip_str as an integer. Raises: AddressValueError: if ip_str isn't a valid IPv4 Address. zAddress cannot be empty.rzExpected 4 octets in %rrz%s in %rN)rr"r#rk from_bytesmap _parse_octetr)rarnZoctetsexcr r r rmKs   z_BaseV4._ip_int_from_stringcCs|s td|jj|s(d}t||t|dkrDd}t||t|d}|dkrr|ddkrrd }t|||d krtd ||S) a Convert a decimal octet into an integer. Args: octet_str: A string, the number to parse. Returns: The octet as an integer. Raises: ValueError: if the octet isn't strictly a decimal from [0..255]. zEmpty octet not permittedz#Only decimal digits permitted in %rz$At most 3 characters permitted in %r r0z3Ambiguous (octal/decimal) value in %r not permittedrzOctet %d (> 255) not permitted)rrirjr#rk)raZ octet_strr^Z octet_intr r r res       z_BaseV4._parse_octetcCsdjtt|jddS)zTurns a 32-bit integer into dotted decimal notation. Args: ip_int: An integer, the IP address. Returns: The IP address as a string in dotted decimal notation. rrr)joinrr!r)rarer r r r|s z_BaseV4._string_from_ip_intcCs|jd}t|dkry$x|D]}t||jkrdSqWWntk rNdSXx0t|D]$\}}|dkrZ|||dkrZdSqZWdSy t|}Wntk rdSXd|ko|jkSS)zVerify that the netmask is valid. Args: netmask: A string, either a prefix or dotted decimal netmask. Returns: A boolean, True if the prefix represents a valid IPv4 netmask. rrFrr&T)r"r#rk_valid_mask_octetsr enumerater9)rWrmaskridxyr r r _is_valid_netmasks"     z_BaseV4._is_valid_netmaskc sh|jd}yfddtt|D}Wntk r:dSXt|t|krPdS|d|dkrddSdS) zTest if the IP string is a hostmask (rather than a netmask). Args: ip_str: A string, the potential hostmask. Returns: A boolean, True if the IP string is a hostmask. rcsg|]}|jkr|qSr )r).0r)rWr r sz(_BaseV4._is_hostmask..Frr&TrG)r"rrkrr#)rWrnr2partsr )rWr _is_hostmasks z_BaseV4._is_hostmaskcCs&t|jdddd}dj|dS)zReturn the reverse DNS pointer name for the IPv4 address. This implements the method described in RFC1035 3.5. rNr&z .in-addr.arparG)r!r"r)rWZreverse_octetsr r r rZsz_BaseV4._reverse_pointercCs|jS)N)r9)rWr r r max_prefixlensz_BaseV4.max_prefixlencCs|jS)N)rH)rWr r r r8sz_BaseV4.versionN)rrrrrrrH IPV4LENGTHr: frozensetrirr9rrVrtrrmrr|rrrZrsrr8r r r r rhs$    %  rhc@seZdZdZdZddZeddZedd Zee j d d Z ee j d d Z eddZ eddZeddZeddZdS)r z/Represent and manipulate single IPv4 Addresses.r) __weakref__cCsrt|tr|j|||_dSt|trF|j|dtj|d|_dSt|}d|krbtd||j ||_dS)a Args: address: A string or integer representing the IP Additionally, an integer can be passed, so IPv4Address('192.0.2.1') == IPv4Address(3221225985). or, more generally IPv4Address(int(IPv4Address('192.0.2.1'))) == IPv4Address('192.0.2.1') Raises: AddressValueError: If ipaddress isn't a valid IPv4 address. NrrrzUnexpected '/' in %r) r5rkr_r)bytesr`rr!rrm)rWraddr_strr r r rs     zIPv4Address.__init__cCs t|jS)z*The binary representation of this address.)rr))rWr r r packedszIPv4Address.packedcCs ||jjkS)zTest if the address is otherwise IETF reserved. Returns: A boolean, True if the address is within the reserved IPv4 Network range. ) _constants_reserved_network)rWr r r r s zIPv4Address.is_reservedcs4tfddjjDo2tfddjjDS)a``True`` if the address is defined as not globally reachable by iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_ (for IPv6) with the following exceptions: * ``is_private`` is ``False`` for ``100.64.0.0/10`` * For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the semantics of the underlying IPv4 addresses and the following condition holds (see :attr:`IPv6Address.ipv4_mapped`):: address.is_private == address.ipv4_mapped.is_private ``is_private`` has value opposite to :attr:`is_global`, except for the ``100.64.0.0/10`` IPv4 range where they are both ``False``. c3s|]}|kVqdS)Nr )rr;)rWr r (sz)IPv4Address.is_private..c3s|]}|kVqdS)Nr )rr;)rWr r r)s)anyr_private_networksall_private_networks_exceptions)rWr )rWr rszIPv4Address.is_privatecCs||jjko|j S)ar``True`` if the address is defined as globally reachable by iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_ (for IPv6) with the following exception: For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the semantics of the underlying IPv4 addresses and the following condition holds (see :attr:`IPv6Address.ipv4_mapped`):: address.is_global == address.ipv4_mapped.is_global ``is_global`` has value opposite to :attr:`is_private`, except for the ``100.64.0.0/10`` IPv4 range where they are both ``False``. )r_public_networkr)rWr r r r,szIPv4Address.is_globalcCs ||jjkS)zTest if the address is reserved for multicast use. Returns: A boolean, True if the address is multicast. See RFC 3171 for details. )r_multicast_network)rWr r r r>s zIPv4Address.is_multicastcCs ||jjkS)zTest if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 5735 3. )r_unspecified_address)rWr r r rIs zIPv4Address.is_unspecifiedcCs ||jjkS)zTest if the address is a loopback address. Returns: A boolean, True if the address is a loopback per RFC 3330. )r_loopback_network)rWr r r rTszIPv4Address.is_loopbackcCs ||jjkS)zTest if the address is reserved for link-local. Returns: A boolean, True if the address is link-local per RFC 3927. )r_linklocal_network)rWr r r r^szIPv4Address.is_link_localN)r)r)rrrrrrrrsrr functools lru_cacherrrrrrr r r r r s#   r c@sjeZdZddZddZddZddZd d Zej Z e d d Z e d dZ e ddZ e ddZdS)rcCst|ttfr2tj||t|j|_|j|_ dSt|t rtj||dt |dkrht|d|_ n|j|_ t|dd|_|jj |_ |jj |_ dSt|}tj||dt|dd|_|jj |_ |jj |_ |jj |_ dS)Nrr&F)r)r5rrkr rrr)rr9rItupler#rrr%)rWrr$r r r rks(        zIPv4Interface.__init__cCsd|j|j|jjfS)Nz%s/%d)r|r)rrb)rWr r r r}s zIPv4Interface.__str__c CsDtj||}| s|tkr|Sy |j|jkStk r>dSXdS)NF)r rwrRrrJ)rWrv address_equalr r r rws  zIPv4Interface.__eq__c CsNtj||}|tkrtSy|j|jkp4|j|jko4|Stk rHdSXdS)NF)r rxrRrrJ)rWrv address_lessr r r rxs  zIPv4Interface.__lt__cCst|j|jt|jjfS)N)r~r)rIrkrrK)rWr r r rszIPv4Interface.__hash__cCs t|jS)N)r r))rWr r r r.szIPv4Interface.ipcCsd|j|j|jfS)Nz%s/%s)r|r)rI)rWr r r rs zIPv4Interface.with_prefixlencCsd|j|j|jfS)Nz%s/%s)r|r)r)rWr r r rs zIPv4Interface.with_netmaskcCsd|j|j|jfS)Nz%s/%s)r|r)r)rWr r r rs zIPv4Interface.with_hostmaskN)rrrrr}rwrxrrUrqrsr.rrrr r r r ris     rc@s2eZdZdZeZdddZeej ddZ dS) raeThis class represents and manipulates 32-bit IPv4 network + addresses.. Attributes: [examples for IPv4Network('192.0.2.0/27')] .network_address: IPv4Address('192.0.2.0') .hostmask: IPv4Address('0.0.0.31') .broadcast_address: IPv4Address('192.0.2.32') .netmask: IPv4Address('255.255.255.224') .prefixlen: 27 TcCstj||t|ttfr&|}|j}n^t|trT|d}t|dkrL|dn|j}n0t|}|j |d}t|dkr~|dn|j}t ||_ |j |\|_ |_t|j }|t|j @|kr|rtd|nt |t|j @|_ |j|jdkr|j|_dS)aInstantiate a new IPv4 network object. Args: address: A string or integer representing the IP [& network]. '192.0.2.0/24' '192.0.2.0/255.255.255.0' '192.0.0.2/0.0.0.255' are all functionally the same in IPv4. Similarly, '192.0.2.1' '192.0.2.1/255.255.255.255' '192.0.2.1/32' are also functionally equivalent. That is to say, failing to provide a subnetmask will create an object with a mask of /32. If the mask (portion after the / in the argument) is given in dotted quad form, it is treated as a netmask if it starts with a non-zero field (e.g. /255.0.0.0 == /8) and as a hostmask if it starts with a zero field (e.g. 0.255.255.255 == /8), with the single exception of an all-zero mask which is treated as a netmask == /0. If no mask is given, a default of /32 is used. Additionally, an integer can be passed, so IPv4Network('192.0.2.1') == IPv4Network(3221225985) or, more generally IPv4Interface(int(IPv4Interface('192.0.2.1'))) == IPv4Interface('192.0.2.1') Raises: AddressValueError: If ipaddress isn't a valid IPv4 address. NetmaskValueError: If the netmask isn't valid for an IPv4 address. ValueError: If strict is True and a network address is not supplied. rr&r z%s has host bits setN)rOrr5rkrr9rr#r%rmr rKrrrIrrr)rWrrr$rargsrr r r rs(%    zIPv4Network.__init__cCs&|jtdko|jtdk o$|j S)zTest if this address is allocated for public networks. Returns: A boolean, True if the address is not reserved per iana-ipv4-special-registry. z 100.64.0.0/10)rKrrDr)rWr r r rs zIPv4Network.is_globalN)T) rrrrr rrrsrrrr r r r rs   Crc@seZdZedZedZedZedZededededededed ed ed ed ed edededgZededgZ edZ e dZ dS)_IPv4Constantsz169.254.0.0/16z 127.0.0.0/8z 224.0.0.0/4z 100.64.0.0/10z 0.0.0.0/8z 10.0.0.0/8z 172.16.0.0/12z 192.0.0.0/24z192.0.0.170/31z 192.0.2.0/24z192.168.0.0/16z 198.18.0.0/15z198.51.100.0/24z203.0.113.0/24z 240.0.0.0/4z255.255.255.255/32z 192.0.0.9/32z 192.0.0.10/32z0.0.0.0N) rrrrrrrrrrrr rr r r r rs,  rc@seZdZdZfZdZdedZdZe dZ eZ iZ e ddZe d d Ze d d Ze d dZe dddZddZddZeddZeddZdS)_BaseV6zyBase IPv6 object. The following methods are used by IPv6 objects in both single IP addresses and networks. r4r r&rdZ0123456789ABCDEFabcdefcCsJ||jkr@t|tr|}n |j|}t|j|}||f|j|<|j|S)aMake a (netmask, prefix_len) tuple from the given argument. Argument can be: - an integer (the prefix length) - a string representing the prefix length (e.g. "24") - a string representing the prefix netmask (e.g. "255.255.255.0") )rr5rkrlr rc)rarrbrr r r rZs   z_BaseV6._make_netmaskcCs|s td|jd}d}t||kr:d||f}t|d|dkryt|jj}Wn4tk r}ztd||fdWYdd}~XnX|jd |d ?d @|jd |d @|jd}t||krd |d|f}t|d}xDtdt|dD].} || s|dk r$d |}t|| }qW|dk r|} t||d} |dst| d8} | rtd}t|||ds| d8} | rd}t|||j| | } | dkr:d}t||jd|fnjt||jkrd}t||j|f|dsd}t|||ds*d}t||t|} d} d} ytd} x,t| D] } | d K} | |j || O} qJW| d | K} x0t| dD] } | d K} | |j || O} qW| St k r}ztd||fdWYdd}~XnXdS)zTurn an IPv6 ip_str into an integer. Args: ip_str: A string, the IPv6 ip_str. Returns: An int, the IPv6 address Raises: AddressValueError: if ip_str isn't a valid IPv6 Address. zAddress cannot be empty:rz At least %d parts expected in %rrr&z%s in %rNz%xriz!At most %d colons permitted in %rz At most one '::' permitted in %rrz0Leading ':' only permitted as part of '::' in %rz1Trailing ':' only permitted as part of '::' in %rz/Expected at most %d other parts with '::' in %rz,Exactly %d parts expected without '::' in %rrGrGrG) rr"r#r r>r)rA _HEXTET_COUNTr _parse_hextetr)rarnrZ _min_partsr^Zipv4_intrZ _max_partsZ skip_indexiZparts_hiZparts_loZ parts_skippedrer r r rmls    $                z_BaseV6._ip_int_from_stringcCs>|jj|std|t|dkr4d}t||t|dS)a&Convert an IPv6 hextet string into an integer. Args: hextet_str: A string, the number to parse. Returns: The hextet as an integer. Raises: ValueError: if the input isn't strictly a hex number from [0..FFFF]. zOnly hex digits permitted in %rrz$At most 4 characters permitted in %rr) _HEX_DIGITSrjrr#rk)raZ hextet_strr^r r r rs     z_BaseV6._parse_hextetc Csd}d}d}d}xJt|D]>\}}|dkrP|d7}|dkr>|}||krX|}|}qd}d}qW|dkr||}|t|kr|dg7}dg|||<|dkrdg|}|S) aCompresses a list of hextets. Compresses a list of strings, replacing the longest continuous sequence of "0" in the list with "" and adding empty strings at the beginning or at the end of the string such that subsequently calling ":".join(hextets) will produce the compressed version of the IPv6 address. Args: hextets: A list of strings, the hextets to compress. Returns: A list of strings. r&rrrGrGrGrG)rr#) rahextetsZbest_doublecolon_startZbest_doublecolon_lenZdoublecolon_startZdoublecolon_lenindexZhextetZbest_doublecolon_endr r r _compress_hextetss.   z_BaseV6._compress_hextetsNcsZ|dkrt|j}||jkr$tdd|fddtdddD}|j|}d j|S) a,Turns a 128-bit integer into hexadecimal notation. Args: ip_int: An integer, the IP address. Returns: A string, the hexadecimal representation of the address. Raises: ValueError: The address is bigger than 128 bits of all ones. NzIPv6 address is too largez%032xcs&g|]}dt||ddqS)z%xrr)rk)rr)hex_strr r r3sz/_BaseV6._string_from_ip_int..rrrr)rkr)r:rrrr)rarerr )rr r|s   z_BaseV6._string_from_ip_intcst|trt|j}nt|tr,t|j}nt|}|j|}d|fddtdddD}t|ttfrddj ||j fSdj |S) zExpand a shortened IPv6 address. Args: ip_str: A string, the IPv6 address. Returns: A string, the expanded IPv6 address. z%032xcsg|]}||dqS)rr )rr)rr r rKsz8_BaseV6._explode_shorthand_ip_string..rrrz%s/%dr) r5rr!rKrr.rmrrOrrI)rWrnrerr )rr rV8s     z$_BaseV6._explode_shorthand_ip_stringcCs&|jdddjdd}dj|dS)zReturn the reverse DNS pointer name for the IPv6 address. This implements the method described in RFC3596 2.5. Nr&rrrz .ip6.arparG)rXreplacer)rWZ reverse_charsr r r rZPsz_BaseV6._reverse_pointercCs|jS)N)r9)rWr r r rYsz_BaseV6.max_prefixlencCs|jS)N)rH)rWr r r r8]sz_BaseV6.version)N)rrrrrrrH IPV6LENGTHr:rrrr9rrtrrmrrr|rVrZrsrr8r r r r rFs$   h  0  rc@seZdZdZdZddZeddZedd Zed d Z ed d Z eddZ ee j ddZeddZeddZeddZeddZeddZeddZdS) r z/Represent and manipulate single IPv6 Addresses.r)rcCsrt|tr|j|||_dSt|trF|j|dtj|d|_dSt|}d|krbtd||j ||_dS)aInstantiate a new IPv6 address object. Args: address: A string or integer representing the IP Additionally, an integer can be passed, so IPv6Address('2001:db8::') == IPv6Address(42540766411282592856903984951653826560) or, more generally IPv6Address(int(IPv6Address('2001:db8::'))) == IPv6Address('2001:db8::') Raises: AddressValueError: If address isn't a valid IPv6 address. NrrrzUnexpected '/' in %r) r5rkr_r)rr`rr!rrm)rWrrr r r rhs     zIPv6Address.__init__cCs t|jS)z*The binary representation of this address.)rr))rWr r r rszIPv6Address.packedcCs ||jjkS)zTest if the address is reserved for multicast use. Returns: A boolean, True if the address is a multicast address. See RFC 2373 2.7 for details. )rr)rWr r r rs zIPv6Address.is_multicastcstfddjjDS)zTest if the address is otherwise IETF reserved. Returns: A boolean, True if the address is within one of the reserved IPv6 Network ranges. c3s|]}|kVqdS)Nr )rr)rWr r rsz*IPv6Address.is_reserved..)rr_reserved_networks)rWr )rWr rs zIPv6Address.is_reservedcCs ||jjkS)zTest if the address is reserved for link-local. Returns: A boolean, True if the address is reserved per RFC 4291. )rr)rWr r r rszIPv6Address.is_link_localcCs ||jjkS)a`Test if the address is reserved for site-local. Note that the site-local address space has been deprecated by RFC 3879. Use is_private to test if this address is in the space of unique local addresses as defined by RFC 4193. Returns: A boolean, True if the address is reserved per RFC 3513 2.5.6. )r_sitelocal_network)rWr r r is_site_locals zIPv6Address.is_site_localcsHj}|dk r|jStfddjjDoFtfddjjDS)a``True`` if the address is defined as not globally reachable by iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_ (for IPv6) with the following exceptions: * ``is_private`` is ``False`` for ``100.64.0.0/10`` * For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the semantics of the underlying IPv4 addresses and the following condition holds (see :attr:`IPv6Address.ipv4_mapped`):: address.is_private == address.ipv4_mapped.is_private ``is_private`` has value opposite to :attr:`is_global`, except for the ``100.64.0.0/10`` IPv4 range where they are both ``False``. Nc3s|]}|kVqdS)Nr )rr;)rWr r rsz)IPv6Address.is_private..c3s|]}|kVqdS)Nr )rr;)rWr r rs) ipv4_mappedrrrrrr)rWrr )rWr rs zIPv6Address.is_privatecCs|j S)ar``True`` if the address is defined as globally reachable by iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_ (for IPv6) with the following exception: For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the semantics of the underlying IPv4 addresses and the following condition holds (see :attr:`IPv6Address.ipv4_mapped`):: address.is_global == address.ipv4_mapped.is_global ``is_global`` has value opposite to :attr:`is_private`, except for the ``100.64.0.0/10`` IPv4 range where they are both ``False``. )r)rWr r r rszIPv6Address.is_globalcCs |jdkS)zTest if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 2373 2.5.2. r)r))rWr r r rs zIPv6Address.is_unspecifiedcCs |jdkS)zTest if the address is a loopback address. Returns: A boolean, True if the address is a loopback address as defined in RFC 2373 2.5.3. r&)r))rWr r r rs zIPv6Address.is_loopbackcCs |jd?dkrdSt|jd@S)zReturn the IPv4 mapped address. Returns: If the IPv6 address is a v4 mapped address, return the IPv4 mapped address. Return None otherwise. riNl)r)r )rWr r r rs zIPv6Address.ipv4_mappedcCs4|jd?dkrdSt|jd?d@t|jd@fS)zTuple of embedded teredo IPs. Returns: Tuple of the (server, client) IPs or None if the address doesn't appear to be a teredo address (doesn't start with 2001::/32) `i N@l)r)r )rWr r r teredo s zIPv6Address.teredocCs$|jd?dkrdSt|jd?d@S)zReturn the IPv4 6to4 embedded address. Returns: The IPv4 6to4-embedded address if present or None if the address doesn't appear to contain a 6to4 embedded address. pi NPl)r)r )rWr r r sixtofours zIPv6Address.sixtofourN)r)r)rrrrrrrrsrrrrrrrrrrrrrrr r r r r bs $    r c@seZdZddZddZddZddZd d Zej Z e d d Z e d dZ e ddZ e ddZe ddZe ddZdS)rcCst|ttfr2tj||t|j|_|j|_ dSt|t rtj||dt |dkrht|d|_ n|j|_ t|dd|_|jj |_ |jj |_ dSt|}tj||dt|dd|_|jj |_ |jj |_ |jj |_ dS)Nrr&F)r)r5rrkr rrr)rr9rIrr#rrr%)rWrr$r r r r+s(        zIPv6Interface.__init__cCsd|j|j|jjfS)Nz%s/%d)r|r)rrb)rWr r r r}Cs zIPv6Interface.__str__c CsDtj||}| s|tkr|Sy |j|jkStk r>dSXdS)NF)r rwrRrrJ)rWrvrr r r rwGs  zIPv6Interface.__eq__c CsNtj||}|tkrtSy|j|jkp4|j|jko4|Stk rHdSXdS)NF)r rxrRrrJ)rWrvrr r r rxSs  zIPv6Interface.__lt__cCst|j|jt|jjfS)N)r~r)rIrkrrK)rWr r r r_szIPv6Interface.__hash__cCs t|jS)N)r r))rWr r r r.dszIPv6Interface.ipcCsd|j|j|jfS)Nz%s/%s)r|r)rI)rWr r r rhs zIPv6Interface.with_prefixlencCsd|j|j|jfS)Nz%s/%s)r|r)r)rWr r r rms zIPv6Interface.with_netmaskcCsd|j|j|jfS)Nz%s/%s)r|r)r)rWr r r rrs zIPv6Interface.with_hostmaskcCs|jdko|jjS)Nr)r)rr)rWr r r rwszIPv6Interface.is_unspecifiedcCs|jdko|jjS)Nr&)r)rr)rWr r r r{szIPv6Interface.is_loopbackN)rrrrr}rwrxrrUrqrsr.rrrrrr r r r r)s       rc@s2eZdZdZeZd ddZddZeddZ d S) ravThis class represents and manipulates 128-bit IPv6 networks. Attributes: [examples for IPv6('2001:db8::1000/124')] .network_address: IPv6Address('2001:db8::1000') .hostmask: IPv6Address('::f') .broadcast_address: IPv6Address('2001:db8::100f') .netmask: IPv6Address('ffff:ffff:ffff:ffff:ffff:ffff:ffff:fff0') .prefixlen: 124 TcCstj||t|ttfr&|}|j}n^t|trT|d}t|dkrL|dn|j}n0t|}|j |d}t|dkr~|dn|j}t ||_ |j |\|_ |_t|j }|t|j @|kr|rtd|nt |t|j @|_ |j|jdkr|j|_dS)aInstantiate a new IPv6 Network object. Args: address: A string or integer representing the IPv6 network or the IP and prefix/netmask. '2001:db8::/128' '2001:db8:0000:0000:0000:0000:0000:0000/128' '2001:db8::' are all functionally the same in IPv6. That is to say, failing to provide a subnetmask will create an object with a mask of /128. Additionally, an integer can be passed, so IPv6Network('2001:db8::') == IPv6Network(42540766411282592856903984951653826560) or, more generally IPv6Network(int(IPv6Network('2001:db8::'))) == IPv6Network('2001:db8::') strict: A boolean. If true, ensure that we have been passed A true network address, eg, 2001:db8::1000/124 and not an IP address on a network, eg, 2001:db8::1/124. Raises: AddressValueError: If address isn't a valid IPv6 address. NetmaskValueError: If the netmask isn't valid for an IPv6 address. ValueError: If strict was True and a network address was not supplied. rr&r z%s has host bits setN)rOrr5rkrr9rr#r%rmr rKrrrIrrr)rWrrr$rrrr r r rs(    zIPv6Network.__init__ccs@t|j}t|j}x&t|d|dD]}|j|Vq(WdS)zGenerate Iterator over usable hosts in a network. This is like __iter__ except it doesn't return the Subnet-Router anycast address. r&N)rkrKrDrr)rWrrrr r r rs  zIPv6Network.hostscCs|jjo|jjS)a`Test if the address is reserved for site-local. Note that the site-local address space has been deprecated by RFC 3879. Use is_private to test if this address is in the space of unique local addresses as defined by RFC 4193. Returns: A boolean, True if the address is reserved per RFC 3513 2.5.6. )rKrrD)rWr r r rs zIPv6Network.is_site_localN)T) rrrrr rrrrsrr r r r rs   > rc@seZdZedZedZededededededed ed ed edg Zed ed ededededgZededededededededededededededed gZed!Z d"S)#_IPv6Constantsz fe80::/10zff00::/8z::1/128z::/128z ::ffff:0:0/96z64:ff9b:1::/48z100::/64z 2001::/23z 2001:db8::/32z 2002::/16zfc00::/7z 2001:1::1/128z 2001:1::2/128z 2001:3::/32z2001:4:112::/48z 2001:20::/28z 2001:30::/28z::/8z100::/8z200::/7z400::/6z800::/5z1000::/4z4000::/3z6000::/3z8000::/3zA000::/3zC000::/3zE000::/4zF000::/5zF800::/6zFE00::/9z fec0::/10N) rrrrrrrrrrr r r r rs6          r)T)#r __version__rrrrrr rrrrrr%r/r3r<rFrNrTrUtotal_orderingr6rOrhr rrrrrr rrrr r r r  sX #716:EE Sa&HWj-token.cpython-36.opt-2.pyc000064400000006310152462730460011263 0ustar003 \ @sNddddgZdZdZdZdZdZd Zd Zd Zd Z d Z dZ dZ dZ dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Zd!Zd"Zd#Z d$Z!d%Z"d&Z#d'Z$d(Z%d)Z&d*Z'd+Z(d,Z)d-Z*d.Z+d/Z,d0Z-d1Z.d2Z/d3Z0d4Z1d5Z2d6Z3d7Z4d8Z5d9Z6d:Z7d;Z8dZ;d?d@e<j=DZ>ej?e>j@dAdZAdBdZBdCdZCdDdEZDeEdFkrJeDdGS)Htok_name ISTERMINAL ISNONTERMINALISEOF  !"#$%&'()*+,-./0123456789cCs,i|]$\}}t|tr|jd r||qS)_) isinstanceint startswith).0namevaluerG/usr/lib64/python3.6/token.py JsrIcCs|tkS)N) NT_OFFSET)xrGrGrHrOscCs|tkS)N)rJ)rKrGrGrHrRscCs|tkS)N) ENDMARKER)rKrGrGrHrUscJCspddl}ddl}|jdd}|r*|dp,d}d}t|dkrF|d}y t|}Wn@tk r}z$|jjdt||j dWYdd}~XnX||j j d}WdQRX|j d|j }i} x:|D]2} |j| } | r| jdd\} } t| } | | | <qWt| j}y t|}WnBtk rZ}z$|jjdt||j dWYdd}~XnX||j j d}WdQRXy|jd d}|jd }Wn,tk r|jjd |j d YnXg}x$|D]} |jd | | | fqW||||<yt|d}WnBtk rJ}z$|jjdt||j dWYdd}~XnX||jdj|WdQRXdS)NrrzInclude/token.hz Lib/token.pyzI/O error: %s  z:#define[ ][ ]*([A-Z0-9][A-Z0-9_]*)[ ][ ]*([0-9][0-9]*)rz#--start constants--z#--end constants--z&target does not contain format markersrz%s = %dwr )resysargvlenopenOSErrorstdoutwritestrexitreadsplitcompile IGNORECASEmatchgrouprBsortedkeysstderrindex ValueErrorappendjoin)rOrPargs inFileName outFileNamefperrlinesprogtokensliner]rEvalr`formatstartendrGrGrH_mainYsb          rs__main__N)F__all__rLNAMENUMBERSTRINGNEWLINEINDENTDEDENTLPARRPARLSQBRSQBCOLONCOMMASEMIPLUSMINUSSTARSLASHVBARAMPERLESSGREATEREQUALDOTPERCENTLBRACERBRACEEQEQUALNOTEQUAL LESSEQUAL GREATEREQUALTILDE CIRCUMFLEX LEFTSHIFT RIGHTSHIFT DOUBLESTAR PLUSEQUALMINEQUAL STAREQUAL SLASHEQUAL PERCENTEQUAL AMPEREQUAL VBAREQUALCIRCUMFLEXEQUALLEFTSHIFTEQUALRIGHTSHIFTEQUALDOUBLESTAREQUAL DOUBLESLASHDOUBLESLASHEQUALATATEQUALRARROWELLIPSISOPAWAITASYNC ERRORTOKENN_TOKENSrJglobalsitemsrextendvaluesrrrrs__name__rGrGrGrHs 5 codeop.cpython-36.opt-1.pyc000064400000014200152462730460011410 0ustar003 \j@sddZddlZddejDZdddgZdZd d Zd d ZdddZGdddZ GdddZ dS)a[Utilities to compile possibly incomplete Python source code. This module provides two interfaces, broadly similar to the builtin function compile(), which take program text, a filename and a 'mode' and: - Return code object if the command is complete and valid - Return None if the command is incomplete - Raise SyntaxError, ValueError or OverflowError if the command is a syntax error (OverflowError and ValueError can be produced by malformed literals). Approach: First, check if the source consists entirely of blank lines and comments; if so, replace it with 'pass', because the built-in parser doesn't always do the right thing for these. Compile three times: as is, with \n, and with \n\n appended. If it compiles as is, it's complete. If it compiles with one \n appended, we expect more. If it doesn't compile either way, we compare the error we get when compiling with \n or \n\n appended. If the errors are the same, the code is broken. But if the errors are different, we expect more. Not intuitive; not even guaranteed to hold in future releases; but this matches the compiler's behavior from Python 1.4 through 2.2, at least. Caveat: It is possible (but not likely) that the parser stops parsing with a successful outcome before reaching the end of the source; in this case, trailing symbols may be ignored instead of causing an error. For example, a backslash followed by two newlines may be followed by arbitrary garbage. This will be fixed once the API for the parser is better. The two interfaces are: compile_command(source, filename, symbol): Compiles a single command in the manner described above. CommandCompiler(): Instances of this class have __call__ methods identical in signature to compile_command; the difference is that if the instance compiles program text containing a __future__ statement, the instance 'remembers' and compiles all subsequent program texts with the statement in force. The module also provides another class: Compile(): Instances of this class act like the built-in function compile, but with 'memory' in the sense described above. NcCsg|]}tt|qS)getattr __future__).0Zfnamerr/usr/lib64/python3.6/codeop.py =srcompile_commandCompileCommandCompileric -Cs*x8|jdD]}|j}|r |ddkr Pq W|dkr:d}d}}}d}} } y||||}Wn"tk r}zWYdd}~XnXy||d||} Wn&tk r} z | }WYdd} ~ XnXy||d||} Wn&tk r} z | }WYdd} ~ XnX|r|S| r&t|t|kr&|dS)N r#evalpassz )splitstrip SyntaxErrorrepr) compilersourcefilenamesymbollineerrZerr1Zerr2codecode1code2errr_maybe_compileDs0  rcCst|||tS)N)compilePyCF_DONT_IMPLY_DEDENT)rrrrrr_compileesr singlecCstt|||S)asCompile a command and determine whether it is incomplete. Arguments: source -- the source string; may contain \n characters filename -- optional filename from which source was read; default "" symbol -- optional grammar start symbol; "single" (default) or "eval" Return value / exceptions raised: - Return a code object if the command is complete and valid - Return None if the command is incomplete - Raise SyntaxError, ValueError or OverflowError if the command is a syntax error (OverflowError and ValueError can be produced by malformed literals). )rr )rrrrrrrhsc@s eZdZdZddZddZdS)r zInstances of this class behave much like the built-in compile function, but if one is used to compile text containing a future statement, it "remembers" and compiles all subsequent program texts with the statement in force.cCs t|_dS)N)rflags)selfrrr__init__szCompile.__init__cCs@t||||jd}x(tD] }|j|j@r|j|jO_qW|S)N)rr# _featuresco_flagsZ compiler_flag)r$rrrZcodeobZfeaturerrr__call__s   zCompile.__call__N)__name__ __module__ __qualname____doc__r%r)rrrrr |sc@s"eZdZdZddZd ddZdS) r a(Instances of this class have __call__ methods identical in signature to compile_command; the difference is that if the instance compiles program text containing a __future__ statement, the instance 'remembers' and compiles all subsequent program texts with the statement in force.cCs t|_dS)N)r r)r$rrrr%szCommandCompiler.__init__r"cCst|j|||S)aCompile a command and determine whether it is incomplete. Arguments: source -- the source string; may contain \n characters filename -- optional filename from which source was read; default "" symbol -- optional grammar start symbol; "single" (default) or "eval" Return value / exceptions raised: - Return a code object if the command is complete and valid - Return None if the command is incomplete - Raise SyntaxError, ValueError or OverflowError if the command is a syntax error (OverflowError and ValueError can be produced by malformed literals). )rr)r$rrrrrrr)szCommandCompiler.__call__N)r.r")r*r+r,r-r%r)rrrrr s)r!r") r-rZall_feature_namesr'__all__rrr rr r rrrr9s  ! random.cpython-36.opt-1.pyc000064400000045604152462730460011433 0ustar003 \2k@sdZddlmZddlmZmZddl m Z m Z mZmZmZddl mZmZmZmZddlmZddlm Z!m"Z#ddl$m%Z&dd l'Z(dd l)Z*d d d d ddddddddddddddddddd d!gZ+d"e d2ed$Z,d$eZ-e d%Z.d&e d'Z/d(Z0d)e0 Z1dd l2Z2Gd*d d e2j3Z3Gd+d!d!e3Z4d,d-Z5d3d/d0Z6e3Z7e7j8Z8e7j9Z9e7j:Z:e7j;Z;e7jZ>e7j?Z?e7j@Z@e7jAZAe7jBZBe7jCZCe7jDZDe7jEZEe7jFZFe7jGZGe7jHZHe7jIZIe7jJZJe7jKZKe7jLZLe7jMZMeNd1kre6d S)4aRandom variable generators. integers -------- uniform within range sequences --------- pick random element pick random sample pick weighted random sample generate random permutation distributions on the real line: ------------------------------ uniform triangular normal (Gaussian) lognormal negative exponential gamma beta pareto Weibull distributions on the circle (angles 0 to 2pi) --------------------------------------------- circular uniform von Mises General notes on the underlying Mersenne Twister core generator: * The period is 2**19937-1. * It is one of the most extensively tested generators in existence. * The random() method is implemented in C, executes in a single Python step, and is, therefore, threadsafe. )warn) MethodTypeBuiltinMethodType)logexppieceil)sqrtacoscossin)urandom)SetSequence)sha512NRandomseedrandomuniformrandintchoicesample randrangeshuffle normalvariatelognormvariate expovariatevonmisesvariate gammavariate triangulargauss betavariate paretovariateweibullvariategetstatesetstate getrandbitschoices SystemRandomg?g@g@g?g@5cseZdZdZdZd;ddZd<fdd Zfd d Zfd d Zd dZ ddZ ddZ dde fddZ ddZe de>eeefddZddZd=ddZddZd>ddd d!d"Zd#d$Zd?d'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Z d7d8Z!d9d:Z"Z#S)@raRandom number generator base class used by bound module functions. Used to instantiate instances of Random to get generators that don't share state. Class Random can also be subclassed if you want to use a different basic generator of your own devising: in that case, override the following methods: random(), seed(), getstate(), and setstate(). Optionally, implement a getrandbits() method so that randrange() can cover arbitrarily large ranges. NcCs|j|d|_dS)zeInitialize an instance. Optional argument x controls seeding, as for Random.seed(). N)r gauss_next)selfxr1/usr/lib64/python3.6/random.py__init__Ws zRandom.__init__r,cs|dkrt|ttfrt|tr*|jdn|}|rBt|dd>nd}x"tt|D]}d||Ad@}qRW|t|N}|d krd n|}|dkrt|tttfrt|tr|j}|t |j 7}t j |d}t j|d |_d S) aInitialize internal state from hashable object. None or no argument seeds from current time or from an operating system specific randomness source if available. If *a* is an int, all bits are used. For version 2 (the default), all of the bits are used if *a* is a str, bytes, or bytearray. For version 1 (provided for reproducing random sequences from older versions of Python), the algorithm for str and bytes generates a narrower range of seeds. zlatin-1riCBlr,bigN) isinstancestrbytesdecodeordmaplen bytearrayencode_sha512Zdigestint from_bytessuperrr.)r/aversionr0c) __class__r1r2r`s    z Random.seedcs|jtj|jfS)z9Return internal state; can be passed to setstate() later.)VERSIONrEr%r.)r/)rIr1r2r%szRandom.getstatecs|d}|dkr*|\}}|_tj|nt|dkr|\}}|_ytdd|D}Wn(tk r|}z t|WYdd}~XnXtj|ntd||jfdS)z:Restore internal state from object returned by getstate().rr-r,css|]}|dVqdS)r, Nlr1).0r0r1r1r2 sz"Random.setstate..Nz?state with version %s passed to Random.setstate() of version %s)r.rEr&tuple ValueError TypeErrorrJ)r/staterGZ internalstater)rIr1r2r&s  zRandom.setstatecCs|jS)N)r%)r/r1r1r2 __getstate__szRandom.__getstate__cCs|j|dS)N)r&)r/rQr1r1r2 __setstate__szRandom.__setstate__cCs|jf|jfS)N)rIr%)r/r1r1r2 __reduce__szRandom.__reduce__r4c Cs||}||krtd|dkr:|dkr2|j|Std||}||krRtd||}|dkrx|dkrx||j|S|dkrtd|||f||}||krtd|dkr||d|} n"|dkr||d|} ntd | dkrtd|||j| S) zChoose a random item from range(start, stop[, step]). This fixes the problem with randint() which includes the endpoint; in Python this is usually not what you want. z!non-integer arg 1 for randrange()Nrzempty range for randrange()z non-integer stop for randrange()r4z'empty range for randrange() (%d,%d, %d)z non-integer step for randrange()zzero step for randrange())rO _randbelow) r/startstopstep_intZistartZistopwidthZistepnr1r1r2rs4  zRandom.randrangecCs|j||dS)zJReturn random integer in range [a, b], including both end points. r4)r)r/rFbr1r1r2rszRandom.randintc Cs|j}|j}|||ks$|||krN|j} || } x| |krH|| } q6W| S||krltd|||S|dkr|td||} || |} |} x| | kr|} qW|| ||S)zCReturn a random int in the range [0,n). Raises ValueError if n==0.zUnderlying random() generator does not supply enough bits to choose from a population range this large. To remove the range limitation, add a getrandbits() method.rzBoundary cannot be zero)rr' bit_length_warnrO) r/r[rCmaxsizetypeZMethodZ BuiltinMethodrr'krZremlimitr1r1r2rUs&     zRandom._randbelowc Cs:y|jt|}Wntk r0tddYnX||S)z2Choose a random element from a non-empty sequence.z$Cannot choose from an empty sequenceN)rUr?rO IndexError)r/seqir1r1r2rs z Random.choicecCs|dkrR|j}xttdt|D]*}||d}||||||<||<q"WnLt}xFttdt|D]0}|||d}||||||<||<qjWdS)zShuffle list x in place, and return None. Optional argument random is a 0-argument function returning a random float in [0.0, 1.0); if it is the default None, the standard random.random will be used. Nr4)rUreversedranger?rC)r/r0r randbelowrfjrYr1r1r2rs   zRandom.shufflec Cs(t|trt|}t|ts$td|j}t|}d|koD|knsRtddg|}d}|dkr|dtt |dd7}||krt |}xt |D]0}|||} || ||<|||d || <qWnRt } | j } xDt |D]8}||} x| | kr ||} qW| | || ||<qW|S) a=Chooses k unique random elements from a population sequence or set. Returns a new list containing elements from the population while leaving the original population unchanged. The resulting list is in selection order so that all sub-slices will also be valid random samples. This allows raffle winners (the sample) to be partitioned into grand prize and second place winners (the subslices). Members of the population need not be hashable or unique. If the population contains repeats, then each occurrence is a possible selection in the sample. To choose a sample in a range of integers, use range as an argument. This is especially fast and space efficient for sampling from a large population: sample(range(10000000), 60) z>Population must be a sequence or set. For dicts, use list(d).rz,Sample larger than population or is negativeNr*r-r4)r9_SetrN _SequencerPrUr?rO_ceil_loglistrhsetadd) r/ populationrarir[resultZsetsizeZpoolrfrjZselectedZ selected_addr1r1r2rs6       z Random.sample) cum_weightsracs|jdkrN|dkr>ttfddt|DSttj|n|dk r^tdttkrvtdt j dtdfddt|DS) zReturn a k sized list of population elements chosen with replacement. If the relative weights or cumulative weights are not specified, the selections are made with equal probability. Ncsg|]}qSr1r1)rLrf)rYrtrtotalr1r2 csz"Random.choices..z2Cannot specify both weights and cumulative weightsz3The number of weights does not match the populationr4cs$g|]}dqS)rr1)rLrf)bisectrvhirtrrwr1r2rxlsr7) rrCr?rhrq _itertools accumulaterPrO_bisectry)r/rtZweightsrvrar1)rYryrvrzrtrrwr2r(Ws  zRandom.choicescCs||||jS)zHGet a random number in the range [a, b) or [a, b] depending on rounding.)r)r/rFr\r1r1r2rsszRandom.uniform?c Csx|j}y |dkrdn||||}Wntk r<|SX||kr`d|}d|}||}}|||||dS)zTriangular distribution. Continuous distribution bounded by given lower and upper limits, and having a given mode value in-between. http://en.wikipedia.org/wiki/Triangular_distribution Ng?g?)rZeroDivisionError)r/ZlowZhighmodeurHr1r1r2r ys   zRandom.triangularcCsT|j}x@|}d|}t|d|}||d}|t| krPqW|||S)z\Normal distribution. mu is the mean, and sigma is the standard deviation. g?g?g@)r NV_MAGICCONSTrp)r/musigmaru1u2zZzzr1r1r2rs   zRandom.normalvariatecCst|j||S)zLog normal distribution. If you take the natural logarithm of this distribution, you'll get a normal distribution with mean mu and standard deviation sigma. mu can have any value, and sigma must be greater than zero. )_expr)r/rrr1r1r2rszRandom.lognormvariatecCstd|j |S)a^Exponential distribution. lambd is 1.0 divided by the desired mean. It should be nonzero. (The parameter would be called "lambda", but that is a reserved word in Python.) Returned values range from 0 to positive infinity if lambd is positive, and from negative infinity to 0 if lambd is negative. g?)rpr)r/Zlambdr1r1r2rszRandom.expovariatecCs|j}|dkrt|Sd|}|td||}xN|}tt|}|||}|} | d||ks~| d|t|kr6Pq6Wd|} | |d| |} |} | dkr|t| t} n|t| t} | S)aFCircular data distribution. mu is the mean angle, expressed in radians between 0 and 2*pi, and kappa is the concentration parameter, which must be greater than or equal to zero. If kappa is equal to zero, this distribution reduces to a uniform random angle over the range 0 to 2*pi. gư>g?g?)rTWOPI_sqrt_cos_pir_acos)r/rZkapparsrbrrdrqfZu3Zthetar1r1r2rs&   $zRandom.vonmisesvariatecCs|dks|dkrtd|j}|dkrtd|d}|t}||}x|}d|ko`dknshqHd|}t|d||} |t| } |||} ||| | } | td| dks| t| krH| |SqHWn|dkr|} x| dkr|} qWt|  |Sx|} t|t}|| }|dkrD|d|} nt||| } |}|dkr||| |dkrPn|t| krPqW| |SdS) aZGamma distribution. Not the gamma function! Conditions on the parameters are alpha > 0 and beta > 0. The probability distribution function is: x ** (alpha - 1) * math.exp(-x / beta) pdf(x) = -------------------------------------- math.gamma(alpha) * beta ** alpha gz*gammavariate: alpha and beta must be > 0.0g?g@gHz>gP?g@N)rOrrLOG4rpr SG_MAGICCONST_e)r/alphabetarZainvZbbbZcccrrvr0rrbrr\pr1r1r2rsJ          zRandom.gammavariatecCs`|j}|j}d|_|dkrT|t}tdtd|}t||}t|||_|||S)zGaussian distribution. mu is the mean, and sigma is the standard deviation. This is slightly faster than the normalvariate() function. Not thread-safe without a lock around calls. Ng@g?g)rr.rrrpr_sin)r/rrrrZx2piZg2radr1r1r2r!?s  z Random.gausscCs0|j|d}|dkrdS|||j|dSdS)zBeta distribution. Conditions on the parameters are alpha > 0 and beta > 0. Returned values range between 0 and 1. g?rgN)r)r/rryr1r1r2r"ts zRandom.betavariatecCsd|j}d|d|S)z3Pareto distribution. alpha is the shape parameter.g?)r)r/rrr1r1r2r#s zRandom.paretovariatecCs"d|j}|t| d|S)zfWeibull distribution. alpha is the scale parameter and beta is the shape parameter. g?)rrp)r/rrrr1r1r2r$s zRandom.weibullvariate)N)Nr,)N)N)r~rN)$__name__ __module__ __qualname____doc__rJr3rr%r&rRrSrTrCrrBPFr` _MethodType_BuiltinMethodTyperUrrrr(rr rrrrrr!r"r#r$ __classcell__r1r1)rIr2rGs8    ,  :  0H5 c@s8eZdZdZddZddZddZdd ZeZZ d S) r)zAlternate random number generator using sources provided by the operating system (such as /dev/urandom on Unix or CryptGenRandom on Windows). Not available on all systems (see os.urandom() for details). cCstjtddd?tS)z3Get the next random number in the range [0.0, 1.0).r5r6r-)rCrD_urandom RECIP_BPF)r/r1r1r2rszSystemRandom.randomcCsP|dkrtd|t|kr$td|dd}tjt|d}||d|?S)z:getrandbits(k) -> x. Generates an int with k random bits.rz(number of bits must be greater than zeroz#number of bits should be an integerr5r6)rOrCrPrDr)r/raZnumbytesr0r1r1r2r's  zSystemRandom.getrandbitscOsdS)z&sn     Y!  doctest.cpython-36.opt-1.pyc000064400000223122152462730460011611 0ustar003 \Ǘ!@stdZdZdddddddd d d d d ddddddddddddddddddd d!d"g!Zd#d$lZd#d$lZd#d$lZd#d$lZd#d$lZd#d$lZd#d$l Z d#d$l Z d#d$l Z d#d$l Z d#d$l Z d#d%lmZd#d&lmZed'd(ZiZd)dZedZedZedZedZedZedZeeBeBeBeBeBZed Zed Zed Zed ZedZ eeBeBeBe BZ!d*Z"d+Z#d,d-Z$dqd/d0Z%d1d2Z&drd4d5Z'd6d7Z(Gd8d9d9eZ)d:d;Z*dd?Z,Gd@dAdAe j-Z.dBdCZ/GdDddZ0GdEddZ1GdFddZ2GdGddZ3GdHddZ4GdIddZ5GdJdde6Z7GdKdde6Z8GdLdde4Z9d$a:dsdOdZ;dMd$d$d$d$dMd#d$dNe2d$f dPdZdSdZ?GdTdUdUe j@ZAGdVdWdWeAZBGdXdYdYe jCZDdudZdZEGd[d\d\eAZFdMd$d$e2d$fd]d^ZGd_dZHd`dZIdad ZJdvdbd!ZKdwdcddZLdxded"ZMGdfdgdgZNeNdhdidjdkdldmZOdndoZPeQdpkrpe jRePd$S)yaModule doctest -- a framework for running examples in docstrings. In simplest use, end each module M to be tested with: def _test(): import doctest doctest.testmod() if __name__ == "__main__": _test() Then running the module as a script will cause the examples in the docstrings to get executed and verified: python M.py This won't display anything unless an example fails, in which case the failing example(s) and the cause(s) of the failure(s) are printed to stdout (why not stderr? because stderr is a lame hack <0.2 wink>), and the final line of output is "Test failed.". Run it with the -v switch instead: python M.py -v and a detailed report of all examples tried is printed to stdout, along with assorted summaries at the end. You can force verbose mode by passing "verbose=True" to testmod, or prohibit it by passing "verbose=False". In either of those cases, sys.argv is not examined by testmod. There are a variety of other ways to run doctests, including integration with the unittest framework, and support for running non-Python text files containing doctests. There are also many ways to override parts of doctest's default behaviors. See the Library Reference Manual for details. zreStructuredText enregister_optionflagDONT_ACCEPT_TRUE_FOR_1DONT_ACCEPT_BLANKLINENORMALIZE_WHITESPACEELLIPSISSKIPIGNORE_EXCEPTION_DETAILCOMPARISON_FLAGS REPORT_UDIFF REPORT_CDIFF REPORT_NDIFFREPORT_ONLY_FIRST_FAILUREREPORTING_FLAGS FAIL_FASTExampleDocTest DocTestParser DocTestFinder DocTestRunner OutputCheckerDocTestFailureUnexpectedException DebugRunnertestmodtestfilerun_docstring_examples DocTestSuite DocFileSuiteset_unittest_reportflagsscript_from_examples testsource debug_srcdebugN)StringIO) namedtuple TestResultszfailed attemptedcCstj|dtt>S)N)OPTIONFLAGS_BY_NAME setdefaultlen)namer+/usr/lib64/python3.6/doctest.pyrsz z...cCs<d}x2tjD](}|j|d}|tt|kr ||jO}q W|S)z Return the compiler-flags associated with the future features that have been imported into the given namespace (globs). r"N) __future__Zall_feature_namesgetgetattrZ compiler_flag)globsflagsZfnameZfeaturer+r+r,_extract_future_flagss   r2cCsVtj|r|St|tr,t|ttdgS|dkrJtjtj |j dSt ddS)a Return the module specified by `module`. In particular: - If `module` is a module, then return module. - If `module` is a string, then import and return the module with that name. - If `module` is None, then return the calling module. The calling module is assumed to be the module of the stack frame at the given depth in the call stack. *N__name__z"Expected a module, string, or None) inspectismodule isinstancestr __import__globalslocalssysmodules _getframe f_globals TypeError)moduleZdepthr+r+r,_normalize_modules  rCc Cs|r\t|d}t||}t|dddk r\t|jdr\|jj|}|j|}|jtj d|fSt ||d}|j |fSQRXdS)N __loader__get_data )encoding) rC_module_relative_pathr/hasattrrErFdecodereplaceoslinesepopenread)filenamepackagemodule_relativerHZ file_contentsfr+r+r,_load_testfiles     rUcCstjd|d|S)z~ Add the given number of space characters to the beginning of every non-blank line in `s`, and return the result. z (?m)^(?!$) )resub)sindentr+r+r,_indentsr\cCs*t}|\}}}tj||||d|jS)zz Return a string containing a traceback message for the given exc_info tuple (as returned by sys.exc_info()). )file)r# tracebackprint_exceptiongetvalue)exc_infoZexcoutexc_typeZexc_valZexc_tbr+r+r,_exception_tracebacks rcc@seZdZddZdddZdS) _SpoofOutcCs&tj|}|r"|jd r"|d7}|S)NrG)r#r`endswith)selfresultr+r+r,r`s z_SpoofOut.getvalueNcCs|j|tj|dS)N)seekr#truncate)rfsizer+r+r,ris z_SpoofOut.truncate)N)r5 __module__ __qualname__r`rir+r+r+r,rds rdcCst|kr||kS|jt}dt|}}|d}|rR|j|rNt|}|d=ndS|d}|r|j|r||t|8}|d=ndS||krdSx2|D]*}|j|||}|dkrdS|t|7}qWdS)z_ Essentially the only subtle case: >>> _ellipsis_match('aa...aa', 'aaa') False r"Fr&Trm)ELLIPSIS_MARKERsplitr) startswithrefind)wantgotZwsstartposendposwr+r+r,_ellipsis_matchs0     rwcCs|j}|rd|SdSdS)z)Return a commented form of the given linez# #N)rstrip)liner+r+r, _comment_line9sr{cCshdt|}}|jd}|dkr$|}|jdd|}|dkr>|}|jdd|}|dkr\|d}|||S)Nr"rG:.r&)r)rqrfind)msgstartendir+r+r,_strip_exception_detailsAs  rc@s2eZdZdZddZd ddZddZd d ZdS) _OutputRedirectingPdbz A specialized version of the python debugger that redirects stdout to a given stream when interacting with the user. Stdout is *not* redirected when traced code is executed. cCs(||_d|_tjj||ddd|_dS)NFT)stdoutnosigintr&)_OutputRedirectingPdb__out$_OutputRedirectingPdb__debugger_usedpdbPdb__init__Z use_rawinput)rfoutr+r+r,rasz_OutputRedirectingPdb.__init__NcCs*d|_|dkrtjj}tjj||dS)NT)rr=r?f_backrr set_trace)rfframer+r+r,ris z_OutputRedirectingPdb.set_tracecCs|jrtjj|dS)N)rrr set_continue)rfr+r+r,rosz"_OutputRedirectingPdb.set_continuec Gs.tj}|jt_ztjj|f|S|t_XdS)N)r=rrrrtrace_dispatch)rfargs save_stdoutr+r+r,rus z$_OutputRedirectingPdb.trace_dispatch)N)r5rkrl__doc__rrrrr+r+r+r,r[s  rcCstj|std||jdr(tdtjj|jd}t |drXtjj|j d}n|j dkrt t jdkrt jddkrtjjt jdd}qtj}nFt |drx,|jD]"}tjj||}tjj|r|SqWtd |j tjj||S) NzExpected a module: %r/z1Module-relative files may not have absolute paths__file__r"__main____path__zBCan't resolve paths relative to the module %r (it has no __file__))r6r7rArp ValueErrorrMpathjoinrorJrr5r)r=argvcurdirrexists)rBZ test_pathZbasedirZ directoryZfullpathr+r+r,rIs&         rIc@s*eZdZdZd ddZddZdd ZdS) ran A single doctest example, consisting of source code and expected output. `Example` defines the following attributes: - source: A single Python statement, always ending with a newline. The constructor adds a newline if needed. - want: The expected output from running the source code (either from stdout, or a traceback in case of exception). `want` ends with a newline unless it's empty, in which case it's an empty string. The constructor adds a newline if needed. - exc_msg: The exception message generated by the example, if the example is expected to generate an exception; or `None` if it is not expected to generate an exception. This exception message is compared against the return value of `traceback.format_exception_only()`. `exc_msg` ends with a newline unless it's `None`. The constructor adds a newline if needed. - lineno: The line number within the DocTest string containing this Example where the Example begins. This line number is zero-based, with respect to the beginning of the DocTest. - indent: The example's indentation in the DocTest string. I.e., the number of space characters that precede the example's first prompt. - options: A dictionary mapping from option flags to True or False, which is used to override default options for this example. Any option flags not contained in this dictionary are left at their default value (as specified by the DocTestRunner's optionflags). By default, no options are set. Nr"cCsz|jds|d7}|r*|jd r*|d7}|dk rF|jd rF|d7}||_||_||_||_|dkrji}||_||_dS)NrG)resourcerrlinenor[optionsexc_msg)rfrrrrrr[rr+r+r,rs zExample.__init__cCs\t|t|k rtS|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkS)N)typeNotImplementedrrrrr[rr)rfotherr+r+r,__eq__s     zExample.__eq__cCst|j|j|j|j|jfS)N)hashrrrrr[r)rfr+r+r,__hash__szExample.__hash__)Nr"r"N)r5rkrlrrrrr+r+r+r,rs "  c@s8eZdZdZddZddZddZdd Zd d Zd S) rae A collection of doctest examples that should be run in a single namespace. Each `DocTest` defines the following attributes: - examples: the list of examples. - globs: The namespace (aka globals) that the examples should be run in. - name: A name identifying the DocTest (typically, the name of the object whose docstring this DocTest was extracted from). - filename: The name of the file that this DocTest was extracted from, or `None` if the filename is unknown. - lineno: The line number within filename where this DocTest begins, or `None` if the line number is unavailable. This line number is zero-based, with respect to the beginning of the file. - docstring: The string that the examples were extracted from, or `None` if the string is unavailable. cCs,||_||_|j|_||_||_||_dS)z Create a new DocTest containing the given examples. The DocTest's globals are initialized with a copy of `globs`. N)examples docstringcopyr0r*rQr)rfrr0r*rQrrr+r+r,r s  zDocTest.__init__cCsRt|jdkrd}n"t|jdkr(d}ndt|j}d|jj|j|j|j|fS)Nr"z no examplesr&z 1 examplez %d examplesz<%s %s from %s:%s (%s)>)r)r __class__r5r*rQr)rfrr+r+r,__repr__szDocTest.__repr__cCs\t|t|k rtS|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkoZ|j|jkS)N)rrrrr0r*rQr)rfrr+r+r,r#s     zDocTest.__eq__cCst|j|j|j|jfS)N)rrr*rQr)rfr+r+r,r.szDocTest.__hash__cCs:t|tstS|j|j|jt|f|j|j|jt|fkS)N)r8rrr*rQrid)rfrr+r+r,__lt__2s zDocTest.__lt__N) r5rkrlrrrrrrr+r+r+r,rs   c@seZdZdZejdejejBZejdejejBej BZ ejdj Z dddZ dd Zdd d Zd d ZejdejZddZejdejZddZddZddZdS)rzD A class used to parse strings containing doctest examples. a # Source consists of a PS1 line followed by zero or more PS2 lines. (?P (?:^(?P [ ]*) >>> .*) # PS1 line (?:\n [ ]* \.\.\. .*)*) # PS2 lines \n? # Want consists of any non-blank lines that do not start with PS1. (?P (?:(?![ ]*$) # Not a blank line (?![ ]*>>>) # Not a line starting with PS1 .+$\n? # But any other line )*) a # Grab the traceback header. Different versions of Python have # said different things on the first traceback line. ^(?P Traceback\ \( (?: most\ recent\ call\ last | innermost\ last ) \) : ) \s* $ # toss trailing whitespace on the header. (?P .*?) # don't blink: absorb stuff until... ^ (?P \w+ .*) # a line *starts* with alphanum. z ^[ ]*(#.*)?$c s|j}|j|dkr8djfdd|jdD}g}d\}}x|jj|D]}|j|||j||jd||j7}|j |||\}}} } |j |s|jt || | |t |j d|d||jd|j|j7}|j}qRW|j||d|S) a= Divide the given string into examples and intervening text, and return them as a list of alternating Examples and strings. Line numbers for the Examples are 0-based. The optional argument `name` is a name identifying this string, and is only used for error messages. r"rGcsg|]}|dqS)Nr+).0l) min_indentr+r, ysz'DocTestParser.parse..r[)rr[rN)r"r") expandtabs _min_indentrro _EXAMPLE_REfinditerappendrcount_parse_example_IS_BLANK_OR_COMMENTrr)groupr) rfstringr*outputZcharnormrrrrrr+)rr,parsems&     zDocTestParser.parsecCst|j|||||||S)a" Extract all doctest examples from the given string, and collect them into a `DocTest` object. `globs`, `name`, `filename`, and `lineno` are attributes for the new `DocTest` object. See the documentation for `DocTest` for more information. )r get_examples)rfrr0r*rQrr+r+r, get_doctests zDocTestParser.get_doctestcCsdd|j||DS)a Extract all doctest examples from the given string, and return them as a list of `Example` objects. Line numbers are 0-based, because it's most common in doctests that nothing interesting appears on the same line as opening triple-quote, and so the first interesting line is called "line 1" then. The optional argument `name` is a name identifying this string, and is only used for error messages. cSsg|]}t|tr|qSr+)r8r)rxr+r+r,rsz.DocTestParser.get_examples..)r)rfrr*r+r+r,rs zDocTestParser.get_examplesc s t|jd|jdjd}|j||||j|dddd||djfdd |D}|jd }|jd}t|dkrtjd |dr|d=|j|d||t|djfd d |D}|jj|}|r|jd }nd}|j |||} || ||fS)a Given a regular expression match from `_EXAMPLE_RE` (`m`), return a pair `(source, want)`, where `source` is the matched example's source code (with prompts and indentation stripped); and `want` is the example's expected output (with indentation stripped). `name` is the string's name, and `lineno` is the line number where the example starts; both are used for error messages. r[rrGr&NrWr}csg|]}|ddqS)rVNr+)rZsl)r[r+r,rsz0DocTestParser._parse_example..rrz *$csg|]}|dqS)Nr+)rZwl)r[r+r,rsrrmrm) r)rro_check_prompt_blank _check_prefixrrXmatch _EXCEPTION_RE _find_options) rfrr*r source_linesrrr want_linesrrr+)r[r,rs$      zDocTestParser._parse_examplez#\s*doctest:\s*([^\n\'"]*)$c Csi}x|jj|D]z}|jdjddj}x^|D]V}|ddksR|ddtkrhtd|d||ft|dd}|ddk||<q2WqW|r|j|rtd |||f|S) a Return a dictionary containing option overrides extracted from option directives in the given source string. `name` is the string's name, and `lineno` is the line number where the example starts; both are used for error messages. r&,rWr"z+-Nz7line %r of the doctest for %s has an invalid option: %r+zSline %r of the doctest for %s has an option directive on a line with no example: %r)_OPTION_DIRECTIVE_RErrrLror'rr) rfrr*rrrZoption_stringsoptionflagr+r+r,rs  zDocTestParser._find_optionsz ^([ ]*)(?=\S)cCs2dd|jj|D}t|dkr*t|SdSdS)z;Return the minimum indentation of any non-blank line in `s`cSsg|] }t|qSr+)r))rr[r+r+r,rsz-DocTestParser._min_indent..r"N) _INDENT_REfindallr)min)rfrZindentsr+r+r,rs zDocTestParser._min_indentc Csbx\t|D]P\}}t||dkr ||ddkr td||d||||d|fq WdS)a  Given the lines of a source string (including prompts and leading indentation), check to make sure that every prompt is followed by a space character. If any line is not followed by a space character, then raise ValueError. rVrDrWz8line %r of the docstring for %s lacks blank after %s: %rr&N) enumerater)r)rflinesr[r*rrrzr+r+r,r s   z!DocTestParser._check_prompt_blankcCsDx>t|D]2\}}|r |j| r td||d||fq WdS)z Check that every line in the given list starts with the given prefix; if any line does not, then raise a ValueError. zGline %r of the docstring for %s has inconsistent leading whitespace: %rr&N)rrpr)rfrprefixr*rrrzr+r+r,rszDocTestParser._check_prefixN)r)r)r5rkrlrrXcompile MULTILINEVERBOSErDOTALLrrrrrrrrrrrrrr+r+r+r,r=s"     ' 3c@sNeZdZdZdeddfddZdddZd d Zd d Zd dZ ddZ dS)ra< A class used to extract the DocTests that are relevant to a given object, from its docstring and the docstrings of its contained objects. Doctests can currently be extracted from the following object types: modules, functions, classes, methods, staticmethods, classmethods, and properties. FTcCs||_||_||_||_dS)at Create a new doctest finder. The optional argument `parser` specifies a class or function that should be used to create new DocTest objects (or objects that implement the same interface as DocTest). The signature for this factory function should match the signature of the DocTest constructor. If the optional argument `recurse` is false, then `find` will only examine the given object, and not any contained objects. If the optional argument `exclude_empty` is false, then `find` will include tests for objects with empty docstrings. N)_parser_verbose_recurse_exclude_empty)rfverboseparserrecurse exclude_emptyr+r+r,r1szDocTestFinder.__init__Nc CsP|dkr.t|dd}|dkr.tdt|f|dkrr)r/rrr6 getmoduleZ getsourcefilerAZgetfile linecachegetlines__dict__rupdate_findsort) rfobjr*rBr0 extraglobsr]rtestsr+r+r,rqGsJ$          zDocTestFinder.findcCs|dkr dStj|dk r(|tj|kStj|r>|j|jkStj|r|t|dr\|jj}nt|drn|j}ndS|j |kStj |r|j |jkSt|dr|j |jkSt |t rdSt ddS)zY Return true if the given object is defined in the given module. NT __objclass__rkz"object must be a class or function)r6r isfunctionr __globals__ZismethoddescriptorrJrrkr5isclassr8propertyr)rfrBobjectZobj_modr+r+r, _from_modules(            zDocTestFinder._from_modulec Cs(|jrtd|t||kr"dSd|t|<|j|||||}|dk rR|j|tj|r|jrx^|jj D]P\} } d|| f} tj tj | stj | rn|j || rn|j|| | ||||qnWtj|o|jrtxt|dij D]\} } t| ts tdt| ftj | p8tj | p8tj| p8t| tsNtdt| fd|| f} |j|| | ||||qWtj |r$|jr$x|jj D]\} } t| trt|| } t| trt|| j} tj | stj | st| tr|j || rd|| f} |j|| | ||||qWdS) zm Find tests for the given object and any contained objects, and add them to `tests`. zFinding tests in %sNr&z%s.%s__test__z5DocTestFinder.find: __test__ keys must be strings: %rz`DocTestFinder.find: __test__ values must be strings, functions, methods, classes, or modules: %rz%s.__test__.%s)rprintr _get_testrr6r7rritemsZ isroutineZunwraprrrr/r8r9rr staticmethod classmethod__func__r) rfrrr*rBrr0seentestZvalnamevalr+r+r,rsP                 zDocTestFinder._findc Cst|tr|}nJy,|jdkr"d}n|j}t|ts:t|}Wnttfk rXd}YnX|j||}|jrv| rvdS|dkrd}n*t|d|j}|dddkr|dd}|j j |||||S) zs Return a DocTest for the given object, if it defines a docstring; otherwise, return None. NrrrVz.pycr&rm) r8r9rrAAttributeError _find_linenorr/r5rr) rfrr*rBr0rrrrQr+r+r,rs(         zDocTestFinder._get_testcCsd}tj|rd}tj|rd|dkr(dStjdt|dd}x$t|D]\}}|j|rH|}PqHWtj|rt|j }tj |r|j }tj |r|j }tj|r|j}tj|rt|ddd}|dk r |dkr|dStjd}x(t|t|D]}|j||r|SqWdS) z Return a line number of the given object's docstring. Note: this method assumes that the object has a docstring. Nr"z^\s*class\s*%s\br5-co_firstlinenor&z(^|.*:)\s*\w*("|\'))r6r7rrXrr/rrZismethodrr__code__Z istracebacktb_frameZisframef_codeZiscoderanger))rfrrrZpatrrzr+r+r,r-s<          zDocTestFinder._find_lineno)NNNN) r5rkrlrrrrqrrrrr+r+r+r,r(s f?%c@seZdZdZddZd ddZdd Zd d Zd d ZddZ ddZ ddZ ddZ e jdZd!ddZd"ddZd#ddZddZdS)$ra3 A class used to run DocTest test cases, and accumulate statistics. The `run` method is used to process a single DocTest case. It returns a tuple `(f, t)`, where `t` is the number of test cases tried, and `f` is the number of test cases that failed. >>> tests = DocTestFinder().find(_TestClass) >>> runner = DocTestRunner(verbose=False) >>> tests.sort(key = lambda test: test.name) >>> for test in tests: ... print(test.name, '->', runner.run(test)) _TestClass -> TestResults(failed=0, attempted=2) _TestClass.__init__ -> TestResults(failed=0, attempted=2) _TestClass.get -> TestResults(failed=0, attempted=2) _TestClass.square -> TestResults(failed=0, attempted=1) The `summarize` method prints a summary of all the test cases that have been run by the runner, and returns an aggregated `(f, t)` tuple: >>> runner.summarize(verbose=1) 4 items passed all tests: 2 tests in _TestClass 2 tests in _TestClass.__init__ 2 tests in _TestClass.get 1 tests in _TestClass.square 7 tests in 4 items. 7 passed and 0 failed. Test passed. TestResults(failed=0, attempted=7) The aggregated number of tried examples and failed examples is also available via the `tries` and `failures` attributes: >>> runner.tries 7 >>> runner.failures 0 The comparison between expected outputs and actual outputs is done by an `OutputChecker`. This comparison may be customized with a number of option flags; see the documentation for `testmod` for more information. If the option flags are insufficient, then the comparison may also be customized by passing a subclass of `OutputChecker` to the constructor. The test runner's display output can be controlled in two ways. First, an output function (`out) can be passed to `TestRunner.run`; this function will be called with strings that should be displayed. It defaults to `sys.stdout.write`. If capturing the output is not sufficient, then the display output can be also customized by subclassing DocTestRunner, and overriding the methods `report_start`, `report_success`, `report_unexpected_exception`, and `report_failure`. r4FNr"cCsN|pt|_|dkrdtjk}||_||_||_d|_d|_i|_ t |_ dS)ac Create a new test runner. Optional keyword arg `checker` is the `OutputChecker` that should be used to compare the expected outputs and actual outputs of doctest examples. Optional keyword arg 'verbose' prints lots of stuff if true, only failures if false; by default, it's true iff '-v' is in sys.argv. Optional argument `optionflags` can be used to control how the test runner compares expected output to actual output, and how it displays failures. See the documentation for `testmod` for more information. Nz-vr") r_checkerr=rr optionflagsoriginal_optionflagstriesfailures_name2ftrd_fakeout)rfcheckerrr r+r+r,rs  zDocTestRunner.__init__cCsH|jrD|jr.|dt|jdt|jn|dt|jddS)z Report that the test runner is about to process the given example. (Only displays a message if verbose=True) zTrying: z Expecting: zExpecting nothing N)rrrr\r)rfrrexampler+r+r, report_starts  zDocTestRunner.report_startcCs|jr|ddS)zt Report that the given example ran successfully. (Only displays a message if verbose=True) zok N)r)rfrrrrsr+r+r,report_successszDocTestRunner.report_successcCs&||j|||jj|||jdS)z7 Report that the given example failed. N)_failure_headerr output_differencer )rfrrrrsr+r+r,report_failures zDocTestRunner.report_failurecCs$||j||dtt|dS)zO Report that the given example raised an unexpected exception. zException raised: N)rr\rc)rfrrrrar+r+r,report_unexpected_exceptionsz)DocTestRunner.report_unexpected_exceptioncCs|jg}|jrR|jdk r4|jdk r4|j|jd}nd}|jd|j||jfn|jd|jd|jf|jd|j}|jt|dj|S)Nr&?zFile "%s", line %s, in %szLine %s, in %szFailed example:rG)DIVIDERrQrrr*rr\r)rfrrrrrr+r+r,rs zDocTestRunner._failure_headercCsd}}|j}td\}}} |jj} xFt|jD]6\} } |jt@oL|dk} ||_| jrx:| jjD],\}}|r|j|O_qf|j|M_qfW|jt @rq2|d7}| s|j ||| d|j | f}y,t t | j|d|d|j|jjd}Wn4tk rYntj}|jjYnX|jj}|jjd|}|dkrh| | j||jr|}n|tj|ddd}| s|t|7}| jdkr| }nB| | j||jr|}n*|jt@r| t| jt||jr|}||kr| sZ|j||| |nT||kr0| s&|j ||| ||d7}n*|| krZ| sP|j!||| ||d7}n|r2|jt"@r2Pq2W||_|j#|||t$||S) a Run the examples in `test`. Write the outcome of each example with one of the `DocTestRunner.report_*` methods, using the writer function `out`. `compileflags` is the set of compiler flags that should be used to execute examples. Return a tuple `(f, t)`, where `t` is the number of examples tried, and `f` is the number of examples that failed. The examples are run in the namespace `test.globs`. r"rDr&zZsingleNr3rm)%r r r  check_outputrrr rrrrr*execrrr0debuggerrKeyboardInterruptr=rarr`rirrr^format_exception_onlyrcrrrrrrr_DocTestRunner__record_outcomer%)rfr compileflagsrrrr SUCCESSFAILUREZBOOMZcheck examplenumrquietZ optionflagrrQZ exceptionrsZoutcomerr+r+r,Z__runs                   zDocTestRunner.__runcCsL|jj|jd\}}||||f|j|j<|j|7_|j|7_dS)z{ Record the fact that the given DocTest (`test`) generated `f` failures out of `t` tried examples. r"N)r"r")rr.r*rr)rfrrTtf2t2r+r+r,Z__record_outcomeuszDocTestRunner.__record_outcomez..+)\[(?P\d+)\]>$cCsV|jj|}|rF|jd|jjkrF|jjt|jd}|jjddS|j ||SdS)Nr*r%T)keepends) %_DocTestRunner__LINECACHE_FILENAME_RErrrr*rintr splitlinessave_linecache_getlines)rfrQmodule_globalsrrr+r+r,Z__patched_linecache_getliness  z*DocTestRunner.__patched_linecache_getlinesTc s||_|dkrt|j}tj|dkrVjdks@jdkrHj}nfdd}|jt_tj }t j }t |_ |j j|j j t _ tj|_|jt_tj}tjt_z|j|||St_|t _ tj||jt_|t_|r|jjddl}d|_XdS)aJ Run the examples in `test`, and display the results using the writer function `out`. The examples are run in the namespace `test.globs`. If `clear_globs` is true (the default), then this namespace will be cleared after the test runs, to help with garbage collection. If you would like to examine the namespace after the test completes, then use `clear_globs=False`. `compileflags` gives the set of flags that should be used by the Python compiler when running the examples. If not specified, then it will default to the set of future-import flags that apply to `globs`. The output of each example is checked using `DocTestRunner.check_output`, and the results are formatted by the `DocTestRunner.report_*` methods. Nzutf-8cs t|jd}j|dS)Nbackslashreplace)r9encodewrite)rZ)rHrr+r,rszDocTestRunner.run..outr")rr2r0r=rrHlowerr2rgettracerrrrresetrrr.*_DocTestRunner__patched_linecache_getlines displayhook__displayhook___DocTestRunner__runsettraceclearbuiltins_) rfrr"r clear_globsZ save_traceZsave_set_traceZsave_displayhookr<r+)rHrr,runs<      zDocTestRunner.runc Cs|dkr|j}g}g}g}d}}xd|jjD]V}|\}\} } || 7}|| 7}| dkrb|j|q.| dkrz|j|| fq.|j|q.W|r|rtt|d|jx|D]} td| qW|rtt|d|jx |D]\} } td| | fqW|rJt|jtt|d|jx(|D] \} \} } td| | | fq&W|rvt|d t|jd t||d |d |rtd |dn|rtdt||S)a Print a summary of all the test cases that have been run by this DocTestRunner, and return a tuple `(f, t)`, where `f` is the total number of failed examples, and `t` is the total number of tried examples. The optional `verbose` argument controls how detailed the summary is. If the verbosity is not specified, then the DocTestRunner's verbosity is used. Nr"zitems had no tests:z zitems passed all tests:z %3d tests in %szitems had failures:z %3d of %3d in %sztests inzitems.z passed andzfailed.z***Test Failed***z failures.z Test passed.) rrrrrr)rrr%) rfrZnotestsZpassedZfailedZtotaltZtotalfrr*rTr'thingrr+r+r, summarizesP     zDocTestRunner.summarizecCsV|j}xJ|jjD]<\}\}}||krB||\}}||}||}||f||<qWdS)N)rr)rfrdr*rTr'r(r)r+r+r,merge s zDocTestRunner.merge)NNr")N)NNT)N)r5rkrlrrrrrrrrr9r!rXrr+r6r?rArCr+r+r+r,ras7 $ }   I 9c@s0eZdZdZddZddZddZdd Zd S) ra_ A class used to check the whether the actual output from a doctest example matches the expected output. `OutputChecker` defines two methods: `check_output`, which compares a given pair of outputs, and returns true if they match; and `output_difference`, which returns a string describing the differences between two outputs. cCst|jdddS)z= Convert string to hex-escaped ASCII string. ASCIIr0)r9r1)rfrZr+r+r,_toAscii!szOutputChecker._toAsciicCs|j|}|j|}||kr dS|t@sH||fd kr8dS||fd krHdS|t@stjdtjtd|}tjdd|}||krdS|t@rd j|j }d j|j }||krdS|t @rt ||rdSd S) a Return True iff the actual output from an example (`got`) matches the expected output (`want`). These strings are always considered to match if they are identical; but depending on what option flags the test runner is using, several non-exact match types are also possible. See the documentation for `TestRunner` for more information about option flags. TTrue 1 False 0 z (?m)^%s\s*?$rz (?m)^\s*?$rWF)rFrG)rHrI) rErrrXrYescapeBLANKLINE_MARKERrrrorrw)rfrrrsr r+r+r,r's0     zOutputChecker.check_outputcCs<|ttBtB@sdS|t@r dS|jddko:|jddkS)NFTrGr3)r r r r)rfrrrsr r+r+r,_do_a_fancy_difffs zOutputChecker._do_a_fancy_diffc Cs8|j}|t@stjdt|}|j|||r|jdd}|jdd}|t@rptj ||dd}t |dd}d}nZ|t @rtj ||dd}t |dd}d}n,|t @rtjtjd } t | j||}d }nd d |D}d |tdj|S|o|r dt|t|fS|rdt|S|r0dt|SdSdS)z Return a string describing the differences between the expected output for a given example (`example`) and the actual output (`got`). `optionflags` is the set of option flags used to compare `want` and `got`. z(?m)^[ ]*(?= )T)r*r3)nNz#unified diff with -expected +actualz-context diff with expected followed by actual)Zcharjunkzndiff with -expected +actualcSsg|]}|jdqS)rG)ry)rrzr+r+r,rsz3OutputChecker.output_difference..zDifferences (%s): rzExpected: %sGot: %szExpected: %sGot nothing zExpected nothing Got: %szExpected nothing Got nothing )rrrrXrYrKrLr-r difflibZ unified_difflistr Z context_diffr ZDifferZIS_CHARACTER_JUNKZcomparer\r) rfrrsr rrrZ got_linesZdiffZkindZenginer+r+r,r}s6     zOutputChecker.output_differenceN)r5rkrlrrErrLrr+r+r+r,rs ?c@s eZdZdZddZddZdS)rzA DocTest example has failed in debugging mode. The exception instance has variables: - test: the DocTest object being run - example: the Example object that failed - got: the actual output cCs||_||_||_dS)N)rrrs)rfrrrsr+r+r,rszDocTestFailure.__init__cCs t|jS)N)r9r)rfr+r+r,__str__szDocTestFailure.__str__N)r5rkrlrrrPr+r+r+r,rs c@s eZdZdZddZddZdS)rzA DocTest example has encountered an unexpected exception The exception instance has variables: - test: the DocTest object being run - example: the Example object that failed - exc_info: the exception info cCs||_||_||_dS)N)rrra)rfrrrar+r+r,rszUnexpectedException.__init__cCs t|jS)N)r9r)rfr+r+r,rPszUnexpectedException.__str__N)r5rkrlrrrPr+r+r+r,rs c@s*eZdZdZd ddZddZdd ZdS) ra Run doc tests but raise an exception as soon as there is a failure. If an unexpected exception occurs, an UnexpectedException is raised. It contains the test, the example, and the original exception: >>> runner = DebugRunner(verbose=False) >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42', ... {}, 'foo', 'foo.py', 0) >>> try: ... runner.run(test) ... except UnexpectedException as f: ... failure = f >>> failure.test is test True >>> failure.example.want '42\n' >>> exc_info = failure.exc_info >>> raise exc_info[1] # Already has the traceback Traceback (most recent call last): ... KeyError We wrap the original exception to give the calling application access to the test and example information. If the output doesn't match, then a DocTestFailure is raised: >>> test = DocTestParser().get_doctest(''' ... >>> x = 1 ... >>> x ... 2 ... ''', {}, 'foo', 'foo.py', 0) >>> try: ... runner.run(test) ... except DocTestFailure as f: ... failure = f DocTestFailure objects provide access to the test: >>> failure.test is test True As well as to the example: >>> failure.example.want '2\n' and the actual output: >>> failure.got '1\n' If a failure or error occurs, the globals are left intact: >>> del test.globs['__builtins__'] >>> test.globs {'x': 1} >>> test = DocTestParser().get_doctest(''' ... >>> x = 2 ... >>> raise KeyError ... ''', {}, 'foo', 'foo.py', 0) >>> runner.run(test) Traceback (most recent call last): ... doctest.UnexpectedException: >>> del test.globs['__builtins__'] >>> test.globs {'x': 2} But the globals are cleared if there is no error: >>> test = DocTestParser().get_doctest(''' ... >>> x = 2 ... ''', {}, 'foo', 'foo.py', 0) >>> runner.run(test) TestResults(failed=0, attempted=1) >>> test.globs {} NTcCs$tj||||d}|r |jj|S)NF)rr?r0r;)rfrr"rr>rr+r+r,r?.s zDebugRunner.runcCst|||dS)N)r)rfrrrrar+r+r,r4sz'DebugRunner.report_unexpected_exceptioncCst|||dS)N)r)rfrrrrsr+r+r,r7szDebugRunner.report_failure)NNT)r5rkrlrr?rrr+r+r+r,rsY TFc Cs|dkrtjjd}tj|s,td|f|dkr:|j}t|d} |rVt||d} n t ||d} x$| j ||||dD]} | j | qvW|r| j t dkr| a n t j| t| j| jS)a* m=None, name=None, globs=None, verbose=None, report=True, optionflags=0, extraglobs=None, raise_on_error=False, exclude_empty=False Test examples in docstrings in functions and classes reachable from module m (or the current module if m is not supplied), starting with m.__doc__. Also test examples reachable from dict m.__test__ if it exists and is not None. m.__test__ maps names to functions, classes and strings; function and class docstrings are tested even if the name is private; strings are tested directly, as if they were docstrings. Return (#failures, #tests). See help(doctest) for an overview. Optional keyword arg "name" gives the name of the module; by default use m.__name__. Optional keyword arg "globs" gives a dict to be used as the globals when executing examples; by default, use m.__dict__. A copy of this dict is actually used for each docstring, so that each docstring's examples start with a clean slate. Optional keyword arg "extraglobs" gives a dictionary that should be merged into the globals that are used to execute examples. By default, no extra globals are used. This is new in 2.4. Optional keyword arg "verbose" prints lots of stuff if true, prints only failures if false; by default, it's true iff "-v" is in sys.argv. Optional keyword arg "report" prints a summary at the end when true, else prints nothing at the end. In verbose mode, the summary is detailed, else very brief (in fact, empty if all tests passed). Optional keyword arg "optionflags" or's together module constants, and defaults to 0. This is new in 2.3. Possible values (see the docs for details): DONT_ACCEPT_TRUE_FOR_1 DONT_ACCEPT_BLANKLINE NORMALIZE_WHITESPACE ELLIPSIS SKIP IGNORE_EXCEPTION_DETAIL REPORT_UDIFF REPORT_CDIFF REPORT_NDIFF REPORT_ONLY_FIRST_FAILURE Optional keyword arg "raise_on_error" raises an exception on the first unexpected exception or failure. This allows failures to be post-mortem debugged. Advanced tomfoolery: testmod runs methods of a local instance of class doctest.Tester, then merges the results into (or creates) global Tester instance doctest.master. Methods of doctest.master can be called directly too, if you want to do something unusual. Passing report=0 to testmod is especially useful then, to delay displaying a summary. Invoke doctest.master.summarize(verbose) when you're done fiddling. Nrztestmod: module required; %r)r)rr )r0r)r=r>r.r6r7rAr5rrrrqr?rAmasterrCr%rr) rr*r0rreportr rraise_on_errorrfinderrunnerrr+r+r,rCs$E     c Cs|r| rtdt|||| p d\} }|dkr>> import doctest >>> old = doctest._unittest_reportflags >>> doctest.set_unittest_reportflags(REPORT_NDIFF | ... REPORT_ONLY_FIRST_FAILURE) == old True >>> doctest._unittest_reportflags == (REPORT_NDIFF | ... REPORT_ONLY_FIRST_FAILURE) True Only reporting flags can be set: >>> doctest.set_unittest_reportflags(ELLIPSIS) Traceback (most recent call last): ... ValueError: ('Only reporting flags allowed', 8) >>> doctest.set_unittest_reportflags(old) == (REPORT_NDIFF | ... REPORT_ONLY_FIRST_FAILURE) True zOnly reporting flags allowed)r r_unittest_reportflags)r1oldr+r+r,rCs   c@sjeZdZdddZddZddZd d Zd d Zd dZddZ ddZ ddZ ddZ e Z ddZdS) DocTestCaser"NcCs.tjj|||_||_||_||_||_dS)N)unittestTestCaser_dt_optionflags _dt_checker_dt_test _dt_setUp _dt_tearDown)rfrr setUptearDownrr+r+r,ris  zDocTestCase.__init__cCs|j}|jdk r|j|dS)N)rarb)rfrr+r+r,rdss zDocTestCase.setUpcCs(|j}|jdk r|j||jjdS)N)rarcr0r;)rfrr+r+r,reys  zDocTestCase.tearDownc Cs|j}tj}t}|j}|t@s(|tO}t||jdd}z$dd|_ |j ||j dd\}}Wd|t_X|r~|j |j |jdS)NF)r rrrr )rr>)rar=rr#r_r rZrr`rr?r2ZfailureExceptionformat_failurer`)rfrr[newr rVrrr+r+r,runTests  zDocTestCase.runTestcCsP|j}|jdkrd}n d|j}dj|jjddd}d|j|j|||fS)Nzunknown line numberz%sr}r&z:Failed doctest test for %s File "%s", line %s, in %s %srm)rarrr*rorQ)rferrrrZlnamer+r+r,rfs  zDocTestCase.format_failurecCs6|jt|j|jdd}|j|jdd|jdS)aRun the test case without results and without catching exceptions The unit test framework includes a debug method on test cases and test suites to support post-mortem debugging. The test code is run in such a way that errors are not caught. This way a caller can catch the errors and initiate post-mortem debugging. The DocTestCase provides a debug method that raises UnexpectedException errors if there is an unexpected exception: >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42', ... {}, 'foo', 'foo.py', 0) >>> case = DocTestCase(test) >>> try: ... case.debug() ... except UnexpectedException as f: ... failure = f The UnexpectedException contains the test, the example, and the original exception: >>> failure.test is test True >>> failure.example.want '42\n' >>> exc_info = failure.exc_info >>> raise exc_info[1] # Already has the traceback Traceback (most recent call last): ... KeyError If the output doesn't match, then a DocTestFailure is raised: >>> test = DocTestParser().get_doctest(''' ... >>> x = 1 ... >>> x ... 2 ... ''', {}, 'foo', 'foo.py', 0) >>> case = DocTestCase(test) >>> try: ... case.debug() ... except DocTestFailure as f: ... failure = f DocTestFailure objects provide access to the test: >>> failure.test is test True As well as to the example: >>> failure.example.want '2\n' and the actual output: >>> failure.got '1\n' F)r rr)r>N)rdrr_r`r?rare)rfrVr+r+r,r!s B zDocTestCase.debugcCs|jjS)N)rar*)rfr+r+r,rszDocTestCase.idcCsPt|t|k rtS|j|jkoN|j|jkoN|j|jkoN|j|jkoN|j|jkS)N)rrrar_rbrcr`)rfrr+r+r,rs    zDocTestCase.__eq__cCst|j|j|j|jfS)N)rr_rbrcr`)rfr+r+r,rszDocTestCase.__hash__cCs,|jjjd}d|ddj|ddfS)Nr}z%s (%s)r&rmrm)rar*ror)rfr*r+r+r,rszDocTestCase.__repr__cCs d|jjS)Nz Doctest: )rar*)rfr+r+r,shortDescription szDocTestCase.shortDescription)r"NNN)r5rkrlrrdrerhrfr!rrrrrPrjr+r+r+r,r\gs  H r\c@s0eZdZddZddZddZddZeZd S) SkipDocTestCasecCs||_tj|ddS)N)rBr\r)rfrBr+r+r,r szSkipDocTestCase.__init__cCs|jddS)Nz-DocTestSuite will not work with -O2 and above)ZskipTest)rfr+r+r,rd szSkipDocTestCase.setUpcCsdS)Nr+)rfr+r+r, test_skip szSkipDocTestCase.test_skipcCs d|jjS)NzSkipping tests from %s)rBr5)rfr+r+r,rj sz SkipDocTestCase.shortDescriptionN)r5rkrlrrdrlrjrPr+r+r+r,rk s rkc@seZdZddZdS) _DocTestSuitecCsdS)Nr+)rfindexr+r+r,_removeTestAtIndex sz _DocTestSuite._removeTestAtIndexN)r5rkrlror+r+r+r,rm srmc Ks|dkrt}t|}|j|||d}| rPtjjdkrPt}|jt||S|j t}x\|D]T}t |j dkrxqd|j s|j }|dddkr|dd }||_ |jt|f|qdW|S) a Convert doctest tests for a module to a unittest test suite. This converts each documentation string in a module that contains doctest tests to a unittest test case. If any of the tests in a doc string fail, then the test case fails. An exception is raised showing the name of the file containing the test and a (sometimes approximate) line number. The `module` argument provides the module to be tested. The argument can be either a module or a module name. If no argument is given, the calling module is used. A number of options may be provided as keyword arguments: setUp A set-up function. This is called before running the tests in each file. The setUp function will be passed a DocTest object. The setUp function can access the test globals as the globs attribute of the test passed. tearDown A tear-down function. This is called after running the tests in each file. The tearDown function will be passed a DocTest object. The tearDown function can access the test globals as the globs attribute of the test passed. globs A dictionary containing initial global variables for the tests. optionflags A set of doctest option flags expressed as an integer. N)r0rr3r"rVz.pycr&rrm)rrCrqr=r1optimizermaddTestrkrr)rrQrr\) rBr0rZ test_finderrrsuiterrQr+r+r,r s(%  c@s(eZdZddZddZeZddZdS) DocFileCasecCsdj|jjjdS)Nr=r})rrar*ro)rfr+r+r,r` szDocFileCase.idcCs|jjS)N)rarQ)rfr+r+r,rc szDocFileCase.__repr__cCsd|jj|jj|fS)Nz2Failed doctest test for %s File "%s", line 0 %s)rar*rQ)rfrir+r+r,rfg szDocFileCase.format_failureN)r5rkrlrrrPrfr+r+r+r,rs^ srsc Ksx|dkri}n|j}|r(| r(tdt||||p6d\}}d|krN||d<tjj|}|j||||d} t| f|S)Nz8Package may only be specified for module-relative paths.zutf-8rr")rrrUrMrrWrrs) rrSrRr0rrHrdocr*rr+r+r, DocFileTestl s  rucOsHt}|jddr$t|jd|d<x|D]}|jt|f|q*W|S)aA unittest suite for one or more doctest files. The path to each doctest file is given as a string; the interpretation of that string depends on the keyword argument "module_relative". A number of options may be provided as keyword arguments: module_relative If "module_relative" is True, then the given file paths are interpreted as os-independent module-relative paths. By default, these paths are relative to the calling module's directory; but if the "package" argument is specified, then they are relative to that package. To ensure os-independence, "filename" should use "/" characters to separate path segments, and may not be an absolute path (i.e., it may not begin with "/"). If "module_relative" is False, then the given file paths are interpreted as os-specific paths. These paths may be absolute or relative (to the current working directory). package A Python package or the name of a Python package whose directory should be used as the base directory for module relative paths. If "package" is not specified, then the calling module's directory is used as the base directory for module relative filenames. It is an error to specify "package" if "module_relative" is False. setUp A set-up function. This is called before running the tests in each file. The setUp function will be passed a DocTest object. The setUp function can access the test globals as the globs attribute of the test passed. tearDown A tear-down function. This is called after running the tests in each file. The tearDown function will be passed a DocTest object. The tearDown function can access the test globals as the globs attribute of the test passed. globs A dictionary containing initial global variables for the tests. optionflags A set of doctest option flags expressed as an integer. parser A DocTestParser (or subclass) that should be used to extract tests from the files. encoding An encoding that will be used to convert the files to unicode. rSTrR)rmr.rCrqru)pathskwrrrr+r+r,r s 8  cCsg}xtj|D]x}t|trj|j|jdd |j}|r|jd|dd|jddd D7}q|dd|jddd D7}qWx|r|d dkr|jqWx|r|d dkr|jd qWdj |dS)awExtract script from text with examples. Converts text with examples to a Python script. Example input is converted to regular code. Example output and all other words are converted to comments: >>> text = ''' ... Here are examples of simple math. ... ... Python has super accurate integer addition ... ... >>> 2 + 2 ... 5 ... ... And very friendly error messages: ... ... >>> 1/0 ... To Infinity ... And ... Beyond ... ... You can use logic if you want: ... ... >>> if 0: ... ... blah ... ... blah ... ... ... ... Ho hum ... ''' >>> print(script_from_examples(text)) # Here are examples of simple math. # # Python has super accurate integer addition # 2 + 2 # Expected: ## 5 # # And very friendly error messages: # 1/0 # Expected: ## To Infinity ## And ## Beyond # # You can use logic if you want: # if 0: blah blah # # Ho hum Nr&z # Expected:cSsg|] }d|qS)z## r+)rrr+r+r,r sz(script_from_examples..rGcSsg|] }t|qSr+)r{)rrr+r+r,r srxr"rmrmrmrm) rrr8rrrrrropopr)rZrZpiecerrr+r+r,r s:  " csJt|}tj|}fdd|D}|s4td|d}t|j}|S)aExtract the test sources from a doctest docstring as a script. Provide the module (or dotted name of the module) containing the test to be debugged and the name (within the module) of the object with the doc string with tests to be debugged. csg|]}|jkr|qSr+)r*)rr')r*r+r,r* sztestsource..znot found in testsr")rCrrqrrr)rBr*rrtestsrcr+)r*r,r! s   cCst|}t|||dS)z4Debug a single doctest docstring, in argument `src`'N)r debug_script)srcpmr0ryr+r+r,r 1 sc Csddl}|r|j}ni}|rvyt|||Wqttjd|jdd}|j|jdtjdYqXn|jddj d|||dS)z7Debug a test script. `src` is the script, as a string.r"Nr&T)rr3zexec(%r)) rrrrr=rarr5Z interactionr?)r{r|r0rpr+r+r,rz6 s  rzcCs$t|}t||}t|||jdS)zDebug a single doctest docstring. Provide the module (or dotted name of the module) containing the test to be debugged and the name (within the module) of the object with the docstring with tests to be debugged. N)rCrrzr)rBr*r|ryr+r+r,r!J s c@s(eZdZdZddZddZddZdS) _TestClassz A pointless class, for sanity-checking of docstring testing. Methods: square() get() >>> _TestClass(13).get() + _TestClass(-12).get() 1 >>> hex(_TestClass(13).square().get()) '0xa9' cCs ||_dS)zval -> _TestClass object with associated value val. >>> t = _TestClass(123) >>> print(t.get()) 123 N)r)rfrr+r+r,rf sz_TestClass.__init__cCs|jd|_|S)zosquare() -> square TestClass's associated value >>> _TestClass(13).square().get() 169 r3)r)rfr+r+r,squarep s z_TestClass.squarecCs|jS)z~get() -> return TestClass's associated value. >>> x = _TestClass(-42) >>> print(x.get()) -42 )r)rfr+r+r,r.z sz_TestClass.getN)r5rkrlrrrr.r+r+r+r,r~X s   r~z Example of a string object, searched as-is. >>> x = 1; y = 2 >>> x + y, x * y (3, 2) a In 2.2, boolean expressions displayed 0 or 1. By default, we still accept them. This can be disabled by passing DONT_ACCEPT_TRUE_FOR_1 to the new optionflags argument. >>> 4 == 4 1 >>> 4 == 4 True >>> 4 > 4 0 >>> 4 > 4 False z Blank lines can be marked with : >>> print('foo\n\nbar\n') foo bar z If the ellipsis flag is used, then '...' can be used to elide substrings in the desired output: >>> print(list(range(1000))) #doctest: +ELLIPSIS [0, 1, 2, ..., 999] a If the whitespace normalization flag is used, then differences in whitespace are ignored. >>> print(list(range(30))) #doctest: +NORMALIZE_WHITESPACE [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29] )r~rzbool-int equivalencez blank linesZellipsiszwhitespace normalizationc Cs tjdd}|jdddddd|jd d d tjgd d |jddddd|jdddd|j}|j}|j}d}x|jD]}|t|O}q|W|j r|t O}x||D]t}|j drt j j|\}}tj jd|t|dd}tj d=t|||d\} } nt|d||d\} } | rdSqWdS)Nzdoctest runner)Z descriptionz-vz --verbose store_trueFz'print very verbose output for all tests)actiondefaulthelpz-oz--optionrzqspecify a doctest option flag to apply to the test run; may be specified more than once to apply multiple options)rchoicesrrz-fz --fail-fastzystop running tests after first failure (this is a shorthand for -o FAIL_FAST, and is in addition to any other -o options))rrr]rz file containing the tests to run)nargsrr"z.pyrD)rr )rSrr r&)argparseArgumentParser add_argumentr'keys parse_argsr]rrZ fail_fastrrerMrror=insertr:rr) rrZ testfilesrrrrQdirnamerrr=r+r+r,_test s<       rr)r3)rV) NNNNTr"NFF)FrYNr")NNNN)FN)FN)F)SrZ __docformat____all__r-rrNr6rrMrrXr=r^r]ior# collectionsr$r%r'rrrrrrrrr r r r rr rKrnr2rCrUr\rcrdrwr{rrrrIrrrrrr ExceptionrrrrRrrrrZrr^r\rkZ TestSuitermrrsrurrrr rzr!r~rrr5exitr+r+r+r,.s      1%.DKl;;n f x $! @ IR   ,  + glob.cpython-36.opt-1.pyc000064400000010140152462730460011061 0ustar003 \@sdZddlZddlZddlZdddgZddddZddd dZd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZejdZejdZddZddZd d!Zd"dZdS)#zFilename globbing utility.NglobiglobescapeF) recursivecCstt||dS)ayReturn a list of paths matching a pathname pattern. The pattern may contain simple shell-style wildcards a la fnmatch. However, unlike fnmatch, filenames starting with a dot are special cases that are not matched by '*' and '?' patterns. If recursive is true, the pattern '**' will match any files and zero or more directories and subdirectories. )r)listr)pathnamerr/usr/lib64/python3.6/glob.pyr s cCs$t||d}|r t|r t|}|S)aReturn an iterator which yields the paths matching a pathname pattern. The pattern may contain simple shell-style wildcards a la fnmatch. However, unlike fnmatch, filenames starting with a dot are special cases that are not matched by '*' and '?' patterns. If recursive is true, the pattern '**' will match any files and zero or more directories and subdirectories. F)_iglob _isrecursivenext)rritsrrr rs  ccstjj|\}}t|sF|r0tjj|rB|Vntjj|rB|VdS|s|rjt|rjt|||EdHnt|||EdHdS||krt|rt ||d}n|g}t|r|rt|rt}qt}nt }x2|D]*}x$||||D]}tjj ||VqWqWdS)NT) ospathsplit has_magiclexistsisdirr _glob2_glob1r _glob0join)rrdironlydirnamebasenamedirsZ glob_in_dirnamerrr r 's0     r cCs0tt||}t|s$dd|D}tj||S)Ncss|]}t|s|VqdS)N) _ishidden).0xrrr Rsz_glob1..)r_iterdirrfnmatchfilter)rpatternrnamesrrr rOsrcCs8|stjj|r4|gSntjjtjj||r4|gSgS)N)rrrrr)rrrrrr rUs  rcCs t||dS)NF)r)rr%rrr glob0bsr'cCs t||dS)NF)r)rr%rrr glob1esr(ccs"|ddVt||EdHdS)Nr) _rlistdir)rr%rrrr rksrccs|s"t|trttjd}ntj}yXtj|D}x<|D]4}y| sJ|jrR|jVWq6tk rhYq6Xq6WWdQRXWntk rdSXdS)NASCII) isinstancebytesrcurdirscandiris_dirrOSError)rrr entryrrr r"rs    r"ccshtt||}xT|D]L}t|s|V|r8tjj||n|}x"t||D]}tjj||VqHWqWdS)N)rr"rrrrr))rrr&r ryrrr r)s r)z([*?[])s([*?[])cCs(t|trtj|}n tj|}|dk S)N)r+r,magic_check_bytessearch magic_check)rmatchrrr rs   rcCs |ddkS)Nr...)r7r9r)rrrr rsrcCst|tr|dkS|dkSdS)Ns**z**)r+r,)r%rrr r s r cCs<tjj|\}}t|tr(tjd|}n tjd|}||S)z#Escape all special characters. s[\1]z[\1])rr splitdriver+r,r3subr5)rZdriverrr rs   )__doc__rrer#__all__rrr rrr'r(rr"r)compiler5r3rrr rrrrr s(  (   symtable.cpython-36.opt-1.pyc000064400000024123152462730460011764 0ustar003 \m @sNdZddlZddlmZmZmZmZmZmZmZm Z m Z m Z m Z m Z mZmZddlZdddddgZd dZGd d d ZeZGd ddeZGd ddeZGdddeZGdddeZedkrJddlZddlZeejdZej Z!WdQRXee!ej"j#ejdddZ$x0e$j%D]$Z&e$j'e&Z(e)e(e(j*e(j+q"WdS)z2Interface to the compiler's internal symbol tablesN)USE DEF_GLOBAL DEF_LOCAL DEF_PARAM DEF_IMPORT DEF_BOUND DEF_ANNOT SCOPE_OFF SCOPE_MASKFREELOCALGLOBAL_IMPLICITGLOBAL_EXPLICITCELLsymtable SymbolTableClassFunctionSymbolcCstj|||}t||S)N) _symtabler_newSymbolTable)codefilenameZ compile_typetopr /usr/lib64/python3.6/symtable.pyr sc@s$eZdZddZddZddZdS)SymbolTableFactorycCstj|_dS)N)weakrefWeakValueDictionary_SymbolTableFactory__memo)selfrrr__init__szSymbolTableFactory.__init__cCs6|jtjkrt||S|jtjkr,t||St||S)N)typer TYPE_FUNCTIONr TYPE_CLASSrr)r tablerrrrnews     zSymbolTableFactory.newcCs8||f}|jj|d}|dkr4|j||}|j|<|S)N)rgetr&)r r%rkeyobjrrr__call__s zSymbolTableFactory.__call__N)__name__ __module__ __qualname__r!r&r*rrrrrsrc@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdS) rcCs||_||_i|_dS)N)_table _filename_symbols)r Z raw_tablerrrrr!'szSymbolTable.__init__cCsN|jtkrd}n d|jj}|jjdkr6dj||jSdj||jj|jSdS)Nz%s globalz<{0}SymbolTable for module {1}>z<{0}SymbolTable for {1} in {2}>) __class__rr+r.nameformatr/)r Zkindrrr__repr__,s   zSymbolTable.__repr__cCs:|jjtjkrdS|jjtjkr$dS|jjtjkr6dSdS)NmoduleZfunctionclass)r.r"rZ TYPE_MODULEr#r$)r rrrget_type9szSymbolTable.get_typecCs|jjS)N)r.id)r rrrget_idCszSymbolTable.get_idcCs|jjS)N)r.r4)r rrrget_nameFszSymbolTable.get_namecCs|jjS)N)r.lineno)r rrr get_linenoIszSymbolTable.get_linenocCst|jjtjkS)N)boolr.r"rr#)r rrr is_optimizedLszSymbolTable.is_optimizedcCs t|jjS)N)r?r.nested)r rrr is_nestedOszSymbolTable.is_nestedcCs t|jjS)N)r?r.children)r rrr has_childrenRszSymbolTable.has_childrencCsdS)z7Return true if the scope uses exec. Deprecated method.Fr)r rrrhas_execUszSymbolTable.has_execcCs |jjjS)N)r.symbolskeys)r rrrget_identifiersYszSymbolTable.get_identifierscCsD|jj|}|dkr@|jj|}|j|}t|||}|j|<|S)N)r0r'r.rF_SymbolTable__check_childrenr)r r4Zsymflags namespacesrrrlookup\s    zSymbolTable.lookupcsfddjDS)Ncsg|]}j|qSr)rL).0ident)r rr esz+SymbolTable.get_symbols..)rH)r r)r r get_symbolsdszSymbolTable.get_symbolscsfddjjDS)Ncs"g|]}|jkrt|jqSr)r4rr/)rMst)r4r rrrOhsz0SymbolTable.__check_children..)r.rC)r r4r)r4r rZ__check_childrengs zSymbolTable.__check_childrencsfddjjDS)Ncsg|]}t|jqSr)rr/)rMrQ)r rrrOmsz,SymbolTable.get_children..)r.rC)r r)r r get_childrenls zSymbolTable.get_childrenN)r+r,r-r!r6r9r;r<r>r@rBrDrErHrLrPrIrRrrrrr%s  c@sDeZdZdZdZdZdZddZddZddZ dd Z d d Z dS) rNcstfddjDS)Ncs g|]}jj|r|qSr)r.rF)rMrN)r test_funcrrrOzsz.Function.__idents_matching..)tuplerH)r rSr)r rSrZ__idents_matchingyszFunction.__idents_matchingcCs |jdkr|jdd|_|jS)NcSs|t@S)N)r)xrrrsz)Function.get_parameters..)_Function__params_Function__idents_matching)r rrrget_parameters}s zFunction.get_parameterscs0|jdkr*ttffdd}|j||_|jS)Ncs|t?t@kS)N)r r )rU)locsrrrVsz%Function.get_locals..)_Function__localsr rrX)r testr)rZr get_localss    zFunction.get_localscs0|jdkr*ttffdd}|j||_|jS)Ncs|t?t@kS)N)r r )rU)globrrrVsz&Function.get_globals..)_Function__globalsr rrX)r r\r)r^r get_globalss    zFunction.get_globalscCs$|jdkrdd}|j||_|jS)NcSs|t?t@tkS)N)r r r )rUrrrrVsz$Function.get_frees..)_Function__freesrX)r is_freerrr get_freess  zFunction.get_frees) r+r,r-rWr[rar_rXrYr]r`rcrrrrrqsc@seZdZdZddZdS)rNcCs:|jdkr4i}x|jjD]}d||j<qWt||_|jS)N)_Class__methodsr.rCr4rT)r drQrrr get_methodss   zClass.get_methods)r+r,r-rergrrrrrsc@seZdZd ddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZddZddZdS)!rNcCs(||_||_|t?t@|_|p f|_dS)N) _Symbol__name_Symbol__flagsr r _Symbol__scope_Symbol__namespaces)r r4rJrKrrrr!szSymbol.__init__cCs dj|jS)Nz)r5rh)r rrrr6szSymbol.__repr__cCs|jS)N)rh)r rrrr<szSymbol.get_namecCst|jtj@S)N)r?rirr)r rrr is_referencedszSymbol.is_referencedcCst|jt@S)N)r?rir)r rrr is_parameterszSymbol.is_parametercCst|jttfkS)N)r?rjr r)r rrr is_globalszSymbol.is_globalcCst|jtkS)N)r?rjr)r rrris_declared_globalszSymbol.is_declared_globalcCst|jt@S)N)r?rir)r rrris_localszSymbol.is_localcCst|jt@S)N)r?rir)r rrr is_annotatedszSymbol.is_annotatedcCst|jtkS)N)r?rjr )r rrrrbszSymbol.is_freecCst|jt@S)N)r?rir)r rrr is_importedszSymbol.is_importedcCst|jt@S)N)r?rir)r rrr is_assignedszSymbol.is_assignedcCs t|jS)aReturns true if name binding introduces new namespace. If the name is used as the target of a function or class statement, this will be true. Note that a single name can be bound to multiple objects. If is_namespace() is true, the name may also be bound to other objects, like an int or list, that does not introduce a new namespace. )r?rk)r rrr is_namespaces zSymbol.is_namespacecCs|jS)z.Return a list of namespaces bound to this name)rk)r rrrget_namespacesszSymbol.get_namespacescCs t|jdkrtd|jdS)zReturns the single namespace bound to this name. Raises ValueError if the name is bound to multiple namespaces. rdz$name is bound to multiple namespacesr)lenrk ValueError)r rrr get_namespaceszSymbol.get_namespace)N)r+r,r-r!r6r<rlrmrnrorprqrbrrrsrtrurxrrrrrs  __main__rdexec),__doc__rrrrrrrrr r r r r rrr__all__rrrobjectrrrrr+ossysopenargvfreadsrcpathsplitmodrHrNrLinfoprintrprtrrrrs&@L& C  argparse.cpython-36.opt-1.pyc000064400000165232152462730460011757 0ustar003 \a@s0dZdZdddddddd d d d d dddddgZddlZddlZddlZddl Z ddl Z ddl ZddlmZmZdZdZdZdZdZdZdZGdddeZdd ZGd!ddeZGd"ddeZGd#d d eZGd$ddeZGd%d d eZ d&d'Z!Gd(dde"Z#Gd)dde"Z$Gd*d d eZ%Gd+d,d,e%Z&Gd-d.d.e%Z'Gd/d0d0e'Z(Gd1d2d2e'Z)Gd3d4d4e%Z*Gd5d6d6e%Z+Gd7d8d8e%Z,Gd9d:d:e%Z-Gd;d<dd>e%Z/Gd?ddeZ0Gd@d d eZ1GdAdBdBeZ2GdCdDdDe2Z3GdEdFdFe3Z4GdGddee2Z5dS)Ha Command-line parsing library This module is an optparse-inspired command-line parsing library that: - handles both optional and positional arguments - produces highly informative usage messages - supports parsers that dispatch to sub-parsers The following is a simple usage example that sums integers from the command-line and writes the result to a file:: parser = argparse.ArgumentParser( description='sum the integers at the command line') parser.add_argument( 'integers', metavar='int', nargs='+', type=int, help='an integer to be summed') parser.add_argument( '--log', default=sys.stdout, type=argparse.FileType('w'), help='the file where the sum should be written') args = parser.parse_args() args.log.write('%s' % sum(args.integers)) args.log.close() The module contains the following public classes: - ArgumentParser -- The main entry point for command-line parsing. As the example above shows, the add_argument() method is used to populate the parser with actions for optional and positional arguments. Then the parse_args() method is invoked to convert the args at the command-line into an object with attributes. - ArgumentError -- The exception raised by ArgumentParser objects when there are errors with the parser's actions. Errors raised while parsing the command-line are caught by ArgumentParser and emitted as command-line messages. - FileType -- A factory for defining types of files to be created. As the example above shows, instances of FileType are typically passed as the type= argument of add_argument() calls. - Action -- The base class for parser actions. Typically actions are selected by passing strings like 'store_true' or 'append_const' to the action= argument of add_argument(). However, for greater customization of ArgumentParser actions, subclasses of Action may be defined and passed as the action= argument. - HelpFormatter, RawDescriptionHelpFormatter, RawTextHelpFormatter, ArgumentDefaultsHelpFormatter -- Formatter classes which may be passed as the formatter_class= argument to the ArgumentParser constructor. HelpFormatter is the default, RawDescriptionHelpFormatter and RawTextHelpFormatter tell the parser not to change the formatting for help text, and ArgumentDefaultsHelpFormatter adds information about argument defaults to the help. All other classes in this module are considered implementation details. (Also note that HelpFormatter and RawDescriptionHelpFormatter are only considered public as object names -- the API of the formatter objects is still considered an implementation detail.) z1.1ArgumentParser ArgumentErrorArgumentTypeErrorFileType HelpFormatterArgumentDefaultsHelpFormatterRawDescriptionHelpFormatterRawTextHelpFormatterMetavarTypeHelpFormatter NamespaceAction ONE_OR_MOREOPTIONALPARSER REMAINDERSUPPRESS ZERO_OR_MOREN)gettextngettextz ==SUPPRESS==?*+zA...z...Z_unrecognized_argsc@s(eZdZdZddZddZddZdS) _AttributeHolderaAbstract base class that provides __repr__. The __repr__ method returns a string in the format:: ClassName(attr=name, attr=name, ...) The attributes are determined either by a class-level attribute, '_kwarg_names', or by inspecting the instance __dict__. cCst|j}g}i}x|jD]}|jt|qWx8|jD],\}}|jr`|jd||fq<|||<qsz6HelpFormatter._Section.format_help..z%*s%s:  ) rTrSrQ _join_partsr+rRrUrrB)r!r Z item_helpZcurrent_indentrUr&r&r' format_helps    z"HelpFormatter._Section.format_help)N)rr,r-rOr]r&r&r&r'rEs rEcCs|jjj||fdS)N)rGr+r)r!rWrXr&r&r' _add_itemszHelpFormatter._add_itemcCs0|j|j||j|}|j|jg||_dS)N)rQrErGr^r])r!rUZsectionr&r&r' start_sectionszHelpFormatter.start_sectioncCs|jj|_|jdS)N)rGrTrR)r!r&r&r' end_sections zHelpFormatter.end_sectioncCs$|tk r |dk r |j|j|gdS)N)rr^ _format_text)r!textr&r&r'add_textszHelpFormatter.add_textcCs&|tk r"||||f}|j|j|dS)N)rr^ _format_usage)r!usageactionsgroupsprefixrXr&r&r' add_usages zHelpFormatter.add_usagecCsz|jtk rv|j}||g}x |j|D]}|j||q&Wtdd|D}||j}t|j||_|j|j |gdS)NcSsg|] }t|qSr&)len)rVsr&r&r'rY sz.HelpFormatter.add_argument..) helpr_format_action_invocation_iter_indented_subactionsrr@rBrDr^_format_action)r!actionZget_invocationZ invocations subactionZinvocation_lengthZ action_lengthr&r&r' add_arguments   zHelpFormatter.add_argumentcCsx|D]}|j|qWdS)N)rr)r!rfrpr&r&r' add_argumentss zHelpFormatter.add_argumentscCs.|jj}|r*|jjd|}|jdd}|S)Nz r[)rFr]rLsubstrip)r!rlr&r&r'r]s  zHelpFormatter.format_helpcCsdjdd|DS)NrZcSsg|]}|r|tk r|qSr&)r)rVpartr&r&r'rY!sz-HelpFormatter._join_parts..)r )r!Z part_stringsr&r&r'r\ s zHelpFormatter._join_partscs|dkrtd}|dk r,|t|jd}n|dkrN| rNdt|jd}n|dkrdt|jd}g}g}x(|D] }|jr|j|qv|j|qvW|j} | |||} djdd|| gD}|j|jt |t |krd} | ||} | ||} t j | | }t j | | }dfdd }t |t |d krdt |t |d }|r||g|||}|j |||n |r||g|||}n|g}nZdt |}||}|||}t |d krg}|j ||||j ||||g|}d j|}d ||fS)Nzusage: )rMz%(prog)s cSsg|] }|r|qSr&r&)rVrkr&r&r'rYAsz/HelpFormatter._format_usage..z%\(.*?\)+(?=\s|$)|\[.*?\]+(?=\s|$)|\S+csg}g}|dk rt|d}n t|d}xb|D]Z}|dt|krp|rp|j|dj|g}t|d}|j||t|d7}q0W|r|j|dj||dk r|dt|d|d<|S)NrPrwr)rjrr )partsindentrhlineslineZline_lenrv) text_widthr&r' get_linesUs"    z.HelpFormatter._format_usage..get_linesg?rPr[z%s%s )N) _dictr<option_stringsr_format_actions_usager rArBrjrHfindallextend)r!rerfrgrhrMZ optionals positionalsrpformatZ action_usageZ part_regexpZ opt_usageZ pos_usageZ opt_partsZ pos_partsr}ryrzrxr&)r|r'rd%sV            zHelpFormatter._format_usagec Cst}i}x|D]}y|j|jd}Wntk r>wYqX|t|j}||||jkrx|jD]}|j|qhW|js||kr||d7<nd||<d||<n*||kr||d7<nd||<d||<xt|d|D] } d || <qWqWg} x2t|D]$\} }|j t krj| j d|j | d krF|j | n"|j | dd kr.|j | dn|js|j|} |j|| } ||kr| ddkr| ddkr| dd} | j | nh|jd} |jdkrd | } n"|j|} |j|| }d | |f} |j r$||kr$d | } | j | q Wx(t|d dD]} || g| | | <qBWdjdd| D}d}d}tjd|d|}tjd|d|}tjd||fd|}tjdd|}|j}|S)Nrz [[]z (()rP|z%sz%s %sz[%s]T)reverserwcSsg|]}|dk r|qS)Nr&)rVitemr&r&r'rYsz7HelpFormatter._format_actions_usage..z[\[(]z[\])]z(%s) z\1z (%s)z%s *%srZz \(([^|]*)\)r)setindex_group_actionsr;rjaddrequiredrange enumeraterlrrgetpopr#_get_default_metavar_for_positional _format_argsnargs!_get_default_metavar_for_optionalr)r rHrtru)r!rfrg group_actionsZinsertsgroupstartendrpirxdefaultrv option_string args_stringrbopencloser&r&r'rsr                 z#HelpFormatter._format_actions_usagecCsFd|kr|t|jd}t|j|jd}d|j}|j|||dS)Nz%(prog))rM rwz )rr<r@rArB _fill_text)r!rbr|ryr&r&r'ras  zHelpFormatter._format_textc CsBt|jd|j}t|j|d}||jd}|j|}|jsV|jd|f}d|}n@t||kr~|jd||f}d|}d}n|jd|f}d|}|}|g}|jr|j |} |j | |} |j d|d| dfx@| ddD]} |j d|d| fqWn|j ds|j dx$|j |D]} |j |j| qW|j|S) Nr3rrZz%*s%s z %*s%-*s rrPr[)r?rDr>r@rArBrmrlrj _expand_help _split_linesrendswithrnror\) r!rpZ help_positionZ help_widthZ action_widthZ action_headertupZ indent_firstrxZ help_textZ help_linesr{rqr&r&r'ros6          zHelpFormatter._format_actioncCs|js&|j|}|j||d\}|Sg}|jdkrB|j|jn8|j|}|j||}x |jD]}|jd||fq`Wdj|SdS)NrPrz%s %sz, ) rr_metavar_formatterrrrrrr )r!rprmetavarrxrrr&r&r'rms     z'HelpFormatter._format_action_invocationcsP|jdk r|jn.|jdk r.z{%s},csttrSf|SdS)N) isinstancetuple)Z tuple_size)resultr&r'r=s z0HelpFormatter._metavar_formatter..format)rchoicesr )r!rpdefault_metavarZ choice_strsrr&)rr'r4s   z HelpFormatter._metavar_formattercCs|j||}|jdkr$d|d}n|jtkr.rw) rrr rr rrrr )r!rprZ get_metavarrZformatsr&r&r'rDs        zHelpFormatter._format_argscCstt||jd}x"t|D]}||tkr||=qWx,t|D] }t||dr@||j||<q@W|jddk rdjdd|dD}||d<|j ||S)N)rMrrz, cSsg|] }t|qSr&)r)rVcr&r&r'rY`sz.HelpFormatter._expand_help..) rvarsr<listrhasattrrrr _get_help_string)r!rpZparamsr$Z choices_strr&r&r'rWs  zHelpFormatter._expand_helpc cs@y |j}Wntk rYnX|j|EdH|jdS)N)_get_subactionsAttributeErrorrQrR)r!rpZget_subactionsr&r&r'rnds  z'HelpFormatter._iter_indented_subactionscCs|jjd|j}tj||S)Nrw)rKrtru _textwrapZwrap)r!rbrNr&r&r'rnszHelpFormatter._split_linescCs$|jjd|j}tj||||dS)Nrw)Zinitial_indentZsubsequent_indent)rKrtrurZfill)r!rbrNryr&r&r'rrs zHelpFormatter._fill_textcCs|jS)N)rl)r!rpr&r&r'rwszHelpFormatter._get_help_stringcCs |jjS)N)destupper)r!rpr&r&r'rzsz/HelpFormatter._get_default_metavar_for_optionalcCs|jS)N)r)r!rpr&r&r'r}sz1HelpFormatter._get_default_metavar_for_positional)r3r4N)N) rr,r-r.rOrQrRobjectrEr^r_r`rcrirrrsr]r\rdrrarormrrrrnrrrrrr&r&r&r'rs<  `a/  c@seZdZdZddZdS)rzHelp message formatter which retains any formatting in descriptions. Only the name of this class is considered a public API. All the methods provided by the class are considered an implementation detail. cs djfdd|jddDS)NrZc3s|]}|VqdS)Nr&)rVr{)ryr&r' sz9RawDescriptionHelpFormatter._fill_text..T)keepends)r splitlines)r!rbrNryr&)ryr'rsz&RawDescriptionHelpFormatter._fill_textN)rr,r-r.rr&r&r&r'rsc@seZdZdZddZdS)rzHelp message formatter which retains formatting of all help text. Only the name of this class is considered a public API. All the methods provided by the class are considered an implementation detail. cCs|jS)N)r)r!rbrNr&r&r'rsz!RawTextHelpFormatter._split_linesN)rr,r-r.rr&r&r&r'rsc@seZdZdZddZdS)rzHelp message formatter which adds default values to argument help. Only the name of this class is considered a public API. All the methods provided by the class are considered an implementation detail. cCs>|j}d|jkr:|jtk r:ttg}|js2|j|kr:|d7}|S)Nz %(default)z (default: %(default)s))rlrrr rrr)r!rprlZdefaulting_nargsr&r&r'rs  z.ArgumentDefaultsHelpFormatter._get_help_stringN)rr,r-r.rr&r&r&r'rsc@s eZdZdZddZddZdS)r a Help message formatter which uses the argument 'type' as the default metavar value (instead of the argument 'dest') Only the name of this class is considered a public API. All the methods provided by the class are considered an implementation detail. cCs|jjS)N)rr)r!rpr&r&r'rsz:MetavarTypeHelpFormatter._get_default_metavar_for_optionalcCs|jjS)N)rr)r!rpr&r&r'rsz.r&)r!namesr&)r!r'r/szAction._get_kwargscCsttddS)Nz.__call__() not defined)NotImplementedErrorr~)r!parserr1valuesrr&r&r'__call__=szAction.__call__)NNNNNFNN)N)rr,r-r.rOrrr&r&r&r'r s1 cs(eZdZdfdd ZdddZZS) _StoreActionNFc sT|dkrtd|dk r,|tkr,tdttt|j||||||||| | d dS)Nrznargs for store actions must be > 0; if you have nothing to store, actions such as store true or store const may be more appropriatez nargs must be %r to supply const) rrrrrrrrrlr)r;r superrrO) r!rrrrrrrrrlr) __class__r&r'rOCs   z_StoreAction.__init__cCst||j|dS)N)r0r)r!rr1rrr&r&r'r`sz_StoreAction.__call__)NNNNNFNN)N)rr,r-rOr __classcell__r&r&)rr'rAsrcs(eZdZdfdd ZdddZZS) _StoreConstActionNFc s"tt|j||d||||ddS)Nr)rrrrrrrl)rrrO)r!rrrrrrlr)rr&r'rOfs z_StoreConstAction.__init__cCst||j|jdS)N)r0rr)r!rr1rrr&r&r'rwsz_StoreConstAction.__call__)NFNN)N)rr,r-rOrrr&r&)rr'rds  rcseZdZdfdd ZZS)_StoreTrueActionFNcs tt|j||d|||ddS)NT)rrrrrrl)rrrO)r!rrrrrl)rr&r'rO}s z_StoreTrueAction.__init__)FFN)rr,r-rOrr&r&)rr'r{srcseZdZdfdd ZZS)_StoreFalseActionTFNcs tt|j||d|||ddS)NF)rrrrrrl)rrrO)r!rrrrrl)rr&r'rOs z_StoreFalseAction.__init__)TFN)rr,r-rOrr&r&)rr'rsrcs(eZdZdfdd ZdddZZS) _AppendActionNFc sT|dkrtd|dk r,|tkr,tdttt|j||||||||| | d dS)Nrznargs for append actions must be > 0; if arg strings are not supplying the value to append, the append const action may be more appropriatez nargs must be %r to supply const) rrrrrrrrrlr)r;r rrrO) r!rrrrrrrrrlr)rr&r'rOs   z_AppendAction.__init__cCs0tjt||jg}|j|t||j|dS)N)_copycopyr2rrr0)r!rr1rrr+r&r&r'rs z_AppendAction.__call__)NNNNNFNN)N)rr,r-rOrrr&r&)rr'rsrcs(eZdZdfdd ZdddZZS) _AppendConstActionNFc s$tt|j||d|||||ddS)Nr)rrrrrrrlr)rrrO)r!rrrrrrlr)rr&r'rOs z_AppendConstAction.__init__cCs2tjt||jg}|j|jt||j|dS)N)rrr2rrrr0)r!rr1rrr+r&r&r'rs z_AppendConstAction.__call__)NFNN)N)rr,r-rOrrr&r&)rr'rs  rcs(eZdZdfdd ZdddZZS) _CountActionNFcs tt|j||d|||ddS)Nr)rrrrrrl)rrrO)r!rrrrrl)rr&r'rOs z_CountAction.__init__cCs$t||jdd}t||j|dS)NrrP)r2rr0)r!rr1rrZ new_countr&r&r'rsz_CountAction.__call__)NFN)N)rr,r-rOrrr&r&)rr'rs rcs.eZdZeedffdd ZdddZZS) _HelpActionNcstt|j|||d|ddS)Nr)rrrrrl)rrrO)r!rrrrl)rr&r'rOs  z_HelpAction.__init__cCs|j|jdS)N) print_helpexit)r!rr1rrr&r&r'rsz_HelpAction.__call__)N)rr,r-rrOrrr&r&)rr'rsrcs0eZdZdeedffdd ZdddZZS)_VersionActionNz&show program's version number and exitcs$tt|j|||d|d||_dS)Nr)rrrrrl)rrrOversion)r!rrrrrl)rr&r'rOs z_VersionAction.__init__cCsD|j}|dkr|j}|j}|j||j|jtj|jdS)N)r_get_formatterrc_print_messager]_sysstdoutr)r!rr1rrrrSr&r&r'rs z_VersionAction.__call__)N)rr,r-rrOrrr&r&)rr'rs  rcsNeZdZGdddeZeddffdd ZddZdd Zd d d Z Z S) _SubParsersActioncseZdZfddZZS)z&_SubParsersAction._ChoicesPseudoActioncs@|}}|r|ddj|7}ttj|}|jg|||ddS)Nz (%s)z, )rrrlr)r rr_ChoicesPseudoActionrO)r!r$aliasesrlrrZsup)rr&r'rO"s   z/_SubParsersAction._ChoicesPseudoAction.__init__)rr,r-rOrr&r&)rr'r srNcs>||_||_tj|_g|_tt|j||t |j||ddS)N)rrrrrlr) _prog_prefix _parser_class _collections OrderedDict_name_parser_map_choices_actionsrrrOr)r!rrM parser_classrrlr)rr&r'rO*s  z_SubParsersAction.__init__cKs|jddkr d|j|f|d<|jdf}d|krX|jd}|j|||}|jj||jf|}||j|<x|D]}||j|<qtW|S)NrMz%s %srrl)rrrrrrrr)r!r$kwargsrrlZ choice_actionraliasr&r&r' add_parser?s      z_SubParsersAction.add_parsercCs|jS)N)r)r!r&r&r'rVsz!_SubParsersAction._get_subactionsc Cs|d}|dd}|jtk r,t||j|y|j|}Wn<tk rv|dj|jd}td|}t||YnX|j|d\} }x$t | j D]\} } t|| | qW|rt |j t gt |t j|dS)NrrPz, ) parser_namerz5unknown parser %(parser_name)r (choices: %(choices)s))rrr0rr:r r~rparse_known_argsrr+ setdefault_UNRECOGNIZED_ARGS_ATTRr/r) r!rr1rrrr"rXmsgZ subnamespacekeyr%r&r&r'rYs"    z_SubParsersAction.__call__)N) rr,r-r rrrOrrrrr&r&)rr'rsrc@s*eZdZdZd ddZddZd d ZdS) raFactory for creating file object types Instances of FileType are typically passed as type= arguments to the ArgumentParser add_argument() method. Keyword Arguments: - mode -- A string indicating how the file is to be opened. Accepts the same values as the builtin open() function. - bufsize -- The file's desired buffer size. Accepts the same values as the builtin open() function. - encoding -- The file's encoding. Accepts the same values as the builtin open() function. - errors -- A string indicating how encoding and decoding errors are to be handled. Accepts the same value as the builtin open() function. rrPNcCs||_||_||_||_dS)N)_mode_bufsize _encoding_errors)r!modebufsizeencodingerrorsr&r&r'rOszFileType.__init__cCs|dkr>d|jkrtjSd|jkr(tjStd|j}t|yt||j|j|j|j St k r}ztd}t |||fWYdd}~XnXdS)N-rwzargument "-" with mode %rzcan't open '%s': %s) rrstdinrr~r;rrrrOSErrorr)r!stringrerr&r&r'rs  zFileType.__call__cCsT|j|jf}d|jfd|jfg}djdd|Ddd|D}dt|j|fS)Nrrz, cSsg|]}|dkrt|qS)rPr)r)rVr#r&r&r'rYsz%FileType.__repr__..cSs$g|]\}}|dk rd||fqS)Nz%s=%rr&)rVkwr#r&r&r'rYsz%s(%s))rrrrr rr)r!rXrZargs_strr&r&r'r(s  zFileType.__repr__r)rrNN)rr,r-r.rOrr(r&r&r&r'r~s c@s(eZdZdZddZddZddZdS) r zSimple object for storing attributes. Implements equality by attribute names and values, and provides a simple string representation. cKs"x|D]}t||||qWdS)N)r0)r!rr$r&r&r'rOs zNamespace.__init__cCst|tstSt|t|kS)N)rr NotImplementedr)r!otherr&r&r'__eq__s zNamespace.__eq__cCs ||jkS)N)r*)r!rr&r&r' __contains__szNamespace.__contains__N)rr,r-r.rOrr r&r&r&r'r scseZdZfddZddZd&ddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZd'ddZddZd d!Zd"d#Zd$d%ZZS)(_ActionsContainercstt|j||_||_||_||_i|_|jddt |jddt |jddt |jddt |jddt |jddt |jddt|jddt|jdd t|jdd t|jdd t|jg|_i|_g|_g|_i|_tjd |_g|_dS) NrpZstoreZ store_const store_trueZ store_falserZ append_constcountrlrparsersz^-\d+$|^-\d*\.\d+$)rr rO descriptionargument_default prefix_charsconflict_handler _registriesregisterrrrrrrrrrr _get_handler_actions_option_string_actions_action_groups_mutually_exclusive_groups _defaultsrHrI_negative_number_matcher_has_negative_number_optionals)r!rrrr)rr&r'rOs2 z_ActionsContainer.__init__cCs|jj|i}|||<dS)N)rr)r! registry_namer%rregistryr&r&r'rsz_ActionsContainer.registerNcCs|j|j||S)N)rr)r!rr%rr&r&r' _registry_getsz_ActionsContainer._registry_getcKs6|jj|x$|jD]}|j|kr||j|_qWdS)N)rupdaterrr)r!rrpr&r&r' set_defaultss   z_ActionsContainer.set_defaultscCs8x(|jD]}|j|kr|jdk r|jSqW|jj|dS)N)rrrrr)r!rrpr&r&r' get_defaults  z_ActionsContainer.get_defaultc Os0|j}| s(t|dkrJ|dd|krJ|r|js>|jjdq>W|S)NT) _check_conflictrr containerrrrmatchr)r!rprr&r&r'r'Ts     z_ActionsContainer._add_actioncCs|jj|dS)N)rremove)r!rpr&r&r'_remove_actionisz _ActionsContainer._remove_actioncCsi}x8|jD].}|j|kr0td}t||j|||j<q Wi}xR|jD]H}|j|krt|j|j|j|jd||j<x|jD]}||j||<q|WqJWx4|jD]*}|j |j d}x|jD] }|||<qWqWx |j D]}|j ||j |qWdS)Nz.cannot merge actions - two groups are named %r)titlerr)r)rr3r~r;r+rrrrr-rrrr')r!r/Ztitle_group_maprrZ group_maprp mutex_groupr&r&r'_add_container_actionsls,         z(_ActionsContainer._add_container_actionscKs^d|krtd}t||jdttgkr2d|d<|jdtkrPd|krPd|d<t||gdS)Nrz1'required' is an invalid argument for positionalsrTr)rr)r~r&rr rr)r!rrrr&r&r'r"sz(_ActionsContainer._get_positional_kwargsc Osg}g}xv|D]n}|d|jkr@||jd}td}t|||j||d|jkrt|dkr|d|jkr|j|qW|jdd}|dkr|r|d}n|d}|j|j}|std}t|||jdd}t|||d S) Nr)optionrzNinvalid option string %(option)r: must start with a character %(prefix_chars)rrPrz%dest= is required for options like %rrr~)rr) rr~r;rrjrlstripreplacer) r!rXrrZlong_option_stringsrrrZdest_option_stringr&r&r'r#s0          z&_ActionsContainer._get_optional_kwargscCs|jd|}|jd||S)Nrp)rr)r!rrrpr&r&r'r$s z#_ActionsContainer._pop_action_classc CsDd|j}y t||Stk r>td}t||jYnXdS)Nz_handle_conflict_%sz%invalid conflict_resolution value: %r)rr/rr~r;)r!Zhandler_func_namerr&r&r'rs   z_ActionsContainer._get_handlercCsPg}x0|jD]&}||jkr |j|}|j||fq W|rL|j}|||dS)N)rrrr)r!rpZconfl_optionalsrZconfl_optionalrr&r&r'r.s   z!_ActionsContainer._check_conflictcCs6tddt|}djdd|D}t|||dS)Nzconflicting option string: %szconflicting option strings: %sz, cSsg|] \}}|qSr&r&)rVrrpr&r&r'rYsz<_ActionsContainer._handle_conflict_error..)rrjr r)r!rpconflicting_actionsrZconflict_stringr&r&r'_handle_conflict_errors    z(_ActionsContainer._handle_conflict_errorcCsBx<|D]4\}}|jj||jj|d|js|jj|qWdS)N)rr1rrr/r2)r!rpr9rr&r&r'_handle_conflict_resolves  z*_ActionsContainer._handle_conflict_resolve)N)N)rr,r-rOrrr r!rrr+r-r'r2r5r"r#r$rr.r:r;rr&r&)rr'r s$ 4   /($   r cs6eZdZdfdd ZfddZfddZZS) r*Nc s|j}|d|j|d|j|d|jtt|j}|fd|i|||_g|_|j |_ |j |_ |j |_ |j |_ |j |_ |j|_dS)Nrrrr)rrrrrr*rOr3rrrrrrr)r!r/r3rrrZ super_init)rr&r'rOs    z_ArgumentGroup.__init__cs tt|j|}|jj||S)N)rr*r'rr)r!rp)rr&r'r's z_ArgumentGroup._add_actioncs tt|j||jj|dS)N)rr*r2rr1)r!rp)rr&r'r2sz_ArgumentGroup._remove_action)NN)rr,r-rOr'r2rr&r&)rr'r*s r*cs.eZdZdfdd ZddZddZZS) r,Fcs tt|j|||_||_dS)N)rr,rOr _container)r!r/r)rr&r'rOsz _MutuallyExclusiveGroup.__init__cCs2|jrtd}t||jj|}|jj||S)Nz-mutually exclusive arguments must be optional)rr~r;r<r'rr)r!rprr&r&r'r'$s   z#_MutuallyExclusiveGroup._add_actioncCs|jj||jj|dS)N)r<r2rr1)r!rpr&r&r'r2,s z&_MutuallyExclusiveGroup._remove_action)F)rr,r-rOr'r2rr&r&)rr'r,sr,c seZdZdZddddgeddddddf fdd Zdd Zd d Zd d ZddZ ddZ d=ddZ d>ddZ ddZ ddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd?d2d3Zd@d4d5ZdAd6d7ZdBd9d:Zd;d<ZZ S)CraObject for parsing command line strings into Python objects. Keyword Arguments: - prog -- The name of the program (default: sys.argv[0]) - usage -- A usage message (default: auto-generated from arguments) - description -- A description of what the program does - epilog -- Text following the argument descriptions - parents -- Parsers whose arguments should be copied into this one - formatter_class -- HelpFormatter class for printing help messages - prefix_chars -- Characters that prefix optional arguments - fromfile_prefix_chars -- Characters that prefix files containing additional arguments - argument_default -- The default value for all arguments - conflict_handler -- String indicating how to handle conflicts - add_help -- Add a -h/-help option - allow_abbrev -- Allow long options to be abbreviated unambiguously NrerrorTc  s&tt|j} | ||| | d|dkr6tjjtjd}||_||_ ||_ ||_ ||_ | |_ | |_|j}|td|_|td|_d|_dd}|jdd|d|krdn|d}|j r|j|d |d d d ttd d xD|D]<}|j|y |j}Wntk rYqX|jj|qWdS)N)rrrrrzpositional argumentszoptional argumentscSs|S)Nr&)rr&r&r'identityjsz)ArgumentParser.__init__..identityrrhr3rlzshow this help message and exit)rprrl)rrrOr8pathbasenamerargvrMreepilogformatter_classfromfile_prefix_charsadd_help allow_abbrevr+r~ _positionals _optionals _subparsersrrrrr5rrr)r!rMrerrCparentsrDrrErrrFrGZ superinitZ add_groupr>Zdefault_prefixrTZdefaults)rr&r'rODsB     zArgumentParser.__init__cs"ddddddg}fdd|DS) NrMrerrDrrFcsg|]}|t|fqSr&)r/)rVr$)r!r&r'rYsz.ArgumentParser._get_kwargs..r&)r!rr&)r!r'rszArgumentParser._get_kwargsc Ks|jdk r|jtd|jdt|d|ks8d|krht|jdd}t|jdd}|j|||_n|j|_|jddkr|j }|j }|j }|j |j ||d|jj|d<|j|d}|fd gi|}|jj||S) Nz(cannot have multiple subparser argumentsrr3rZ subcommandsrMrZr r)rJr=r~rrrr+rHrr_get_positional_actionsrrirer]rur$r') r!rr3rrSrrgZ parsers_classrpr&r&r'add_subparserss$   zArgumentParser.add_subparserscCs$|jr|jj|n |jj||S)N)rrIr'rH)r!rpr&r&r'r's zArgumentParser._add_actioncCsdd|jDS)NcSsg|]}|jr|qSr&)r)rVrpr&r&r'rYsz8ArgumentParser._get_optional_actions..)r)r!r&r&r'_get_optional_actionssz$ArgumentParser._get_optional_actionscCsdd|jDS)NcSsg|]}|js|qSr&)r)rVrpr&r&r'rYsz:ArgumentParser._get_positional_actions..)r)r!r&r&r'rLsz&ArgumentParser._get_positional_actionscCs4|j||\}}|r0td}|j|dj||S)Nzunrecognized arguments: %srw)rr~r=r )r!rXr1rBrr&r&r' parse_argss zArgumentParser.parse_argsc Cs |dkrtjdd}nt|}|dkr.t}x>|jD]4}|jtk r6t||js6|jtk r6t ||j|jq6Wx*|j D] }t||svt |||j |qvWy<|j ||\}}t|t r|j t|t t|t ||fStk rtjd}|jt|YnXdS)NrP)rrBrr rrrrrr0r_parse_known_argsrrr/delattrrexc_infor=r)r!rXr1rprerrr&r&r'rs,         zArgumentParser.parse_known_argscs" jdk r jix` jD]V}|j}xJt|jD]<\}}j|g}|j|d||j||ddq6Wq Wig}t} xnt| D]b\}} | dkr|jdxF| D]} |jdqWq j | } | dkrd} n | |<d} |j| qWdj |t t d fdd  fd d } j  fd d }gd rpt }nd}x| |krt fddD} |kr| }| kr| qvn| kr |}j|| |  qvW| }j|dg}x jD]|}|kr|jr>|jt|nT|jdk rt|jtrt|jr|jt|jkrt|j j||jqW|r jtddj |xb jD]X}|jrxH|jD]}|krPqWdd|jD}td} j|dj |qWfS)NrPz--rAOrZcsj|j||}||jk rfj|x:j|gD]*}|kr8td}t|}t|||q8W|tk r||||dS)Nznot allowed with argument %s)r _get_valuesrrr~rrr)rpZargument_stringsrZargument_valuesZconflict_actionrZ action_name)action_conflictsr1 seen_actionsseen_non_default_actionsr!r&r' take_actions    z5ArgumentParser._parse_known_args..take_actioncs|}|\}}}j}g}x>|dkr>j||dS|dk r||d}j}|dkr|d|kr|j|g|f|d} | |d}|ddpd} j} || kr| |}| }ntd} t|| |n@|dkr|d} |g}|j|||fPntd} t|| |q |d}|d}|||}||} || }|j|||fPq Wx |D]\}}}|||qdW| S)NrPrTrzignored explicit argument %r)_match_argumentrrrr~r) start_index option_tuplerpr explicit_argZmatch_argumentZ action_tuples arg_countr(charZnew_explicit_argZ optionals_maprstoprXrZselected_patterns)r"arg_strings_patternextrasoption_string_indicesr!rZr&r'consume_optional3sN       z:ArgumentParser._parse_known_args..consume_optionalcsrj}|d}||}x8t|D]*\}}|||}||7}||q(Wt|ddd<|S)N)_match_arguments_partialziprj)r\Z match_partialZselected_patternZ arg_countsrpr_rX)r"rbrr!rZr&r'consume_positionalss  z=ArgumentParser._parse_known_args..consume_positionalsrcsg|]}|kr|qSr&r&)rVr)r\r&r'rYsz4ArgumentParser._parse_known_args..z(the following arguments are required: %sz, cSsg|]}|jtk rt|qSr&)rlrr)rVrpr&r&r'rYsz#one of the arguments %s is requiredrw)Nr)rE_read_args_from_filesrrrrriterr_parse_optionalr rrLr@r?rrrrrrrrr/r0 _get_valuer=r~)r!r"r1r4rrZ mutex_actionZ conflictsZarg_string_pattern_partsZarg_strings_iter arg_stringr]patternrerhZmax_option_string_indexZnext_option_string_indexZpositionals_end_indexZstringsZ stop_indexZrequired_actionsrprrrr&) rWr"rbrcr1rdrrXrYr!r\rZr'rPs        J                 z ArgumentParser._parse_known_argscCsg}x|D]}| s"|d|jkr.|j|q ylt|ddR}g}x2|jjD]"}x|j|D]}|j|qdWqTW|j|}|j|WdQRXWq tk rt j d}|j t |Yq Xq W|S)NrrP) rErrreadrconvert_arg_line_to_argsrirrrrRr=r)r!r"Znew_arg_stringsrmZ args_filearg_liner#rSr&r&r'ris     z$ArgumentParser._read_args_from_filescCs|gS)Nr&)r!rqr&r&r'rpsz'ArgumentParser.convert_arg_line_to_argscCst|j|}tj||}|dkrfdtdttdttdi}tdd|j|j}|j|j|}t ||t |j dS)Nzexpected one argumentzexpected at most one argumentzexpected at least one argumentzexpected %s argumentzexpected %s argumentsrP) _get_nargs_patternrHr0r~r r rrrrrjr)r!rprb nargs_patternr0Z nargs_errorsrrr&r&r'r[s    zArgumentParser._match_argumentcstg}xjtt|ddD]V}|d|}djfdd|D}tj||}|dk r|jdd|jDPqW|S)NrrPrZcsg|]}j|qSr&)rr)rVrp)r!r&r'rYsz;ArgumentParser._match_arguments_partial..cSsg|] }t|qSr&)rj)rVrr&r&r'rY!sr)rrjr rHr0rrg)r!rfrbrrZ actions_slicernr0r&)r!r'rfs   z'ArgumentParser._match_arguments_partialc Cs|sdS|d|jkrdS||jkr8|j|}||dfSt|dkrHdSd|kr~|jdd\}}||jkr~|j|}|||fS|jr|j|}t|dkrdjdd|D}||d}td}|j||nt|dkr|\} | S|j j |r|j sdSd |krdSd|dfS) NrrP=z, cSsg|]\}}}|qSr&r&)rVrprr^r&r&r'rYGsz2ArgumentParser._parse_optional..)r6Zmatchesz4ambiguous option: %(option)s could match %(matches)srw) rrrjsplitrG_get_option_tuplesr r~r=rr0r) r!rmrprr^Z option_tuplesZoptionsrXrr]r&r&r'rk's>              zArgumentParser._parse_optionalc Cs0g}|j}|d|kr~|d|kr~d|kr<|jdd\}}n|}d}x|jD],}|j|rL|j|}|||f}|j|qLWn|d|ko|d|kr|}d}|dd}|dd} xr|jD]T}||kr|j|}||| f}|j|q|j|r|j|}|||f}|j|qWn|jtd||S)NrrPrtr3zunexpected option string: %s)rrur startswithrr=r~) r!rrr(Z option_prefixr^rprZshort_option_prefixZshort_explicit_argr&r&r'rvbs8             z!ArgumentParser._get_option_tuplescCs|j}|dkrd}nX|tkr"d}nJ|tkr0d}n<|tkr>d}n.|tkrLd}n |tkrZd}nddjd |}|jr|jdd }|jd d }|S) Nz(-*A-*)z(-*A?-*)z (-*[A-]*)z (-*A[A-]*)z([-AO]*)z (-*A[-AO]*)z(-*%s-*)z-*rTrZr) rr rr rrr rr8)r!rprrsr&r&r'rrs$  z!ArgumentParser._get_nargs_patternc sxjttgkr2y|jdWntk r0YnX| rzjtkrzjrPj}nj}t |t rxj |}j |n| rjt krj rjdk rj}n|}j |nt|dkrjdtgkr|\}j |}j |njtkrfdd|D}nbjtkrDfdd|D}j |dn0fdd|D}x|D]}j |q^W|S)Nz--rPcsg|]}j|qSr&)rl)rVv)rpr!r&r'rYsz.ArgumentParser._get_values..csg|]}j|qSr&)rl)rVrx)rpr!r&r'rYsrcsg|]}j|qSr&)rl)rVrx)rpr!r&r'rYs)rrrr1r;r rrrrrrl _check_valuerrj)r!rpr"r%rmrxr&)rpr!r'rVs>       zArgumentParser._get_valuesc Cs|jd|j|j}t|s0td}t|||y ||}Wntk r~t|jdt|j}tt j d}t||YnLt t fk rt|jdt|j}||d}td}t|||YnX|S)Nrz%r is not callablerrP)rr%z!invalid %(type)s value: %(value)r) rrr%r~rrr/rrrrRr&r;)r!rprmr)rrr$rXr&r&r'rls   zArgumentParser._get_valuecCsF|jdk rB||jkrB|djtt|jd}td}t|||dS)Nz, )r%rz3invalid choice: %(value)r (choose from %(choices)s))rr maprr~r)r!rpr%rXrr&r&r'ry s zArgumentParser._check_valuecCs$|j}|j|j|j|j|jS)N)rrirerrr])r!rSr&r&r' format_usage s zArgumentParser.format_usagecCsx|j}|j|j|j|j|j|jx:|jD]0}|j|j |j|j|j |j |j q0W|j|j |jS)N)rrirerrrcrrr_r3rsrr`rCr])r!rSZ action_groupr&r&r'r] s        zArgumentParser.format_helpcCs|j|jdS)N)rM)rDrM)r!r&r&r'r0 szArgumentParser._get_formattercCs"|dkrtj}|j|j|dS)N)rrrr{)r!filer&r&r' print_usage6 szArgumentParser.print_usagecCs"|dkrtj}|j|j|dS)N)rrrr])r!r|r&r&r'r; szArgumentParser.print_helpcCs |r|dkrtj}|j|dS)N)rstderrwrite)r!rr|r&r&r'r@ szArgumentParser._print_messagercCs |r|j|tjtj|dS)N)rrr~r)r!Zstatusrr&r&r'rI szArgumentParser.exitcCs0|jtj|j|d}|jdtd|dS)zerror(message: string) Prints a usage message incorporating the message to stderr and exits. If you override this in a subclass, it should not return -- it should either exit or raise an exception. )rMrr3z%(prog)s: error: %(message)s N)r}rr~rMrr~)r!rrXr&r&r'r=N s  zArgumentParser.error)NN)NN)N)N)N)rN)!rr,r-r.rrOrrMr'rNrLrOrrPrirpr[rfrkrvrrrVrlryr{r]rr}rrrr=rr&r&)rr'r1sP4  #w;,,4    )6r. __version____all__ collectionsrrrosr8rerHsysrtextwraprrr~rrr rr rrrrrr2rrrrr r Exceptionrrr rrrrrrrrrrrr r r*r,rr&r&r&r'>s n    [#%`65"pathlib.cpython-36.pyc000064400000117556152462730460010645 0ustar003 i@s$ddlZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z mZmZmZddlmZddlmZmZmZmZmZmZmZddlmZdZd d d d d dgZdZ dZ!dZ"ddZ#Gddde$Z%Gddde%Z&Gddde%Z'e&Z(e'Z)GdddZ*Gddde*Z+e+Z,ddZ-e.ed rTej/e-Z-Gd!d"d"Z0Gd#d$d$Z1Gd%d&d&e0Z2Gd'd(d(e0Z3Gd)d*d*e0Z4Gd+d,d,e Z5Gd-d d e$Z6ej7j8e6Gd.d d e6Z9Gd/d d e6Z:Gd0d d e6Z;Gd1d d e;e9Zssz_WindowsFlavour.azr7ccs|]}t|VqdS)N)rB)rCr5rrrrDtsAZz\\?\ZCONZPRNZAUXZNULcCsh|] }d|qS)zCOM%dr)rCirrr zsz_WindowsFlavour. cCsh|] }d|qS)zLPT%dr)rCrIrrrrJ{sc Csb|dd}|dd}||krP||krP|j|\}}|dd}|dd}nd}|dd}||kov||kov||kr|j|d}|dkr|j||d}||dkr|dkrt|}|r||d||||ddfS|d||||ddfSd} } |dkr<||jkr<|dd} |dd}|}||krT|} |j|}|| | |fS) Nrr7r%:rO)_split_extended_pathfindlen drive_letterslstrip) r#r4r!firstsecondprefixZthirdindexZindex2r1r2rrrr*s6      "    z_WindowsFlavour.splitrootcCs|jS)N)lower)r#srrrr8sz_WindowsFlavour.casefoldcCsdd|DS)NcSsg|] }|jqSr)rY)rCprrr sz2_WindowsFlavour.casefold_parts..r)r#r0rrrcasefold_partssz_WindowsFlavour.casefold_partscCsXd}|j|rP|dd}|dd}|jdrP||dd7}d|dd}||fS)Nr%zUNC\rMr?) startswith)r#rZZ ext_prefixrWrrrrPs    z$_WindowsFlavour._split_extended_pathcCs6|sdS|djdrdS|djddj|jkS)NFrz\\r7r&rO)r_ partitionupperreserved_names)r#r0rrr is_reserveds z_WindowsFlavour.is_reservedcCsd|j}t|dkrJ|ddkrJ|jddjd}d|t|jdfSdt|jjdSdS)NrLr7rNr@z file:///%s/%szutf-8zfile:)driverRas_posixrTurlquote_from_bytesencode)r#pathrdrestrrrmake_uris z_WindowsFlavour.make_uric Csdtjkrtjd}n`dtjkr,tjd}nJdtjkrnytjd}Wntk r\d}YnX|tjd}ntd|rtjd|kr|j|f\}}}|d tjdkrtd |||d <|s|r|||j|dd}n |j|}|S) NHOMEZ USERPROFILEZHOMEPATHZ HOMEDRIVEr%zCan't determine home directoryZUSERNAMEr7z%Can't determine home directory for %rrOrO)osenvironKeyError RuntimeErrorr6r")r#usernameuserhomer1r2r0rrr gethomedirs,       z_WindowsFlavour.gethomedirN)r:r;r<r!r'has_drvntpathpathmodrlname is_supportedsetrangeordrSZext_namespace_prefixrbr*r8r]rPrcrjrrrrrrr>gs" "& '   r>c@sZeZdZdZdZdZeZej dkZ efddZ ddZ d d Z d d Zd dZddZdS) _PosixFlavourr@r%FrAcCsV|rH|d|krH|j|}t|t|dkr.wrapped) functoolswraps staticmethod)rrr)rr _wrap_strfunc3sz_NormalAccessor._wrap_strfunccstjfdd}t|S)Ncst|t|f|S)N)r)ZpathobjAZpathobjBr)rrrr:sz5_NormalAccessor._wrap_binary_strfunc..wrapped)rrr)rrr)rr_wrap_binary_strfunc9sz$_NormalAccessor._wrap_binary_strfunclchmodcCs tddS)Nz%lchmod() not available on this system)NotImplementedError)r#rmoderrrrNsz_NormalAccessor.lchmodsymlinkFcCs tddS)Nz)os.symlink() not available on this system)r)r#srcdsttarget_is_directoryrrrr^sz_NormalAccessor.symlinkcCs tj|S)N)rlreadlink)r#rhrrrresz_NormalAccessor.readlinkN)F)r:r;r<rrrlstatlstatopenlistdirscandirchmodhasattrrmkdirunlinkrmdirrenamer)rutimergetcwdrrh expanduserrealpathrrrrr1s0                 rcCsP|d}|dd}|dkr"t}n$d|kr4tdnt|rBt}nt}|||S)Nrr7z**z:Invalid pattern: '**' can only be an entire path component)_RecursiveWildcardSelector ValueErrorr_WildcardSelector_PreciseSelector) pattern_partsr child_partsclsrrr_make_selectorvs  r lru_cachec@s eZdZdZddZddZdS) _SelectorzYA selector matches a specific glob pattern part against the children of a given path.cCs.||_|rt||_d|_nt|_d|_dS)NTF)rr successordironly_TerminatingSelector)r#rrrrr$s  z_Selector.__init__cCs<t|}|j}|j}|jj}||s,tgS|j||||S)zuIterate over all child paths of `parent_path` matched by this selector. This can contain parent_path itself.)typeis_direxists _accessorriter _select_from)r# parent_pathZpath_clsrrrrrr select_fromsz_Selector.select_fromN)r:r;r<r=r$rrrrrrs rc@seZdZddZdS)rccs |VdS)Nr)r#rrrrrrrrsz!_TerminatingSelector._select_fromN)r:r;r<rrrrrrsrc@seZdZddZddZdS)rcCs||_tj||dS)N)rvrr$)r#rvrrrrr$sz_PreciseSelector.__init__c cs^yD|j|j}|jr|n||rBx |jj||||D] }|Vq4WWntk rXdSXdS)N)_make_child_relpathrvrrrPermissionError)r#rrrrrhr[rrrrs z_PreciseSelector._select_fromN)r:r;r<r$rrrrrrsrc@seZdZddZddZdS)rcCs"tjtj||_tj||dS)N)recompilefnmatch translaterrr$)r#rrrrrr$sz_WildcardSelector.__init__c csy||jj}t||}xb|D]Z}|j s0|jr|j}||} |jj| r|j|} x |j j | |||D] } | VqhWqWWnt k rdSXdS)N) _flavourr8listrrrvrmatchrrrr) r#rrrrcfentriesentryrvZ casefoldedrhr[rrrrs    z_WildcardSelector._select_fromN)r:r;r<r$rrrrrrsrc@s$eZdZddZddZddZdS)rcCstj||dS)N)rr$)r#rrrrrr$sz#_RecursiveWildcardSelector.__init__c csz|VyZt||}xH|D]@}|jr|j r|j|j}x|j|||D] }|VqLWqWWntk rtdSXdS)N)rr is_symlinkrrv_iterate_directoriesr)r#rrrrrrhr[rrrrs   z/_RecursiveWildcardSelector._iterate_directoriesc csyjt}zT|jj}xF|j|||D]4}x.|||||D]}||kr6|V|j|q6Wq"WWd|jXWntk r~dSXdS)N)rxrrraddclearr) r#rrrrZyieldedZsuccessor_selectZstarting_pointr[rrrrsz'_RecursiveWildcardSelector._select_fromN)r:r;r<r$rrrrrrrs rc@s4eZdZdZdZddZdd Zd d Zd d ZdS) _PathParentszvThis object provides sequence-like access to the logical ancestors of a path. Don't try to construct it yourself._pathcls_drv_root_partscCs&t||_|j|_|j|_|j|_dS)N)rrrrr)r#rhrrrr$s z_PathParents.__init__cCs(|js |jrt|jdSt|jSdS)Nr7)rrrRr)r#rrr__len__s z_PathParents.__len__cCs@|dks|t|krt||jj|j|j|jd| dS)Nrr7)rR IndexErrorr_from_parsed_partsrrr)r#idxrrr __getitem__sz_PathParents.__getitem__cCsdj|jjS)Nz <{}.parents>)formatrr:)r#rrr__repr__ sz_PathParents.__repr__N)rrrr) r:r;r<r= __slots__r$rrrrrrrrs rc@seZdZdZdZZd d Zd d Zed dZed[ddZ ed\ddZ eddZ ddZ ddZ ddZddZddZd d!Zd"d#Zd$d%Zed&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zeedd4d5Zeedd6d5Zed7d8Zed9d:Z ed;d<Z!ed=d>Z"ed?d@Z#dAdBZ$dCdDZ%dEdFZ&edGdHZ'dIdJZ(dKdLZ)dMdNZ*edOdPZ+edQdRZ,dSdTZ-dUdVZ.dWdXZ/dYS)]ra|Base class for manipulating paths without I/O. PurePath represents a filesystem path and offers operations which don't imply any actual filesystem I/O. Depending on your system, instantiating a PurePath will return either a PurePosixPath or a PureWindowsPath object. You can also instantiate either of these classes directly, regardless of your system. rrr_str_hash_pparts_cached_cpartscGs$|tkrtjdkrtnt}|j|S)zConstruct a PurePath from one or several strings and or existing PurePath objects. The strings and path objects are combined so as to yield a canonicalized path, which is incorporated into the new PurePath object. rA)rrlrvrr _from_parts)rrrrr__new__szPurePath.__new__cCs|jt|jfS)N) __class__tupler)r#rrr __reduce__&szPurePath.__reduce__cCshg}xV|D]N}t|tr$||j7}q tj|}t|trH|jt|q tdt|q W|j j |S)NzNargument should be a str object or an os.PathLike object returning str, not %r) isinstancerrrlfspathrr, TypeErrorrrr6)rrr0rErrr _parse_args+s     zPurePath._parse_argsTcCs<tj|}|j|\}}}||_||_||_|r8|j|S)N)objectrrrrr_init)rrinitr#r1r2r0rrrr?s zPurePath._from_partscCs,tj|}||_||_||_|r(|j|S)N)rrrrrr)rr1r2r0rr#rrrrLs zPurePath._from_parsed_partscCs4|s|r$|||jj|ddS|jj|SdS)Nr7)rr")rr1r2r0rrr_format_parsed_partsVszPurePath._format_parsed_partscCsdS)Nr)r#rrrr]szPurePath._initcCs@|j|\}}}|jj|j|j|j|||\}}}|j|||S)N)rrr9rrrr)r#rr1r2r0rrr _make_childaszPurePath._make_childc Cs<y|jStk r6|j|j|j|jp,d|_|jSXdS)z[Return the string representation of the path, suitable for passing to system calls.r&N)rAttributeErrorrrrr)r#rrr__str__gs  zPurePath.__str__cCst|S)N)r)r#rrr __fspath__qszPurePath.__fspath__cCs|j}t|j|jdS)zNReturn the string representation of the path with forward (/) slashes.r@)rrr)r!)r#frrrretszPurePath.as_posixcCstjt|S)zaReturn the bytes representation of the path. This is only recommended to use under Unix.)rlfsencoder)r#rrr __bytes__zszPurePath.__bytes__cCsdj|jj|jS)Nz{}({!r}))rrr:re)r#rrrrszPurePath.__repr__cCs|jstd|jj|S)z Return the path as a 'file' URI.z.relative path can't be expressed as a file URI) is_absoluterrrj)r#rrras_uriszPurePath.as_uric Cs2y|jStk r,|jj|j|_|jSXdS)N)rrrr]r)r#rrr_cpartss zPurePath._cpartscCs&t|tstS|j|jko$|j|jkS)N)rrNotImplementedrr)r#otherrrr__eq__s zPurePath.__eq__c Cs2y|jStk r,tt|j|_|jSXdS)N)rrhashrr)r#rrr__hash__s zPurePath.__hash__cCs(t|t s|j|jk rtS|j|jkS)N)rrrrr)r#rrrr__lt__szPurePath.__lt__cCs(t|t s|j|jk rtS|j|jkS)N)rrrrr)r#rrrr__le__szPurePath.__le__cCs(t|t s|j|jk rtS|j|jkS)N)rrrrr)r#rrrr__gt__szPurePath.__gt__cCs(t|t s|j|jk rtS|j|jkS)N)rrrrr)r#rrrr__ge__szPurePath.__ge__z.The drive prefix (letter or UNC path), if any.)doczThe root of the path, if any.cCs|j|j}|S)z/The concatenation of the drive and root, or ''.)rr)r#anchorrrrrs zPurePath.anchorcCs.|j}t||js|jrdndkr&dS|dS)z!The final path component, if any.r7rr%rO)rrRrr)r#r0rrrrvsz PurePath.namecCsD|j}|jd}d|ko*t|dknr<||dSdSdS)z*The final component's last suffix, if any.r&rr7Nr%)rvrfindrR)r#rvrIrrrsuffixs    zPurePath.suffixcCs:|j}|jdrgS|jd}dd|jdddDS)z1A list of the final component's suffixes, if any.r&cSsg|] }d|qS)r&r)rCrrrrr\sz%PurePath.suffixes..r7N)rvendswithrTr+)r#rvrrrsuffixess   zPurePath.suffixescCsD|j}|jd}d|ko*t|dknr<|d|S|SdS)z0The final path component, minus its last suffix.r&rr7N)rvrrR)r#rvrIrrrstems    z PurePath.stemcCs|jstd|f|jj|f\}}}| sZ|d|jj|jjgksZ|sZ|sZt|dkrftd||j|j|j |j dd|gS)z-Return a new path with the file name changed.z%r has an empty namer7zInvalid name %rNrOrO) rvrrr6r!r'rRrrrr)r#rvr1r2r0rrr with_names  zPurePath.with_namecCs|j}|j|ks |jr,|j|kr,td||r<|jd sD|dkrPtd||j}|shtd|f|j}|s|||}n|dt| |}|j|j |j |j dd|gS)zReturn a new path with the file suffix changed. If the path has no suffix, add given suffix. If the given suffix is an empty string, remove the suffix from the path. zInvalid suffix %rr&z%r has an empty nameNr7rO) rr!r'rr_rvrrRrrrr)r#rrrvZ old_suffixrrr with_suffixs    zPurePath.with_suffixc Gs|s td|j}|j}|j}|r8||g|dd}n|}|j|\}}}|rf||g|dd} n|} t| } |jj} | dkr|p|n| |d| | | kr|j|||} t dj t |t | |j d| dkr|nd|| dS)zReturn the relative path to another path identified by the passed arguments. If the operation is not possible (because this is not a subpath of the other path), raise ValueError. zneed at least one argumentr7Nrz{!r} does not start with {!r}r%) rrrrrrRrr]rrrrr) r#rr0r1r2Z abs_partsZto_drvZto_rootZto_partsZ to_abs_partsnrZ formattedrrr relative_tos( (zPurePath.relative_toc Cs.y|jStk r(t|j|_|jSXdS)zZAn object providing sequence-like access to the components in the filesystem path.N)rrrr)r#rrrr0"s  zPurePath.partscGs |j|S)zCombine this path with one or several arguments, and return a new path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored). )r)r#rrrrjoinpath.szPurePath.joinpathcCs |j|fS)N)r)r#keyrrr __truediv__6szPurePath.__truediv__cCs|j|g|jS)N)rr)r#rrrr __rtruediv__9szPurePath.__rtruediv__cCs@|j}|j}|j}t|dkr*|s&|r*|S|j|||ddS)zThe logical parent of the path.r7NrO)rrrrRr)r#r1r2r0rrrparent<s zPurePath.parentcCst|S)z*A sequence of this path's logical parents.)r)r#rrrparentsFszPurePath.parentscCs|js dS|jj pt|jS)zSTrue if the path is absolute (has both a root and, if applicable, a drive).F)rrrsboolr)r#rrrrKszPurePath.is_absolutecCs|jj|jS)zaReturn True if the path contains one of the special names reserved by the system, if any.)rrcr)r#rrrrcRszPurePath.is_reservedc Cs|jj}||}|jj|f\}}}|s0td|rF|||jkrFdS|r\|||jkr\dS|j}|sj|rt|t|kr~dS|dd}nt|t|krdSx.tt |t |D]\}}t j ||sdSqWdS)zE Return True if this path matches the given pattern. z empty patternFr7NT) rr8r6rrrrrRzipr(rZ fnmatchcase) r#Z path_patternrr1r2Z pat_partsr0r4rrrrrWs( zPurePath.matchN)rrrrrrr)T)T)0r:r;r<r=rrr classmethodrrrrrrrrrerrrpropertyrrrrrrrrrdr2rrvrrrrrrr0rr r r r rrcrrrrrrs^            c@seZdZdZeZfZdS)rzPurePath subclass for non-Windows systems. On a POSIX system, instantiating a PurePath should return this object. However, you can also instantiate it directly on any system. N)r:r;r<r=_posix_flavourrrrrrrrusc@seZdZdZeZfZdS)rzPurePath subclass for Windows systems. On a Windows system, instantiating a PurePath should return this object. However, you can also instantiate it directly on any system. N)r:r;r<r=_windows_flavourrrrrrrrsc@seZdZdZdaZddZdbddZd d Zd d Zd dZ ddZ dcddZ ddddZ e ddZe ddZddZddZdd Zd!d"Zd#d$Zded&d'Zd(d)Zd*d+Zd,d-Zdgd0d1Zd2d3Zdhd4d5Zd6d7Zdid8d9Zdjd;d<Zdkd=d>Zd?d@Z dAdBZ!dCdDZ"dEdFZ#dGdHZ$dIdJZ%dKdLZ&dldMdNZ'dOdPZ(dQdRZ)dSdTZ*dUdVZ+dWdXZ,dYdZZ-d[d\Z.d]d^Z/d_d`Z0dS)mraPurePath subclass that can make system calls. Path represents a filesystem path but unlike PurePath, also offers methods to do system calls on path objects. Depending on your system, instantiating a Path will return either a PosixPath or a WindowsPath object. You can also instantiate a PosixPath or WindowsPath directly, but cannot instantiate a WindowsPath on a POSIX system or vice versa. r_closedcOsL|tkrtjdkrtnt}|j|dd}|jjs@td|j f|j |S)NrAF)rz$cannot instantiate %r on your system) rrlrvrrrrrwrr:r)rrkwargsr#rrrrs z Path.__new__NcCs"d|_|dk r|j|_nt|_dS)NF)rr_normal_accessor)r#templaterrrrs z Path._initcCs|j|g}|j|j|j|S)N)rrrr)r#r4r0rrrrs zPath._make_child_relpathcCs|jr|j|S)N)r _raise_closed)r#rrr __enter__szPath.__enter__cCs d|_dS)NT)r)r#tvtbrrr__exit__sz Path.__exit__cCs tddS)NzI/O operation on closed path)r)r#rrrrszPath._raise_closedcCs|jj|||S)N)rr)r#rvflagsrrrr_openersz Path._openercCs|jr|j|jj|||S)zm Open the file pointed by this path and return a file descriptor, as os.open() does. )rrrr)r#rrrrr _raw_openszPath._raw_opencCs |tjS)zjReturn a new path pointing to the current working directory (as returned by os.getcwd()). )rlr)rrrrcwdszPath.cwdcCs||jjdS)zrReturn a new path pointing to the user's home directory (as returned by os.path.expanduser('~')). N)rrr)rrrrhomesz Path.homec CsB|j}y |j}Wntk r2tj|}YnXtjj||S)zoReturn whether other_path is the same or not as this file (as returned by os.path.samefile()). )rrrlrhsamestat)r#Z other_pathstZother_strrrsamefiles  z Path.samefileccsL|jr|jx8|jj|D](}|dkr*q|j|V|jr|jqWdS)zyIterate over the files in this directory. Does not yield any result for the special paths '.' and '..'. r&..N>r&r')rrrrr)r#rvrrriterdirs z Path.iterdirccsl|stdj||jj|}|jj|f\}}}|s:|rBtdtt|}x|j|D] }|VqZWdS)zIterate over this subtree and yield all existing files (of any kind, including directories) matching the given pattern. zUnacceptable pattern: {!r}z%Non-relative patterns are unsupportedN) rrrr8r6rrrr)r#patternr1r2rselectorr[rrrglobs  z Path.globccs^|jj|}|jj|f\}}}|s(|r0tdtdt|}x|j|D] }|VqLWdS)zRecursively yield all existing files (of any kind, including directories) matching the given pattern, anywhere in this subtree. z%Non-relative patterns are unsupported**N)r,)rr8r6rrrr)r#r)r1r2rr*r[rrrrglobs z Path.rglobcCsD|jr|j|jr|S|jtjg|jdd}|j|d|S)aReturn an absolute version of this path. This function works even if the path doesn't point to anything. No normalization is done, i.e. all '.' and '..' will be kept along. Use resolve() to get the canonical path to a file. F)r)r)rrrrrlrrr)r#objrrrabsolutes z Path.absoluteFcCs|jr|jdd}y|jj||d}Wn,tk rV}z||WYdd}~XnX|j|f}|sy |jWn*tk r}z||WYdd}~XnX|S)z Make the path absolute, resolving all symlinks on the way and also normalizing it (for example turning slashes into backslashes under Windows). cSs0t|dd}|jtks|tkr,td|jdS)NwinerrorrzSymlink loop from %r)getattrerrnor_WINERROR_CANT_RESOLVE_FILENAMErofilename)er0rrr check_eloop*s z!Path.resolve..check_eloop)strictN)rrrrOSErrorrr)r#r7r6rZr5r[rrrresolve!s  z Path.resolvecCs |jj|S)zh Return the result of the stat() system call on this path, like os.stat() does. )rr)r#rrrr?sz Path.statcCsddl}|j|jjjS)z: Return the login name of the file owner. rN)r}r~rst_uidZpw_name)r#r}rrrownerFsz Path.ownercCsddl}|j|jjjS)z8 Return the group name of the file gid. rN)grpZgetgrgidrst_gidZgr_name)r#r<rrrgroupMsz Path.grouprr7c Cs,|jr|jtjt|||||||jdS)z| Open the file pointed by this path and return a file object, as the built-in open() function does. )opener)rriorrr)r#r bufferingencodingerrorsnewlinerrrrTsz Path.openc Cs |jdd }|jSQRXdS)zK Open the file in bytes mode, read it, and close the file. rb)rN)rread)r#rrrr read_bytes_szPath.read_bytesc Cs$|jd||d }|jSQRXdS)zJ Open the file in text mode, read it, and close the file. r?)rrCrDN)rrG)r#rCrDrrrr read_textfszPath.read_textc Cs*t|}|jdd }|j|SQRXdS)zO Open the file in bytes mode, write to it, and close the file. wb)rN) memoryviewrwrite)r#dataZviewrrrr write_bytesmszPath.write_bytesc Cs@t|tstd|jj|jd||d }|j|SQRXdS)zN Open the file in text mode, write to it, and close the file. zdata must be str, not %sw)rrCrDN)rrrrr:rrL)r#rMrCrDrrrr write_textvs   zPath.write_textTc Csr|jr|j|r>y|jj|dWntk r8YnXdStjtjB}|sX|tjO}|j ||}tj |dS)zS Create this file with the given access mode, if it doesn't exist. N) rrrrr8rlO_CREATO_WRONLYO_EXCLr!close)r#rexist_okrfdrrrtouchs   z Path.touchc Cs|jr|jy|jj||Wnjtk rf| s@|j|krB|jjddd|j|d|dYn&tk r| s|j rYnXdS)z< Create a new directory at this given path. T)r rUFN)rrrrFileNotFoundErrorr r8r)r#rr rUrrrrsz Path.mkdircCs |jr|j|jj||dS)zF Change the permissions of the path, like os.chmod(). N)rrrr)r#rrrrrsz Path.chmodcCs |jr|j|jj||dS)z Like chmod(), except if the path points to a symlink, the symlink's permissions are changed, rather than its target's. N)rrrr)r#rrrrrsz Path.lchmodcCs|jr|j|jj|dS)zd Remove this file or link. If the path is a directory, use rmdir() instead. N)rrrr)r#rrrrsz Path.unlinkcCs|jr|j|jj|dS)zF Remove this directory. The directory must be empty. N)rrrr)r#rrrrsz Path.rmdircCs|jr|j|jj|S)z Like stat(), except if the path points to a symlink, the symlink's status information is returned, rather than its target's. )rrrr)r#rrrrsz Path.lstatcCs |jr|j|jj||dS)z5 Rename this path to the given path. N)rrrr)r#targetrrrrsz Path.renamecCs |jr|j|jj||dS)zo Rename this path to the given path, clobbering the existing destination if it exists. N)rrrr))r#rYrrrr)sz Path.replacecCs"|jr|j|jj|||dS)z Make this path a symlink pointing to the given path. Note the order of arguments (self, target) is the reverse of os.symlink's. N)rrrr)r#rYrrrr symlink_toszPath.symlink_tocCsBy |jWn0tk r<}z|jttfkr.dSd}~XnXdS)z+ Whether this path exists. FNT)rr8r2rr)r#r5rrrrs z Path.existscCsDyt|jjStk r>}z|jttfkr0dSd}~XnXdS)z3 Whether this path is a directory. FN)r rst_moder8r2rr)r#r5rrrrs z Path.is_dircCsDyt|jjStk r>}z|jttfkr0dSd}~XnXdS)zq Whether this path is a regular file (also True for symlinks pointing to regular files). FN)r rr[r8r2rr)r#r5rrris_file s z Path.is_filecCsDyt|jjStk r>}z|jttfkr0dSd}~XnXdS)z7 Whether this path is a symbolic link. FN)r rr[r8r2rr)r#r5rrrrs zPath.is_symlinkcCsDyt|jjStk r>}z|jttfkr0dSd}~XnXdS)z6 Whether this path is a block device. FN)r rr[r8r2rr)r#r5rrris_block_device$s zPath.is_block_devicecCsDyt|jjStk r>}z|jttfkr0dSd}~XnXdS)z: Whether this path is a character device. FN)rrr[r8r2rr)r#r5rrris_char_device1s zPath.is_char_devicecCsDyt|jjStk r>}z|jttfkr0dSd}~XnXdS)z. Whether this path is a FIFO. FN)rrr[r8r2rr)r#r5rrris_fifo>s z Path.is_fifocCsDyt|jjStk r>}z|jttfkr0dSd}~XnXdS)z0 Whether this path is a socket. FN)r rr[r8r2rr)r#r5rrr is_socketKs zPath.is_socketcCsb|jp |j r^|jr^|jddddkr^|jj|jddd}|j|g|jddS|S)zl Return a new path with expanded ~ and ~user constructs (as returned by os.path.expanduser) rNr7~)rrrrrrr)r#ZhomedirrrrrXs zPath.expanduser)rr)N)r)r )FrO)r?rONNN)NN)NN)rT)r FF)F)1r:r;r<r=rrrrrrrrr!rr"r#r&r(r+r-r/r9rr;r>rrHrIrNrPrWrrrrrrrr)rZrrr\rr]r^r_r`rrrrrrs^                      c@seZdZdZfZdS)rzsPath subclass for non-Windows systems. On a POSIX system, instantiating a Path should return this object. N)r:r;r<r=rrrrrrdsc@s$eZdZdZfZddZddZdS)rzqPath subclass for Windows systems. On a Windows system, instantiating a Path should return this object. cCs tddS)Nz*Path.owner() is unsupported on this system)r)r#rrrr;rszWindowsPath.ownercCs tddS)Nz*Path.group() is unsupported on this system)r)r#rrrr>uszWindowsPath.groupN)r:r;r<r=rr;r>rrrrrks)>rrrArtrlrrr- collectionsr contextlibrr2rrrroperatorrrr r r r r rrZ urllib.parserrfZsupports_symlinks__all__Z_WINERROR_NOT_READYZ_WINERROR_INVALID_NAMEr3rrr r>r{rrrrrrrrrrrrrrrPathLikeregisterrrrrrrrrrsd   $  ? 6>  %f   [tracemalloc.cpython-36.opt-2.pyc000064400000036707152462730460012446 0ustar003 \A@sddlmZmZddlmZddlZddlZddlZddl Z ddl Tddl m Z m Z ddZ Gdd d ZGd d d Zd d ZeGdddZeGdddeZddZGdddZGdddeZddZGdddZGdddeZGdddeZGd d!d!Zd"d#ZdS)$)SequenceIterable)total_orderingN)*)_get_object_traceback _get_tracescCszxtd D]l}t|dkr:|dkr:|r.d||fSd||fSt|dksN|dkrj|r^d ||fSd ||fS|d }qWdS)NBKiBMiBGiBTiBdz%+.1f %sz%.1f %s iz%+.0f %sz%.0f %s)rr r r r i()abs)sizeZsignZunitr#/usr/lib64/python3.6/tracemalloc.py _format_size s     rc@s@eZdZdZddZddZdd Zd d Zd d ZddZ dS) Statistic tracebackrcountcCs||_||_||_dS)N)rrr)selfrrrrrr__init__%szStatistic.__init__cCst|j|j|jfS)N)hashrrr)rrrr__hash__*szStatistic.__hash__cCs$|j|jko"|j|jko"|j|jkS)N)rrr)rotherrrr__eq__-s  zStatistic.__eq__cCsBd|jt|jd|jf}|jr>|j|j}|dt|d7}|S)Nz%s: size=%s, count=%iFz , average=%s)rrrr)rtextaveragerrr__str__2s   zStatistic.__str__cCsd|j|j|jfS)Nz))rrr)rrrr__repr__<szStatistic.__repr__cCs|j|j|jfS)N)rrr)rrrr _sort_key@szStatistic._sort_keyN)rrr) __name__ __module__ __qualname__ __slots__rrrrr r!rrrrrs rc@s@eZdZdZddZdd Zd d Zd d ZddZddZ dS) StatisticDiffrr size_diffr count_diffcCs"||_||_||_||_||_dS)N)rrr'rr()rrrr'rr(rrrrKs zStatisticDiff.__init__cCst|j|j|j|j|jfS)N)rrrr'rr()rrrrrRszStatisticDiff.__hash__cCs<|j|jko:|j|jko:|j|jko:|j|jko:|j|jkS)N)rrr'rr()rrrrrrVs     zStatisticDiff.__eq__cCsPd|jt|jdt|jd|j|jf}|jrL|j|j}|dt|d7}|S)Nz %s: size=%s (%s), count=%i (%+i)FTz , average=%s)rrrr'rr()rrrrrrr]s    zStatisticDiff.__str__cCsd|j|j|j|j|jfS)Nz9)rrr'rr()rrrrr is zStatisticDiff.__repr__cCs t|j|jt|j|j|jfS)N)rr'rr(rr)rrrrr!ns  zStatisticDiff._sort_keyN)rrr'rr() r"r#r$r%rrrrr r!rrrrr&Ds r&cCsg}xp|jD]d\}}|j|d}|dk rPt||j|j|j|j|j|j}nt||j|j|j|j}|j|qWx6|jD]*\}}t|d|j d|j }|j|qW|S)Nr)itemspopr&rrappend) old_group new_group statisticsrstatZpreviousrrr_compare_grouped_statsts  r0c@sXeZdZdZddZeddZeddZdd Zd d Z d d Z ddZ ddZ dS)Frame_framecCs ||_dS)N)r2)rframerrrrszFrame.__init__cCs |jdS)Nr)r2)rrrrfilenameszFrame.filenamecCs |jdS)N)r2)rrrrlinenosz Frame.linenocCs |j|jkS)N)r2)rrrrrrsz Frame.__eq__cCs |j|jkS)N)r2)rrrrr__lt__sz Frame.__lt__cCs t|jS)N)rr2)rrrrrszFrame.__hash__cCsd|j|jfS)Nz%s:%s)r4r6)rrrrrsz Frame.__str__cCsd|j|jfS)Nz)r4r6)rrrrr szFrame.__repr__N)r2) r"r#r$r%rpropertyr4r6rr7rrr rrrrr1s  r1c@sbeZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ dddZ dS) Traceback_framescCstj|||_dS)N)rrr:)rframesrrrrs zTraceback.__init__cCs t|jS)N)lenr:)rrrr__len__szTraceback.__len__cCs4t|tr"tdd|j|DSt|j|SdS)Ncss|]}t|VqdS)N)r1).0tracerrr sz(Traceback.__getitem__..) isinstanceslicetupler:r1)rindexrrr __getitem__s zTraceback.__getitem__cCs |j|jkS)N)r2r:)rr3rrr __contains__szTraceback.__contains__cCs t|jS)N)rr:)rrrrrszTraceback.__hash__cCs |j|jkS)N)r:)rrrrrrszTraceback.__eq__cCs |j|jkS)N)r:)rrrrrr7szTraceback.__lt__cCs t|dS)Nr)str)rrrrrszTraceback.__str__cCsdt|fS)Nz)rC)rrrrr szTraceback.__repr__NcCsng}|dk r|dkr|SxP|d|D]@}|jd|j|jftj|j|jj}|r&|jd|q&W|S)Nrz File "%s", line %sz %s)r+r4r6 linecachegetlinestrip)rlimitlinesr3linerrrformatszTraceback.format)r:)N)r"r#r$r%rr=rErFrrr7rr rNrrrrr9sr9cCs t|}|dk rt|SdSdS)N)rr9)objr;rrrget_object_tracebacksrPc@s\eZdZdZddZeddZeddZedd Zd d Z d d Z ddZ ddZ dS)Trace_tracecCs ||_dS)N)rR)rr?rrrrszTrace.__init__cCs |jdS)Nr)rR)rrrrdomainsz Trace.domaincCs |jdS)Nr5)rR)rrrrrsz Trace.sizecCst|jdS)N)r9rR)rrrrrszTrace.tracebackcCs |j|jkS)N)rR)rrrrrrsz Trace.__eq__cCs t|jS)N)rrR)rrrrr szTrace.__hash__cCsd|jt|jdfS)Nz%s: %sF)rrr)rrrrr sz Trace.__str__cCsd|jt|jd|jfS)Nz'F)rSrrr)rrrrr szTrace.__repr__N)rR) r"r#r$r%rr8rSrrrrrr rrrrrQs   rQc@s<eZdZddZddZddZddZd d Zd d Zd S)_TracescCstj|||_dS)N)rr_traces)rtracesrrrrs z_Traces.__init__cCs t|jS)N)r<rV)rrrrr=sz_Traces.__len__cCs4t|tr"tdd|j|DSt|j|SdS)Ncss|]}t|VqdS)N)rQ)r>r?rrrr@ sz&_Traces.__getitem__..)rArBrCrVrQ)rrDrrrrEs z_Traces.__getitem__cCs |j|jkS)N)rRrV)rr?rrrrF$sz_Traces.__contains__cCs |j|jkS)N)rV)rrrrrr'sz_Traces.__eq__cCs dt|S)Nz)r<)rrrrr *sz_Traces.__repr__N) r"r#r$rr=rErFrr rrrrrUs rUcCs&tjj|}|jdr"|dd}|S)Nz.pycr5)ospathnormcaseendswith)r4rrr_normalize_filename.s   r]c@seZdZddZddZdS) BaseFiltercCs ||_dS)N) inclusive)rr_rrrr6szBaseFilter.__init__cCstdS)N)NotImplementedError)rr?rrr_match9szBaseFilter._matchN)r"r#r$rrarrrrr^5sr^csJeZdZdfdd ZeddZddZd d Zd d Zd dZ Z S)FilterNFcs2tj|||_t||_||_||_||_dS)N)superrr_r]_filename_patternr6 all_framesrS)rr_filename_patternr6rerS) __class__rrr>s   zFilter.__init__cCs|jS)N)rd)rrrrrfGszFilter.filename_patterncCs6t|}tj||jsdS|jdkr(dS||jkSdS)NFT)r]fnmatchrdr6)rr4r6rrr_match_frame_implKs  zFilter._match_frame_implcCs|j|||j AS)N)rir_)rr4r6rrr _match_frameTszFilter._match_framecsHjr,tfdd|Dr"jSj Sn|d\}}j||SdS)Nc3s|]\}}j||VqdS)N)ri)r>r4r6)rrrr@Ysz*Filter._match_traceback..r)reanyr_rj)rrr4r6r)rr_match_tracebackWs    zFilter._match_tracebackcCsD|\}}}|j|}|jdk r@|jr2|o0||jkS|p>||jkS|S)N)rlrSr_)rr?rSrrresrrrrabs   z Filter._match)NFN) r"r#r$rr8rfrirjrlra __classcell__rr)rgrrb=s    rbcs0eZdZfddZeddZddZZS) DomainFiltercstj|||_dS)N)rcr_domain)rr_rS)rgrrrns zDomainFilter.__init__cCs|jS)N)rp)rrrrrSrszDomainFilter.domaincCs|\}}}||jk|j AS)N)rSr_)rr?rSrrrrrravs zDomainFilter._match)r"r#r$rr8rSrarnrr)rgrroms  roc@sTeZdZddZddZeddZddZd d Zd d Z dddZ dddZ dS)SnapshotcCst||_||_dS)N)rUrWtraceback_limit)rrWrrrrrrs zSnapshot.__init__c Cs*t|d}tj||tjWdQRXdS)Nwb)openpickledumpZHIGHEST_PROTOCOL)rr4fprrrrvs z Snapshot.dumpc Cs t|d }tj|SQRXdS)Nrb)rtruload)r4rwrrrrys z Snapshot.loadcs@|rtfdd|DsdS|r trace_filter)r?rrr@sz)Snapshot._filter_trace..Fc3s|]}|j VqdS)N)ra)r>rz)r?rrr@sT)rk)rinclude_filtersexclude_filtersr?r)r?r _filter_traces    zSnapshot._filter_tracecst|tstdt|j|rnggx(|D] }|jrDj|q.j|q.WfddjjD}n jjj }t |j S)Nz)filters must be a list of filters, not %scsg|]}j|r|qSr)r})r>r?)r|r{rrr sz*Snapshot.filter_traces..) rAr TypeErrortyper"r_r+rWrVcopyrqrr)rfiltersrzZ new_tracesr)r|r{rr filter_tracess    zSnapshot.filter_tracesc Cs|dkrtd|f|r.|d kr.td|i}i}|sx|jjD]}|\}}}y ||} WnZtk r|dkr~|} n(|dkr|dd} n|dddff} t| } | ||<YnXy(|| } | j|7_| jd7_WqFtk r t| |d|| <YqFXqFWnx|jjD]}|\}}}x|D]} y || } WnFtk r|dkrd| f} n| ddff} t| } | || <YnXy(|| } | j|7_| jd7_Wn&tk rt| |d|| <YnXq0WqW|S) Nrr4r6zunknown key_type: %rz/cumulative mode cannot by used with key type %rr5r)rr4r6)r6r4) ValueErrorrWrVKeyErrorr9rrr) rkey_type cumulativeZstatsZ tracebacksr?rSrZtrace_tracebackrr;r/r3rrr _group_bysX       "zSnapshot._group_byFcCs,|j||}t|j}|jdtjd|S)NT)reversekey)rlistvaluessortrr!)rrrZgroupedr.rrrr.s  zSnapshot.statisticscCs6|j||}|j||}t||}|jdtjd|S)NT)rr)rr0rr&r!)rZ old_snapshotrrr-r,r.rrr compare_tos    zSnapshot.compare_toN)F)F) r"r#r$rrv staticmethodryr}rrr.rrrrrrq{s  3 rqcCs$tstdt}t}t||S)NzLthe tracemalloc module must be tracing memory allocations to take a snapshot)Z is_tracing RuntimeErrorrZget_traceback_limitrq)rWrrrrr take_snapshots r) collectionsrr functoolsrrhrHZos.pathrYruZ _tracemallocrrrrr&r0r1r9rPrQrUr]r^rbrorqrrrrrs0 &0# 5%0 statistics.cpython-36.opt-1.pyc000064400000043017152462730460012341 0ustar003 \P @sDdZddddddddd d d d g Zd dlZd dlZd dlZd dlZd dlmZd dlmZd dl m Z m Z d dl m Z mZGdddeZd5ddZddZddZddZddZddZd d!Zd"d#Zd6d%d&Zd'd Zd(d Zd)dZd*dZd+dZd7d-d Zd.d Z d8d/d0Z!d9d1dZ"d:d2dZ#d;d3dZ$d>> mean([-1.0, 2.5, 3.25, 5.75]) 2.625 Calculate the standard median of discrete data: >>> median([2, 3, 4, 5]) 3.5 Calculate the median, or 50th percentile, of data grouped into class intervals centred on the data values provided. E.g. if your data points are rounded to the nearest whole number: >>> median_grouped([2, 2, 3, 3, 3, 4]) #doctest: +ELLIPSIS 2.8333333333... This should be interpreted in this way: you have two data points in the class interval 1.5-2.5, three data points in the class interval 2.5-3.5, and one in the class interval 3.5-4.5. The median of these data points is 2.8333... Calculating variability or spread --------------------------------- ================== ============================================= Function Description ================== ============================================= pvariance Population variance of data. variance Sample variance of data. pstdev Population standard deviation of data. stdev Sample standard deviation of data. ================== ============================================= Calculate the standard deviation of sample data: >>> stdev([2.5, 3.25, 5.5, 11.25, 11.75]) #doctest: +ELLIPSIS 4.38961843444... If you have previously calculated the mean, you can pass it as the optional second argument to the four "spread" functions to avoid recalculating it: >>> data = [1, 2, 2, 4, 4, 4, 5, 6] >>> mu = mean(data) >>> pvariance(data, mu) 2.5 Exceptions ---------- A single exception is defined: StatisticsError is a subclass of ValueError. StatisticsErrorpstdev pvariancestdevvariancemedian median_low median_highmedian_groupedmeanmode harmonic_meanN)Fraction)Decimal)groupbychain) bisect_left bisect_rightc@s eZdZdS)rN)__name__ __module__ __qualname__rr"/usr/lib64/python3.6/statistics.pyrcsc Csd}t|\}}||i}|j}ttt|}xRt|tD]D\}} t||}x0tt| D]"\}}|d7}||d|||<qVWq8Wd|kr|d} ntddt|j D} || |fS)aC_sum(data [, start]) -> (type, sum, count) Return a high-precision sum of the given numeric data as a fraction, together with the type to be converted to and the count of items. If optional argument ``start`` is given, it is added to the total. If ``data`` is empty, ``start`` (defaulting to 0) is returned. Examples -------- >>> _sum([3, 2.25, 4.5, -0.5, 1.0], 0.75) (, Fraction(11, 1), 5) Some sources of round-off error will be avoided: # Built-in sum returns zero. >>> _sum([1e50, 1, -1e50] * 1000) (, Fraction(1000, 1), 3000) Fractions and Decimals are also supported: >>> from fractions import Fraction as F >>> _sum([F(2, 3), F(7, 5), F(1, 4), F(5, 6)]) (, Fraction(63, 20), 4) >>> from decimal import Decimal as D >>> data = [D("0.1375"), D("0.2108"), D("0.3061"), D("0.0419")] >>> _sum(data) (, Fraction(6963, 10000), 4) Mixed types are currently treated as an error, except that int is allowed. r Ncss|]\}}t||VqdS)N)r).0dnrrr sz_sum..) _exact_ratioget_coerceinttypermapsumsorteditems) datastartcountrrZpartialsZ partials_getTtypvaluestotalrrr_sumis$  r.c Cs(y|jStk r"tj|SXdS)N)Z is_finiteAttributeErrormathZisfinite)xrrr _isfinitesr2cCs||kr |S|tks|tkr |S|tkr,|St||r:|St||rH|St|trV|St|trd|St|tr|t|tr||St|trt|tr|Sd}t||j|jfdS)zCoerce types T and S to a common type, or raise TypeError. Coercion rules are currently an implementation detail. See the CoerceTest test class in test_statistics for details. z"don't know how to coerce %s and %sN)r!bool issubclassrfloat TypeErrorr)r*Smsgrrrr s(     r cCsydt|tkst|tkr"|jSy |j|jfStk r`y|jStk rZYnXYnXWnttfk r|dfSXd}t |j t|j dS)zReturn Real number x to exact (numerator, denominator) pair. >>> _exact_ratio(0.25) (1, 4) x is expected to be an int, Fraction, Decimal or float. Nz0can't convert type '{}' to numerator/denominator) r"r5ras_integer_ratio numerator denominatorr/ OverflowError ValueErrorr6formatr)r1r8rrrrs  rc Csjt||kr|St|tr(|jdkr(t}y||Stk rdt|tr^||j||jSYnXdS)z&Convert value to given numeric type T.rN)r"r4r!r;r5r6rr:)valuer*rrr_converts  r@cCs`tjt|j}|s|S|dd}x4tdt|D]"}||d|kr6|d|}Pq6W|S)Nr r) collectionsCounteriter most_commonrangelen)r'tableZmaxfreqirrr_countss  rIcCs.t||}|t|kr&|||kr&|StdS)z,Locate the leftmost value exactly equal to xN)rrFr=)ar1rHrrr _find_lteq s rKcCs>t|||d}|t|dkr6||d|kr6|dStdS)z-Locate the rightmost value exactly equal to x)lorN)rrFr=)rJlr1rHrrr _find_rteqs rNnegative valueccs(x"|D]}|dkrt||VqWdS)z7Iterate over values, failing if any are less than zero.r N)r)r,errmsgr1rrr _fail_negs rQcCsHt||krt|}t|}|dkr,tdt|\}}}t|||S)aReturn the sample arithmetic mean of data. >>> mean([1, 2, 3, 4, 4]) 2.8 >>> from fractions import Fraction as F >>> mean([F(3, 7), F(1, 21), F(5, 3), F(1, 3)]) Fraction(13, 21) >>> from decimal import Decimal as D >>> mean([D("0.5"), D("0.75"), D("0.625"), D("0.375")]) Decimal('0.5625') If ``data`` is empty, StatisticsError will be raised. rz%mean requires at least one data point)rClistrFrr.r@)r'rr*r-r)rrrr #s c Cst||krt|}d}t|}|dkr2tdn<|dkrn|d}t|tjtfrf|dkrbt||Stdy"t ddt ||D\}}}Wnt k rdSXt |||S)aReturn the harmonic mean of data. The harmonic mean, sometimes called the subcontrary mean, is the reciprocal of the arithmetic mean of the reciprocals of the data, and is often appropriate when averaging quantities which are rates or ratios, for example speeds. Example: Suppose an investor purchases an equal value of shares in each of three companies, with P/E (price/earning) ratios of 2.5, 3 and 10. What is the average P/E ratio for the investor's portfolio? >>> harmonic_mean([2.5, 3, 10]) # For an equal investment portfolio. 3.6 Using the arithmetic mean would give an average of about 5.167, which is too high. If ``data`` is empty, or any element is less than zero, ``harmonic_mean`` will raise ``StatisticsError``. z.harmonic mean does not support negative valuesrz.harmonic_mean requires at least one data pointr zunsupported typecss|]}d|VqdS)rNr)rr1rrrrdsz harmonic_mean..) rCrRrFr isinstancenumbersZRealrr6r.rQZeroDivisionErrorr@)r'rPrr1r*r-r)rrrr =s$  "cCs\t|}t|}|dkr td|ddkr8||dS|d}||d||dSdS)aBReturn the median (middle value) of numeric data. When the number of data points is odd, return the middle data point. When the number of data points is even, the median is interpolated by taking the average of the two middle values: >>> median([1, 3, 5]) 3 >>> median([1, 3, 5, 7]) 4.0 r zno median for empty datarN)r%rFr)r'rrHrrrrls   cCsLt|}t|}|dkr td|ddkr8||dS||ddSdS)a Return the low median of numeric data. When the number of data points is odd, the middle value is returned. When it is even, the smaller of the two middle values is returned. >>> median_low([1, 3, 5]) 3 >>> median_low([1, 3, 5, 7]) 3 r zno median for empty datarVrN)r%rFr)r'rrrrrs   cCs,t|}t|}|dkr td||dS)aReturn the high median of data. When the number of data points is odd, the middle value is returned. When it is even, the larger of the two middle values is returned. >>> median_high([1, 3, 5]) 3 >>> median_high([1, 3, 5, 7]) 5 r zno median for empty datarV)r%rFr)r'rrrrrs rc Cst|}t|}|dkr"tdn|dkr2|dS||d}x*||fD]}t|ttfrHtd|qHWy||d}Wn(tk rt|t|d}YnXt||}t |||}|}||d} |||d|| S)aReturn the 50th percentile (median) of grouped continuous data. >>> median_grouped([1, 2, 2, 3, 4, 4, 4, 4, 4, 5]) 3.7 >>> median_grouped([52, 52, 53, 54]) 52.5 This calculates the median as the 50th percentile, and should be used when your data is continuous and grouped. In the above example, the values 1, 2, 3, etc. actually represent the midpoint of classes 0.5-1.5, 1.5-2.5, 2.5-3.5, etc. The middle value falls somewhere in class 3.5-4.5, and interpolation is used to estimate it. Optional argument ``interval`` represents the class interval, and defaults to 1. Changing the class interval naturally will change the interpolated 50th percentile value: >>> median_grouped([1, 3, 3, 5, 7], interval=1) 3.25 >>> median_grouped([1, 3, 3, 5, 7], interval=2) 3.5 This function does not check whether the data points are at least ``interval`` apart. r zno median for empty datarrVzexpected number but got %r) r%rFrrSstrbytesr6r5rKrN) r'Zintervalrr1objLl1l2Zcffrrrr s&     cCsBt|}t|dkr |ddS|r6tdt|ntddS)aReturn the most common data point from discrete or nominal data. ``mode`` assumes discrete data, and returns a single value. This is the standard treatment of the mode as commonly taught in schools: >>> mode([1, 1, 2, 3, 3, 3, 3, 4]) 3 This also works with nominal (non-numeric) data: >>> mode(["red", "blue", "blue", "red", "green", "red", "red"]) 'red' If there is not exactly one most common value, ``mode`` will raise StatisticsError. rr z.no unique mode; found %d equally common valueszno mode for empty dataN)rIrFr)r'rGrrrr s  csddkrt|tfdd|D\}}}tfdd|D\}}}||dt|8}||fS)a;Return sum of square deviations of sequence data. If ``c`` is None, the mean is calculated in one pass, and the deviations from the mean are calculated in a second pass. Otherwise, deviations are calculated from ``c`` as given. Use the second case with care, as it can lead to garbage results. Nc3s|]}|dVqdS)rVNr)rr1)crrrsz_ss..c3s|]}|VqdS)Nr)rr1)r^rrrsrV)r r.rF)r'r^r*r-r)UZtotal2Zcount2r)r^r_sss r`cCsLt||krt|}t|}|dkr,tdt||\}}t||d|S)aReturn the sample variance of data. data should be an iterable of Real-valued numbers, with at least two values. The optional argument xbar, if given, should be the mean of the data. If it is missing or None, the mean is automatically calculated. Use this function when your data is a sample from a population. To calculate the variance from the entire population, see ``pvariance``. Examples: >>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5] >>> variance(data) 1.3720238095238095 If you have already calculated the mean of your data, you can pass it as the optional second argument ``xbar`` to avoid recalculating it: >>> m = mean(data) >>> variance(data, m) 1.3720238095238095 This function does not check that ``xbar`` is actually the mean of ``data``. Giving arbitrary values for ``xbar`` may lead to invalid or impossible results. Decimals and Fractions are supported: >>> from decimal import Decimal as D >>> variance([D("27.5"), D("30.25"), D("30.25"), D("34.5"), D("41.75")]) Decimal('31.01875') >>> from fractions import Fraction as F >>> variance([F(1, 6), F(1, 2), F(5, 3)]) Fraction(67, 108) rVz*variance requires at least two data pointsr)rCrRrFrr`r@)r'xbarrr*ssrrrr"s& cCsHt||krt|}t|}|dkr,tdt||\}}t|||S)aReturn the population variance of ``data``. data should be an iterable of Real-valued numbers, with at least one value. The optional argument mu, if given, should be the mean of the data. If it is missing or None, the mean is automatically calculated. Use this function to calculate the variance from the entire population. To estimate the variance from a sample, the ``variance`` function is usually a better choice. Examples: >>> data = [0.0, 0.25, 0.25, 1.25, 1.5, 1.75, 2.75, 3.25] >>> pvariance(data) 1.25 If you have already calculated the mean of the data, you can pass it as the optional second argument to avoid recalculating it: >>> mu = mean(data) >>> pvariance(data, mu) 1.25 This function does not check that ``mu`` is actually the mean of ``data``. Giving arbitrary values for ``mu`` may lead to invalid or impossible results. Decimals and Fractions are supported: >>> from decimal import Decimal as D >>> pvariance([D("27.5"), D("30.25"), D("30.25"), D("34.5"), D("41.75")]) Decimal('24.815') >>> from fractions import Fraction as F >>> pvariance([F(1, 4), F(5, 4), F(1, 2)]) Fraction(13, 72) rz*pvariance requires at least one data point)rCrRrFrr`r@)r'murr*rbrrrrQs' c Cs2t||}y|jStk r,tj|SXdS)zReturn the square root of the sample variance. See ``variance`` for arguments and other details. >>> stdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75]) 1.0810874155219827 N)rsqrtr/r0)r'ravarrrrrs c Cs2t||}y|jStk r,tj|SXdS)zReturn the square root of the population variance. See ``pvariance`` for arguments and other details. >>> pstdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75]) 0.986893273527251 N)rrdr/r0)r'rcrerrrrs )r )rO)r)N)N)N)N)N)&__doc____all__rAZdecimalr0rTZ fractionsrr itertoolsrrZbisectrrr=rr.r2r rr@rIrKrNrQr r rrrr r r`rrrrrrrrMsD    :  / 7*  / 0 smtplib.cpython-36.opt-1.pyc000064400000104721152462730460011621 0ustar003 \ @sndZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl mZdddddd d d d d ddg ZdZdZdZdZdZejdejZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdd d eZ Gdd d eZ!Gdd d eZ"Gd d d eZ#d!d Z$d"d#Z%d$dZ&d%d&Z'd'd(Z(y ddl)Z)Wne*k rd)Z+YnXd*Z+Gd+ddZ,e+rGd,d-d-e,Z-ej.d-d.Z/Gd/d0d0e,Z0e1d1krjd2d3Z2e2d4Z3e2d5j4d6Z5e6d7d8Z7x e j8j9Z:e:s$Pe7e:Z7qWe6d9e;e7e,d:Ze3e5e7e>> import smtplib >>> s=smtplib.SMTP("localhost") >>> print(s.help()) This is Sendmail version 8.8.4 Topics: HELO EHLO MAIL RCPT DATA RSET NOOP QUIT HELP VRFY EXPN VERB ETRN DSN For more info use "HELP ". To report bugs in the implementation send email to sendmail-bugs@sendmail.org. For local information send email to Postmaster at your site. End of HELP info >>> s.putcmd("vrfy","someone@here") >>> s.getreply() (250, "Somebody OverHere ") >>> s.quit() N) body_encode SMTPExceptionSMTPServerDisconnectedSMTPResponseExceptionSMTPSenderRefusedSMTPRecipientsRefused SMTPDataErrorSMTPConnectError SMTPHeloErrorSMTPAuthenticationError quoteaddr quotedataSMTPiz s i z auth=(.*)c@seZdZdZdS)rz4Base class for all exceptions raised by this module.N)__name__ __module__ __qualname____doc__rr/usr/lib64/python3.6/smtplib.pyrGsc@seZdZdZdS)SMTPNotSupportedErrorzThe command or option is not supported by the SMTP server. This exception is raised when an attempt is made to run a command or a command with an option which is not supported by the server. N)rrrrrrrrrJsrc@seZdZdZdS)rzNot connected to any SMTP server. This exception is raised when the server unexpectedly disconnects, or when an attempt is made to use the SMTP instance before connecting it to a server. N)rrrrrrrrrQsc@seZdZdZddZdS)ra2Base class for all exceptions that include an SMTP error code. These exceptions are generated in some instances when the SMTP server returns an error code. The error code is stored in the `smtp_code' attribute of the error, and the `smtp_error' attribute is set to the error message. cCs||_||_||f|_dS)N) smtp_code smtp_errorargs)selfcodemsgrrr__init__bszSMTPResponseException.__init__N)rrrrrrrrrrYsc@seZdZdZddZdS)rzSender address refused. In addition to the attributes set by on all SMTPResponseException exceptions, this sets `sender' to the string that the SMTP refused. cCs"||_||_||_|||f|_dS)N)rrsenderr)rrrrrrrrnszSMTPSenderRefused.__init__N)rrrrrrrrrrgsc@seZdZdZddZdS)rzAll recipient addresses refused. The errors for each recipient are accessible through the attribute 'recipients', which is a dictionary of exactly the same sort as SMTP.sendmail() returns. cCs||_|f|_dS)N) recipientsr)rrrrrr|szSMTPRecipientsRefused.__init__N)rrrrrrrrrrtsc@seZdZdZdS)rz'The SMTP server didn't accept the data.N)rrrrrrrrrsc@seZdZdZdS)r z&Error during connection establishment.N)rrrrrrrrr sc@seZdZdZdS)r z"The server refused our HELO reply.N)rrrrrrrrr sc@seZdZdZdS)r zvAuthentication error. Most probably the server didn't accept the username/password combination provided. N)rrrrrrrrr scCs>tjj|\}}||fdkr6|jjdr.|Sd|Sd|S)zQuote a subset of the email addresses defined by RFC 821. Should be able to handle anything email.utils.parseaddr can handle. )r r )emailutils parseaddrstrip startswith) addrstring displaynameaddrrrrr s  cCs$tjj|\}}||fdkr |S|S)Nr )r r )r"r#r$)r'r(r)rrr _addr_onlys r*cCstjddtjdt|S)zQuote data for email. Double leading '.', and change Unix newline '\n', or Mac '\r' into Internet CRLF end-of-line. z(?m)^\.z..z(?:\r\n|\n|\r(?!\n)))resubCRLF)datarrrr scCstjdd|S)Ns(?m)^\.s..)r+r,)Zbindatarrr_quote_periodssr/cCstjdt|S)Nz(?:\r\n|\n|\r(?!\n)))r+r,r-)r.rrr _fix_eolssr0FTc@seZdZdZdZdZdZdZdZdZ e Z ddde j dfddZdd Zd d Zd d ZddZddZdMddZddZdNddZddZdOddZdPddZdQdd Zd!d"ZdRd#d$Zd%d&Zd'd(Zd)d*Zffd+d,Z ffd-d.Z!d/d0Z"d1d2Z#e#Z$d3d4Z%d5d6Z&d7d8d9d:Z'dSd;d<Z(dTd=d>Z)dUd?d@Z*d7d8dAdBZ+dVdCdDZ,fffdEdFZ-ddfffdGdHZ.dIdJZ/dKdLZ0dS)WraThis class manages a connection to an SMTP or ESMTP server. SMTP Objects: SMTP objects have the following attributes: helo_resp This is the message given by the server in response to the most recent HELO command. ehlo_resp This is the message given by the server in response to the most recent EHLO command. This is usually multiline. does_esmtp This is a True value _after you do an EHLO command_, if the server supports ESMTP. esmtp_features This is a dictionary, which, if the server supports ESMTP, will _after you do an EHLO command_, contain the names of the SMTP service extensions this server supports, and their parameters (if any). Note, all extension names are mapped to lower case in the dictionary. See each method's docstrings for details. In general, there is a method of the same name to perform each SMTP command. There is also a method called 'sendmail' that will do an entire mail transaction. rNehlor c Cs||_||_i|_d|_||_|rL|j||\}}|dkrL|jt|||dk r\||_nPt j }d|krt||_n8d} yt j t j } Wnt j k rYnXd| |_dS)aInitialize a new instance. If specified, `host' is the name of the remote host to which to connect. If specified, `port' specifies the port to which to connect. By default, smtplib.SMTP_PORT is used. If a host is specified the connect method is called, and if it returns anything other than a success code an SMTPConnectError is raised. If specified, `local_hostname` is used as the FQDN of the local host in the HELO/EHLO command. Otherwise, the local hostname is found using socket.getfqdn(). The `source_address` parameter takes a 2-tuple (host, port) for the socket to bind to as its source address before connecting. If the host is '' and port is 0, the OS default behavior will be used. asciiN.z 127.0.0.1z[%s])_hosttimeoutesmtp_featurescommand_encodingsource_addressconnectcloser local_hostnamesocketZgetfqdnZ gethostbynameZ gethostnameZgaierror) rhostportr<r6r9rrZfqdnr)rrrrs* z SMTP.__init__cCs|S)Nr)rrrr __enter__szSMTP.__enter__cGsNz>y$|jd\}}|dkr$t||Wntk r:YnXWd|jXdS)NZQUIT)docmdrrr;)rrrmessagerrr__exit__s z SMTP.__exit__cCs ||_dS)zSet the debug output level. A non-false value results in debug messages for connection and for all messages sent to and received from the server. N) debuglevel)rrErrrset_debuglevelszSMTP.set_debuglevelcGs@|jdkr,ttjjjf|dtjint|dtjidS)Nfile)rEprintdatetimeZnowZtimesysstderr)rrrrr _print_debug's "zSMTP._print_debugcCs2|jdkr|jd||f|jtj||f||jS)Nrz connect: to)rErMr9r=create_connection)rr>r?r6rrr _get_socket-s  zSMTP._get_socket localhostc Cs|r ||_| r~|jd|jdkr~|jd}|dkr~|d|||dd}}y t|}Wntk r|tdYnX|s|j}|jdkr|jd||f|j |||j |_ d|_ |j \}}|jdkr|jdt|||fS)apConnect to a host on a given port. If the hostname ends with a colon (`:') followed by a number, and there is no port specified, that suffix will be stripped off and the number interpreted as the port number to use. Note: This method is automatically invoked by __init__, if a host is specified during instantiation. :rNrGznonnumeric portzconnect:)r9findrfindint ValueErrorOSError default_portrErMrOr6sockrHgetreplyrepr)rr>r?r9irrrrrr:5s(      z SMTP.connectc Cs|jdkr|jdt|t|drx|jrxt|tr@|j|j}y|jj |Wqt k rt|j t dYqXnt ddS)zSend `s' to the server.rzsend:rXzServer not connectedzplease run connect() firstN) rErMrZhasattrrX isinstancestrencoder8ZsendallrVr;r)rsrrrsendWs   z SMTP.sendcCs2|dkrd|tf}nd||tf}|j|dS)zSend a command to the server.r z%s%sz%s %s%sN)r-ra)rcmdrr^rrrputcmdisz SMTP.putcmdcCsPg}|jdkr|jjd|_xy|jjtd}Wn:tk rn}z|jtdt|WYdd}~XnX|s|jtd|j dkr|j dt |t |tkr|jt dd |j|d djd |dd }y t|}Wntk rd}PYnX|d d d kr Pq Wdj|}|j dkrH|j d||f||fS)aGet a reply from the server. Returns a tuple consisting of: - server response code (e.g. '250', or such, if all goes well) Note: returns -1 if it can't read response code. - server response string corresponding to response code (multiline responses are converted to a single, multiline string). Raises SMTPServerDisconnected if end-of-file is reached. NrbrGz Connection unexpectedly closed: zConnection unexpectedly closedrzreply:izLine too long.s - zreply: retcode (%s); Msg: %a)rHrXmakefilereadline_MAXLINErVr;rr^rErMrZlenrappendr%rTrUjoin)rresplineerZerrcodeerrmsgrrrrYqs>         z SMTP.getreplycCs|j|||jS)z-Send a command, and return its response code.)rcrY)rrbrrrrrBs z SMTP.docmdcCs,|jd|p|j|j\}}||_||fS)zwSMTP 'helo' command. Hostname to send for this command defaults to the FQDN of the local host. helo)rcr<rY helo_resp)rnamerrrrrrts z SMTP.heloc Cs2i|_|j|j|p|j|j\}}|d krJt|dkrJ|jtd||_|dkr`||fSd|_ |jj dj d}|d=x|D]}t j |}|r|jjddd |jdd|jd<qtj d |}|r|jd j}|j|jd d j} |dkr|jj|dd | |j|<q| |j|<qW||fS)zx SMTP 'ehlo' command. Hostname to send for this command defaults to the FQDN of the local host. rGrzServer not connectedzlatin-1 authr  z((?P[A-Za-z0-9][A-Za-z0-9\-]*) ?featureNri)r7rcehlo_msgr<rYrmr;r ehlo_resp does_esmtpdecodesplit OLDSTYLE_AUTHmatchgetgroupsr+grouplowerstringendr%) rrvrrrpeachZ auth_matchmr{Zparamsrrrr1s2   &  z SMTP.ehlocCs|j|jkS)z7Does the server support a given SMTP service extension?)rr7)roptrrrhas_extnsz SMTP.has_extncCs|jd||jdS)z;SMTP 'help' command. Returns help text from server.helprG)rcrY)rrrrrrs z SMTP.helpcCsd|_|jdS)z&SMTP 'rset' command -- resets session.r2rset)r8rB)rrrrrsz SMTP.rsetc Cs&y |jWntk r YnXdS)aInternal 'rset' command which ignores any SMTPServerDisconnected error. Used internally in the library, since the server disconnected error should appear to the application when the *next* command is issued, if we are doing an internal "safety" reset. N)rr)rrrr_rsets z SMTP._rsetcCs |jdS)z-SMTP 'noop' command -- doesn't do anything :>noop)rB)rrrrrsz SMTP.noopcCshd}|rH|jrHtdd|Dr:|jdr2d|_ntdddj|}|jdd t||f|jS) a8SMTP 'mail' command -- begins mail xfer session. This method may raise the following exceptions: SMTPNotSupportedError The options parameter includes 'SMTPUTF8' but the SMTPUTF8 extension is not supported by the server. r css|]}|jdkVqdS)smtputf8N)r).0xrrr szSMTP.mail..rzutf-8z SMTPUTF8 not supported by serverrzmailz FROM:%s%s) r~anyrr8rrorcr rY)rroptions optionlistrrrrs   z SMTP.mailcCs<d}|r|jrddj|}|jddt||f|jS)z;SMTP 'rcpt' command -- indicates 1 recipient for this mail.r rzrcptzTO:%s%s)r~rorcr rY)rZreciprrrrrrs  z SMTP.rcptcCs|jd|j\}}|jdkr0|jd||f|dkrDt||n|t|tr\t|jd}t |}|d dt kr||t }|dt }|j ||j\}}|jdkr|jd||f||fSdS) aSMTP 'DATA' command -- sends message data to server. Automatically quotes lines beginning with a period per rfc821. Raises SMTPDataError if there is an unexpected reply to the DATA command; the return value from this method is the final response code received when the all data is sent. If msg is a string, lone '\r' and '\n' characters are converted to '\r\n' characters. If msg is bytes, it is transmitted as is. r.rzdata:ibr2N.) rcrYrErMrr]r^r0r_r/bCRLFra)rrrreplqrrrr.!s"         z SMTP.datacCs|jdt||jS)z5SMTP 'verify' command -- checks for address validity.vrfy)rcr*rY)raddressrrrverify>sz SMTP.verifycCs|jdt||jS)z.SMTP 'expn' command -- expands a mailing list.expn)rcr*rY)rrrrrrEsz SMTP.expncCsf|jdkrb|jdkrbd|jdko.dknsb|j\}}d|koRdknsbt||dS)abCall self.ehlo() and/or self.helo() if needed. If there has been no previous EHLO or HELO command this session, this method tries ESMTP EHLO first. This method may raise the following exceptions: SMTPHeloError The server didn't reply properly to the helo greeting. Nri+)rur}r1rtr )rrrprrrehlo_or_helo_if_neededLs   zSMTP.ehlo_or_helo_if_neededT)initial_response_okc Cs|j}|r|nd}|dk rJt|jddd}|jd|d|\}}n|jd|\}}|dkrtj|}t||jddd}|j|\}}|d kr||fSt||dS) aAuthentication command - requires response processing. 'mechanism' specifies which authentication mechanism is to be used - the valid values are those listed in the 'auth' element of 'esmtp_features'. 'authobject' must be a callable object taking a single argument: data = authobject(challenge) It will be called to process the server's challenge response; the challenge argument it is passed will be a bytes. It should return an ASCII string that will be base64 encoded and sent to the server. Keyword arguments: - initial_response_ok: Allow sending the RFC 4954 initial-response to the AUTH command, if the authentication methods supports it. Nr2r )ZeolZAUTHrziN)rr)upper encode_base64r_rBbase64Z decodebytesr ) rZ mechanismZ authobjectrZinitial_responseZresponserrp challengerrrry]s z SMTP.authcCs0|dkr dS|jdtj|jjd|djS)zh Authobject to use with CRAM-MD5 authentication. Requires self.user and self.password to be set.Nrzr2Zmd5)userhmacZHMACpasswordr_Z hexdigest)rrrrr auth_cram_md5s zSMTP.auth_cram_md5cCsd|j|jfS)ze Authobject to use with PLAIN authentication. Requires self.user and self.password to be set.z%s%s)rr)rrrrr auth_plainszSMTP.auth_plaincCs|dkr|jS|jSdS)ze Authobject to use with LOGIN authentication. Requires self.user and self.password to be set.N)rr)rrrrr auth_loginszSMTP.auth_loginc s|j|jdstd|jdjdddg}fdd|D}|sPtd|||_|_xv|D]n}d |jj d d }y.|j |t |||d \}} |dkr|| fSWqdt k r} z | } WYdd} ~ XqdXqdW| dS)awLog in on an SMTP server that requires authentication. The arguments are: - user: The user name to authenticate with. - password: The password for the authentication. Keyword arguments: - initial_response_ok: Allow sending the RFC 4954 initial-response to the AUTH command, if the authentication methods supports it. If there has been no previous EHLO or HELO command this session, this method tries ESMTP EHLO first. This method will return normally if the authentication was successful. This method may raise the following exceptions: SMTPHeloError The server didn't reply properly to the helo greeting. SMTPAuthenticationError The server didn't accept the username/ password combination. SMTPNotSupportedError The AUTH command is not supported by the server. SMTPException No suitable authentication method was found. ryz,SMTP AUTH extension not supported by server.zCRAM-MD5ZPLAINZLOGINcsg|]}|kr|qSrr)rry)advertised_authlistrr szSMTP.login..z(No suitable authentication method found.Zauth_-_)rrN)rr) rrrr7rrrrrreplacerygetattrr ) rrrrZpreferred_authsZauthlistZ authmethodZ method_namerrprrZlast_exceptionr)rrlogins*      z SMTP.logincCs|j|jdstd|jd\}}|dkrts>> import smtplib >>> s=smtplib.SMTP("localhost") >>> tolist=["one@one.org","two@two.org","three@three.org","four@four.org"] >>> msg = '''\ ... From: Me@my.org ... Subject: testin'... ... ... This is a test ''' >>> s.sendmail("me@my.org",tolist,msg) { "three@three.org" : ( 550 ,"User unknown" ) } >>> s.quit() In the above example, the message was accepted for delivery to three of the four addresses, and one was rejected, with the error code 550. If all addresses are accepted, then the method will return an empty dictionary. r2sizezsize=%drwi)rr]r^r0r_r~rrnrmrr;rrrrr.r) r from_addrto_addrsr mail_options rcpt_optionsZ esmtp_optsZoptionrrpZsenderrsrrrrsendmailsF@             z SMTP.sendmailcCs|j|jd}|dkr d}nt|dkr2d}ntd|dkr||d|krZ||dn ||d}tjj|gd d}|dkrd d ||d ||d ||dfD}dd tjj|D}tj|} | d =| d=d} ydj|f|j dWn.t k r(|j ds t dd} YnXt jR} | r^tjj| |jjddd} |d}n tjj| } | j| dd| j} WdQRX|j||| ||S)a~Converts message to a bytestring and passes it to sendmail. The arguments are as for sendmail, except that msg is an email.message.Message object. If from_addr is None or to_addrs is None, these arguments are taken from the headers of the Message as described in RFC 2822 (a ValueError is raised if there is more than one set of 'Resent-' headers). Regardless of the values of from_addr and to_addr, any Bcc field (or Resent-Bcc field, when the Message is a resent) of the Message object won't be transmitted. The Message object is then serialized using email.generator.BytesGenerator and sendmail is called to transmit the message. If the sender or any of the recipient addresses contain non-ASCII and the server advertises the SMTPUTF8 capability, the policy is cloned with utf8 set to True for the serialization, and SMTPUTF8 and BODY=8BITMIME are asserted on the send. If the server does not support SMTPUTF8, an SMTPNotSupported error is raised. Otherwise the generator is called without modifying the policy. z Resent-DateNr rGzResent-z0message has more than one 'Resent-' header blockZSenderFromrcSsg|]}|dk r|qS)Nr)rfrrrrsz%SMTP.send_message..ToZBccZCccSsg|] }|dqS)rGr)rarrrrsz Resent-BccFr2rzOne or more source or delivery addresses require internationalized email support, but the server does not advertise the required SMTPUTF8 capabilityT)utf8)policySMTPUTF8 BODY=8BITMIMEz )linesep)rr)rZget_allrmrUr"r#Z getaddressescopyror_UnicodeEncodeErrorrrioBytesIO generatorZBytesGeneratorrZcloneZflattengetvaluer)rrrrrrZresentZ header_prefixZ addr_fieldsZmsg_copyZ internationalZbytesmsggZflatmsgrrr send_message|sJ           zSMTP.send_messagec Cs<z|j}d|_|r|jWd|j}d|_|r6|jXdS)z(Close the connection to the SMTP server.N)rHr;rX)rrHrXrrrr;s z SMTP.closecCs.|jd}d|_|_i|_d|_|j|S)zTerminate the SMTP session.quitNF)rBr}rur7r~r;)rresrrrrs   z SMTP.quit)rPrN)r )r )r )r )r )N)N)N)NNN)1rrrrrErHrur|r}r~ SMTP_PORTrWr=_GLOBAL_DEFAULT_TIMEOUTrr@rDrFrMrOr:rarcrYrBrtr1rrrrrrrr.rrrrryrrrrrrrr;rrrrrrs^ -   " 1  3    '  B 8 gL c@s8eZdZdZeZdddddejddfddZddZ dS) SMTP_SSLa This is a subclass derived from SMTP that connects over an SSL encrypted socket (to use this class you need a socket module that was compiled with SSL support). If host is not specified, '' (the local host) is used. If port is omitted, the standard SMTP-over-SSL port (465) is used. local_hostname and source_address have the same meaning as they do in the SMTP class. keyfile and certfile are also optional - they can contain a PEM formatted private key and certificate chain file for the SSL connection. context also optional, can contain a SSLContext, and is an alternative to keyfile and certfile; If it is specified both keyfile and certfile must be None. r rNc Cs|dk r|dk rtd|dk r0|dk r0td|dk s@|dk rVddl} | jdtd||_||_|dkrxtj||d}||_t j ||||||dS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadr)rr) rUrrrrrrrrrr) rr>r?r<rrr6r9rrrrrrs zSMTP_SSL.__init__cCsD|jdkr|jd||ftj||f||j}|jj||jd}|S)Nrzconnect:)r)rErMr=rNr9rrr5)rr>r?r6Z new_socketrrrrO s   zSMTP_SSL._get_socket) rrrr SMTP_SSL_PORTrWr=rrrOrrrrrs ric@s0eZdZdZdZdeddfddZd d d ZdS) LMTPaLMTP - Local Mail Transfer Protocol The LMTP protocol, which is very similar to ESMTP, is heavily based on the standard SMTP client. It's common to use Unix sockets for LMTP, so our connect() method must support that as well as a regular host:port server. local_hostname and source_address have the same meaning as they do in the SMTP class. To specify a Unix socket, you must use an absolute path as the host, starting with a '/'. Authentication is supported, using the regular SMTP mechanism. When using a Unix socket, LMTP generally don't support or require any authentication, but your mileage might vary.Zlhlor NcCstj|||||ddS)zInitialize a new instance.)r<r9N)rr)rr>r?r<r9rrrr)s z LMTP.__init__rPrc Cs|ddkrtj||||dSy(tjtjtj|_d|_|jj|WnBtk r|jdkrl|j d||jr||jj d|_YnX|j \}}|jdkr|j d|||fS)z=Connect to the LMTP daemon, on either a Unix or a TCP socket.r/)r9Nz connect fail:zconnect:) rr:r=ZAF_UNIXZ SOCK_STREAMrXrHrVrErMr;rY)rr>r?r9rrrrrr:/s"       z LMTP.connect)rPrN)rrrrr| LMTP_PORTrr:rrrrrs   r__main__cCs(tjj|dtjjtjjjS)Nz: )rKstdoutwriteflushstdinrkr%)promptrrrrIs rrr,zEnter message, end with ^D:r zMessage length is %drPrG)@rr=rr+Z email.utilsr"Z email.messageZemail.generatorrrrrJrKZemail.base64mimerr__all__rrr-rrlcompileIrrVrrrrrrrr r r r r*r r/r0r ImportErrorrrrrnrrrrZfromaddrrZtoaddrsrIrrrkrqrmZserverrFrrrrrr!s         )0 /   pickletools.cpython-36.opt-2.pyc000064400000156156152462730460012511 0ustar003 \fI@s ddlZddlZddlZddlZddlZdddgZejZdZdZdZ dZ dZ Gd d d e Z dd lmZd dZe ddeddZddZe ddeddZddZe ddeddZddZe ddeddZddZe d d!ed"dZdd$d%Ze d&eed'dZd(d)Ze d*eed+dZd,d-Ze d.eed/dZ d0d1Z!e d2ee!d3dZ"d4d5Z#e d6e e#d7dZ$d8d9Z%e d:ee%d;dZ&dd?Z'e d@e e'dAdZ(dBdCZ)e dDe e)dEdZ*dFdGZ+e dHee+dIdZ,dJdKZ-e dLee-dMdZ.dNdOZ/e dPe e/dQdZ0dRdSZ1e dTe e1dUdZ2dVdWZ3dXdYZ4e dZee3d[dZ5e d\ee4d]dZ6d^d_Z7e d`ee7dadZ8dbdcZ9e ddd!e9dedZ:ddflm;Z;dgdhZe dme e>dndZ?Gdodpdpe Z@e@dqeAdrdsZBZCe@dteAeDfdudsZEe@dveDdwdsZFe@dxeGdydsZHe@dzeIeJfd{dsZKZLe@d|eId}dsZMe@d~eJddsZNe@deOdddsZPe@deQddsZRe@deSddsZTe@deUddsZVe@deWddsZXe@deWddsZYe@de ddsZZe@de@ddsZ[e@de@ddsZ\Gddde Z]e]Z^e^dde5geEgddde^ddegeBgddde^ddegeBgddde^ddegeBgddde^dde6geBgddde^dde=geBgddde^dde?geBgddde^ddegeKgddde^dde$geKgddde^dde"geKgddde^dde(geMgddde^dde&geMgddde^dde*geMgddde^dddgePgddde^dddgeFgddde^dddgeFgddde^dde,geNgddde^dde.geNgddde^dde0geNgddde^dde2geNgddde^dde8geHgddde^dde:geHgddde^dddgeTgddde^dddeTeZgeTgddde^dddeTe[e\geTgddde^ddde[e\geTgddde^dddgeRgddde^ddde[e\geRgddde^dddeZgeRgddde^dddeZeZgeRgddde^dddeZeZeZgeRgddde^dddgeVgddde^ddde[e\geVgddde^dddeVeZeZgeVgddde^dddeVe[e\geVgddde^dddgeXgddde^dddeXe[e\geXgddde^ddde[e\geYgddde^dddeZggdd de^d d deZgeZeZgdd de^d ddge[gddde^ddde[e\ggddde^dde5geZgddde^ddegeZgddde^ddegeZgddde^dde5ggddde^dd eggdd!de^d"d#eggdd$de^d%d&deZgeZgdd'de^d(d)egeZgdd*de^d+d,egeZgdd-de^d.d/egeZgdd0de^d1d2e geZgdd3de^d4d5deNeNgeZgdd6de^d7d8deZeZgeZgdd9de^d:d;deZeZgeZgdde e[e\geZgdd?de^d@dAde[eZe\geZgddBde^dCdDdeZeZgeZgddEde^dFdGdeZeZeZgeZgddHde^dIdJeggddKde^dLdMdeZggddNde^dOdPeggddQde^dRdSegeZgddTde^dUdVdeZgeZgddWdgAZ_[^iZ`iZaxzebe_D]n\ZcZdedjee`k refdXedjee`edjeecfedjgeak refdYedjgeaedjgecfece`edje<eceaedjg< qW[`[a[c[diZhxe_D]Zdedehedjg< qW[ddd[d\Ziei[idd]d^Zjd_dZkd`dZlddadZmGdbdcdcZnddZodeZpeoepdfZqdgdhZresdik r~ddltZtetjudjdkZvevjwdletjxdmdndodpevjwdqdrejyetjxdsdtduevjwdvdwdxdydzevjwd{d|deAd}duevjwd~ddxddzevjwdddddevjwdddxddzevjwddxddzevjzZ{e{j| rerne{j} rdndZ}e{j~ sevjnee{j~dk r$eme{j~de{jde{je}nZe{j r0indZxHe{j~D]>Ze{jjejedZe{jjedemee{jee{je} qstring4zA counted string. The first argument is a 4-byte little-endian signed int giving the number of bytes in the string, and the second argument is that many bytes. cCs:t|}|j|}t||kr"|Std|t|fdS)Nz1expected %d bytes in a bytes1, but only %d remain)rrrr)rr rrrr read_bytes1s   r@bytes1zA counted bytes string. The first argument is a 1-byte unsigned int giving the number of bytes in the string, and the second argument is that many bytes. cCs:t|}|j|}t||kr"|Std|t|fdS)Nz1expected %d bytes in a bytes1, but only %d remain)rrrr)rr rrrrr@s   zA counted bytes string. The first argument is a 1-byte unsigned int giving the number of bytes, and the second argument is that many bytes. cCsPt|}|tjkrtd||j|}t||kr8|Std|t|fdS)Nz#bytes4 byte count > sys.maxsize: %dz1expected %d bytes in a bytes4, but only %d remain)r$sysmaxsizerrr)rr rrrr read_bytes4s     rDbytes4zA counted bytes string. The first argument is a 4-byte little-endian unsigned int giving the number of bytes, and the second argument is that many bytes. cCsPt|}|tjkrtd||j|}t||kr8|Std|t|fdS)Nz#bytes8 byte count > sys.maxsize: %dz1expected %d bytes in a bytes8, but only %d remain)r'rBrCrrr)rr rrrr read_bytes83s    rFbytes8zA counted bytes string. The first argument is an 8-byte little-endian unsigned int giving the number of bytes, and the second argument is that many bytes. cCs0|j}|jdstd|dd}t|dS)Nr)z4no newline found when trying to read unicodestringnlrzraw-unicode-escaper-)r.r/rstr)rrrrrread_unicodestringnlUs   rIunicodestringnlzA newline-terminated Unicode string. This is raw-unicode-escape encoded, so consists of printable ASCII characters, and may contain embedded escape sequences. cCsBt|}|j|}t||kr*t|ddStd|t|fdS)Nzutf-8 surrogatepassz9expected %d bytes in a unicodestring1, but only %d remain)rrrrHr)rr rrrrread_unicodestring1os    rLunicodestring1aAA counted Unicode string. The first argument is a 1-byte little-endian signed int giving the number of bytes in the string, and the second argument-- the UTF-8 encoding of the Unicode string -- contains that many bytes. cCsXt|}|tjkrtd||j|}t||kr@t|ddStd|t|fdS)Nz+unicodestring4 byte count > sys.maxsize: %dzutf-8rKz9expected %d bytes in a unicodestring4, but only %d remain)r$rBrCrrrrH)rr rrrrread_unicodestring4s     rNunicodestring4aAA counted Unicode string. The first argument is a 4-byte little-endian signed int giving the number of bytes in the string, and the second argument-- the UTF-8 encoding of the Unicode string -- contains that many bytes. cCsXt|}|tjkrtd||j|}t||kr@t|ddStd|t|fdS)Nz+unicodestring8 byte count > sys.maxsize: %dzutf-8rKz9expected %d bytes in a unicodestring8, but only %d remain)r'rBrCrrrrH)rr rrrrread_unicodestring8s     rPunicodestring8aBA counted Unicode string. The first argument is an 8-byte little-endian signed int giving the number of bytes in the string, and the second argument-- the UTF-8 encoding of the Unicode string -- contains that many bytes. cCs.t|ddd}|dkrdS|dkr&dSt|S)NF)r3r4s00s01T)r6int)rsrrrread_decimalnl_shorts rTcCs2t|ddd}|dddkr*|dd}t|S)NF)r3r4rLr-r-)r6rR)rrSrrrread_decimalnl_longs  rVdecimalnl_shortaA newline-terminated decimal integer literal. This never has a trailing 'L', and the integer fit in a short Python int on the box where the pickle was written -- but there's no guarantee it will fit in a short Python int on the box where the pickle is read. decimalnl_longzA newline-terminated decimal integer literal. This has a trailing 'L', and can represent integers of any size. cCst|ddd}t|S)NF)r3r4)r6float)rrSrrr read_floatnl'srZfloatnlaA newline-terminated decimal floating literal. In general this requires 17 significant digits for roundtrip identity, and pickling then unpickling infinities, NaNs, and minus zero doesn't work across boxes, or on some boxes even on itself (e.g., Windows can't read the strings it produces for infinities or NaNs). cCs0|jd}t|dkr$td|dStddS)Nr&z>drz(not enough data in stream to read float8)rrrr)rrrrr read_float8=s  r\float8aAn 8-byte binary representation of a float, big-endian. The format is unique to Python, and shared with the struct module (format string '>d') "in theory" (the struct and pickle implementations don't share the code -- they should). It's strongly related to the IEEE-754 double format, and, in normal cases, is in fact identical to the big-endian 754 double format. On other boxes the dynamic range is limited to that of a 754 double, and "add a half and chop" rounding is used to reduce the precision to 53 bits. However, even on a 754 box, infinities, NaNs, and minus zero may not be handled correctly (may not survive roundtrip pickling intact). ) decode_longcCs.t|}|j|}t||kr&tdt|S)Nz'not enough data in stream to read long1)rrrrr^)rr rrrr read_long1cs   r_long1aA binary long, little-endian, using 1-byte size. This first reads one byte as an unsigned size, then reads that many bytes and interprets them as a little-endian 2's-complement long. If the size is 0, that's taken as a shortcut for the long 0L. cCsBt|}|dkrtd||j|}t||kr:tdt|S)Nrzlong4 byte count < 0: %dz'not enough data in stream to read long4)r"rrrr^)rr rrrr read_long4s   ralong4aA binary representation of a long, little-endian. This first reads four bytes as a signed size (but requires the size to be >= 0), then reads that many bytes and interprets them as a little-endian 2's-complement long. If the size is 0, that's taken as a shortcut for the int 0, although LONG1 should really be used then instead (and in any case where # of bytes < 256). c@s eZdZd ZddZddZdS) StackObjectr obtypercCs.||_t|trx |D]}qW||_||_dS)N)r isinstancetuplerdr)rr rdrZ containedrrrrs   zStackObject.__init__cCs|jS)N)r )rrrr__repr__szStackObject.__repr__N)r rdr)rrrrrrgrrrrrcs  rcrRzA Python integer object.)r rdrZ int_or_boolz#A Python integer or boolean object.boolzA Python boolean object.rYzA Python float object.Z bytes_or_strz*A Python bytes or (Unicode) string object.byteszA Python bytes object.rHz!A Python (Unicode) string object.NonezThe Python None object.rfzA Python tuple object.listzA Python list object.dictzA Python dict object.setzA Python set object. frozensetzA Python frozenset object.anyzAny kind of object whatsoever.Zmarkaz'The mark' is a unique object. Opcodes that operate on a variable number of objects generally don't embed the count of objects in the opcode, or pull it off the stack. Instead the MARK opcode is used to push a special marker object on the stack, and then some other opcodes grab all the objects from the top of the stack down to (but not including) the topmost marker object. stacksliceaAn object representing a contiguous slice of the stack. This is used in conjunction with markobject, to represent all of the stack following the topmost markobject. For example, the POP_MARK opcode changes the stack from [..., markobject, stackslice] to [...] No matter how many object are on the stack after the topmost markobject, POP_MARK gets rid of all of them (including the topmost markobject too). c@seZdZd Zdd Zd S) OpcodeInfor codearg stack_before stack_afterprotorc CsJ||_||_||_x |D]}qW||_x |D]}q,W||_||_||_dS)N)r rrrsrtrurvr) rr rrrsrtrurvrxrrrrTs  zOpcodeInfo.__init__N)r rrrsrtrurvr)rrrrrrrrrrq5srqZINTIaPush an integer or bool. The argument is a newline-terminated decimal literal string. The intent may have been that this always fit in a short Python int, but INT can be generated in pickles written on a 64-bit box that require a Python long on a 32-bit box. The difference between this and LONG then is that INT skips a trailing 'L', and produces a short int whenever possible. Another difference is due to that, when bool was introduced as a distinct type in 2.3, builtin names True and False were also added to 2.2.2, mapping to ints 1 and 0. For compatibility in both directions, True gets pickled as INT + "I01\n", and False as INT + "I00\n". Leading zeroes are never produced for a genuine integer. The 2.3 (and later) unpicklers special-case these and return bool instead; earlier unpicklers ignore the leading "0" and return the int. )r rrrsrtrurvrZBININTJa1Push a four-byte signed integer. This handles the full range of Python (short) integers on a 32-bit box, directly as binary bytes (1 for the opcode and 4 for the integer). If the integer is non-negative and fits in 1 or 2 bytes, pickling via BININT1 or BININT2 saves space. ZBININT1KzPush a one-byte unsigned integer. This is a space optimization for pickling very small non-negative ints, in range(256). ZBININT2MzPush a two-byte unsigned integer. This is a space optimization for pickling small positive ints, in range(256, 2**16). Integers in range(256) can also be pickled via BININT2, but BININT1 instead saves a byte. ZLONGLaPush a long integer. The same as INT, except that the literal ends with 'L', and always unpickles to a Python long. There doesn't seem a real purpose to the trailing 'L'. Note that LONG takes time quadratic in the number of digits when unpickling (this is simply due to the nature of decimal->binary conversion). Proto 2 added linear-time (in C; still quadratic-time in Python) LONG1 and LONG4 opcodes. ZLONG1Šz|Long integer using one-byte length. A more efficient encoding of a Python long; the long1 encoding says it all.ZLONG4‹z~Long integer using found-byte length. A more efficient encoding of a Python long; the long4 encoding says it all.STRINGSaPush a Python string object. The argument is a repr-style string, with bracketing quote characters, and perhaps embedded escapes. The argument extends until the next newline character. These are usually decoded into a str instance using the encoding given to the Unpickler constructor. or the default, 'ASCII'. If the encoding given was 'bytes' however, they will be decoded as bytes object instead. Z BINSTRINGTaPush a Python string object. There are two arguments: the first is a 4-byte little-endian signed int giving the number of bytes in the string, and the second is that many bytes, which are taken literally as the string content. These are usually decoded into a str instance using the encoding given to the Unpickler constructor. or the default, 'ASCII'. If the encoding given was 'bytes' however, they will be decoded as bytes object instead. ZSHORT_BINSTRINGUaPush a Python string object. There are two arguments: the first is a 1-byte unsigned int giving the number of bytes in the string, and the second is that many bytes, which are taken literally as the string content. These are usually decoded into a str instance using the encoding given to the Unpickler constructor. or the default, 'ASCII'. If the encoding given was 'bytes' however, they will be decoded as bytes object instead. ZBINBYTESBzPush a Python bytes object. There are two arguments: the first is a 4-byte little-endian unsigned int giving the number of bytes, and the second is that many bytes, which are taken literally as the bytes content. ZSHORT_BINBYTESCzPush a Python bytes object. There are two arguments: the first is a 1-byte unsigned int giving the number of bytes, and the second is that many bytes, which are taken literally as the string content. Z BINBYTES8ŽzPush a Python bytes object. There are two arguments: the first is an 8-byte unsigned int giving the number of bytes in the string, and the second is that many bytes, which are taken literally as the string content. ZNONENzPush None on the stack.ZNEWTRUEˆzPush True onto the stack.ZNEWFALSE‰zPush False onto the stack.UNICODEVzPush a Python Unicode string object. The argument is a raw-unicode-escape encoding of a Unicode string, and so may contain embedded escape sequences. The argument extends until the next newline character. ZSHORT_BINUNICODEŒaPush a Python Unicode string object. There are two arguments: the first is a 1-byte little-endian signed int giving the number of bytes in the string. The second is that many bytes, and is the UTF-8 encoding of the Unicode string. Z BINUNICODEXaPush a Python Unicode string object. There are two arguments: the first is a 4-byte little-endian unsigned int giving the number of bytes in the string. The second is that many bytes, and is the UTF-8 encoding of the Unicode string. Z BINUNICODE8aPush a Python Unicode string object. There are two arguments: the first is an 8-byte little-endian signed int giving the number of bytes in the string. The second is that many bytes, and is the UTF-8 encoding of the Unicode string. ZFLOATFaNewline-terminated decimal float literal. The argument is repr(a_float), and in general requires 17 significant digits for roundtrip conversion to be an identity (this is so for IEEE-754 double precision values, which is what Python float maps to on most boxes). In general, FLOAT cannot be used to transport infinities, NaNs, or minus zero across boxes (or even on a single box, if the platform C library can't read the strings it produces for such things -- Windows is like that), but may do less damage than BINFLOAT on boxes with greater precision or dynamic range than IEEE-754 double. ZBINFLOATGaFloat stored in binary form, with 8 bytes of data. This generally requires less than half the space of FLOAT encoding. In general, BINFLOAT cannot be used to transport infinities, NaNs, or minus zero, raises an exception if the exponent exceeds the range of an IEEE-754 double, and retains no more than 53 bits of precision (if there are more than that, "add a half and chop" rounding is used to cut it back to 53 significant bits). Z EMPTY_LIST]zPush an empty list.ZAPPENDazAppend an object to a list. Stack before: ... pylist anyobject Stack after: ... pylist+[anyobject] although pylist is really extended in-place. ZAPPENDSezExtend a list by a slice of stack objects. Stack before: ... pylist markobject stackslice Stack after: ... pylist+stackslice although pylist is really extended in-place. ZLISTlasBuild a list out of the topmost stack slice, after markobject. All the stack entries following the topmost markobject are placed into a single Python list, which single list object replaces all of the stack from the topmost markobject onward. For example, Stack before: ... markobject 1 2 3 'abc' Stack after: ... [1, 2, 3, 'abc'] Z EMPTY_TUPLE)zPush an empty tuple.ZTUPLEtavBuild a tuple out of the topmost stack slice, after markobject. All the stack entries following the topmost markobject are placed into a single Python tuple, which single tuple object replaces all of the stack from the topmost markobject onward. For example, Stack before: ... markobject 1 2 3 'abc' Stack after: ... (1, 2, 3, 'abc') ZTUPLE1…zBuild a one-tuple out of the topmost item on the stack. This code pops one value off the stack and pushes a tuple of length 1 whose one item is that value back onto it. In other words: stack[-1] = tuple(stack[-1:]) ZTUPLE2†aBuild a two-tuple out of the top two items on the stack. This code pops two values off the stack and pushes a tuple of length 2 whose items are those values back onto it. In other words: stack[-2:] = [tuple(stack[-2:])] ZTUPLE3‡aBuild a three-tuple out of the top three items on the stack. This code pops three values off the stack and pushes a tuple of length 3 whose items are those values back onto it. In other words: stack[-3:] = [tuple(stack[-3:])] Z EMPTY_DICT}zPush an empty dict.ZDICTdaBuild a dict out of the topmost stack slice, after markobject. All the stack entries following the topmost markobject are placed into a single Python dict, which single dict object replaces all of the stack from the topmost markobject onward. The stack slice alternates key, value, key, value, .... For example, Stack before: ... markobject 1 2 3 'abc' Stack after: ... {1: 2, 3: 'abc'} ZSETITEMrSzAdd a key+value pair to an existing dict. Stack before: ... pydict key value Stack after: ... pydict where pydict has been modified via pydict[key] = value. ZSETITEMSua\Add an arbitrary number of key+value pairs to an existing dict. The slice of the stack following the topmost markobject is taken as an alternating sequence of keys and values, added to the dict immediately under the topmost markobject. Everything at and after the topmost markobject is popped, leaving the mutated dict at the top of the stack. Stack before: ... pydict markobject key_1 value_1 ... key_n value_n Stack after: ... pydict where pydict has been modified via pydict[key_i] = value_i for i in 1, 2, ..., n, and in that order. Z EMPTY_SETzPush an empty set.ZADDITEMSa$Add an arbitrary number of items to an existing set. The slice of the stack following the topmost markobject is taken as a sequence of items, added to the set immediately under the topmost markobject. Everything at and after the topmost markobject is popped, leaving the mutated set at the top of the stack. Stack before: ... pyset markobject item_1 ... item_n Stack after: ... pyset where pyset has been modified via pyset.add(item_i) = item_i for i in 1, 2, ..., n, and in that order. Z FROZENSET‘azBuild a frozenset out of the topmost slice, after markobject. All the stack entries following the topmost markobject are placed into a single Python frozenset, which single frozenset object replaces all of the stack from the topmost markobject onward. For example, Stack before: ... markobject 1 2 3 Stack after: ... frozenset({1, 2, 3}) POP0z. ZBUILDbaFinish building an object, via __setstate__ or dict update. Stack before: ... anyobject argument Stack after: ... anyobject where anyobject may have been mutated, as follows: If the object has a __setstate__ method, anyobject.__setstate__(argument) is called. Else the argument must be a dict, the object must have a __dict__, and the object is updated via anyobject.__dict__.update(argument) ZINSTiaqBuild a class instance. This is the protocol 0 version of protocol 1's OBJ opcode. INST is followed by two newline-terminated strings, giving a module and class name, just as for the GLOBAL opcode (and see GLOBAL for more details about that). self.find_class(module, name) is used to get a class object. In addition, all the objects on the stack following the topmost markobject are gathered into a tuple and popped (along with the topmost markobject), just as for the TUPLE opcode. Now it gets complicated. If all of these are true: + The argtuple is empty (markobject was at the top of the stack at the start). + The class object does not have a __getinitargs__ attribute. then we want to create an old-style class instance without invoking its __init__() method (pickle has waffled on this over the years; not calling __init__() is current wisdom). In this case, an instance of an old-style dummy class is created, and then we try to rebind its __class__ attribute to the desired class object. If this succeeds, the new instance object is pushed on the stack, and we're done. Else (the argtuple is not empty, it's not an old-style class object, or the class object does have a __getinitargs__ attribute), the code first insists that the class object have a __safe_for_unpickling__ attribute. Unlike as for the __safe_for_unpickling__ check in REDUCE, it doesn't matter whether this attribute has a true or false value, it only matters whether it exists (XXX this is a bug). If __safe_for_unpickling__ doesn't exist, UnpicklingError is raised. Else (the class object does have a __safe_for_unpickling__ attr), the class object obtained from INST's arguments is applied to the argtuple obtained from the stack, and the resulting instance object is pushed on the stack. NOTE: checks for __safe_for_unpickling__ went away in Python 2.3. NOTE: the distinction between old-style and new-style classes does not make sense in Python 3. ZOBJoaBuild a class instance. This is the protocol 1 version of protocol 0's INST opcode, and is very much like it. The major difference is that the class object is taken off the stack, allowing it to be retrieved from the memo repeatedly if several instances of the same class are created. This can be much more efficient (in both time and space) than repeatedly embedding the module and class names in INST opcodes. Unlike INST, OBJ takes no arguments from the opcode stream. Instead the class object is taken off the stack, immediately above the topmost markobject: Stack before: ... markobject classobject stackslice Stack after: ... new_instance_object As for INST, the remainder of the stack above the markobject is gathered into an argument tuple, and then the logic seems identical, except that no __safe_for_unpickling__ check is done (XXX this is a bug). See INST for the gory details. NOTE: In Python 2.3, INST and OBJ are identical except for how they get the class object. That was always the intent; the implementations had diverged for accidental reasons. ZNEWOBJaLBuild an object instance. The stack before should be thought of as containing a class object followed by an argument tuple (the tuple being the stack top). Call these cls and args. They are popped off the stack, and the value returned by cls.__new__(cls, *args) is pushed back onto the stack. Z NEWOBJ_EX’auBuild an object instance. The stack before should be thought of as containing a class object followed by an argument tuple and by a keyword argument dict (the dict being the stack top). Call these cls and args. They are popped off the stack, and the value returned by cls.__new__(cls, *args, *kwargs) is pushed back onto the stack. PROTO€zProtocol version indicator. For protocol 2 and above, a pickle must start with this opcode. The argument is the protocol version, an int in range(2, 256). ZSTOP.zStop the unpickling machine. Every pickle ends with this opcode. The object at the top of the stack is popped, and that's the result of unpickling. The stack should be empty then. FRAME•zIndicate the beginning of a new frame. The unpickler may use this opcode to safely prefetch data from its underlying stream. ZPERSIDPaPush an object identified by a persistent ID. The pickle module doesn't define what a persistent ID means. PERSID's argument is a newline-terminated str-style (no embedded escapes, no bracketing quote characters) string, which *is* "the persistent ID". The unpickler passes this string to self.persistent_load(). Whatever object that returns is pushed on the stack. There is no implementation of persistent_load() in Python's unpickler: it must be supplied by an unpickler subclass. Z BINPERSIDQaXPush an object identified by a persistent ID. Like PERSID, except the persistent ID is popped off the stack (instead of being a string embedded in the opcode bytestream). The persistent ID is passed to self.persistent_load(), and whatever object that returns is pushed on the stack. See PERSID for more detail. z%repeated name %r at indices %d and %dz%repeated code %r at indices %d and %dFcCstj}xtjD]}tjd|s2|rtd|qtt|}t|t  sTt |dkrj|rtd||fq|j d}||kr|rtd||f||}|j |krt d|||j f||=qt d||fqW|rd g}x(|jD]\}}|jd |j |fqWt d j|dS) Nz[A-Z][A-Z0-9_]+$z0skipping %r: it doesn't look like an opcode namerz5skipping %r: value %r doesn't look like a pickle codezlatin-1z+checking name %r w/ code %r for consistencyzBfor pickle code %r, pickle.py uses name %r but we're using name %rzPpickle.py appears to have a pickle opcode with name %r and code %r, but we don'tz=we appear to have pickle opcodes that pickle.py doesn't have:z name %r with code %r )code2opcopypickle__all__rematchprintgetattrrerirr3r ritemsappendjoin)verboserr Z picklecodermsgrrrrrassure_pickle_consistencys>         rccst|trtj|}t|dr&|j}ndd}x|}|jd}tj|j d}|dkr|dkrjt dnt d|dkrzd n||f|j dkrd}n |j j |}|r||||fVn |||fV|d kr0Pq0WdS) NtellcSsdS)Nrrrrrsz_genops..rzlatin-1z#pickle exhausted before seeing STOPz!at position %s, opcode %r unknownz .) re bytes_typesioBytesIOhasattrrrrgetr3rrsr )r yield_end_posZgetposposrropcodersrrr_genopss.         rcCst|S)N)r)rrrrrscCsd}d}t}i}g}d}d}xt|ddD]\}} } } d|jkr\|j| |j|| fq,|jdkrt|} |j| |j|| fq,d|jkrq,d|jkr|j|kr|j}d|| <|j|| fq,|jd kr| |kr| }| dkr|| | }n|j| | fq,|j| | fq,W~tj} | j |t j | |}|d krJ|j j d} x|D]x\}} ||kr| |krtqT|j| }| || <| d 7} n&||kr|j|| }n ||| }|j j|j |qTW|j j| jS) NrrrrT)rrrrrr)rmrr addrrrvrrwriterZ_PicklerZframerZ start_framingputrZ commit_frameZ end_framinggetvalue)rrrZoldidsZnewidsopcodesrvZ protoheaderrrsrZend_posidxoutZpickleroprrrrrsd                    cCsg}|dkri}d}g}d|}d} |} xt|D]\} } } | dk rZtd| d|ddt| jdd|t|| jf}t|| j}| j}| j }t|}d}t |ks| jdko|o|d t krD|r<|j }|dkrd}nd|}x|d!t k r|j qW|j y|j t }Wnt k r8d }YnXnd } }| jd"kr| jdkrnt|}d|}n| }||krd| } n,|sd} n |d#t krd} n |d$||<n*| jd%kr| |kr|| g}nd| } | dk s|r0|ddt| j7}| dk r|dt| 7}|r0|d|7}|rz|d| t|7}t|} | dkr`|} |d| jjddd 7}t||d| rt | t||krt d|t|f|r|| d=t |kr|j| |j|q4Wtd||d|r t d|dS)&Nr z%5d:)endfilez %-4s %s%srz(MARK at unknown opcode offset)z (MARK at %d)rzno MARK exists on stackrrrrz(as %d)zmemo key %r already definedz'stack is empty -- can't store into memoz"can't store markobject in the memorrrz&memo key %r has never been stored into 2r)rz3tries to pop %d items from stack with only %d itemsz highest protocol among opcodes =zstack not empty after STOP: %rr-r-r-r-)rrrrr-r-)rrr)rrreprrrrr maxrvrtru markobjectpopindexrrsplitrextend)rrmemo indentlevelannotatestackZmaxprotoZ markstackZ indentchunkZerrormsgZannocolrrsrlineZbeforeafterZnumtopopZmarkmsgZmarkposZmemo_idxrrrr% s-                    c@seZdZddZdS)_ExamplecCs ||_dS)N)value)rrrrrr sz_Example.__init__N)rrrrrrrrr sra >>> import pickle >>> x = [1, 2, (3, 4), {b'abc': "def"}] >>> pkl0 = pickle.dumps(x, 0) >>> dis(pkl0) 0: ( MARK 1: l LIST (MARK at 0) 2: p PUT 0 5: L LONG 1 9: a APPEND 10: L LONG 2 14: a APPEND 15: ( MARK 16: L LONG 3 20: L LONG 4 24: t TUPLE (MARK at 15) 25: p PUT 1 28: a APPEND 29: ( MARK 30: d DICT (MARK at 29) 31: p PUT 2 34: c GLOBAL '_codecs encode' 50: p PUT 3 53: ( MARK 54: V UNICODE 'abc' 59: p PUT 4 62: V UNICODE 'latin1' 70: p PUT 5 73: t TUPLE (MARK at 53) 74: p PUT 6 77: R REDUCE 78: p PUT 7 81: V UNICODE 'def' 86: p PUT 8 89: s SETITEM 90: a APPEND 91: . STOP highest protocol among opcodes = 0 Try again with a "binary" pickle. >>> pkl1 = pickle.dumps(x, 1) >>> dis(pkl1) 0: ] EMPTY_LIST 1: q BINPUT 0 3: ( MARK 4: K BININT1 1 6: K BININT1 2 8: ( MARK 9: K BININT1 3 11: K BININT1 4 13: t TUPLE (MARK at 8) 14: q BINPUT 1 16: } EMPTY_DICT 17: q BINPUT 2 19: c GLOBAL '_codecs encode' 35: q BINPUT 3 37: ( MARK 38: X BINUNICODE 'abc' 46: q BINPUT 4 48: X BINUNICODE 'latin1' 59: q BINPUT 5 61: t TUPLE (MARK at 37) 62: q BINPUT 6 64: R REDUCE 65: q BINPUT 7 67: X BINUNICODE 'def' 75: q BINPUT 8 77: s SETITEM 78: e APPENDS (MARK at 3) 79: . STOP highest protocol among opcodes = 1 Exercise the INST/OBJ/BUILD family. >>> import pickletools >>> dis(pickle.dumps(pickletools.dis, 0)) 0: c GLOBAL 'pickletools dis' 17: p PUT 0 20: . STOP highest protocol among opcodes = 0 >>> from pickletools import _Example >>> x = [_Example(42)] * 2 >>> dis(pickle.dumps(x, 0)) 0: ( MARK 1: l LIST (MARK at 0) 2: p PUT 0 5: c GLOBAL 'copy_reg _reconstructor' 30: p PUT 1 33: ( MARK 34: c GLOBAL 'pickletools _Example' 56: p PUT 2 59: c GLOBAL '__builtin__ object' 79: p PUT 3 82: N NONE 83: t TUPLE (MARK at 33) 84: p PUT 4 87: R REDUCE 88: p PUT 5 91: ( MARK 92: d DICT (MARK at 91) 93: p PUT 6 96: V UNICODE 'value' 103: p PUT 7 106: L LONG 42 111: s SETITEM 112: b BUILD 113: a APPEND 114: g GET 5 117: a APPEND 118: . STOP highest protocol among opcodes = 0 >>> dis(pickle.dumps(x, 1)) 0: ] EMPTY_LIST 1: q BINPUT 0 3: ( MARK 4: c GLOBAL 'copy_reg _reconstructor' 29: q BINPUT 1 31: ( MARK 32: c GLOBAL 'pickletools _Example' 54: q BINPUT 2 56: c GLOBAL '__builtin__ object' 76: q BINPUT 3 78: N NONE 79: t TUPLE (MARK at 31) 80: q BINPUT 4 82: R REDUCE 83: q BINPUT 5 85: } EMPTY_DICT 86: q BINPUT 6 88: X BINUNICODE 'value' 98: q BINPUT 7 100: K BININT1 42 102: s SETITEM 103: b BUILD 104: h BINGET 5 106: e APPENDS (MARK at 3) 107: . STOP highest protocol among opcodes = 1 Try "the canonical" recursive-object test. >>> L = [] >>> T = L, >>> L.append(T) >>> L[0] is T True >>> T[0] is L True >>> L[0][0] is L True >>> T[0][0] is T True >>> dis(pickle.dumps(L, 0)) 0: ( MARK 1: l LIST (MARK at 0) 2: p PUT 0 5: ( MARK 6: g GET 0 9: t TUPLE (MARK at 5) 10: p PUT 1 13: a APPEND 14: . STOP highest protocol among opcodes = 0 >>> dis(pickle.dumps(L, 1)) 0: ] EMPTY_LIST 1: q BINPUT 0 3: ( MARK 4: h BINGET 0 6: t TUPLE (MARK at 3) 7: q BINPUT 1 9: a APPEND 10: . STOP highest protocol among opcodes = 1 Note that, in the protocol 0 pickle of the recursive tuple, the disassembler has to emulate the stack in order to realize that the POP opcode at 16 gets rid of the MARK at 0. >>> dis(pickle.dumps(T, 0)) 0: ( MARK 1: ( MARK 2: l LIST (MARK at 1) 3: p PUT 0 6: ( MARK 7: g GET 0 10: t TUPLE (MARK at 6) 11: p PUT 1 14: a APPEND 15: 0 POP 16: 0 POP (MARK at 0) 17: g GET 1 20: . STOP highest protocol among opcodes = 0 >>> dis(pickle.dumps(T, 1)) 0: ( MARK 1: ] EMPTY_LIST 2: q BINPUT 0 4: ( MARK 5: h BINGET 0 7: t TUPLE (MARK at 4) 8: q BINPUT 1 10: a APPEND 11: 1 POP_MARK (MARK at 0) 12: h BINGET 1 14: . STOP highest protocol among opcodes = 1 Try protocol 2. >>> dis(pickle.dumps(L, 2)) 0: \x80 PROTO 2 2: ] EMPTY_LIST 3: q BINPUT 0 5: h BINGET 0 7: \x85 TUPLE1 8: q BINPUT 1 10: a APPEND 11: . STOP highest protocol among opcodes = 2 >>> dis(pickle.dumps(T, 2)) 0: \x80 PROTO 2 2: ] EMPTY_LIST 3: q BINPUT 0 5: h BINGET 0 7: \x85 TUPLE1 8: q BINPUT 1 10: a APPEND 11: 0 POP 12: h BINGET 1 14: . STOP highest protocol among opcodes = 2 Try protocol 3 with annotations: >>> dis(pickle.dumps(T, 3), annotate=1) 0: \x80 PROTO 3 Protocol version indicator. 2: ] EMPTY_LIST Push an empty list. 3: q BINPUT 0 Store the stack top into the memo. The stack is not popped. 5: h BINGET 0 Read an object from the memo and push it on the stack. 7: \x85 TUPLE1 Build a one-tuple out of the topmost item on the stack. 8: q BINPUT 1 Store the stack top into the memo. The stack is not popped. 10: a APPEND Append an object to a list. 11: 0 POP Discard the top stack item, shrinking the stack by one item. 12: h BINGET 1 Read an object from the memo and push it on the stack. 14: . STOP Stop the unpickling machine. highest protocol among opcodes = 2 a= >>> import pickle >>> import io >>> f = io.BytesIO() >>> p = pickle.Pickler(f, 2) >>> x = [1, 2, 3] >>> p.dump(x) >>> p.dump(x) >>> f.seek(0) 0 >>> memo = {} >>> dis(f, memo=memo) 0: \x80 PROTO 2 2: ] EMPTY_LIST 3: q BINPUT 0 5: ( MARK 6: K BININT1 1 8: K BININT1 2 10: K BININT1 3 12: e APPENDS (MARK at 5) 13: . STOP highest protocol among opcodes = 2 >>> dis(f, memo=memo) 14: \x80 PROTO 2 16: h BINGET 0 18: . STOP highest protocol among opcodes = 2 )Zdisassembler_testZdisassembler_memo_testcCsddl}|jS)Nr)doctestZtestmod)rrrr_test sr__main__z$disassemble one or more pickle files)Z description pickle_filebr*zthe pickle file)typenargshelpz-oz--outputwz+the file where the output should be written)defaultrrz-mz--memo store_truez#preserve memo between disassemblies)actionrz-lz --indentlevelz8the number of blanks by which to indent a new MARK levelz-az --annotatez2annotate each line with a short opcode descriptionz-pz --preamblez==> {name} <==zMif more than one pickle file is specified, print this before each disassembly)rrz-tz--testzrun self-test suitez-vz)run verbosely; only affects self-test run)r rr-)TT)F)F)NNrr)r1rrrrBrrZ UP_TO_NEWLINEZTAKEN_FROM_ARGUMENT1ZTAKEN_FROM_ARGUMENT4ZTAKEN_FROM_ARGUMENT4UZTAKEN_FROM_ARGUMENT8Uobjectr Zstructrrrrr r!r"r#r$r%r'r(r6r7r8r9r:r;r<r=r>r?r@rArDrErFrGrIrJrLrMrNrOrPrQrTrVrWrXrZr[r\r]r^r_r`rarbrcrRZpyintZpylongrhZpyinteger_or_boolZpyboolrYZpyfloatrirHZpybytes_or_strZpystringZpybytesZ pyunicoderZpynonerfZpytuplerkZpylistrlZpydictrmZpysetZ pyfrozensetZ anyobjectrrprqrxrZname2iZcode2i enumeraterrr rrrrrrrrrrZ _dis_testZ _memo_testZ__test__rrargparseArgumentParserparser add_argumentZFileTypestdout parse_argsargsZtestrrZ print_helproutputrrrZpreambleformatrrrrr s $   /        ;           +      &  >                   sre_parse.cpython-36.pyc000064400000047610152462730460011176 0ustar003 \ @sdZddlTdZdZedZedZedZedZed Z ee e hZ ee eeeeehZeed feed feed feed feedfeedfeedfeedfdZeefeefeefeeefgfeeefgfeeefgfeeefgfeeefgfeeefgfee fd Z!e"e#e$e%e&e'e(e)dZ*e'e#Be)Be+Be(BZ,Gddde-Z.GdddZ/GdddZ0GdddZ1ddZ2dd Z3d!d"Z4d#d$Z5d3d&d'Z6d(d)Z7d*d+Z8d4d-d.Z9d/d0Z:d1d2Z;d,S)5zInternal support module for sre)*z .\[{()*+?^$|z*+?{ 0123456789Z01234567Z0123456789abcdefABCDEFZ4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZz      \)z\az\bz\fz\nz\rz\tz\vz\\) z\Az\bz\Bz\dz\Dz\sz\Sz\wz\Wz\Z)iLmsxatuc@s eZdZdS)VerboseN)__name__ __module__ __qualname__rr!/usr/lib64/python3.6/sre_parse.pyrGsrc@sBeZdZddZeddZdddZdd Zd d Zd d Z dS)PatterncCsd|_i|_dg|_d|_dS)Nr)flags groupdict groupwidthslookbehindgroups)selfrrr__init__LszPattern.__init__cCs t|jS)N)lenr)rrrrgroupsQszPattern.groupsNcCsb|j}|jjd|jtkr$td|dk r^|jj|d}|dk rTtd|||f||j|<|S)Nztoo many groupsz7redefinition of group name %r as group %d; was group %d)r"rappend MAXGROUPSerrorrget)rnamegidogidrrr opengroupTs   zPattern.opengroupcCs|j|j|<dS)N)getwidthr)rr(prrr closegroup`szPattern.closegroupcCs||jko|j|dk S)N)r"r)rr(rrr checkgroupbszPattern.checkgroupcCs6|jdk r2|j|s|jd||jkr2|jddS)Nzcannot refer to an open groupz?cannot refer to group defined in the same lookbehind subpattern)rr.r%)rr(sourcerrrchecklookbehindgroupes     zPattern.checklookbehindgroup)N) rrrr propertyr"r*r-r.r0rrrrrJs   rc@s`eZdZdddZdddZddZd d Zd d Zd dZddZ ddZ ddZ ddZ dS) SubPatternNcCs"||_|dkrg}||_d|_dS)N)patterndatawidth)rr3r4rrrr os zSubPattern.__init__rc Csd}ttf}x|jD]\}}t|dt|dd|tkrttx*|D]"\}}t|ddt||qLWq|tkrtx:t|dD]*\}}|rt|dd|j|dqWq|t kr|\}} } td|| j|d| rt|dd| j|dqt ||rd}x\|D]T}t |t rX|sDt|j|dd}n"|sjtd ddt|ddd}q(W|stqtd|qWdS) NTz )endORELSEF ) tuplelistr4printstrINBRANCH enumeratedumpGROUPREF_EXISTS isinstancer2) rlevelnlseqtypesopavrr condgroupitem_yesitem_norrrrCusH          zSubPattern.dumpcCs t|jS)N)reprr4)rrrr__repr__szSubPattern.__repr__cCs t|jS)N)r!r4)rrrr__len__szSubPattern.__len__cCs |j|=dS)N)r4)rindexrrr __delitem__szSubPattern.__delitem__cCs&t|trt|j|j|S|j|S)N)rEslicer2r3r4)rrQrrr __getitem__s zSubPattern.__getitem__cCs||j|<dS)N)r4)rrQcoderrr __setitem__szSubPattern.__setitem__cCs|jj||dS)N)r4insert)rrQrUrrrrWszSubPattern.insertcCs|jj|dS)N)r4r#)rrUrrrr#szSubPattern.appendc Cs|jdk r|jSd}}x|jD]\}}|tkrtd}d}x0|dD]$}|j\}}t||}t||}qJW||}||}q"|tkr|j\}}||}||}q"|tkr|dj\}}||}||}q"|t kr|dj\}}|||d}|||d}q"|t kr,|d}|d}q"|t krX|j j |\}}||}||}q"|tkr|dj\}}|ddk r|dj\}}t||}t||}nd}||}||}q"|tkr"Pq"Wt|tdt|tf|_|jS)Nrr8)r5r4rA MAXREPEATr+minmaxCALL SUBPATTERN _REPEATCODES _UNITCODESGROUPREFr3rrDSUCCESS) rlohirIrJr jlhrrrr+sZ                zSubPattern.getwidth)N)r) rrrr rCrOrPrRrTrVrWr#r+rrrrr2ms  (r2c@sbeZdZddZddZddZddZd d Zd d Ze d dZ ddZ ddZ dddZ dS) TokenizercCs@t|t|_||_|js"t|d}||_d|_d|_|jdS)Nlatin1r)rEr?istextstringdecoded_stringrQnext_Tokenizer__next)rrkrrrr s  zTokenizer.__init__cCs|j}y|j|}Wntk r.d|_dSX|dkr|d7}y||j|7}Wn.tk rtd|jt|jddYnX|d|_||_dS)Nr r8zbad escape (end of pattern))rQrl IndexErrorrmr%rkr!)rrQcharrrr__nexts zTokenizer.__nextcCs||jkr|jdSdS)NTF)rmrn)rrprrrmatchs zTokenizer.matchcCs|j}|j|S)N)rmrn)rthisrrrr&sz Tokenizer.getcCs:d}x0t|D]$}|j}||kr"P||7}|jqW|S)Nr6)rangermrn)rncharsetresult_crrrgetwhiles zTokenizer.getwhilecCshd}x^|j}|j|dkr>|s*|jd|jd|t|||krX|sV|jddP||7}qW|S)Nr6zmissing group namezmissing %s, unterminated namer8)rmrnr%r!)r terminatorrwryrrrgetuntil s     zTokenizer.getuntilcCs|jt|jpdS)Nr6)rQr!rm)rrrrpossz Tokenizer.poscCs|jt|jpdS)Nr6)rQr!rm)rrrrtellszTokenizer.tellcCs||_|jdS)N)rQrn)rrQrrrseekszTokenizer.seekrcCst||j|j|S)N)r%rkr~)rmsgoffsetrrrr%#szTokenizer.errorN)r)rrrr rnrrr&rzr|r1r}r~rr%rrrrrhs   rhc Cstj|}|r|Stj|}|r0|dtkr0|Sy|dd}|dkr||jdt7}t|dkrx|jd|t|tt |dddfS|dkr|j r||jdt7}t|d kr|jd|t|tt |dddfS|d ko|j rF||jd t7}t|d kr$|jd|t|t |ddd}t |t|fS|t kr||jdt 7}t |ddd }|d kr|jd|t|t|fS|t krtt|dkr|tkr|jd|t|tt|dfSWntk rYnX|jd|t|dS)Nrr8rXrzincomplete escape %srU z.octal escape value %s outside of range 0-0o377z bad escape %s)ESCAPESr& CATEGORIESr@rz HEXDIGITSr!r%LITERALintrjchr OCTDIGITSDIGITS ValueError ASCIILETTERSord)r/escaperUryrrr _class_escape&sR         rc Cstj|}|r|Stj|}|r$|Syt|dd}|dkr||jdt7}t|dkrl|jd|t|tt|dddfS|dkr|j r||jdt7}t|dkr|jd|t|tt|dddfS|d ko|j r:||jd t7}t|d kr|jd|t|t|ddd}t |t|fS|d krj||jdt 7}tt|ddd fS|t kr\|j t kr||j7}|dt kr|dt kr|j t kr||j7}t|ddd }|d kr|jd|t|t|fSt|dd}||jkrD|j|s0|jdt||j||t|fS|jd|t|dt|dkr|tkr|jd|t|tt|dfSWntk rYnX|jd|t|dS)Nr8rXrrzincomplete escape %srrrrrr0rz.octal escape value %s outside of range 0-0o377zcannot refer to an open groupzinvalid group reference %dz bad escape %s)rr&rrzrr!r%rrrjrrrrmr"r.r0rarrr)r/rstaterUrygrouprrr_escapeVsn                  rc Cs$g}|j}|j}|j}x.|t||||d| o4| |dsPqWt|dkr\|dSt|}|j} x\d} xP|D]*} | sP| dkr| d} qv| d| krvPqvWx|D] } | d=qW| | qlPqlWxD|D]"} t| dks| ddtk rPqW| tdd|Df|S|jtd|ff|S)Nr8|rcSsg|] }|dqS)rr).0itemrrr sz_parse_sub..) r#rrr~_parser!r2rr@rA) r/rverbosenesteditems itemsappend sourcematchstart subpatternsubpatternappendprefixrrrr _parse_subsD       rcCsht||||d}|jdrDt||||d}|jdkrH|jdnd}t|}|jt|||ff|S)Nr8rz/conditional backref with more than two branches)rrrrmr%r2r#rD)r/rrKrrrLrMrrrr_parse_sub_conds   rFc)Cs t|}|j}|j}|j}t} t} x|j} | dkr6P| dkr@P||r|| tkrTq&| dkr|x|} | dkst| dkr^Pq^Wq&| ddkrt|| |} || q&| t kr|t | | fq&| dkr4|j d} g}|j}|dr|t df|dd}x|} | dkr |j d |j | | d kr8||kr8Pn&| ddkrRt|| }n t | | f}|d r|}|dkr|j d |j | |d kr|dtkr|dd}|||t | d fP|ddkrt||}n t | |f}|dt ks |dt kr4d | |f}|j |t| dt||d}|d}||krvd | |f}|j |t| dt||t||ffn"|dtkr|dd}||qW| |dkr|ddt kr||dnT| |d kr&|ddt kr&|ddt kr&|t|ddfn |t|fq&| tkrb|j } | dkr\d7\}}nJ| dkrtdt}}n2| dkrdt}}n| dkr|jdkr|t | | fq&dt}}d}}x|jtkr||7}qW|drx"|jtkr ||7}qWn|}|ds8|t | | f|j| q&|rXt|}|tkrXtd|rt|}|tkrxtd||kr|j d|j | ntd|f|r|d8d}nd}| s| |dkr|ddtkr|j d|j | t| |ddtkr0|j d|j | t| |drNt|||ff|d9<nt|||ff|d:<q&| dkrz|tdfq&| dk r|j d}d}d}d}d}d}|d r|}|dkr|j d|dkr|dr|jd }|jsd!|}|j |t|dn|d"r|jd#}|jsHd!|}|j |t|d|j j|} | dkrzd$|}|j |t|d|j!| s|j d%t|d|j"| ||t#| fq&n2|}|dkr|j d|j d&|t|d n|d'krd}n|dkrDx4|jdkr*|j d(|j ||d#kr Pq Wq&n|d)kr0d}!|dkr|}|dkrv|j d|d*kr|j d+|t|d d;}!|j$}"|"dkr|j%|_$t&||||d}#|!dkr|"dkrd|_$|d#s|j d,|j ||d"kr|t'|!|#ffq&|t(|!|#ffq&n|dk r$|jd#}$d}|$jr|j j|$}|dk rd$|$}|j |t|$dnyt|$}|dkrt)Wn4t)k rd!|$}|j |t|$ddYnX|s|j d-t|$d|t*k rd.|}|j |t|$d|j"||n|t+k s8|d k rt,|||}%|%dk r| s\| rddl-}&|&j.d/|j/dd0t|j/d0k rd1ndft0|d2d3|j1t2@r&| r&t3q&|%\}}d}n|j d4|t|d|dk r0y|j4|}Wn<t k r.}'z|j |'j5t|ddWYdd}'~'XnX| rLt6|||||d}#n,| s\|t2@ od|t2@ }(t&|||(|d}#|jd# s|j d,|j ||dk r|j7||#|t8||||#ffq&| dk r|tt9fq&| d5k r|jtt:fq&td6|fq&W|S)zbad character in group name %r=)zunknown group name %rzcannot refer to an open groupzunknown extension ?P:zmissing ), unterminated commentz=!|t@rtd|t@s,|tO}qf|t@rftdn(|t@rNtd|t@rf|t@rftd|S)Nz)cannot use LOCALE flag with a str patternz(ASCII and UNICODE flags are incompatiblez,cannot use UNICODE flag with a bytes patternz'ASCII and LOCALE flags are incompatible)rEr?SRE_FLAG_LOCALErSRE_FLAG_ASCIISRE_FLAG_UNICODE)srcrrrr fix_flags<s   rNc Cst|}|dkrt}||_||_yt|||t@d}WnBtk rzt}|tB|_||_|jdt||dd}YnXt||j j|j _|j dk r|j dkst |j d|t @r|j|S)NrTrzunbalanced parenthesis)rhrrr?rrrrrr3rmrr%SRE_FLAG_DEBUGrC)r?rr3r/r,rrrparseLs(    rc st|j}gggj}fdd}j}x|}|dkrNP|ddkr|d}|dkrJd}jdsjd jd }|jry ||} Wn tk rt d |YnXnlyt |} | dkrt Wn0t k rjd |t |ddYnX| t kr4jd | t |d|| t |dq|dkrjtkr||7}jtkr||7}|tt |dddd@q|tkrZd} jtkr4||7}|tkr4|dtkr4jtkr4||7}d} t |ddd}|dkr(jd|t ||t|| s|t |ddt |dnZytt|d}Wn<tk r|tkrddl} | jd|tddYnX||q>||q>Wr؈jdjt|tsddDfS)NcsX|jkrjd||r8jdjdd=jt|fjddS)Nzinvalid group reference %dr6)r"r%r#joinr!)rQr})r"literalliteralsr3rrraddgroupus  z parse_template..addgrouprr r8gr6rz missing .)rhr&r# groupindexrrr%r|rKeyErrorrorrr!r$rmrrrrrrrrrrEr?) r/r3sgetlappendrrrsryr'rQisoctalrr)r"rrr3rrparse_templatels             "             rc Csz|j}|jdd}|\}}|dd}y&x |D]\}}||pB|||<q0WWn tk rntd|YnX|j|S)Nrzinvalid group reference %d)rrkror%r)templaterrremptyr"rrQrrrrexpand_templates r)F)rN)<__doc__ sre_constantsrr frozensetrrrrrrrr_rrr@rrCATEGORYr`rrrZAT_BEGINNING_STRINGZ AT_BOUNDARYZAT_NON_BOUNDARYZCATEGORY_DIGITZCATEGORY_NOT_DIGITZCATEGORY_SPACEZCATEGORY_NOT_SPACEZ CATEGORY_WORDZCATEGORY_NOT_WORDZ AT_END_STRINGrSRE_FLAG_IGNORECASErSRE_FLAG_MULTILINESRE_FLAG_DOTALLrrSRE_FLAG_TEMPLATErrrr Exceptionrrr2rhrrrrrrrrrrrrrr sj               #qH0A3 <, W__future__.cpython-36.opt-2.pyc000064400000004221152462730460012250 0ustar003 \ @sdddddddddg Zd geZd Zd Zd Zd ZdZdZdZdZ dZ GdddZ e d d!eZ e d"d#eZ e d$d%eZe d&d'eZe d(d)eZe d*d+eZe d,d-eZe d.d/e Ze d0d1e ZdS)2 nested_scopes generatorsdivisionabsolute_importwith_statementprint_functionunicode_literalsbarry_as_FLUFLgenerator_stopall_feature_namesi i@iiiiic@s,eZdZddZddZddZddZd S) _FeaturecCs||_||_||_dS)N)optional mandatory compiler_flag)selfZoptionalReleaseZmandatoryReleaserr"/usr/lib64/python3.6/__future__.py__init__Osz_Feature.__init__cCs|jS)N)r)rrrrgetOptionalReleaseTsz_Feature.getOptionalReleasecCs|jS)N)r)rrrrgetMandatoryRelease\sz_Feature.getMandatoryReleasecCsdt|j|j|jfS)Nr )reprrrr)rrrr__repr__esz_Feature.__repr__N)__name__ __module__ __qualname__rrrrrrrrr Ns r betaalphafinal N)rrr rr)rrr rr )rrr rr)rr r r!r )rrr rr)r r r rr )rr"r rr)r r r rr )rr"r rr)rr#r rr )rr#r rr)r r r rr )rr#r rr)r r r rr )r rr rr)r r$r rr )r r"r rr)r r%r rr )r __all__Z CO_NESTEDZCO_GENERATOR_ALLOWEDZCO_FUTURE_DIVISIONZCO_FUTURE_ABSOLUTE_IMPORTZCO_FUTURE_WITH_STATEMENTZCO_FUTURE_PRINT_FUNCTIONZCO_FUTURE_UNICODE_LITERALSZCO_FUTURE_BARRY_AS_BDFLZCO_FUTURE_GENERATOR_STOPr rrrrrrrrr rrrr3s\ smtpd.cpython-36.opt-1.pyc000064400000064075152462730460011305 0ustar003 \@s^dZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z mZddddd gZejdZd ZGd d d Zead ZdZdZd%ddZGdddejZGdddejZGdddeZGdddeZGdd d eZGdddZ ddZ!e"dkrZe!Z#e#j$Z$de$krpe$j%dZ&e'e$de&e(e)dgZ*e$e&ddZ$nddl+Z*e,e*e$Z-e-e#j.e#j/fe#j0e#j1fe#j2e#j3dZ4e#j5r6y ddl6Z6Wn.e7k re8d ej9d!ej:dYnXe6j;d"d#ZWne?k rXYnXdS)&aAn RFC 5321 smtp proxy with optional RFC 1870 and RFC 6531 extensions. Usage: %(program)s [options] [localhost:localport [remotehost:remoteport]] Options: --nosetuid -n This program generally tries to setuid `nobody', unless this flag is set. The setuid call will fail if this program is not run as root (in which case, use this flag). --version -V Print the version number and exit. --class classname -c classname Use `classname' as the concrete SMTP proxy class. Uses `PureProxy' by default. --size limit -s limit Restrict the total size of the incoming message to "limit" number of bytes via the RFC 1870 SIZE extension. Defaults to 33554432 bytes. --smtputf8 -u Enable the SMTPUTF8 extension and behave as an RFC 6531 smtp proxy. --debug -d Turn on debugging prints. --help -h Print this message and exit. Version: %(__version__)s If localhost is not given then `localhost' is used, and if localport is not given then 8025 is used. If remotehost is not given then `localhost' is used, and if remoteport is not given, then 25 is used. N)warn) get_addr_specget_angle_addr SMTPChannel SMTPServerDebuggingServer PureProxy MailmanProxyzPython SMTP proxy version 0.3c@seZdZddZddZdS)DevnullcCsdS)N)selfmsgr r /usr/lib64/python3.6/smtpd.pywritefsz Devnull.writecCsdS)Nr )r r r rflushgsz Devnull.flushN)__name__ __module__ __qualname__rrr r r rr esr  z, icCs4ttttjd|r&t|tjdtj|dS)N)file)print__doc__globalssysstderrexit)coder r r rusagepsrc@seZdZdZdZdZejefddZe ddZ e dd d fd d Z d d Z ddZe ddZejddZe ddZejddZe ddZejddZe ddZejddZe ddZejddZe dd Zejd!d Ze d"d#Zejd$d#Ze d%d&Zejd'd&Ze d(d)Zejd*d)Ze d+d,Zejd-d,Ze d.d/Zejd0d/Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Zd;d<Z d=d>Z!d?d@Z"dAdBZ#dCdDZ$dEdFZ%dGdHZ&dIdJZ'dKdLZ(dMdNZ)dOdPZ*dQdRZ+dS)SrricCs|S)Nr )xr r r|szSMTPChannel.c Cs*yt|jjStk r$|jSXdS)N)maxcommand_size_limitsvalues ValueErrorcommand_size_limit)r r r rmax_command_size_limit~sz"SMTPChannel.max_command_size_limitNFc Cstjj|||d||_||_||_||_||_||_|rF|rFt d|rdd|_ d|_ d|_ t |_nd|_ d|_ td|_ d |_|jd|_d |_|jjtj|_y|j|_Wn:tk r}z|j|jd tjkrdSd}~XnXtd t |jt!d |j"d|jt#fdS)N)mapzFdecode_data and enable_SMTPUTF8 cannot be set to True at the same timerz .s . FrzPeer:)rz 220 %s %s)$asynchat async_chat__init__ smtp_serverconnaddrdata_size_limitenable_SMTPUTF8 _decode_datar% _emptystring_linesep_dotsepNEWLINE_newlineord_set_rset_state seen_greeting extended_smtpr#clearsocketZgetfqdnfqdnZ getpeernamepeerOSErrorcloseargserrnoZENOTCONNrrepr DEBUGSTREAMpush __version__) r Zserverr1r2r3r(r4 decode_dataerrr r rr/s@   zSMTPChannel.__init__cCs.|j|_d|_g|_d|_d|_|jddS)z/Reset state variables to their post-DATA state.NFrs )COMMAND smtp_statemailfromrcpttosrequire_SMTPUTF8 num_bytesset_terminator)r r r r_set_post_data_states z SMTPChannel._set_post_data_statecCs|jd|_g|_dS)z.Reset all state variables except the greeting.rN)rT received_datareceived_lines)r r r rr<szSMTPChannel._set_rset_statecCstdtd|jS)NzTAccess to __server attribute on SMTPChannel is deprecated, use 'smtp_server' instead)rDeprecationWarningr0)r r r r__serverszSMTPChannel.__servercCstdtd||_dS)NzRSetting __server attribute on SMTPChannel is deprecated, set 'smtp_server' insteadrW)rrXr0)r valuer r rrYscCstdtd|jS)NzUAccess to __line attribute on SMTPChannel is deprecated, use 'received_lines' insteadrW)rrXrV)r r r r__lineszSMTPChannel.__linecCstdtd||_dS)NzSSetting __line attribute on SMTPChannel is deprecated, set 'received_lines' insteadrW)rrXrV)r rZr r rr[scCstdtd|jS)NzRAccess to __state attribute on SMTPChannel is deprecated, use 'smtp_state' insteadrW)rrXrN)r r r r__stateszSMTPChannel.__statecCstdtd||_dS)NzPSetting __state attribute on SMTPChannel is deprecated, set 'smtp_state' insteadrW)rrXrN)r rZr r rr\scCstdtd|jS)NzXAccess to __greeting attribute on SMTPChannel is deprecated, use 'seen_greeting' insteadrW)rrXr=)r r r r __greetingszSMTPChannel.__greetingcCstdtd||_dS)NzVSetting __greeting attribute on SMTPChannel is deprecated, set 'seen_greeting' insteadrW)rrXr=)r rZr r rr]scCstdtd|jS)NzSAccess to __mailfrom attribute on SMTPChannel is deprecated, use 'mailfrom' insteadrW)rrXrO)r r r r __mailfromszSMTPChannel.__mailfromcCstdtd||_dS)NzQSetting __mailfrom attribute on SMTPChannel is deprecated, set 'mailfrom' insteadrW)rrXrO)r rZr r rr^scCstdtd|jS)NzQAccess to __rcpttos attribute on SMTPChannel is deprecated, use 'rcpttos' insteadrW)rrXrP)r r r r __rcpttosszSMTPChannel.__rcpttoscCstdtd||_dS)NzOSetting __rcpttos attribute on SMTPChannel is deprecated, set 'rcpttos' insteadrW)rrXrP)r rZr r rr_scCstdtd|jS)NzTAccess to __data attribute on SMTPChannel is deprecated, use 'received_data' insteadrW)rrXrU)r r r r__dataszSMTPChannel.__datacCstdtd||_dS)NzRSetting __data attribute on SMTPChannel is deprecated, set 'received_data' insteadrW)rrXrU)r rZr r rr`scCstdtd|jS)NzKAccess to __fqdn attribute on SMTPChannel is deprecated, use 'fqdn' insteadrW)rrXrA)r r r r__fqdn szSMTPChannel.__fqdncCstdtd||_dS)NzISetting __fqdn attribute on SMTPChannel is deprecated, set 'fqdn' insteadrW)rrXrA)r rZr r rrascCstdtd|jS)NzKAccess to __peer attribute on SMTPChannel is deprecated, use 'peer' insteadrW)rrXrB)r r r r__peerszSMTPChannel.__peercCstdtd||_dS)NzISetting __peer attribute on SMTPChannel is deprecated, set 'peer' insteadrW)rrXrB)r rZr r rrbscCstdtd|jS)NzKAccess to __conn attribute on SMTPChannel is deprecated, use 'conn' insteadrW)rrXr1)r r r r__conn szSMTPChannel.__conncCstdtd||_dS)NzISetting __conn attribute on SMTPChannel is deprecated, set 'conn' insteadrW)rrXr1)r rZr r rrc%scCstdtd|jS)NzKAccess to __addr attribute on SMTPChannel is deprecated, use 'addr' insteadrW)rrXr2)r r r r__addr+szSMTPChannel.__addrcCstdtd||_dS)NzISetting __addr attribute on SMTPChannel is deprecated, set 'addr' insteadrW)rrXr2)r rZr r rrd0scCs&tjj|t|d|jrdnddS)Nz zutf-8ascii)r-r.rIbytesrQ)r r r r rrI7s zSMTPChannel.pushcCs|d}|j|jkr|j}n|j|jkr*|j}|r<|j|krr#r&getattrrgr3splitr7r8rir:rUrBrOrProrpr0process_messagerT) r lineZszicommandargZmax_szmethodrktextrEkwargsZstatusr r rfound_terminatorLsd        zSMTPChannel.found_terminatorcCsH|s|jddS|jr&|jddS|j||_|jd|jdS)Nz501 Syntax: HELO hostnamez503 Duplicate HELO/EHLOz250 %s)rIr=r<rA)r r{r r r smtp_HELOs  zSMTPChannel.smtp_HELOcCs|s|jddS|jr&|jddS|j||_d|_|jd|j|jrr|jd|j|jdd7<|js|jd|jr|jd |jdd 7<|jd dS) Nz501 Syntax: EHLO hostnamez503 Duplicate HELO/EHLOTz250-%sz 250-SIZE %sMAILz 250-8BITMIMEz 250-SMTPUTF8 z250 HELP) rIr=r<r>rAr3r#r5r4)r r{r r r smtp_EHLOs&    zSMTPChannel.smtp_EHLOcCs|r|jdn |jddS)Nz501 Syntax: NOOPz250 OK)rI)r r{r r r smtp_NOOPs zSMTPChannel.smtp_NOOPcCs|jd|jdS)Nz221 Bye)rIZclose_when_done)r r{r r r smtp_QUITs zSMTPChannel.smtp_QUITcCs0t|}|d|j|kr,||djSdS)Nr)rhrsrt)r keywordr{Zkeylenr r r_strip_command_keywordsz"SMTPChannel._strip_command_keywordcCsF|sdS|jjdr$t|\}}n t|\}}|s<||fS|j|fS)Nr<)rr)lstrip startswithrrZ addr_spec)r r{addressrestr r r_getaddrs zSMTPChannel._getaddrcCsNi}xD|D]<}|jd\}}}|j s2|r6| r6dS|r>|nd||<q W|S)N=T) partitionisalnum)r paramsresultZparameqrZr r r _getparamss zSMTPChannel._getparamscCs|rd}|j}|dkr$|jdq|dkr8|jdq|dkr^d}|jrR||7}|j|q|dkrd }|jrx||7}|j|q|d kr|jd q|d kr|jd q|dkr|jdq|dkr|jdq|dkr|jdq|jdn |jddS)Nz [SP ]ZEHLOz250 Syntax: EHLO hostnameZHELOz250 Syntax: HELO hostnamerz 250 Syntax: MAIL FROM:
ZRCPTz250 Syntax: RCPT TO:
rgz250 Syntax: DATAZRSETz250 Syntax: RSETZNOOPz250 Syntax: NOOPZQUITz250 Syntax: QUITZVRFYz250 Syntax: VRFY
zD501 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFYzD250 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFY)rsrIr>)r r{ZextendedZlc_argr r r r smtp_HELPs:          zSMTPChannel.smtp_HELPcCs@|r2|j|\}}|r"|jdq<|jd|n |jddS)NzB252 Cannot VRFY user, but will accept message and attempt deliveryz502 Could not VRFY %sz501 Syntax: VRFY
)rrI)r r{rrr r r smtp_VRFYs  zSMTPChannel.smtp_VRFYcCs|js|jddStd|tdd}|jr4|d7}|dkrJ|j|dS|jd|}|j|\}}|sv|j|dS|j r|r|j|dS|jr|jddS|jj |_ |j |j }|dkr|j|dS|j s|j dd }|dkr|jd dS|jr>|j d d }|dkr&d|_n|d k r>|jddS|j dd}|r|jsh|j|dS|jrt||jkr|jddSt|jdkr|jddS||_td|jtd|jddS)Nz503 Error: send HELO firstz ===> MAIL)rz 501 Syntax: MAIL FROM:
z [SP ]zFROM:z503 Error: nested MAIL commandZBODY7BIT8BITMIMEz1501 Error: BODY can only be one of 7BIT, 8BITMIMEZSMTPUTF8FTz&501 Error: SMTPUTF8 takes no argumentsZSIZEz:552 Error: message size exceeds fixed maximum message sizerz:555 MAIL FROM parameters not recognized or not implementedzsender:z250 OK)rr)r=rIrrHr>rrrOrsrvrorr5popr4rQisdigitr3intrhkeys)r r{ syntaxerrrrZbodysmtputf8sizer r r smtp_MAILsh                     zSMTPChannel.smtp_MAILcCs|js|jddStd|td|js6|jddSd}|jrH|d7}|dkr^|j|dS|jd|}|j|\}}|s|j|dS|j r|r|j|dS|jj |_ |j |j }|dkr|j|dSt |j dkr|jd dS|jj|td |jtd|jd dS) Nz503 Error: send HELO firstz ===> RCPT)rz503 Error: need MAIL commandz501 Syntax: RCPT TO:
z [SP ]zTO:rz8555 RCPT TO parameters not recognized or not implementedzrecips:z250 OK)r=rIrrHrOr>rrrsrvrprrhrrPri)r r{rrrr r r smtp_RCPT7s@           zSMTPChannel.smtp_RCPTcCs(|r|jddS|j|jddS)Nz501 Syntax: RSETz250 OK)rIr<)r r{r r r smtp_RSETZs  zSMTPChannel.smtp_RSETcCsZ|js|jddS|js(|jddS|r:|jddS|j|_|jd|jddS)Nz503 Error: send HELO firstz503 Error: need RCPT commandz501 Syntax: DATAs . z#354 End data with .)r=rIrPrgrNrS)r r{r r r smtp_DATAas    zSMTPChannel.smtp_DATAcCs|jddS)Nz502 EXPN not implemented)rI)r r{r r r smtp_EXPNpszSMTPChannel.smtp_EXPN),rrrrMrgr& collections defaultdictr#propertyr'DATA_SIZE_DEFAULTr/rTr<Z_SMTPChannel__serversetterZ_SMTPChannel__lineZ_SMTPChannel__stateZ_SMTPChannel__greetingZ_SMTPChannel__mailfromZ_SMTPChannel__rcpttosZ_SMTPChannel__dataZ_SMTPChannel__fqdnZ_SMTPChannel__peerZ_SMTPChannel__connZ_SMTPChannel__addrrIrmrrrrrrrrrrrrrrrr r r rrws` &            >   # 6#c@s2eZdZeZedddfddZddZddZdS) rNFc Cs||_||_||_||_||_|r.|r.tdtjj||dyNt j |dt j i}|j |dd|dd|j |j||jdWn|jYn(Xtd|jjtjtj||ftddS) NzFdecode_data and enable_SMTPUTF8 cannot be set to True at the same time)r(typerrz0%s started at %s Local addr: %s Remote addr:%s)r)Z _localaddr _remoteaddrr3r4r5r%asyncore dispatcherr/r@Z getaddrinfoZ SOCK_STREAMZ create_socketZset_reuse_addrZbindZlistenrDr __class__rtimectimerH)r Z localaddrZ remoteaddrr3r(r4rKZ gai_resultsr r rr/xs*  zSMTPServer.__init__cCs6tdt|td|j||||j|j|j|j}dS)NzIncoming connection from %s)r)rrGrH channel_classr3Z_mapr4r5)r r1r2Zchannelr r rhandle_acceptedszSMTPServer.handle_acceptedcKstdS)aOverride this abstract method to handle messages from the client. peer is a tuple containing (ipaddr, port) of the client that made the socket connection to our smtp port. mailfrom is the raw address the client claims the message is coming from. rcpttos is a list of raw addresses the client wishes to deliver the message to. data is a string containing the entire full text of the message, headers (if supplied) and all. It has been `de-transparencied' according to RFC 821, Section 4.5.2. In other words, a line containing a `.' followed by other text has had the leading dot removed. kwargs is a dictionary containing additional information. It is empty if decode_data=True was given as init parameter, otherwise it will contain the following keys: 'mail_options': list of parameters to the mail command. All elements are uppercase strings. Example: ['BODY=8BITMIME', 'SMTPUTF8']. 'rcpt_options': same, for the rcpt command. This function should return None for a normal `250 Ok' response; otherwise, it should return the desired response string in RFC 821 format. N)NotImplementedError)r rBrOrPrkr~r r rrwszSMTPServer.process_message) rrrrrrr/rrwr r r rrts  c@seZdZddZddZdS)rcCsrd}|j}x`|D]X}|rP| rPd|d}t|tsDt|jd}t|d}t|tsbt|}t|qWdS)NrzX-Peer: rzutf-8) splitlines isinstancerjrGencoder)r rBrkZ inheaderslinesrxZ peerheaderr r r_print_message_contents     z&DebuggingServer._print_message_contentcKsXtd|r@|jdr&td|d|jdr@td|d|j||tddS)Nz%---------- MESSAGE FOLLOWS ----------rozmail options: %srpzrcpt options: %s z%------------ END MESSAGE ------------)rgetr)r rBrOrPrkr~r r rrws   zDebuggingServer.process_messageN)rrrrrwr r r rrscs,eZdZfddZddZddZZS)rcs.d|kr|drtdtt|j||dS)Nr4z$PureProxy does not support SMTPUTF8.)r%superrr/)r rEr~)rr rr/szPureProxy.__init__c Csh|jd}d}x|D]}|sP|d7}qW|j|d|dtj|}|j|||}td|tddS)Nrrrz X-Peer: %szwe got some refusals:)r)rvinsertr9rq_deliverrrH) r rBrOrPrkrryrxrefusedr r rrws    zPureProxy.process_messagec Csddl}i}yB|j}|j|jd|jdz|j|||}Wd|jXWn|jk r}ztdtd|j }WYdd}~Xnjt |j fk r}zHtd|j tdt |dd }t |dd} x|D]} || f|| <qWWYdd}~XnX|S) Nrrzgot SMTPRecipientsRefused)rZgotZ smtp_codeZ smtp_errorignore)smtplibZSMTPZconnectrZsendmailquitZSMTPRecipientsRefusedrrHZ recipientsrCZ SMTPExceptionrru) r rOrPrkrrseZerrcodeerrmsgrr r rrs$    "zPureProxy._deliver)rrrr/rwr __classcell__r r )rrrs cs$eZdZfddZddZZS)r cs.d|kr|drtdtt|j||dS)Nr4z'MailmanProxy does not support SMTPUTF8.)r%rrr/)r rEr~)rr rr/ szMailmanProxy.__init__cCs:ddlm}ddlm}ddlm}ddlm}g} x~|D]v} | jjdd} | jd} t| dkrhq:| d} t| dkr| d }nd }|j |  s:|d!krq:| j | | |fq:Wx| D]\} } }|j | qWt ddj |td|r|j|||}t d|tdi}||}|j|}|jds2||d<|jdsPtjtj|d<x| D]\} } }t d| td|j| }|s|j| dd}||| <|d kr|j|d dn|d kr|j|d dnh|d kr|j|d dnN|d kr|j|d dn4|d"krV|dkrd|d<nd |d<|j|d dqVWdS)#Nr)StringIO)Utils)Message)MailList@-rWrradminownerrequestrqleavezforwarding recips:rn)rzwe got refusals:fromZFromZdateZDatezsending message to)lock)tolist)Ztoadmin)Ztoowner)Z torequestZ subscribeZSubjectZ unsubscribe)rrrrrqr)rqr)iorZMailmanrrrlowerrvrhZ list_existsriremoverrqrHrrrrZEnqueue)r rBrOrPrkrrrrZ listnamesZrcptZlocalpartsZlistnamerzrZmlistsrr Zmlistr r rrwsd                    zMailmanProxy.process_message)rrrr/rwrr r )rrr s c@seZdZdZdZdZdZdS)OptionsTrNF)rrrsetuid classname size_limitr4r r r rr_src !Csty.tjtjdddddddddd g\}}Wn.tjk r\}ztd|WYdd}~XnXt}x|D]\}}|d'krtd qj|d(krtttjd qj|d)krd|_ qj|d*kr||_ qj|d+krtj a qj|d,krd|_ qj|d-krjyt|}||_Wqjtd|tj dtjdYqjXqjWt|dkr@d}d}nPt|dkr\|d }d}n4t|d kr||d }|d}ntdd!tj||jd"} | d krtdd#||d| |_yt|| dd|_Wn$tk rtdd$|YnX|jd"} | d kr"tdd%||d| |_yt|| dd|_Wn$tk rntdd&|YnX|S).Nrz nVhc:s:duzclass=Znosetuidversionhelpzsize=debugr-h--helpr-V --version-n --nosetuidF-c--class-d--debug-u --smtputf8T-s--sizezInvalid size: )rzlocalhost:8025z localhost:25rWzInvalid arguments: %s:zBad local spec: %szBad local port: %szBad remote spec: %szBad remote port: %s)rr)rr)rr)rr)rr)rr)rr)getoptrargverrorrrrrJrrrrrHr4rrrh COMMASPACErqrr localhost localportr% remotehost remoteport) ZoptsrEroptionsoptr{Zint_sizeZ localspecZ remotespecryr r r parseargsfsp         r__main__r)r)r4z7Cannot import module "pwd"; try running with -n option.)rnobodyrWz3Cannot setuid "nobody"; try running with -n option.)r)@rrosrFrrr@rr-rwarningsrZemail._header_value_parserrr__all__rZprogramrJr rHr9rrrr.rrrrrr rrrrrrfindZlastdot __import__rlocalsmodrruZclass_rrrrrr4proxyrpwd ImportErrorrrrgetpwnamrPermissionErrorZloopKeyboardInterruptr r r r-sx#   M-SB        random.cpython-36.pyc000064400000045604152462730460010474 0ustar003 \2k@sdZddlmZddlmZmZddl m Z m Z mZmZmZddl mZmZmZmZddlmZddlm Z!m"Z#ddl$m%Z&dd l'Z(dd l)Z*d d d d ddddddddddddddddddd d!gZ+d"e d2ed$Z,d$eZ-e d%Z.d&e d'Z/d(Z0d)e0 Z1dd l2Z2Gd*d d e2j3Z3Gd+d!d!e3Z4d,d-Z5d3d/d0Z6e3Z7e7j8Z8e7j9Z9e7j:Z:e7j;Z;e7jZ>e7j?Z?e7j@Z@e7jAZAe7jBZBe7jCZCe7jDZDe7jEZEe7jFZFe7jGZGe7jHZHe7jIZIe7jJZJe7jKZKe7jLZLe7jMZMeNd1kre6d S)4aRandom variable generators. integers -------- uniform within range sequences --------- pick random element pick random sample pick weighted random sample generate random permutation distributions on the real line: ------------------------------ uniform triangular normal (Gaussian) lognormal negative exponential gamma beta pareto Weibull distributions on the circle (angles 0 to 2pi) --------------------------------------------- circular uniform von Mises General notes on the underlying Mersenne Twister core generator: * The period is 2**19937-1. * It is one of the most extensively tested generators in existence. * The random() method is implemented in C, executes in a single Python step, and is, therefore, threadsafe. )warn) MethodTypeBuiltinMethodType)logexppieceil)sqrtacoscossin)urandom)SetSequence)sha512NRandomseedrandomuniformrandintchoicesample randrangeshuffle normalvariatelognormvariate expovariatevonmisesvariate gammavariate triangulargauss betavariate paretovariateweibullvariategetstatesetstate getrandbitschoices SystemRandomg?g@g@g?g@5cseZdZdZdZd;ddZd<fdd Zfd d Zfd d Zd dZ ddZ ddZ dde fddZ ddZe de>eeefddZddZd=ddZddZd>ddd d!d"Zd#d$Zd?d'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Z d7d8Z!d9d:Z"Z#S)@raRandom number generator base class used by bound module functions. Used to instantiate instances of Random to get generators that don't share state. Class Random can also be subclassed if you want to use a different basic generator of your own devising: in that case, override the following methods: random(), seed(), getstate(), and setstate(). Optionally, implement a getrandbits() method so that randrange() can cover arbitrarily large ranges. NcCs|j|d|_dS)zeInitialize an instance. Optional argument x controls seeding, as for Random.seed(). N)r gauss_next)selfxr1/usr/lib64/python3.6/random.py__init__Ws zRandom.__init__r,cs|dkrt|ttfrt|tr*|jdn|}|rBt|dd>nd}x"tt|D]}d||Ad@}qRW|t|N}|d krd n|}|dkrt|tttfrt|tr|j}|t |j 7}t j |d}t j|d |_d S) aInitialize internal state from hashable object. None or no argument seeds from current time or from an operating system specific randomness source if available. If *a* is an int, all bits are used. For version 2 (the default), all of the bits are used if *a* is a str, bytes, or bytearray. For version 1 (provided for reproducing random sequences from older versions of Python), the algorithm for str and bytes generates a narrower range of seeds. zlatin-1riCBlr,bigN) isinstancestrbytesdecodeordmaplen bytearrayencode_sha512Zdigestint from_bytessuperrr.)r/aversionr0c) __class__r1r2r`s    z Random.seedcs|jtj|jfS)z9Return internal state; can be passed to setstate() later.)VERSIONrEr%r.)r/)rIr1r2r%szRandom.getstatecs|d}|dkr*|\}}|_tj|nt|dkr|\}}|_ytdd|D}Wn(tk r|}z t|WYdd}~XnXtj|ntd||jfdS)z:Restore internal state from object returned by getstate().rr-r,css|]}|dVqdS)r, Nlr1).0r0r1r1r2 sz"Random.setstate..Nz?state with version %s passed to Random.setstate() of version %s)r.rEr&tuple ValueError TypeErrorrJ)r/staterGZ internalstater)rIr1r2r&s  zRandom.setstatecCs|jS)N)r%)r/r1r1r2 __getstate__szRandom.__getstate__cCs|j|dS)N)r&)r/rQr1r1r2 __setstate__szRandom.__setstate__cCs|jf|jfS)N)rIr%)r/r1r1r2 __reduce__szRandom.__reduce__r4c Cs||}||krtd|dkr:|dkr2|j|Std||}||krRtd||}|dkrx|dkrx||j|S|dkrtd|||f||}||krtd|dkr||d|} n"|dkr||d|} ntd | dkrtd|||j| S) zChoose a random item from range(start, stop[, step]). This fixes the problem with randint() which includes the endpoint; in Python this is usually not what you want. z!non-integer arg 1 for randrange()Nrzempty range for randrange()z non-integer stop for randrange()r4z'empty range for randrange() (%d,%d, %d)z non-integer step for randrange()zzero step for randrange())rO _randbelow) r/startstopstep_intZistartZistopwidthZistepnr1r1r2rs4  zRandom.randrangecCs|j||dS)zJReturn random integer in range [a, b], including both end points. r4)r)r/rFbr1r1r2rszRandom.randintc Cs|j}|j}|||ks$|||krN|j} || } x| |krH|| } q6W| S||krltd|||S|dkr|td||} || |} |} x| | kr|} qW|| ||S)zCReturn a random int in the range [0,n). Raises ValueError if n==0.zUnderlying random() generator does not supply enough bits to choose from a population range this large. To remove the range limitation, add a getrandbits() method.rzBoundary cannot be zero)rr' bit_length_warnrO) r/r[rCmaxsizetypeZMethodZ BuiltinMethodrr'krZremlimitr1r1r2rUs&     zRandom._randbelowc Cs:y|jt|}Wntk r0tddYnX||S)z2Choose a random element from a non-empty sequence.z$Cannot choose from an empty sequenceN)rUr?rO IndexError)r/seqir1r1r2rs z Random.choicecCs|dkrR|j}xttdt|D]*}||d}||||||<||<q"WnLt}xFttdt|D]0}|||d}||||||<||<qjWdS)zShuffle list x in place, and return None. Optional argument random is a 0-argument function returning a random float in [0.0, 1.0); if it is the default None, the standard random.random will be used. Nr4)rUreversedranger?rC)r/r0r randbelowrfjrYr1r1r2rs   zRandom.shufflec Cs(t|trt|}t|ts$td|j}t|}d|koD|knsRtddg|}d}|dkr|dtt |dd7}||krt |}xt |D]0}|||} || ||<|||d || <qWnRt } | j } xDt |D]8}||} x| | kr ||} qW| | || ||<qW|S) a=Chooses k unique random elements from a population sequence or set. Returns a new list containing elements from the population while leaving the original population unchanged. The resulting list is in selection order so that all sub-slices will also be valid random samples. This allows raffle winners (the sample) to be partitioned into grand prize and second place winners (the subslices). Members of the population need not be hashable or unique. If the population contains repeats, then each occurrence is a possible selection in the sample. To choose a sample in a range of integers, use range as an argument. This is especially fast and space efficient for sampling from a large population: sample(range(10000000), 60) z>Population must be a sequence or set. For dicts, use list(d).rz,Sample larger than population or is negativeNr*r-r4)r9_SetrN _SequencerPrUr?rO_ceil_loglistrhsetadd) r/ populationrarir[resultZsetsizeZpoolrfrjZselectedZ selected_addr1r1r2rs6       z Random.sample) cum_weightsracs|jdkrN|dkr>ttfddt|DSttj|n|dk r^tdttkrvtdt j dtdfddt|DS) zReturn a k sized list of population elements chosen with replacement. If the relative weights or cumulative weights are not specified, the selections are made with equal probability. Ncsg|]}qSr1r1)rLrf)rYrtrtotalr1r2 csz"Random.choices..z2Cannot specify both weights and cumulative weightsz3The number of weights does not match the populationr4cs$g|]}dqS)rr1)rLrf)bisectrvhirtrrwr1r2rxlsr7) rrCr?rhrq _itertools accumulaterPrO_bisectry)r/rtZweightsrvrar1)rYryrvrzrtrrwr2r(Ws  zRandom.choicescCs||||jS)zHGet a random number in the range [a, b) or [a, b] depending on rounding.)r)r/rFr\r1r1r2rsszRandom.uniform?c Csx|j}y |dkrdn||||}Wntk r<|SX||kr`d|}d|}||}}|||||dS)zTriangular distribution. Continuous distribution bounded by given lower and upper limits, and having a given mode value in-between. http://en.wikipedia.org/wiki/Triangular_distribution Ng?g?)rZeroDivisionError)r/ZlowZhighmodeurHr1r1r2r ys   zRandom.triangularcCsT|j}x@|}d|}t|d|}||d}|t| krPqW|||S)z\Normal distribution. mu is the mean, and sigma is the standard deviation. g?g?g@)r NV_MAGICCONSTrp)r/musigmaru1u2zZzzr1r1r2rs   zRandom.normalvariatecCst|j||S)zLog normal distribution. If you take the natural logarithm of this distribution, you'll get a normal distribution with mean mu and standard deviation sigma. mu can have any value, and sigma must be greater than zero. )_expr)r/rrr1r1r2rszRandom.lognormvariatecCstd|j |S)a^Exponential distribution. lambd is 1.0 divided by the desired mean. It should be nonzero. (The parameter would be called "lambda", but that is a reserved word in Python.) Returned values range from 0 to positive infinity if lambd is positive, and from negative infinity to 0 if lambd is negative. g?)rpr)r/Zlambdr1r1r2rszRandom.expovariatecCs|j}|dkrt|Sd|}|td||}xN|}tt|}|||}|} | d||ks~| d|t|kr6Pq6Wd|} | |d| |} |} | dkr|t| t} n|t| t} | S)aFCircular data distribution. mu is the mean angle, expressed in radians between 0 and 2*pi, and kappa is the concentration parameter, which must be greater than or equal to zero. If kappa is equal to zero, this distribution reduces to a uniform random angle over the range 0 to 2*pi. gư>g?g?)rTWOPI_sqrt_cos_pir_acos)r/rZkapparsrbrrdrqfZu3Zthetar1r1r2rs&   $zRandom.vonmisesvariatecCs|dks|dkrtd|j}|dkrtd|d}|t}||}x|}d|ko`dknshqHd|}t|d||} |t| } |||} ||| | } | td| dks| t| krH| |SqHWn|dkr|} x| dkr|} qWt|  |Sx|} t|t}|| }|dkrD|d|} nt||| } |}|dkr||| |dkrPn|t| krPqW| |SdS) aZGamma distribution. Not the gamma function! Conditions on the parameters are alpha > 0 and beta > 0. The probability distribution function is: x ** (alpha - 1) * math.exp(-x / beta) pdf(x) = -------------------------------------- math.gamma(alpha) * beta ** alpha gz*gammavariate: alpha and beta must be > 0.0g?g@gHz>gP?g@N)rOrrLOG4rpr SG_MAGICCONST_e)r/alphabetarZainvZbbbZcccrrvr0rrbrr\pr1r1r2rsJ          zRandom.gammavariatecCs`|j}|j}d|_|dkrT|t}tdtd|}t||}t|||_|||S)zGaussian distribution. mu is the mean, and sigma is the standard deviation. This is slightly faster than the normalvariate() function. Not thread-safe without a lock around calls. Ng@g?g)rr.rrrpr_sin)r/rrrrZx2piZg2radr1r1r2r!?s  z Random.gausscCs0|j|d}|dkrdS|||j|dSdS)zBeta distribution. Conditions on the parameters are alpha > 0 and beta > 0. Returned values range between 0 and 1. g?rgN)r)r/rryr1r1r2r"ts zRandom.betavariatecCsd|j}d|d|S)z3Pareto distribution. alpha is the shape parameter.g?)r)r/rrr1r1r2r#s zRandom.paretovariatecCs"d|j}|t| d|S)zfWeibull distribution. alpha is the scale parameter and beta is the shape parameter. g?)rrp)r/rrrr1r1r2r$s zRandom.weibullvariate)N)Nr,)N)N)r~rN)$__name__ __module__ __qualname____doc__rJr3rr%r&rRrSrTrCrrBPFr` _MethodType_BuiltinMethodTyperUrrrr(rr rrrrrr!r"r#r$ __classcell__r1r1)rIr2rGs8    ,  :  0H5 c@s8eZdZdZddZddZddZdd ZeZZ d S) r)zAlternate random number generator using sources provided by the operating system (such as /dev/urandom on Unix or CryptGenRandom on Windows). Not available on all systems (see os.urandom() for details). cCstjtddd?tS)z3Get the next random number in the range [0.0, 1.0).r5r6r-)rCrD_urandom RECIP_BPF)r/r1r1r2rszSystemRandom.randomcCsP|dkrtd|t|kr$td|dd}tjt|d}||d|?S)z:getrandbits(k) -> x. Generates an int with k random bits.rz(number of bits must be greater than zeroz#number of bits should be an integerr5r6)rOrCrPrDr)r/raZnumbytesr0r1r1r2r's  zSystemRandom.getrandbitscOsdS)z&sn     Y!  timeit.cpython-36.opt-1.pyc000064400000026525152462730460011447 0ustar003 \4@sdZddlZddlZddlZddlZddddgZdZdZd Zej Z e Z d Z d d ZGd ddZdde edfddZdde eedfddZdddddZedkrejedS)amTool for measuring execution time of small code snippets. This module avoids a number of common traps for measuring execution times. See also Tim Peters' introduction to the Algorithms chapter in the Python Cookbook, published by O'Reilly. Library usage: see the Timer class. Command line usage: python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [-p] [-h] [--] [statement] Options: -n/--number N: how many times to execute 'statement' (default: see below) -r/--repeat N: how many times to repeat the timer (default 3) -s/--setup S: statement to be executed once initially (default 'pass'). Execution time of this setup statement is NOT timed. -p/--process: use time.process_time() (default is time.perf_counter()) -t/--time: use time.time() (deprecated) -c/--clock: use time.clock() (deprecated) -v/--verbose: print raw timing results; repeat for more digits precision -u/--unit: set the output time unit (usec, msec, or sec) -h/--help: print this usage message and exit --: separate options from statement, use when statement starts with - statement: statement to be timed (default 'pass') A multi-line statement may be given by specifying each line as a separate argument; indented lines are possible by enclosing an argument in quotes and using leading spaces. Multiple -s options are treated similarly. If -n is not given, a suitable number of loops is calculated by trying successive powers of 10 until the total time is at least 0.2 seconds. Note: there is a certain baseline overhead associated with executing a pass statement. It differs between versions. The code here doesn't try to hide it, but you should be aware of it. The baseline overhead can be measured by invoking the program without arguments. Classes: Timer Functions: timeit(string, string) -> float repeat(string, string) -> list default_timer() -> float NTimertimeitrepeat default_timerz i@Bz def inner(_it, _timer{init}): {setup} _t0 = _timer() for _i in _it: {stmt} _t1 = _timer() return _t1 - _t0 cCs|jddd|S)z*Helper to reindent a multi-line statement.  )replace)srcindentr /usr/lib64/python3.6/timeit.pyreindentPsrc@sPeZdZdZddedfddZdddZefdd Ze efd d Z dd d Z dS)raClass for timing execution speed of small code snippets. The constructor takes a statement to be timed, an additional statement used for setup, and a timer function. Both statements default to 'pass'; the timer function is platform-dependent (see module doc string). If 'globals' is specified, the code will be executed within that namespace (as opposed to inside timeit's namespace). To measure the execution time of the first statement, use the timeit() method. The repeat() method is a convenience to call timeit() multiple times and return a list of results. The statements may contain newlines, as long as they don't contain multi-line string literals. passNc Cs||_i}|dkrtn|}d}t|trJt|td|d}t|d}n*t|rl||d<|d7}d}d}ntd t|trt||tdt|d }n&t|r||d <|d 7}d }ntdt j |||d} | |_ t| td} t | |||d|_ dS)z#Constructor. See class doc string.Nexecr_setupz, _setup=_setupz_setup()z&setup is neither a string nor callableZ_stmtz , _stmt=_stmtz_stmt()z%stmt is neither a string nor callable)stmtsetupinitinner)timer_globals isinstancestrcompiledummy_src_namercallable ValueErrortemplateformatr rr) selfrrrglobalsZlocal_nsZ global_nsrZ stmtprefixr coder r r __init__fs6       zTimer.__init__cCsJddl}ddl}|jdk r:t|jd|jjdtf|jt<|j|ddS)aHelper to print a traceback from the timed code. Typical use: t = Timer(...) # outside the try/except try: t.timeit(...) # or t.repeat(...) except: t.print_exc() The advantage over the standard traceback is that source lines in the compiled template will be displayed. The optional file argument directs where the traceback is sent; it defaults to sys.stderr. rNr)file) linecache tracebackr lensplitrcache print_exc)r#r'r(r)r r r r-s   zTimer.print_excc CsBtjd|}tj}tjz|j||j}Wd|r= 0.2. Calls the timeit method with *number* set to successive powers of ten (10, 100, 1000, ...) up to a maximum of one billion, until the time taken is at least 0.2 second, or the maximum is reached. Returns ``(number, time_taken)``. If *callback* is given and is not None, it will be called after each trial with two arguments: ``callback(number, time_taken)``.  g?)r5r)r#callbackr8r3 time_takenr r r autoranges   zTimer.autorange)N)N) __name__ __module__ __qualname____doc__rr&r-default_numberrdefault_repeatrr>r r r r rTs "  rcCst||||j|S)zCConvenience function to create Timer object and call timeit method.)rr)rrrr3r$r r r rscCst||||j||S)zCConvenience function to create Timer object and call repeat method.)rr)rrrrr3r$r r r rs) _wrap_timerc s^|dkrtjdd}ddl}y(|j|dddddd d d d d g \}}Wn2|jk rx}zt|tddSd}~XnXt}dj|pd}d}g}t} d} d} dddd} dx|D]\} }| d9krt|}| d:kr|j || d;kr|| kr|} ntdtj ddS| dkrPt j }| d?kr`t j }| d@kr| rxd7| d7} | dAkrttd*d+dSqWdj|pd}ddl}tjjd|j|dk r||}t|||}|dkr(d}| rfd,d-}y|j|\}}Wn|jdSy|j| |}Wn|jdSt|}| rxtd.d*jfd/d0|Dtd1|d*d+|d|}| dk r| | }n>d2d0| jD}|jd3d4x|D]\}} ||krPqWtd5| ||| ft|}|d|}t|}||d6krZ|d|}ddl}|jd7||| ftd8ddS)BaMain program, used when run as a script. The optional 'args' argument specifies the command line to be parsed, defaulting to sys.argv[1:]. The return value is an exit code to be passed to sys.exit(); it may be None to indicate success. When an exception happens during timing, a traceback is printed to stderr and the return value is 1. Exceptions at other times (including the template compilation) are not caught. '_wrap_timer' is an internal interface used for unit testing. If it is not None, it must be a callable that accepts a timer function and returns another timer function (used for unit testing). Nr:rz n:u:s:r:tcpvhznumber=zsetup=zrepeat=timeclockZprocessverbosezunit=helpz#use -h/--help for command line helprrg@@g.A)usecZmsecZsecr-n--number-s--setup-u--unitz4Unrecognized unit. Please select usec, msec, or sec.)r'-r--repeat-t--time-c--clock-p --process-v --verbose-h--helpr)endcsd}t|j||ddS)Nz#{num} loops -> {secs:.{prec}g} secs)ZnumZsecsZprec)printr")r3r=msg) precisionr r r<@szmain..callbackz raw times:csg|]}d|fqS)z%.*gr ).0x)rar r Oszmain..z %d loops,cSsg|]\}}||fqSr r )rbZunitscaler r r rdUsT)reversezbest of %d: %.*g %s per looprztThe test results are likely unreliable. The worst time (%.*g %s) was more than four times slower than the best time.r)rLrM)rNrO)rPrQ)rRrS)rTrU)rVrW)rXrY)rZr[)r\r])sysargvgetopterrorr_rjoinrDintr6stderrrFrGZ process_timerBospathinsertcurdirrr>r-rminitemssortmaxwarnings warn_explicit UserWarning)argsrEriZoptserrrrr3rrrHZ time_unitZunitsoarnr9r<_r7ZbestrKreZscalesZworstrvr )rar mains                        r~__main__)N)rBr/rgrFr.__all__rrCrDZ perf_counterrr$rr!rrrrr~r?exitr r r r 3s*  y_compat_pickle.cpython-36.opt-1.pyc000064400000014556152462730460013126 0ustar003 \-"C@sdddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d**Zddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddi!Zd ZyeWnek rYn Xed 7ZxeD]Zdefedef<q*Wd ZxeD]ZdQefedef<qPWeddejDZ eddejDZ ej dddddd"d"dEdEdEd(ddd e j dd(d/dddej d d ddddddie j ddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-i d.Z xe D]Zd/e def<qzWd0Z xe D]Zd1e def<qWdS(2builtinscopyregZqueueZ socketserverZ configparserreprlibtkinter.filedialogtkinter.simpledialogztkinter.colorchooserztkinter.commondialogztkinter.dialogz tkinter.dndz tkinter.fontztkinter.messageboxztkinter.scrolledtextztkinter.constantsz tkinter.tixz tkinter.ttkZtkinterZ _markupbasewinreg_threadZ _dummy_threadzdbm.bsdzdbm.dumbzdbm.ndbmzdbm.gnuz xmlrpc.client xmlrpc.serverz http.clientz html.entitiesz html.parserz http.cookieszhttp.cookiejar http.serverz test.support subprocess urllib.parsezurllib.robotparserurllib.requestdbmzcollections.abc)* __builtin__Zcopy_regZQueueZ SocketServerZ ConfigParserreprZ tkFileDialogZtkSimpleDialogZtkColorChooserZtkCommonDialogZDialogZTkdndZtkFontZ tkMessageBoxZ ScrolledTextZ TkconstantsZTixZttkZTkinterZ markupbase_winregZthreadZ dummy_threadZdbhashZdumbdbmr gdbmZ xmlrpclibZSimpleXMLRPCServerZhttplibZhtmlentitydefsZ HTMLParserZCookieZ cookielibZBaseHTTPServerztest.test_supportZcommandsZurlparseZ robotparserurllib2ZanydbmZ_abcollrxrangerangereduce functoolsinternsysunichrchrunicodestrlongint itertoolsizipzipimapmapifilterfilter ifilterfalse filterfalse izip_longest zip_longestUserDictIterableUserDict collectionsUserList UserStringwhichdb_socketfromfdsocket_multiprocessing Connectionmultiprocessing.connectionmultiprocessing.processProcessmultiprocessing.contextmultiprocessing.forkingPopenmultiprocessing.popen_forkurllibContentTooShortError urllib.error getproxies pathname2url quote_plusquote unquote_plusunquote url2pathname urlcleanup urlencodeurlopen urlretriever HTTPErrorURLErrorArithmeticErrorAssertionErrorAttributeError BaseException BufferError BytesWarningDeprecationWarningEOFErrorEnvironmentError ExceptionFloatingPointError FutureWarning GeneratorExitIOError ImportError ImportWarningIndentationError IndexErrorKeyErrorKeyboardInterrupt LookupError MemoryError NameErrorNotImplementedErrorOSError OverflowErrorPendingDeprecationWarningReferenceError RuntimeErrorRuntimeWarning StopIteration SyntaxError SyntaxWarning SystemError SystemExitTabError TypeErrorUnboundLocalErrorUnicodeDecodeErrorUnicodeEncodeError UnicodeErrorUnicodeTranslateErrorUnicodeWarning UserWarning ValueErrorWarningZeroDivisionError WindowsError exceptionsAuthenticationErrorBufferTooShort ProcessError TimeoutErrorZmultiprocessingccs|]\}}||fVqdS)N).0kvrr&/usr/lib64/python3.6/_compat_pickle.py srccs|]\}}||fVqdS)Nr)rrrrrrrspicklezxml.etree.ElementTreeio) ZcPickleZ _elementtree FileDialog SimpleDialogDocXMLRPCServerSimpleHTTPServer CGIHTTPServerr*r-r.r/StringIOZ cStringIObz2r)Z_bz2Z_dbm _functoolsZ_gdbm_pickle basestring StandardError _socketobject SocketTyperrLoadFileDialogSaveFileDialogr ServerHTMLDocrXMLRPCDocGeneratorDocXMLRPCRequestHandlerDocCGIXMLRPCRequestHandlerSimpleHTTPRequestHandlerrCGIHTTPRequestHandlerrBrokenPipeErrorChildProcessErrorConnectionAbortedErrorConnectionErrorConnectionRefusedErrorConnectionResetErrorFileExistsErrorFileNotFoundErrorInterruptedErrorIsADirectoryErrorNotADirectoryErrorPermissionErrorProcessLookupErrorModuleNotFoundErrorN)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr )rr!)rr")rr#)rr$)rr%)rr&)rr')rr()rr))r*r+)r,r*)r-r-)r,r-)r.r.)r,r.)r/r/)r r/)r0r1)r2r1)r3r4)r5r4)r6r7)r8r7)r9r:)r;r:)r<r=)r>r=)r<r?)r r?)r<r@)r r@)r<rA)r rA)r<rB)r rB)r<rC)r rC)r<rD)r rD)r<rE)r rE)r<rF)r rF)r<rG)r rG)r<rH)r rH)r<rI)r rI)rrJ)r>rJ)rrK)r>rK)/rLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrz)r{)r}r~rr)rr)rr)r|r)rrU)r*r*)r,r*)r2r)r2r)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)r r)rr)r r)rr)r0r2)r2r)rrrrrrrrrrrrrr)r|rd)r)r|rZ)ZIMPORT_MAPPINGZ NAME_MAPPINGZPYTHON2_EXCEPTIONSr{rbZexcnameZMULTIPROCESSING_EXCEPTIONSdictitemsZREVERSE_IMPORT_MAPPINGZREVERSE_NAME_MAPPINGupdateZPYTHON3_OSERROR_EXCEPTIONSZPYTHON3_IMPORTERROR_EXCEPTIONSrrrr s        getpass.cpython-36.pyc000064400000010123152462730460010646 0ustar003 \j@sdZddlZddlZddlZddlZddlZdddgZGdddeZddd Z dd d Z dd d Z dddZ ddZ yddlZejejfWnBeefk ry ddlZWnek re ZYnXe ZYnXe ZdS)aUtilities to get a password and/or the current user name. getpass(prompt[, stream]) - Prompt for a password, with echo turned off. getuser() - Get the user name from the environment or password database. GetPassWarning - This UserWarning is issued when getpass() cannot prevent echoing of the password contents while reading. On Windows, the msvcrt module will be used. NgetpassgetuserGetPassWarningc@s eZdZdS)rN)__name__ __module__ __qualname__rr/usr/lib64/python3.6/getpass.pyrs Password: c .Csd}tj}yJtjdtjtjB}tj|d}|j|tj |}|j||sX|}Wnpt k r}zT|j yt j j}Wn&ttfk rd}t||}YnXt j }|st j}WYdd}~XnX|dk rytj|}|dd} | dtjM<tj} ttdr| tjO} z tj|| | t|||d}Wdtj|| ||jXWn@tjk r|dk rz||k r|j t||}YnX|jd|SQRXdS)aPrompt for a password, with echo turned off. Args: prompt: Written on stream to ask for the input. Default: 'Password: ' stream: A writable file object to display the prompt. Defaults to the tty. If no tty is available defaults to sys.stderr. Returns: The seKr3t input. Raises: EOFError: If our input tty or stdin was closed. GetPassWarning: When we were unable to turn echo off on the input. Always restores terminal settings before returning. Nz/dev/ttyzw+TCSASOFT)input ) contextlib ExitStackosopenO_RDWRO_NOCTTYioFileIO enter_context TextIOWrapperOSErrorclosesysstdinfilenoAttributeError ValueErrorfallback_getpassstderrtermios tcgetattrZECHOZ TCSAFLUSHhasattrr tcsetattr _raw_inputflusherrorwrite) promptstreamZpasswdstackfdZttyr eoldnewZtcsetattr_flagsrrr unix_getpasssR             r1cCstjtjk rt||Sx|D]}tj|qWd}xHtj}|dksL|dkrNP|dkrZt|dkrp|dd}q4||}q4Wtjdtjd|S) z9Prompt for password with echo off, using Windows getch(). rN)rr __stdin__r msvcrtZputwchZgetwchKeyboardInterrupt)r*r+cZpwrrr win_getpassas"      r<cCs0tjdtdd|stj}td|dt||S)Nz%Can not control echo on the terminal.) stacklevelz&Warning: Password input may be echoed.)file)warningswarnrrr!printr&)r*r+rrr r xs  r r2c Cs|s tj}|stj}t|}|rpy|j|Wn8tk rf|j|jd}|j|j}|j|YnX|j |j }|st |ddkr|dd}|S)Nreplacer6rr7r7) rr!rstrr)UnicodeEncodeErrorencodeencodingdecoder'readlineEOFError)r*r+r linerrr r&s&   r&cCs<x dD]}tjj|}|r|SqWddl}|jtjdS)zGet the username from the environment or password database. First try various environment variables, then the password database. This works on Windows as long as USERNAME is set. LOGNAMEUSERLNAMEUSERNAMErN)rLrMrNrO)renvirongetpwdgetpwuidgetuid)nameuserrRrrr rs   )r N)r N)r N)r2NN)__doc__rrrrr@__all__ UserWarningrr1r<r r&rr"r#r% ImportErrorrr9rrrrr  s,  D     enum.cpython-36.pyc000064400000055637152462730460010167 0ustar003 \F@s>ddlZddlmZmZddlmZddlmZyddl m Z Wn e k r`ddl m Z YnXdddd d d d gZ d dZddZddZddZeZGdd d ZGdddeZdZGdddeZGdddedZGdddeeZddZGdd d eZGdd d eeZd d!Zd"d Z d#d$Z!d%d&Z"dS)'N)MappingProxyTypeDynamicClassAttribute)reduce)or_) OrderedDictEnumMetaEnumIntEnumFlagIntFlagautouniquecCst|dpt|dpt|dS)z5Returns True if obj is a descriptor, False otherwise.__get____set__ __delete__)hasattr)objr/usr/lib64/python3.6/enum.py_is_descriptors  rcCsT|dd|ddko"dknoR|dddkoR|dd dkoRt|dkS) z3Returns True if a __dunder__ name, False otherwise.N___r)len)namerrr _is_dunders(rcCsL|d|dkodknoJ|dddkoJ|dddkoJt|dkS)z1Returns True if a _sunder_ name, False otherwise.rrrrr!)r)rrrr _is_sunder$s r"cCsdd}||_d|_dS)z"Make the given class un-picklable.cSstd|dS)Nz%r cannot be pickled) TypeError)selfprotorrr_break_on_call_reduce-sz6_make_class_unpicklable.._break_on_call_reducez N) __reduce_ex__ __module__)clsr&rrr_make_class_unpicklable+sr*c@seZdZdZeZdS)r zP Instances are replaced with an appropriate value in Enum class suites. N)__name__r( __qualname____doc__ _auto_nullvaluerrrrr 3scs,eZdZdZfddZfddZZS) _EnumDictzTrack enum member order and ensure member names are not reused. EnumMeta will use the names found in self._member_names as the enumeration member names. cstjg|_g|_dS)N)super__init__ _member_names _last_values)r$) __class__rrr2As z_EnumDict.__init__cst|r.|d krtd|dkrt|d|nt|rD|dkrd}n||jkr\td|nxt|s||krtd |||ft|tr|j t kr|j |d t |j|j d d |_ |j }|jj||j j|tj||d S) zChanges anything not dundered or not a descriptor. If an enum member name is used twice, an error is raised; duplicate values are not checked for. Single underscore (sunder) names are reserved. _order__create_pseudo_member__generate_next_value_ _missing_z(_names_ are reserved for future Enum use_generate_next_value __order__zAttempted to reuse key: %rz%r already defined as: %rr N)r6r7r8r9)r" ValueErrorsetattrrr3r#r isinstancer r/r.r:rr4appendr1 __setitem__)r$keyr/)r5rrr@Fs,    "  z_EnumDict.__setitem__)r+r(r,r-r2r@ __classcell__rr)r5rr0:s r0cseZdZdZeddZfddZddZd)dddd d d d Zd dZ fddZ ddZ ddZ ddZ ddZddZeddZddZdd Zfd!d"Zdddd d d#d$Zed%d&Zed'd(ZZS)*rzMetaclass for EnumcCs0t}|j|\}}|dk r,t|dd|d<|S)Nr8)r0 _get_mixins_getattr)metaclsr)bases enum_dict member_type first_enumrrr __prepare__rs zEnumMeta.__prepare__c s|j|\}|j|\}}}fddjD}xjD] } | =q>Wjdd} t|dh@} | r~tdjdj| dkrdd<tj |||} g| _ t | _ | _ d d | jD} i| _d krtk rd}tfdd|Dst| x6jD]*}||}t|ts0|f}n|}tkrD|f}|sf|| }t|ds||_n6|| f|}t|dstkr||_n ||_|j}||_| |_|j|x8| j jD]\} }|j|jkr|}PqW| j j||| krt| |||| j |<y|| j|<Wntk r6YnXqWxPdD]H} t| | }t| d}t|| d}|dk rD||krDt| | |qDWtdk r|r|| _ tj | _ | dk rt| t!r| j"ddj#} | | j krtd| S)Ncsi|]}||qSrr).0k) classdictrr sz$EnumMeta.__new__..r6mrozInvalid enum member name: {0},r-zAn enumeration.cSs.h|]&}|jjD]\}}t|tr|qqSr)__dict__itemsr>r)rKcrLvrrr sz#EnumMeta.__new__..r'__getnewargs_ex____getnewargs__ __reduce__c3s|]}|jkVqdS)N)rQ)rKm)rHrr sz#EnumMeta.__new__.._value___repr____str__ __format__ z#member order does not match _order_)rVrWr'rX)r\r]r^r')$rC _find_new_r3popsetr<formatjoinr1__new___member_names_r _member_map_ _member_type_rO_value2member_map_objectanyr*r>tuplerr[_name_ __objclass__r2rRr?r=r#rDr__new_member__strreplacesplit)rEr)rFrMrIresave_newuse_args enum_membersrr6 invalid_names enum_classdynamic_attributesmethods member_namer/args enum_membercanonical_member class_method obj_method enum_method)r5)rMrHrre|s                          zEnumMeta.__new__cCsdS)z6 classes/types should always be True. Tr)r$rrr__bool__szEnumMeta.__bool__Nr )modulequalnametypestartcCs*|dkr|j||S|j||||||dS)aEither returns an existing member, or creates a new enum class. This method is used both when an enum class is given a value to match to an enumeration member (i.e. Color(3)) and for the functional API (i.e. Color = Enum('Color', names='RED GREEN BLUE')). When used for the functional API: `value` will be the name of the new class. `names` should be either a string of white-space/comma delimited names (values will start at `start`), or an iterator/mapping of name, value pairs. `module` should be set to the module this class is being created in; if it is not set, an attempt to find that module will be made, but if it fails the class will not be picklable. `qualname` should be set to the actual location this class can be found at in its module; by default it is set to the global scope. If this is not correct, unpickling will fail in some circumstances. `type`, if set, will be mixed in as the first base class. N)rrrr)re_create_)r)r/namesrrrrrrr__call__ s zEnumMeta.__call__cCst||o|j|jkS)N)r>rmrg)r)memberrrr __contains__)szEnumMeta.__contains__cs(||jkrtd|jtj|dS)Nz%s: cannot delete Enum member.)rgAttributeErrorr+r1 __delattr__)r)attr)r5rrr,s  zEnumMeta.__delattr__cCsddddg|jS)Nr5r- __members__r()rf)r$rrr__dir__4s zEnumMeta.__dir__c Cs>t|rt|y |j|Stk r8t|dYnXdS)a5Return the enum member matching `name` We use __getattr__ instead of descriptors or inserting into the enum class' __dict__ in order to support `name` and `value` being both properties for enum members (which live in the class' __dict__) and enum members themselves. N)rrrgKeyError)r)rrrr __getattr__8s  zEnumMeta.__getattr__cCs |j|S)N)rg)r)rrrr __getitem__HszEnumMeta.__getitem__csfddjDS)Nc3s|]}j|VqdS)N)rg)rKr)r)rrrZLsz$EnumMeta.__iter__..)rf)r)r)r)r__iter__KszEnumMeta.__iter__cCs t|jS)N)rrf)r)rrr__len__NszEnumMeta.__len__cCs t|jS)zReturns a mapping of member name->value. This mapping lists all enum members, including aliases. Note that this is a read-only view of the internal mapping. )rrg)r)rrrrQszEnumMeta.__members__cCs d|jS)Nz )r+)r)rrrr\[szEnumMeta.__repr__csfddtjDS)Nc3s|]}j|VqdS)N)rg)rKr)r)rrrZ_sz(EnumMeta.__reversed__..)reversedrf)r)r)r)r __reversed__^szEnumMeta.__reversed__cs0|jjdi}||krtdtj||dS)zBlock attempts to reassign Enum members. A simple assignment to the class namespace only changes one of the several possible ways to get an Enum member from the Enum class, resulting in an inconsistent Enumeration. rgzCannot reassign members.N)rQgetrr1 __setattr__)r)rr/ member_map)r5rrraszEnumMeta.__setattr__cCs|j}|dkr|fn||f}|j|\} } |j||} t|trP|jddj}t|ttfr|rt|dtr|g} }g} xDt | D]8\}}| j |||| dd}| j ||j ||fqWx6|D].}t|tr|||}}n|\}}|| |<qW|j |||| }|dkrTyt jdjd}Wn(ttfk rR}zWYdd}~XnX|dkrht|n||_|dk r~||_|S)aConvenience method to create a new Enum class. `names` can be: * A string containing member names, separated either with spaces or commas. Values are incremented by 1 from `start`. * An iterable of member names. Values are incremented by 1 from `start`. * An iterable of (member name, value) pairs. * A mapping of member name -> value pairs. NrPr_rrr+)r5rCrJr>rprqrrrllist enumerater8r?resys _getframe f_globalsrr<r*r(r,)r) class_namerrrrrrErFrrIrMoriginal_names last_valuescountrr/itemrz member_valuerwexcrrrrns<             zEnumMeta._create_cCs|s ttfSd}}x,|D]$}|tk rt|tr|jrtdqWt|tsTtdt|dtst|d}|d}n8x6|djD](}t|tr|dkr|}q|dkr|}qW||fS)zReturns the type for creating enum members, and the first inherited enum class. bases: the tuple of bases that was given to __new__ NzCannot extend enumerationszHnew enumerations must be created as `ClassName([mixin_type,] enum_type)`rr r!)rjr issubclassrfr#__mro__)rFrHrIbaserrrrCs(      zEnumMeta._get_mixins_c Cs|jdd}|dk }|dkrtxVdD]H}x8||fD],}t||d}|ddjtjtjhkr0|}Pq0W|dk r"Pq"Wtj}|tjkrd}nd}|||fS)a Returns the __new__ to be used for creating the enum members. classdict: the class dictionary given to __new__ member_type: the data type whose __new__ will be used by default first_enum: enumeration to check for an overriding __new__ reNroFT)rore)rrDrerjr) rMrHrIrersmethodpossibletargetrtrrrr`s(     zEnumMeta._find_new_)N)r+r(r,r- classmethodrJrerrrrrrrrrpropertyrr\rrr staticmethodrCr`rBrr)r5rrps(     5 -c@seZdZdZddZddZeddZdd Zd d Z d d Z ddZ ddZ ddZ eddZeddZedddZdS)rzRGeneric enumeration. Derive from this class to define new enumerations. c Csjt||kr|Sy||jkr&|j|SWn6tk r^x |jjD]}|j|krD|SqDWYnX|j|S)N)rrir#rgvaluesr[r9)r)r/rrrrres   z Enum.__new__c Cs8x2t|D]"}y|dStk r*Yq Xq W|SdS)Nr )rr#)rrrr last_valuerrrr8s  zEnum._generate_next_value_cCstd||jfdS)Nz%r is not a valid %s)r<r+)r)r/rrrr9"szEnum._missing_cCsd|jj|j|jfS)Nz <%s.%s: %r>)r5r+rmr[)r$rrrr\&sz Enum.__repr__cCsd|jj|jfS)Nz%s.%s)r5r+rm)r$rrrr]*sz Enum.__str__cs&fddjjD}dddg|S)Ncs2g|]*}|jD]}|ddkr|jkr|qqS)rr)rQrg)rKr)rY)r$rr /s z Enum.__dir__..r5r-r()r5rO)r$added_behaviorr)r$rr-s z Enum.__dir__cCs0|jtkrt}t|}n |j}|j}|j||S)N)rhrjrpr[r^)r$ format_specr)valrrrr^6s   zEnum.__format__cCs t|jS)N)hashrm)r$rrr__hash__Esz Enum.__hash__cCs|j|jffS)N)r5r[)r$r%rrrr'HszEnum.__reduce_ex__cCs|jS)zThe name of the Enum member.)rm)r$rrrrRsz Enum.namecCs|jS)zThe value of the Enum member.)r[)r$rrrr/Wsz Enum.valueNc sttj|}rtn|fddjD}y|jdddWn$tk rp|jdddYnX||||d}t|_|j|j |||<|S)z[ Create a new Enum subclass that replaces a collection of global constants cs g|]}|r||fqSrr)rKr)filtersourcerrrqsz!Enum._convert..cSs|d|dfS)Nr rr)trrrvszEnum._convert..)rAcSs|dS)Nrr)rrrrrys)r) varsrmoduleskeyssortr#_reduce_ex_by_namer'updater)r)rrrrmodule_globalsmembersr)rrr_convert\s     z Enum._convert)N)r+r(r,r-rer8rr9r\r]rr^rr'rrr/rrrrrrs    ) metaclassc@seZdZdZdS)r z.Enum where members are also (and must be) intsN)r+r(r,r-rrrrr scCs|jS)N)r)r$r%rrrrsrc@speZdZdZddZeddZeddZdd Zd d Z d d Z ddZ ddZ ddZ ddZddZdS)r zSupport for flagsc Csd|s|dk r|SdSxBt|D]6}yt|}PWqtk rRtd|dYqXqWd|dS)z Generate the next value when not given. name: the name of the member start: the initital start value or None count: the number of existing members last_value: the last value assigned or None Nr zInvalid Flag value: %rr)r _high_bit Exceptionr#)rrrrrhigh_bitrrrr8s zFlag._generate_next_value_cCs.|}|dkr|}|j|}|dkr*|}|S)Nr)r7)r)r/original_valuepossible_memberrrrr9s zFlag._missing_cCsb|jj|d}|dkr^t||\}}|r:td||jftj|}d|_||_|jj ||}|S)zL Create a composite member iff value contains only members. Nz%r is not a valid %s) rir _decomposer<r+rjrermr[ setdefault)r)r/ pseudo_memberr extra_flagsrrrr7s zFlag._create_pseudo_member_cCs"t||jstS|j|j@|jkS)N)r>r5NotImplementedr[)r$otherrrrrs zFlag.__contains__cCsV|j}|jdk r$d|j|j|jfSt||j\}}d|jdjdd|D|jfS)Nz <%s.%s: %r>|cSsg|]}t|jp|jqSr)rprmr[)rKrYrrrrsz!Flag.__repr__..)r5rmr+r[rrd)r$r)r uncoveredrrrr\s z Flag.__repr__cCs|j}|jdk r d|j|jfSt||j\}}t|dkr^|djdkr^d|j|djfSd|jdjdd|DfSdS)Nz%s.%sr rz%s.%rrcSsg|]}t|jp|jqSr)rprmr[)rKrYrrrrsz Flag.__str__..)r5rmr+rr[rrd)r$r)rrrrrr]s z Flag.__str__cCs t|jS)N)boolr[)r$rrrrsz Flag.__bool__cCs"t||jstS|j|j|jBS)N)r>r5rr[)r$rrrr__or__s z Flag.__or__cCs"t||jstS|j|j|j@S)N)r>r5rr[)r$rrrr__and__s z Flag.__and__cCs"t||jstS|j|j|jAS)N)r>r5rr[)r$rrrr__xor__s z Flag.__xor__csDtjj\}fddjD}tt|jd}j|S)Ncs&g|]}|kr|jj@ r|qSr)r[)rKrY)rr$rrrsz#Flag.__invert__..r)rr5r[r_or_)r$rinverted_membersinvertedr)rr$r __invert__szFlag.__invert__N)r+r(r,r-r8rr9r7rr\r]rrrrrrrrrr s   c@sTeZdZdZeddZeddZddZdd Zd d Z eZ eZ e Z d d Z dS)r zSupport for integer-based FlagscCs*t|tstd||jf|j|}|S)Nz%r is not a valid %s)r>intr<r+r7)r)r/ new_memberrrrr9s  zIntFlag._missing_cCs|jj|d}|dkr|g}t||\}}xL|rvt|}d|}||jkr\||kr\|j||| krld}q,||N}q,Wx6t|D]*}tj||}d|_||_ |jj ||}qW|S)Nrr) rirrrr?rrrermr[r)r)r/rneed_to_createrrbit flag_valuerrrr7s&     zIntFlag._create_pseudo_member_cCs0t||jtfstS|j|j|j|jB}|S)N)r>r5rrr[)r$rresultrrrrszIntFlag.__or__cCs,t||jtfstS|j|j|j|j@S)N)r>r5rrr[)r$rrrrr#szIntFlag.__and__cCs,t||jtfstS|j|j|j|jAS)N)r>r5rrr[)r$rrrrr(szIntFlag.__xor__cCs|j|j}|S)N)r5r[)r$rrrrr1szIntFlag.__invert__N)r+r(r,r-rr9r7rrr__ror____rand____rxor__rrrrrr s  cCs |jdS)z@returns index of highest bit, or -1 if value is zero or negativer ) bit_length)r/rrrr6srcCsbg}x0|jjD]"\}}||jkr|j||jfqW|r^djdd|D}td||f|S)z?Class decorator for enumerations ensuring unique member values.z, cSsg|]\}}d||fqS)z%s -> %sr)rKaliasrrrrrBszunique..z duplicate values found in %r: %s)rrRrr?rdr<) enumeration duplicatesrr alias_detailsrrrr :s  cCs|}|dk}|r*ddt|jjD}nddt|jjD}g}x4|D],\}}|rL||@|krL|j|||M}qLW| r||jkr|j|j||jddddt|d kr|dj|kr|jd||fS) z#Extract all members from the value.rcSs"g|]\}}|jdk r||fqS)N)r)rKrTrYrrrrRsz_decompose..cSs*g|]"\}}|jdk st|r||fqS)N)r _power_of_two)rKrTrYrrrrYscSs|jS)N)r[)rYrrrrdsz_decompose..T)rAreverser )rrirRr?rrr/ra)flagr/ not_coverednegativeflags_to_checkrrrrrrrGs$  rcCs|dkr dS|dt|kS)Nr Fr)r)r/rrrrjsr)#rtypesrr functoolsroperatorrr _collectionsr ImportError collections__all__rrr"r*rjr.r dictr0rrrrr rr r rr rrrrrrs@  3mA #ipaddress.cpython-36.opt-2.pyc000064400000110743152462730460012127 0ustar003 i/@sdZddlZdZdZGdddeZGdddeZd d Zd7}|d|j krPqWdS)Nz1first and last must be IP addresses, not networksz%%s and %s are not of the same versionz*last IP address must be greater than firstrzunknown IP versionr%) isinstance _BaseAddress TypeErrorversionr rr_max_prefixlenr(r/r2r0 _ALL_ONES)r+r,r-Zip_bitsZ first_intZlast_intZnbitsnetrrr summarize_address_ranges0         r;ccst|}i}xL|rX|j}|j}|j|}|dkr>|||<q||kr||=|j|qWd}x4t|jD]$}|dk r|j|jkrql|V|}qlWdS)N)listpopsupernetgetappendsortedvaluesbroadcast_address)r)Zto_mergesubnetsr:r>Zexistingr,rrr _collapse_addresses_internals$   rEc Cs8g}g}g}x|D]}t|trT|rH|dj|jkrHtd||df|j|q|j|jkr|r|dj|jkrtd||dfy|j|jWqtk r|j|j YqXq|r|dj|jkrtd||df|j|qWt t |}|r,x&t |D]\}}|j t||qWt||S) Nr%z%%s and %s are not of the same versionrFrFrFrFrF)r4r5_versionr6r@ _prefixlenr8r-AttributeErrornetwork_addressrAsetr.extendr;rE)r)ZaddrsZipsZnetsr-r+r,rrr collapse_addresses2s4     rMcCs(t|tr|jSt|tr$|jStS)N)r4 _BaseNetwork_get_networks_keyr5_get_address_keyNotImplemented)objrrr get_mixed_type_keyhs   rSc@seZdZfZeddZeddZeddZeddZd d Z d d Z e d dZ e ddZ e ddZe ddZe ddZddZdS)_IPAddressBasecCs|jS)N)_explode_shorthand_ip_string)selfrrr explodedsz_IPAddressBase.explodedcCst|S)N)r )rVrrr compressedsz_IPAddressBase.compressedcCs|jS)N)_reverse_pointer)rVrrr reverse_pointers z_IPAddressBase.reverse_pointercCsdt|f}t|dS)Nz%200s has no version specified)typeNotImplementedError)rVmsgrrr r7sz_IPAddressBase.versioncCsF|dkrd}t|||jf||jkrBd}t|||j|jfdS)Nrz-%d (< 0) is not permitted as an IPv%d addressz2%d (>= 2**%d) is not permitted as an IPv%d address)rrGr9r8)rVrr]rrr _check_int_addresss  z!_IPAddressBase._check_int_addresscCs.t|}||kr*d}t|||||jfdS)Nz6%r (len %d != %d) is not permitted as an IPv%d address)r"rrG)rVrZ expected_lenZ address_lenr]rrr _check_packed_addresss z$_IPAddressBase._check_packed_addresscCs|j|j|?AS)N)r9)cls prefixlenrrr _ip_int_from_prefixs z"_IPAddressBase._ip_int_from_prefixc Cs\t||j}|j|}||?}d|>d}||krX|jd}|j|d}d}t|||S)Nr%rz&Netmask pattern %r mixes zeroes & ones)r2r8rr ) r`ip_intZtrailing_zeroesraZ leading_onesZall_onesZbyteslenZdetailsr]rrr _prefix_from_ip_ints      z"_IPAddressBase._prefix_from_ip_intcCsd|}t|ddS)Nz%r is not a valid netmask)r )r`Z netmask_strr]rrr _report_invalid_netmasksz&_IPAddressBase._report_invalid_netmaskc Csjtjj|s|j|y t|}Wntk r@|j|YnXd|koV|jknsf|j||S)Nr)_BaseV4_DECIMAL_DIGITS issupersetrfintr r8)r`Z prefixlen_strrarrr _prefix_from_prefix_strings    z)_IPAddressBase._prefix_from_prefix_stringcCsy|j|}Wntk r,|j|YnXy |j|Stk rLYnX||jN}y |j|Stk r|j|YnXdS)N)_ip_int_from_stringrrfrer r9)r`ip_strrdrrr _prefix_from_ip_strings   z%_IPAddressBase._prefix_from_ip_stringcCs|jt|ffS)N) __class__r )rVrrr __reduce__sz_IPAddressBase.__reduce__N)rrr __slots__propertyrWrXrZr7r^r_ classmethodrbrerfrkrnrprrrr rTs        "rTc@s`eZdZfZddZddZddZddZd d Zd d Z d dZ ddZ ddZ ddZ dS)r5cCs|jS)N)r()rVrrr __int__&sz_BaseAddress.__int__c Cs2y|j|jko|j|jkStk r,tSXdS)N)r(rGrIrQ)rVotherrrr __eq__)s   z_BaseAddress.__eq__cCsFt|tstS|j|jkr*td||f|j|jkrB|j|jkSdS)Nz%%s and %s are not of the same versionF)r4r5rQrGr6r()rVrurrr __lt__0s     z_BaseAddress.__lt__cCs t|tstS|jt||S)N)r4rjrQro)rVrurrr __add__<s z_BaseAddress.__add__cCs t|tstS|jt||S)N)r4rjrQro)rVrurrr __sub__As z_BaseAddress.__sub__cCsd|jjt|fS)Nz%s(%r))rorr )rVrrr __repr__Fsz_BaseAddress.__repr__cCst|j|jS)N)r _string_from_ip_intr()rVrrr __str__Isz_BaseAddress.__str__cCsttt|jS)N)hashhexrjr()rVrrr __hash__Lsz_BaseAddress.__hash__cCs |j|fS)N)rG)rVrrr rPOsz_BaseAddress._get_address_keycCs|j|jffS)N)ror()rVrrr rpRsz_BaseAddress.__reduce__N)rrrrqrtrvrwrxryrzr|rrPrprrrr r5s  r5c@sDeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ eddZeddZeddZeddZedd Zed!d"Zed#d$Zed%d&Zd'd(Zd)d*Zd+d,ZdAd/d0ZdBd1d2Zed3d4Zed5d6Zed7d8Zed9d:Zed;d<Z ed=d>Z!ed?d@Z"d.S)CrNcCs i|_dS)N)_cache)rVrrrr __init___sz_BaseNetwork.__init__cCsd|jjt|fS)Nz%s(%r))rorr )rVrrr rzbsz_BaseNetwork.__repr__cCsd|j|jfS)Nz%s/%d)rJra)rVrrr r|esz_BaseNetwork.__str__ccs<t|j}t|j}x"t|d|D]}|j|Vq$WdS)Nr%)rjrJrCrange_address_class)rVnetwork broadcastxrrr hostshs  z_BaseNetwork.hostsccs<t|j}t|j}x"t||dD]}|j|Vq$WdS)Nr%)rjrJrCrr)rVrrrrrr __iter__ts  z_BaseNetwork.__iter__cCslt|j}t|j}|dkr>|||kr0td|j||S|d7}|||krZtd|j||SdS)Nrzaddress out of ranger%)rjrJrC IndexErrorr)rVnrrrrr __getitem__zs    z_BaseNetwork.__getitem__cCs^t|tstS|j|jkr*td||f|j|jkrB|j|jkS|j|jkrZ|j|jkSdS)Nz%%s and %s are not of the same versionF)r4rNrQrGr6rJnetmask)rVrurrr rws       z_BaseNetwork.__lt__c CsFy,|j|jko,|j|jko,t|jt|jkStk r@tSXdS)N)rGrJrjrrIrQ)rVrurrr rvs   z_BaseNetwork.__eq__cCstt|jt|jAS)N)r}rjrJr)rVrrr rsz_BaseNetwork.__hash__cCsL|j|jkrdSt|trdSt|jt|jkoBt|jkSSdS)NF)rGr4rNrjrJr(rC)rVrurrr __contains__s   z_BaseNetwork.__contains__cCs(|j|kp&|j|kp&|j|kp&|j|kS)N)rJrC)rVrurrr overlapss   z_BaseNetwork.overlapscCs<|jjd}|dkr8|jt|jt|jB}||jd<|S)NrC)rr?rrjrJhostmask)rVrrrr rCs    z_BaseNetwork.broadcast_addresscCs8|jjd}|dkr4|jt|j|jA}||jd<|S)Nr)rr?rrjrr9)rVrrrr rs   z_BaseNetwork.hostmaskcCsd|j|jfS)Nz%s/%d)rJrH)rVrrr with_prefixlensz_BaseNetwork.with_prefixlencCsd|j|jfS)Nz%s/%s)rJr)rVrrr with_netmasksz_BaseNetwork.with_netmaskcCsd|j|jfS)Nz%s/%s)rJr)rVrrr with_hostmasksz_BaseNetwork.with_hostmaskcCst|jt|jdS)Nr%)rjrCrJ)rVrrr num_addressessz_BaseNetwork.num_addressescCsdt|f}t|dS)Nz%%200s has no associated address class)r[r\)rVr]rrr rsz_BaseNetwork._address_classcCs|jS)N)rH)rVrrr rasz_BaseNetwork.prefixlenccsD|j|jkstd||ft|ts2td||j|jkoH|j|jksZtd||f||krfdS|jd|j|jf}|j \}}x||ko||kr|j|jkr|j|jkr|V|j \}}q|j|jkr|j|jkr|V|j \}}qt d|||fqW||kr|Vn$||kr.|Vnt d|||fdS)Nz%%s and %s are not of the same versionz%s is not a network objectz%s not contained in %sz%s/%sz3Error performing exclusion: s1: %s s2: %s other: %s) rGr6r4rNrJrCr rorarDAssertionError)rVrus1s2rrr address_excludes<$               z_BaseNetwork.address_excludecCs`|j|jkrtd||f|j|jkr,dS|j|jkr 0z0prefix length diff %d is invalid for netblock %s) rHr8r rjrJrCrrro) rVprefixlen_diff new_prefix new_prefixlenstartendstepZnew_addrZcurrentrrr rDhs,       z_BaseNetwork.subnetscCs|jdkr|S|dk rB||jkr(td|dkr8td|j|}|j|}|dkrftd|j|f|jt|jt|j|>@|fS)Nrznew prefix must be shorterr%z(cannot set prefixlen_diff and new_prefixz;current prefixlen is %d, cannot have a prefixlen_diff of %d)rHr rarorjrJr)rVrrrrrr r>s     z_BaseNetwork.supernetcCs|jjo|jjS)N)rJ is_multicastrC)rVrrr rs z_BaseNetwork.is_multicastcCs|jjo|jjS)N)rJ is_reservedrC)rVrrr rs z_BaseNetwork.is_reservedcCs|jjo|jjS)N)rJ is_link_localrC)rVrrr rsz_BaseNetwork.is_link_localcCs|jjo|jjS)N)rJ is_privaterC)rVrrr rs z_BaseNetwork.is_privatecCs|j S)N)r)rVrrr is_globals z_BaseNetwork.is_globalcCs|jjo|jjS)N)rJis_unspecifiedrC)rVrrr rs z_BaseNetwork.is_unspecifiedcCs|jjo|jjS)N)rJ is_loopbackrC)rVrrr r s z_BaseNetwork.is_loopback)r%N)r%N)#rrrrrzr|rrrrwrvrrrrrrCrrrrrrrarrrOrDr>rrrrrrrrrrr rNVs>            N0 5 ) rNc @seZdZfZdZdedZedZeddddd d d d d h Z eZ iZ ddZ e ddZe ddZe ddZe ddZddZddZddZeddZed d!Zd"S)#rgrrr% 0123456789rrcCst|S)N)r )rVrrr rU0sz$_BaseV4._explode_shorthand_ip_stringc Csn||jkrdt|tr|}n.y|j|}Wntk rF|j|}YnXt|j|}||f|j|<|j|S)N)_netmask_cacher4rjrkr rnr rb)r`argrarrrr _make_netmask3s  z_BaseV4._make_netmaskcCs||s td|jd}t|dkr.td|ytjt|j|dStk rv}ztd||fdWYdd}~XnXdS)NzAddress cannot be empty.rzExpected 4 octets in %rrz%s in %r)rr!r"rj from_bytesmap _parse_octetr )r`rmZoctetsexcrrr rlKs   z_BaseV4._ip_int_from_stringcCs|s td|jj|s(d}t||t|dkrDd}t||t|d}|dkrr|ddkrrd }t|||d krtd ||S) NzEmpty octet not permittedz#Only decimal digits permitted in %rz$At most 3 characters permitted in %r r0z3Ambiguous (octal/decimal) value in %r not permittedrzOctet %d (> 255) not permitted)r rhrir"rj)r`Z octet_strr]Z octet_intrrr res       z_BaseV4._parse_octetcCsdjtt|jddS)Nrrr)joinrr r)r`rdrrr r{s z_BaseV4._string_from_ip_intcCs|jd}t|dkry$x|D]}t||jkrdSqWWntk rNdSXx0t|D]$\}}|dkrZ|||dkrZdSqZWdSy t|}Wntk rdSXd|ko|jkSS)NrrFrr%T)r!r"rj_valid_mask_octetsr enumerater8)rVrmaskridxyrrr _is_valid_netmasks"     z_BaseV4._is_valid_netmaskc sh|jd}yfddtt|D}Wntk r:dSXt|t|krPdS|d|dkrddSdS) Nrcsg|]}|jkr|qSr)r).0r)rVrr sz(_BaseV4._is_hostmask..Frr%TrF)r!rrjr r")rVrmr1partsr)rVr _is_hostmasks z_BaseV4._is_hostmaskcCs&t|jdddd}dj|dS)Nrr%z .in-addr.arparF)r r!r)rVZreverse_octetsrrr rYsz_BaseV4._reverse_pointercCs|jS)N)r8)rVrrr max_prefixlensz_BaseV4.max_prefixlencCs|jS)N)rG)rVrrr r7sz_BaseV4.versionN)rrrrqrG IPV4LENGTHr9 frozensetrhrr8rrUrsrrlrr{rrrYrrrr7rrrr rgs"     %  rgc@seZdZdZddZeddZeddZeej d d Z eej d d Z ed dZ eddZ eddZeddZdS)r r( __weakref__cCsrt|tr|j|||_dSt|trF|j|dtj|d|_dSt|}d|krbtd||j ||_dS)NrrrzUnexpected '/' in %r) r4rjr^r(bytesr_rr rrl)rVraddr_strrrr rs     zIPv4Address.__init__cCs t|jS)N)rr()rVrrr packedszIPv4Address.packedcCs ||jjkS)N) _constants_reserved_network)rVrrr r s zIPv4Address.is_reservedcs4tfddjjDo2tfddjjDS)Nc3s|]}|kVqdS)Nr)rr:)rVrr (sz)IPv4Address.is_private..c3s|]}|kVqdS)Nr)rr:)rVrr r)s)anyr_private_networksall_private_networks_exceptions)rVr)rVr rszIPv4Address.is_privatecCs||jjko|j S)N)r_public_networkr)rVrrr r,szIPv4Address.is_globalcCs ||jjkS)N)r_multicast_network)rVrrr r>s zIPv4Address.is_multicastcCs ||jjkS)N)r_unspecified_address)rVrrr rIs zIPv4Address.is_unspecifiedcCs ||jjkS)N)r_loopback_network)rVrrr rTszIPv4Address.is_loopbackcCs ||jjkS)N)r_linklocal_network)rVrrr r^szIPv4Address.is_link_localN)r(r)rrrrqrrrrr functools lru_cacherrrrrrrrrr r s#   r c@sjeZdZddZddZddZddZd d Zej Z e d d Z e d dZ e ddZ e ddZdS)rcCst|ttfr2tj||t|j|_|j|_ dSt|t rtj||dt |dkrht|d|_ n|j|_ t|dd|_|jj |_ |jj |_ dSt|}tj||dt|dd|_|jj |_ |jj |_ |jj |_ dS)Nrr%F)r)r4rrjr rrr(rr8rHtupler"rrr$)rVrr#rrr rks(        zIPv4Interface.__init__cCsd|j|j|jjfS)Nz%s/%d)r{r(rra)rVrrr r|s zIPv4Interface.__str__c CsDtj||}| s|tkr|Sy |j|jkStk r>dSXdS)NF)r rvrQrrI)rVru address_equalrrr rvs  zIPv4Interface.__eq__c CsNtj||}|tkrtSy|j|jkp4|j|jko4|Stk rHdSXdS)NF)r rwrQrrI)rVru address_lessrrr rws  zIPv4Interface.__lt__cCst|j|jt|jjfS)N)r}r(rHrjrrJ)rVrrr rszIPv4Interface.__hash__cCs t|jS)N)r r()rVrrr r-szIPv4Interface.ipcCsd|j|j|jfS)Nz%s/%s)r{r(rH)rVrrr rs zIPv4Interface.with_prefixlencCsd|j|j|jfS)Nz%s/%s)r{r(r)rVrrr rs zIPv4Interface.with_netmaskcCsd|j|j|jfS)Nz%s/%s)r{r(r)rVrrr rs zIPv4Interface.with_hostmaskN)rrrrr|rvrwrrTrprrr-rrrrrrr ris     rc@s.eZdZeZdddZeejddZ dS)rTcCstj||t|ttfr&|}|j}n^t|trT|d}t|dkrL|dn|j}n0t|}|j |d}t|dkr~|dn|j}t ||_ |j |\|_ |_t|j }|t|j @|kr|rtd|nt |t|j @|_ |j|jdkr|j|_dS)Nrr%rz%s has host bits set)rNrr4rjrr8rr"r$rlr rJrrrHr rr)rVrrr#rargsrrrr rs(%    zIPv4Network.__init__cCs&|jtdko|jtdk o$|j S)Nz 100.64.0.0/10)rJrrCr)rVrrr rs zIPv4Network.is_globalN)T) rrrr rrrrrrrrrrr rs  Crc@seZdZedZedZedZedZededededededed ed ed ed ed edededgZededgZ edZ e dZ dS)_IPv4Constantsz169.254.0.0/16z 127.0.0.0/8z 224.0.0.0/4z 100.64.0.0/10z 0.0.0.0/8z 10.0.0.0/8z 172.16.0.0/12z 192.0.0.0/24z192.0.0.170/31z 192.0.2.0/24z192.168.0.0/16z 198.18.0.0/15z198.51.100.0/24z203.0.113.0/24z 240.0.0.0/4z255.255.255.255/32z 192.0.0.9/32z 192.0.0.10/32z0.0.0.0N) rrrrrrrrrrrr rrrrr rs,  rc@seZdZfZdZdedZdZedZ eZ iZ e ddZ e dd Ze d d Ze d d Ze dddZddZddZeddZeddZdS)_BaseV6r3rr%rcZ0123456789ABCDEFabcdefcCsJ||jkr@t|tr|}n |j|}t|j|}||f|j|<|j|S)N)rr4rjrkr rb)r`rrarrrr rZs   z_BaseV6._make_netmaskcCs|s td|jd}d}t||kr:d||f}t|d|dkryt|jj}Wn4tk r}ztd||fdWYdd}~XnX|jd|d ?d @|jd|d @|jd}t||krd |d|f}t|d}xDtdt|dD].} || s|dk r$d |}t|| }qW|dk r|} t||d} |d st| d8} | rtd}t|||ds| d8} | rd}t|||j| | } | dkr:d}t||jd|fnjt||jkrd}t||j|f|d sd}t|||ds*d}t||t|} d } d } ytd } x,t| D] } | d K} | |j || O} qJW| d | K} x0t| d D] } | d K} | |j || O} qW| St k r}ztd||fdWYdd}~XnXdS)NzAddress cannot be empty:rz At least %d parts expected in %rrr%z%s in %rz%xriz!At most %d colons permitted in %rz At most one '::' permitted in %rrz0Leading ':' only permitted as part of '::' in %rz1Trailing ':' only permitted as part of '::' in %rz/Expected at most %d other parts with '::' in %rz,Exactly %d parts expected without '::' in %rrFrFrF) rr!r"r r=r(r@ _HEXTET_COUNTr _parse_hextetr )r`rmrZ _min_partsr]Zipv4_intrZ _max_partsZ skip_indexiZparts_hiZparts_loZ parts_skippedrdrrr rlls    $                z_BaseV6._ip_int_from_stringcCs>|jj|std|t|dkr4d}t||t|dS)NzOnly hex digits permitted in %rrz$At most 4 characters permitted in %rr) _HEX_DIGITSrir r"rj)r`Z hextet_strr]rrr rs     z_BaseV6._parse_hextetc Csd}d}d}d}xJt|D]>\}}|dkrP|d7}|dkr>|}||krX|}|}qd}d}qW|dkr||}|t|kr|dg7}dg|||<|dkrdg|}|S) Nr%rrrFrFrFrF)rr") r`hextetsZbest_doublecolon_startZbest_doublecolon_lenZdoublecolon_startZdoublecolon_lenindexZhextetZbest_doublecolon_endrrr _compress_hextetss.   z_BaseV6._compress_hextetsNcsZ|dkrt|j}||jkr$tdd|fddtdddD}|j|}dj|S) NzIPv6 address is too largez%032xcs&g|]}dt||ddqS)z%xrr)rj)rr)hex_strrr r3sz/_BaseV6._string_from_ip_int..rrrr)rjr(r9r rrr)r`rdrr)rr r{s   z_BaseV6._string_from_ip_intcst|trt|j}nt|tr,t|j}nt|}|j|}d|fddtdddD}t|ttfrddj ||j fSdj |S) Nz%032xcsg|]}||dqS)rr)rr)rrr rKsz8_BaseV6._explode_shorthand_ip_string..rrrz%s/%dr) r4rr rJrr-rlrrNrrH)rVrmrdrr)rr rU8s     z$_BaseV6._explode_shorthand_ip_stringcCs&|jdddjdd}dj|dS)Nr%rrrz .ip6.arparF)rWreplacer)rVZ reverse_charsrrr rYPsz_BaseV6._reverse_pointercCs|jS)N)r8)rVrrr rYsz_BaseV6.max_prefixlencCs|jS)N)rG)rVrrr r7]sz_BaseV6.version)N)rrrrqrG IPV6LENGTHr9rrrr8rrsrrlrrr{rUrYrrrr7rrrr rFs"    h  0  rc@seZdZdZddZeddZeddZed d Zed d Z ed dZ ee j ddZ eddZeddZeddZeddZeddZeddZdS)r r(rcCsrt|tr|j|||_dSt|trF|j|dtj|d|_dSt|}d|krbtd||j ||_dS)NrrrzUnexpected '/' in %r) r4rjr^r(rr_rr rrl)rVrrrrr rhs     zIPv6Address.__init__cCs t|jS)N)rr()rVrrr rszIPv6Address.packedcCs ||jjkS)N)rr)rVrrr rs zIPv6Address.is_multicastcstfddjjDS)Nc3s|]}|kVqdS)Nr)rr)rVrr rsz*IPv6Address.is_reserved..)rr_reserved_networks)rVr)rVr rs zIPv6Address.is_reservedcCs ||jjkS)N)rr)rVrrr rszIPv6Address.is_link_localcCs ||jjkS)N)r_sitelocal_network)rVrrr is_site_locals zIPv6Address.is_site_localcsHj}|dk r|jStfddjjDoFtfddjjDS)Nc3s|]}|kVqdS)Nr)rr:)rVrr rsz)IPv6Address.is_private..c3s|]}|kVqdS)Nr)rr:)rVrr rs) ipv4_mappedrrrrrr)rVrr)rVr rs zIPv6Address.is_privatecCs|j S)N)r)rVrrr rszIPv6Address.is_globalcCs |jdkS)Nr)r()rVrrr rs zIPv6Address.is_unspecifiedcCs |jdkS)Nr%)r()rVrrr rs zIPv6Address.is_loopbackcCs |jd?dkrdSt|jd@S)Nril)r(r )rVrrr rs zIPv6Address.ipv4_mappedcCs4|jd?dkrdSt|jd?d@t|jd@fS)N`i @l)r(r )rVrrr teredo s zIPv6Address.teredocCs$|jd?dkrdSt|jd?d@S)Npi Pl)r(r )rVrrr sixtofours zIPv6Address.sixtofourN)r(r)rrrrqrrrrrrrrrrrrrrrrrrrrr r bs$    r c@seZdZddZddZddZddZd d Zej Z e d d Z e d dZ e ddZ e ddZe ddZe ddZdS)rcCst|ttfr2tj||t|j|_|j|_ dSt|t rtj||dt |dkrht|d|_ n|j|_ t|dd|_|jj |_ |jj |_ dSt|}tj||dt|dd|_|jj |_ |jj |_ |jj |_ dS)Nrr%F)r)r4rrjr rrr(rr8rHrr"rrr$)rVrr#rrr r+s(        zIPv6Interface.__init__cCsd|j|j|jjfS)Nz%s/%d)r{r(rra)rVrrr r|Cs zIPv6Interface.__str__c CsDtj||}| s|tkr|Sy |j|jkStk r>dSXdS)NF)r rvrQrrI)rVrurrrr rvGs  zIPv6Interface.__eq__c CsNtj||}|tkrtSy|j|jkp4|j|jko4|Stk rHdSXdS)NF)r rwrQrrI)rVrurrrr rwSs  zIPv6Interface.__lt__cCst|j|jt|jjfS)N)r}r(rHrjrrJ)rVrrr r_szIPv6Interface.__hash__cCs t|jS)N)r r()rVrrr r-dszIPv6Interface.ipcCsd|j|j|jfS)Nz%s/%s)r{r(rH)rVrrr rhs zIPv6Interface.with_prefixlencCsd|j|j|jfS)Nz%s/%s)r{r(r)rVrrr rms zIPv6Interface.with_netmaskcCsd|j|j|jfS)Nz%s/%s)r{r(r)rVrrr rrs zIPv6Interface.with_hostmaskcCs|jdko|jjS)Nr)r(rr)rVrrr rwszIPv6Interface.is_unspecifiedcCs|jdko|jjS)Nr%)r(rr)rVrrr r{szIPv6Interface.is_loopbackN)rrrrr|rvrwrrTrprrr-rrrrrrrrr r)s       rc@s.eZdZeZd ddZddZeddZdS) rTcCstj||t|ttfr&|}|j}n^t|trT|d}t|dkrL|dn|j}n0t|}|j |d}t|dkr~|dn|j}t ||_ |j |\|_ |_t|j }|t|j @|kr|rtd|nt |t|j @|_ |j|jdkr|j|_dS)Nrr%rz%s has host bits set)rNrr4rjrr8rr"r$rlr rJrrrHr rr)rVrrr#rrrrrr rs(    zIPv6Network.__init__ccs@t|j}t|j}x&t|d|dD]}|j|Vq(WdS)Nr%)rjrJrCrr)rVrrrrrr rs  zIPv6Network.hostscCs|jjo|jjS)N)rJrrC)rVrrr rs zIPv6Network.is_site_localN)T) rrrr rrrrrrrrrr rs > rc@seZdZedZedZededededededed ed ed edg Zed ed ededededgZededededededededededededededed gZed!Z d"S)#_IPv6Constantsz fe80::/10zff00::/8z::1/128z::/128z ::ffff:0:0/96z64:ff9b:1::/48z100::/64z 2001::/23z 2001:db8::/32z 2002::/16zfc00::/7z 2001:1::1/128z 2001:1::2/128z 2001:3::/32z2001:4:112::/48z 2001:20::/28z 2001:30::/28z::/8z100::/8z200::/7z400::/6z800::/5z1000::/4z4000::/3z6000::/3z8000::/3zA000::/3zC000::/3zE000::/4zF000::/5zF800::/6zFE00::/9z fec0::/10N) rrrrrrrrrrrrrr rs6          r)T)" __version__rrrr rr rrrrrr$r.r2r;rErMrSrTtotal_orderingr5rNrgr rrrrrr rrrrrrr  sV #716:EE Sa&HWj-cmd.cpython-36.pyc000064400000030441152462730460007750 0ustar003 \ :@s@dZddlZddlZdgZdZejejdZGdddZdS)a A generic class to build line-oriented command interpreters. Interpreters constructed with this class obey the following conventions: 1. End of file on input is processed as the command 'EOF'. 2. A command is parsed out of each line by collecting the prefix composed of characters in the identchars member. 3. A command `foo' is dispatched to a method 'do_foo()'; the do_ method is passed a single argument consisting of the remainder of the line. 4. Typing an empty line repeats the last command. (Actually, it calls the method `emptyline', which may be overridden in a subclass.) 5. There is a predefined `help' method. Given an argument `topic', it calls the command `help_topic'. With no arguments, it lists all topics with defined help_ functions, broken into up to three topics; documented commands, miscellaneous help topics, and undocumented commands. 6. The command '?' is a synonym for `help'. The command '!' is a synonym for `shell', if a do_shell method exists. 7. If completion is enabled, completing commands will be done automatically, and completing of commands args is done by calling complete_foo() with arguments text, line, begidx, endidx. text is string we are matching against, all returned matches must begin with it. line is the current input line (lstripped), begidx and endidx are the beginning and end indexes of the text being matched, which could be used to provide different completion depending upon which position the argument is in. The `default' method may be overridden to intercept commands for which there is no do_ method. The `completedefault' method may be overridden to intercept completions for commands that have no complete_ method. The data member `self.ruler' sets the character used to draw separator lines in the help messages. If empty, no ruler line is drawn. It defaults to "=". If the value of `self.intro' is nonempty when the cmdloop method is called, it is printed out on interpreter startup. This value may be overridden via an optional argument to the cmdloop() method. The data members `self.doc_header', `self.misc_header', and `self.undoc_header' set the headers used for the help function's listings of documented functions, miscellaneous topics, and undocumented functions respectively. NCmdz(Cmd) _c@seZdZdZeZeZdZdZ dZ dZ dZ dZ dZdZd Zd0d d Zd1d dZddZddZddZddZddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Z d+d,Z!d2d.d/Z"dS)3raA simple framework for writing line-oriented command interpreters. These are often useful for test harnesses, administrative tools, and prototypes that will later be wrapped in a more sophisticated interface. A Cmd instance or subclass instance is a line-oriented interpreter framework. There is no good reason to instantiate Cmd itself; rather, it's useful as a superclass of an interpreter class you define yourself in order to inherit Cmd's methods and encapsulate action methods. =Nz(Documented commands (type help ):zMiscellaneous help topics:zUndocumented commands:z*** No help on %stabcCs@|dk r||_ntj|_|dk r(||_ntj|_g|_||_dS)aInstantiate a line-oriented interpreter framework. The optional argument 'completekey' is the readline name of a completion key; it defaults to the Tab key. If completekey is not None and the readline module is available, command completion is done automatically. The optional arguments stdin and stdout specify alternate input and output file objects; if not specified, sys.stdin and sys.stdout are used. N)stdinsysstdoutcmdqueue completekey)selfr rr r/usr/lib64/python3.6/cmd.py__init__Ls z Cmd.__init__cCs|j|jr\|jr\y2ddl}|j|_|j|j|j|jdWnt k rZYnXz|dk rl||_ |j r|j j t |j dd}x|s6|jr|jjd}nl|jryt|j}Wntk rd}YnXn<|j j |j|j j|jj}t|s d}n |jd}|j|}|j|}|j||}qW|jWd|jr|jryddl}|j|jWnt k rYnXXdS)zRepeatedly issue a prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument. rNz : complete EOFz )preloop use_rawinputr readlineZ get_completerZ old_completerZ set_completercompleteparse_and_bind ImportErrorintror writestrr popinputpromptEOFErrorflushrlenrstripprecmdonecmdpostcmdpostloop)r rrstoplinerrrcmdloopbsN           z Cmd.cmdloopcCs|S)zHook method executed just before the command line is interpreted, but after the input prompt is generated and issued. r)r r(rrrr#sz Cmd.precmdcCs|S)z?Hook method executed just after a command dispatch is finished.r)r r'r(rrrr%sz Cmd.postcmdcCsdS)z>Hook method executed once when the cmdloop() method is called.Nr)r rrrrsz Cmd.preloopcCsdS)zYHook method executed once when the cmdloop() method is about to return. Nr)r rrrr&sz Cmd.postloopcCs|j}|sdd|fS|ddkr4d|dd}n2|ddkrft|dr\d|dd}n dd|fSdt|}}x"||kr|||jkr|d}qvW|d|||dj}}|||fS) zParse the line into a command name and a string containing the arguments. Returns a tuple containing (command, args, line). 'command' and 'args' may be None if the line couldn't be parsed. Nr?zhelp r!Zdo_shellzshell )striphasattrr! identchars)r r(incmdargrrr parselines      z Cmd.parselinec Cs|j|\}}}|s|jS|dkr.|j|S||_|dkrBd|_|dkrT|j|Syt|d|}Wntk r|j|SX||SdS)ahInterpret the argument as though it had been typed in response to the prompt. This may be overridden, but should not normally need to be; see the precmd() and postcmd() methods for useful execution hooks. The return value is a flag indicating whether interpretation of commands by the interpreter should stop. Nrrdo_)r3 emptylinedefaultlastcmdgetattrAttributeError)r r(r1r2funcrrrr$s    z Cmd.onecmdcCs|jr|j|jSdS)zCalled when an empty line is entered in response to the prompt. If this method is not overridden, it repeats the last nonempty command entered. N)r7r$)r rrrr5sz Cmd.emptylinecCs|jjd|dS)zCalled on an input line when the command prefix is not recognized. If this method is not overridden, it prints an error message and returns. z*** Unknown syntax: %s N)r r)r r(rrrr6sz Cmd.defaultcGsgS)zMethod called to complete an input line when no command-specific complete_*() method is available. By default, it returns an empty list. r)r ignoredrrrcompletedefaultszCmd.completedefaultcsd|fdd|jDS)Nr4cs"g|]}|jr|ddqS)N) startswith).0a)dotextrr sz%Cmd.completenames..) get_names)r textr;r)rAr completenamesszCmd.completenamesc Cs|dkrddl}|j}|j}t|t|}|j|}|j|}|dkr|j|\} } } | dkrp|j} qyt|d| } Wqt k r|j} YqXn|j } | |||||_ y |j |St k rdSXdS)zReturn the next possible completion for 'text'. If a command has not been entered, then complete against command list. Otherwise try to call complete_ to get list of completions. rNrZ complete_) rZget_line_bufferlstripr!Z get_begidxZ get_endidxr3r<r8r9rEZcompletion_matches IndexError) r rDstaterZorigliner(strippedZbegidxZendidxr1argsZfooZcompfuncrrrrs*   z Cmd.completecCs t|jS)N)dir __class__)r rrrrCsz Cmd.get_namescs4t|j}tfdd|jD}t||BS)Nc3s,|]$}|jddr|ddVqdS)help_rN)r>)r?r@)rJrr sz$Cmd.complete_help..)setrErClist)r rJZcommandsZtopicsr)rJr complete_helpszCmd.complete_helpc Cs|ryt|d|}Wnvtk ry0t|d|j}|rT|jjdt|dSWntk rjYnX|jjdt|j|fdSX|n|j}g}g}i}x,|D]$}|dddkrd||dd<qW|jd} xx|D]p}|dddkr|| kr q|} |dd} | |kr8|j | || =qt||jrR|j | q|j | qW|jjdt|j |j |j |d d |j |j t|jd d |j |j|d d dS) zEList available commands with "help" or detailed help with "help cmd".rMr4z%s NrNrrr=P)r8r9__doc__r rrnohelprCsortappend doc_leader print_topics doc_header misc_headerrQkeys undoc_header) r r2r:docnamesZcmds_docZ cmds_undochelpnameZprevnamer1rrrdo_help$sN        z Cmd.do_helpcCs\|rX|jjdt||jr<|jjdt|jt||j||d|jjddS)Nz%s rr)r rrrulerr! columnize)r headerZcmdsZcmdlenZmaxcolrrrrZRs zCmd.print_topicsrTcss|jjddSfddttD}|rJtddjtt|t}|dkrv|jjdtd dSxtdtD]}||d|}g}d }xrt|D]f} d } x Ncsg|]}t|ts|qSr) isinstancer)r?r/)rQrrrBdsz!Cmd.columnize..z list[i] not a string for i in %sz, rz%s rrz rj) r rranger! TypeErrorjoinmaprmaxrXljust)r rQZ displaywidthZ nonstringssizeZnrowsZncolsZ colwidthsZtotwidthcolZcolwidthrowr/xZtextsr)rQrreZsZ       z Cmd.columnize)rNN)N)rT)#__name__ __module__ __qualname__rUPROMPTr IDENTCHARSr.rdr7rrYr[r\r^rVrrr)r#r%rr&r3r$r5r6r<rErrCrRrcrZrerrrrr4s<   4   .) rUstringr __all__rxZ ascii_lettersZdigitsryrrrrr+s zipfile.cpython-36.pyc000064400000143254152462730460010656 0ustar003 i482@sdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z y ddl Z Wne k r|ddlZ YnXyddlZejZWne k rdZe jZYnXy ddlZWne k rdZYnXy ddlZWne k rdZYnXddddddd d d d d dg ZGdddeZGdddeZeZZdfZdhZdjZdZdZdZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&e j'e%Z(dZ)dZ*dZ+dZ,dZ-d Z.d!Z/d"Z0dZ1d#Z2d$Z3d%Z4e j'e3Z5dZ6dZ7dZ8dZ9dZ:d Z;d!Zd#Z?d&Z@d'ZAdZBd(ZCdZDd)ZEdZFd*ZGd+ZHd,ZId-ZJe j'eIZKdZLdZMdZNdZOdZPd ZQd!ZRd"ZSdZTd#ZUd&ZVd'ZWd.ZXd/ZYe j'eXZZd0Z[d1Z\e j'e[Z]dZ^dZ_dZ`dZadZbd Zcd!Zdd"ZedZfd#Zgd2Zhe jid3Zjd4d5Zkd6d7Zld8d Zmd9d:Znd;d<ZoGd=d d epZqGd>d?d?ZrGd@dAdAZsGdBdCdCZtdDdEdFdFdFdFdGdHdIdJdGdKdLdMdNdOdPdQZudRdSZvdTdUZwdVdWZxGdXdYdYZyGdZd[d[ZzGd\d]d]ej{Z|Gd^d_d_ej{Z}Gd`d d Z~Gdad d e~ZdkdbdcZeddkredS)lzP Read and write ZIP files. XXX references to utf-8 need further investigation. N BadZipFile BadZipfileerror ZIP_STORED ZIP_DEFLATED ZIP_BZIP2ZIP_LZMA is_zipfileZipInfoZipFile PyZipFile LargeZipFilec@s eZdZdS)rN)__name__ __module__ __qualname__rr/usr/lib64/python3.6/zipfile.pyr+sc@seZdZdZdS)r zu Raised when writing a zipfile, the zipfile requires ZIP64 extensions and those extensions are disabled. N)rrr__doc__rrrrr /s -.?s<4s4H2LHsPK z<4s4B4HL2L5H2LsPK z <4s2B4HL2L2HsPKz<4sLQLsPKz <4sQ2H2L4QsPKiPKz        r7c@sVeZdZdZd)Zd+ddZddZd,dd Zd!d"Zd#d$Z e d-d%d&Z d'd(Z dS).r z>Class with attributes describing each file in the ZIP archive. orig_filenamer? date_time compress_typer_r1 create_systemrTextract_versionreserved flag_bitsvolume internal_attr external_attr header_offsetCRC compress_size file_size _raw_time _end_offsetNoNamerrcCs||_|jtd}|dkr(|d|}tjdkrJtj|krJ|jtjd}||_||_|ddkrjtdt |_ d|_ d|_ t jdkrd|_nd|_t|_t|_d|_d|_d|_d|_d|_d|_dS)Nr/iz+ZIP does not support timestamps before 1980r+Zwin32r)r`findchrossepreplacer?ra ValueErrorrrbr_r1sysplatformrcDEFAULT_VERSIONrTrdrerfrgrhriro)selfr?raZ null_byterrr__init__Xs0   zZipInfo.__init__cCsd|jj|jfg}|jtkr8|jdtj|j|j|jd?}|jd@}|rd|jdt j ||rv|jd||j }| s|j r|jd|j | s|j r|jtks|j |j kr|jd|j |jd d j|S) Nz<%s filename=%rz compress_type=%sriz filemode=%rz external_attr=%#xz file_size=%rz compress_size=%r>) __class__rr?rbrr/compressor_namesgetristatfilemodeis_dirrmrlr0)r|r@hiloisdirrrr__repr__s(         zZipInfo.__repr__NcCs||j}|ddd>|dd>B|dB}|dd>|d d>B|ddB}|jd @rfd}}}n|j}|j}|j}|j}d} |d kr|tkp|tk}|rd } |tj| dtj | d ||}|tks|tkr|st d d}d}t } |j t krtt| } n|j tkrtt| } t| |j|_t| |j|_|j\} } tjtt|j|j| |j |||||t| t| } | | |S)z-Return the per-file header as a bytes object.rir$rr!rrr&r rNzy|jjd|jfStk r8|jjd|jdBfSXdS)Nasciizutf-8i)r?encoderfUnicodeEncodeError)r|rrrrszZipInfo._encodeFilenameFlagscCs(|j}tj}xt|dkr"|d|dd\}}|dkr|dkrZ|d|dd}nV|dkrv|d|dd }n:|d kr|d |dd }n|d krf}ntd||fd }|jdkr|||_|d7}|jdkr|||_|d7}|jdkr|j}|||_|d7}||dd}qWdS)Nr z|_|rd|_|jdO_n|j|_|S)a_Construct an appropriate ZipInfo for a file on the filesystem. filename should be the path to a file or directory on the filesystem. arcname is the name which it will have within the archive (by default, this will be the same as filename, but without a drive letter and with leading path separators removed). rr"Nrrrir) isinstanceruPathLikefspathrS_ISDIRst_modetime localtimest_mtimepathnormpath splitdrivervaltseprirmst_size)clsr?arcnamestrmtimerazinforrr from_files(       zZipInfo.from_filecCs|jddkS)z2Return True if this archive member is a directory.rrr)r?)r|rrrrszZipInfo.is_dir)r`r?rarbr_r1rcrTrdrerfrgrhrirjrkrlrmrnrorqrrrrr)rpr)N)N) rrrr __slots__r}rrrr classmethodrrrrrrr >s: + .$ !c@s<eZdZdZddZdZddZddZd d Zd d Z dS) _ZipDecrypteraClass to handle decryption of files stored within a ZIP archive. ZIP supports a password-based form of encryption. Even though known plaintext attacks have been found against it, it is still useful to be able to get data out of such a file. Usage: zd = _ZipDecrypter(mypwd) plain_char = zd(cypher_char) plain_text = map(zd, cypher_text) cCshd}dgd}xTtdD]H}|}x6tdD]*}|d@rH|d?d@|A}q*|d?d@}q*W|||<qW|S)zGenerate a CRC-32 table. ZIP encryption uses the CRC32 one-byte primitive for scrambling some internal keys. We noticed that a direct implementation is faster than relying on binascii.crc32(). l q[rrri)range)Zpolytabler4crcr5rrr_GenerateCRCTable%s  z_ZipDecrypter._GenerateCRCTableNcCs|d?d@|j||Ad@AS)z(Compute the CRC32 primitive on one byte.ri)crctable)r|Zchrrrr_crc329sz_ZipDecrypter._crc32cCsBtjdkrtjt_d|_d|_d|_x|D]}|j|q,WdS)NixV4igE#ixV4)rrrkey0key1key2 _UpdateKeys)r|pwdprrrr}=s   z_ZipDecrypter.__init__cCsX|j||j|_|j|jd@d@|_|jddd@|_|j|jd?d@|j|_dS)Nrlirr)rrrr)r|crrrrFsz_ZipDecrypter._UpdateKeyscCs>t|tst|jdB}|||dAd?d@A}|j||S)zDecrypt a single character.rrrr)rintAssertionErrorrr)r|rkrrr__call__Ls   z_ZipDecrypter.__call__) rrrrrrrr}rrrrrrrs  rc@s,eZdZddZddZddZddZd S) LZMACompressorcCs d|_dS)N)_comp)r|rrrr}WszLZMACompressor.__init__cCsFtjdtji}tjtjtjtj|gd|_tjdddt ||S)Nid)filtersz|jjd|jd}|dkr>|j|j|}||_|Stjj||S)zrRead and return a line from the stream. If limit is specified, at most limit bytes will be read. r r)r rsr ioBufferedIOBasereadline)r|limitr4linerrrrMszZipExtFile.readlinecCsr|t|j|jkr\|j|}t||jkrJ||j|jd|_d|_n|jt|8_|j|j|jdS)z6Returns buffered bytes without advancing the position.Nri)r.r r r;)r|rchunkrrrpeek]s zZipExtFile.peekcCsdS)NTr)r|rrrreadablejszZipExtFile.readablecCs |dks|dkrL|j|jd}d|_d|_x|jsF||j|j7}q.W|S||j}|t|jkr~|j|j|}||_|S|t|j}|j|jd}d|_d|_x^|dko|j r|j|}|t|kr||_||_||d|7}P||7}|t|8}qW|S)zRead and return up to n bytes. If the argument is omitted, None, or negative, data is read and returned until EOF is reached.. Nrr+)r r r_read1MAX_Nr.)r|rbufendrSrrrr;ms4   zZipExtFile.readcCs@|jdkrdSt||j|_|jr<|j|jkr      zZipExtFile.read1cCs"|js|dkrdS|jtkrH|jj}|t|krR||j|t|7}n |j|}|jtkrj|jdk|_nx|jtkrt ||j }|jj ||}|jj p|jdko|jj |_|jr||jj 7}n |jj |}|jj p|jdk|_|d|j}|jt|8_|jdkrd|_|j||S)Nrr+T)rrrrZunconsumed_tailr._read2rrr\ MIN_READ_SIZErrrrr')r|rrSrrrr"s2           zZipExtFile._read1cCsj|jdkrdSt||j}t||j}|jj|}|jt|8_|sLt|jdk rft t |j|}|S)Nrr+) rr\r*minrr;r.EOFErrorrbytesmap)r|rrSrrrr)s     zZipExtFile._read2c s&z|jr|jjWdtjXdS)N)rrrsuper)r|)rrrrszZipExtFile.closecCs|jS)N)r)r|rrrrszZipExtFile.seekablercCs,|jstjd|j}|dkr&|}n.|dkr8||}n|dkrL|j|}ntd||jkrd|j}|dkrpd}||}||j}|dkr|t|jkr||_d}nR|dkr|j j |j |j |_ |j|_|j|_d|_d|_tj|j|_d|_|}x,|dkr"t|j|}|j|||8}qW|jS)Nz!underlying stream is not seekablerrrzCwhence must be os.SEEK_SET (0), os.SEEK_CUR (1), or os.SEEK_END (2)r+F)rrUnsupportedOperationrWrrxr r.r rrArrrrrrZzipfilerrrrr+ MAX_SEEK_READr;)r|rQrZcurr_posZnew_posZ read_offsetZ buff_offsetZread_lenrrrrAsD         zZipExtFile.seekcCs0|jstjd|j|jt|j|j}|S)Nz!underlying stream is not seekable)rrr0rrr.r r )r|ZfileposrrrrW*s zZipExtFile.telli@i)NFr)r)rr)r)r)rrrrr#r*r1r}rrr r!r;r'r(r"r)rrrArW __classcell__rr)rrrs& *   ! %$  /rcs@eZdZddZeddZddZddZfd d ZZ S) _ZipWriteFilecCs4||_||_||_t|j|_d|_d|_d|_dS)Nr) _zinfo_zip64_zipfilerrb _compressor _file_size_compress_size_crc)r|zfrrrrrr}2s z_ZipWriteFile.__init__cCs|jjS)N)r7r9)r|rrrr;sz_ZipWriteFile._fileobjcCsdS)NTr)r|rrrwritable?sz_ZipWriteFile.writablecCsf|jrtdt|}|j|7_t||j|_|jrV|jj|}|jt|7_|j j ||S)NzI/O operation on closed file.) rrxr.r9rr;r8rr:rr)r|rSnbytesrrrrBs  z_ZipWriteFile.writecsX|jr dStj|jrN|jj}|jt|7_|jj||j|j _ n |j |j _ |j |j _ |j |j _|j jd@r|jrdnd}|jjtj|t|j j |j j |j j|jj|j_nn|js|j tkrtd|jtkrtd|jj|j_|jj|j j|jj|j j|j|jj|jjd|j_|jjj|j |j |jj|j j <dS)Nrzd d!d"d#Zd?d$d%Zd@d&d'ZdAd(d)Zed*d+Zd,d-Zd.d/ZdBd0d1ZdCd2d3Zd4d5Z d6d7Z!d8d9Z"d:d;Z#dS)Dr a Class with methods to open, read, write, close, list zip files. z = ZipFile(file, mode="r", compression=ZIP_STORED, allowZip64=True) file: Either the path to the file, or a file-like object. If it is a path, the file will be opened and closed by ZipFile. mode: The mode can be either read 'r', write 'w', exclusive create 'x', or append 'a'. compression: ZIP_STORED (no compression), ZIP_DEFLATED (requires zlib), ZIP_BZIP2 (requires bz2) or ZIP_LZMA (requires lzma). allowZip64: if True ZipFile will create files with ZIP64 extensions when needed, otherwise it will raise an exception when this would be necessary. NrTcCsF|dkrtdt|||_d|_d|_i|_g|_||_||_d|_ d |_ t |t j rdt j|}t |trd|_||_d d d d d ddd}||}x^ytj|||_Wn(tk r||kr||}wYnXPqWnd|_||_t|dd|_d|_tj|_d|_d|_y|dkr*|jn|dkrd|_y|jj|_Wn2t tfk r|t!|j|_d|_d|_Yn6Xy|jj"|jWn t tfk rd|_YnXnf|dkry|j|jj"|jWn6t#k r|jj"ddd|_|jj|_YnXntdWn$|j}d|_|j$|YnXdS)z]Open the ZIP file with mode read 'r', write 'w', exclusive create 'x', or append 'a'.rDwxaz+ZipFile requires mode 'r', 'w', 'x', or 'a'FrNr+r<zw+bzx+bzr+bwbZxb)rDrErFrGzr+bzw+bzx+brr Trz"Mode must be 'r', 'w', 'x', or 'a')rDrErFrG)rErF)%rxr _allowZip64 _didModifydebugrBrArr r_commentrrurrstr _filePassedr?rr>r9r8getattr _fileRefCnt threadingRLockrrr_RealGetContentsrWr@rrrAr_fpclose)r|rr r allowZip64ZmodeDictrr9rrrr}s             zZipFile.__init__cCs|S)Nr)r|rrr __enter__szZipFile.__enter__cCs |jdS)N)r)r|typevalue tracebackrrr__exit__szZipFile.__exit__cCsd|jj|jjfg}|jdk rd|jr8|jd|jn|jdk rR|jd|j|jd|jn |jd|jddj|S)Nz<%s.%sz file=%rz filename=%rz mode=%rz [closed]r~r) rrrr9rNr/r?r r0)r|r@rrrrs    zZipFile.__repr__cCs|j}y t|}Wntk r.tdYnX|sIsz*ZipFile._RealGetContents..T)keyreverseN);r9r7r8rrKprintrNrO _ECD_COMMENTrL _ECD_LOCATIONrIrHrFrBr@rAr;rBytesIOsizeCentralDirr.rCr-structCentralDir _CD_SIGNATUREstringCentralDir_CD_FILENAME_LENGTHdecoder _CD_EXTRA_FIELD_LENGTHr1_CD_COMMENT_LENGTHr__CD_LOCAL_HEADER_OFFSETrjrTrcrdrerfrbrkrlrmMAX_EXTRACT_VERSIONrrgrhrirnrarrAr/rBr?sortedro)r|r9rRZsize_cdZ offset_cdconcatZinferredrSr\centdirr?flagsrFtdZ end_offsetrrrrrSs|                4        zZipFile._RealGetContentscCsdd|jDS)z+Return a list of file names in the archive.cSsg|] }|jqSr)r?).0rSrrr Psz$ZipFile.namelist..)rA)r|rrrnamelistNszZipFile.namelistcCs|jS)zJReturn a list of class ZipInfo instances for files in the archive.)rA)r|rrrinfolistRszZipFile.infolistcCsPtdd |dx:|jD]0}d|jdd}td |j||jf|dqWdS) z+Print a table of contents for the zip file.z%-46s %19s %12s File Name Modified Size)rz%d-%02d-%02d %02d:%02d:%02dNr"z %-46s %s %12d)rxryrz)r`rArar?rm)r|rrZdaterrrprintdirWs  zZipFile.printdircCs^d}xT|jD]J}y.|j|jd}x|j|r0q$WWdQRXWq tk rT|jSXq WdS)z%Read all the files and check the CRC.rrrDNi)rAr>r?r;r)r|Z chunk_sizerfrrrtestzip`s  zZipFile.testzipcCs$|jj|}|dkr td||S)z,Return the instance of ZipInfo given 'name'.Nz(There is no item named %r in the archive)rBrKeyError)r|r inforrrgetinfoms   zZipFile.getinfocCs8|r"t|t r"tdt|j|r.||_nd|_dS)z)Set default password for encrypted files.zpwd: expected bytes, got %sN)rr- TypeErrorrWrr)r|rrrr setpasswordvs zZipFile.setpasswordcCs|jS)z.The comment text associated with the ZIP file.)rL)r|rrrr_szZipFile.commentcCs^t|tstdt|jt|tkrNddl}|jdtdd|dt}||_ d|_ dS)Nzcomment: expected bytes, got %srz3Archive comment is too long; truncating to %d bytesr) stacklevelT) rr-rrWrr.ZIP_MAX_COMMENTwarningswarnrLrJ)r|r_rrrrr_s    c Cs"|j|d| }|jSQRXdS)zReturn file bytes for name.rDN)r>r;)r|r rr9rrrr;sz ZipFile.readF) force_zip64c s|d"krtd|r2t|t r2tdt|j|rF|dkrFtdjsTtdt|trd|}n$|dkr~t|}j|_ n j |}|dkrj ||dSj rtdj d 7_ tj|jjjfd d }y|jt}t|tkrtd tjt|}|ttkr td |j|t}|trF|j|t|jd@rZtd|jd@rntd|jd@r|jd} n |jd} | |j krtd|j |f|j!dk r|j"|j#|j!krtd|j d|jd @} d} | r|sj$}|st%d|t&|} |jd} t't(| | dd} |jd@rX|j)d?d@}n|j*d?d@}| d|krt%d |t+|||| d!S|j,YnXdS)#auReturn file-like object for 'name'. name is a string for the file name within the ZIP file, or a ZipInfo object. mode should be 'r' to read a file already in the ZIP file, or 'w' to write to a file newly added to the archive. pwd is the password to decrypt files (only used for reading). When writing, if the file size is not known in advance but may exceed 2 GiB, pass force_zip64 to use the ZIP64 format, which can handle large files. If the size is known in advance, it is best to pass a ZipInfo instance for name, with zinfo.file_size set. rDrEzopen() requires mode "r" or "w"zpwd: expected bytes, got %sz'pwd is only supported for reading filesz2Attempt to use ZIP archive that was already closed)rzyCan't read from the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.rcsjS)N)rr)r|rrr]szZipFile.open..zTruncated file headerz Bad magic number for file header z$compressed patched data (flag bit 5)@zstrong encryption (flag bit 6)izutf-8r[z/File name in directory %r and header %r differ.NzOverlapped entries: z (possible zip bomb)z6File %r is encrypted, password required for extractionrrrrrr&zBad password for file %rT>rDrE)-rxrr-rrWrr9r rrbr_open_to_writerrPrrjrTrr;sizeFileHeaderr.rrCr-r _FH_SIGNATUREr_FH_FILENAME_LENGTH_FH_EXTRA_FIELD_LENGTHrfrrir`rorWrlrrrr[r.rnrkrr)r|r r rrrZzef_fileZfheaderfnameZ fname_strZ is_encryptedZzdrhZ check_byter)r|rr>s                   z ZipFile.opencCs|r|j rtd|jr"tdt|ds2d|_d|_d|_d|_|jt kr\|jdO_|j sp|jdO_|j s|d |_ |jo|p|jd t k}|j r|j j|j|j j|_|j|d |_|j j|j|d |_t|||S) NzHforce_zip64 is True, but allowZip64 was False when opening the ZIP file.zzCan't write to the ZIP file while there is another write handle open on it. Close the first handle before opening another.rmrrrirg?Ti)rIrxrr=rmrlrkrfrbrrrirr9rAr@rWrj _writecheckrJrrr4)r|rrrrrrr s4     zZipFile._open_to_writecCs*|dkrtj}n tj|}|j|||S)a#Extract a member from the archive to the current working directory, using its full name. Its file information is extracted as accurately as possible. `member' may be a filename or a ZipInfo object. You can specify a different directory using `path'. N)rugetcwdr_extract_member)r|memberrrrrrextract6s  zZipFile.extractcCsL|dkr|j}|dkr"tj}n tj|}x|D]}|j|||q2WdS)zExtract all members from the archive to the current working directory. `path' specifies a different directory to extract to. `members' is optional and must be a subset of the list returned by namelist(). N)rvrurrr)r|rmembersrrrrr extractallCs   zZipFile.extractallcCs^|j}|s(d}tj|dt|}||_|j|}dd|j|D}|jdd|D}|S)z;Replace bad characters and remove trailing dots from parts.z:<>|"?*_css|]}|jdVqdS).N)rstrip)rtrFrrr ^sz1ZipFile._sanitize_windows_name..css|]}|r|VqdS)Nr)rtrFrrrr`s)!_windows_illegal_name_trans_tablerM maketransr. translatesplitr0)rrpathseprZillegalrrr_sanitize_windows_nameTs zZipFile._sanitize_windows_namecsNt|ts|j|}|jjdtjj}tjjrB|jtjjtjj}tjj |d}dtjj tjj ftjjj fdd|j tjjD}tjjdkr|j|tjj}tjj ||}tjj|}tjj|}|rtjj| rtj||jrtjj|s tj||S|j||d(}t|d}tj||Wd QRXWd QRX|S) zbExtract the ZipInfo object 'member' to a physical file on the path targetpath. rrrrc3s|]}|kr|VqdS)Nr)rtrF)invalid_path_partsrrrtsz*ZipFile._extract_member..\)rrHN)rr rr?rwrurrvrrcurdirpardirr0rrrdirnameexistsmakedirsrrmkdirr>shutil copyfileobj)r|rZ targetpathrrZ upperdirssourcetargetr)rrrcs.  &        zZipFile._extract_membercCs|j|jkr(ddl}|jd|jdd|jdkr:td |jsHtd t|j|j sd}t |j t krpd }n|j tkrd }n|jtkrd }|rt|ddS)z6Check for errors before writing a file to the archive.rNzDuplicate name: %rr)rrErFrGz&write() requires mode 'w', 'x', or 'a'z4Attempt to write ZIP archive that was already closedz Files countZFilesizez Zipfile sizez would require ZIP64 extensions)rErFrG)r?rBrrr rxr9rrbrIr.rAZIP_FILECOUNT_LIMITrmrrjr )r|rrrequires_zip64rrrrs(     zZipFile._writecheckcCs0|jstd|jrtdtj||}|jr>d|_d|_n|dk rN||_n|j |_|jr|j |j rz|jj |j |jj|_|jtkr|jdO_|j|d|_|jj|||j|j<|jj|jd|jj|_ WdQRXnCan't write to ZIP archive while an open writing handle existsrNrTFr<rEiri )r9rxrr rrrlrkrbrrrrAr@rWrjrrfrrJrAr/rBr?rrr>rr)r|r?rrbrsrcdestrrrrs8      z ZipFile.writecCst|tr|jd}t|tspt|tjtjddd}|j|_|jddkrhd|_ |j dO_ qtd|_ n|}|j st d |j rt d |dk r||_t ||_|j*|j|d d }|j|WdQRXWdQRXdS)aWrite a file into the archive. The contents is 'data', which may be either a 'str' or a 'bytes' instance; if it is a 'str', it is encoded as UTF-8 first. 'zinfo_or_arcname' is either a ZipInfo instance or the name of the file in the archive.zutf-8Nr")r?rarrriAriz7Attempt to write to ZIP archive that was already closedz?Can't write to ZIP archive while an open writing handle exists.rE)r riAi)rrMrr rrrrbr?rir9rxrr.rmrr>r)r|Zzinfo_or_arcnamerSrbrrrrrwritestrs.    zZipFile.writestrcCs |jdS)z2Call the "close()" method in case the user forgot.N)r)r|rrr__del__szZipFile.__del__cCs||jdkrdS|jrtdzB|jdkr\|jr\|j"|jrJ|jj|j|j WdQRXWd|j}d|_|j |XdS)zOClose the file, and for mode 'w', 'x' and 'a' write the ending records.NzvCan't close the ZIP file while there is an open writing handle on it. Close the writing handle before closing the zip.rErFrG)rErFrG) r9rrxr rJrrrAr@_write_end_recordrT)r|r9rrrrs z ZipFile.closecCsrxP|jD]D}|j}|ddd>|dd>B|dB}|dd>|d d>B|ddB}g}|jtksv|jtkr|j|j|j|jd }d }n |j}|j}|jtkr|j|jd }n|j}|j} d} |rt| d} t j d d t |dd t |f|| } t } |j tkr(tt| } n|j tkr>tt| } t| |j} t| |j} yZ|j\} }t j tt| |j| |j||j |||j||t | t | t |jd|j|j|}Wnltk rttt| |j| |j|j |j |||j||t |j!t | t |jd|j|j|ft"j#dYnX|j$j%||j$j%| |j$j%| |j$j%|jq W|j$j&}t |j}||j'}|j'}d}|t(krd}n|tkrd}n|tkrd}|r*|j)st*|dt j t+t,ddddd|||| }|j$j%|t j t-t.d|d}|j$j%|t/|d}t/|d }t/|d }t j t0t1dd||||t |j2 }|j$j%||j$j%|j2|j$j3dS)Nrir$rr!rrr&r lzrrrrrrrrrrrrrTrrrrr {s<WT     u +  * * $fc@s4eZdZdZdedd fddZdd d Zd d ZdS)r zDClass to create ZIP archives with Python library files and packages.rDTrcCstj|||||d||_dS)N)r rrU)r r} _optimize)r|rr rrUoptimizerrrr}|s zPyZipFile.__init__rNcCstj|}|rF|| rF|jrBtjj|r.dnd}td||fdStjj|\}}tjj|rntjj|d}tjj|r|rd||f}n|}|jrtd|d||j |d d|\}} |jrtd | |j || tj |} | j dx| D]} tjj|| } tjj | \} }tjj| rRtjjtjj| dr|j| ||d q|d kr|r||  r|jrtd| q|j | d d|\}} |jrtd | |j || qWn|jrtd|xtj |D]} tjj|| } tjj | \} }|d kr|r0||  r0|jrtd| q|j | d d|\}} |jrZtd | |j || qWnP|ddd krtd|j |d d|\}} |jrtd| |j || dS)aAdd all files from "pathname" to the ZIP archive. If pathname is a package directory, search the directory and all package subdirectories recursively for all *.py and enter the modules into the archive. If pathname is a plain directory, listdir *.py and enter all modules. Else, pathname must be a Python *.py file and the module will be put into the archive. Added modules are always module.pyc. This method will compile the module.py into module.pyc if necessary. If filterfunc(pathname) is given, it is called with every argument. When it is False, the file or directory is skipped. rrz%s %r skipped by filterfuncNz __init__.pyz%s/%szAdding package inasrrZAdding) filterfuncz.pyzfile %r skipped by filterfunczAdding files from directoryz.Files added with writepy() must end with ".py"z Adding filerrrr)rurrKrrr`rr0isfile _get_codenamerlistdirremovesplitextwritepyr)r|pathnamebasenamerZlabeldirr ZinitnamerrZdirlistr?rrootZextrrrrsx                zPyZipFile.writepyc sdfdd }|d}|d}tjj|dd}tjj|dd}tjj|dd}jdkr\tjj|rtj|jtj|jkr|} } ntjj|rtj|jtj|jkr|} |} ntjj|rtj|jtj|jkr|} |} nvtjj|rtj|jtj|jkr|} |} nD||rRt j j d kr4|} nt j j dkrH|} n|} |} n|} } njd krr|} |} n<|} jdkr|} n&jdkr|} nd j j} t | tjj| otj| jtj|jks||jd s|} } tjj| d} |rd || f} | | fS)aReturn (filename, archivename) for the path. Given a module name path, return the correct file path and archive name, compiling if necessary. For example, given /python/lib/string, return (/python/lib/string.pyc, string). rcs^ddl}jrtd|y|j|d|dWn,|jk rX}zt|jdSd}~XnXdS)NrZ CompilingT)doraiserF) py_compilerKr`compilePyCompileErrormsg)rrrerr)r|rr_compiles  z)PyZipFile._get_codename.._compilez.pyz.pycr) optimizationrrz"invalid value for 'optimize': {!r})rz%s/%sr)rr) importlibutilcache_from_sourcerrurrrrryrqrformatrxr) r|rrrZfile_pyZfile_pycZ pycache_opt0Z pycache_opt1Z pycache_opt2rrrZ archivenamer)r|rrs`             zPyZipFile._get_codenamer)rN)rrrrrr}rrrrrrr ys  Rc sddl}|jd}|dkr(tjdd}| s:|ddkrLt|tjd|ddkrt|dkrvt|tjdt|dd }|jWdQRXn||ddkr t|dkrt|tjdt|dd }|j }WdQRX|rtd j |td n|ddkrbt|d kr8t|tjdt|dd }|j |dWdQRXn|ddkrt|d krt|tjdfd dt|ddh}x`|ddD]P}t j j|}|st j jt j j|}|dt jt jfkrd}|||qWWdQRXdS)NraE Usage: zipfile.py -l zipfile.zip # Show listing of a zipfile zipfile.py -t zipfile.zip # Test if a zipfile is valid zipfile.py -e zipfile.zip target # Extract zipfile into target dir zipfile.py -c zipfile.zip src ... # Create zipfile from sources r-l-c-e-trrDz.The following enclosed file is corrupted: {!r}z Done testingrcsptjj|r|j||tnPtjj|rl|r8|j||x2tj|D]$}|tjj||tjj||qDWdS)N)rurrrrrrr0)r<rzippathZnm)addToZiprrrUs   zmain..addToZiprEr)rrrr)textwrapdedentryargvr`exitr.r r{r}rrrurrrrr)argsrZUSAGEr<Zbadfilerrr)rrmain'sT           r__main__liiiii)N)rrrureimportlib.utilrryrrrrCZbinasciirQ ImportErrorZdummy_threadingrrrr__all__ Exceptionrr rrrrrrrrrr{rrrrmrZrYrrXrIrJrKrLrMrNrOr^rarbrergrdrfZ_CD_CREATE_VERSIONZ_CD_CREATE_SYSTEMZ_CD_EXTRACT_VERSIONZ_CD_EXTRACT_SYSTEMZ _CD_FLAG_BITSZ_CD_COMPRESS_TYPEZ_CD_TIMEZ_CD_DATEZ_CD_CRCZ_CD_COMPRESSED_SIZEZ_CD_UNCOMPRESSED_SIZErhrjrkZ_CD_DISK_NUMBER_STARTZ_CD_INTERNAL_FILE_ATTRIBUTESZ_CD_EXTERNAL_FILE_ATTRIBUTESrlrrrrZ_FH_EXTRACT_VERSIONZ_FH_EXTRACT_SYSTEMZ_FH_GENERAL_PURPOSE_FLAG_BITSZ_FH_COMPRESSION_METHODZ_FH_LAST_MOD_TIMEZ_FH_LAST_MOD_DATEZ_FH_CRCZ_FH_COMPRESSED_SIZEZ_FH_UNCOMPRESSED_SIZErrrDrErBrGrHrFZ_CD64_SIGNATUREZ_CD64_DIRECTORY_RECSIZEZ_CD64_CREATE_VERSIONZ_CD64_EXTRACT_VERSIONZ_CD64_DISK_NUMBERZ_CD64_DISK_NUMBER_STARTZ_CD64_NUMBER_ENTRIES_THIS_DISKZ_CD64_NUMBER_ENTRIES_TOTALZ_CD64_DIRECTORY_SIZEZ_CD64_OFFSET_START_CENTDIRr?ZStructr,r6r:r rUr7objectr rrrrrrrrrrrr4r r rrrrrrsD              +=[= &-J/ B base64.cpython-36.opt-2.pyc000064400000026051152462730460011233 0ustar003 \O@sddlZddlZddlZdddddddd d d d d ddddddgZeefZddZdBddZdCddZ ddZ ddZ ej ddZ ej ddZddZddZdZdadad dZdDd!d Zd"d ZdEd#d Zdadad$Zd%ZdFd&d'Zddddd(d)dZddd*d+d,dZd-Zda da!da"dGd.d Z#d/d Z$d0Z%e%d1d2Z&d3dZ'd4dZ(d5d6Z)d7dZ*d8d9Z+d:dZ,d;d<Z-d=d>Z.d?d@Z/e0dAkre.dS)HNencodedecode encodebytes decodebytes b64encode b64decode b32encode b32decode b16encode b16decode b85encode b85decode a85encode a85decodestandard_b64encodestandard_b64decodeurlsafe_b64encodeurlsafe_b64decodecCsxt|tr2y |jdStk r0tdYnXt|tr@|Sy t|jStk rrtd|j j dYnXdS)Nasciiz4string argument should contain only ASCII charactersz>argument should be a bytes-like object or ASCII string, not %r) isinstancestrrUnicodeEncodeError ValueError bytes_types memoryviewtobytes TypeError __class____name__)sr /usr/lib64/python3.6/base64.py_bytes_from_decode_data"s    r"cCs,tj|dd}|dk r(|jtjd|S|S)NF)newlines+/)binascii b2a_base64 translatebytes maketrans)raltcharsencodedr r r!r3sFcCsPt|}|dk r*t|}|jtj|d}|rFtjd| rFtjdtj|S)Ns+/s^[A-Za-z0-9+/]*={0,2}$zNon-base64 digit found) r"r&r'r(rematchr$Error a2b_base64)rr)Zvalidater r r!rAs cCst|S)N)r)rr r r!rZscCst|S)N)r)rr r r!rass+/s-_cCst|jtS)N)rr&_urlsafe_encode_translation)rr r r!roscCst|}|jt}t|S)N)r"r&_urlsafe_decode_translationr)rr r r!rxs  s ABCDEFGHIJKLMNOPQRSTUVWXYZ234567csBtdkr,ddtDfddDadt|tsBt|j}t|d}|rb|dd|}t}tj }t}xjt dt|dD]V}||||dd}|||d?||d ?d @||d ?d @||d @7}qW|d krd |dd<nF|dkr d|dd<n.|dkr$d|dd<n|dkr:d|dd<t |S)NcSsg|]}t|fqSr )r').0ir r r! szb32encode..csg|]}D] }||q qSr r )r1ab)b32tabr r!r3srbigi s======s====s====i) _b32tab2 _b32alphabetrrrrlen bytearrayint from_bytesranger')rleftoverr*rKZb32tab2r2cr )r6r!rs4   *    c CstdkrddttDat|}t|dr8tjd|dk r^t|}|jtj dd|}|rj|j }t|}|j d}|t|}t }t}xt dt|dD]l}|||d}d} y"x|D]} | d >|| } qWWn tk rtjd dYnX|| jd d 7}qW|ds(|dkr2tjd|rz|rz| d |K} | jd d } dd |d} | d| |dd<t|S)NcSsi|]\}}||qSr r )r1kvr r r! szb32decode..zIncorrect paddings01OrBrr7zNon-base32 digit foundr9r=rAr@r>+>rr=rAr@r>)_b32rev enumeraterGr"rHr$r-r&r'r(upperrstriprIrLKeyErrorto_bytes) rcasefoldZmap01lZpadcharsdecodedZb32revr2ZquantaaccrNZlastrMr r r!r s@         cCstj|jS)N)r$ZhexlifyrX)rr r r!r scCs4t|}|r|j}tjd|r*tjdtj|S)Ns [^0-9A-F]zNon-base16 digit found)r"rXr+searchr$r-Z unhexlify)rr\r r r!r s   s<~s~>c st|tst|j}t| d}|r4|d|}tjdt|dj|}fdd|D}|r| r|d dkrdd |d <|d d| |d<d j|S)Nr@r8z!%dIcsRg|]J}r| rdn6r&|dkr&dn&|d|dd|dqS)zi yi^ Ui9r )r1Zword)charschars2foldnuls foldspacesr r!r3!sz_85encode..r=rarr7rErErErE) rrrrrHstructStructZunpackjoin) r5rdrepadrfrgpaddingZwordschunksr )rdrerfrgr! _85encodes     ro)rgwrapcolrladobecstdkr*ddtddDaddtDat|tt|d||rHtrt|rVdndfd dtd tD}|rt|d dkr|jd d j||rt 7S)NcSsg|]}t|fqSr )r')r1r2r r r!r3Dsza85encode..!vcSsg|]}tD] }||q qSr ) _a85chars)r1r4r5r r r!r3EsTr?r=csg|]}||qSr r )r1r2)resultrpr r!r3Msrrh rE) rtrL _a85chars2ro _A85STARTmaxrHappendrk_A85END)r5rgrprlrqrnr )rurpr!r/s"   s )rgrq ignorecharsc Cst|}|rH|jts$tdjt|jtr<|dd}n |dd}tjdj }g}|j }g}|j }|j } x|dD]} d| kodknr|| t |dkrrd} x|D]} d | | d } qWy||| Wn"tj k rtd dYnX| qz| dkr0|r&td |dqz|rX| dkrX|rNtd|dqz| |krfqzqztd| qzWdj|} dt |} | r| d| } | S)Nz1Ascii85 encoded byte sequences must end with {!r}r?z!Iur@!rr7rcrrzAscii85 overflowrazz inside Ascii85 5-tuplesrbzy inside Ascii85 5-tuples zNon-Ascii85 digit found: %crhrsuuuurruzy)r"endswithr{rformat startswithrxrirjpackrzclearrHerrorrk)r5rgrqr|packIr^Zdecoded_appendZcurrZ curr_appendZ curr_clearxr_rurmr r r!rXsV           sU0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~cCs2tdkr$ddtDaddtDat|tt|S)NcSsg|]}t|fqSr )r')r1r2r r r!r3szb85encode..cSsg|]}tD] }||q qSr ) _b85chars)r1r4r5r r r!r3s)r _b85alphabet _b85chars2ro)r5rlr r r!r s c CsZtdkr0dgdaxttD]\}}|t|<qWt|}t| d}|d|}g}tjdj}xtdt|dD]}|||d}d}y"x|D]}|dt|}qWWnJt k rx2t|D]&\}}t|dkrt d||dqWYnXy|j ||Wqttj k r2t d|dYqtXqtWd j |} |rV| d| } | S) Nr7~z!Irrcz#bad base85 character at position %dz+base85 overflow in hunk starting at byte %drh)_b85decrWrr"rHrirjrrLrrrzrrk) r5r2rNrmoutrchunkr_jrur r r!r s<       Lr@rAcCs`xZ|jt}|sPx0t|tkrB|jtt|}|s8P||7}qWtj|}|j|qWdS)N)read MAXBINSIZErHr$r%write)inputoutputrnsliner r r!rs   cCs,x&|j}|sPtj|}|j|qWdS)N)readliner$r.r)rrrrr r r!rs  cCsy t|}Wn8tk rD}zd|jj}t||WYdd}~XnX|jdkrjd|j|jjf}t||jdkrd|j|jjf}t|dS) Nz"expected bytes-like object, not %srNr5Bz-expected single byte elements, not %r from %sr=z(expected 1-D data, not %d-D data from %s)rNr5r)rrrrrndim)rmerrmsgr r r!_input_type_checks    rcCsPt|g}x8tdt|tD]$}|||t}|jtj|qWdj|S)Nrrh)rrLrHrrzr$r%rk)rpiecesr2rr r r!r s cCsddl}|jdtdt|S)NrzAencodestring() is a deprecated alias since 3.1, use encodebytes()r?)warningswarnDeprecationWarningr)rrr r r! encodestringsrcCst|tj|S)N)rr$r.)rr r r!rscCsddl}|jdtdt|S)NrzHdecodestring() is a deprecated alias since Python 3.1, use decodebytes()r?)rrrr)rrr r r! decodestring$src Csddl}ddl}y|j|jddd\}}WnP|jk r~}z2|j|_t|td|jd|jdWYdd}~XnXt}xF|D]>\}}|dkrt}|dkrt }|dkrt }|d krt dSqW|o|dd krt |dd }|||jj WdQRXn||j j |jj dS) Nrr=Zdeutzusage: %s [-d|-e|-u|-t] [file|-] -d, -u: decode -e: encode (default) -t: encode and decode string 'Aladdin:open sesame'r?z-ez-dz-uz-t-rb)sysgetoptargvrstderrstdoutprintexitrrtestopenbufferstdin) rrZoptsargsrfuncor4fr r r!main.s0rcCs<d}tt|t|}tt|t|}tt|dS)NsAladdin:open sesame)rreprrr)Zs0s1s2r r r!rHs   r__main__)N)NF)FN)F)FFF)F)1r+rir$__all__r'rIrr"rrrrr(r/r0rrrGrFrVrr r r rtrwrxr{rorrrrrrr r Z MAXLINESIZErrrrrrrrrrrr r r r! sf     & C  )H -      subprocess.cpython-36.opt-1.pyc000064400000105072152462730460012337 0ustar003 \@s8dZddlZejdkZddlZddlZddlZddlZddlZddl Z ddl Z ddlm Z Gddde ZGdddeZGd d d eZerddlZddlZddlZGd d d ZnhddlZddlZddlZy ddlZWnek rddlZYnXeed dZeedrejZnejZddddddddddddd dgZ erddlm!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(e j)ddddd d!d"d#d g Gd$d%d%e*Z+gZ,d&d'Z-dZ0d+d,Z1d-d.Z2dd/d0dZ3d1dZ4dd/d2dZ5Gd3dde6Z7ddd4d5d6dZ8d7d8Z9d9dZ:d:dZ;e6Z}|jtjd}|dk rytj|Wqtk rJYqXqWdS)N) _deadstate)_active_internal_pollsysmaxsizeremover)Zinstresrrr_cleanupsrEcCs*g}tjj}|dkr&|jdd||S)zgReturn a list of command-line arguments reproducing the current optimization settings in sys.flags.r-O)rAflagsoptimizeappend)argsrrrr"_optim_args_from_interpreter_flagss rOcCsddddddd}t}x:|jD].\}}ttj|}|dkr"|jd ||q"Wtjjrh|jd n$tjjrz|jd tjjr|jd xtj D]}|jd |qWttdi}xDdD]<}||kr||}|dkr|}n d||f}|j d|fqW|S)z}Return a list of command-line arguments reproducing the current settings in sys.flags, sys.warnoptions and sys._xoptions.dBSvbq)debugdont_write_bytecodeno_siteverbose bytes_warningquietrrIz-Iz-Ez-sz-W _xoptions faulthandler tracemallocshowalloccount showrefcountutf8Tz%s=%sz-X)r]r^r_r`ra) rOitemsgetattrrArKrMisolatedignore_environment no_user_site warnoptionsextend)Z flag_opt_maprNflagoptrSZxoptionsrargrrr_args_from_interpreter_flagss:       rl)rcOsFt||2}y |j|dS|j|jYnXWdQRXdS)zRun command with arguments. Wait for command to complete or timeout, then return the returncode attribute. The arguments are the same as for the Popen constructor. Example: retcode = call(["ls", "-l"]) )rN)r!waitkill)r popenargskwargsprrrr$s  cOs6t||}|r2|jd}|dkr(|d}t||dS)aORun command with arguments. Wait for command to complete. If the exit code was zero then return, otherwise raise CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute. The arguments are the same as for the call function. Example: check_call(["ls", "-l"]) rNNr)r$getr )rorpretcoder rrrr%(s   cOsTd|krtdd|kr<|ddkr<|jddr4dnd|d<t|t|d d |jS) a(Run command with arguments and return its output. If the exit code was non-zero it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute and output in the output attribute. The arguments are the same as for the Popen constructor. Example: >>> check_output(["ls", "-l", "/dev/null"]) b'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n' The stdout argument is not allowed as it is used internally. To capture standard error in the result, use stderr=STDOUT. >>> check_output(["/bin/sh", "-c", ... "ls -l non_existent_file ; exit 0"], ... stderr=STDOUT) b'ls: non_existent_file: No such file or directory\n' There is an additional optional argument, "input", allowing you to pass a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it too will be used internally. Example: >>> check_output(["sed", "-e", "s/foo/bar/"], ... input=b"when in the course of fooman events\n") b'when in the course of barman events\n' If universal_newlines=True is passed, the "input" argument must be a string and the return value will be a string rather than bytes. rz3stdout argument not allowed, it will be overridden.inputNuniversal_newlinesFT)rrcheck)rrrr)r"r)rrorprrrr(;s c@s*eZdZdZd ddZddZddZdS) r+aEA process that has finished running. This is returned by run(). Attributes: args: The list or str args passed to run(). returncode: The exit code of the process, negative for signals. stdout: The standard output (None if not captured). stderr: The standard error (None if not captured). NcCs||_||_||_||_dS)N)rNr rr )rrNr rr rrrrrszCompletedProcess.__init__cCshdj|jdj|jg}|jdk r4|jdj|j|jdk rP|jdj|jdjt|jdj|S)Nz args={!r}zreturncode={!r}z stdout={!r}z stderr={!r}z{}({})z, ) formatrNr rrMr typerjoin)rrNrrrr;xs   zCompletedProcess.__repr__cCs |jrt|j|j|j|jdS)z6Raise CalledProcessError if the exit code is non-zero.N)r r rNrr )rrrrcheck_returncodesz!CompletedProcess.check_returncode)NN)rrrrrr;r|rrrrr+gs   F)rtrrxc Os|dk r d|krtdt|d<t||}y|j||d\}}WnVtk r||j|j\}}t|j|||dYn|j|jYnX|j}|r|rt ||j||dWdQRXt |j|||S)afRun command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them. If check is True and the exit code was non-zero, it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute, and output & stderr attributes if those streams were captured. If timeout is given, and the process takes too long, a TimeoutExpired exception will be raised. There is an optional argument "input", allowing you to pass a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it will be used internally. The other arguments are the same as for the Popen constructor. If universal_newlines=True is passed, the "input" argument must be a string and stdout/stderr in the returned object will be strings rather than bytes. Nstdinz/stdin and input arguments may not both be used.)r)r r ) rr"r! communicaterrnrNrmpollr r+) rtrrxrorpZprocessrr rsrrrr)s*    cCsg}d}x|D]}g}|r$|jdd|kp8d|kp8| }|rH|jdxj|D]b}|dkrf|j|qN|dkr|jdt|dg}|jdqN|r|j|g}|j|qNW|r|j||r|j||jdqWdj|S) a Translate a sequence of arguments into a command line string, using the same rules as the MS C runtime: 1) Arguments are delimited by white space, which is either a space or a tab. 2) A string surrounded by double quotation marks is interpreted as a single argument, regardless of white space contained within. A quoted string can be embedded in an argument. 3) A double quotation mark preceded by a backslash is interpreted as a literal double quotation mark. 4) Backslashes are interpreted literally, unless they immediately precede a double quotation mark. 5) If backslashes immediately precede a double quotation mark, every pair of backslashes is interpreted as a literal backslash. If the number of backslashes is odd, the last backslash escapes the next double quotation mark as described in rule 3. F  "\rGz\"rv)rMlenrhr{)seqresultZ needquoterkZbs_bufcrrr list2cmdlines4         rcCslyt|ddtd}d}Wn.tk rF}z|j}|j}WYdd}~XnX|dddkrd|dd}||fS) aReturn (exitcode, output) of executing cmd in a shell. Execute the string 'cmd' in a shell with 'check_output' and return a 2-tuple (status, output). The locale encoding is used to decode the output and process newlines. A trailing newline is stripped from the output. The exit status for the command can be interpreted according to the rules for the function 'wait'. Example: >>> import subprocess >>> subprocess.getstatusoutput('ls /bin/ls') (0, '/bin/ls') >>> subprocess.getstatusoutput('cat /bin/junk') (1, 'cat: /bin/junk: No such file or directory') >>> subprocess.getstatusoutput('/bin/junk') (127, 'sh: /bin/junk: not found') >>> subprocess.getstatusoutput('/bin/kill $$') (-15, '') T)shellrur rNrF r)r(r#r r r )r dataZexitcodeZexrrrr&s cCs t|dS)a%Return output (stdout or stderr) of executing cmd in a shell. Like getstatusoutput(), except the exit status is ignored and the return value is a string containing the command's output. Example: >>> import subprocess >>> subprocess.getoutput('ls /bin/ls') '/bin/ls' rF)r&)r rrrr'"s c@seZdZdZdZd?dddddeddddddddffddddd Zd d Zd d ZddZ e j e j fddZddZddZd@ddZddZddZddZerddZd d!Zd"d#Zdejejejfd$d%ZdAd&d'Zd(d)Zd*d+Z d,d-Z!d.d/Z"e"Z#nd0dZd1d#Ze$j%e$j&e$j'e$j(e$j)e$j*fd2d3Z+de$j,e$j-e.j/fd4d%Zd5d6Z0dBd7d'Zd8d+Z d9d:Z1d;d-Z!dZ#dS)Cr!a Execute a child program in a new process. For a complete description of the arguments see the Python documentation. Arguments: args: A string, or a sequence of program arguments. bufsize: supplied as the buffering argument to the open() function when creating the stdin/stdout/stderr pipe file objects executable: A replacement program to execute. stdin, stdout and stderr: These specify the executed programs' standard input, standard output and standard error file handles, respectively. preexec_fn: (POSIX only) An object to be called in the child process just before the child is executed. close_fds: Controls closing or inheriting of file descriptors. shell: If true, the command will be executed through the shell. cwd: Sets the current directory before the child is executed. env: Defines the environment variables for the new process. universal_newlines: If true, use universal line endings for file objects stdin, stdout and stderr. startupinfo and creationflags (Windows only) restore_signals (POSIX only) start_new_session (POSIX only) pass_fds (POSIX only) encoding and errors: Text mode encoding and error handling to use for file objects stdin, stdout and stderr. Attributes: stdin, stdout, stderr, pid, returncode FrFNrT)encodingerrorscCsrttj|_d|_d|_|dkr(d}t|ts:tdt r|dk rNt d|dk pd|dk pd|dk }|t kr~|rxd}qd}q|r|rt dnF|t krd}|r| rt j dtd}| dk rt d |d krt d ||_d|_d|_d|_d|_d|_| |_||_||_|j|||\}}}}}}t rz|dkrFtj|jd }|dkr`tj|jd }|dkrztj|jd }|p|p| }d|_y|dkrtj|d ||_|rtj|jd|dk||d |_|dkrtj|d||_|rtj|j||d|_|dkr6tj|d||_|r6tj|j||d|_|j |||||| | | || ||||||||WnxDt!d|j|j|jfD]*}y |j"Wnt#k rYnXqW|jsfg}|t$kr|j%||t$kr|j%||t$kr|j%|t&|dr|j%|j'xP|D]H}y*t r)_child_createdr rResourceWarningr@r?rM)rZ_maxsizeZ_warnrrrr= s    z Popen.__del__cCs"t|dstjtjtj|_|jS)Nr)rrrdevnullO_RDWRr)rrrr _get_devnulls zPopen._get_devnullcCs|rZy|jj|WnDtk r(Yn2tk rX}z|jtjkrFnWYdd}~XnXy|jjWnDtk r|Yn2tk r}z|jtjkrnWYdd}~XnXdS)N)r}writeBrokenPipeErrorrerrnoZEINVALr)rrtexcrrr _stdin_writes"  zPopen._stdin_writec Cs|jr|rtd|dkr|j r|j|j|jgjddkrd}d}|jrV|j|n6|jrr|jj}|jjn|jr|jj}|jj|j nJ|dk rt |}nd}z|j |||\}}Wdd|_X|j |j |d}||fS)a4Interact with process: Send data to stdin. Read data from stdout and stderr, until end-of-file is reached. Wait for process to terminate. The optional "input" argument should be data to be sent to the child process (if self.universal_newlines is True, this should be a string; if it is False, "input" should be bytes), or None, if no data should be sent to the child. communicate() returns a tuple (stdout, stderr). These will be bytes or, if self.universal_newlines was True, a string. z.Cannot send input after starting communicationNrGT)r) rrr}rr countrreadrrm_time _communicate_remaining_time)rrtrrr endtimestsrrrr~7s.        zPopen.communicatecCs|jS)zSCheck if child process has terminated. Set and return returncode attribute.)r@)rrrrrhsz Popen.pollcCs|dkr dS|tSdS)z5Convenience for _communicate when computing timeouts.N)r)rrrrrrnszPopen._remaining_timecCs&|dkr dSt|kr"t|j|dS)z2Convenience for checking if a timeout has expired.N)rrrN)rr orig_timeoutrrr_check_timeoutvs zPopen._check_timeoutc Cs|dkr|dkr|dkrd Sd \}}d\}}d\}} |dkrttjtj}|dkrrtjdd\}} t|}tj| nj|tkrtjdd\}}t|t|}}n>|tkrtj |j }n&t |t rtj |}ntj |j }|j|}|dkr,tjtj}|dkrtjdd\} }t|}tj| nn|tkrZtjdd\}}t|t|}}n@|tkrttj |j }n&t |t rtj |}ntj |j }|j|}|dkrtjtj} | dkrftjdd\} } t| } tj| n~|tkrtjdd\}} t|t| }} nP|tkr&|} n@|tkr@tj |j } n&t |t rXtj |} ntj |j } |j| } |||||| fS)z|Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite NrFrrrrrrr)rrrrrrrr)rrrr)rrrr)rr)r<Z GetStdHandler.Z CreatePiper4r6r"r*rZ get_osfhandlerrr8fileno_make_inheritabler/r0r#) rr}rr rrrrrr_rrrrsn                        zPopen._get_handlescCs&tjtj|tjddtj}t|S)z2Return a duplicate of handle, which is inheritablerrF)r<ZDuplicateHandleZGetCurrentProcessZDUPLICATE_SAME_ACCESSr4)rZhandlehrrrrs  zPopen._make_inheritablecCs<t|tst|}|dkr t}d| ||fkrP|jtjO_| |_||_||_ | r|jtj O_tj |_ t jjdd}dj||}z>tj||ddt| | ||dk rt j|nd| \}}}}Wd| d kr| j|d kr|j|d kr|jt|drt j|jd|_Xd|_t||_||_tj|dS) z$Execute program (MS Windows version)NrFZCOMSPECzcmd.exez {} /c "{}"rTrrrr)rstrrrrr<r2rrrr3r1rrenvironrrryZ CreateProcessr8fspathr7rrrrrr4_handlerr6)rrNrrrrrrrrrrrrrrrZunused_restore_signalsZunused_start_new_sessionZcomspecZhpZhtrtidrrrrsF      zPopen._execute_childcCs,|jdkr&||jd|kr&||j|_|jS)zCheck if child process has terminated. Returns returncode attribute. This method is called by __del__, so it can only refer to objects in its local scope. Nr)r r)rr>Z_WaitForSingleObjectZ_WAIT_OBJECT_0Z_GetExitCodeProcessrrrr@s  zPopen._internal_pollcCs|dk r"tjdtdd|j|}|dkr2tj}n t|d}|jdkrztj|j |}|tj krlt |j |tj |j |_|jS)zOWait for child process to terminate. Returns returncode attribute.Nz0'endtime' argument is deprecated; use 'timeout'.rG) stackleveli)rrDeprecationWarningrr<ZINFINITEr8r WaitForSingleObjectrZ WAIT_TIMEOUTrrNGetExitCodeProcess)rrrZtimeout_millisrrrrrm$s      z Popen.waitcCs|j|j|jdS)N)rMrr)rZfhbufferrrr _readerthread:szPopen._readerthreadcCs`|jrDt|d rDg|_tj|j|j|jfd|_d|j_|jj|j rt|d rg|_ tj|j|j |j fd|_ d|j _|j j|j r|j ||jdk r|jj|j||jjrt|j||j dk r|j j|j||j jrt|j|d}d}|jr|j}|jj|j r4|j }|j j|dk rF|d}|dk rX|d}||fS)N _stdout_buff)targetrNT _stderr_buffr)rrrrZThreadrZ stdout_threadZdaemonstartr rZ stderr_threadr}rr{rZis_aliverrNr)rrtrrrr rrrr?sF             zPopen._communicatecCsl|jdk rdS|tjkr"|jnF|tjkr>tj|jtjn*|tjkrZtj|jtjnt dj |dS)zSend a signal to the process.NzUnsupported signal: {}) r rSIGTERM terminateZ CTRL_C_EVENTrrnrZCTRL_BREAK_EVENTrry)rsigrrr send_signalss     zPopen.send_signalc CsX|jdk rdSytj|jdWn2tk rRtj|j}|tjkrH||_YnXdS)zTerminates the process.NrF)r r<ZTerminateProcessrPermissionErrorrZ STILL_ACTIVE)rZrcrrrrs   zPopen.terminatec Cs.d\}}d\}}d \}} |dkr"n@|tkr8tj\}}n*|tkrJ|j}nt|trZ|}n|j}|dkrln@|tkrtj\}}n*|tkr|j}nt|tr|}n|j}|dkrnh|tkrtj\}} nR|tkr|d kr|} n t j j} n.|tkr|j} nt|tr|} n|j} |||||| fS) z|Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite rFNrr)rrrr)rrrr)rrr) r"rpiper*rrr8rr#rA __stdout__) rr}rr rrrrrrrrrrsJ         c)"st|ttfr|g}nt|}| r:ddg|}r:|d<dkrJ|d}tj\}}g}x |dkr~|j|tj|}q`Wx|D]}tj|qWzz|dk rg}xL|j D]:\}}tj |}d|krt d|j|dtj |qWnd}tj tj j rf}ntfdd tj|D}t|}|j|tj|||tttt|||| | | |||||||||_d |_Wdtj|Xt|d d}| dkr| dkr| |krtj| |dkr| dkr||krtj||dkr|dkr||krtj||dk r.tj|d |_t}x2tj|d }||7}| sft|d krsz'Popen._execute_child..TrrFiP:rGsSubprocessError0z#Bad exception data from child: {!r}asciiZnoexecrvz: rrrrrr)/rrbyteslistrrrMduprrbrrrdirnametuple get_exec_pathsetadd_posixsubprocessZ fork_execsortedmapr8rrrcr bytearrayrrwaitpid_handle_exitstatusrArBr ChildProcessErrorsplitrrybuiltinsr issubclassrstrerrorrENOENTrepr))rrNrrrrrrrrrrrrrrrrrZorig_executableZ errpipe_readZ errpipe_writeZlow_fds_to_closeZlow_fdZenv_listkrSZexecutable_listZ fds_to_keepZ devnull_fdZ errpipe_datapartrrZexception_nameZ hex_errnoZerr_msgZchild_exception_typeZ errno_numZchild_exec_never_calledZ err_filenamer)rrrs                                cCsL||r|| |_n2||r*|||_n||r@|| |_ntddS)z:All callers to this function MUST hold self._waitpid_lock.zUnknown child exit status!N)r r)rrZ _WIFSIGNALEDZ _WTERMSIGZ _WIFEXITEDZ _WEXITSTATUSZ _WIFSTOPPEDZ _WSTOPSIGrrrr Xs zPopen._handle_exitstatuscCs|jdkr|jjdsdSzy8|jdk r.|jS||j|\}}||jkrR|j|WnBtk r}z&|dk rv||_n|j|krd|_WYdd}~XnXWd|jjX|jS)zCheck if child process has terminated. Returns returncode attribute. This method is called by __del__, so it cannot reference anything outside of the local scope (nor can any methods it calls). NFr)r racquirerr rrrelease)rr>Z_waitpidZ_WNOHANGZ_ECHILDrrerrrr@js      c Cs>ytj|j|\}}Wntk r4|j}d}YnX||fS)z:All callers to this function MUST hold self._waitpid_lock.r)rr rr )rZ wait_flagsrrrrr _try_waits  zPopen._try_waitc CsV|jdk r|jS|dk r(tjdtdd|dk s8|dk r^|dkrLt|}n|dkr^|j|}|dk rd}x|jjdrz6|jdk rP|jt j \}}||j kr|j |PWd|jj X|j|}|dkrt|j|t|d|d}tj|qlWnVxT|jdkrN|j8|jdk rP|jd\}}||j krB|j |WdQRXqW|jS) zOWait for child process to terminate. Returns returncode attribute.Nz0'endtime' argument is deprecated; use 'timeout'.rG)rgMb@?Frg?)r rrrrrrrrrWNOHANGrr rrrNmintimeZsleep)rrrZdelayrrZ remainingrrrrmsJ            c#Cs|jrZ|j rZy|jjWntk r0YnX|sZy|jjWntk rXYnXd}d}|jsi|_|jrg|j|j<|jrg|j|j<|jr|j|j}|jr|j|j}|j||j rt |j }t }|jr|r|j |jt j|jr |j |jt j|jr$|j |jt jxJ|jrp|j|}|dk r\|dkr\t|j||j|} |j||x| D]\} } | j|jkr||j|jt} y|jtj| j| 7_Wn,tk r|j| j| jjYn*X|jt|j krf|j| j| jjnP| j|j|jfkrxtj| jd} | sT|j| j| jj|j| jj| qxWq(WWdQRX|j |j|d|dk rdj!|}|dk rdj!|}|j"s|j#s|j$r|dk r|j%||jj"|jj#}|dk r|j%||jj"|jj#}||fS)Nri)rrw)&r}rflushrrZ_fileobj2outputrr _save_inputr memoryview_PopenSelectorregister selectorsZ EVENT_WRITEZ EVENT_READZget_maprrrNselectrZfileobj _input_offset _PIPE_BUFrrrZ unregisterrrrMrmr{rrrur)rrtrrrr Z input_viewZselectorrZreadykeyZeventschunkrrrrrs                 (        cCsR|jrN|jdkrNd|_||_|dk rN|js6|js6|jrN|jj|jj|jj|_dS)Nr)r}rr#rrruencode)rrtrrrr/s zPopen._save_inputcCs|jdkrtj|j|dS)zSend a signal to the process.N)r rrnr)rrrrrr<s cCs|jtjdS)z/Terminate the process with SIGTERM N)rrr)rrrrrBscCs|jtjdS)z*Kill the process with SIGKILL N)rrSIGKILL)rrrrrnGsz Popen.killr)NN)NN)NN)2rrrrrrrrrrrArBrrr=rrr~rrrrrrrr<rZ WAIT_OBJECT_0rr@rmrrrrrnr WIFSIGNALEDWTERMSIG WIFEXITED WEXITSTATUS WIFSTOPPEDWSTOPSIGr r rrZECHILDrrrrrrr!2sd+  1H @ 46 " 4a r)>rrAplatformrrrrrrrrrr Exceptionrr rrrr<rrr"r! ImportErrorZdummy_threadingrcr$rr rZSelectSelector__all__r,r-r.r/r0r1r2r3rhr8r4r?rEr"r#r*rOrlr$r%r(objectr+r)rr&r'rr!rrrr*sr  %      (  .,!2I types.cpython-36.opt-2.pyc000064400000015574152462730460011323 0ustar003 \" @sddlZddZeeZeddZeejZeejZeej Z ddZ ee Z dd Z e Z ee Ze jd d ZeZeeZGd d d ZeejZeeZegjZeeZyeWn8ek rejdZeeZeejZdZ[YnXeejZ eej!Z"[[[ [[ fddfddZ#fdfddZ$ddZ%GdddZ&ddl'Z(ddl)j*Z+GdddZ,ddZ-dde.DZ/dS)NcCsdS)Nrrr/usr/lib64/python3.6/types.py_f srcCsdS)Nrrrrr srccs dVdS)Nrrrrr_gsrcsdS)Nrrrrr_csrcCs dVdS)Nrrrrr_agsr c@seZdZddZdS)_CcCsdS)Nr)selfrrr_m!sz_C._mN)__name__ __module__ __qualname__r rrrrr sr cCs2t|||\}}}|dk r"||||||f|S)N) prepare_class)namebaseskwds exec_bodymetansrrr new_class9srcCs~|dkri}nt|}d|kr*|jd}n|r||_||_||_|p|j|_|dk|_tt|dd|_dS)N__isabstractmethod__F)fgetfsetfdel__doc__ overwrite_docboolgetattrr')r r(r)r*docrrr__init__}s   zDynamicClassAttribute.__init__cCs6|dkr|jr|Stn|jdkr,td|j|S)Nzunreadable attribute)r'AttributeErrorr()r instance ownerclassrrr__get__s zDynamicClassAttribute.__get__cCs"|jdkrtd|j||dS)Nzcan't set attribute)r)r1)r r2valuerrr__set__s zDynamicClassAttribute.__set__cCs |jdkrtd|j|dS)Nzcan't delete attribute)r*r1)r r2rrr __delete__s z DynamicClassAttribute.__delete__cCs8|jr |jnd}t|||j|j|p(|j}|j|_|S)N)r,r+rr)r*)r r(fdocresultrrrgetterszDynamicClassAttribute.gettercCs$t||j||j|j}|j|_|S)N)rr(r*r+r,)r r)r9rrrsetterszDynamicClassAttribute.settercCs$t||j|j||j}|j|_|S)N)rr(r)r+r,)r r*r9rrrdeleterszDynamicClassAttribute.deleter)NNNN)N) r rrr0r4r6r7r:r;r<rrrrr&qs r&c@seZdZddZddZddZddZed d Zed d Z ed dZ eddZ eZ e Z e Ze ZddZddZeZdS)_GeneratorWrappercCs2||_|jtk|_t|dd|_t|dd|_dS)Nr r)_GeneratorWrapper__wrapped __class__ GeneratorType_GeneratorWrapper__isgenr.r r)r genrrrr0s z_GeneratorWrapper.__init__cCs |jj|S)N)r>send)r valrrrrCsz_GeneratorWrapper.sendcGs|jj|f|S)N)r>throw)r tprestrrrrEsz_GeneratorWrapper.throwcCs |jjS)N)r>close)r rrrrHsz_GeneratorWrapper.closecCs|jjS)N)r>gi_code)r rrrrIsz_GeneratorWrapper.gi_codecCs|jjS)N)r>gi_frame)r rrrrJsz_GeneratorWrapper.gi_framecCs|jjS)N)r> gi_running)r rrrrKsz_GeneratorWrapper.gi_runningcCs|jjS)N)r> gi_yieldfrom)r rrrrLsz_GeneratorWrapper.gi_yieldfromcCs t|jS)N)nextr>)r rrr__next__sz_GeneratorWrapper.__next__cCs|jr |jS|S)N)rAr>)r rrr__iter__sz_GeneratorWrapper.__iter__N)r rrr0rCrErHpropertyrIrJrKrLcr_codecr_frame cr_runningcr_awaitrNrO __await__rrrrr=s    r=cststdjtkrtddjtkrjj}|d@r@S|d@rj}t|j|j |j |j |jdB|j |j |j|j|j|j|j|j|j|j_Stjfdd}|S)Nz$types.coroutine() expects a callable__code__i csT||}|jtks*|jtkr.|jjd@r.|St|tjrPt|tj rPt |S|S)NrX) r? CoroutineTyper@rIco_flagsr_collections_abc Generator Coroutiner=)argskwargscoro)funcrrwrappeds   zcoroutine..wrapped)callabler"r? FunctionTyper.CodeTyperVrZ co_argcountco_kwonlyargcount co_nlocals co_stacksizeco_code co_constsco_names co_varnames co_filenameco_nameco_firstlineno co_lnotab co_freevars co_cellvars _functoolswraps)rarZcorbr)rar coroutines(   rwcCs g|]}|dddkr|qS)Nr_r).0nrrr sr{)0sysrrrd LambdaTyperVre__dict__MappingProxyTypeimplementationSimpleNamespacerr@rrYrHr AsyncGeneratorTyper r MethodTypelenBuiltinFunctionTypeappendBuiltinMethodType ModuleTyper"exc_infotb TracebackTypetb_frame FrameTypeGetSetDescriptorType __globals__MemberDescriptorTyperrrr& functoolsrtcollections.abcabcr[r=rwglobals__all__rrrrsP             : %7zipapp.cpython-36.pyc000064400000012640152462730460010511 0ustar003 \@sddlZddlZddlZddlZddlZddlZddlZdddgZdZej j drXdZ nej Z Gddde Zejd d Zd d Zdd dZdddZddZdddZedkredS)N ZipAppErrorcreate_archiveget_interpreterz8# -*- coding: utf-8 -*- import {module} {module}.{fn}() winzutf-8c@s eZdZdS)rN)__name__ __module__ __qualname__r r /usr/lib64/python3.6/zipapp.pyr!sc csFt|tjrt|}t|tr|sz!create_archive...css|]}|jVqdS)N)r*)r+r,r r r r-}szInvalid entry point: )modulefnz.pyzrrw*zutf-8)hasattrr r is_filer(existsr partitionallsplit MAIN_TEMPLATEformatZ with_suffixrrzipfileZZipFileZrglobrZ relative_torZwritestrrr"r#r$r%)sourcetargetrmainZsource_is_fileZhas_mainZmain_pymodsepr0Zmod_okZfn_okfdzrootZchildZarcnamer r r rNsP           &c Cs:t|d&}|jddkr,|jjjtSWdQRXdS)Nrrs#!)rrrstripdecoder)rrr r r rs cCs ddl}|j}|jddddd|jdddd d|jd d dd d|jd dddd|jddd|j|}|jrtjj|jst dt |j}t dj |pdt jdtjj|jr|jdkstjj|jrtjj|j|jrt d|jrt dt|j|j|j|jddS)zRun the zipapp command line interface. The ARGS parameter lets you specify the argument list directly. Omitting ARGS (or setting it to None) works as for argparse, using sys.argv[1:] as the argument list. rNz--outputz-ozAThe name of the output archive. Required if SOURCE is an archive.)defaulthelpz--pythonz-pzEThe name of the Python interpreter to use (default: no shebang line).z--mainz-mzLThe main function of the application (default: use an existing __main__.py).z--infoF store_truez)Display the interpreter from the archive.)rFactionrGr<z'Source directory (or existing archive).)rGz%Can only get info for an archive filezInterpreter: {}zz-In-place editing of archives is not supportedz,Cannot change the main function when copying)rr>)argparseArgumentParser add_argument parse_argsinfor!pathisfiler< SystemExitrprintr:sysexitoutputr5samefiler>rpython)argsrJparserrr r r r>s6        r>__main__)N)NNN)N) contextlibr!r r r#rSr;__all__r9platform startswithrgetfilesystemencoding ValueErrorrcontextmanagerrrr(rrr>rr r r r s(     G -mailbox.cpython-36.opt-1.pyc000064400000174270152462730460011610 0ustar003 \ 3@sRdZddlZddlZddlZddlZddlZddlZddlZddlZddl Zddl Zddl Z ddl Z y ddl Z Wnek rdZ YnXddddddd d d d d ddddddgZejjdZGdddZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdd d ejjZGd d d eZGd!d"d"eZGd#d d eZGd$d d eZGd%d d eZ Gd&ddeZ!Gd'd(d(Z"Gd)d*d*e"Z#d=d,d-Z$d.d/Z%d0d1Z&d2d3Z'd4d5Z(d6d7Z)Gd8dde*Z+Gd9dde+Z,Gd:dde+Z-Gd;dde+Z.GdzDRead/write support for Maildir, mbox, MH, Babyl, and MMDF mailboxes.NMailboxMaildirmboxMHBabylMMDFMessageMaildirMessage mboxMessage MHMessage BabylMessage MMDFMessageErrorNoSuchMailboxError NotEmptyErrorExternalClashError FormatErrorasciic@seZdZdZdCddZddZdd Zd d Zd d ZddZ dDddZ ddZ ddZ ddZ ddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/ZdEd0d1Zd2d3ZdFd4d5Zd6d7Zd8d9Zd:d;Zdd?Z!d@Z"dGdAdBZ#dS)Hrz*A group of messages in a particular place.NTcCs tjjtjj||_||_dS)zInitialize a Mailbox instance.N)ospathabspath expanduser_path_factory)selfrfactorycreater/usr/lib64/python3.6/mailbox.py__init__$szMailbox.__init__cCs tddS)z$Add message and return assigned key.z&Method must be implemented by subclassN)NotImplementedError)rmessagerrradd)sz Mailbox.addcCs tddS)z=Remove the keyed message; raise KeyError if it doesn't exist.z&Method must be implemented by subclassN)r )rkeyrrrremove-szMailbox.removecCs|j|dS)N)r$)rr#rrr __delitem__1szMailbox.__delitem__c Cs(y|j|Wntk r"YnXdS)z'If the keyed message exists, remove it.N)r$KeyError)rr#rrrdiscard4szMailbox.discardcCs tddS)z>Replace the keyed message; raise KeyError if it doesn't exist.z&Method must be implemented by subclassN)r )rr#r!rrr __setitem__;szMailbox.__setitem__c Cs$y |j|Stk r|SXdS)z9Return the keyed message, or default if it doesn't exist.N) __getitem__r&)rr#defaultrrrget?s z Mailbox.getc Cs6|js|j|Stj|j| }|j|SQRXdS)z=Return the keyed message; raise KeyError if it doesn't exist.N)r get_message contextlibclosingget_file)rr#filerrrr)Fs zMailbox.__getitem__cCs tddS)z4Return a Message representation or raise a KeyError.z&Method must be implemented by subclassN)r )rr#rrrr,NszMailbox.get_messagecCstj|j|jS)zReturn a string representation or raise a KeyError. Uses email.message.Message to create a 7bit clean string representation of the message.)emailmessage_from_bytes get_bytes as_string)rr#rrr get_stringRszMailbox.get_stringcCs tddS)z8Return a byte string representation or raise a KeyError.z&Method must be implemented by subclassN)r )rr#rrrr3YszMailbox.get_bytescCs tddS)z6Return a file-like representation or raise a KeyError.z&Method must be implemented by subclassN)r )rr#rrrr/]szMailbox.get_filecCs tddS)zReturn an iterator over keys.z&Method must be implemented by subclassN)r )rrrriterkeysaszMailbox.iterkeyscCs t|jS)zReturn a list of keys.)listr6)rrrrkeysesz Mailbox.keysc cs@x:|jD].}y ||}Wntk r0w YnX|Vq WdS)z%Return an iterator over all messages.N)r6r&)rr#valuerrr itervaluesis  zMailbox.itervaluescCs|jS)N)r:)rrrr__iter__rszMailbox.__iter__cCs t|jS)z,Return a list of messages. Memory intensive.)r7r:)rrrrvaluesuszMailbox.valuesc csDx>|jD]2}y ||}Wntk r0w YnX||fVq WdS)z.Return an iterator over (key, message) tuples.N)r6r&)rr#r9rrr iteritemsys  zMailbox.iteritemscCs t|jS)z9Return a list of (key, message) tuples. Memory intensive.)r7r=)rrrritemssz Mailbox.itemscCs tddS)z9Return True if the keyed message exists, False otherwise.z&Method must be implemented by subclassN)r )rr#rrr __contains__szMailbox.__contains__cCs tddS)z*Return a count of messages in the mailbox.z&Method must be implemented by subclassN)r )rrrr__len__szMailbox.__len__cCs x|jD]}|j|q WdS)zDelete all messages.N)r8r')rr#rrrclearsz Mailbox.clearc Cs0y ||}Wntk r |SX|j||S)z3Delete the keyed message and return it, or default.)r&r')rr#r*resultrrrpops   z Mailbox.popcCs*x$|jD]}||j|fSWtddS)z6Delete an arbitrary (key, message) pair and return it.zNo messages in mailboxN)r6rCr&)rr#rrrpopitemszMailbox.popitemc Csxt|dr|j}nt|dr(|j}n|}d}x6|D].\}}y |||<Wq6tk rbd}Yq6Xq6W|rttddS)z4Change the messages that correspond to certain keys.r=r>FTzNo message with key(s)N)hasattrr=r>r&)rargsourceZbad_keyr#r!rrrupdates     zMailbox.updatecCs tddS)z&Write any pending changes to the disk.z&Method must be implemented by subclassN)r )rrrrflushsz Mailbox.flushcCs tddS)zLock the mailbox.z&Method must be implemented by subclassN)r )rrrrlocksz Mailbox.lockcCs tddS)z#Unlock the mailbox if it is locked.z&Method must be implemented by subclassN)r )rrrrunlockszMailbox.unlockcCs tddS)zFlush and close the mailbox.z&Method must be implemented by subclassN)r )rrrrclosesz Mailbox.closec Cs,y |jdStk r&tdYnXdS)Nrz?String input must be ASCII-only; use bytes or a Message instead)encode UnicodeError ValueError)rr!rrr_string_to_bytess zMailbox._string_to_bytesFc Cst|tjjrxtj}tjj||d}|j||j d|j }|j dt }|j ||jrt|jt  rt|j t nt|tttjfrt|tjrtjdtd|j}t|tr|j|}|r|j dd}|j dt }|j ||jo|jt  r|j t nt|drt|dr4tjd td|j}d }x|j}|jd r`|d dd}n|jd r||d dd}|sP|r|jdrd|dd }|j dt }|j ||}q:W|jr|r|jt  r|j t ntdt|d S)z%Dump message contents to target file.r z8Use of StringIO input is deprecated, use BytesIO insteads From s >From readbufferzDUse of text mode files is deprecated, use a binary mode file insteadNs  sFrom s>From zInvalid message type: %s) isinstancer1r!rioBytesIO generatorBytesGeneratorflattenseekrSreplacelinesepwrite_append_newlineendswithstrbytesStringIOwarningswarnDeprecationWarninggetvaluerPrErTreadline startswith TypeErrortype) rr!targetZ mangle_from_rTgendataZlastlinelinerrr _dump_messagesZ                   zMailbox._dump_message)NT)N)N)N)F)$__name__ __module__ __qualname____doc__rr"r$r%r'r(r+r)r,r5r3r/r6r8r:r;r<r=r>r?r@rArCrDrHrIrJrKrLrPrervrrrrr!sB       c@seZdZdZdZd6ddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-Zd.d/Zd0d1Zd2d3Zd4d5ZdS)7rzA qmail-style Maildir mailbox.:NTcCstj||||tjj|jdtjj|jdtjj|jdd|_tjj|js|rtj|jdx*|jj D]}tj|dqnWn t |ji|_ ddd|_ d|_ d|_d S) zInitialize a Maildir instance.tmpnewcur)r|r}r~ir)r~r}g?N)rrrrjoinr_pathsexistsmkdirr<r_toc _toc_mtimes _last_read _skewfactor)rdirnamerrrrrrr s  zMaildir.__init__cCs~|j}y|j||Wn*tk rB|jtj|jYnXt|t|t r||j }|j |j }||j krd}nd}d}tj j|jj|j d}tj j|j|||}t|t rtj|jtj j|j|jfyLytj|j|Wn(ttfk rtj|j|YnXtj|jWnNtk rx}z0tj|j|jtjkrftd|nWYdd}~XnX|S)z$Add message and return assigned key.r}rz$Name clash with existing message: %sN) _create_tmprv BaseExceptionrLrr$name _sync_closer[r get_subdircolonget_inforbasenamesplitrrutimegetatimeget_datelinkAttributeErrorPermissionErrorrenameOSErrorerrnoZEEXISTr)rr!Ztmp_filesubdirsuffixuniqdesterrrr"!sB      z Maildir.addcCs tjtjj|j|j|dS)z=Remove the keyed message; raise KeyError if it doesn't exist.N)rr$rrr_lookup)rr#rrrr$KszMaildir.removec Cs,y|j|Wnttfk r&YnXdS)z'If the keyed message exists, remove it.N)r$r&FileNotFoundError)rr#rrrr'OszMaildir.discardc Cs|j|}|j|}|j|}t|tr.|}n|}tjj|}|j|kr`|j|j|jd}nd}|j |tjj |j |} tjj |j |||} t|trtj | tjj | |jftj| | dS)z>Replace the keyed message; raise KeyError if it doesn't exist.rWrNrZ)rr"r[r rrrrrr'rrrrrr) rr#r!Z old_subpathZtemp_keyZ temp_subpathZdominant_subpathrrZtmp_pathnew_pathrrrr(Ws"        zMaildir.__setitem__c Cs|j|}ttjj|j|d }|jr4|j|}nt|}WdQRXtjj|\}}|j ||j |kr|j |j|j d|j tjj tjj|j||S)z4Return a Message representation or raise a KeyError.rbNrWrZ)ropenrrrrrr r set_subdirrset_infoset_dategetmtime)rr#Zsubpathfmsgrrrrrr,rs    zMaildir.get_messagec Cs8ttjj|j|j|d}|jjtdSQRXdS)z2Return a bytes representation or raise a KeyError.rrQN) rrrrrrrSrbrc)rr#rrrrr3szMaildir.get_bytescCs$ttjj|j|j|d}t|S)z6Return a file-like representation or raise a KeyError.r)rrrrrr _ProxyFile)rr#rrrrr/szMaildir.get_filec csH|jx:|jD]0}y|j|Wntk r8wYnX|VqWdS)zReturn an iterator over keys.N)_refreshrrr&)rr#rrrr6s zMaildir.iterkeyscCs|j||jkS)z9Return True if the keyed message exists, False otherwise.)rr)rr#rrrr?szMaildir.__contains__cCs|jt|jS)z*Return a count of messages in the mailbox.)rlenr)rrrrr@szMaildir.__len__cCsdS)z"Write any pending changes to disk.Nr)rrrrrIsz Maildir.flushcCsdS)zLock the mailbox.Nr)rrrrrJsz Maildir.lockcCsdS)z#Unlock the mailbox if it is locked.Nr)rrrrrKszMaildir.unlockcCsdS)zFlush and close the mailbox.Nr)rrrrrLsz Maildir.closecCs`g}xVtj|jD]F}t|dkr|ddkrtjjtjj|j|r|j|ddqW|S)zReturn a list of folder names.rWr.N)rlistdirrrrisdirrappend)rrBentryrrr list_folderss zMaildir.list_folderscCs ttjj|jd||jddS)z/Return a Maildir instance for the named folder.rF)rr)rrrrrr)rfolderrrr get_folderszMaildir.get_foldercCs\tjj|jd|}t||jd}tjj|d}tjj|sXtjtj|tj tj Bd|S)z>Create a folder and return a Maildir instance representing it.r)rZ maildirfolderi) rrrrrrrrLrO_CREATO_WRONLY)rrrrBZmaildirfolder_pathrrr add_folders zMaildir.add_foldercCs,tjj|jd|}xTtjtjj|dtjtjj|dD](}t|dksZ|ddkr>td|q>WxPtj|D]B}|dkrv|dkrv|dkrvtjjtjj||rvtd||fqvWx`tj|d d D]N\}}}x |D]}tj tjj||qWx |D]}tj tjj||qWqWtj |d S) z-Delete the named folder, which must be empty.rr}r~rWrzFolder contains message(s): %sr|z%Folder contains subdirectory '%s': %sF)topdownN) rrrrrrrrwalkr$rmdir)rrrrrootdirsfilesrrr remove_folders   zMaildir.remove_foldercCs\tj}xNtjtjj|jdD]4}tjj|jd|}|tjj|dkr tj|q WdS)zDelete old files in "tmp".r|i@N)timerrrrrrr$)rnowrrrrrcleans z Maildir.cleanrWcCstj}tj}d|kr$|jdd}d|kr8|jdd}dt|t|ddtjtj|f}tj j |j d|}ytj |Wn@t k rtjd7_yt|Stk rYnXYnXtd |d S) z=Create a file in the tmp subdirectory and open and return it./z\057r{z\072z%s.M%sP%sQ%s.%srWg.Ar|z&Name clash prevented file creation: %sN)rsocket gethostnamerbintrgetpidr_countrrrstatr_create_carefullyFileExistsErrorr)rrZhostnamerrrrrrs&    zMaildir._create_tmpcCstj|jd|jkrbd}x<|jD]2}tjj|j|}||j|krLd}||j|<q$W|sbdSi|_xl|jD]b}|j|}xRtj |D]D}tjj ||}tjj |rq|j |j d}tjj |||j|<qWqpWtj|_dS)z!Update table of contents mapping.rUFTNr)rrrrrrrrrrrrrr)rZrefreshrmtimerrprrrrrs&    zMaildir._refreshcCszy,tjjtjj|j|j|r*|j|SWntk r@YnX|jy |j|Stk rttd|YnXdS)z=Use TOC to return subpath for given key, or raise a KeyError.zNo message with key: %sN)rrrrrrr&r)rr#rrrr#s zMaildir._lookupc CsVt|ds|j|_xReplace the keyed message; raise KeyError if it doesn't exist.TN)rrrr)rr#r!rrrr(hs z_singlefileMailbox.__setitem__ccs|j|jjEdHdS)zReturn an iterator over keys.N)rrr8)rrrrr6nsz_singlefileMailbox.iterkeyscCs|j||jkS)z9Return True if the keyed message exists, False otherwise.)rr)rr#rrrr?ssz_singlefileMailbox.__contains__cCs|jt|jS)z*Return a count of messages in the mailbox.)rrr)rrrrr@xsz_singlefileMailbox.__len__cCs|jst|jd|_dS)zLock the mailbox.TN)r _lock_filer)rrrrrJ}s z_singlefileMailbox.lockcCs|jrt|jd|_dS)z#Unlock the mailbox if it is locked.FN)r _unlock_filer)rrrrrKs z_singlefileMailbox.unlockc Cs|js |jrt|jd|_dS|jjdd|jj}||jkrTtd|j|ft|j }yi}|j |xt |j j D]|}|j |\}}|jj||j||j}x0|jjtd||jj}|sP|j|qW||jf||<|j|q~W|j|_Wn"|jtj|jYnXt||jjtj|j j} tj|j| ytj|j|j Wn2tk rtj|j tj|j|j YnXt|j d|_||_ d|_d|_|jrt|jdddS) z"Write any pending changes to disk.FNrrUz4Size of mailbox file changed (expected %i, found %i)izrb+)dotlock) rr _sync_flushrratellrr_create_temporaryr_pre_mailbox_hooksortedrr8_pre_message_hookrSminrd_post_message_hookrLrr$rrrst_modechmodrrrrr) rZcur_lenZnew_fileZnew_tocr#startstopZ new_startrTmoderrrrIs^            z_singlefileMailbox.flushcCsdS)z,Called before writing the mailbox to file f.Nr)rrrrrrsz$_singlefileMailbox._pre_mailbox_hookcCsdS)z-Called before writing each message to file f.Nr)rrrrrrsz$_singlefileMailbox._pre_message_hookcCsdS)z,Called after writing each message to file f.Nr)rrrrrrsz%_singlefileMailbox._post_message_hookcCs4z |jWdz|jr|jWd|jjXXdS)zFlush and close the mailbox.N)rIrrKrrL)rrrrrLs   z_singlefileMailbox.closec CsJ|jdkr|j|dk rFy |j|Stk rDtd|YnXdS)z'Return (start, stop) or raise KeyError.NzNo message with key: %s)r _generate_tocr&)rr#rrrrs  z_singlefileMailbox._lookupc Cs|jjdd|jj}t|jdkr:|j r:|j|jy&|j|j|j|}|j |jWn"t k r|jj |YnX|jj |jj|_ |S)z;Append message to mailbox and return (start, stop) offsets.rrU)rrarrrrrr_install_messagerrtruncaterIr)rr!ZbeforeZoffsetsrrrrs       z"_singlefileMailbox._append_message)NT)N)rwrxryrzrr"r$r(r6r?r@rJrKrIrrrrLrrrrrrr>s"  @ rc@sBeZdZdZdZddZdddZddd Zdd d Zd d Z dS) _mboxMMDFzAn mbox or MMDF mailbox.TcCsp|j|\}}|jj||jjjtd}|jj||jj}|j|jtd}|j |ddj d|S)z4Return a Message representation or raise a KeyError.rQrXNr) rrrarnrbrcrSr_message_factoryset_fromdecode)rr#rr from_linestringrrrrr,s z_mboxMMDF.get_messageFcCstj|j|j|dS)z3Return a string representation or raise a KeyError.)unixfrom)r1r2r3r4)rr#from_rrrr5sz_mboxMMDF.get_stringcCsJ|j|\}}|jj||s(|jj|jj||jj}|jtdS)z3Return a string representation or raise a KeyError.rQ)rrrarnrSrrbrc)rr#rrrrrrrr3s   z_mboxMMDF.get_bytescCs<|j|\}}|jj||s(|jjt|j|jj|S)z6Return a file-like representation or raise a KeyError.)rrrarn _PartialFiler)rr#rrrrrrr/s   z_mboxMMDF.get_filecCs d}t|tr|j|}t|trf|jdrf|jd}|dkr\|d|}||dd}q|}d}nJt|tr|jjd}d|}n(t|t j j r|j }|dk r|jd}|dkrdt jt jj}|jj}|jj|t|j||j|j|jj}||fS) z1Format a message and blindly write to self._file.NsFrom rQrWrrsFrom MAILER-DAEMON rZ)r[rgrPrhrofind_mboxMMDFMessageget_fromrMr1r!r get_unixfromrasctimegmtimerrrdrcrv _mangle_from_)rr!rnewlineZauthorrrrrrr&s0         z_mboxMMDF._install_messageN)F)F)F) rwrxryrzrr,r5r3r/rrrrrrs  rc@s2eZdZdZdZdZd ddZddZdd ZdS) rzA classic mbox mailbox.TNcCst|_tj||||dS)zInitialize an mbox mailbox.N)r rrr)rrrrrrrrLsz mbox.__init__cCs|jtdS)z,Called after writing each message to file f.N)rdrc)rrrrrrQszmbox._post_message_hookcCsgg}}d}|jjdx|jj}|jj}|jdr|t|t|krl|rb|j|ttn |j||j|d}q|s|r|j|ttn |j|Pq|tkrd}qd}qWtt t |||_ t|j |_ |jj|_ dS)z0Generate key-to-(start, stop) table of contents.FrsFrom TN)rrarrnrorrrcdict enumerateziprrr)rstartsstopsZlast_was_emptyline_posrurrrrUs0         zmbox._generate_toc)NT) rwrxryrzrrerrrrrrrrCs  c@s2eZdZdZd ddZddZdd Zd d ZdS) rzAn MMDF mailbox.NTcCst|_tj||||dS)zInitialize an MMDF mailbox.N)r rrr)rrrrrrrrzsz MMDF.__init__cCs|jdtdS)z-Called before writing each message to file f.sN)rdrc)rrrrrrszMMDF._pre_message_hookcCs|jtdtdS)z,Called after writing each message to file f.sN)rdrc)rrrrrrszMMDF._post_message_hookcCsgg}}|jjdd}x|}|jj}|jj}|jdtr|j|xV|}|jj}|jj}|dtkr|j|ttPqN|sN|j|PqNWq|sPqWtt t |||_ t|j |_ |jjdd|jj|_ dS)z0Generate key-to-(start, stop) table of contents.rsrUN)rrarnrrorcrrrrrrrr)rrrnext_posrrurrrrs2          zMMDF._generate_toc)NT)rwrxryrzrrrrrrrrrws  c@seZdZdZd0ddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/ZdS)1rzAn MH mailbox.NTcCsttj||||tjj|jsj|r`tj|jdtjtjtjj |jdtj tj Btj Bdn t |jd|_dS)zInitialize an MH instance.iz .mh_sequencesiFN)rrrrrrrrLrrrO_EXCLrrr)rrrrrrrrs z MH.__init__cCs|j}t|dkrd}n t|d}tjj|jt|}t|}d}z|j rVt |zfy|j ||Wn:t k r|j rt |t|d}tj|YnXt|tr|j||Wd|j rt |XWd|st|X|S)z$Add message and return assigned key.rrWFTN)r8rmaxrrrrrgrrrrvrrrr$r[r _dump_sequences)rr!r8Znew_keyrrclosedrrrr"s6     zMH.addcCsxtjj|jt|}yt|d}Wn>tk r`}z"|jtjkrNt d|nWYdd}~XnX|j tj |dS)z=Remove the keyed message; raise KeyError if it doesn't exist.zrb+zNo message with key: %sN) rrrrrgrrrrr&rLr$)rr#rrrrrrr$s z MH.removecCstjj|jt|}yt|d}Wn>tk r`}z"|jtjkrNt d|nWYdd}~XnXzd|j rrt |z@tj tj|tj tjB|j||t|tr|j||Wd|j rt|XWdt|XdS)z>Replace the keyed message; raise KeyError if it doesn't exist.zrb+zNo message with key: %sN)rrrrrgrrrrr&rrrLrO_TRUNCrvr[r r rr)rr#r!rrrrrrr(s$   zMH.__setitem__c Csy@|jr$ttjj|jt|d}nttjj|jt|d}Wn>tk r~}z"|jtj krlt d|nWYdd}~XnX|2|jrt |z t |}Wd|jrt |XWdQRXx*|jjD]\}}||kr|j|qW|S)z4Return a Message representation or raise a KeyError.zrb+rzNo message with key: %sN)rrrrrrrgrrrr&rr r get_sequencesr> add_sequence)rr#rrrrkey_listrrrr,s&  zMH.get_messagec Csy@|jr$ttjj|jt|d}nttjj|jt|d}Wn>tk r~}z"|jtj krlt d|nWYdd}~XnX|6|jrt |z|j j tdS|jrt|XWdQRXdS)z2Return a bytes representation or raise a KeyError.zrb+rzNo message with key: %sNrQ)rrrrrrrgrrrr&rrSrbrcr)rr#rrrrrr3s z MH.get_bytescCsfyttjj|jt|d}Wn>tk r\}z"|jtjkrJt d|nWYdd}~XnXt |S)z6Return a file-like representation or raise a KeyError.rzNo message with key: %sN) rrrrrrgrrrr&r)rr#rrrrrr/)s z MH.get_filecCsttddtj|jDS)zReturn an iterator over keys.css|]}|jrt|VqdS)N)isdigitr).0rrrr 6szMH.iterkeys..)iterrrrr)rrrrr64sz MH.iterkeyscCstjjtjj|jt|S)z9Return True if the keyed message exists, False otherwise.)rrrrrrg)rr#rrrr?9szMH.__contains__cCstt|jS)z*Return a count of messages in the mailbox.)rr7r6)rrrrr@=sz MH.__len__cCs2|js.ttjj|jdd|_t|jd|_dS)zLock the mailbox.z .mh_sequenceszrb+TN)rrrrrrrr)rrrrrJAs zMH.lockcCs(|jr$t|jt|j|`d|_dS)z#Unlock the mailbox if it is locked.FN)rrrr)rrrrrKHs   z MH.unlockcCsdS)z&Write any pending changes to the disk.Nr)rrrrrIPszMH.flushcCs|jr|jdS)zFlush and close the mailbox.N)rrK)rrrrrLTszMH.closecCs@g}x6tj|jD]&}tjjtjj|j|r|j|qW|S)zReturn a list of folder names.)rrrrrrr)rrBrrrrrYs zMH.list_folderscCsttjj|j||jddS)z+Return an MH instance for the named folder.F)rr)rrrrrr)rrrrrrasz MH.get_foldercCsttjj|j||jdS)z:Create a folder and return an MH instance representing it.)r)rrrrrr)rrrrrrfsz MH.add_foldercCs`tjj|j|}tj|}|dgkr:tjtjj|dn|gkrDntd|jtj|dS)z-Delete the named folder, which must be empty.z .mh_sequenceszFolder not empty: %sN)rrrrrr$rr)rrrZentriesrrrrks  zMH.remove_folderc s i}ttjj|jdddd}t|jx|D]}y|jd\}}t}xT|jD]H}|jrr|j t |qVdd|jdD\}} |j t || d qVWfd d t |D||<t||d kr||=Wq2tk rtd |jYq2Xq2WWdQRX|S)z=Return a name-to-key-list dictionary to define each sequence.z .mh_sequencesrASCII)encodingr{css|]}t|VqdS)N)r)rxrrrrsz#MH.get_sequences..-rWcsg|]}|kr|qSrr)rr#)all_keysrr sz$MH.get_sequences..rz"Invalid sequence specification: %sN)rrrrrsetr8rrr"rrHrangerrrOrrstrip) rZresultsrrurcontentsr8specrrr)rrr ws&    zMH.get_sequencesc Cs ttjj|jdddd}ztjtj|jtjtjBx|j D]\}}t |dkrXqB|j |dd}d}xbt t |D]R}|d |kr|sd }|j d n*|rd}|j d ||fn|j d ||}q|W|r|j t|dqB|j dqBWWdt|XdS)z:Set sequences using the given name-to-key-list dictionary.z .mh_sequenceszr+r)rrr{NFrWTrz%s %sz %s )rrrrrrLrrr r>rrdrrrgr)r sequencesrrr8prevZ completingr#rrr set_sequencess.   zMH.set_sequencesc CsL|j}d}g}x|jD]}|d|kr|j||dfy4tjtjj|jt|tjj|jt|dWnHt t fk rtj tjj|jt|tjj|jt|dYnXtj tjj|jt||d7}qW|d|_ t|dkrdSxB|jD]6\}}x*|D]"\}}||kr|||j|<qWqW|j|dS)z?Re-name messages to eliminate numbering gaps. Invalidates keys.rrWN)r r6rrrrrrrgrrrunlinkrrr>indexr#) rr!r"Zchangesr#rroldr}rrrpacks,      zMH.packcCs||j}|j}x<|jD]0\}}||kr6|j|q||kr||j|=qWx|D]}||krT|g||<qTW|j|dS)z;Inspect a new MHMessage and update sequences appropriately.N)r r>rr%r#)rr!r#Zpending_sequencesZ all_sequencesrrsequencerrrr s  zMH._dump_sequences)NT)rwrxryrzrr"r$r(r,r3r/r6r?r@rJrKrIrLrrrrr r#r'r rrrrrs. "  c@seZdZdZedddddddhZd%d d Zd dZddZddZ ddZ ddZ ddZ ddZ ddZddZdd Zd!d"Zd#d$Zd S)&rzAn Rmail-style Babyl mailbox.unseendeletedZfiledanswered forwardedZeditedresentNTcCstj||||i|_dS)zInitialize a Babyl mailbox.N)rr_labels)rrrrrrrrszBabyl.__init__cCs(tj||}t|tr$|j|j|<|S)z$Add message and return assigned key.)rr"r[r get_labelsr.)rr!r#rrrr"s  z Babyl.addcCs"tj||||jkr|j|=dS)z=Remove the keyed message; raise KeyError if it doesn't exist.N)rr$r.)rr#rrrr$s  z Babyl.removecCs*tj|||t|tr&|j|j|<dS)z>Replace the keyed message; raise KeyError if it doesn't exist.N)rr(r[r r/r.)rr#r!rrrr(s zBabyl.__setitem__c Cs|j|\}}|jj||jjtj}x4|jj}|dtksJ| rLP|j|jtdq.Wtj}x0|jj}|tks| rP|j|jtdqlW||jj }|jj |}|jtd}t |j |} | j |j ||jkr| j|j|| S)z4Return a Message representation or raise a KeyError.s *** EOOH ***rQ)rrrarnr\r]rcrdrbrrSr rm set_visibler. set_labels) rr#rroriginal_headersruZvisible_headersnZbodyrrrrr,s.       zBabyl.get_messagec Cs|j|\}}|jj||jjtj}x4|jj}|dtksJ| rLP|j|jtdq.Wx|jj}|tks|| rdPqdW|j }||jj }|jj |}|jtd}||S)z3Return a string representation or raise a KeyError.s *** EOOH ***rQ) rrrarnr\r]rcrdrbrmrrS) rr#rrr2ruZheadersr3rtrrrr3s$      zBabyl.get_bytescCstj|j|jdtS)z6Return a file-like representation or raise a KeyError.rQ)r\r]r3rbrc)rr#rrrr/%szBabyl.get_filecCs@|jt}x|jjD]}|j|qW|j|jt|S)z4Return a list of user-defined labels in the mailbox.)rrr.r<rHdifference_update_special_labelsr7)rlabelsZ label_listrrrr/)s  zBabyl.get_labelscCs>gg}}|jjdd}g}x|}|jj}|jj}|dtkrt|t|krf|j|tt|j|dd|jjddjdD}|j|q |dks|dtkrt|t|kr|j|ttq |s |j|ttPq Wtt t |||_ tt ||_ t|j |_ |jjdd |jj|_dS) z0Generate key-to-(start, stop) table of contents.rs cSsg|]}|jr|jqSr)strip)rlabelrrrr@sz'Babyl._generate_toc..rWN,rU)rrarnrrcrrrrrrrr.rr)rrrrZ label_listsrrur6rrrr2s4        zBabyl._generate_toccCsVdt}|dt7}|j}dd|D}|ddj|t7}|d7}|j|dS) z,Called before writing the mailbox to file f.sBABYL OPTIONS:s Version: 5css|]}|jVqdS)N)rM)rr8rrrrUsz*Babyl._pre_mailbox_hook..sLabels:r9r:N)rcr/rrd)rrZbabylr6rrrrPs zBabyl._pre_mailbox_hookcCs|jdtdS)z-Called before writing each message to file f. N)rdrc)rrrrrrZszBabyl._pre_message_hookcCs|jtddS)z,Called after writing each message to file f.r:N)rdrc)rrrrrr^szBabyl._post_message_hookcCs|jj}t|trg}g}x0|jD]$}||jkr@|j|q&|j|q&W|jjdx |D]}|jjd|jq`W|jjdx$|D]}|jjd|jdqW|jjt n|jjdt t|t j j r0t j}t jj|dd}|j||jdx6|j}|jj|jd t |d ks8| r Pq W|jjd t t|trt j} t jj| dd} | j|jxz| j}|jj|jd t |d ks| rPqWnB|jdx6|j}|jj|jd t |d ks| rPqWx,|jd } | sP|jj| jd t qWnZt|ttt jfr,t|t jrhtjd td |j}t|tr~|j|}|jdd} | ddkr|jj|d| jd t |jjd t |jj|d| jd t |jj|| djd t n(|jjd t t |jj|jd t n^t |drzt |drXtjdtd |j!}|j} d}x|j}|j"dr|ddd }n|j"dr|ddd }|jj|jd t |d ks| rf|rd}|jjd t |j| nPqfWx|j}|sP|j"dr,|ddt }n:|j"drJ|ddt }n|j"d rf|ddt }|jj|qWnt#dt$||jj}||fS)z0Write message contents and return (start, stop).1s, s,, r9s1,,FrrQs *** EOOH ***iz8Use of StringIO input is deprecated, use BytesIO insteadrRs rUrWNrnrTzDUse of text mode files is deprecated, use a binary mode file insteadTs rVzInvalid message type: %srZrYrZrYrZrZ)%rrr[r r/r5rrdrMrcr1r!rr\r]r^r_r`rarnrb get_visiblerSrhrgrirjrkrlrmrPrrErTrfrprq)rr!rZspecial_labelsr6r8Z orig_bufferZorig_generatorruZ vis_bufferZ vis_generatorrTZ body_startZ original_posZ first_passrrrrrbs                         zBabyl._install_message)NT)rwrxryrz frozensetr5rr"r$r(r,r3r/r/rrrrrrrrrrs      c@s*eZdZdZd ddZddZddZdS) rz0Message with mailbox-format-specific properties.NcCst|tjjr4|jtj|t|tr|j|nt|trP|jtj |n~t|t rl|jtj |nbt|t j r|jtj|nDt|dr|jtj|n(|dkrtjjj|ntdt|dS)zInitialize a Message instance.rSNzInvalid message type: %s)r[r1r!r_become_messagecopydeepcopy _explain_torhr2rgZmessage_from_stringr\ TextIOWrapperZmessage_from_filerEZmessage_from_binary_filerrprq)rr!rrrrs      zMessage.__init__cCs8t|dg}x&|jD]}||kr|j||j|<qWdS)z0Assume the non-format-specific state of message._type_specific_attributesN)getattr__dict__)rr!Z type_specificrrrrr@s  zMessage._become_messagecCst|trdStddS)z:Copy format-specific state to message insofar as possible.Nz Cannot convert to specified type)r[rrp)rr!rrrrCs zMessage._explain_to)N)rwrxryrzrr@rCrrrrrs c@s|eZdZdZdddgZdddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZddZdS)r z)Message with Maildir-specific properties._subdir_info_dateNcCs&d|_d|_tj|_tj||dS)z%Initialize a MaildirMessage instance.r}rN)rHrIrrJrr)rr!rrrrs zMaildirMessage.__init__cCs|jS)zReturn 'new' or 'cur'.)rH)rrrrrszMaildirMessage.get_subdircCs(|dks|dkr||_n td|dS)zSet subdir to 'new' or 'cur'.r}r~z!subdir must be 'new' or 'cur': %sN)rHrO)rrrrrrszMaildirMessage.set_subdircCs"|jjdr|jddSdSdS)z*Return as a string the flags that are set.z2,rUNr)rIro)rrrr get_flags s zMaildirMessage.get_flagscCsddjt||_dS)z)Set the given flags and unset all others.z2,rN)rrrI)rflagsrrr set_flagsszMaildirMessage.set_flagscCs$|jdjt|jt|BdS)z.Set the given flag(s) without changing others.rN)rMrrrK)rflagrrradd_flagszMaildirMessage.add_flagcCs,|jr(|jdjt|jt|dS)z7Unset the given string flag(s) without changing others.rN)rKrMrr)rrNrrr remove_flagszMaildirMessage.remove_flagcCs|jS)zSet "From " line, formatting and appending time_ if specified.NT )rrrr^)rrZtime_rrrrrs z_mboxMMDFMessage.set_fromcCs|jdd|jddS)z*Return as a string the flags that are set.StatusrzX-Status)r+)rrrrrKzsz_mboxMMDFMessage.get_flagscCst|}d \}}x&d D]}||kr||7}|j|qWx&d D]}||kr>||7}|j|q>W|djt|7}y|jd|Wn tk r|jd|YnXy|jd|Wn tk r|jd|YnXd S) z)Set the given flags and unset all others.rrTrUrWrXrYr`zX-StatusN)rr)rTrU)rWrXrY)rr$rrreplace_headerr&Z add_header)rrLZ status_flagsZ xstatus_flagsrNrrrrM~s&  z_mboxMMDFMessage.set_flagscCs$|jdjt|jt|BdS)z.Set the given flag(s) without changing others.rN)rMrrrK)rrNrrrrOsz_mboxMMDFMessage.add_flagcCs4d|ksd|kr0|jdjt|jt|dS)z7Unset the given string flag(s) without changing others.r`zX-StatusrN)rMrrrK)rrNrrrrPsz_mboxMMDFMessage.remove_flagc Cst|trt|j}d|kr(|jdd|kr:|jdd|krL|jdd|kr^|jdd|krp|jd|d =|d =d j|jjdd }y|j t j t j |dWnttfk rYnXn t|tr|j|j|j|jnt|trZt|j}d|kr$|jdd|kr8|jdd|krL|jd|d =|d =nt|trt|j}d|kr|jdd|kr|jdd|kr|jd|d =|d =nt|trntdt|d S)zACopy mbox- or MMDF-specific state to message insofar as possible.rUr~rXrYrTrSrWrVZstatuszx-statusr_rXNz%a %b %d %H:%M:%S %Yr)rZr[r*r+z$Cannot convert to specified type: %s)r[r rrKrrOrrrrcalendarZtimegmrZstrptimerO OverflowErrorrrMrr rr r]rrprq)rr!rLZ maybe_daterrrrCs^                          z_mboxMMDFMessage._explain_to)N)N) rwrxryrzrErrrrKrMrOrPrCrrrrr`s  rc@seZdZdZdS)r z&Message with mbox-specific properties.N)rwrxryrzrrrrr sc@sHeZdZdZdgZdddZddZdd Zd d Zd d Z ddZ dS)r z$Message with MH-specific properties. _sequencesNcCsg|_tj||dS)z!Initialize an MHMessage instance.N)rerr)rr!rrrrszMHMessage.__init__cCs|jddS)z4Return a list of sequences that include the message.N)re)rrrrr szMHMessage.get_sequencescCst||_dS)z3Set the list of sequences that include the message.N)r7re)rr!rrrr#szMHMessage.set_sequencescCs6t|tr"||jkr2|jj|ntdt|dS)z8Add sequence to list of sequences including the message.zsequence type must be str: %sN)r[rgrerrprq)rr(rrrrs  zMHMessage.add_sequencec Cs*y|jj|Wntk r$YnXdS)zARemove sequence from the list of sequences including the message.N)rer$rO)rr(rrrremove_sequenceszMHMessage.remove_sequencecCsJt|trdt|j}d|kr*|jdn|jd|jdd|krP|jdd|krb|jdnt|trt|j}d|kr|jdn |jd d|kr|jdd|kr|jd nt|trx||jD]}|j|qWn`t|t r(t|j}d|kr|j dd|krF|j d nt|t r6nt d t |d S)z6Copy MH-specific state to message insofar as possible.r)r~rSr[rXrZrTROrUrYr+z$Cannot convert to specified type: %sN)r[r rr rrOrr rr r]rrprq)rr!r!r(rrrrCs@                     zMHMessage._explain_to)N) rwrxryrzrErr r#rrfrCrrrrr s c@sbeZdZdZddgZdddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ dS)r z'Message with Babyl-specific properties.r._visibleNcCsg|_t|_tj||dS)z#Initialize a BabylMessage instance.N)r.rrhr)rr!rrrr"szBabylMessage.__init__cCs|jddS)z'Return a list of labels on the message.N)r.)rrrrr/(szBabylMessage.get_labelscCst||_dS)z&Set the list of labels on the message.N)r7r.)rr6rrrr1,szBabylMessage.set_labelscCs6t|tr"||jkr2|jj|ntdt|dS)z+Add label to list of labels on the message.zlabel must be a string: %sN)r[rgr.rrprq)rr8rrrr]0s  zBabylMessage.add_labelc Cs*y|jj|Wntk r$YnXdS)z4Remove label from the list of labels on the message.N)r.r$rO)rr8rrr remove_label8szBabylMessage.remove_labelcCs t|jS)z3Return a Message representation of visible headers.)rrh)rrrrr>?szBabylMessage.get_visiblecCst||_dS)z2Set the Message representation of visible headers.N)rrh)rZvisiblerrrr0CszBabylMessage.set_visiblecCsjx6|jjD](}||kr,|jj|||q |j|=q Wx,dD]$}||kr>||jkr>|||j|<q>WdS) z9Update and/or sensibly generate a set of visible headers.DateFromReply-ToToCCSubjectN)rjrkrlrmrnro)rhr8ra)rheaderrrrupdate_visibleGs  zBabylMessage.update_visiblecCsvt|tr~t|j}d|kr*|jdn|jd|jdd|ksNd|krX|jdd|krj|jdd |kr||jd nt|trt|j}d|kr|jd n |jd d |kr|jd d|kr|jdnt|trt|j}d|kr|jdd|krr|jdnXt|t rT|j |j x<|jD]}|j |q>Wnt|t rbntdt|dS)z9Copy Babyl-specific state to message insofar as possible.r)r~rSr,r-r\r+rTr*rVrgrUrWrYrZz$Cannot convert to specified type: %sN)r[r rr/rrOrr rr r0r>r]rrprq)rr!r6r8rrrrCRsF                      zBabylMessage._explain_to)N)rwrxryrzrErr/r1r]rir>r0rqrCrrrrr s  c@seZdZdZdS)r z&Message with MMDF-specific properties.N)rwrxryrzrrrrr |sc@seZdZdZd&ddZd'ddZd(ddZd)d d Zd*d d Zd dZ ddZ d+ddZ ddZ ddZ ddZddZddZddZd d!Zd"d#Zed$d%ZdS),rzA read-only wrapper of a file.NcCs$||_|dkr|j|_n||_dS)zInitialize a _ProxyFile.N)rr_pos)rrposrrrrs z_ProxyFile.__init__cCs|j||jjS)z Read bytes.)_readrrS)rsizerrrrSsz_ProxyFile.readcCs|j||jjS)z Read bytes.)rtrread1)rrurrrrvsz_ProxyFile.read1cCs|j||jjS)z Read a line.)rtrrn)rrurrrrnsz_ProxyFile.readlinecCs>g}x4|D],}|j||dk r |t|8}|dkr Pq W|S)zRead multiple lines.Nr)rr)rsizehintrBrurrr readliness   z_ProxyFile.readlinesccs x|j}|sdS|VqWdS)zIterate over lines.N)rn)rrurrrr;s z_ProxyFile.__iter__cCs|jS)zReturn the position.)rr)rrrrrsz_ProxyFile.tellrcCs4|dkr|jj|j|jj|||jj|_dS)zChange position.rWN)rrarrr)roffsetwhencerrrrasz_ProxyFile.seekc Cs0t|dr,zt|jdr"|jjWd|`XdS)zClose the file.rrLN)rErrL)rrrrrLs   z_ProxyFile.closecCs2|dkr d}|jj|j||}|jj|_|S)z"Read size bytes using read_method.NrWrZ)rrarrr)rru read_methodrBrrrrts  z_ProxyFile._readcCs|S)z$Context management protocol support.r)rrrr __enter__sz_ProxyFile.__enter__cGs |jdS)N)rL)rexcrrr__exit__sz_ProxyFile.__exit__cCs |jjS)N)rreadable)rrrrrsz_ProxyFile.readablecCs |jjS)N)rwritable)rrrrrsz_ProxyFile.writablecCs |jjS)N)rseekable)rrrrrsz_ProxyFile.seekablecCs |jjS)N)rrI)rrrrrIsz_ProxyFile.flushcCs&t|dsdSt|jdsdS|jjS)NrTr F)rErr )rrrrr s   z_ProxyFile.closed)N)N)N)N)N)r)rwrxryrzrrSrvrnrxr;rrarLrtr|r~rrrrIpropertyr rrrrrs$        rc@s<eZdZdZdddZddZddd Zd d Zd d ZdS)rz&A read-only wrapper of part of a file.NcCstj|||||_||_dS)zInitialize a _PartialFile.N)rr_start_stop)rrrrrrrrsz_PartialFile.__init__cCstj||jS)z*Return the position with respect to start.)rrr)rrrrrsz_PartialFile.tellrcCs<|dkr|j|_d}n|dkr*|j|_d}tj|||dS)z8Change position, possibly with respect to start or stop.rrWrUN)rrrrrra)rryrzrrrrasz_PartialFile.seekcCsB|j|j}|dkrdS|dks0|dks0||kr4|}tj|||S)z;Read size bytes using read_method, honoring start and stop.rrN)rrrrrt)rrur{Z remainingrrrrts  z_PartialFile._readcCst|dr|`dS)Nr)rEr)rrrrrLs z_PartialFile.close)NN)r) rwrxryrzrrrartrLrrrrrs    rTc4Csd}yZtrpytj|tjtjBWnJtk rn}z.|jtjtjtjfkr\t d|j nWYdd}~XnX|r^yt |j d}|j Wn:tk r}z|jtjtjfkrdSWYdd}~XnXy`yt j|j |j dd}Wn2ttfk rt j|j |j dd}YnXt j|j Wn0tk r\t j|j t d|j YnXWn8tr|tj|tj|rt j|j dYnXdS)z(Lock file f using lockf and dot locking.Fzlockf: lock unavailable: %sNz.lockTzdot lock unavailable: %s)fcntllockfZLOCK_EXZLOCK_NBrrZEAGAINrrrrrrLrrrrrr$rr$LOCK_UN)rrZ dotlock_donerZpre_lockrrrr sH    rcCs8trtj|tjtjj|jdr4tj|jddS)z*Unlock file f using lockf and dot locking.z.lockN)rrrrrrrr$)rrrrr4src Cs8tj|tjtjBtjBd}z t|dStj|XdS)zCCreate a file if it doesn't exist and open for reading and writing.izrb+N)rrrrO_RDWRrL)rfdrrrr;s rcCs$td|ttjtjtjfS)zBCreate a temp file based on path and open for reading and writing.z %s.%s.%s.%s)rrrrrrr)rrrrrCsrcCs$|jttdr tj|jdS)z0Ensure changes to file f are physically on disk.fsyncN)rIrErrfileno)rrrrrIs rcCst||jdS)z:Close file f, ensuring all changes are physically on disk.N)rrL)rrrrrOsrc@seZdZdZdS)rz"Raised for module-specific errors.N)rwrxryrzrrrrrUsc@seZdZdZdS)rz:The specified mailbox does not exist and won't be created.N)rwrxryrzrrrrrXsc@seZdZdZdS)rz>The specified mailbox is not empty and deletion was requested.N)rwrxryrzrrrrr[sc@seZdZdZdS)rz)Another process caused an action to fail.N)rwrxryrzrrrrr^sc@seZdZdZdS)rz)A file appears to have an invalid format.N)rwrxryrzrrrrras)T)0rzrrrcrrrArjr1Z email.messageZemail.generatorr\r-r ImportError__all__rcrMrrrrrrrrr!rr rr r r r rrrrrrrr Exceptionrrrrrrrrrsp     h8DB4-3z%mqH_c' *filecmp.cpython-36.opt-1.pyc000064400000020163152462730460011563 0ustar003 \f&@sdZddlZddlZddlmZdddddgZiZd#Zd d d dddddgZddZ d$ddZ ddZ ddZ GdddZ d%ddZee fddZddZd d!Zed"kredS)&zUtilities for comparing files and directories. Classes: dircmp Functions: cmp(f1, f2, shallow=True) -> int cmpfiles(a, b, common) -> ([], [], []) clear_cache() N) filterfalse clear_cachecmpdircmpcmpfilesDEFAULT_IGNORESiZRCSZCVSZtagsz.gitz.hgz.bzrZ_darcs __pycache__cCs tjdS)zClear the filecmp cache.N)_cacheclearr r /usr/lib64/python3.6/filecmp.pyrsTcCsttj|}ttj|}|dtjks8|dtjkrdS|sdSqWWdQRXWdQRXdS)NrbFT)BUFSIZEopenread)rrbufsizefp1fp2Zb1Zb2r r r rIs  rc@seZdZdZdddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ee eeeeeeeeeeed ZddZdS)raMA class that manages the comparison of 2 directories. dircmp(a, b, ignore=None, hide=None) A and B are directories. IGNORE is a list of names to ignore, defaults to DEFAULT_IGNORES. HIDE is a list of names to hide, defaults to [os.curdir, os.pardir]. High level usage: x = dircmp(dir1, dir2) x.report() -> prints a report on the differences between dir1 and dir2 or x.report_partial_closure() -> prints report on differences between dir1 and dir2, and reports on common immediate subdirectories. x.report_full_closure() -> like report_partial_closure, but fully recursive. Attributes: left_list, right_list: The files in dir1 and dir2, filtered by hide and ignore. common: a list of names in both dir1 and dir2. left_only, right_only: names only in dir1, dir2. common_dirs: subdirectories in both dir1 and dir2. common_files: files in both dir1 and dir2. common_funny: names in both dir1 and dir2 where the type differs between dir1 and dir2, or the name is not stat-able. same_files: list of identical files. diff_files: list of filenames which differ. funny_files: list of files which could not be compared. subdirs: a dictionary of dircmp objects, keyed by names in common_dirs. NcCsD||_||_|dkr$tjtjg|_n||_|dkr:t|_n||_dS)N)leftrightrcurdirpardirhiderignore)selfabr-r,r r r __init__xszdircmp.__init__cCsPttj|j|j|j|_ttj|j|j|j|_|jj |jj dS)N) _filterrlistdirr(r,r- left_listr) right_listsort)r.r r r phase0s    z dircmp.phase0cCsttttjj|j|j}ttttjj|j|j}tt|j t |j ||_ tt|j t |j ||_tt|j t |j ||_dS)N)dictzipmaprpathnormcaser4r5list __getitem__filter __contains__commonr left_only right_only)r.r/r0r r r phase1s z dircmp.phase1c Cs:g|_g|_g|_x |jD]}tjj|j|}tjj|j|}d}ytj |}Wn&t k rz}z d}WYdd}~XnXytj |}Wn&t k r}z d}WYdd}~XnX|r&t j |j }t j |j } || kr|jj |n>t j|r|jj |n&t j|r|jj |n |jj |q|jj |qWdS)Nrr) common_dirs common_files common_funnyrArr;joinr(r)rOSErrorrrappendS_ISDIRS_ISREG) r.xZa_pathZb_pathokZa_statZwhyZb_statZa_typeZb_typer r r phase2s4    z dircmp.phase2cCs&t|j|j|j}|\|_|_|_dS)N)rr(r)rF same_files diff_files funny_files)r.Zxxr r r phase3sz dircmp.phase3cCsRi|_xF|jD]<}tjj|j|}tjj|j|}t|||j|j |j|<qWdS)N) subdirsrErr;rHr(r)rr-r,)r.rMZa_xZb_xr r r phase4s  z dircmp.phase4cCs(|jx|jjD] }|jqWdS)N)rUrTvaluesphase4_closure)r.sdr r r rWszdircmp.phase4_closurecCstd|j|j|jr2|jjtd|jd|j|jrT|jjtd|jd|j|jrp|jjtd|j|jr|jjtd|j|jr|jjtd|j|j r|j jtd|j |j r|j jtd|j dS) NZdiffzOnly in:zIdentical files :zDiffering files :zTrouble with common files :zCommon subdirectories :zCommon funny cases :) printr(r)rBr6rCrPrQrRrErG)r.r r r reports,           z dircmp.reportcCs.|jx |jjD]}t|jqWdS)N)r[rTrVrZ)r.rXr r r report_partial_closureszdircmp.report_partial_closurecCs.|jx |jjD]}t|jqWdS)N)r[rTrVrZreport_full_closure)r.rXr r r r]szdircmp.report_full_closure) rTrPrQrRrErFrGrArBrCr4r5cCs*||jkrt||j||t||S)N) methodmapAttributeErrorgetattr)r.attrr r r __getattr__s zdircmp.__getattr__)NN)__name__ __module__ __qualname____doc__r1r7rDrOrSrUrWr[r\r]r8r^rbr r r r rVs"  #  cCsNgggf}x>|D]6}tjj||}tjj||}|t|||j|qW|S)a]Compare common files in two directories. a, b -- directory names common -- list of file names found in both directories shallow -- if true, do comparison based solely on stat() information Returns a tuple of three lists: files that compare equal files that are different filenames that aren't regular files. )rr;rH_cmprJ)r/r0rArresrMZaxZbxr r r rs  c Cs,y||||| Stk r&dSXdS)N)rI)r/r0Zshabsrr r r rgsrgcCstt|j|S)N)r=rr@)Zflistskipr r r r2sr2cCsrddl}ddl}|j|jddd\}}t|dkrB|jddt|d|d}d|krf|jn|jdS) Nrrrrizneed exactly two args-r)rmrn)sysgetoptargvrZ GetoptErrorrr]r[)rorpZoptionsargsZddr r r demo$s   rs__main__i )T)T)rfrr itertoolsr__all__r r"rrrrrrrrjrgr2rsrcr r r r  s&  ' %   zipapp.cpython-36.opt-2.pyc000064400000010410152462730460011442 0ustar003 \@sddlZddlZddlZddlZddlZddlZddlZdddgZdZej j drXdZ nej Z Gddde Zejd d Zd d Zdd dZdddZddZdddZedkredS)N ZipAppErrorcreate_archiveget_interpreterz8# -*- coding: utf-8 -*- import {module} {module}.{fn}() winzutf-8c@s eZdZdS)rN)__name__ __module__ __qualname__r r /usr/lib64/python3.6/zipapp.pyr!sc csFt|tjrt|}t|tr|sz!create_archive...css|]}|jVqdS)N)r*)r+r,r r r r-}szInvalid entry point: )modulefnz.pyzrrw*zutf-8)hasattrr r is_filer(existsr partitionallsplit MAIN_TEMPLATEformatZ with_suffixrrzipfileZZipFileZrglobrZ relative_torZwritestrrr"r#r$r%)sourcetargetrmainZsource_is_fileZhas_mainZmain_pymodsepr0Zmod_okZfn_okfdzrootZchildZarcnamer r r rNsP           &c Cs:t|d&}|jddkr,|jjjtSWdQRXdS)Nrrs#!)rrrstripdecoder)rrr r r rs cCs ddl}|j}|jddddd|jddddd|jd d dd d|jd d ddd|jddd|j|}|jrtjj|jst dt |j}t dj |pdt jdtjj|jr|jdkstjj|jrtjj|j|jrt d|jrt dt|j|j|j|jddS)Nrz--outputz-ozAThe name of the output archive. Required if SOURCE is an archive.)defaulthelpz--pythonz-pzEThe name of the Python interpreter to use (default: no shebang line).z--mainz-mzLThe main function of the application (default: use an existing __main__.py).z--infoF store_truez)Display the interpreter from the archive.)rFactionrGr<z'Source directory (or existing archive).)rGz%Can only get info for an archive filezInterpreter: {}zz-In-place editing of archives is not supportedz,Cannot change the main function when copying)rr>)argparseArgumentParser add_argument parse_argsinfor!pathisfiler< SystemExitrprintr:sysexitoutputr5samefiler>rpython)argsrJparserrr r r r>s6        r>__main__)N)NNN)N) contextlibr!r r r#rSr;__all__r9platform startswithrgetfilesystemencoding ValueErrorrcontextmanagerrrr(rrr>rr r r r s(     G -warnings.cpython-36.pyc000064400000031714152462730460011041 0ustar003 \8H @sdZddlZddddddd d gZd;d dZdd,dZGd-d.d.eZGd/d d eZdZy0dd0lmZm Z m!Z!mZmZm"Z"e Z#e!Z$d1ZWn.e%k rfgZd2Z#iZ$d*a&d3d4Z"YnXeej'ese(e)gZ*e*j+e,xe*D]Z-e d5e-d6qWej.j/Z/e/d*krd7Z0ne/rd2Z0nd5Z0e e0e1d*d8e2ed9rd:Z3nd5Z3e e3e4d*d8[dS)?z&Python part of the warnings subsystem.Nwarn warn_explicit showwarning formatwarningfilterwarnings simplefilter resetwarningscatch_warningscCst||||||}t|dS)z7Hook to write a warning to a file; replace if you like.N)WarningMessage_showwarnmsg_impl)messagecategoryfilenamelinenofilelinemsgr /usr/lib64/python3.6/warnings.pyr scCst||||d|}t|S)z.Function to format a warning the standard way.N)r _formatwarnmsg_impl)r r rrrrrrrrsc CsP|j}|dkr tj}|dkr dSt|}y|j|Wntk rJYnXdS)N)rsysstderr_formatwarnmsgwriteOSError)rrtextrrrr sr cCsLd|j|j|jj|jf}|jdkr`yddl}|j|j|j}Wqftk r\d}d}YqfXn|j}|r~|j }|d|7}|j dk rHyddl }|j |j }Wntk rd}YnX|dk rH|d7}xx|D]p}|d|j|jf7}y$|dk r |j|j|j}nd}Wntk r*d}YnX|r|j }|d|7}qW|S)Nz%s:%s: %s: %s rz %s z.Object allocated at (most recent call first): z File "%s", lineno %s z %s ) rrr __name__r r linecachegetline Exceptionstripsource tracemallocget_object_traceback)rsrrr"tbframerrrr#sF          rcCsdyt}Wntk rYn= 0)append)r0r1r2r3r4r5) reAssertionError isinstancestrtype issubclassWarningint _add_filtercompileI)actionr r r4rr6r7rrrrws cCsH|d kstd|ft|tr(|dks0td t|d |d ||d d S) aInsert a simple entry into the list of warnings filters (at the front). A simple filter matches all modules and messages. 'action' -- one of "error", "ignore", "always", "default", "module", or "once" 'category' -- a class that the warning must be a subclass of 'lineno' -- an integer line number, 0 matches all warnings 'append' -- if true, append to the list of filters r0r1r2r3r4r5zinvalid action: %rrzlineno must be an int >= 0N)r6)r0r1r2r3r4r5)r8r9r>r?)rBr rr6rrrrs c GsR|s6ytj|Wntk r&YnXtjd|n|tkrHtj|tdS)Nr)filtersremove ValueErrorinsertr6_filters_mutated)r6itemrrrr?s r?cCsgtdd<tdS)zAClear the list of warning filters, so that no filters are active.N)rCrGrrrrrs c@seZdZdZdS) _OptionErrorz,Exception used by option processing helpers.N)r __module__ __qualname____doc__rrrrrIsrIcCsRxL|D]D}y t|Wqtk rH}ztd|tjdWYdd}~XqXqWdS)NzInvalid -W option ignored:)r) _setoptionrIprintrr)argsargrrrr_processoptionss   rQcCsddl}|jd}t|dkr,td|fxt|dkrF|jdq.Wdd|D\}}}}}t|}|j|}t|}|j|}|r|d}|ryt|}|dkrt Wqt t fk rtd |fYqXnd}t |||||dS) Nr:ztoo many fields (max 5): %rr/cSsg|] }|jqSr)r ).0r$rrr sz_setoption..$zinvalid lineno %r) r7splitlenrIr6 _getactionescape _getcategoryr>rE OverflowErrorr)rPr7partsrBr r r4rrrrrMs.    rMcCsB|sdS|dkrdSxd D]}|j|r|SqWtd|fdS) Nr3allr2r1r4r5r0zinvalid action: %r)r3r2r1r4r5r0) startswithrI)rBarrrrYs  rYcCsddl}|stS|jd|rNy t|}Wqtk rJtd|fYqXn|jd}|d|}||dd}yt|dd|g}Wn"tk rtd|fYnXyt ||}Wn"t k rtd|fYnXt |tstd|f|S)Nrz^[a-zA-Z0-9_]+$zunknown warning category: %r.zinvalid module name: %rzinvalid warning category: %r) r7r=matchevalr'rIrfind __import__ ImportErrorgetattrAttributeErrorr<)r r7catir4klassmrrrr[s,     r[cCs|jj}d|kod|kS)zFSignal whether the frame is an internal CPython implementation detail. importlib _bootstrap)f_code co_filename)r&rrrr_is_internal_framesrrcCs&|j}x|dk r t|r |j}qW|S)z;Find the next frame that doesn't involve CPython internals.N)f_backrr)r&rrr_next_external_frames rtrbc Csvt|tr|j}|dkrt}t|to.t|tsDtdjt|jyZ|dks\t t j drht j |}n4t j d}x(t |dD]}t |}|dkrtqWWntk rt j}d}YnX|j}|j}d|kr|d}nd}|jd} | r| j} | jdrP| dd } n>|dkrFyt jd } Wntk rDd} YnX| sP|} |jd i} t||| ||| ||dS) z:Issue a warning, or maybe ignore it or raise an exception.Nz/category must be a Warning subclass, not '{:s}'rbrz__file__z.pyc__main__rZ__warningregistry__)r9r= __class__ UserWarningr;r<r*formatrrrr _getframerangertrE__dict__ f_globalsf_linenogetlowerendswithargvri setdefaultr) r r stacklevelr!r&xglobalsrr4rZfnlregistryrrrr sL           cCst|}|dkr8|pd}|ddjdkr8|dd}|dkrDi}|jddtkrd|jt|d<t|tr~t|}|j}n |}||}|||f} |j| rdSx^t D]R} | \} } } }}| dks| j |rt || r|dks|j |r|dks||krPqWt } | dkrd|| <dSddl }|j||| dkr:|| d krnd|| <||f}tj|rddSdt|<nf| d krznZ| d krd|| <||df}|j|rdSd||<n$| d krd|| <ntd | | ft|||||} t| dS)Nz z.pyversionrr1rbr0r5r2r4r3z1Unrecognized action (%r) in warnings.filters: %sr)r>rr_filters_versionclearr9r=r:rxrCrcr< defaultactionrgetlines onceregistry RuntimeErrorr r,)r r rrr4rmodule_globalsr!rkeyrHrBrrjmodlnrZoncekeyZaltkeyrrrrAsl                    c@s"eZdZd Zdd d Zd d ZdS)r r r rrrrr!Nc Cs:t}x|jD]} t|| || qW|r0|jnd|_dS)N)locals_WARNING_DETAILSsetattrr_category_name) selfr r rrrrr! local_valuesattrrrr__init__s zWarningMessage.__init__cCsd|j|j|j|j|jfS)NzD{message : %r, category : %r, filename : %r, lineno : %s, line : %r})r rrrr)rrrr__str__szWarningMessage.__str__)r r rrrrr!)NNN)rrJrKrrrrrrrr s  r c@s8eZdZdZdddddZddZd d Zd d ZdS) r aA context manager that copies and restores the warnings filter upon exiting the context. The 'record' argument specifies whether warnings should be captured by a custom implementation of warnings.showwarning() and be appended to a list returned by the context manager. Otherwise None is returned by the context manager. The objects appended to the list are arguments whose attributes mirror the arguments to showwarning(). The 'module' argument is to specify an alternative module to the module named 'warnings' and imported under that name. This argument is only useful when testing the warnings module itself. FN)recordr4cCs(||_|dkrtjdn||_d|_dS)zSpecify whether to record warnings and if an alternative module should be used other than sys.modules['warnings']. For compatibility with Python 3.0, please consider all arguments to be keyword-only. NwarningsF)_recordrmodules_module_entered)rrr4rrrrszcatch_warnings.__init__cCsPg}|jr|jd|jtjdk r4|jd|jt|j}d|dj|fS)Nz record=Truerz module=%rz%s(%s)z, )rr6rrrr;rjoin)rrOnamerrr__repr__s  zcatch_warnings.__repr__cCs~|jrtd|d|_|jj|_|jdd|j_|jj|jj|_|jj|_|j rvg}|j |j_|jj |j_|SdSdS)NzCannot enter %r twiceT) rrrrC_filtersrGr _showwarningr rr6r()rlogrrr __enter__s       zcatch_warnings.__enter__cGs>|jstd||j|j_|jj|j|j_|j|j_dS)Nz%Cannot exit %r without entering first) rrrrrCrGrrr )rexc_inforrr__exit__s     zcatch_warnings.__exit__)rrJrKrLrrrrrrrrr s   )rC_defaultaction _onceregistryrrrGTr3cCs td7adS)Nrb)rrrrrrGsrGr1)r r0)r r6gettotalrefcountr2)NN)N)NrbN)NNNN)5rLr__all__rrr rr(r,r-rr=rrr?rrrIrQrMrYr[rrrtrrobjectr r Z_warnings_defaults _warningsrCrrrGrrrgr warnoptions ImportWarningPendingDeprecationWarningZsilencer6DeprecationWarningclsflags bytes_warningZ bytes_action BytesWarninghasattrZresource_actionResourceWarningrrrrsv  0    5 FJ      filecmp.cpython-36.pyc000064400000020163152462730460010624 0ustar003 \f&@sdZddlZddlZddlmZdddddgZiZd#Zd d d dddddgZddZ d$ddZ ddZ ddZ GdddZ d%ddZee fddZddZd d!Zed"kredS)&zUtilities for comparing files and directories. Classes: dircmp Functions: cmp(f1, f2, shallow=True) -> int cmpfiles(a, b, common) -> ([], [], []) clear_cache() N) filterfalse clear_cachecmpdircmpcmpfilesDEFAULT_IGNORESiZRCSZCVSZtagsz.gitz.hgz.bzrZ_darcs __pycache__cCs tjdS)zClear the filecmp cache.N)_cacheclearr r /usr/lib64/python3.6/filecmp.pyrsTcCsttj|}ttj|}|dtjks8|dtjkrdS|sdSqWWdQRXWdQRXdS)NrbFT)BUFSIZEopenread)rrbufsizefp1fp2Zb1Zb2r r r rIs  rc@seZdZdZdddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ee eeeeeeeeeeed ZddZdS)raMA class that manages the comparison of 2 directories. dircmp(a, b, ignore=None, hide=None) A and B are directories. IGNORE is a list of names to ignore, defaults to DEFAULT_IGNORES. HIDE is a list of names to hide, defaults to [os.curdir, os.pardir]. High level usage: x = dircmp(dir1, dir2) x.report() -> prints a report on the differences between dir1 and dir2 or x.report_partial_closure() -> prints report on differences between dir1 and dir2, and reports on common immediate subdirectories. x.report_full_closure() -> like report_partial_closure, but fully recursive. Attributes: left_list, right_list: The files in dir1 and dir2, filtered by hide and ignore. common: a list of names in both dir1 and dir2. left_only, right_only: names only in dir1, dir2. common_dirs: subdirectories in both dir1 and dir2. common_files: files in both dir1 and dir2. common_funny: names in both dir1 and dir2 where the type differs between dir1 and dir2, or the name is not stat-able. same_files: list of identical files. diff_files: list of filenames which differ. funny_files: list of files which could not be compared. subdirs: a dictionary of dircmp objects, keyed by names in common_dirs. NcCsD||_||_|dkr$tjtjg|_n||_|dkr:t|_n||_dS)N)leftrightrcurdirpardirhiderignore)selfabr-r,r r r __init__xszdircmp.__init__cCsPttj|j|j|j|_ttj|j|j|j|_|jj |jj dS)N) _filterrlistdirr(r,r- left_listr) right_listsort)r.r r r phase0s    z dircmp.phase0cCsttttjj|j|j}ttttjj|j|j}tt|j t |j ||_ tt|j t |j ||_tt|j t |j ||_dS)N)dictzipmaprpathnormcaser4r5list __getitem__filter __contains__commonr left_only right_only)r.r/r0r r r phase1s z dircmp.phase1c Cs:g|_g|_g|_x |jD]}tjj|j|}tjj|j|}d}ytj |}Wn&t k rz}z d}WYdd}~XnXytj |}Wn&t k r}z d}WYdd}~XnX|r&t j |j }t j |j } || kr|jj |n>t j|r|jj |n&t j|r|jj |n |jj |q|jj |qWdS)Nrr) common_dirs common_files common_funnyrArr;joinr(r)rOSErrorrrappendS_ISDIRS_ISREG) r.xZa_pathZb_pathokZa_statZwhyZb_statZa_typeZb_typer r r phase2s4    z dircmp.phase2cCs&t|j|j|j}|\|_|_|_dS)N)rr(r)rF same_files diff_files funny_files)r.Zxxr r r phase3sz dircmp.phase3cCsRi|_xF|jD]<}tjj|j|}tjj|j|}t|||j|j |j|<qWdS)N) subdirsrErr;rHr(r)rr-r,)r.rMZa_xZb_xr r r phase4s  z dircmp.phase4cCs(|jx|jjD] }|jqWdS)N)rUrTvaluesphase4_closure)r.sdr r r rWszdircmp.phase4_closurecCstd|j|j|jr2|jjtd|jd|j|jrT|jjtd|jd|j|jrp|jjtd|j|jr|jjtd|j|jr|jjtd|j|j r|j jtd|j |j r|j jtd|j dS) NZdiffzOnly in:zIdentical files :zDiffering files :zTrouble with common files :zCommon subdirectories :zCommon funny cases :) printr(r)rBr6rCrPrQrRrErG)r.r r r reports,           z dircmp.reportcCs.|jx |jjD]}t|jqWdS)N)r[rTrVrZ)r.rXr r r report_partial_closureszdircmp.report_partial_closurecCs.|jx |jjD]}t|jqWdS)N)r[rTrVrZreport_full_closure)r.rXr r r r]szdircmp.report_full_closure) rTrPrQrRrErFrGrArBrCr4r5cCs*||jkrt||j||t||S)N) methodmapAttributeErrorgetattr)r.attrr r r __getattr__s zdircmp.__getattr__)NN)__name__ __module__ __qualname____doc__r1r7rDrOrSrUrWr[r\r]r8r^rbr r r r rVs"  #  cCsNgggf}x>|D]6}tjj||}tjj||}|t|||j|qW|S)a]Compare common files in two directories. a, b -- directory names common -- list of file names found in both directories shallow -- if true, do comparison based solely on stat() information Returns a tuple of three lists: files that compare equal files that are different filenames that aren't regular files. )rr;rH_cmprJ)r/r0rArresrMZaxZbxr r r rs  c Cs,y||||| Stk r&dSXdS)N)rI)r/r0Zshabsrr r r rgsrgcCstt|j|S)N)r=rr@)Zflistskipr r r r2sr2cCsrddl}ddl}|j|jddd\}}t|dkrB|jddt|d|d}d|krf|jn|jdS) Nrrrrizneed exactly two args-r)rmrn)sysgetoptargvrZ GetoptErrorrr]r[)rorpZoptionsargsZddr r r demo$s   rs__main__i )T)T)rfrr itertoolsr__all__r r"rrrrrrrrjrgr2rsrcr r r r  s&  ' %   threading.cpython-36.opt-1.pyc000064400000107632152462730460012120 0ustar003 i@sdZddlZddlZddlmZmZddl m Z ddl m Z ddlmZmZyddlmZWn ek r|ddlmZYnXdd d d d d dddddddddddddddgZejZejZejZejZejZ y ej!Z"Wne#k rdZ"YnXej$Z$[da%da&ddZ'ddZ(eZ)ddZ!Gd d!d!Z*e*Z+Gd"d d Z,Gd#ddZ-Gd$dde-Z.Gd%ddZ/Gd&ddZ0Gd'dde1Z2ej3Z4e4d@d)d*Z5e!a6iZ7iZ8e Z9Gd+ddZ:Gd,dde:Z;Gd-d.d.e:Ze>Z?d2d Z@e@ZAd3d4ZBd5d ZCdd6lmDZDe<aEd7d8ZFd9d:ZGd;d ZHyddd?ZLdS)Az;Thread module emulating a subset of Java's threading model.N) monotonicsleep) format_exc)WeakSet)islicecount)deque get_ident active_count Conditioncurrent_thread enumerate main_thread TIMEOUT_MAXEventLockRLock SemaphoreBoundedSemaphoreThreadBarrierBrokenBarrierErrorTimer ThreadError setprofilesettracelocal stack_sizecCs|adS)zSet a profile function for all threads started from the threading module. The func will be passed to sys.setprofile() for each thread, before its run() method is called. N) _profile_hook)funcr !/usr/lib64/python3.6/threading.pyr2scCs|adS)zSet a trace function for all threads started from the threading module. The func will be passed to sys.settrace() for each thread, before its run() method is called. N) _trace_hook)rr r r!r<scOstdkrt||St||S)a2Factory function that returns a new reentrant lock. A reentrant lock must be released by the thread that acquired it. Once a thread has acquired a reentrant lock, the same thread may acquire it again without blocking; the thread must release it once for each time it has acquired it. N)_CRLock_PyRLock)argskwargsr r r!rJs  c@sVeZdZdZddZddZddd ZeZd d Zd d Z ddZ ddZ ddZ dS)_RLocka,This class implements reentrant lock objects. A reentrant lock must be released by the thread that acquired it. Once a thread has acquired a reentrant lock, the same thread may acquire it again without blocking; the thread must release it once for each time it has acquired it. cCst|_d|_d|_dS)Nr)_allocate_lock_block_owner_count)selfr r r!__init__asz_RLock.__init__cCs^|j}yt|j}Wntk r(YnXd|jjr:dnd|jj|jj||j t t |fS)Nz)<%s %s.%s object owner=%r count=%d at %s>lockedZunlocked) r*_activenameKeyErrorr)r. __class__ __module__ __qualname__r+hexid)r,ownerr r r!__repr__fsz_RLock.__repr__TcCsDt}|j|kr"|jd7_dS|jj||}|r@||_d|_|S)aAcquire a lock, blocking or non-blocking. When invoked without arguments: if this thread already owns the lock, increment the recursion level by one, and return immediately. Otherwise, if another thread owns the lock, block until the lock is unlocked. Once the lock is unlocked (not owned by any thread), then grab ownership, set the recursion level to one, and return. If more than one thread is blocked waiting until the lock is unlocked, only one at a time will be able to grab ownership of the lock. There is no return value in this case. When invoked with the blocking argument set to true, do the same thing as when called without arguments, and return true. When invoked with the blocking argument set to false, do not block. If a call without an argument would block, return false immediately; otherwise, do the same thing as when called without arguments, and return true. When invoked with the floating-point timeout argument set to a positive value, block for at most the number of seconds specified by timeout and as long as the lock cannot be acquired. Return true if the lock has been acquired, false if the timeout has elapsed. r9)r r*r+r)acquire)r,blockingtimeoutmercr r r!r:us z_RLock.acquirecCs<|jtkrtd|jd|_}|s8d|_|jjdS)amRelease a lock, decrementing the recursion level. If after the decrement it is zero, reset the lock to unlocked (not owned by any thread), and if any other threads are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed. If after the decrement the recursion level is still nonzero, the lock remains locked and owned by the calling thread. Only call this method when the calling thread owns the lock. A RuntimeError is raised if this method is called when the lock is unlocked. There is no return value. zcannot release un-acquired lockr9N)r*r RuntimeErrorr+r)release)r,rr r r!r@s  z_RLock.releasecCs |jdS)N)r@)r,tvtbr r r!__exit__sz_RLock.__exit__cCs|jj|\|_|_dS)N)r)r:r+r*)r,stater r r!_acquire_restores z_RLock._acquire_restorecCs<|jdkrtd|j}d|_|j}d|_|jj||fS)Nrzcannot release un-acquired lock)r+r?r*r)r@)r,rr7r r r! _release_saves  z_RLock._release_savecCs |jtkS)N)r*r )r,r r r! _is_ownedsz_RLock._is_ownedN)TrI) __name__r3r4__doc__r-r8r: __enter__r@rDrFrGrHr r r r!r'Ws $ r'c@steZdZdZdddZddZddZd d Zd d Zd dZ ddZ dddZ dddZ dddZ ddZeZdS)r ajClass that implements a condition variable. A condition variable allows one or more threads to wait until they are notified by another thread. If the lock argument is given and not None, it must be a Lock or RLock object, and it is used as the underlying lock. Otherwise, a new RLock object is created and used as the underlying lock. NcCs|dkrt}||_|j|_|j|_y |j|_Wntk rDYnXy |j|_Wntk rfYnXy |j|_Wntk rYnXt|_ dS)N) r_lockr:r@rGAttributeErrorrFrH_deque_waiters)r,lockr r r!r-s$   zCondition.__init__cCs |jjS)N)rMrL)r,r r r!rLszCondition.__enter__cGs |jj|S)N)rMrD)r,r%r r r!rDszCondition.__exit__cCsd|jt|jfS)Nz)rMlenrP)r,r r r!r8szCondition.__repr__cCs|jjdS)N)rMr@)r,r r r!rGszCondition._release_savecCs|jjdS)N)rMr:)r,xr r r!rFszCondition._acquire_restorecCs"|jjdr|jjdSdSdS)NrFT)rMr:r@)r,r r r!rHs  zCondition._is_ownedcCs|jstdt}|j|jj||j}d}z|dkrN|jd}nj|dkrt|}d}xR|jd}|rvPt|t|}|dkrPt|d|d}t |qfWn |jd}|S|j ||sy|jj |Wnt k rYnXXdS) akWait until notified or until a timeout occurs. If the calling thread has not acquired the lock when this method is called, a RuntimeError is raised. This method releases the underlying lock, and then blocks until it is awakened by a notify() or notify_all() call for the same condition variable in another thread, or until the optional timeout occurs. Once awakened or timed out, it re-acquires the lock and returns. When the timeout argument is present and not None, it should be a floating point number specifying a timeout for the operation in seconds (or fractions thereof). When the underlying lock is an RLock, it is not released using its release() method, since this may not actually unlock the lock when it was acquired multiple times recursively. Instead, an internal interface of the RLock class is used, which really unlocks it even when it has been recursively acquired several times. Another internal interface is then used to restore the recursion level when the lock is reacquired. zcannot wait on un-acquired lockFNTrgMb@?g?) rHr?r(r:rPappendrG_timemin_sleeprFremove ValueError)r,r<waiterZ saved_stateZgotitendtimeZdelayZ remainingr r r!waits>     zCondition.waitcCs\d}|}|}xH|sV|dk rD|dkr0t|}n|t}|dkrDP|j||}qW|S)zWait until a condition evaluates to True. predicate should be a callable which result will be interpreted as a boolean value. A timeout may be provided giving the maximum time to wait. Nr)rVr])r,Z predicater<r\Zwaittimeresultr r r!wait_forIs    zCondition.wait_forr9c Csj|jstd|j}tt||}|s,dSx8|D]0}|jy|j|Wq2tk r`Yq2Xq2WdS)aKWake up one or more threads waiting on this condition, if any. If the calling thread has not acquired the lock when this method is called, a RuntimeError is raised. This method wakes up at most n of the threads waiting for the condition variable; it is a no-op if no threads are waiting. z!cannot notify on un-acquired lockN)rHr?rPrO_islicer@rYrZ)r,nZ all_waitersZwaiters_to_notifyr[r r r!notify`s  zCondition.notifycCs|jt|jdS)zWake up all threads waiting on this condition. If the calling thread has not acquired the lock when this method is called, a RuntimeError is raised. N)rbrRrP)r,r r r! notify_allwszCondition.notify_all)N)N)N)r9)rJr3r4rKr-rLrDr8rGrFrHr]r_rbrcZ notifyAllr r r r!r s   B   c@s8eZdZdZd ddZdddZeZd d Zd d ZdS)raGThis class implements semaphore objects. Semaphores manage a counter representing the number of release() calls minus the number of acquire() calls, plus an initial value. The acquire() method blocks if necessary until it can return without making the counter negative. If not given, value defaults to 1. r9cCs&|dkrtdtt|_||_dS)Nrz$semaphore initial value must be >= 0)rZr r_cond_value)r,valuer r r!r-s zSemaphore.__init__TNc Cs| r|dk rtdd}d}|jjxb|jdkrv|s8P|dk rh|dkrTt|}n|t}|dkrhP|jj|q(W|jd8_d}WdQRX|S)aAcquire a semaphore, decrementing the internal counter by one. When invoked without arguments: if the internal counter is larger than zero on entry, decrement it by one and return immediately. If it is zero on entry, block, waiting until some other thread has called release() to make it larger than zero. This is done with proper interlocking so that if multiple acquire() calls are blocked, release() will wake exactly one of them up. The implementation may pick one at random, so the order in which blocked threads are awakened should not be relied on. There is no return value in this case. When invoked with blocking set to true, do the same thing as when called without arguments, and return true. When invoked with blocking set to false, do not block. If a call without an argument would block, return false immediately; otherwise, do the same thing as when called without arguments, and return true. When invoked with a timeout other than None, it will block for at most timeout seconds. If acquire does not complete successfully in that interval, return false. Return true otherwise. Nz.can't specify timeout for non-blocking acquireFrr9T)rZrdrerVr])r,r;r<r>r\r r r!r:s$   zSemaphore.acquirec Cs.|j|jd7_|jjWdQRXdS)zRelease a semaphore, incrementing the internal counter by one. When the counter is zero on entry and another thread is waiting for it to become larger than zero again, wake up that thread. r9N)rdrerb)r,r r r!r@szSemaphore.releasecCs |jdS)N)r@)r,rArBrCr r r!rDszSemaphore.__exit__)r9)TN) rJr3r4rKr-r:rLr@rDr r r r!rs   - c@s"eZdZdZdddZddZdS) raImplements a bounded semaphore. A bounded semaphore checks to make sure its current value doesn't exceed its initial value. If it does, ValueError is raised. In most situations semaphores are used to guard resources with limited capacity. If the semaphore is released too many times it's a sign of a bug. If not given, value defaults to 1. Like regular semaphores, bounded semaphores manage a counter representing the number of release() calls minus the number of acquire() calls, plus an initial value. The acquire() method blocks if necessary until it can return without making the counter negative. If not given, value defaults to 1. r9cCstj||||_dS)N)rr-_initial_value)r,rfr r r!r-s zBoundedSemaphore.__init__c CsB|j2|j|jkrtd|jd7_|jjWdQRXdS)a6Release a semaphore, incrementing the internal counter by one. When the counter is zero on entry and another thread is waiting for it to become larger than zero again, wake up that thread. If the number of releases exceeds the number of acquires, raise a ValueError. z!Semaphore released too many timesr9N)rdrergrZrb)r,r r r!r@s  zBoundedSemaphore.releaseN)r9)rJr3r4rKr-r@r r r r!rs c@sFeZdZdZddZddZddZeZdd Zd d Z dd dZ d S)rzClass implementing event objects. Events manage a flag that can be set to true with the set() method and reset to false with the clear() method. The wait() method blocks until the flag is true. The flag is initially false. cCstt|_d|_dS)NF)r rrd_flag)r,r r r!r-s zEvent.__init__cCs|jjtdS)N)rdr-r)r,r r r!_reset_internal_locksszEvent._reset_internal_lockscCs|jS)z5Return true if and only if the internal flag is true.)rh)r,r r r!is_set sz Event.is_setc Cs&|jd|_|jjWdQRXdS)zSet the internal flag to true. All threads waiting for it to become true are awakened. Threads that call wait() once the flag is true will not block at all. TN)rdrhrc)r,r r r!setsz Event.setc Cs|j d|_WdQRXdS)zReset the internal flag to false. Subsequently, threads calling wait() will block until set() is called to set the internal flag to true again. FN)rdrh)r,r r r!clearsz Event.clearNc Cs,|j|j}|s|jj|}|SQRXdS)aHBlock until the internal flag is true. If the internal flag is true on entry, return immediately. Otherwise, block until another thread calls set() to set the flag to true, or until the optional timeout occurs. When the timeout argument is present and not None, it should be a floating point number specifying a timeout for the operation in seconds (or fractions thereof). This method returns the internal flag on exit, so it will always return True except if a timeout is given and the operation times out. N)rdrhr])r,r<Zsignaledr r r!r]'s  z Event.wait)N) rJr3r4rKr-rirjZisSetrkrlr]r r r r!rs  c@seZdZdZdddZdddZddZd d Zd d Zd dZ ddZ ddZ ddZ e ddZe ddZe ddZdS)rzImplements a Barrier. Useful for synchronizing a fixed number of threads at known synchronization points. Threads block on 'wait()' and are simultaneously once they have all made that call. NcCs.tt|_||_||_||_d|_d|_dS)aWCreate a barrier, initialised to 'parties' threads. 'action' is a callable which, when supplied, will be called by one of the threads after they have all entered the barrier and just prior to releasing them all. If a 'timeout' is provided, it is uses as the default for all subsequent 'wait()' calls. rN)r rrd_action_timeout_parties_stater+)r,partiesactionr<r r r!r-Qs zBarrier.__init__cCs|dkr|j}|jb|j|j}|jd7_z&|d|jkrL|jn |j||S|jd8_|jXWdQRXdS)aNWait for the barrier. When the specified number of threads have started waiting, they are all simultaneously awoken. If an 'action' was provided for the barrier, one of the threads will have executed that callback prior to returning. Returns an individual index number from 0 to 'parties-1'. Nr9)rnrd_enterr+ro_release_wait_exit)r,r<indexr r r!r]as   z Barrier.waitcCs,x|jdkr|jjqW|jdkr(tdS)Nr9rrI)rIr9)rprdr]r)r,r r r!rss   zBarrier._enterc Cs>y"|jr|jd|_|jjWn|jYnXdS)Nr9)rmrprdrc_break)r,r r r!rtszBarrier._releasecs4jjfdd|s"jtjdkr0tdS)Ncs jdkS)Nr)rpr )r,r r!szBarrier._wait..r)rdr_rxrrp)r,r<r )r,r!rus  z Barrier._waitcCs(|jdkr$|jdkr$d|_|jjdS)Nrr9rI)rIr9)r+rprdrc)r,r r r!rvs  z Barrier._exitc CsT|jD|jdkr6|jdkr$d|_q<|jdkrReturn the number of threads currently waiting at the barrier.r)rpr+)r,r r r! n_waitings zBarrier.n_waitingcCs |jdkS)z0Return True if the barrier is in a broken state.rTrz)rp)r,r r r!brokenszBarrier.broken)NN)N)rJr3r4rKr-r]rsrtrurvr{r|rxpropertyrqr}r~r r r r!rHs       c@s eZdZdS)rN)rJr3r4r r r r!rs Thread-%dcCs |tS)N)_counter)templater r r!_newnamesrc@seZdZdZdZejZdddfdfddddZddZ d d Z d d Z d dZ ddZ ddZddZddZddZddZd3ddZd5dd Zed!d"Zejd#d"Zed$d%Zd&d'ZeZed(d)Zejd*d)Zd+d,Zd-d.Zd/d0Zd1d2ZdS)6raA class that represents a thread of control. This class can be safely subclassed in a limited fashion. There are two ways to specify the activity: by passing a callable object to the constructor, or by overriding the run() method in a subclass. FN)daemoncCs~|dkr i}||_t|pt|_||_||_|dk r>||_n tj|_d|_ d|_ t |_ d|_ d|_tj|_tj|dS)aKThis constructor should always be called with keyword arguments. Arguments are: *group* should be None; reserved for future extension when a ThreadGroup class is implemented. *target* is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called. *name* is the thread name. By default, a unique name is constructed of the form "Thread-N" where N is a small decimal number. *args* is the argument tuple for the target invocation. Defaults to (). *kwargs* is a dictionary of keyword arguments for the target invocation. Defaults to {}. If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread. NFT)_targetstrr_name_args_kwargs _daemonicr r_ident _tstate_lockr_started _is_stopped _initialized_sysstderr_stderr _danglingadd)r,grouptargetr0r%r&rr r r!r- s  zThread.__init__cCs(|jj|r|jn d|_d|_dS)NT)rri_set_tstate_lockrr)r,is_aliver r r!ri7s   zThread._reset_internal_lockscCs^d}|jjrd}|j|jr$d}|jr2|d7}|jdk rJ|d|j7}d|jj|j|fS)NinitialZstartedZstoppedz daemonz %sz <%s(%s, %s)>) rrjrrrrr2rJr)r,Zstatusr r r!r8Cs  zThread.__repr__cCs|jstd|jjr tdt|t|<WdQRXyt|jfWn,tk rtt t|=WdQRXYnX|jj dS)a-Start the thread's activity. It must be called at most once per thread object. It arranges for the object's run() method to be invoked in a separate thread of control. This method will raise a RuntimeError if called more than once on the same thread object. zthread.__init__() not calledz threads can only be started onceN) rr?rrj_active_limbo_lock_limbo_start_new_thread _bootstrap Exceptionr])r,r r r!startQs  z Thread.startc Cs.z|jr|j|j|jWd|`|`|`XdS)aXMethod representing the thread's activity. You may override this method in a subclass. The standard run() method invokes the callable object passed to the object's constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively. N)rrr)r,r r r!runjs z Thread.runc Cs2y |jWn |jr&tdkr&dSYnXdS)N)_bootstrap_innerrr)r,r r r!r{s  zThread._bootstrapcCs t|_dS)N)r r)r,r r r! _set_identszThread._set_identcCst|_|jjdS)z Set a lock object which will be released by the interpreter when the underlying thread state (see pystate.h) gets deleted. N) _set_sentinelrr:)r,r r r!rszThread._set_tstate_lockc2CszT|j|j|jjt|t|j<t|=WdQRXtrLt j tt rZt j t zy |j Wntk r|Ynt rt jdk rtd|jtft jdn|jdk rH|j\}}}zxtd|jd|jdtd|jdx6|r$td|jjj|j|jjjf|jd|j}qWtd||f|jdWd~~~XYnXWdXWdt y tt=Wn YnXWdQRXXdS)NzException in thread %s: %s)filezException in thread z2 (most likely raised during interpreter shutdown):z"Traceback (most recent call last):z File "%s", line %s, in %sz%s: %s)rrrrkrr/rrr"rrrrr SystemExitrprintr0 _format_excr _exc_infotb_framef_code co_filename tb_linenoco_nametb_nextr )r,exc_type exc_valueZexc_tbr r r!rsT         zThread._bootstrap_innercCs|j}|dk rd|_d|_dS)NT)rr)r,rQr r r!_stopsz Thread._stopcCsByttt=WdQRXWn tk r<dtjkr8YnXdS)zARemove current thread from the dict of currently running threads.NZdummy_threading)rr/r r1rmodules)r,r r r!_deletes  zThread._deletecCsZ|jstd|jjs td|tkr2td|dkrD|jn|jt|dddS)aWait until the thread terminates. This blocks the calling thread until the thread whose join() method is called terminates -- either normally or through an unhandled exception or until the optional timeout occurs. When the timeout argument is present and not None, it should be a floating point number specifying a timeout for the operation in seconds (or fractions thereof). As join() always returns None, you must call isAlive() after join() to decide whether a timeout happened -- if the thread is still alive, the join() call timed out. When the timeout argument is not present or None, the operation will block until the thread terminates. A thread can be join()ed many times. join() raises a RuntimeError if an attempt is made to join the current thread as that would cause a deadlock. It is also an error to join() a thread before it has been started and attempts to do so raises the same exception. zThread.__init__() not calledz'cannot join thread before it is startedzcannot join current threadNr)r<)rr?rrjr _wait_for_tstate_lockmax)r,r<r r r!joins   z Thread.joinTr9cCs0|j}|dkrn|j||r,|j|jdS)N)rr:r@r)r,blockr<rQr r r!r;s  zThread._wait_for_tstate_lockcCs|jS)zA string used for identification purposes only. It has no semantics. Multiple threads may be given the same name. The initial name is set by the constructor. )r)r,r r r!r0Is z Thread.namecCst||_dS)N)rr)r,r0r r r!r0TscCs|jS)a4Thread identifier of this thread or None if it has not been started. This is a nonzero integer. See the get_ident() function. Thread identifiers may be recycled when a thread exits and another thread is created. The identifier is available even after the thread has exited. )r)r,r r r!identYs z Thread.identcCs(|js|jj rdS|jd|j S)zReturn whether the thread is alive. This method returns True just before the run() method starts until just after the run() method terminates. The module function enumerate() returns a list of all alive threads. F)rrrjr)r,r r r!res  zThread.is_alivecCs|jS)aA boolean value indicating whether this thread is a daemon thread. This must be set before start() is called, otherwise RuntimeError is raised. Its initial value is inherited from the creating thread; the main thread is not a daemon thread and therefore all threads created in the main thread default to daemon = False. The entire Python program exits when no alive non-daemon threads are left. )r)r,r r r!rusz Thread.daemoncCs*|jstd|jjr td||_dS)NzThread.__init__() not calledz)cannot set daemon status of active thread)rr?rrjr)r,daemonicr r r!rs  cCs|jS)N)r)r,r r r!isDaemonszThread.isDaemoncCs ||_dS)N)r)r,rr r r! setDaemonszThread.setDaemoncCs|jS)N)r0)r,r r r!getNameszThread.getNamecCs ||_dS)N)r0)r,r0r r r!setNameszThread.setName)NrI)TrI) rJr3r4rKrrexc_inforr-rir8rrrrrrrrrrrr0setterrrZisAliverrrrrr r r r!rs8, A# &    c@s*eZdZdZd ddZddZddZdS) rzCall a function after a specified number of seconds: t = Timer(30.0, f, args=None, kwargs=None) t.start() t.cancel() # stop the timer's action if it's still waiting NcCsFtj|||_||_|dk r"|ng|_|dk r4|ni|_t|_dS)N)rr-intervalfunctionr%r&rfinished)r,rrr%r&r r r!r-s  zTimer.__init__cCs|jjdS)z)Stop the timer if it hasn't finished yet.N)rrk)r,r r r!cancelsz Timer.cancelcCs6|jj|j|jjs(|j|j|j|jjdS)N)rr]rrjrr%r&rk)r,r r r!rs z Timer.run)NN)rJr3r4rKr-rrr r r r!rs c@seZdZddZdS) _MainThreadc CsHtj|ddd|j|jj|jt|t|j<WdQRXdS)NZ MainThreadF)r0r) rr-rrrkrrr/r)r,r r r!r-s  z_MainThread.__init__N)rJr3r4r-r r r r!rsrc@s.eZdZddZddZddZd dd ZdS) _DummyThreadc CsDtj|tddd|jj|jt|t|j<WdQRXdS)NzDummy-%dT)r0r) rr-rrrkrrr/r)r,r r r!r-s  z_DummyThread.__init__cCsdS)Nr )r,r r r!rsz_DummyThread._stopcCsdS)NTr )r,r r r!rsz_DummyThread.is_aliveNcCsdS)Nr )r,r<r r r!rsz_DummyThread.join)N)rJr3r4r-rrrr r r r!rsrc Cs&y ttStk r tSXdS)zReturn the current Thread object, corresponding to the caller's thread of control. If the caller's thread of control was not created through the threading module, a dummy thread object with limited functionality is returned. N)r/r r1rr r r r!r s c Cs tttttSQRXdS)zReturn the number of Thread objects currently alive. The returned count is equal to the length of the list returned by enumerate(). N)rrRr/rr r r r!r scCsttjttjS)N)listr/valuesrr r r r! _enumeratesrc Cs(tttjttjSQRXdS)zReturn a list of all Thread objects currently alive. The list includes daemonic threads, dummy thread objects created by current_thread(), and the main thread. It excludes terminated threads and threads that have not yet been started. N)rrr/rrr r r r!r s)rcCs8tj}|jtjt}x|r2|jt}qWdS)N) _main_threadrr@r_pickSomeNonDaemonThreadr)ZtlockrAr r r! _shutdownsrcCs(x"tD]}|j r|jr|SqWdS)N)r rr)rAr r r!r&s rcCstS)zReturn the main thread object. In normal conditions, the main thread is the thread from which the Python interpreter was started. )rr r r r!r,s)_local)rc Cstai}t}|at|tt}|jtxF|D]>}||kr`|jdt }||_ |||<q4|jd|j q4Wt j tj tj|WdQRXdS)NTF)rrr rrkrupdaterrir rrrrlr/)Z new_activeZcurrentZthreadsZthreadrr r r! _after_fork=s&        r)r)MrKsysr_threadZtimerrVrrX tracebackrr _weakrefsetr itertoolsrr`rr+ _collectionsrrO ImportError collections__all__start_new_threadr allocate_lockr(rr errorrrr#rNrrr"rrrr'r$r rrrrr?r__next__rrrr/rrrrrrr Z currentThreadr Z activeCountrr rrrrrrrZ_threading_localrr r r r!s          q9P&O '    threading.cpython-36.pyc000064400000111047152462730460011154 0ustar003 i@sdZddlZddlZddlmZmZddl m Z ddl m Z ddlmZmZyddlmZWn ek r|ddlmZYnXdd d d d d dddddddddddddddgZejZejZejZejZejZ y ej!Z"Wne#k rdZ"YnXej$Z$[da%da&ddZ'ddZ(eZ)ddZ!Gd d!d!Z*e*Z+Gd"d d Z,Gd#ddZ-Gd$dde-Z.Gd%ddZ/Gd&ddZ0Gd'dde1Z2ej3Z4e4d@d)d*Z5e!a6iZ7iZ8e Z9Gd+ddZ:Gd,dde:Z;Gd-d.d.e:Ze>Z?d2d Z@e@ZAd3d4ZBd5d ZCdd6lmDZDe<aEd7d8ZFd9d:ZGd;d ZHyddd?ZLdS)Az;Thread module emulating a subset of Java's threading model.N) monotonicsleep) format_exc)WeakSet)islicecount)deque get_ident active_count Conditioncurrent_thread enumerate main_thread TIMEOUT_MAXEventLockRLock SemaphoreBoundedSemaphoreThreadBarrierBrokenBarrierErrorTimer ThreadError setprofilesettracelocal stack_sizecCs|adS)zSet a profile function for all threads started from the threading module. The func will be passed to sys.setprofile() for each thread, before its run() method is called. N) _profile_hook)funcr !/usr/lib64/python3.6/threading.pyr2scCs|adS)zSet a trace function for all threads started from the threading module. The func will be passed to sys.settrace() for each thread, before its run() method is called. N) _trace_hook)rr r r!r<scOstdkrt||St||S)a2Factory function that returns a new reentrant lock. A reentrant lock must be released by the thread that acquired it. Once a thread has acquired a reentrant lock, the same thread may acquire it again without blocking; the thread must release it once for each time it has acquired it. N)_CRLock_PyRLock)argskwargsr r r!rJs  c@sVeZdZdZddZddZddd ZeZd d Zd d Z ddZ ddZ ddZ dS)_RLocka,This class implements reentrant lock objects. A reentrant lock must be released by the thread that acquired it. Once a thread has acquired a reentrant lock, the same thread may acquire it again without blocking; the thread must release it once for each time it has acquired it. cCst|_d|_d|_dS)Nr)_allocate_lock_block_owner_count)selfr r r!__init__asz_RLock.__init__cCs^|j}yt|j}Wntk r(YnXd|jjr:dnd|jj|jj||j t t |fS)Nz)<%s %s.%s object owner=%r count=%d at %s>lockedZunlocked) r*_activenameKeyErrorr)r. __class__ __module__ __qualname__r+hexid)r,ownerr r r!__repr__fsz_RLock.__repr__TcCsDt}|j|kr"|jd7_dS|jj||}|r@||_d|_|S)aAcquire a lock, blocking or non-blocking. When invoked without arguments: if this thread already owns the lock, increment the recursion level by one, and return immediately. Otherwise, if another thread owns the lock, block until the lock is unlocked. Once the lock is unlocked (not owned by any thread), then grab ownership, set the recursion level to one, and return. If more than one thread is blocked waiting until the lock is unlocked, only one at a time will be able to grab ownership of the lock. There is no return value in this case. When invoked with the blocking argument set to true, do the same thing as when called without arguments, and return true. When invoked with the blocking argument set to false, do not block. If a call without an argument would block, return false immediately; otherwise, do the same thing as when called without arguments, and return true. When invoked with the floating-point timeout argument set to a positive value, block for at most the number of seconds specified by timeout and as long as the lock cannot be acquired. Return true if the lock has been acquired, false if the timeout has elapsed. r9)r r*r+r)acquire)r,blockingtimeoutmercr r r!r:us z_RLock.acquirecCs<|jtkrtd|jd|_}|s8d|_|jjdS)amRelease a lock, decrementing the recursion level. If after the decrement it is zero, reset the lock to unlocked (not owned by any thread), and if any other threads are blocked waiting for the lock to become unlocked, allow exactly one of them to proceed. If after the decrement the recursion level is still nonzero, the lock remains locked and owned by the calling thread. Only call this method when the calling thread owns the lock. A RuntimeError is raised if this method is called when the lock is unlocked. There is no return value. zcannot release un-acquired lockr9N)r*r RuntimeErrorr+r)release)r,rr r r!r@s  z_RLock.releasecCs |jdS)N)r@)r,tvtbr r r!__exit__sz_RLock.__exit__cCs|jj|\|_|_dS)N)r)r:r+r*)r,stater r r!_acquire_restores z_RLock._acquire_restorecCs<|jdkrtd|j}d|_|j}d|_|jj||fS)Nrzcannot release un-acquired lock)r+r?r*r)r@)r,rr7r r r! _release_saves  z_RLock._release_savecCs |jtkS)N)r*r )r,r r r! _is_ownedsz_RLock._is_ownedN)TrI) __name__r3r4__doc__r-r8r: __enter__r@rDrFrGrHr r r r!r'Ws $ r'c@steZdZdZdddZddZddZd d Zd d Zd dZ ddZ dddZ dddZ dddZ ddZeZdS)r ajClass that implements a condition variable. A condition variable allows one or more threads to wait until they are notified by another thread. If the lock argument is given and not None, it must be a Lock or RLock object, and it is used as the underlying lock. Otherwise, a new RLock object is created and used as the underlying lock. NcCs|dkrt}||_|j|_|j|_y |j|_Wntk rDYnXy |j|_Wntk rfYnXy |j|_Wntk rYnXt|_ dS)N) r_lockr:r@rGAttributeErrorrFrH_deque_waiters)r,lockr r r!r-s$   zCondition.__init__cCs |jjS)N)rMrL)r,r r r!rLszCondition.__enter__cGs |jj|S)N)rMrD)r,r%r r r!rDszCondition.__exit__cCsd|jt|jfS)Nz)rMlenrP)r,r r r!r8szCondition.__repr__cCs|jjdS)N)rMr@)r,r r r!rGszCondition._release_savecCs|jjdS)N)rMr:)r,xr r r!rFszCondition._acquire_restorecCs"|jjdr|jjdSdSdS)NrFT)rMr:r@)r,r r r!rHs  zCondition._is_ownedcCs|jstdt}|j|jj||j}d}z|dkrN|jd}nj|dkrt|}d}xR|jd}|rvPt|t|}|dkrPt|d|d}t |qfWn |jd}|S|j ||sy|jj |Wnt k rYnXXdS) akWait until notified or until a timeout occurs. If the calling thread has not acquired the lock when this method is called, a RuntimeError is raised. This method releases the underlying lock, and then blocks until it is awakened by a notify() or notify_all() call for the same condition variable in another thread, or until the optional timeout occurs. Once awakened or timed out, it re-acquires the lock and returns. When the timeout argument is present and not None, it should be a floating point number specifying a timeout for the operation in seconds (or fractions thereof). When the underlying lock is an RLock, it is not released using its release() method, since this may not actually unlock the lock when it was acquired multiple times recursively. Instead, an internal interface of the RLock class is used, which really unlocks it even when it has been recursively acquired several times. Another internal interface is then used to restore the recursion level when the lock is reacquired. zcannot wait on un-acquired lockFNTrgMb@?g?) rHr?r(r:rPappendrG_timemin_sleeprFremove ValueError)r,r<waiterZ saved_stateZgotitendtimeZdelayZ remainingr r r!waits>     zCondition.waitcCs\d}|}|}xH|sV|dk rD|dkr0t|}n|t}|dkrDP|j||}qW|S)zWait until a condition evaluates to True. predicate should be a callable which result will be interpreted as a boolean value. A timeout may be provided giving the maximum time to wait. Nr)rVr])r,Z predicater<r\Zwaittimeresultr r r!wait_forIs    zCondition.wait_forr9c Csj|jstd|j}tt||}|s,dSx8|D]0}|jy|j|Wq2tk r`Yq2Xq2WdS)aKWake up one or more threads waiting on this condition, if any. If the calling thread has not acquired the lock when this method is called, a RuntimeError is raised. This method wakes up at most n of the threads waiting for the condition variable; it is a no-op if no threads are waiting. z!cannot notify on un-acquired lockN)rHr?rPrO_islicer@rYrZ)r,nZ all_waitersZwaiters_to_notifyr[r r r!notify`s  zCondition.notifycCs|jt|jdS)zWake up all threads waiting on this condition. If the calling thread has not acquired the lock when this method is called, a RuntimeError is raised. N)rbrRrP)r,r r r! notify_allwszCondition.notify_all)N)N)N)r9)rJr3r4rKr-rLrDr8rGrFrHr]r_rbrcZ notifyAllr r r r!r s   B   c@s8eZdZdZd ddZdddZeZd d Zd d ZdS)raGThis class implements semaphore objects. Semaphores manage a counter representing the number of release() calls minus the number of acquire() calls, plus an initial value. The acquire() method blocks if necessary until it can return without making the counter negative. If not given, value defaults to 1. r9cCs&|dkrtdtt|_||_dS)Nrz$semaphore initial value must be >= 0)rZr r_cond_value)r,valuer r r!r-s zSemaphore.__init__TNc Cs| r|dk rtdd}d}|jjxb|jdkrv|s8P|dk rh|dkrTt|}n|t}|dkrhP|jj|q(W|jd8_d}WdQRX|S)aAcquire a semaphore, decrementing the internal counter by one. When invoked without arguments: if the internal counter is larger than zero on entry, decrement it by one and return immediately. If it is zero on entry, block, waiting until some other thread has called release() to make it larger than zero. This is done with proper interlocking so that if multiple acquire() calls are blocked, release() will wake exactly one of them up. The implementation may pick one at random, so the order in which blocked threads are awakened should not be relied on. There is no return value in this case. When invoked with blocking set to true, do the same thing as when called without arguments, and return true. When invoked with blocking set to false, do not block. If a call without an argument would block, return false immediately; otherwise, do the same thing as when called without arguments, and return true. When invoked with a timeout other than None, it will block for at most timeout seconds. If acquire does not complete successfully in that interval, return false. Return true otherwise. Nz.can't specify timeout for non-blocking acquireFrr9T)rZrdrerVr])r,r;r<r>r\r r r!r:s$   zSemaphore.acquirec Cs.|j|jd7_|jjWdQRXdS)zRelease a semaphore, incrementing the internal counter by one. When the counter is zero on entry and another thread is waiting for it to become larger than zero again, wake up that thread. r9N)rdrerb)r,r r r!r@szSemaphore.releasecCs |jdS)N)r@)r,rArBrCr r r!rDszSemaphore.__exit__)r9)TN) rJr3r4rKr-r:rLr@rDr r r r!rs   - c@s"eZdZdZdddZddZdS) raImplements a bounded semaphore. A bounded semaphore checks to make sure its current value doesn't exceed its initial value. If it does, ValueError is raised. In most situations semaphores are used to guard resources with limited capacity. If the semaphore is released too many times it's a sign of a bug. If not given, value defaults to 1. Like regular semaphores, bounded semaphores manage a counter representing the number of release() calls minus the number of acquire() calls, plus an initial value. The acquire() method blocks if necessary until it can return without making the counter negative. If not given, value defaults to 1. r9cCstj||||_dS)N)rr-_initial_value)r,rfr r r!r-s zBoundedSemaphore.__init__c CsB|j2|j|jkrtd|jd7_|jjWdQRXdS)a6Release a semaphore, incrementing the internal counter by one. When the counter is zero on entry and another thread is waiting for it to become larger than zero again, wake up that thread. If the number of releases exceeds the number of acquires, raise a ValueError. z!Semaphore released too many timesr9N)rdrergrZrb)r,r r r!r@s  zBoundedSemaphore.releaseN)r9)rJr3r4rKr-r@r r r r!rs c@sFeZdZdZddZddZddZeZdd Zd d Z dd dZ d S)rzClass implementing event objects. Events manage a flag that can be set to true with the set() method and reset to false with the clear() method. The wait() method blocks until the flag is true. The flag is initially false. cCstt|_d|_dS)NF)r rrd_flag)r,r r r!r-s zEvent.__init__cCs|jjtdS)N)rdr-r)r,r r r!_reset_internal_locksszEvent._reset_internal_lockscCs|jS)z5Return true if and only if the internal flag is true.)rh)r,r r r!is_set sz Event.is_setc Cs&|jd|_|jjWdQRXdS)zSet the internal flag to true. All threads waiting for it to become true are awakened. Threads that call wait() once the flag is true will not block at all. TN)rdrhrc)r,r r r!setsz Event.setc Cs|j d|_WdQRXdS)zReset the internal flag to false. Subsequently, threads calling wait() will block until set() is called to set the internal flag to true again. FN)rdrh)r,r r r!clearsz Event.clearNc Cs,|j|j}|s|jj|}|SQRXdS)aHBlock until the internal flag is true. If the internal flag is true on entry, return immediately. Otherwise, block until another thread calls set() to set the flag to true, or until the optional timeout occurs. When the timeout argument is present and not None, it should be a floating point number specifying a timeout for the operation in seconds (or fractions thereof). This method returns the internal flag on exit, so it will always return True except if a timeout is given and the operation times out. N)rdrhr])r,r<Zsignaledr r r!r]'s  z Event.wait)N) rJr3r4rKr-rirjZisSetrkrlr]r r r r!rs  c@seZdZdZdddZdddZddZd d Zd d Zd dZ ddZ ddZ ddZ e ddZe ddZe ddZdS)rzImplements a Barrier. Useful for synchronizing a fixed number of threads at known synchronization points. Threads block on 'wait()' and are simultaneously once they have all made that call. NcCs.tt|_||_||_||_d|_d|_dS)aWCreate a barrier, initialised to 'parties' threads. 'action' is a callable which, when supplied, will be called by one of the threads after they have all entered the barrier and just prior to releasing them all. If a 'timeout' is provided, it is uses as the default for all subsequent 'wait()' calls. rN)r rrd_action_timeout_parties_stater+)r,partiesactionr<r r r!r-Qs zBarrier.__init__cCs|dkr|j}|jb|j|j}|jd7_z&|d|jkrL|jn |j||S|jd8_|jXWdQRXdS)aNWait for the barrier. When the specified number of threads have started waiting, they are all simultaneously awoken. If an 'action' was provided for the barrier, one of the threads will have executed that callback prior to returning. Returns an individual index number from 0 to 'parties-1'. Nr9)rnrd_enterr+ro_release_wait_exit)r,r<indexr r r!r]as   z Barrier.waitcCs:x|jdkr|jjqW|jdkr(t|jdks6tdS)Nr9rrI)rIr9)rprdr]rAssertionError)r,r r r!rss   zBarrier._enterc Cs>y"|jr|jd|_|jjWn|jYnXdS)Nr9)rmrprdrc_break)r,r r r!rtszBarrier._releasecsBjjfdd|s"jtjdkr0tjdks>tdS)Ncs jdkS)Nr)rpr )r,r r!szBarrier._wait..rr9)rdr_ryrrprx)r,r<r )r,r!rus  z Barrier._waitcCs(|jdkr$|jdkr$d|_|jjdS)Nrr9rI)rIr9)r+rprdrc)r,r r r!rvs  z Barrier._exitc CsT|jD|jdkr6|jdkr$d|_q<|jdkrReturn the number of threads currently waiting at the barrier.r)rpr+)r,r r r! n_waitings zBarrier.n_waitingcCs |jdkS)z0Return True if the barrier is in a broken state.rTr{)rp)r,r r r!brokenszBarrier.broken)NN)N)rJr3r4rKr-r]rsrtrurvr|r}rypropertyrqr~rr r r r!rHs       c@s eZdZdS)rN)rJr3r4r r r r!rs Thread-%dcCs |tS)N)_counter)templater r r!_newnamesrc@seZdZdZdZejZdddfdfddddZddZ d d Z d d Z d dZ ddZ ddZddZddZddZddZd3ddZd5dd Zed!d"Zejd#d"Zed$d%Zd&d'ZeZed(d)Zejd*d)Zd+d,Zd-d.Zd/d0Zd1d2ZdS)6raA class that represents a thread of control. This class can be safely subclassed in a limited fashion. There are two ways to specify the activity: by passing a callable object to the constructor, or by overriding the run() method in a subclass. FN)daemoncCs|dkstd|dkri}||_t|p,t|_||_||_|dk rN||_n tj |_d|_ d|_ t |_ d|_d|_tj|_tj|dS)aKThis constructor should always be called with keyword arguments. Arguments are: *group* should be None; reserved for future extension when a ThreadGroup class is implemented. *target* is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called. *name* is the thread name. By default, a unique name is constructed of the form "Thread-N" where N is a small decimal number. *args* is the argument tuple for the target invocation. Defaults to (). *kwargs* is a dictionary of keyword arguments for the target invocation. Defaults to {}. If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread. Nz#group argument must be None for nowFT)rx_targetstrr_name_args_kwargs _daemonicr r_ident _tstate_lockr_started _is_stopped _initialized_sysstderr_stderr _danglingadd)r,grouptargetr0r%r&rr r r!r- s" zThread.__init__cCs(|jj|r|jn d|_d|_dS)NT)rri_set_tstate_lockrr)r,is_aliver r r!ri7s   zThread._reset_internal_lockscCsl|jstdd}|jjr d}|j|jr2d}|jr@|d7}|jdk rX|d|j7}d|jj |j |fS)Nz Thread.__init__() was not calledinitialZstartedZstoppedz daemonz %sz <%s(%s, %s)>) rrxrrjrrrrr2rJr)r,Zstatusr r r!r8Cs  zThread.__repr__cCs|jstd|jjr tdt|t|<WdQRXyt|jfWn,tk rtt t|=WdQRXYnX|jj dS)a-Start the thread's activity. It must be called at most once per thread object. It arranges for the object's run() method to be invoked in a separate thread of control. This method will raise a RuntimeError if called more than once on the same thread object. zthread.__init__() not calledz threads can only be started onceN) rr?rrj_active_limbo_lock_limbo_start_new_thread _bootstrap Exceptionr])r,r r r!startQs  z Thread.startc Cs.z|jr|j|j|jWd|`|`|`XdS)aXMethod representing the thread's activity. You may override this method in a subclass. The standard run() method invokes the callable object passed to the object's constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively. N)rrr)r,r r r!runjs z Thread.runc Cs2y |jWn |jr&tdkr&dSYnXdS)N)_bootstrap_innerrr)r,r r r!r{s  zThread._bootstrapcCs t|_dS)N)r r)r,r r r! _set_identszThread._set_identcCst|_|jjdS)z Set a lock object which will be released by the interpreter when the underlying thread state (see pystate.h) gets deleted. N) _set_sentinelrr:)r,r r r!rszThread._set_tstate_lockc2CszT|j|j|jjt|t|j<t|=WdQRXtrLt j tt rZt j t zy |j Wntk r|Ynt rt jdk rtd|jtft jdn|jdk rH|j\}}}zxtd|jd|jdtd|jdx6|r$td|jjj|j|jjjf|jd|j}qWtd||f|jdWd~~~XYnXWdXWdt y tt=Wn YnXWdQRXXdS)NzException in thread %s: %s)filezException in thread z2 (most likely raised during interpreter shutdown):z"Traceback (most recent call last):z File "%s", line %s, in %sz%s: %s)rrrrkrr/rrr"rrrrr SystemExitrprintr0 _format_excr _exc_infotb_framef_code co_filename tb_linenoco_nametb_nextr )r,exc_type exc_valueZexc_tbr r r!rsT         zThread._bootstrap_innercCs,|j}|dk r|j std|_d|_dS)NT)rr.rxr)r,rQr r r!_stops z Thread._stopcCsByttt=WdQRXWn tk r<dtjkr8YnXdS)zARemove current thread from the dict of currently running threads.NZdummy_threading)rr/r r1rmodules)r,r r r!_deletes  zThread._deletecCsZ|jstd|jjs td|tkr2td|dkrD|jn|jt|dddS)aWait until the thread terminates. This blocks the calling thread until the thread whose join() method is called terminates -- either normally or through an unhandled exception or until the optional timeout occurs. When the timeout argument is present and not None, it should be a floating point number specifying a timeout for the operation in seconds (or fractions thereof). As join() always returns None, you must call isAlive() after join() to decide whether a timeout happened -- if the thread is still alive, the join() call timed out. When the timeout argument is not present or None, the operation will block until the thread terminates. A thread can be join()ed many times. join() raises a RuntimeError if an attempt is made to join the current thread as that would cause a deadlock. It is also an error to join() a thread before it has been started and attempts to do so raises the same exception. zThread.__init__() not calledz'cannot join thread before it is startedzcannot join current threadNr)r<)rr?rrjr _wait_for_tstate_lockmax)r,r<r r r!joins   z Thread.joinTr9cCs:|j}|dkr|js6tn|j||r6|j|jdS)N)rrrxr:r@r)r,blockr<rQr r r!r;s   zThread._wait_for_tstate_lockcCs|jstd|jS)zA string used for identification purposes only. It has no semantics. Multiple threads may be given the same name. The initial name is set by the constructor. zThread.__init__() not called)rrxr)r,r r r!r0Isz Thread.namecCs|jstdt||_dS)NzThread.__init__() not called)rrxrr)r,r0r r r!r0TscCs|jstd|jS)a4Thread identifier of this thread or None if it has not been started. This is a nonzero integer. See the get_ident() function. Thread identifiers may be recycled when a thread exits and another thread is created. The identifier is available even after the thread has exited. zThread.__init__() not called)rrxr)r,r r r!identYs z Thread.identcCs6|jstd|js |jj r$dS|jd|j S)zReturn whether the thread is alive. This method returns True just before the run() method starts until just after the run() method terminates. The module function enumerate() returns a list of all alive threads. zThread.__init__() not calledF)rrxrrrjr)r,r r r!res  zThread.is_alivecCs|jstd|jS)aA boolean value indicating whether this thread is a daemon thread. This must be set before start() is called, otherwise RuntimeError is raised. Its initial value is inherited from the creating thread; the main thread is not a daemon thread and therefore all threads created in the main thread default to daemon = False. The entire Python program exits when no alive non-daemon threads are left. zThread.__init__() not called)rrxr)r,r r r!rus z Thread.daemoncCs*|jstd|jjr td||_dS)NzThread.__init__() not calledz)cannot set daemon status of active thread)rr?rrjr)r,daemonicr r r!rs  cCs|jS)N)r)r,r r r!isDaemonszThread.isDaemoncCs ||_dS)N)r)r,rr r r! setDaemonszThread.setDaemoncCs|jS)N)r0)r,r r r!getNameszThread.getNamecCs ||_dS)N)r0)r,r0r r r!setNameszThread.setName)NrI)TrI) rJr3r4rKrrexc_inforr-rir8rrrrrrrrrrrr0setterrrZisAliverrrrrr r r r!rs8, A# &    c@s*eZdZdZd ddZddZddZdS) rzCall a function after a specified number of seconds: t = Timer(30.0, f, args=None, kwargs=None) t.start() t.cancel() # stop the timer's action if it's still waiting NcCsFtj|||_||_|dk r"|ng|_|dk r4|ni|_t|_dS)N)rr-intervalfunctionr%r&rfinished)r,rrr%r&r r r!r-s  zTimer.__init__cCs|jjdS)z)Stop the timer if it hasn't finished yet.N)rrk)r,r r r!cancelsz Timer.cancelcCs6|jj|j|jjs(|j|j|j|jjdS)N)rr]rrjrr%r&rk)r,r r r!rs z Timer.run)NN)rJr3r4rKr-rrr r r r!rs c@seZdZddZdS) _MainThreadc CsHtj|ddd|j|jj|jt|t|j<WdQRXdS)NZ MainThreadF)r0r) rr-rrrkrrr/r)r,r r r!r-s  z_MainThread.__init__N)rJr3r4r-r r r r!rsrc@s.eZdZddZddZddZd dd ZdS) _DummyThreadc CsDtj|tddd|jj|jt|t|j<WdQRXdS)NzDummy-%dT)r0r) rr-rrrkrrr/r)r,r r r!r-s  z_DummyThread.__init__cCsdS)Nr )r,r r r!rsz_DummyThread._stopcCs|j r|jjstdS)NT)rrrjrx)r,r r r!rsz_DummyThread.is_aliveNcCsds tddS)NFzcannot join a dummy thread)rx)r,r<r r r!rsz_DummyThread.join)N)rJr3r4r-rrrr r r r!rsrc Cs&y ttStk r tSXdS)zReturn the current Thread object, corresponding to the caller's thread of control. If the caller's thread of control was not created through the threading module, a dummy thread object with limited functionality is returned. N)r/r r1rr r r r!r s c Cs tttttSQRXdS)zReturn the number of Thread objects currently alive. The returned count is equal to the length of the list returned by enumerate(). N)rrRr/rr r r r!r scCsttjttjS)N)listr/valuesrr r r r! _enumeratesrc Cs(tttjttjSQRXdS)zReturn a list of all Thread objects currently alive. The list includes daemonic threads, dummy thread objects created by current_thread(), and the main thread. It excludes terminated threads and threads that have not yet been started. N)rrr/rrr r r r!r s)rcCsPtj}|dk st|jst|jtjt}x|rJ|jt}q6WdS)N) _main_threadrrxr.r@r_pickSomeNonDaemonThreadr)ZtlockrAr r r! _shutdowns  rcCs(x"tD]}|j r|jr|SqWdS)N)r rr)rAr r r!r&s rcCstS)zReturn the main thread object. In normal conditions, the main thread is the thread from which the Python interpreter was started. )rr r r r!r,s)_local)rc Cstai}t}|attt}|jtxF|D]>}||kr`|jdt }||_ |||<q4|jd|j q4Wt j tj tj|ttdkstWdQRXdS)NTFr9)rrr rrkrupdaterrir rrrrlr/rRrx)Z new_activeZcurrentZthreadsZthreadrr r r! _after_fork=s&        r)r)MrKsysr_threadZtimerrVrrX tracebackrr _weakrefsetr itertoolsrr`rr+ _collectionsrrO ImportError collections__all__start_new_threadr allocate_lockr(rr errorrrr#rNrrr"rrrr'r$r rrrrr?r__next__rrrr/rrrrrrr Z currentThreadr Z activeCountrr rrrrrrrZ_threading_localrr r r r!s          q9P&O '    _pydecimal.cpython-36.opt-1.pyc000064400000477114152462730460012266 0ustar003 \T$@sJdZddddddddd d d d d ddddddddddddddddddd d!d"d#d$g$ZeZd%Zd&Zd'Zd(d)lZd(d)lZ d(d)l Z yd(d*l m Z e dd+ZWnek rd,d-ZYnXdZdZdZdZdZdZdZdZd.Ze jdkrd2Zd2ZdZn d3Zd3ZdZeed1ZGd4ddeZGd5ddeZ Gd6d d eZ!Gd7dde!Z"Gd8d d ee#Z$Gd9dde!Z%Gd:dde!e#Z&Gd;d d eZ'Gdd d eZ*Gd?dde'e)Z+Gd@dde'e)e*Z,GdAddee-Z.e e$e'e+e)e,e!e*e.g Z/e"e!e%e!e&e!e(e!iZ0eeeeeeeefZ1y d(d)l2Z2Wn.ek rhGdBdCdCe3Z4e4Z2[4YnXy e2j5Wn>e6k re7e2j8dDre2j8`9dEdZ:dFdZ;Yn6Xe2j5Z5e7e5dDre5`9e5fdGdZ;e5fdHdZ:[2[5ddIdZe j?j@e=GdNdOdOe3ZAGdPdde3ZBGdQdRdRe3ZCddSdTZDeEjFZGdUdVZHdWdXZIdYdZZJd[d\ZKdd^d_ZLd`daZMdbdcZNGdddedee3ZOeOjPZQddfdgZRdhdiZSdjdkZTdldmdndodpdqdrdsdtdu fdvdwZUddxdyZVddzd{ZWeBd|ee$e+e!ggd}dd1d(d~ZXeBdee$e+e!e e,ggdZYeBdeggdZZd(d)l[Z[e[j\de[j]e[j^Bj_Z`e[j\dj_Zae[j\dj_Zbe[j\de[j]e[jcBZd[[y d(d)leZfWnek rYnXdddZgddZhddZidddZjddZkddZle=dZme=dZne=dZoe=d(Zpe=d1Zqe=dZremenfZse jtjuZve jtjwZxe jtjyZze{dsevd/evZ|[ d)S)a This is an implementation of decimal floating point arithmetic based on the General Decimal Arithmetic Specification: http://speleotrove.com/decimal/decarith.html and IEEE standard 854-1987: http://en.wikipedia.org/wiki/IEEE_854-1987 Decimal floating point has finite precision with arbitrarily large bounds. The purpose of this module is to support arithmetic using familiar "schoolhouse" rules and to avoid some of the tricky representation issues associated with binary floating point. The package is especially useful for financial applications or for contexts where users have expectations that are at odds with binary floating point (for instance, in binary floating point, 1.00 % 0.1 gives 0.09999999999999995 instead of 0.0; Decimal('1.00') % Decimal('0.1') returns the expected Decimal('0.00')). Here are some examples of using the decimal module: >>> from decimal import * >>> setcontext(ExtendedContext) >>> Decimal(0) Decimal('0') >>> Decimal('1') Decimal('1') >>> Decimal('-.0123') Decimal('-0.0123') >>> Decimal(123456) Decimal('123456') >>> Decimal('123.45e12345678') Decimal('1.2345E+12345680') >>> Decimal('1.33') + Decimal('1.27') Decimal('2.60') >>> Decimal('12.34') + Decimal('3.87') - Decimal('18.41') Decimal('-2.20') >>> dig = Decimal(1) >>> print(dig / Decimal(3)) 0.333333333 >>> getcontext().prec = 18 >>> print(dig / Decimal(3)) 0.333333333333333333 >>> print(dig.sqrt()) 1 >>> print(Decimal(3).sqrt()) 1.73205080756887729 >>> print(Decimal(3) ** 123) 4.85192780976896427E+58 >>> inf = Decimal(1) / Decimal(0) >>> print(inf) Infinity >>> neginf = Decimal(-1) / Decimal(0) >>> print(neginf) -Infinity >>> print(neginf + inf) NaN >>> print(neginf * inf) -Infinity >>> print(dig / 0) Infinity >>> getcontext().traps[DivisionByZero] = 1 >>> print(dig / 0) Traceback (most recent call last): ... ... ... decimal.DivisionByZero: x / 0 >>> c = Context() >>> c.traps[InvalidOperation] = 0 >>> print(c.flags[InvalidOperation]) 0 >>> c.divide(Decimal(0), Decimal(0)) Decimal('NaN') >>> c.traps[InvalidOperation] = 1 >>> print(c.flags[InvalidOperation]) 1 >>> c.flags[InvalidOperation] = 0 >>> print(c.flags[InvalidOperation]) 0 >>> print(c.divide(Decimal(0), Decimal(0))) Traceback (most recent call last): ... ... ... decimal.InvalidOperation: 0 / 0 >>> print(c.flags[InvalidOperation]) 1 >>> c.flags[InvalidOperation] = 0 >>> c.traps[InvalidOperation] = 0 >>> print(c.divide(Decimal(0), Decimal(0))) NaN >>> print(c.flags[InvalidOperation]) 1 >>> DecimalContext DecimalTupleDefaultContext BasicContextExtendedContextDecimalExceptionClampedInvalidOperationDivisionByZeroInexactRounded SubnormalOverflow UnderflowFloatOperationDivisionImpossibleInvalidContextConversionSyntaxDivisionUndefined ROUND_DOWN ROUND_HALF_UPROUND_HALF_EVEN ROUND_CEILING ROUND_FLOORROUND_UPROUND_HALF_DOWN ROUND_05UP setcontext getcontext localcontextMAX_PRECMAX_EMAXMIN_EMIN MIN_ETINY HAVE_THREADSZdecimalz1.70z2.4.2N) namedtuplezsign digits exponentcGs|S)N)argsr'r'"/usr/lib64/python3.6/_pydecimal.pysr*T?lNZoi@Tc@seZdZdZddZdS)ra1Base exception class. Used exceptions derive from this. If an exception derives from another exception besides this (such as Underflow (Inexact, Rounded, Subnormal) that indicates that it is only called if the others are present. This isn't actually used for anything, though. handle -- Called when context._raise_error is called and the trap_enabler is not set. First argument is self, second is the context. More arguments can be given, those being after the explanation in _raise_error (For example, context._raise_error(NewError, '(-x)!', self._sign) would call NewError().handle(context, self._sign).) To define a new exception, it should be sufficient to have it derive from DecimalException. cGsdS)Nr')selfcontextr(r'r'r)handleszDecimalException.handleN)__name__ __module__ __qualname____doc__r0r'r'r'r)rsc@seZdZdZdS)ra)Exponent of a 0 changed to fit bounds. This occurs and signals clamped if the exponent of a result has been altered in order to fit the constraints of a specific concrete representation. This may occur when the exponent of a zero result would be outside the bounds of a representation, or when a large normal number would have an encoded exponent that cannot be represented. In this latter case, the exponent is reduced to fit and the corresponding number of zero digits are appended to the coefficient ("fold-down"). N)r1r2r3r4r'r'r'r)rs c@seZdZdZddZdS)r a0An invalid operation was performed. Various bad things cause this: Something creates a signaling NaN -INF + INF 0 * (+-)INF (+-)INF / (+-)INF x % 0 (+-)INF % x x._rescale( non-integer ) sqrt(-x) , x > 0 0 ** 0 x ** (non-integer) x ** (+-)INF An operand is invalid The result of the operation after these is a quiet positive NaN, except when the cause is a signaling NaN, in which case the result is also a quiet NaN, but with the original sign, and an optional diagnostic information. cGs,|r(t|dj|djdd}|j|StS)Nr%nT)_dec_from_triple_sign_int_fix_nan_NaN)r.r/r(ansr'r'r)r0s zInvalidOperation.handleN)r1r2r3r4r0r'r'r'r)r sc@seZdZdZddZdS)rzTrying to convert badly formed string. This occurs and signals invalid-operation if a string is being converted to a number and it does not conform to the numeric string syntax. The result is [0,qNaN]. cGstS)N)r:)r.r/r(r'r'r)r0szConversionSyntax.handleN)r1r2r3r4r0r'r'r'r)rsc@seZdZdZddZdS)r aDivision by 0. This occurs and signals division-by-zero if division of a finite number by zero was attempted (during a divide-integer or divide operation, or a power operation with negative right-hand operand), and the dividend was not zero. The result of the operation is [sign,inf], where sign is the exclusive or of the signs of the operands for divide, or is 1 for an odd power of -0, for power. cGst|S)N)_SignedInfinity)r.r/signr(r'r'r)r0szDivisionByZero.handleN)r1r2r3r4r0r'r'r'r)r s c@seZdZdZddZdS)rzCannot perform the division adequately. This occurs and signals invalid-operation if the integer result of a divide-integer or remainder operation had too many digits (would be longer than precision). The result is [0,qNaN]. cGstS)N)r:)r.r/r(r'r'r)r0szDivisionImpossible.handleN)r1r2r3r4r0r'r'r'r)rsc@seZdZdZddZdS)rzUndefined result of division. This occurs and signals invalid-operation if division by zero was attempted (during a divide-integer, divide, or remainder operation), and the dividend is also zero. The result is [0,qNaN]. cGstS)N)r:)r.r/r(r'r'r)r0)szDivisionUndefined.handleN)r1r2r3r4r0r'r'r'r)r!sc@seZdZdZdS)r aHad to round, losing information. This occurs and signals inexact whenever the result of an operation is not exact (that is, it needed to be rounded and any discarded digits were non-zero), or if an overflow or underflow condition occurs. The result in all cases is unchanged. The inexact signal may be tested (or trapped) to determine if a given operation (or sequence of operations) was inexact. N)r1r2r3r4r'r'r'r)r ,s c@seZdZdZddZdS)raInvalid context. Unknown rounding, for example. This occurs and signals invalid-operation if an invalid context was detected during an operation. This can occur if contexts are not checked on creation and either the precision exceeds the capability of the underlying concrete representation or an unknown or unsupported rounding was specified. These aspects of the context need only be checked when the values are required to be used. The result is [0,qNaN]. cGstS)N)r:)r.r/r(r'r'r)r0CszInvalidContext.handleN)r1r2r3r4r0r'r'r'r)r8s c@seZdZdZdS)r aNumber got rounded (not necessarily changed during rounding). This occurs and signals rounded whenever the result of an operation is rounded (that is, some zero or non-zero digits were discarded from the coefficient), or if an overflow or underflow condition occurs. The result in all cases is unchanged. The rounded signal may be tested (or trapped) to determine if a given operation (or sequence of operations) caused a loss of precision. N)r1r2r3r4r'r'r'r)r Fs c@seZdZdZdS)r aExponent < Emin before rounding. This occurs and signals subnormal whenever the result of a conversion or operation is subnormal (that is, its adjusted exponent is less than Emin, before any rounding). The result in all cases is unchanged. The subnormal signal may be tested (or trapped) to determine if a given or operation (or sequence of operations) yielded a subnormal result. N)r1r2r3r4r'r'r'r)r Rs c@seZdZdZddZdS)raNumerical overflow. This occurs and signals overflow if the adjusted exponent of a result (from a conversion or from an operation that is not an attempt to divide by zero), after rounding, would be greater than the largest value that can be handled by the implementation (the value Emax). The result depends on the rounding mode: For round-half-up and round-half-even (and for round-half-down and round-up, if implemented), the result of the operation is [sign,inf], where sign is the sign of the intermediate result. For round-down, the result is the largest finite number that can be represented in the current precision, with the sign of the intermediate result. For round-ceiling, the result is the same as for round-down if the sign of the intermediate result is 1, or is [0,inf] otherwise. For round-floor, the result is the same as for round-down if the sign of the intermediate result is 0, or is [1,inf] otherwise. In all cases, Inexact and Rounded will also be raised. cGs|jttttfkrt|S|dkrR|jtkr4t|St|d|j|j |jdS|dkr|jt krlt|St|d|j|j |jdSdS)Nr%9r-) roundingrrrrr<rr6precEmaxr)r.r/r=r(r'r'r)r0ss     zOverflow.handleN)r1r2r3r4r0r'r'r'r)r]sc@seZdZdZdS)raxNumerical underflow with result rounded to 0. This occurs and signals underflow if a result is inexact and the adjusted exponent of the result would be smaller (more negative) than the smallest value that can be handled by the implementation (the value Emin). That is, the result is both inexact and subnormal. The result after an underflow will be a subnormal number rounded, if necessary, so that its exponent is not less than Etiny. This may result in 0 with the sign of the intermediate result and an exponent of Etiny. In all cases, Inexact, Rounded, and Subnormal will also be raised. N)r1r2r3r4r'r'r'r)rs c@seZdZdZdS)raEnable stricter semantics for mixing floats and Decimals. If the signal is not trapped (default), mixing floats and Decimals is permitted in the Decimal() constructor, context.create_decimal() and all comparison operators. Both conversion and comparisons are exact. Any occurrence of a mixed operation is silently recorded by setting FloatOperation in the context flags. Explicit conversions with Decimal.from_float() or context.create_decimal_from_float() do not set the flag. Otherwise (the signal is trapped), only equality comparisons and explicit conversions are silent. All other mixed operations raise FloatOperation. N)r1r2r3r4r'r'r'r)rs c@seZdZefddZdS) MockThreadingcCs |jtS)N)modules __xname__)r.sysr'r'r)localszMockThreading.localN)r1r2r3rErFr'r'r'r)rBsrB__decimal_context__cCs,|tttfkr|j}|j|tj_dS)z%Set this thread's context to context.N)rrrcopy clear_flags threadingcurrent_threadrG)r/r'r'r)rsc Cs4y tjjStk r.t}|tj_|SXdS)zReturns this thread's context. If this thread does not yet have a context, returns a new context and sets this thread's context. New contexts are copies of DefaultContext. N)rJrKrGAttributeErrorr)r/r'r'r)rs   c Cs,y|jStk r&t}||_|SXdS)zReturns this thread's context. If this thread does not yet have a context, returns a new context and sets this thread's context. New contexts are copies of DefaultContext. N)rGrLr)_localr/r'r'r)rs cCs(|tttfkr|j}|j||_dS)z%Set this thread's context to context.N)rrrrHrIrG)r/rMr'r'r)rscCs|dkrt}t|S)abReturn a context manager for a copy of the supplied context Uses a copy of the current context if no context is specified The returned context manager creates a local decimal context in a with statement: def sin(x): with localcontext() as ctx: ctx.prec += 2 # Rest of sin calculation algorithm # uses a precision 2 greater than normal return +s # Convert result to normal precision def sin(x): with localcontext(ExtendedContext): # Rest of sin calculation algorithm # uses the Extended Context from the # General Decimal Arithmetic Specification return +s # Convert result to normal context >>> setcontext(DefaultContext) >>> print(getcontext().prec) 28 >>> with localcontext(): ... ctx = getcontext() ... ctx.prec += 2 ... print(ctx.prec) ... 30 >>> with localcontext(ExtendedContext): ... print(getcontext().prec) ... 9 >>> print(getcontext().prec) 28 N)r_ContextManager)Zctxr'r'r)rs$c @seZdZdZdZddd Zed d Zd d ZddZ dddZ ddZ ddZ ddZ dddZdddZdddZdddZdd d!Zdd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zdd-d.Zdd/d0Zdd1d2Zdd3d4Zdd6d7Zdd8d9ZeZdd:d;Zddd?Z!e!Z"dd@dAZ#dBdCZ$ddDdEZ%d dFdGZ&d dHdIZ'd dJdKZ(d dLdMZ)d dNdOZ*ddPdQZ+ddRdSZ,dTdUZ-dVdWZ.e.Z/dXdYZ0e1e0Z0dZd[Z2e1e2Z2d\d]Z3d^d_Z4d`daZ5dbdcZ6dddeZ7dfdgZ8dhdiZ9djdkZ:dldmZ;dndoZe?e7e8e9e:e;edtZ@ddudvZAdwdxZBdydzZCdd{d|ZDdd}d~ZEddZFdddZGdddZHdddZIdddZJdddZKddZLddZMdddZNdddZOeOZPdddZQdddZRdddZSddZTddZUddZVddZWdddZXdddZYdddZZddZ[ddZ\d ddZ]d!ddZ^ddZ_ddZ`ddZaddZbd"ddZcddZdddZeddZfd#ddZgdd„ZhddĄZid$ddƄZjddȄZkd%ddʄZld&dd̄Zmdd΄ZnddЄZod'dd҄Zpd(ddԄZqd)ddքZrd*dd؄Zsd+ddڄZtd,dd܄Zud-ddބZvd.ddZwd/ddZxd0ddZyddZzd1ddZ{d2ddZ|d3ddZ}ddZ~ddZddZd4ddZdS(5rz,Floating point class for decimal arithmetic._expr8r7 _is_special0Nc Cstj|}t|tr$t|jjdd}|dkrP|dkr@t}|jt d|S|j ddkrfd|_ nd|_ |j d }|dk r|j d pd}t |j d pd }tt |||_ |t||_d |_nZ|j d}|dk rtt |pd jd |_ |j drd|_nd|_n d |_ d|_d|_|St|t rf|dkrBd|_ nd|_ d|_tt||_ d |_|St|tr|j|_|j |_ |j |_ |j|_|St|tr|j|_ t|j |_ t |j|_d |_|St|ttfr&t|dkrtdt|dt o |ddkstd|d|_ |ddkrHd |_ |d|_d|_ng} x^|dD]R} t| t rd| kozdknr| s| dkr| j| ntdqVW|ddkrdjtt| |_ |d|_d|_nDt|dt rdjtt| pdg|_ |d|_d |_ntd|St|tr||dkrBt}|jtdtj|}|j|_|j |_ |j |_ |j|_|St d|dS)aCreate a decimal point instance. >>> Decimal('3.14') # string input Decimal('3.14') >>> Decimal((0, (3, 1, 4), -2)) # tuple (sign, digit_tuple, exponent) Decimal('3.14') >>> Decimal(314) # int Decimal('314') >>> Decimal(Decimal(314)) # another decimal instance Decimal('314') >>> Decimal(' 3.14 \n') # leading and trailing whitespace okay Decimal('3.14') _NzInvalid literal for Decimal: %rr=-r-r%intZfracexprQFdiagsignalNr5FTztInvalid tuple size in creation of Decimal from list or tuple. The list or tuple should have exactly three elements.z|Invalid sign. The first value in the tuple should be an integer; either 0 for a positive number or 1 for a negative number.r+ zTThe second value in the tuple must be composed of integers in the range 0 through 9.zUThe third value in the tuple must be an integer, or one of the strings 'F', 'n', 'N'.z;strict semantics for mixing floats and Decimals are enabledzCannot convert %r to Decimal)r%r-)r5rY)!object__new__ isinstancestr_parserstripreplacer _raise_errorrgroupr7rUr8lenrOrPlstripabsr_WorkRepr=rVlisttuple ValueErrorappendjoinmapfloatr from_float TypeError) clsvaluer/r.mintpartfracpartrVrWdigitsZdigitr'r'r)r^4s               (      zDecimal.__new__cCst|tr||St|ts$tdtj|s8tj|rD|t|Stjd|dkrZd}nd}t |j \}}|j d}t |t |d|| }|tkr|S||SdS)a.Converts a float to a decimal number, exactly. Note that Decimal.from_float(0.1) is not the same as Decimal('0.1'). Since 0.1 is not exactly representable in binary floating point, the value is stored as the nearest representable value which is 0x1.999999999999ap-4. The exact equivalent of the value in decimal is 0.1000000000000000055511151231257827021181583404541015625. >>> Decimal.from_float(0.1) Decimal('0.1000000000000000055511151231257827021181583404541015625') >>> Decimal.from_float(float('nan')) Decimal('NaN') >>> Decimal.from_float(float('inf')) Decimal('Infinity') >>> Decimal.from_float(-float('inf')) Decimal('-Infinity') >>> Decimal.from_float(-0.0) Decimal('-0') zargument must be int or float.g?r%r-N)r_rUrprr_mathZisinfZisnanreprZcopysignrhas_integer_ratio bit_lengthr6r`r)rsfr=r5dkresultr'r'r)rqs    zDecimal.from_floatcCs(|jr$|j}|dkrdS|dkr$dSdS)zrReturns whether the number is not actually one. 0 if a number 1 if NaN 2 if sNaN r5r-rYr+r%)rPrO)r.rVr'r'r)_isnanszDecimal._isnancCs|jdkr|jrdSdSdS)zyReturns whether the number is infinite 0 if finite or not a number 1 if +INF -1 if -INF rZr-r%)rOr7)r.r'r'r) _isinfinitys  zDecimal._isinfinitycCs||j}|dkrd}n|j}|s&|rx|dkr4t}|dkrJ|jtd|S|dkr`|jtd|S|rn|j|S|j|SdS)zReturns whether the number is not actually one. if self, other are sNaN, signal if self, other are NaN return nan return 0 Done before operations. NFr+sNaNr%)rrrdr r9)r.otherr/ self_is_nan other_is_nanr'r'r) _check_nanss"   zDecimal._check_nanscCsv|dkrt}|js|jrr|jr0|jtd|S|jrF|jtd|S|jr\|jtd|S|jrr|jtd|SdS)aCVersion of _check_nans used for the signaling comparisons compare_signal, __le__, __lt__, __ge__, __gt__. Signal InvalidOperation if either self or other is a (quiet or signaling) NaN. Signaling NaNs take precedence over quiet NaNs. Return 0 if neither operand is a NaN. Nzcomparison involving sNaNzcomparison involving NaNr%)rrPis_snanrdr is_qnan)r.rr/r'r'r)_compare_check_nans.s(  zDecimal._compare_check_nanscCs|jp|jdkS)zuReturn True if self is nonzero; otherwise return False. NaNs and infinities are considered nonzero. rQ)rPr8)r.r'r'r)__bool__OszDecimal.__bool__cCs|js |jr8|j}|j}||kr(dS||kr4dSdS|sP|sDdSd|j S|s^d|jS|j|jkrndS|j|jkr~dS|j}|j}||kr|jd|j|j}|jd|j|j}||krdS||krd |j Sd |jSn ||krd |jSd |j SdS) zCompare the two non-NaN decimal instances self and other. Returns -1 if self < other, 0 if self == other and 1 if self > other. This routine is for internal use only.r%r-rQNrrrrrrrr)rPrr7adjustedr8rO)r.rZself_infZ other_inf self_adjustedZother_adjusted self_paddedZ other_paddedr'r'r)_cmpVs>          z Decimal._cmpcCs<t||dd\}}|tkr|S|j||r.dS|j|dkS)NT) equality_opFr%)_convert_for_comparisonNotImplementedrr)r.rr/r'r'r)__eq__s  zDecimal.__eq__cCs<t||\}}|tkr|S|j||}|r.dS|j|dkS)NFr%)rrrr)r.rr/r;r'r'r)__lt__s zDecimal.__lt__cCs<t||\}}|tkr|S|j||}|r.dS|j|dkS)NFr%)rrrr)r.rr/r;r'r'r)__le__s zDecimal.__le__cCs<t||\}}|tkr|S|j||}|r.dS|j|dkS)NFr%)rrrr)r.rr/r;r'r'r)__gt__s zDecimal.__gt__cCs<t||\}}|tkr|S|j||}|r.dS|j|dkS)NFr%)rrrr)r.rr/r;r'r'r)__ge__s zDecimal.__ge__cCs>t|dd}|js|r0|jr0|j||}|r0|St|j|S)zCompare self to other. Return a decimal value: a or b is a NaN ==> Decimal('NaN') a < b ==> Decimal('-1') a == b ==> Decimal('0') a > b ==> Decimal('1') T)raiseit)_convert_otherrPrrr)r.rr/r;r'r'r)compares   zDecimal.comparecCs|jr4|jrtdn|jr$tS|jr0t StS|jdkrNtd|jt }ntt |j t }t |j |t }|dkr||n| }|dkrdS|S)zx.__hash__() <==> hash(x)z"Cannot hash a signaling NaN value.r% r-r+r) rPrrris_nan _PyHASH_NANr7 _PyHASH_INFrOpow_PyHASH_MODULUS _PyHASH_10INVrUr8)r.Zexp_hashZhash_r;r'r'r)__hash__s  zDecimal.__hash__cCst|jttt|j|jS)zeRepresents the number as a triple tuple. To show the internals exactly as they are. )rr7rkrorUr8rO)r.r'r'r)as_tupleszDecimal.as_tuplecCs|jr |jrtdntd|s(dSt|j}|jdkrR|d|jd}}nr|j }x(|dkr|ddkr|d}|d8}q\W|j }t|| @jd|}|r||L}||8}d||>}|j r| }||fS)aExpress a finite Decimal instance in the form n / d. Returns a pair (n, d) of integers. When called on an infinity or NaN, raises OverflowError or ValueError respectively. >>> Decimal('3.14').as_integer_ratio() (157, 50) >>> Decimal('-123e5').as_integer_ratio() (-12300000, 1) >>> Decimal('0.00').as_integer_ratio() (0, 1) z#cannot convert NaN to integer ratioz(cannot convert Infinity to integer ratior%r-rry)r%r-) rPrrl OverflowErrorrUr8rOminr}r7)r.r5rZd5Zd2Zshift2r'r'r)r|s,     zDecimal.as_integer_ratiocCs dt|S)z0Represents the number as an instance of Decimal.z Decimal('%s'))r`)r.r'r'r)__repr__'szDecimal.__repr__Fc Csdddg|j}|jrL|jdkr&|dS|jdkr>|d|jS|d|jS|jt|j}|jdkrt|dkrt|}n6|s~d }n,|jd kr|d d d }n|d d d }|dkrd }d d | |j}nN|t|jkr|jd |t|j}d}n |jd|}d |j|d}||kr*d}n*|dkr:t}ddg|jd||}||||S)zReturn string representation of the number in scientific notation. Captures all of the information in the underlying representation. rSrTrZZInfinityr5NaNrr%r-rQr[.NeEz%+di)r7rPrOr8rfrcapitals) r.engr/r= leftdigitsdotplacervrwrVr'r'r)__str__,s:     zDecimal.__str__cCs|jd|dS)a,Convert to a string, using engineering notation if an exponent is needed. Engineering notation has an exponent which is a multiple of 3. This can leave up to 3 digits to the left of the decimal place and may require the addition of either one or two trailing zeros. T)rr/)r)r.r/r'r'r) to_eng_string`szDecimal.to_eng_stringcCsT|jr|j|d}|r|S|dkr(t}| rB|jtkrB|j}n|j}|j|S)zRReturns a copy with the sign switched. Rounds, if it has reason. )r/N)rPrrr?rcopy_abs copy_negate_fix)r.r/r;r'r'r)__neg__is  zDecimal.__neg__cCsT|jr|j|d}|r|S|dkr(t}| rB|jtkrB|j}nt|}|j|S)zhReturns a copy, unless it is a sNaN. Rounds the number (if more than precision digits) )r/N)rPrrr?rrrr)r.r/r;r'r'r)__pos__s  zDecimal.__pos__TcCsJ|s |jS|jr&|j|d}|r&|S|jr:|j|d}n |j|d}|S)zReturns the absolute value of self. If the keyword argument 'round' is false, do not round. The expression self.__abs__(round=False) is equivalent to self.copy_abs(). )r/)rrPrr7rr)r.roundr/r;r'r'r)__abs__s  zDecimal.__abs__c Cslt|}|tkr|S|dkr"t}|js.|jr|j||}|rB|S|jrr|j|jkrj|jrj|jtdSt |S|jrt |St |j |j }d}|j t kr|j|jkrd}| r| rt |j|j}|rd}t|d|}|j|}|S|s"t||j |jd}|j||j }|j|}|S|sZt||j |jd}|j||j }|j|}|St|}t|}t|||j\}}t} |j|jkr|j|jkrt|d|}|j|}|S|j|jkr||}}|jdkrd| _|j|j|_|_nd| _n&|jdkrd| _d\|_|_nd| _|jdkr@|j|j| _n|j|j| _|j| _t | }|j|}|S)zbReturns self + other. -INF + INF (or the reverse) cause InvalidOperation errors. Nz -INF + INFr%r-rQ)r%r%)rrrrPrrr7rdr rrrOr?rr6rmaxr@_rescaleri _normalizer=rUrV) r.rr/r;rVZ negativezeror=op1op2rr'r'r)__add__s|               zDecimal.__add__cCsHt|}|tkr|S|js |jr6|j||d}|r6|S|j|j|dS)zReturn self - other)r/)rrrPrrr)r.rr/r;r'r'r)__sub__s zDecimal.__sub__cCs"t|}|tkr|S|j||dS)zReturn other - self)r/)rrr)r.rr/r'r'r)__rsub__szDecimal.__rsub__cCsDt|}|tkr|S|dkr"t}|j|jA}|js:|jr|j||}|rN|S|jrn|sf|jtdSt |S|jr|s|jtdSt |S|j |j }| s| rt |d|}|j |}|S|j dkrt ||j |}|j |}|S|j dkrt ||j |}|j |}|St|}t|}t |t|j|j|}|j |}|S)z\Return self * other. (+-) INF * 0 (or its reverse) raise InvalidOperation. Nz (+-)INF * 0z 0 * (+-)INFrQ1)rrrr7rPrrrdr r<rOr6rr8rir`rU)r.rr/Z resultsignr;Z resultexprrr'r'r)__mul__sH              zDecimal.__mul__c Cst|}|tkrtS|dkr"t}|j|jA}|js:|jr|j||}|rN|S|jrj|jrj|jtdS|jrzt |S|jr|jt dt |d|j S|s|s|jt dS|jtd|S|s|j|j}d}nt|jt|j|jd}|j|j|}t|}t|} |dkr:t|jd || j\}} nt|j| jd | \}} | rt|d dkr|d7}n<|j|j} x.|| kr|d dkr|d }|d7}qWt |t||}|j|S) zReturn self / other.Nz(+-)INF/(+-)INFzDivision by infinityrQz0 / 0zx / 0r%r-rry)rrrr7rPrrrdr r<rr6Etinyrr rOrfr8r@ridivmodrUr`r) r.rr/r=r;rVcoeffshiftrr remainder ideal_expr'r'r) __truediv__QsP          zDecimal.__truediv__c Cs |j|jA}|jr|j}nt|j|j}|j|j}| sP|jsP|dkrjt|dd|j||jfS||jkr t |}t |}|j |j kr|j d|j |j 9_ n|j d|j |j 9_ t |j |j \}} |d|jkr t|t |dt|jt | |fS|jtd} | | fS)zReturn (self // other, self % other), to context.prec precision. Assumes that neither self nor other is a NaN, that self is not infinite and that other is nonzero. r+rQr%rz%quotient too large in //, % or divmodr)r7rrOrrr6rr?r@rirVrUrr`rdr) r.rr/r=rexpdiffrrqrr;r'r'r)_divides*    zDecimal._dividecCs"t|}|tkr|S|j||dS)z)Swaps self/other and returns __truediv__.)r/)rrr)r.rr/r'r'r) __rtruediv__szDecimal.__rtruediv__cCst|}|tkr|S|dkr"t}|j||}|r:||fS|j|jA}|jr~|jrj|jtd}||fSt||jtdfS|s|s|jt d}||fS|jt d||jtdfS|j ||\}}|j |}||fS)z6 Return (self // other, self % other) Nzdivmod(INF, INF)zINF % xz divmod(0, 0)zx // 0zx % 0) rrrrr7rrdr r<rr rr)r.rr/r;r=Zquotientrr'r'r) __divmod__s0      zDecimal.__divmod__cCs"t|}|tkr|S|j||dS)z(Swaps self/other and returns __divmod__.)r/)rrr)r.rr/r'r'r) __rdivmod__szDecimal.__rdivmod__cCst|}|tkr|S|dkr"t}|j||}|r6|S|jrJ|jtdS|sj|r^|jtdS|jtdS|j||d}|j |}|S)z self % other NzINF % xzx % 0z0 % 0r-) rrrrrrdr rrr)r.rr/r;rr'r'r)__mod__s"     zDecimal.__mod__cCs"t|}|tkr|S|j||dS)z%Swaps self/other and returns __mod__.)r/)rrr)r.rr/r'r'r)__rmod__szDecimal.__rmod__c Cs|dkrt}t|dd}|j||}|r.|S|jrB|jtdS|sb|rV|jtdS|jtdS|jr|t|}|j|St |j |j }|st |j d|}|j|S|j |j }||jdkr|jtS|d kr|j||j}|j|St|}t|}|j|jkr(|jd |j|j9_n|jd |j|j9_t|j|j\}} d | |d@|jkr~| |j8} |d7}|d |jkr|jtS|j } | d krd| } | } t | t| |}|j|S) zI Remainder nearest to 0- abs(remainder-near) <= other/2 NT)rzremainder_near(infinity, x)zremainder_near(x, 0)zremainder_near(0, 0)rQr-r+rr%r)rrrrrdr rrrrrOr6r7rr@rrr?rirVrUrr`) r.rr/r;ideal_exponentrrrrrr=r'r'r)remainder_nearsZ         zDecimal.remainder_nearcCst|}|tkr|S|dkr"t}|j||}|r6|S|jrb|jrR|jtdSt|j|jAS|s|r|jt d|j|jAS|jt dS|j ||dS)z self // otherNz INF // INFzx // 0z0 // 0r%) rrrrrrdr r<r7r rr)r.rr/r;r'r'r) __floordiv__Ls$   zDecimal.__floordiv__cCs"t|}|tkr|S|j||dS)z*Swaps self/other and returns __floordiv__.)r/)rrr)r.rr/r'r'r) __rfloordiv__hszDecimal.__rfloordiv__cCs8|jr(|jrtd|jr"dnd}nt|}t|S)zFloat representation.z%Cannot convert signaling NaN to floatz-nannan)rrrlr7r`rp)r.sr'r'r) __float__os zDecimal.__float__cCst|jr(|jrtdn|jr(tdd|j}|jdkrT|t|jd|jS|t|jd|jpjdSdS) z1Converts self to an int, truncating if necessary.zCannot convert NaN to integerz"Cannot convert infinity to integerr-r%rNrQr) rPrrlrrr7rOrUr8)r.rr'r'r)__int__ys   zDecimal.__int__cCs|S)Nr')r.r'r'r)realsz Decimal.realcCstdS)Nr%)r)r.r'r'r)imagsz Decimal.imagcCs|S)Nr')r.r'r'r) conjugateszDecimal.conjugatecCs tt|S)N)complexrp)r.r'r'r) __complex__szDecimal.__complex__cCsR|j}|j|j}t||krJ|t||djd}t|j||jdSt|S)z2Decapitate the payload of a NaN to fit the contextNrQT) r8r@clamprfrgr6r7rOr)r.r/ZpayloadZmax_payload_lenr'r'r)r9s   zDecimal._fix_nancCsX|jr |jr|j|St|S|j}|j}|s|j|g|j}tt |j ||}||j krx|j t t |jd|St|St|j|j |j}||kr|j td|j}|j t|j t|S||k}|r|}|j |krt|j|j |} | dkrt |jd|d}d} |j|j} | || } |jd| p>d} | dkr~tt| d} t| |jkr~| dd} |d7}||kr|j td|j}nt |j| |}| r|r|j t|r|j t| r|j t|j t|s|j t |S|r |j t|jdkrP|j |krP|j t |jd|j |} t |j| |St|S)zRound if it is necessary to keep self within prec precision. Rounds and fixes the exponent. Does not raise on a sNaN. Arguments: self - Decimal instance context - context used. rQz above Emaxr%rr-Nr)rPrr9rrEtoprArrrrOrdrr6r7rfr8r@rr r _pick_rounding_functionr?r`rUrr )r.r/rrexp_maxZnew_expZexp_minr;Zself_is_subnormalrxZrounding_methodchangedrrr'r'r)rsn                     z Decimal._fixcCst|j|rdSdSdS)z(Also known as round-towards-0, truncate.r%r-Nr) _all_zerosr8)r.r@r'r'r) _round_downs zDecimal._round_downcCs |j| S)zRounds away from 0.)r)r.r@r'r'r) _round_upszDecimal._round_upcCs*|j|dkrdSt|j|r"dSdSdS)zRounds 5 up (away from 0)Z56789r-r%Nr)r8r)r.r@r'r'r)_round_half_ups  zDecimal._round_half_upcCst|j|rdS|j|SdS)z Round 5 downr-Nr) _exact_halfr8r)r.r@r'r'r)_round_half_downs zDecimal._round_half_downcCs8t|j|r*|dks&|j|ddkr*dS|j|SdS)z!Round 5 to even, rest to nearest.r%r-02468Nr)rr8r)r.r@r'r'r)_round_half_even#s zDecimal._round_half_evencCs |jr|j|S|j| SdS)z(Rounds up (not away from 0 if negative.)N)r7r)r.r@r'r'r)_round_ceiling+s zDecimal._round_ceilingcCs |js|j|S|j| SdS)z'Rounds down (not towards 0 if negative)N)r7r)r.r@r'r'r) _round_floor2s zDecimal._round_floorcCs0|r |j|ddkr |j|S|j| SdS)z)Round down unless digit prec-1 is 0 or 5.r-Z05N)r8r)r.r@r'r'r) _round_05up9s zDecimal._round_05up)rrrrrrrrcCsb|dk r2t|tstdtdd| }|j|S|jrR|jrJtdntdt|j dt S)aRound self to the nearest integer, or to a given precision. If only one argument is supplied, round a finite Decimal instance self to the nearest integer. If self is infinite or a NaN then a Python exception is raised. If self is finite and lies exactly halfway between two integers then it is rounded to the integer with even last digit. >>> round(Decimal('123.456')) 123 >>> round(Decimal('-456.789')) -457 >>> round(Decimal('-3.0')) -3 >>> round(Decimal('2.5')) 2 >>> round(Decimal('3.5')) 4 >>> round(Decimal('Inf')) Traceback (most recent call last): ... OverflowError: cannot round an infinity >>> round(Decimal('NaN')) Traceback (most recent call last): ... ValueError: cannot round a NaN If a second argument n is supplied, self is rounded to n decimal places using the rounding mode for the current context. For an integer n, round(self, -n) is exactly equivalent to self.quantize(Decimal('1En')). >>> round(Decimal('123.456'), 0) Decimal('123') >>> round(Decimal('123.456'), 2) Decimal('123.46') >>> round(Decimal('123.456'), -2) Decimal('1E+2') >>> round(Decimal('-Infinity'), 37) Decimal('NaN') >>> round(Decimal('sNaN123'), 0) Decimal('NaN123') Nz+Second argument to round should be integralr%rzcannot round a NaNzcannot round an infinity) r_rUrrr6quantizerPrrlrrr)r.r5rVr'r'r) __round__Ks/   zDecimal.__round__cCs0|jr |jrtdntdt|jdtS)zReturn the floor of self, as an integer. For a finite Decimal instance self, return the greatest integer n such that n <= self. If self is infinite or a NaN then a Python exception is raised. zcannot round a NaNzcannot round an infinityr%)rPrrlrrUrr)r.r'r'r) __floor__s  zDecimal.__floor__cCs0|jr |jrtdntdt|jdtS)zReturn the ceiling of self, as an integer. For a finite Decimal instance self, return the least integer n such that n >= self. If self is infinite or a NaN then a Python exception is raised. zcannot round a NaNzcannot round an infinityr%)rPrrlrrUrr)r.r'r'r)__ceil__s  zDecimal.__ceil__cCst|dd}t|dd}|js$|jr|dkr2t}|jdkrJ|jtd|S|jdkrb|jtd|S|jdkrr|}nf|jdkr|}nV|jdkr|s|jtdSt|j|jA}n*|jdkr|s|jtd St|j|jA}n0t|j|jAt t |j t |j |j|j}|j ||S) a:Fused multiply-add. Returns self*other+third with no rounding of the intermediate product self*other. self and other are multiplied together, with no rounding of the result. The third operand is then added to the result, and a single final rounding is performed. T)rNrYrr5rZzINF * 0 in fmaz0 * INF in fma) rrPrrOrdr r<r7r6r`rUr8r)r.rZthirdr/productr'r'r)fmas6          z Decimal.fmac Cst|}|tkr|St|}|tkr(|S|dkr6t}|j}|j}|j}|sZ|sZ|r|dkrp|jtd|S|dkr|jtd|S|dkr|jtd|S|r|j|S|r|j|S|j|S|jo|jo|js|jtdS|dkr|jtdS|s |jtdS|j|j kr(|jtdS| rD| rD|jtd S|j rTd}n|j }t t |}t|j}t|j} |j |td |j||}x t| jD]} t|d |}qWt|| j |}t|t|dS) z!Three argument version of __pow__Nr+rz@pow() 3rd argument not allowed unless all arguments are integersr%zApow() 2nd argument cannot be negative when 3rd argument specifiedzpow() 3rd argument cannot be 0zSinsufficient precision: pow() 3rd argument must not have more than precision digitszXat least one of pow() 1st argument and 2nd argument must be nonzero; 0**0 is not definedr)rrrrrdr r9 _isintegerrr@_isevenr7rhrUrito_integral_valuerrVranger6r`) r.rmodulor/rrZ modulo_is_nanr=baseexponentir'r'r) _power_modulosl        zDecimal._power_modulocCst|}|j|j}}x |ddkr6|d}|d7}qWt|}|j|j}}x |ddkrn|d}|d7}qPW|dkr||9}x |ddkr|d}|d7}qW|dkrdS|d|} |jdkr| } |jo|jdkr|jt|} t| | |d} nd} tddd| | | S|jdkr|d} | dkr|| @|krPdSt |d} |d d }|t t |kr~dSt | ||} t |||}| dks|dkrdS| |krdSd | }n| d krt |dd } t d | |\}}|rdSx$|d dkr$|d }| d8} qW|dd}|t t |krHdSt | ||} t |||}| dksx|dkr|dS| |krdSd| }ndS|d|krdS| |}tdt ||S|dkr|d|d}}n|dkr t t t||| kr dSt |}|dkr>t t t||| kr>dS|d| }}x:|d|dkoldknr|d}|d}qPWx:|d |d kodknr|d }|d }qW|dkrt|dkr||krdSt ||\}}|dkrdSdt | | >}x>t |||d\}}||kr>Pn||d||}qW||koh|dkspdS|}|dkr||dt|krdS||}||9}|d|krdSt |}|jr|jdkr|jt|} t|| |t |} nd} td|d| || S)ahAttempt to compute self**other exactly. Given Decimals self and other and an integer p, attempt to compute an exact result for the power self**other, with p digits of precision. Return None if self**other is not exactly representable in p digits. Assumes that elimination of special cases has already been performed: self and other must both be nonspecial; self must be positive and not numerically equal to 1; other must be nonzero. For efficiency, other._exp should not be too large, so that 10**abs(other._exp) is a feasible calculation.rr%r-NrrQr+r]Aryr[d)r+rrr)rirUrVr=rr7rOrr6_nbitsrfr`_decimal_lshift_exactrrh _log10_lb)r.rpxxcxeyycyerrZzerosZ last_digitrZemaxrrur5Zxc_bitsremarrZstr_xcr'r'r) _power_exact(s:                  &&&&    zDecimal._power_exactcCs@|dk r|j|||St|}|tkr*|S|dkr8t}|j||}|rL|S|sd|s`|jtdStSd}|jdkr|j r|j sd}n|r|jtdS|j }|s|jdkrt |ddSt |S|jr|jdkrt |St |ddS|tkr|j rZ|jdkrd}n||jkr"|j}nt|}|j|}|d|jkrxd|j}|jtn|jt|jtd|j}t |dd| |S|j}|jr|jdk|dkkrt |ddSt |Sd}d} |j|j} |dk|jdkkr| tt|jkrHt |d|jd}n,|j} | tt| krHt |d| d}|dkr|j||jd}|dk r|dkrt d|j|j}d } |dkr:|j} t|} | j| j}}t|}|j|j}}|jdkr| }d }xJt||||| |\}}|d d tt|| drP|d 7}qWt |t||}| r2|j r2t|j|jkr|jdt|j}t |j|jd||j|}|j }|j!xt"D]}d|j#|<qW|j$|}|jt|j%t&r|jt'|j%t(r|jt(d |jx:t't&ttt)fD]}|j%|r|j|qWn |j$|}|S)aHReturn self ** other [ % modulo]. With two arguments, compute self**other. With three arguments, compute (self**other) % modulo. For the three argument form, the following restrictions on the arguments hold: - all three arguments must be integral - other must be nonnegative - either self or other (or both) must be nonzero - modulo must be nonzero and must have at most p digits, where p is the context precision. If any of these restrictions is violated the InvalidOperation flag is raised. The result of pow(self, other, modulo) is identical to the result that would be obtained by computing (self**other) % modulo with unbounded precision, but is computed more efficiently. It is always exact. Nz0 ** 0r%r-z+x ** y with x negative and y not an integerrQrFTr[ryrz above Emax)*rrrrrrdr _Oner7rrrr6r<rr@rUrOr r r_log10_exp_boundrfr`rArrr8rirVr=_dpowerrHrI_signalstrapsrflagsr rrr)r.rrr/r;Z result_signZ multiplierrVZself_adjexactZboundrr r r rrrrextrarrZ newcontextZ exceptionr'r'r)__pow__ s                        "         zDecimal.__pow__cCs"t|}|tkr|S|j||dS)z%Swaps self/other and returns __pow__.)r/)rrr)r.rr/r'r'r)__rpow__ szDecimal.__rpow__cCs|dkrt}|jr(|j|d}|r(|S|j|}|jr>|S|sPt|jddS|j|jg|j }t |j }|j }x.|j |ddkr||kr|d7}|d8}qvWt|j|j d||S)z?Normalize- strip trailing 0s, change anything equal to 0 to 0e0N)r/rQr%r-) rrPrrrr6r7rArrrfr8rO)r.r/r;duprendrVr'r'r) normalize s$    zDecimal.normalizecCst|dd}|dkrt}|dkr(|j}|js4|jr||j||}|rH|S|jsX|jr||jrp|jrpt|S|jtdS|j |j ko|j kns|jtdS|st |j d|j }|j|S|j}||j kr|jtdS||j d|jkr|jtd S|j|j |}|j|j kr0|jtdSt|j|jkrN|jtd S|rn|j|jkrn|jt|j |j kr||kr|jt|jt|j|}|S) zQuantize self so its exponent is the same as that of exp. Similar to self._rescale(exp._exp) but with error checking. T)rNzquantize with one INFz)target exponent out of bounds in quantizerQz9exponent of quantize result too large for current contextr-z7quantize result has too many digits for current context)rrr?rPrrrrdr rrOrAr6r7rrr@rrfr8Eminr r r )r.rVr?r/r;rr'r'r)r sT           zDecimal.quantizecCsDt|dd}|js|jr8|jr(|jp6|jo6|jS|j|jkS)a=Return True if self and other have the same exponent; otherwise return False. If either operand is a special value, the following rules are used: * return True if both operands are infinities * return True if both operands are NaNs * otherwise, return False. T)r)rrPr is_infiniterO)r.rr/r'r'r) same_quantumJ s  zDecimal.same_quantumcCs|jrt|S|s t|jd|S|j|krHt|j|jd|j||St|j|j|}|dkrzt|jd|d}d}|j|}|||}|jd|pd}|dkrtt |d}t|j||S)asRescale self so that the exponent is exp, either by padding with zeros or by truncating digits, using the given rounding mode. Specials are returned without change. This operation is quiet: it raises no flags, and uses no information from the context. exp = exp to scale to (an integer) rounding = rounding mode rQr%rr-N) rPrr6r7rOr8rfrr`rU)r.rVr?rxZ this_functionrrr'r'r)rY s"    zDecimal._rescalecCsh|dkrtd|js| r$t|S|j|jd||}|j|jkrd|j|jd||}|S)a"Round a nonzero, nonspecial Decimal to a fixed number of significant figures, using the given rounding mode. Infinities, NaNs and zeros are returned unaltered. This operation is quiet: it raises no flags, and uses no information from the context. r%z'argument should be at least 1 in _roundr-)rlrPrrr)r.placesr?r;r'r'r)_round{ s  zDecimal._roundcCs|jr"|j|d}|r|St|S|jdkr4t|S|sFt|jddS|dkrTt}|dkrb|j}|jd|}||kr|j t |j t |S)aVRounds to a nearby integer. If no rounding mode is specified, take the rounding mode from the context. This method raises the Rounded and Inexact flags when appropriate. See also: to_integral_value, which does exactly the same as this method except that it doesn't raise Inexact or Rounded. )r/r%rQN) rPrrrOr6r7rr?rrdr r )r.r?r/r;r'r'r)to_integral_exact s$      zDecimal.to_integral_exactcCs`|dkrt}|dkr|j}|jr>|j|d}|r6|St|S|jdkrPt|S|jd|SdS)z@Rounds to the nearest integer, without raising inexact, rounded.N)r/r%)rr?rPrrrOr)r.r?r/r;r'r'r)r s  zDecimal.to_integral_valuecCs|dkrt}|jrB|j|d}|r(|S|jrB|jdkrBt|S|sdt|jd|jd}|j|S|jdkrz|j t dS|j d}t |}|j d?}|j d@r|jd}t|jd?d}n|j}t|jdd?}||}|dkr|d |9}d } nt|d | \}} | } ||8}d|} x(|| } | | kr:Pn | | d?} q$W| o\| | |k} | r|dkr|| d|} n| d| 9} ||7}n| d dkr| d7} tdt| |}|j}|jt} |j|}| |_|S) zReturn the square root of self.N)r/r%rQr+r-zsqrt(-x), x > 0rrTry)rrPrrr7rr6rOrrdr r@rirVrUrfr8rr` _shallow_copy _set_roundingrr?)r.r/r;r@oprclrrrr5rr?r'r'r)sqrt s`              z Decimal.sqrtcCst|dd}|dkrt}|js&|jr~|j}|j}|s>|r~|dkrX|dkrX|j|S|dkrr|dkrr|j|S|j||S|j|}|dkr|j|}|dkr|}n|}|j|S)zReturns the larger value. Like max(self, other) except if one is not a number, returns NaN (and signals if one is sNaN). Also rounds. T)rNr-r%r)rrrPrrrr compare_total)r.rr/snonr+r;r'r'r)r% s&       z Decimal.maxcCst|dd}|dkrt}|js&|jr~|j}|j}|s>|r~|dkrX|dkrX|j|S|dkrr|dkrr|j|S|j||S|j|}|dkr|j|}|dkr|}n|}|j|S)zReturns the smaller value. Like min(self, other) except if one is not a number, returns NaN (and signals if one is sNaN). Also rounds. T)rNr-r%r)rrrPrrrrr.)r.rr/r/r0r+r;r'r'r)rO s&       z Decimal.mincCs8|jr dS|jdkrdS|j|jd}|dt|kS)z"Returns whether self is an integerFr%TNrQ)rPrOr8rf)r.restr'r'r)rq s  zDecimal._isintegercCs(| s|jdkrdS|jd|jdkS)z:Returns True if self is even. Assumes self is an integer.r%Tr-rr)rOr8)r.r'r'r)rz szDecimal._isevenc Cs.y|jt|jdStk r(dSXdS)z$Return the adjusted exponent of selfr-r%N)rOrfr8rr)r.r'r'r)r szDecimal.adjustedcCs|S)zReturns the same Decimal object. As we do not have different encodings for the same number, the received object already is in its canonical form. r')r.r'r'r) canonical szDecimal.canonicalcCs.t|dd}|j||}|r |S|j||dS)zCompares self to the other operand numerically. It's pretty much like compare(), but all NaNs signal, with signaling NaNs taking precedence over quiet NaNs. T)r)r/)rrr)r.rr/r;r'r'r)compare_signal s   zDecimal.compare_signalcCsft|dd}|jr|j rtS|j r0|jr0tS|j}|j}|j}|sP|r||krt|j|jf}t|j|jf}||kr|rtStS||kr|rtStStS|r|dkrtS|dkrtS|dkrtS|dkrtSn4|dkrtS|dkrtS|dkrtS|dkrtS||krtS||kr*tS|j|jkrF|rBtStS|j|jkrb|r^tStStS)zCompares self to other using the abstract representations. This is not like the standard compare, which use their numerical value. Note that a total ordering is defined for all possible abstract representations. T)rr-r+) rr7 _NegativeOnerrrfr8_ZerorO)r.rr/r=Zself_nanZ other_nanZself_keyZ other_keyr'r'r)r. sf      zDecimal.compare_totalcCs&t|dd}|j}|j}|j|S)zCompares self to other using abstract repr., ignoring sign. Like compare_total, but with operand's sign ignored and assumed to be 0. T)r)rrr.)r.rr/ror'r'r)compare_total_mag s zDecimal.compare_total_magcCstd|j|j|jS)z'Returns a copy with the sign set to 0. r%)r6r8rOrP)r.r'r'r)r szDecimal.copy_abscCs2|jrtd|j|j|jStd|j|j|jSdS)z&Returns a copy with the sign inverted.r%r-N)r7r6r8rOrP)r.r'r'r)r szDecimal.copy_negatecCs"t|dd}t|j|j|j|jS)z$Returns self with the sign of other.T)r)rr6r7r8rOrP)r.rr/r'r'r) copy_sign s  zDecimal.copy_signc Cs|dkrt}|j|d}|r"|S|jd kr2tS|s:tS|jdkrNt|S|j}|j}|jdkr|t t |j ddkrt dd|j d}n0|jdkr|t t |j ddkrt dd|j d}n|jdko|| kr t ddd|dd| }n|jdkrB|| dkrBt dd|d| d}nt|}|j|j}}|jdkrj| }d}xFt||||\} } | d d t t | |drP|d7}qpWt dt | | }|j}|jt} |j|}| |_|S) zReturns e ** self.N)r/r-r%r[rrQr>ryrr)rrrr5rrr@rr7rfr`rAr6rrirUrVr=_dexpr(r)rrr?) r.r/r;r adjr*r+rrrrVr?r'r'r)rV sJ   $(  "  z Decimal.expcCsdS)zReturn True if self is canonical; otherwise return False. Currently, the encoding of a Decimal instance is always canonical, so this method returns True for any Decimal. Tr')r.r'r'r) is_canonicalL szDecimal.is_canonicalcCs|j S)zReturn True if self is finite; otherwise return False. A Decimal instance is considered finite if it is neither infinite nor a NaN. )rP)r.r'r'r) is_finiteT szDecimal.is_finitecCs |jdkS)z8Return True if self is infinite; otherwise return False.rZ)rO)r.r'r'r)r#\ szDecimal.is_infinitecCs |jdkS)z>Return True if self is a qNaN or sNaN; otherwise return False.r5rY)r5rY)rO)r.r'r'r)r` szDecimal.is_nancCs,|js | rdS|dkrt}|j|jkS)z?Return True if self is a normal number; otherwise return False.FN)rPrr"r)r.r/r'r'r) is_normald s  zDecimal.is_normalcCs |jdkS)z;Return True if self is a quiet NaN; otherwise return False.r5)rO)r.r'r'r)rl szDecimal.is_qnancCs |jdkS)z8Return True if self is negative; otherwise return False.r-)r7)r.r'r'r) is_signedp szDecimal.is_signedcCs |jdkS)z?Return True if self is a signaling NaN; otherwise return False.rY)rO)r.r'r'r)rt szDecimal.is_snancCs,|js | rdS|dkrt}|j|jkS)z9Return True if self is subnormal; otherwise return False.FN)rPrrr")r.r/r'r'r) is_subnormalx s  zDecimal.is_subnormalcCs|j o|jdkS)z6Return True if self is a zero; otherwise return False.rQ)rPr8)r.r'r'r)is_zero szDecimal.is_zerocCs|jt|jd}|dkr4tt|dddS|dkrXttd|dddSt|}|j|j}}|dkrt|d| }t|}t|t|||kS|ttd| |dS)zCompute a lower bound for the adjusted exponent of self.ln(). In other words, compute r such that self.ln() >= 10**r. Assumes that self is finite and positive and that self != 1. r-rr+r%rr)rOrfr8r`rirUrV)r.r:r*r+rnumdenr'r'r) _ln_exp_bound szDecimal._ln_exp_boundc Cs |dkrt}|j|d}|r"|S|s*tS|jdkr:tS|tkrFtS|jdkr\|jt dSt |}|j |j }}|j }||jd}x>t|||}|ddttt||drP|d7}qWtt |d ktt|| }|j}|jt} |j|}| |_|S) z/Returns the natural (base e) logarithm of self.N)r/r-zln of a negative valuer+ryrr[r%)rr_NegativeInfinityr _Infinityrr5r7rdr rirUrVr@rD_dlogrfr`rhr6r(r)rrr?) r.r/r;r*r+rr r%rr?r'r'r)ln s:    $   z Decimal.lncCs|jt|jd}|dkr,tt|dS|dkrHttd|dSt|}|j|j}}|dkrt|d| }td|}t|t|||kdStd| |}t|||dkdS) zCompute a lower bound for the adjusted exponent of self.log10(). In other words, find r such that self.log10() >= 10**r. Assumes that self is finite and positive and that self != 1. r-r+r%rZ231rr)rOrfr8r`rirUrV)r.r:r*r+rrBrCr'r'r)r s  zDecimal._log10_exp_boundc CsH|dkrt}|j|d}|r"|S|s*tS|jdkr:tS|jdkrP|jtdS|jddkr|jdddt |jdkrt |j t |jd}nt |}|j |j}}|j}||jd}x>t|||}|d d t tt||drP|d 7}qWtt |dktt|| }|j}|jt} |j|}| |_|S) z&Returns the base 10 logarithm of self.N)r/r-zlog10 of a negative valuer%rrQr+ryrr[)rrrErrFr7rdr r8rfrrOrirUrVr@r_dlog10r`rhr6r(r)rrr?) r.r/r;r*r+rr r%rr?r'r'r)log10 s:   . $   z Decimal.log10cCsV|j|d}|r|S|dkr"t}|jr.tS|s@|jtddSt|j}|j|S)aM Returns the exponent of the magnitude of self's MSD. The result is the integer which is the exponent of the magnitude of the most significant digit of self (as though it were truncated to a single digit while maintaining the value of that digit and without limiting the resulting exponent). )r/Nzlogb(0)r-) rrrrFrdr rrr)r.r/r;r'r'r)logb s  z Decimal.logbcCs8|jdks|jdkrdSx|jD]}|dkr dSq WdS)zReturn True if self is a logical operand. For being logical, it must be a finite number with a sign of 0, an exponent of 0, and a coefficient whose digits must all be either 0 or 1. r%FZ01T)r7rOr8)r.digr'r'r) _islogical> s  zDecimal._islogicalcCs|jt|}|dkr$d||}n|dkr<||j d}|jt|}|dkr`d||}n|dkrx||j d}||fS)Nr%rQ)r@rf)r.r/opaopbZdifr'r'r) _fill_logicalL szDecimal._fill_logicalcCs~|dkrt}t|dd}|j s.|j r8|jtS|j||j|j\}}djddt||D}t d|j dpxddS) z;Applies an 'and' operation between self and other's digits.NT)rrScSs$g|]\}}tt|t|@qSr')r`rU).0rbr'r'r) g sz'Decimal.logical_and..r%rQ) rrrNrdr rQr8rnzipr6rg)r.rr/rOrPrr'r'r) logical_andY s  zDecimal.logical_andcCs(|dkrt}|jtdd|jd|S)zInvert all its digits.Nr%r)r logical_xorr6r@)r.r/r'r'r)logical_invertj szDecimal.logical_invertcCs~|dkrt}t|dd}|j s.|j r8|jtS|j||j|j\}}djddt||D}t d|j dpxddS) z:Applies an 'or' operation between self and other's digits.NT)rrScSs$g|]\}}tt|t|BqSr')r`rU)rRrrSr'r'r)rT sz&Decimal.logical_or..r%rQ) rrrNrdr rQr8rnrUr6rg)r.rr/rOrPrr'r'r) logical_orq s  zDecimal.logical_orcCs~|dkrt}t|dd}|j s.|j r8|jtS|j||j|j\}}djddt||D}t d|j dpxddS) z;Applies an 'xor' operation between self and other's digits.NT)rrScSs$g|]\}}tt|t|AqSr')r`rU)rRrrSr'r'r)rT sz'Decimal.logical_xor..r%rQ) rrrNrdr rQr8rnrUr6rg)r.rr/rOrPrr'r'r)rW s  zDecimal.logical_xorcCst|dd}|dkrt}|js&|jr~|j}|j}|s>|r~|dkrX|dkrX|j|S|dkrr|dkrr|j|S|j||S|jj|j}|dkr|j|}|dkr|}n|}|j|S)z8Compares the values numerically with their sign ignored.T)rNr-r%r) rrrPrrrrrr.)r.rr/r/r0r+r;r'r'r)max_mag s&      zDecimal.max_magcCst|dd}|dkrt}|js&|jr~|j}|j}|s>|r~|dkrX|dkrX|j|S|dkrr|dkrr|j|S|j||S|jj|j}|dkr|j|}|dkr|}n|}|j|S)z8Compares the values numerically with their sign ignored.T)rNr-r%r) rrrPrrrrrr.)r.rr/r/r0r+r;r'r'r)min_mag s&      zDecimal.min_magcCs|dkrt}|j|d}|r"|S|jdkr2tS|jdkrTtdd|j|jS|j}|jt |j |j |}||kr|S|j tdd|j d|S)z=Returns the largest representable number smaller than itself.N)r/r-r%r>rr)rrrrEr6r@rrHr)r_ignore_all_flagsrrr)r.r/r;new_selfr'r'r) next_minus s"     zDecimal.next_minuscCs|dkrt}|j|d}|r"|S|jdkr2tS|jdkrTtdd|j|jS|j}|jt |j |j |}||kr|S|j tdd|j d|S)z=Returns the smallest representable number larger than itself.N)r/r-r>r%rr)rrrrFr6r@rrHr)rr\rrr)r.r/r;r]r'r'r) next_plus s"     zDecimal.next_pluscCst|dd}|dkrt}|j||}|r.|S|j|}|dkrJ|j|S|dkr^|j|}n |j|}|jr|jt d|j |jt |jt nD|j |jkr|jt|jt|jt |jt |s|jt|S)aReturns the number closest to self, in the direction towards other. The result is the closest representable number to self (excluding self) that is in the direction towards other, unless both have the same value. If the two operands are numerically equal, then the result is a copy of self with the sign set to be the same as the sign of other. T)rNr%r-z Infinite result from next_towardr)rrrrr8r_r^rrdrr7r r rr"rr r)r.rr/r;Z comparisonr'r'r) next_toward s4             zDecimal.next_towardcCs|jr dS|jrdS|j}|dkr,dS|dkr8dS|jrN|jrJdSdS|dkr\t}|j|d rv|jrrd Sd S|jrd Sd SdS)aReturns an indication of the class of self. The class is one of the following strings: sNaN NaN -Infinity -Normal -Subnormal -Zero +Zero +Subnormal +Normal +Infinity rrr-z +Infinityz -Infinityz-Zeroz+ZeroN)r/z -Subnormalz +Subnormalz-Normalz+Normalr)rrrr@r7rr?)r.r/infr'r'r) number_class+s, zDecimal.number_classcCstdS)z'Just returns 10, as this is Decimal, :)r)r)r.r'r'r)radixUsz Decimal.radixcCs|dkrt}t|dd}|j||}|r.|S|jdkrB|jtS|j t|ko^|jknsn|jtS|jr~t |St|}|j }|jt |}|dkrd||}n|dkr|| d}||d|d|}t |j |jdpd|jS)z5Returns a rotated copy of self, value-of-other times.NT)rr%rQ)rrrrOrdr r@rUrrr8rfr6r7rg)r.rr/r;torotrotdigtopadZrotatedr'r'r)rotateYs,    " zDecimal.rotatecCs|dkrt}t|dd}|j||}|r.|S|jdkrB|jtSd|j|j}d|j|j}|t|kox|kns|jtS|j rt |St |j |j |jt|}|j|}|S)z>Returns self operand after adding the second value to its exp.NT)rr%r+r)rrrrOrdr rAr@rUrrr6r7r8r)r.rr/r;ZliminfZlimsuprr'r'r)scalebzs"      zDecimal.scalebcCs|dkrt}t|dd}|j||}|r.|S|jdkrB|jtS|j t|ko^|jknsn|jtS|jr~t |St|}|j }|jt |}|dkrd||}n|dkr|| d}|dkr|d|}n|d|}||j d}t |j |jdp d|jS)z5Returns a shifted copy of self, value-of-other times.NT)rr%rQ)rrrrOrdr r@rUrrr8rfr6r7rg)r.rr/r;rdrerfZshiftedr'r'r)rs2    "  z Decimal.shiftcCs|jt|ffS)N) __class__r`)r.r'r'r) __reduce__szDecimal.__reduce__cCst|tkr|S|jt|S)N)typerrir`)r.r'r'r)__copy__s zDecimal.__copy__cCst|tkr|S|jt|S)N)rkrrir`)r.memor'r'r) __deepcopy__s zDecimal.__deepcopy__cCsN|dkrt}t||d}|jrXt|j|}t|j}|ddkrL|d7}t|||S|ddkrvddg|j|d<|ddkrt |j|j |j d}|j }|d}|dk r|dd kr|j |d |}nF|dd kr|j| |}n*|dd krt|j |kr|j ||}| rB|j d krB|dd krB|jd |}|j t|j } |dd kr| r||dk r|d |} nd } nB|dd kr| } n.|dd kr|j d kr| dkr| } nd } | d krd} d| |j } nP| t|j kr|j d| t|j } d} n"|j d| p$d} |j | d} | | } t|j| | | |S)a|Format a Decimal instance according to the given specifier. The specifier should be a standard format specifier, with the form described in PEP 3101. Formatting types 'e', 'E', 'f', 'F', 'g', 'G', 'n' and '%' are supported. If the formatting type is omitted it defaults to 'g' or 'G', depending on the value of context.capitals. N) _localeconvrk%gGr+ precisioneEr-zfF%ZgGr%rrQrSi)r_parse_format_specifierrP _format_signr7r`r _format_alignrr6r8rOr?r&rrf_format_number)r.Z specifierr/rospecr=bodyr?rsrrrvrwrVr'r'r) __format__sZ           "   zDecimal.__format__)rOr8r7rP)rQN)NN)N)N)N)N)N)N)FN)N)N)N)TN)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)NN)N)N)NN)N)NN)NN)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)NN)r1r2r3r4 __slots__r^ classmethodrqrrrrrrrrrrrrrrr|rrrrrrr__radd__rrr__rmul__rrrrrrrrrrrr __trunc__rpropertyrrrr9rrrrrrrrrdictrrrrrrrrrr!rr$rr&r'r to_integralr-rrrrrr2r3r.r7rrr8rVr;r<r#rr=rr>rr?r@rDrHrrKrLrNrQrVrXrYrWrZr[r^r_r`rbrcrgrhrrjrlrnr{r'r'r'r)r+s  ( !@  2 4    V   7 ;!  $    K     f  > , Un Y   = "   c * "  I   K   2 3          . * !  'FcCs&tjt}||_||_||_||_|S)zCreate a decimal instance directly, without any validation, normalization (e.g. removal of leading zeros) or argument conversion. This function is for *internal use only*. )r]r^rr7r8rOrP)r=Z coefficientrZspecialr.r'r'r)r6s  r6c@s(eZdZdZddZddZddZdS) rNzContext manager class to support localcontext(). Sets a copy of the supplied context in __enter__() and restores the previous decimal context in __exit__() cCs|j|_dS)N)rH new_context)r.rr'r'r)__init__9sz_ContextManager.__init__cCst|_t|j|jS)N)r saved_contextrr)r.r'r'r) __enter__;s z_ContextManager.__enter__cCst|jdS)N)rr)r.tvtbr'r'r)__exit__?sz_ContextManager.__exit__N)r1r2r3r4rrrr'r'r'r)rN3srNc @seZdZdZdddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZeZdddZddZddZdd ZdZd!d"Zd#d$Zd%d&Zdd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Z d:d;Z!dd?Z#d@dAZ$dBdCZ%dDdEZ&dFdGZ'dHdIZ(dJdKZ)dLdMZ*dNdOZ+dPdQZ,dRdSZ-dTdUZ.dVdWZ/dXdYZ0dZd[Z1d\d]Z2d^d_Z3d`daZ4dbdcZ5dddeZ6dfdgZ7dhdiZ8djdkZ9dldmZ:dndoZ;dpdqZdvdwZ?dxdyZ@dzd{ZAd|d}ZBd~dZCddZDddZEddZFddZGdddZHddZIddZJddZKddZLddZMddZNddZOddZPddZQddZRddZSddZTddZUddZVeVZWdS)raContains the context for a Decimal instance. Contains: prec - precision (for use in rounding, division, square roots..) rounding - rounding type (how you round) traps - If traps[exception] = 1, then the exception is raised when it is caused. Otherwise, a value is substituted in. flags - When an exception is caused, flags[exception] is set. (Whether or not the trap_enabler is set) Should be reset by user of Decimal instance. Emin - Minimum exponent Emax - Maximum exponent capitals - If 1, 1*10^1 is printed as 1E+1. If 0, printed as 1e1 clamp - If 1, change exponents if too high (Default 0) Nc s>yt} Wntk rYnX|dk r*|n| j|_|dk r>|n| j|_|dk rR|n| j|_|dk rf|n| j|_|dk rz|n| j|_|dk r|n| j|_| dkrg|_n| |_dkr| j j |_ n.t t st fddt D|_ n|_ dkr t jt d|_n0t t s4t fddt D|_n|_dS)Nc3s|]}|t|kfVqdS)N)rU)rRr)rr'r) nsz#Context.__init__..r%c3s|]}|t|kfVqdS)N)rU)rRr)rr'r)rus)r NameErrorr@r?r"rArr_ignored_flagsrrHr_rrfromkeysr) r.r@r?r"rArrrrrZdcr')rrr)rUs.   zContext.__init__cCst|tstd||dkr<||krtd||||fnJ|dkrb||krtd||||fn$||ksr||krtd||||ftj|||S)Nz%s must be an integerz-infz%s must be in [%s, %d]. got: %sraz%s must be in [%d, %s]. got: %sz%s must be in [%d, %d]. got %s)r_rUrrrlr] __setattr__)r.namertZvminZvmaxr'r'r)_set_integer_checkys  zContext._set_integer_checkcCsht|tstd|x |D]}|tkrtd|qWx tD]}||kr>td|q>Wtj|||S)Nz%s must be a signal dictz%s is not a valid signal dict)r_rrrrKeyErrorr]r)r.rrkeyr'r'r)_set_signal_dicts    zContext._set_signal_dictcCs|dkr|j||ddS|dkr0|j||ddS|dkrH|j||ddS|dkr`|j||ddS|d krx|j||ddS|d kr|tkrtd |tj|||S|d ks|d kr|j||S|dkrtj|||Std|dS)Nr@r-rar"z-infr%rArrr?z%s: invalid rounding moderrrz.'decimal.Context' object has no attribute '%s')r_rounding_modesrrr]rrrL)r.rrtr'r'r)rs(  zContext.__setattr__cCstd|dS)Nz%s cannot be deleted)rL)r.rr'r'r) __delattr__szContext.__delattr__c CsNdd|jjD}dd|jjD}|j|j|j|j|j|j|j ||ffS)NcSsg|]\}}|r|qSr'r')rRsigrr'r'r)rTsz&Context.__reduce__..cSsg|]\}}|r|qSr'r')rRrrr'r'r)rTs) ritemsrrir@r?r"rArr)r.rrr'r'r)rjs zContext.__reduce__cCs|g}|jdt|dd|jjD}|jddj|ddd|jjD}|jddj|ddj|d S) zShow the current context.zrContext(prec=%(prec)d, rounding=%(rounding)s, Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)d, clamp=%(clamp)dcSsg|]\}}|r|jqSr')r1)rRr~rr'r'r)rTsz$Context.__repr__..zflags=[z, ]cSsg|]\}}|r|jqSr')r1)rRrrr'r'r)rTsztraps=[))rmvarsrrrnr)r.rnamesr'r'r)rs zContext.__repr__cCsx|jD]}d|j|<qWdS)zReset all flags to zeror%N)r)r.flagr'r'r)rIs zContext.clear_flagscCsx|jD]}d|j|<qWdS)zReset all traps to zeror%N)r)r.rr'r'r) clear_trapss zContext.clear_trapsc Cs.t|j|j|j|j|j|j|j|j|j }|S)z!Returns a shallow copy from self.) rr@r?r"rArrrrr)r.ncr'r'r)r(szContext._shallow_copyc Cs6t|j|j|j|j|j|j|jj|j j|j }|S)zReturns a deep copy from self.) rr@r?r"rArrrrHrr)r.rr'r'r)rHs z Context.copycGsZtj||}||jkr(|j|f|Sd|j|<|j|sN|j|f|S||dS)a#Handles an error If the flag is in _ignored_flags, returns the default response. Otherwise, it sets the flag, then, if the corresponding trap_enabler is set, it reraises the exception. Otherwise, it returns the default value after setting the flag. r-N)_condition_mapgetrr0rr)r.Z conditionZ explanationr(errorr'r'r)rds    zContext._raise_errorcCs |jtS)z$Ignore all flags, if they are raised) _ignore_flagsr)r.r'r'r)r\szContext._ignore_all_flagscGs|jt||_t|S)z$Ignore the flags, if they are raised)rrj)r.rr'r'r)rszContext._ignore_flagscGs<|rt|dttfr|d}x|D]}|jj|q$WdS)z+Stop ignoring the flags, if they are raisedr%N)r_rkrjrremove)r.rrr'r'r) _regard_flagss zContext._regard_flagscCst|j|jdS)z!Returns Etiny (= Emin - prec + 1)r-)rUr"r@)r.r'r'r)rsz Context.EtinycCst|j|jdS)z,Returns maximum exponent (= Emax - prec + 1)r-)rUrAr@)r.r'r'r)r sz Context.EtopcCs|j}||_|S)aSets the rounding type. Sets the rounding type, and returns the current (previous) rounding type. Often used like: context = context.copy() # so you don't change the calling context # if an error occurs in the middle. rounding = context._set_rounding(ROUND_UP) val = self.__sub__(other, context=context) context._set_rounding(rounding) This will make it round up for that operation. )r?)r.rkr?r'r'r)r)szContext._set_roundingrQcCsjt|tr*||jksd|kr*|jtdSt||d}|jr`t|j|j |j kr`|jtdS|j |S)zCreates a new Decimal instance but using self as context. This method implements the to-number operation of the IBM Decimal specification.rRzAtrailing or leading whitespace and underscores are not permitted.)r/zdiagnostic info too long in NaN) r_r`rbrdrrrrfr8r@rr)r.rBrr'r'r)create_decimal#s zContext.create_decimalcCstj|}|j|S)aCreates a new Decimal instance from a float but rounding using self as the context. >>> context = Context(prec=5, rounding=ROUND_DOWN) >>> context.create_decimal_from_float(3.1415926535897932) Decimal('3.1415') >>> context = Context(prec=5, traps=[Inexact]) >>> context.create_decimal_from_float(3.1415926535897932) Traceback (most recent call last): ... decimal.Inexact: None )rrqr)r.r~rr'r'r)create_decimal_from_float4s z!Context.create_decimal_from_floatcCst|dd}|j|dS)a[Returns the absolute value of the operand. If the operand is negative, the result is the same as using the minus operation on the operand. Otherwise, the result is the same as using the plus operation on the operand. >>> ExtendedContext.abs(Decimal('2.1')) Decimal('2.1') >>> ExtendedContext.abs(Decimal('-100')) Decimal('100') >>> ExtendedContext.abs(Decimal('101.5')) Decimal('101.5') >>> ExtendedContext.abs(Decimal('-101.5')) Decimal('101.5') >>> ExtendedContext.abs(-1) Decimal('1') T)r)r/)rr)r.rr'r'r)rhFs z Context.abscCs8t|dd}|j||d}|tkr0td|n|SdS)aReturn the sum of the two operands. >>> ExtendedContext.add(Decimal('12'), Decimal('7.00')) Decimal('19.00') >>> ExtendedContext.add(Decimal('1E+2'), Decimal('1.01E+4')) Decimal('1.02E+4') >>> ExtendedContext.add(1, Decimal(2)) Decimal('3') >>> ExtendedContext.add(Decimal(8), 5) Decimal('13') >>> ExtendedContext.add(5, 5) Decimal('10') T)r)r/zUnable to convert %s to DecimalN)rrrrr)r.rrSrr'r'r)add[s  z Context.addcCst|j|S)N)r`r)r.rr'r'r)_applypszContext._applycCst|tstd|jS)zReturns the same Decimal object. As we do not have different encodings for the same number, the received object already is in its canonical form. >>> ExtendedContext.canonical(Decimal('2.50')) Decimal('2.50') z,canonical requires a Decimal as an argument.)r_rrrr2)r.rr'r'r)r2ss zContext.canonicalcCst|dd}|j||dS)aCompares values numerically. If the signs of the operands differ, a value representing each operand ('-1' if the operand is less than zero, '0' if the operand is zero or negative zero, or '1' if the operand is greater than zero) is used in place of that operand for the comparison instead of the actual operand. The comparison is then effected by subtracting the second operand from the first and then returning a value according to the result of the subtraction: '-1' if the result is less than zero, '0' if the result is zero or negative zero, or '1' if the result is greater than zero. >>> ExtendedContext.compare(Decimal('2.1'), Decimal('3')) Decimal('-1') >>> ExtendedContext.compare(Decimal('2.1'), Decimal('2.1')) Decimal('0') >>> ExtendedContext.compare(Decimal('2.1'), Decimal('2.10')) Decimal('0') >>> ExtendedContext.compare(Decimal('3'), Decimal('2.1')) Decimal('1') >>> ExtendedContext.compare(Decimal('2.1'), Decimal('-3')) Decimal('1') >>> ExtendedContext.compare(Decimal('-3'), Decimal('2.1')) Decimal('-1') >>> ExtendedContext.compare(1, 2) Decimal('-1') >>> ExtendedContext.compare(Decimal(1), 2) Decimal('-1') >>> ExtendedContext.compare(1, Decimal(2)) Decimal('-1') T)r)r/)rr)r.rrSr'r'r)rs! zContext.comparecCst|dd}|j||dS)aCompares the values of the two operands numerically. It's pretty much like compare(), but all NaNs signal, with signaling NaNs taking precedence over quiet NaNs. >>> c = ExtendedContext >>> c.compare_signal(Decimal('2.1'), Decimal('3')) Decimal('-1') >>> c.compare_signal(Decimal('2.1'), Decimal('2.1')) Decimal('0') >>> c.flags[InvalidOperation] = 0 >>> print(c.flags[InvalidOperation]) 0 >>> c.compare_signal(Decimal('NaN'), Decimal('2.1')) Decimal('NaN') >>> print(c.flags[InvalidOperation]) 1 >>> c.flags[InvalidOperation] = 0 >>> print(c.flags[InvalidOperation]) 0 >>> c.compare_signal(Decimal('sNaN'), Decimal('2.1')) Decimal('NaN') >>> print(c.flags[InvalidOperation]) 1 >>> c.compare_signal(-1, 2) Decimal('-1') >>> c.compare_signal(Decimal(-1), 2) Decimal('-1') >>> c.compare_signal(-1, Decimal(2)) Decimal('-1') T)r)r/)rr3)r.rrSr'r'r)r3s zContext.compare_signalcCst|dd}|j|S)a+Compares two operands using their abstract representation. This is not like the standard compare, which use their numerical value. Note that a total ordering is defined for all possible abstract representations. >>> ExtendedContext.compare_total(Decimal('12.73'), Decimal('127.9')) Decimal('-1') >>> ExtendedContext.compare_total(Decimal('-127'), Decimal('12')) Decimal('-1') >>> ExtendedContext.compare_total(Decimal('12.30'), Decimal('12.3')) Decimal('-1') >>> ExtendedContext.compare_total(Decimal('12.30'), Decimal('12.30')) Decimal('0') >>> ExtendedContext.compare_total(Decimal('12.3'), Decimal('12.300')) Decimal('1') >>> ExtendedContext.compare_total(Decimal('12.3'), Decimal('NaN')) Decimal('-1') >>> ExtendedContext.compare_total(1, 2) Decimal('-1') >>> ExtendedContext.compare_total(Decimal(1), 2) Decimal('-1') >>> ExtendedContext.compare_total(1, Decimal(2)) Decimal('-1') T)r)rr.)r.rrSr'r'r)r.s zContext.compare_totalcCst|dd}|j|S)zCompares two operands using their abstract representation ignoring sign. Like compare_total, but with operand's sign ignored and assumed to be 0. T)r)rr7)r.rrSr'r'r)r7s zContext.compare_total_magcCst|dd}|jS)aReturns a copy of the operand with the sign set to 0. >>> ExtendedContext.copy_abs(Decimal('2.1')) Decimal('2.1') >>> ExtendedContext.copy_abs(Decimal('-100')) Decimal('100') >>> ExtendedContext.copy_abs(-1) Decimal('1') T)r)rr)r.rr'r'r)rs zContext.copy_abscCst|dd}t|S)aReturns a copy of the decimal object. >>> ExtendedContext.copy_decimal(Decimal('2.1')) Decimal('2.1') >>> ExtendedContext.copy_decimal(Decimal('-1.00')) Decimal('-1.00') >>> ExtendedContext.copy_decimal(1) Decimal('1') T)r)rr)r.rr'r'r) copy_decimals zContext.copy_decimalcCst|dd}|jS)a(Returns a copy of the operand with the sign inverted. >>> ExtendedContext.copy_negate(Decimal('101.5')) Decimal('-101.5') >>> ExtendedContext.copy_negate(Decimal('-101.5')) Decimal('101.5') >>> ExtendedContext.copy_negate(1) Decimal('-1') T)r)rr)r.rr'r'r)rs zContext.copy_negatecCst|dd}|j|S)aCopies the second operand's sign to the first one. In detail, it returns a copy of the first operand with the sign equal to the sign of the second operand. >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('7.33')) Decimal('1.50') >>> ExtendedContext.copy_sign(Decimal('-1.50'), Decimal('7.33')) Decimal('1.50') >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('-7.33')) Decimal('-1.50') >>> ExtendedContext.copy_sign(Decimal('-1.50'), Decimal('-7.33')) Decimal('-1.50') >>> ExtendedContext.copy_sign(1, -2) Decimal('-1') >>> ExtendedContext.copy_sign(Decimal(1), -2) Decimal('-1') >>> ExtendedContext.copy_sign(1, Decimal(-2)) Decimal('-1') T)r)rr8)r.rrSr'r'r)r8s zContext.copy_signcCs8t|dd}|j||d}|tkr0td|n|SdS)aDecimal division in a specified context. >>> ExtendedContext.divide(Decimal('1'), Decimal('3')) Decimal('0.333333333') >>> ExtendedContext.divide(Decimal('2'), Decimal('3')) Decimal('0.666666667') >>> ExtendedContext.divide(Decimal('5'), Decimal('2')) Decimal('2.5') >>> ExtendedContext.divide(Decimal('1'), Decimal('10')) Decimal('0.1') >>> ExtendedContext.divide(Decimal('12'), Decimal('12')) Decimal('1') >>> ExtendedContext.divide(Decimal('8.00'), Decimal('2')) Decimal('4.00') >>> ExtendedContext.divide(Decimal('2.400'), Decimal('2.0')) Decimal('1.20') >>> ExtendedContext.divide(Decimal('1000'), Decimal('100')) Decimal('10') >>> ExtendedContext.divide(Decimal('1000'), Decimal('1')) Decimal('1000') >>> ExtendedContext.divide(Decimal('2.40E+6'), Decimal('2')) Decimal('1.20E+6') >>> ExtendedContext.divide(5, 5) Decimal('1') >>> ExtendedContext.divide(Decimal(5), 5) Decimal('1') >>> ExtendedContext.divide(5, Decimal(5)) Decimal('1') T)r)r/zUnable to convert %s to DecimalN)rrrrr)r.rrSrr'r'r)divide+s  zContext.dividecCs8t|dd}|j||d}|tkr0td|n|SdS)a/Divides two numbers and returns the integer part of the result. >>> ExtendedContext.divide_int(Decimal('2'), Decimal('3')) Decimal('0') >>> ExtendedContext.divide_int(Decimal('10'), Decimal('3')) Decimal('3') >>> ExtendedContext.divide_int(Decimal('1'), Decimal('0.3')) Decimal('3') >>> ExtendedContext.divide_int(10, 3) Decimal('3') >>> ExtendedContext.divide_int(Decimal(10), 3) Decimal('3') >>> ExtendedContext.divide_int(10, Decimal(3)) Decimal('3') T)r)r/zUnable to convert %s to DecimalN)rrrrr)r.rrSrr'r'r) divide_intPs  zContext.divide_intcCs8t|dd}|j||d}|tkr0td|n|SdS)aReturn (a // b, a % b). >>> ExtendedContext.divmod(Decimal(8), Decimal(3)) (Decimal('2'), Decimal('2')) >>> ExtendedContext.divmod(Decimal(8), Decimal(4)) (Decimal('2'), Decimal('0')) >>> ExtendedContext.divmod(8, 4) (Decimal('2'), Decimal('0')) >>> ExtendedContext.divmod(Decimal(8), 4) (Decimal('2'), Decimal('0')) >>> ExtendedContext.divmod(8, Decimal(4)) (Decimal('2'), Decimal('0')) T)r)r/zUnable to convert %s to DecimalN)rrrrr)r.rrSrr'r'r)rgs  zContext.divmodcCst|dd}|j|dS)a#Returns e ** a. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> c.exp(Decimal('-Infinity')) Decimal('0') >>> c.exp(Decimal('-1')) Decimal('0.367879441') >>> c.exp(Decimal('0')) Decimal('1') >>> c.exp(Decimal('1')) Decimal('2.71828183') >>> c.exp(Decimal('0.693147181')) Decimal('2.00000000') >>> c.exp(Decimal('+Infinity')) Decimal('Infinity') >>> c.exp(10) Decimal('22026.4658') T)r)r/)rrV)r.rr'r'r)rV|s z Context.expcCst|dd}|j|||dS)a Returns a multiplied by b, plus c. The first two operands are multiplied together, using multiply, the third operand is then added to the result of that multiplication, using add, all with only one final rounding. >>> ExtendedContext.fma(Decimal('3'), Decimal('5'), Decimal('7')) Decimal('22') >>> ExtendedContext.fma(Decimal('3'), Decimal('-5'), Decimal('7')) Decimal('-8') >>> ExtendedContext.fma(Decimal('888565290'), Decimal('1557.96930'), Decimal('-86087.7578')) Decimal('1.38435736E+12') >>> ExtendedContext.fma(1, 3, 4) Decimal('7') >>> ExtendedContext.fma(1, Decimal(3), 4) Decimal('7') >>> ExtendedContext.fma(1, 3, Decimal(4)) Decimal('7') T)r)r/)rr)r.rrSr+r'r'r)rs z Context.fmacCst|tstd|jS)aReturn True if the operand is canonical; otherwise return False. Currently, the encoding of a Decimal instance is always canonical, so this method returns True for any Decimal. >>> ExtendedContext.is_canonical(Decimal('2.50')) True z/is_canonical requires a Decimal as an argument.)r_rrrr;)r.rr'r'r)r;s zContext.is_canonicalcCst|dd}|jS)a,Return True if the operand is finite; otherwise return False. A Decimal instance is considered finite if it is neither infinite nor a NaN. >>> ExtendedContext.is_finite(Decimal('2.50')) True >>> ExtendedContext.is_finite(Decimal('-0.3')) True >>> ExtendedContext.is_finite(Decimal('0')) True >>> ExtendedContext.is_finite(Decimal('Inf')) False >>> ExtendedContext.is_finite(Decimal('NaN')) False >>> ExtendedContext.is_finite(1) True T)r)rr<)r.rr'r'r)r<s zContext.is_finitecCst|dd}|jS)aUReturn True if the operand is infinite; otherwise return False. >>> ExtendedContext.is_infinite(Decimal('2.50')) False >>> ExtendedContext.is_infinite(Decimal('-Inf')) True >>> ExtendedContext.is_infinite(Decimal('NaN')) False >>> ExtendedContext.is_infinite(1) False T)r)rr#)r.rr'r'r)r#s zContext.is_infinitecCst|dd}|jS)aOReturn True if the operand is a qNaN or sNaN; otherwise return False. >>> ExtendedContext.is_nan(Decimal('2.50')) False >>> ExtendedContext.is_nan(Decimal('NaN')) True >>> ExtendedContext.is_nan(Decimal('-sNaN')) True >>> ExtendedContext.is_nan(1) False T)r)rr)r.rr'r'r)rs zContext.is_nancCst|dd}|j|dS)aReturn True if the operand is a normal number; otherwise return False. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> c.is_normal(Decimal('2.50')) True >>> c.is_normal(Decimal('0.1E-999')) False >>> c.is_normal(Decimal('0.00')) False >>> c.is_normal(Decimal('-Inf')) False >>> c.is_normal(Decimal('NaN')) False >>> c.is_normal(1) True T)r)r/)rr=)r.rr'r'r)r=s zContext.is_normalcCst|dd}|jS)aHReturn True if the operand is a quiet NaN; otherwise return False. >>> ExtendedContext.is_qnan(Decimal('2.50')) False >>> ExtendedContext.is_qnan(Decimal('NaN')) True >>> ExtendedContext.is_qnan(Decimal('sNaN')) False >>> ExtendedContext.is_qnan(1) False T)r)rr)r.rr'r'r)rs zContext.is_qnancCst|dd}|jS)aReturn True if the operand is negative; otherwise return False. >>> ExtendedContext.is_signed(Decimal('2.50')) False >>> ExtendedContext.is_signed(Decimal('-12')) True >>> ExtendedContext.is_signed(Decimal('-0')) True >>> ExtendedContext.is_signed(8) False >>> ExtendedContext.is_signed(-8) True T)r)rr>)r.rr'r'r)r>s zContext.is_signedcCst|dd}|jS)aTReturn True if the operand is a signaling NaN; otherwise return False. >>> ExtendedContext.is_snan(Decimal('2.50')) False >>> ExtendedContext.is_snan(Decimal('NaN')) False >>> ExtendedContext.is_snan(Decimal('sNaN')) True >>> ExtendedContext.is_snan(1) False T)r)rr)r.rr'r'r)r$s zContext.is_snancCst|dd}|j|dS)aReturn True if the operand is subnormal; otherwise return False. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> c.is_subnormal(Decimal('2.50')) False >>> c.is_subnormal(Decimal('0.1E-999')) True >>> c.is_subnormal(Decimal('0.00')) False >>> c.is_subnormal(Decimal('-Inf')) False >>> c.is_subnormal(Decimal('NaN')) False >>> c.is_subnormal(1) False T)r)r/)rr?)r.rr'r'r)r?4s zContext.is_subnormalcCst|dd}|jS)auReturn True if the operand is a zero; otherwise return False. >>> ExtendedContext.is_zero(Decimal('0')) True >>> ExtendedContext.is_zero(Decimal('2.50')) False >>> ExtendedContext.is_zero(Decimal('-0E+2')) True >>> ExtendedContext.is_zero(1) False >>> ExtendedContext.is_zero(0) True T)r)rr@)r.rr'r'r)r@Js zContext.is_zerocCst|dd}|j|dS)aReturns the natural (base e) logarithm of the operand. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> c.ln(Decimal('0')) Decimal('-Infinity') >>> c.ln(Decimal('1.000')) Decimal('0') >>> c.ln(Decimal('2.71828183')) Decimal('1.00000000') >>> c.ln(Decimal('10')) Decimal('2.30258509') >>> c.ln(Decimal('+Infinity')) Decimal('Infinity') >>> c.ln(1) Decimal('0') T)r)r/)rrH)r.rr'r'r)rH[s z Context.lncCst|dd}|j|dS)aReturns the base 10 logarithm of the operand. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> c.log10(Decimal('0')) Decimal('-Infinity') >>> c.log10(Decimal('0.001')) Decimal('-3') >>> c.log10(Decimal('1.000')) Decimal('0') >>> c.log10(Decimal('2')) Decimal('0.301029996') >>> c.log10(Decimal('10')) Decimal('1') >>> c.log10(Decimal('70')) Decimal('1.84509804') >>> c.log10(Decimal('+Infinity')) Decimal('Infinity') >>> c.log10(0) Decimal('-Infinity') >>> c.log10(1) Decimal('0') T)r)r/)rrK)r.rr'r'r)rKqs z Context.log10cCst|dd}|j|dS)a4 Returns the exponent of the magnitude of the operand's MSD. The result is the integer which is the exponent of the magnitude of the most significant digit of the operand (as though the operand were truncated to a single digit while maintaining the value of that digit and without limiting the resulting exponent). >>> ExtendedContext.logb(Decimal('250')) Decimal('2') >>> ExtendedContext.logb(Decimal('2.50')) Decimal('0') >>> ExtendedContext.logb(Decimal('0.03')) Decimal('-2') >>> ExtendedContext.logb(Decimal('0')) Decimal('-Infinity') >>> ExtendedContext.logb(1) Decimal('0') >>> ExtendedContext.logb(10) Decimal('1') >>> ExtendedContext.logb(100) Decimal('2') T)r)r/)rrL)r.rr'r'r)rLs z Context.logbcCst|dd}|j||dS)aApplies the logical operation 'and' between each operand's digits. The operands must be both logical numbers. >>> ExtendedContext.logical_and(Decimal('0'), Decimal('0')) Decimal('0') >>> ExtendedContext.logical_and(Decimal('0'), Decimal('1')) Decimal('0') >>> ExtendedContext.logical_and(Decimal('1'), Decimal('0')) Decimal('0') >>> ExtendedContext.logical_and(Decimal('1'), Decimal('1')) Decimal('1') >>> ExtendedContext.logical_and(Decimal('1100'), Decimal('1010')) Decimal('1000') >>> ExtendedContext.logical_and(Decimal('1111'), Decimal('10')) Decimal('10') >>> ExtendedContext.logical_and(110, 1101) Decimal('100') >>> ExtendedContext.logical_and(Decimal(110), 1101) Decimal('100') >>> ExtendedContext.logical_and(110, Decimal(1101)) Decimal('100') T)r)r/)rrV)r.rrSr'r'r)rVs zContext.logical_andcCst|dd}|j|dS)a Invert all the digits in the operand. The operand must be a logical number. >>> ExtendedContext.logical_invert(Decimal('0')) Decimal('111111111') >>> ExtendedContext.logical_invert(Decimal('1')) Decimal('111111110') >>> ExtendedContext.logical_invert(Decimal('111111111')) Decimal('0') >>> ExtendedContext.logical_invert(Decimal('101010101')) Decimal('10101010') >>> ExtendedContext.logical_invert(1101) Decimal('111110010') T)r)r/)rrX)r.rr'r'r)rXs zContext.logical_invertcCst|dd}|j||dS)aApplies the logical operation 'or' between each operand's digits. The operands must be both logical numbers. >>> ExtendedContext.logical_or(Decimal('0'), Decimal('0')) Decimal('0') >>> ExtendedContext.logical_or(Decimal('0'), Decimal('1')) Decimal('1') >>> ExtendedContext.logical_or(Decimal('1'), Decimal('0')) Decimal('1') >>> ExtendedContext.logical_or(Decimal('1'), Decimal('1')) Decimal('1') >>> ExtendedContext.logical_or(Decimal('1100'), Decimal('1010')) Decimal('1110') >>> ExtendedContext.logical_or(Decimal('1110'), Decimal('10')) Decimal('1110') >>> ExtendedContext.logical_or(110, 1101) Decimal('1111') >>> ExtendedContext.logical_or(Decimal(110), 1101) Decimal('1111') >>> ExtendedContext.logical_or(110, Decimal(1101)) Decimal('1111') T)r)r/)rrY)r.rrSr'r'r)rYs zContext.logical_orcCst|dd}|j||dS)aApplies the logical operation 'xor' between each operand's digits. The operands must be both logical numbers. >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('0')) Decimal('0') >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('1')) Decimal('1') >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('0')) Decimal('1') >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('1')) Decimal('0') >>> ExtendedContext.logical_xor(Decimal('1100'), Decimal('1010')) Decimal('110') >>> ExtendedContext.logical_xor(Decimal('1111'), Decimal('10')) Decimal('1101') >>> ExtendedContext.logical_xor(110, 1101) Decimal('1011') >>> ExtendedContext.logical_xor(Decimal(110), 1101) Decimal('1011') >>> ExtendedContext.logical_xor(110, Decimal(1101)) Decimal('1011') T)r)r/)rrW)r.rrSr'r'r)rWs zContext.logical_xorcCst|dd}|j||dS)amax compares two values numerically and returns the maximum. If either operand is a NaN then the general rules apply. Otherwise, the operands are compared as though by the compare operation. If they are numerically equal then the left-hand operand is chosen as the result. Otherwise the maximum (closer to positive infinity) of the two operands is chosen as the result. >>> ExtendedContext.max(Decimal('3'), Decimal('2')) Decimal('3') >>> ExtendedContext.max(Decimal('-10'), Decimal('3')) Decimal('3') >>> ExtendedContext.max(Decimal('1.0'), Decimal('1')) Decimal('1') >>> ExtendedContext.max(Decimal('7'), Decimal('NaN')) Decimal('7') >>> ExtendedContext.max(1, 2) Decimal('2') >>> ExtendedContext.max(Decimal(1), 2) Decimal('2') >>> ExtendedContext.max(1, Decimal(2)) Decimal('2') T)r)r/)rr)r.rrSr'r'r)r s z Context.maxcCst|dd}|j||dS)aCompares the values numerically with their sign ignored. >>> ExtendedContext.max_mag(Decimal('7'), Decimal('NaN')) Decimal('7') >>> ExtendedContext.max_mag(Decimal('7'), Decimal('-10')) Decimal('-10') >>> ExtendedContext.max_mag(1, -2) Decimal('-2') >>> ExtendedContext.max_mag(Decimal(1), -2) Decimal('-2') >>> ExtendedContext.max_mag(1, Decimal(-2)) Decimal('-2') T)r)r/)rrZ)r.rrSr'r'r)rZ&s zContext.max_magcCst|dd}|j||dS)amin compares two values numerically and returns the minimum. If either operand is a NaN then the general rules apply. Otherwise, the operands are compared as though by the compare operation. If they are numerically equal then the left-hand operand is chosen as the result. Otherwise the minimum (closer to negative infinity) of the two operands is chosen as the result. >>> ExtendedContext.min(Decimal('3'), Decimal('2')) Decimal('2') >>> ExtendedContext.min(Decimal('-10'), Decimal('3')) Decimal('-10') >>> ExtendedContext.min(Decimal('1.0'), Decimal('1')) Decimal('1.0') >>> ExtendedContext.min(Decimal('7'), Decimal('NaN')) Decimal('7') >>> ExtendedContext.min(1, 2) Decimal('1') >>> ExtendedContext.min(Decimal(1), 2) Decimal('1') >>> ExtendedContext.min(1, Decimal(29)) Decimal('1') T)r)r/)rr)r.rrSr'r'r)r7s z Context.mincCst|dd}|j||dS)aCompares the values numerically with their sign ignored. >>> ExtendedContext.min_mag(Decimal('3'), Decimal('-2')) Decimal('-2') >>> ExtendedContext.min_mag(Decimal('-3'), Decimal('NaN')) Decimal('-3') >>> ExtendedContext.min_mag(1, -2) Decimal('1') >>> ExtendedContext.min_mag(Decimal(1), -2) Decimal('1') >>> ExtendedContext.min_mag(1, Decimal(-2)) Decimal('1') T)r)r/)rr[)r.rrSr'r'r)r[Rs zContext.min_magcCst|dd}|j|dS)aMinus corresponds to unary prefix minus in Python. The operation is evaluated using the same rules as subtract; the operation minus(a) is calculated as subtract('0', a) where the '0' has the same exponent as the operand. >>> ExtendedContext.minus(Decimal('1.3')) Decimal('-1.3') >>> ExtendedContext.minus(Decimal('-1.3')) Decimal('1.3') >>> ExtendedContext.minus(1) Decimal('-1') T)r)r/)rr)r.rr'r'r)minuscs z Context.minuscCs8t|dd}|j||d}|tkr0td|n|SdS)amultiply multiplies two operands. If either operand is a special value then the general rules apply. Otherwise, the operands are multiplied together ('long multiplication'), resulting in a number which may be as long as the sum of the lengths of the two operands. >>> ExtendedContext.multiply(Decimal('1.20'), Decimal('3')) Decimal('3.60') >>> ExtendedContext.multiply(Decimal('7'), Decimal('3')) Decimal('21') >>> ExtendedContext.multiply(Decimal('0.9'), Decimal('0.8')) Decimal('0.72') >>> ExtendedContext.multiply(Decimal('0.9'), Decimal('-0')) Decimal('-0.0') >>> ExtendedContext.multiply(Decimal('654321'), Decimal('654321')) Decimal('4.28135971E+11') >>> ExtendedContext.multiply(7, 7) Decimal('49') >>> ExtendedContext.multiply(Decimal(7), 7) Decimal('49') >>> ExtendedContext.multiply(7, Decimal(7)) Decimal('49') T)r)r/zUnable to convert %s to DecimalN)rrrrr)r.rrSrr'r'r)multiplyts  zContext.multiplycCst|dd}|j|dS)a"Returns the largest representable number smaller than a. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> ExtendedContext.next_minus(Decimal('1')) Decimal('0.999999999') >>> c.next_minus(Decimal('1E-1007')) Decimal('0E-1007') >>> ExtendedContext.next_minus(Decimal('-1.00000003')) Decimal('-1.00000004') >>> c.next_minus(Decimal('Infinity')) Decimal('9.99999999E+999') >>> c.next_minus(1) Decimal('0.999999999') T)r)r/)rr^)r.rr'r'r)r^s zContext.next_minuscCst|dd}|j|dS)aReturns the smallest representable number larger than a. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> ExtendedContext.next_plus(Decimal('1')) Decimal('1.00000001') >>> c.next_plus(Decimal('-1E-1007')) Decimal('-0E-1007') >>> ExtendedContext.next_plus(Decimal('-1.00000003')) Decimal('-1.00000002') >>> c.next_plus(Decimal('-Infinity')) Decimal('-9.99999999E+999') >>> c.next_plus(1) Decimal('1.00000001') T)r)r/)rr_)r.rr'r'r)r_s zContext.next_pluscCst|dd}|j||dS)aReturns the number closest to a, in direction towards b. The result is the closest representable number from the first operand (but not the first operand) that is in the direction towards the second operand, unless the operands have the same value. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> c.next_toward(Decimal('1'), Decimal('2')) Decimal('1.00000001') >>> c.next_toward(Decimal('-1E-1007'), Decimal('1')) Decimal('-0E-1007') >>> c.next_toward(Decimal('-1.00000003'), Decimal('0')) Decimal('-1.00000002') >>> c.next_toward(Decimal('1'), Decimal('0')) Decimal('0.999999999') >>> c.next_toward(Decimal('1E-1007'), Decimal('-100')) Decimal('0E-1007') >>> c.next_toward(Decimal('-1.00000003'), Decimal('-10')) Decimal('-1.00000004') >>> c.next_toward(Decimal('0.00'), Decimal('-0.0000')) Decimal('-0.00') >>> c.next_toward(0, 1) Decimal('1E-1007') >>> c.next_toward(Decimal(0), 1) Decimal('1E-1007') >>> c.next_toward(0, Decimal(1)) Decimal('1E-1007') T)r)r/)rr`)r.rrSr'r'r)r`s zContext.next_towardcCst|dd}|j|dS)anormalize reduces an operand to its simplest form. Essentially a plus operation with all trailing zeros removed from the result. >>> ExtendedContext.normalize(Decimal('2.1')) Decimal('2.1') >>> ExtendedContext.normalize(Decimal('-2.0')) Decimal('-2') >>> ExtendedContext.normalize(Decimal('1.200')) Decimal('1.2') >>> ExtendedContext.normalize(Decimal('-120')) Decimal('-1.2E+2') >>> ExtendedContext.normalize(Decimal('120.00')) Decimal('1.2E+2') >>> ExtendedContext.normalize(Decimal('0.00')) Decimal('0') >>> ExtendedContext.normalize(6) Decimal('6') T)r)r/)rr!)r.rr'r'r)r!s zContext.normalizecCst|dd}|j|dS)aReturns an indication of the class of the operand. The class is one of the following strings: -sNaN -NaN -Infinity -Normal -Subnormal -Zero +Zero +Subnormal +Normal +Infinity >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> c.number_class(Decimal('Infinity')) '+Infinity' >>> c.number_class(Decimal('1E-10')) '+Normal' >>> c.number_class(Decimal('2.50')) '+Normal' >>> c.number_class(Decimal('0.1E-999')) '+Subnormal' >>> c.number_class(Decimal('0')) '+Zero' >>> c.number_class(Decimal('-0')) '-Zero' >>> c.number_class(Decimal('-0.1E-999')) '-Subnormal' >>> c.number_class(Decimal('-1E-10')) '-Normal' >>> c.number_class(Decimal('-2.50')) '-Normal' >>> c.number_class(Decimal('-Infinity')) '-Infinity' >>> c.number_class(Decimal('NaN')) 'NaN' >>> c.number_class(Decimal('-NaN')) 'NaN' >>> c.number_class(Decimal('sNaN')) 'sNaN' >>> c.number_class(123) '+Normal' T)r)r/)rrb)r.rr'r'r)rbs/ zContext.number_classcCst|dd}|j|dS)aPlus corresponds to unary prefix plus in Python. The operation is evaluated using the same rules as add; the operation plus(a) is calculated as add('0', a) where the '0' has the same exponent as the operand. >>> ExtendedContext.plus(Decimal('1.3')) Decimal('1.3') >>> ExtendedContext.plus(Decimal('-1.3')) Decimal('-1.3') >>> ExtendedContext.plus(-1) Decimal('-1') T)r)r/)rr)r.rr'r'r)plus)s z Context.pluscCs:t|dd}|j|||d}|tkr2td|n|SdS)a Raises a to the power of b, to modulo if given. With two arguments, compute a**b. If a is negative then b must be integral. The result will be inexact unless b is integral and the result is finite and can be expressed exactly in 'precision' digits. With three arguments, compute (a**b) % modulo. For the three argument form, the following restrictions on the arguments hold: - all three arguments must be integral - b must be nonnegative - at least one of a or b must be nonzero - modulo must be nonzero and have at most 'precision' digits The result of pow(a, b, modulo) is identical to the result that would be obtained by computing (a**b) % modulo with unbounded precision, but is computed more efficiently. It is always exact. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> c.power(Decimal('2'), Decimal('3')) Decimal('8') >>> c.power(Decimal('-2'), Decimal('3')) Decimal('-8') >>> c.power(Decimal('2'), Decimal('-3')) Decimal('0.125') >>> c.power(Decimal('1.7'), Decimal('8')) Decimal('69.7575744') >>> c.power(Decimal('10'), Decimal('0.301029996')) Decimal('2.00000000') >>> c.power(Decimal('Infinity'), Decimal('-1')) Decimal('0') >>> c.power(Decimal('Infinity'), Decimal('0')) Decimal('1') >>> c.power(Decimal('Infinity'), Decimal('1')) Decimal('Infinity') >>> c.power(Decimal('-Infinity'), Decimal('-1')) Decimal('-0') >>> c.power(Decimal('-Infinity'), Decimal('0')) Decimal('1') >>> c.power(Decimal('-Infinity'), Decimal('1')) Decimal('-Infinity') >>> c.power(Decimal('-Infinity'), Decimal('2')) Decimal('Infinity') >>> c.power(Decimal('0'), Decimal('0')) Decimal('NaN') >>> c.power(Decimal('3'), Decimal('7'), Decimal('16')) Decimal('11') >>> c.power(Decimal('-3'), Decimal('7'), Decimal('16')) Decimal('-11') >>> c.power(Decimal('-3'), Decimal('8'), Decimal('16')) Decimal('1') >>> c.power(Decimal('3'), Decimal('7'), Decimal('-16')) Decimal('11') >>> c.power(Decimal('23E12345'), Decimal('67E189'), Decimal('123456789')) Decimal('11729830') >>> c.power(Decimal('-0'), Decimal('17'), Decimal('1729')) Decimal('-0') >>> c.power(Decimal('-23'), Decimal('0'), Decimal('65537')) Decimal('1') >>> ExtendedContext.power(7, 7) Decimal('823543') >>> ExtendedContext.power(Decimal(7), 7) Decimal('823543') >>> ExtendedContext.power(7, Decimal(7), 2) Decimal('1') T)r)r/zUnable to convert %s to DecimalN)rrrrr)r.rrSrrr'r'r)power:s I z Context.powercCst|dd}|j||dS)a Returns a value equal to 'a' (rounded), having the exponent of 'b'. The coefficient of the result is derived from that of the left-hand operand. It may be rounded using the current rounding setting (if the exponent is being increased), multiplied by a positive power of ten (if the exponent is being decreased), or is unchanged (if the exponent is already equal to that of the right-hand operand). Unlike other operations, if the length of the coefficient after the quantize operation would be greater than precision then an Invalid operation condition is raised. This guarantees that, unless there is an error condition, the exponent of the result of a quantize is always equal to that of the right-hand operand. Also unlike other operations, quantize will never raise Underflow, even if the result is subnormal and inexact. >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.001')) Decimal('2.170') >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.01')) Decimal('2.17') >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.1')) Decimal('2.2') >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('1e+0')) Decimal('2') >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('1e+1')) Decimal('0E+1') >>> ExtendedContext.quantize(Decimal('-Inf'), Decimal('Infinity')) Decimal('-Infinity') >>> ExtendedContext.quantize(Decimal('2'), Decimal('Infinity')) Decimal('NaN') >>> ExtendedContext.quantize(Decimal('-0.1'), Decimal('1')) Decimal('-0') >>> ExtendedContext.quantize(Decimal('-0'), Decimal('1e+5')) Decimal('-0E+5') >>> ExtendedContext.quantize(Decimal('+35236450.6'), Decimal('1e-2')) Decimal('NaN') >>> ExtendedContext.quantize(Decimal('-35236450.6'), Decimal('1e-2')) Decimal('NaN') >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e-1')) Decimal('217.0') >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e-0')) Decimal('217') >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e+1')) Decimal('2.2E+2') >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e+2')) Decimal('2E+2') >>> ExtendedContext.quantize(1, 2) Decimal('1') >>> ExtendedContext.quantize(Decimal(1), 2) Decimal('1') >>> ExtendedContext.quantize(1, Decimal(2)) Decimal('1') T)r)r/)rr)r.rrSr'r'r)rs7 zContext.quantizecCstdS)zkJust returns 10, as this is Decimal, :) >>> ExtendedContext.radix() Decimal('10') r)r)r.r'r'r)rcsz Context.radixcCs8t|dd}|j||d}|tkr0td|n|SdS)aReturns the remainder from integer division. The result is the residue of the dividend after the operation of calculating integer division as described for divide-integer, rounded to precision digits if necessary. The sign of the result, if non-zero, is the same as that of the original dividend. This operation will fail under the same conditions as integer division (that is, if integer division on the same two operands would fail, the remainder cannot be calculated). >>> ExtendedContext.remainder(Decimal('2.1'), Decimal('3')) Decimal('2.1') >>> ExtendedContext.remainder(Decimal('10'), Decimal('3')) Decimal('1') >>> ExtendedContext.remainder(Decimal('-10'), Decimal('3')) Decimal('-1') >>> ExtendedContext.remainder(Decimal('10.2'), Decimal('1')) Decimal('0.2') >>> ExtendedContext.remainder(Decimal('10'), Decimal('0.3')) Decimal('0.1') >>> ExtendedContext.remainder(Decimal('3.6'), Decimal('1.3')) Decimal('1.0') >>> ExtendedContext.remainder(22, 6) Decimal('4') >>> ExtendedContext.remainder(Decimal(22), 6) Decimal('4') >>> ExtendedContext.remainder(22, Decimal(6)) Decimal('4') T)r)r/zUnable to convert %s to DecimalN)rrrrr)r.rrSrr'r'r)rs  zContext.remaindercCst|dd}|j||dS)aGReturns to be "a - b * n", where n is the integer nearest the exact value of "x / b" (if two integers are equally near then the even one is chosen). If the result is equal to 0 then its sign will be the sign of a. This operation will fail under the same conditions as integer division (that is, if integer division on the same two operands would fail, the remainder cannot be calculated). >>> ExtendedContext.remainder_near(Decimal('2.1'), Decimal('3')) Decimal('-0.9') >>> ExtendedContext.remainder_near(Decimal('10'), Decimal('6')) Decimal('-2') >>> ExtendedContext.remainder_near(Decimal('10'), Decimal('3')) Decimal('1') >>> ExtendedContext.remainder_near(Decimal('-10'), Decimal('3')) Decimal('-1') >>> ExtendedContext.remainder_near(Decimal('10.2'), Decimal('1')) Decimal('0.2') >>> ExtendedContext.remainder_near(Decimal('10'), Decimal('0.3')) Decimal('0.1') >>> ExtendedContext.remainder_near(Decimal('3.6'), Decimal('1.3')) Decimal('-0.3') >>> ExtendedContext.remainder_near(3, 11) Decimal('3') >>> ExtendedContext.remainder_near(Decimal(3), 11) Decimal('3') >>> ExtendedContext.remainder_near(3, Decimal(11)) Decimal('3') T)r)r/)rr)r.rrSr'r'r)rs zContext.remainder_nearcCst|dd}|j||dS)aNReturns a rotated copy of a, b times. The coefficient of the result is a rotated copy of the digits in the coefficient of the first operand. The number of places of rotation is taken from the absolute value of the second operand, with the rotation being to the left if the second operand is positive or to the right otherwise. >>> ExtendedContext.rotate(Decimal('34'), Decimal('8')) Decimal('400000003') >>> ExtendedContext.rotate(Decimal('12'), Decimal('9')) Decimal('12') >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('-2')) Decimal('891234567') >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('0')) Decimal('123456789') >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('+2')) Decimal('345678912') >>> ExtendedContext.rotate(1333333, 1) Decimal('13333330') >>> ExtendedContext.rotate(Decimal(1333333), 1) Decimal('13333330') >>> ExtendedContext.rotate(1333333, Decimal(1)) Decimal('13333330') T)r)r/)rrg)r.rrSr'r'r)rgs zContext.rotatecCst|dd}|j|S)aReturns True if the two operands have the same exponent. The result is never affected by either the sign or the coefficient of either operand. >>> ExtendedContext.same_quantum(Decimal('2.17'), Decimal('0.001')) False >>> ExtendedContext.same_quantum(Decimal('2.17'), Decimal('0.01')) True >>> ExtendedContext.same_quantum(Decimal('2.17'), Decimal('1')) False >>> ExtendedContext.same_quantum(Decimal('Inf'), Decimal('-Inf')) True >>> ExtendedContext.same_quantum(10000, -1) True >>> ExtendedContext.same_quantum(Decimal(10000), -1) True >>> ExtendedContext.same_quantum(10000, Decimal(-1)) True T)r)rr$)r.rrSr'r'r)r$1s zContext.same_quantumcCst|dd}|j||dS)a3Returns the first operand after adding the second value its exp. >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('-2')) Decimal('0.0750') >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('0')) Decimal('7.50') >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('3')) Decimal('7.50E+3') >>> ExtendedContext.scaleb(1, 4) Decimal('1E+4') >>> ExtendedContext.scaleb(Decimal(1), 4) Decimal('1E+4') >>> ExtendedContext.scaleb(1, Decimal(4)) Decimal('1E+4') T)r)r/)rrh)r.rrSr'r'r)rhIs zContext.scalebcCst|dd}|j||dS)a{Returns a shifted copy of a, b times. The coefficient of the result is a shifted copy of the digits in the coefficient of the first operand. The number of places to shift is taken from the absolute value of the second operand, with the shift being to the left if the second operand is positive or to the right otherwise. Digits shifted into the coefficient are zeros. >>> ExtendedContext.shift(Decimal('34'), Decimal('8')) Decimal('400000000') >>> ExtendedContext.shift(Decimal('12'), Decimal('9')) Decimal('0') >>> ExtendedContext.shift(Decimal('123456789'), Decimal('-2')) Decimal('1234567') >>> ExtendedContext.shift(Decimal('123456789'), Decimal('0')) Decimal('123456789') >>> ExtendedContext.shift(Decimal('123456789'), Decimal('+2')) Decimal('345678900') >>> ExtendedContext.shift(88888888, 2) Decimal('888888800') >>> ExtendedContext.shift(Decimal(88888888), 2) Decimal('888888800') >>> ExtendedContext.shift(88888888, Decimal(2)) Decimal('888888800') T)r)r/)rr)r.rrSr'r'r)r\s z Context.shiftcCst|dd}|j|dS)aSquare root of a non-negative number to context precision. If the result must be inexact, it is rounded using the round-half-even algorithm. >>> ExtendedContext.sqrt(Decimal('0')) Decimal('0') >>> ExtendedContext.sqrt(Decimal('-0')) Decimal('-0') >>> ExtendedContext.sqrt(Decimal('0.39')) Decimal('0.624499800') >>> ExtendedContext.sqrt(Decimal('100')) Decimal('10') >>> ExtendedContext.sqrt(Decimal('1')) Decimal('1') >>> ExtendedContext.sqrt(Decimal('1.0')) Decimal('1.0') >>> ExtendedContext.sqrt(Decimal('1.00')) Decimal('1.0') >>> ExtendedContext.sqrt(Decimal('7')) Decimal('2.64575131') >>> ExtendedContext.sqrt(Decimal('10')) Decimal('3.16227766') >>> ExtendedContext.sqrt(2) Decimal('1.41421356') >>> ExtendedContext.prec 9 T)r)r/)rr-)r.rr'r'r)r-zs z Context.sqrtcCs8t|dd}|j||d}|tkr0td|n|SdS)a&Return the difference between the two operands. >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('1.07')) Decimal('0.23') >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('1.30')) Decimal('0.00') >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('2.07')) Decimal('-0.77') >>> ExtendedContext.subtract(8, 5) Decimal('3') >>> ExtendedContext.subtract(Decimal(8), 5) Decimal('3') >>> ExtendedContext.subtract(8, Decimal(5)) Decimal('3') T)r)r/zUnable to convert %s to DecimalN)rrrrr)r.rrSrr'r'r)subtracts  zContext.subtractcCst|dd}|j|dS)aConvert to a string, using engineering notation if an exponent is needed. Engineering notation has an exponent which is a multiple of 3. This can leave up to 3 digits to the left of the decimal place and may require the addition of either one or two trailing zeros. The operation is not affected by the context. >>> ExtendedContext.to_eng_string(Decimal('123E+1')) '1.23E+3' >>> ExtendedContext.to_eng_string(Decimal('123E+3')) '123E+3' >>> ExtendedContext.to_eng_string(Decimal('123E-10')) '12.3E-9' >>> ExtendedContext.to_eng_string(Decimal('-123E-12')) '-123E-12' >>> ExtendedContext.to_eng_string(Decimal('7E-7')) '700E-9' >>> ExtendedContext.to_eng_string(Decimal('7E+1')) '70' >>> ExtendedContext.to_eng_string(Decimal('0E+1')) '0.00E+3' T)r)r/)rr)r.rr'r'r)rs zContext.to_eng_stringcCst|dd}|j|dS)zyConverts a number to a string, using scientific notation. The operation is not affected by the context. T)r)r/)rr)r.rr'r'r) to_sci_strings zContext.to_sci_stringcCst|dd}|j|dS)akRounds to an integer. When the operand has a negative exponent, the result is the same as using the quantize() operation using the given operand as the left-hand-operand, 1E+0 as the right-hand-operand, and the precision of the operand as the precision setting; Inexact and Rounded flags are allowed in this operation. The rounding mode is taken from the context. >>> ExtendedContext.to_integral_exact(Decimal('2.1')) Decimal('2') >>> ExtendedContext.to_integral_exact(Decimal('100')) Decimal('100') >>> ExtendedContext.to_integral_exact(Decimal('100.0')) Decimal('100') >>> ExtendedContext.to_integral_exact(Decimal('101.5')) Decimal('102') >>> ExtendedContext.to_integral_exact(Decimal('-101.5')) Decimal('-102') >>> ExtendedContext.to_integral_exact(Decimal('10E+5')) Decimal('1.0E+6') >>> ExtendedContext.to_integral_exact(Decimal('7.89E+77')) Decimal('7.89E+77') >>> ExtendedContext.to_integral_exact(Decimal('-Inf')) Decimal('-Infinity') T)r)r/)rr')r.rr'r'r)r's zContext.to_integral_exactcCst|dd}|j|dS)aLRounds to an integer. When the operand has a negative exponent, the result is the same as using the quantize() operation using the given operand as the left-hand-operand, 1E+0 as the right-hand-operand, and the precision of the operand as the precision setting, except that no flags will be set. The rounding mode is taken from the context. >>> ExtendedContext.to_integral_value(Decimal('2.1')) Decimal('2') >>> ExtendedContext.to_integral_value(Decimal('100')) Decimal('100') >>> ExtendedContext.to_integral_value(Decimal('100.0')) Decimal('100') >>> ExtendedContext.to_integral_value(Decimal('101.5')) Decimal('102') >>> ExtendedContext.to_integral_value(Decimal('-101.5')) Decimal('-102') >>> ExtendedContext.to_integral_value(Decimal('10E+5')) Decimal('1.0E+6') >>> ExtendedContext.to_integral_value(Decimal('7.89E+77')) Decimal('7.89E+77') >>> ExtendedContext.to_integral_value(Decimal('-Inf')) Decimal('-Infinity') T)r)r/)rr)r.rr'r'r)rs zContext.to_integral_value) NNNNNNNNN)N)rQ)N)Xr1r2r3r4rrrrrrjrrIrr(rHrlrdr\rrrrrr)rrrhrrr2rr3r.r7rrrr8rrrrVrr;r<r#rr=rr>rr?r@rHrKrLrVrXrYrWrrZrr[rrr^r_r`r!rbrrrrcrrrgr$rhrr-rrrr'rrr'r'r'r)rBs "     $#   %  #2 P:&" c@s&eZdZd Zd ddZddZeZdS) rir=rUrVNcCsf|dkrd|_d|_d|_nFt|trD|j|_t|j|_|j|_n|d|_|d|_|d|_dS)Nr%r-r+)r=rUrVr_rr7r8rO)r.rtr'r'r)rs     z_WorkRep.__init__cCsd|j|j|jfS)Nz (%r, %r, %r))r=rUrV)r.r'r'r)r(sz_WorkRep.__repr__)r=rUrV)N)r1r2r3r|rrrr'r'r'r)ris ricCs|j|jkr|}|}n|}|}tt|j}tt|j}|jtd||d}||jd|krpd|_||_|jd|j|j9_|j|_||fS)zcNormalizes op1, op2 to have the same exp and length of coefficient. Done during addition. r-r+rr)rVrfr`rUr)rrr@ZtmprZtmp_lenZ other_lenrVr'r'r)r/s rcCsb|dkr dS|dkr |d|Stt|}t|t|jd}|| krPdS|d| SdS)a Given integers n and e, return n * 10**e if it's an integer, else None. The computation is designed to avoid computing large powers of 10 unnecessarily. >>> _decimal_lshift_exact(3, 4) 30000 >>> _decimal_lshift_exact(300, -999999999) # returns None r%rrQN)r`rhrfrstrip)r5rZstr_nZval_nr'r'r)r Os   r cCsF|dks|dkrtdd}x$||kr@||| |d?}}qW|S)zClosest integer to the square root of the positive integer n. a is an initial approximation to the square root. Any positive integer will do for a, but the closer a is to the square root of n the faster convergence will be. r%z3Both arguments to _sqrt_nearest should be positive.r-)rl)r5rrSr'r'r) _sqrt_nearestds  rcCs2d|>||?}}|d||d@|d@|kS)zGiven an integer x and a nonnegative integer shift, return closest integer to x / 2**shift; use round-to-even in case of a tie. r-r+r')r rrSrr'r'r)_rshift_nearestssrcCs&t||\}}|d||d@|kS)zaClosest integer to a/b, a and b positive integers; rounds to even in the case of a tie. r+r-)r)rrSrrr'r'r) _div_nearest{srrc Cs||}d}xn||kr*t|||>|ksF||krzt|||?|krzt||d>|t||t|||}|d7}qWtdtt|d| }t||}t||}x0t|dddD]}t||t|||}qWt|||S)aInteger approximation to M*log(x/M), with absolute error boundable in terms only of x/M. Given positive integers x and M, return an integer approximation to M * log(x/M). For L = 8 and 0.1 <= x/M <= 10 the difference between the approximation and the exact result is at most 22. For L = 8 and 1.0 <= x/M <= 10.0 the difference is at most 15. In both cases these are upper bounds on the error; it will usually be much smaller.r%r-rr[ir)rhrrrrUrfr`r) r MLrRTZyshiftwrr'r'r)_ilogs    rc Cs|d7}tt|}||||dk}|dkrd|}|||}|dkrZ|d|9}nt|d| }t||}t|}t|||}||} nd}t|d| } t| |dS)zGiven integers c, e and p with c > 0, p >= 0, compute an integer approximation to 10**p * log10(c*10**e), with an absolute error of at most 1. Assumes that c*10**e is not exactly 1.r+r-r%rr)rfr`rr _log10_digits) r+rr r,r~rrlog_dZlog_10Z log_tenpowerr'r'r)rJs     rJc Cs|d7}tt|}||||dk}|dkrr|||}|dkrR|d|9}nt|d| }t|d|}nd}|rttt|d}||dkrt|t||d|}qd}nd}t||dS)zGiven integers c, e and p with c > 0, compute an integer approximation to 10**p * log(c*10**e), with an absolute error of at most 1. Assumes that c*10**e is not exactly 1.r+r-r%rr)rfr`rrrhr) r+rr r,r~rrrZ f_log_tenr'r'r)rGs"   rGc@s eZdZdZddZddZdS) _Log10MemoizezClass to compute, store, and allow retrieval of, digits of the constant log(10) = 2.302585.... This constant is needed by Decimal.ln, Decimal.log10, Decimal.exp and Decimal.__pow__.cCs d|_dS)NZ/23025850929940456840179914546843642076011014886)rx)r.r'r'r)rsz_Log10Memoize.__init__cCs|dkrtd|t|jkrd}xLd||d}tttd||d}|| dd|krdP|d7}q$W|jddd |_t|jd|d S) ztGiven an integer p >= 0, return floor(10**p)*log(10). For example, self.getdigits(3) returns 2302. r%zp should be nonnegativer[rr+rNrQr-r)rlrfrxr`rrrrU)r.r rrrxr'r'r) getdigitss  z_Log10Memoize.getdigitsN)r1r2r3r4rrr'r'r'r)rsrc Cst||>|}tdtt|d| }t||}||>}x.t|dddD]}t|||||}qRWx6t|ddd D]"}||d>}t||||}qW||S) zGiven integers x and M, M > 0, such that x/M is small in absolute value, compute an integer approximation to M*exp(x/M). For 0 <= x/M <= 2.4, the absolute error in the result is bounded by 60 (and is usually much smaller).rr[r-r%r+irrr)rrUrfr`rr) r rrrrrZMshiftrrr'r'r)_iexp&s  rc Cs|d7}td|tt|d}||}||}|dkrH|d|}n|d| }t|t|\}}t|d|}tt|d|d||dfS)aCompute an approximation to exp(c*10**e), with p decimal places of precision. Returns integers d, f such that: 10**(p-1) <= d <= 10**p, and (d-1)*10**f < exp(c*10**e) < (d+1)*10**f In other words, d*10**f is an approximation to exp(c*10**e) with p digits of precision, and with an error in d of at most 1. This is almost, but not quite, the same as the error being < 1ulp: when d = 10**(p-1) the error could be up to 10 ulp.r+r%r-rir[)rrfr`rrrr) r+rr rrrZcshiftZquotrr'r'r)r9Ksr9c Csttt||}t||||d}||}|dkrJ||d|}nt||d| }|dkrtt||dk|dkkrd|ddd|} } qd|d| } } n,t||d |d\} } t| d} | d7} | | fS)a5Given integers xc, xe, yc and ye representing Decimals x = xc*10**xe and y = yc*10**ye, compute x**y. Returns a pair of integers (c, e) such that: 10**(p-1) <= c <= 10**p, and (c-1)*10**e < x**y < (c+1)*10**e in other words, c*10**e is an approximation to x**y with p digits of precision, and with an error in c of at most 1. (This is almost, but not quite, the same as the error being < 1ulp: when c == 10**(p-1) we can only guarantee error < 10ulp.) We assume that: x is positive and not equal to 1, and y is nonzero. r-r%r)rfr`rhrGrr9) r rrrr rSZlxcrZpcrrVr'r'r)ros rrF5(rArry) r2345678r>cCs0|dkrtdt|}dt|||dS)z@Compute a lower bound for 100*log10(c) for a positive integer c.r%z0The argument to _log10_lb should be nonnegative.r)rlr`rf)r+Z correctionZstr_cr'r'r)r sr cCsLt|tr|St|tr t|S|r8t|tr8tj|S|rHtd|tS)zConvert other to Decimal. Verifies that it's ok to use in an implicit construction. If allow_float is true, allow conversion from float; this is used in the comparison methods (__eq__ and friends). zUnable to convert %s to Decimal)r_rrUrprqrrr)rrZ allow_floatr'r'r)rs    rcCst|tr||fSt|tjrR|jsDt|jtt|j |j |j }|t|j fS|rrt|tj rr|jdkrr|j}t|trt}|rd|jt<n |jtd|tj|fSttfS)zGiven a Decimal instance self and a Python object other, return a pair (s, o) of Decimal instances such that "s op o" is equivalent to "self op other" for any of the 6 comparison operators "op". r%r-z;strict semantics for mixing floats and Decimals are enabled)r_r_numbersZRationalrPr6r7r`rUr8 denominatorrO numeratorZComplexrrrprrrrdrqr)r.rrr/r'r'r)rs$    rri?B)r@r?rrrAr"rrr\)r@r?rra # A numeric string consists of: # \s* (?P[-+])? # an optional sign, followed by either... ( (?=\d|\.\d) # ...a number (with at least one digit) (?P\d*) # having a (possibly empty) integer part (\.(?P\d*))? # followed by an optional fractional part (E(?P[-+]?\d+))? # followed by an optional exponent, or... | Inf(inity)? # ...an infinity, or... | (?Ps)? # ...an (optionally signaling) NaN # NaN (?P\d*) # with (possibly empty) diagnostic info. ) # \s* \Z z0*$z50*$z\A (?: (?P.)? (?P[<>=^]) )? (?P[-+ ])? (?P\#)? (?P0)? (?P(?!0)\d+)? (?P,)? (?:\.(?P0|(?!0)\d+))? (?P[eEfFgGn%])? \Z cCstj|}|dkrtd||j}|d}|d}|ddk |d<|drv|dk rbtd||dk rvtd||p|d|d<|pd |d<|d dkrd |d <t|d pd |d <|ddk rt|d|d<|ddkr|ddks|ddkrd|d<|ddkrfd|d<|dkr&tj}|ddk r@td||d|d<|d|d<|d|d<n*|ddkr|d|d<ddg|d<d|d<|S)aParse and validate a format specifier. Turns a standard numeric format specifier into a dict, with the following entries: fill: fill character to pad field to minimum width align: alignment type, either '<', '>', '=' or '^' sign: either '+', '-' or ' ' minimumwidth: nonnegative integer giving minimum width zeropad: boolean, indicating whether to pad with zeros thousands_sep: string to use as thousands separator, or '' grouping: grouping for thousands separators, in format used by localeconv decimal_point: string to use for decimal point precision: nonnegative integer giving precision, or None type: one of the characters 'eEfFgG%', or None NzInvalid format specifier: fillalignzeropadz7Fill character conflicts with '0' in format specifier: z2Alignment conflicts with '0' in format specifier:  >r=rT minimumwidthrQrsr%rkZgGnr-r5rq thousands_sepzJExplicit thousands separator conflicts with 'n' type in format specifier: grouping decimal_pointrSr[r)_parse_format_specifier_regexmatchrl groupdictrU_locale localeconv) format_specroruZ format_dictrrr'r'r)ruDsN           ruc Cs|d}|d}||t|t|}|d}|dkrF|||}nj|dkr\|||}nT|dkrr|||}n>|dkrt|d}|d |||||d }ntd |S) zGiven an unpadded, non-aligned numeric string 'body' and sign string 'sign', add padding and alignment conforming to the given format specifier dictionary 'spec' (as produced by parse_format_specifier). rrrqs           &         .  ^  0",# %$+   *      P % )pprint.cpython-36.pyc000064400000036722152462730460010531 0ustar003 \|Q @sdZddlZddlZddlZddlZddlm Z dddddd gZ d!d d ddZ d"d d ddZ ddZddZddZGdddZddZGdd d ZddZeeeeeeeeedhZddZd#ddZ ddZ!e"d kre dS)$a/Support to pretty-print lists, tuples, & dictionaries recursively. Very simple, but useful, especially in debugging data structures. Classes ------- PrettyPrinter() Handle pretty-printing operations onto a stream using a configured set of formatting parameters. Functions --------- pformat() Format a Python object into a pretty-printed representation. pprint() Pretty-print a Python object to a stream [default is sys.stdout]. saferepr() Generate a 'standard' repr()-like value, but protect against recursive data structures. N)StringIOpprintpformat isreadable isrecursivesaferepr PrettyPrinterPF)compactcCs t|||||d}|j|dS)zAPretty-print a Python object to a stream [default is sys.stdout].)streamindentwidthdepthr N)rr)objectr r rrr Zprinterr/usr/lib64/python3.6/pprint.pyr/scCst||||dj|S)z= 0Nzdepth must be > 0zwidth must be != 0) int ValueError_depth_indent_per_level_width_stream_sysstdoutbool_compact)rr rrr r rrrrcszPrettyPrinter.__init__cCs&|j||jddid|jjddS)Nr )_formatr+write)rrrrrrszPrettyPrinter.pprintcCs"t}|j||ddid|jS)Nr) _StringIOr1getvalue)rrZsiorrrrszPrettyPrinter.pformatcCs|j|idddS)Nrr)format)rrrrrrszPrettyPrinter.isrecursivecCs |j|idd\}}}|o| S)Nr)r5)rrsreadable recursiverrrrszPrettyPrinter.isreadablec Cst|}||kr.|jt|d|_d|_dS|j|||}|j||} t|| kr|jj t |j d} | dk rd||<| |||||||d||=dSt |t rd||<|j||||||d||=dS|j|dS)NTFr )rr2 _recursion _recursive _readable_reprr*len _dispatchgetr__repr__ isinstancedict _pprint_dict) rrr r allowancecontextlevelobjidrep max_widthprrrr1s,    zPrettyPrinter._formatc Csj|j}|d|jdkr*||jddt|}|r^t|jtd} |j| |||d|||ddS)N{r  )key})r2r)r=sorteditemsr%_format_dict_items) rrr r rDrErFr2ZlengthrPrrrrCs zPrettyPrinter._pprint_dictcCslt|s|jt|dS|j}|j|jd|jt|j||t|jd|d|||jddS)N(r ))r=r2repr __class__rr1listrP)rrr r rDrErFclsrrr_pprint_ordered_dictsz"PrettyPrinter._pprint_ordered_dictcCs0|jd|j||||d|||jddS)N[r ])r2 _format_items)rrr r rDrErFrrr _pprint_lists zPrettyPrinter._pprint_listcCsH|jdt|dkrdnd}|j||||t||||j|dS)NrRr z,)rS)r2r=r[)rrr r rDrErFendcharrrr _pprint_tuples  zPrettyPrinter._pprint_tuplec Cst|s|jt|dS|j}|tkr8|jdd}n&|j|jdd}|t|jd7}t|td}|j||||t||||j|dS)NrKrNz({z})r )rM) r=r2rTrUsetrrOrr[) rrr r rDrErFtypr]rrr _pprint_sets  zPrettyPrinter._pprint_setcCs|j}t|s|t|dSg}|jd} |dkrD|d7}|d7}|j|} } x t| D]\} } t| }| t| dkr| |8} t|| kr|j|q^tjd| }|st |d  st |j | }d}xxt|D]l\}}||}|t|dkr| t| dkr||8}tt||krD|r>|jt||}q|}qW|r^|jt|q^Wt|dkr|||dS|dkr|dx8t|D],\} }| dkr|dd|||qW|dkr|d dS) NTr z\S*\s*rRrr0rLrS) r2r=rT splitlinesr* enumerateappendrefindallAssertionErrorpop)rrr r rDrErFr2ZchunkslinesZ max_width1rIilinerHpartsZ max_width2currentjpart candidaterrr _pprint_strsX     $   zPrettyPrinter._pprint_strc Cs|j}t|dkr"|t|dS|dk}|rF|d7}|d7}|dd} x:t||j||D]$} || || | s^dd|} q^W|r|ddS)Nr rRrbr0rLrS)r2r=rT_wrap_bytes_reprr*) rrr r rDrErFr2ZparensdelimrHrrr _pprint_bytes's"  zPrettyPrinter._pprint_bytescCs>|j}|d|jt|||d|d||d|ddS)Nz bytearray( r rS)r2rwbytes)rrr r rDrErFr2rrr_pprint_bytearray<s zPrettyPrinter._pprint_bytearraycCs8|jd|j|j||d|d|||jddS)Nz mappingproxy( r rS)r2r1copy)rrr r rDrErFrrr_pprint_mappingproxyEs z"PrettyPrinter._pprint_mappingproxycCs|j}||j7}dd|}t|d} xrt|D]f\} \} } | | k} |j| ||}|||d|j| ||t|d| r|nd||| s2||q2WdS)Nz, rLr z: r)r2r)r=rer<r1)rrPr r rDrErFr2delimnlZ last_indexrlrMentlastrHrrrrQMs    z PrettyPrinter._format_dict_itemscCsN|j}||j7}|jdkr,||jdddd|}d} |j|d} } t|} y t| } Wntk rvdSXd}x|sH| }y t| } Wn(tk rd}| |8} | |8} YnX|jr|j|||}t|d}| |kr| } | r|} | |kr| |8} || d} ||q~|| |} |j ||||r<|nd||q~WdS) Nr rLz, rbFTrz, ) r2r)r*iternext StopIterationr/r<r=r1)rrPr r rDrErFr2r~rvrrIitZnext_entrrrHwrrrr[^sN         zPrettyPrinter._format_itemscCs4|j||j|j|\}}}|s&d|_|r0d|_|S)NFT)r5r|r(r;r:)rrrErFrTr7r8rrrr<s zPrettyPrinter._reprcCst||||S)zFormat object for a specific context, returning a string and flags indicating whether the representation is 'readable' and whether the object represents a recursive construct. )r)rrrE maxlevelsrFrrrr5szPrettyPrinter.formatc Cst|s|jt|dS|j|j||}|j}|t|jd7}|jd|j|d|f|j||||d|||jddS)Nr z %s(%s, %srLrS)r=r2rTr<default_factoryrUrrC) rrr r rDrErFZrdfrWrrr_pprint_default_dictsz"PrettyPrinter._pprint_default_dictc Cst|s|jt|dS|j}|j|jd|jdkrN|j|jdd|j}|j|||t|jd|d|||jddS)Nz({r rLrz}))r=r2rTrUrr) most_commonrQ) rrr r rDrErFrWrPrrr_pprint_counters zPrettyPrinter._pprint_counterc Cst|js|jt|dS|j}|j|jd|t|jd7}xrt|jD]d\}} |t|jdkr|j| |||d|||jdqP|j| ||d|||jdd|qPWdS)NrRr rSz, rL)r=mapsr2rTrUrrer1) rrr r rDrErFrWrlmrrr_pprint_chain_maps  zPrettyPrinter._pprint_chain_mapc Cst|s|jt|dS|j}|j|jd|t|jd7}|jd|jdkrz|j||||d|||jdn:|j|||d|||j|j||}|jdd||fdS)NrRr rYrz])z], %smaxlen=%s)rL)r=r2rTrUrmaxlenr[r<) rrr r rDrErFrWZrmlrrr _pprint_deques    zPrettyPrinter._pprint_dequecCs|j|j|||||ddS)Nr )r1data)rrr r rDrErFrrr_pprint_user_dictszPrettyPrinter._pprint_user_dictcCs|j|j|||||ddS)Nr )r1r)rrr r rDrErFrrr_pprint_user_listszPrettyPrinter._pprint_user_listcCs|j|j|||||ddS)Nr )r1r)rrr r rDrErFrrr_pprint_user_stringsz!PrettyPrinter._pprint_user_string)r r NN)2rr r!rrrrrr1r>rCrBr@rX _collections OrderedDictr\rVr^tuplerar_ frozensetrsrrwryrz bytearrayr}_typesMappingProxyTyperQr[r<r5r defaultdictrCounterrChainMaprdequerUserDictrUserListr UserStringrrrrrbsZ&      1    )       cCst|}|tkrt|ddfSt|dd}t|to<|tjkr8|sHdSt|}|rj||krjdd||kfS||krt|ddfSd||<d}d}g} | j } |d7}t } t |j t d} xf| D]^\} }| | |||\}}}| ||||\}}}| d||f|o |o |}|s|rd}qW||=d d j| ||fSt|trP|tjksht|trd|tjkrdt|tr|s~dSd }n"t|dkrd }n|sdSd}t|}|r||kr|dd||kfS||krt|ddfSd||<d}d}g} | j } |d7}x>|D]6}t ||||\}}}| ||s:d}|rd}qW||=|d j| ||fSt|}||o~|jd dfS)NTFr@{}z{...}r )rMz%s: %sz{%s}z, []z[%s]z(%s,)()z(%s)z...<)rTF)rTF)rTF)r_builtin_scalarsrTgetattr issubclassrBr@rr9rfrrOrPr%joinrVrr= startswith)rrErrFr`rrGr7r8Z componentsrfrrPkvZkreprZ kreadableZkrecurZvreprZ vreadableZvrecurr5oZoreprZ oreadableZorecurrHrrrrs|       rcCsdt|jt|fS)Nz)rrr)rrrrr91sr9cCsddl}|dkr,dd ddgddd fgd }t}|j}t|idd|j}|j||j}td ||td ||dS)Nrstringr rrt)iz _safe_repr:zpformat:)r r)timerrrprint)rrrJZt1Zt2Zt3rrr _perfcheck6s rccsd}t|dd}xhtdt|dD]T}|||d}||}||krR||8}tt||krv|rpt|V|}q&|}q&W|rt|VdS)Nrtr)r=rangerT)rrrDrorrlrqrrrrrruCs ru__main__)Nr r N)r r N)N)#r" collectionsrrgsysr,typesriorr3__all__rrrrrrr%rrrrryrr&floatcomplexr.rrr9rrurrrrr#s6   D imp.cpython-36.opt-1.pyc000064400000022742152462730460010736 0ustar003 \) @sdZddlmZmZmZmZmZmZmZm Z m Z yddlm Z Wne k rXdZ YnXddl mZmZmZmZddlmZddlmZddlmZddlZddlZddlZddlZddlZddlZejd ed d dZd Zd Z d Z!dZ"dZ#dZ$dZ%dZ&dZ'ddZ(ddZ)ddZ*d8ddZ+ddZ,ddZ-Gd d!d!Z.Gd"d#d#Z/Gd$d%d%e/ej0Z1d9d&d'Z2Gd(d)d)e/eZ3d:d*d+Z4d,d-Z5d.d/Z6d;d0d1Z7d2d3Z8d4d5Z9e rdksz get_suffixes..cSsg|]}|dtfqS)r) PY_SOURCE)r3r4r r r!r5lscSsg|]}|dtfqS)r1) PY_COMPILED)r3r4r r r!r5ms)rEXTENSION_SUFFIXESSOURCE_SUFFIXESBYTECODE_SUFFIXES) extensionssourcebytecoder r r! get_suffixesisr?c@s eZdZdZddZddZdS) NullImporterz-**DEPRECATED** Null import object. cCs2|dkrtdddntjj|r.td|ddS)Nzempty pathname)r.zexisting directory) ImportErrorosr.isdir)selfr.r r r!__init__zs zNullImporter.__init__cCsdS)zAlways returns None.Nr )rEfullnamer r r! find_moduleszNullImporter.find_moduleN)__name__ __module__ __qualname____doc__rFrHr r r r!r@rsr@cs.eZdZdZdfdd ZfddZZS)_HackedGetDatazMCompatibility support for 'file' arguments of various load_*() functions.Ncstj||||_dS)N)superrFfile)rErGr.rO) __class__r r!rFsz_HackedGetData.__init__c sX|jrH||jkrH|jjs |j}nt|jd|_}| |jSQRXn tj|SdS)z;Gross hack to contort loader to deal w/ load_*()'s bad API.r6N)rOr.closedopenreadrNget_data)rEr.rO)rPr r!rTsz_HackedGetData.get_data)N)rIrJrKrLrFrT __classcell__r r )rPr!rMsrMc@seZdZdZdS)_LoadSourceCompatibilityz5Compatibility support for implementing load_source().N)rIrJrKrLr r r r!rVsrVcCs\t|||}tj|||d}|tjkr8t|tj|}nt|}tj|||_ |j |j _ |S)N)loader) rVrspec_from_file_locationr%modulesr rrSourceFileLoader __loader____spec__rW)rpathnamerOrWspecmoduler r r! load_sources   r`c@seZdZdZdS)_LoadCompiledCompatibilityz7Compatibility support for implementing load_compiled().N)rIrJrKrLr r r r!rasracCsZt|||}tj|||d}|tjkr8t|tj|}nt|}t|||_|j|j _ |S)z**DEPRECATED**)rW) rarrXr%rYr rrr[r\rW)rr]rOrWr^r_r r r! load_compileds    rbcCstjj|rhtjddtjdd}x>|D](}tjj|d|}tjj|r.|}Pq.Wtdj |t j ||gd}|t j krt|t j |St|SdS)z**DEPRECATED**NrFz{!r} is not a package)submodule_search_locations)rCr.rDrr:r;joinexists ValueErrorformatrrXr%rYr r)rr.r< extensionZ init_pathr^r r r! load_packages     ric Cs|\}}}|r2|jd  s"d|kr2tdj|n|dkrZ|tthkrZdj|}t|n|tkrnt|||S|tkrt|||S|tkrtdk r|dkrt |d}t|||SQRXn t|||SnL|t krt ||S|t krt |S|tkrt|Sdj||}t||d dS) z**DEPRECATED** Load a module, given information returned by find_module(). The module name must include the full package name, if any. r6U+zinvalid file open mode {!r}Nz.file object required for import (type code {})r1z*Don't know how to import {} (type code {}))r)r6rj) startswithrfrgr7r8r`rbr2 load_dynamicrR PKG_DIRECTORYri C_BUILTIN init_builtin PY_FROZENrrB) rrOfilenameZdetailssuffixmodetype_msgZ opened_filer r r! load_modules.         rwc Cst|tstdjt|n$t|tdtfsBtdjt||dkrt|rbddddtffSt |rzddddt ffSt j }x|D]}t j j||}xHdtjdgD]6}d|}t j j||}t j j|rd|ddtffSqWx:tD].\}}}||} t j j|| }t j j|rPqWqPqWttj||dd} d |krjt|d } tj| jd} WdQRXt||| d } | ||||ffS) a,**DEPRECATED** Search for a module. If path is omitted or None, search for a built-in, frozen or special module and continue search in sys.path. The module name cannot contain '.'; to search for a submodule of a package, pass the submodule name and the package's __path__. z'name' must be a str, not {}Nz%'path' must be None or a list, not {}rAz.pyrrF)rbr1)encoding) isinstancestr TypeErrorrgtypelist RuntimeErrorrror rqr%r.rCrdrr;isfilernr?rBr rRtokenizedetect_encodingreadline) rr.entryZpackage_directoryrsZpackage_file_nameZ file_pathrtru file_nameryrOr r r!rHs@       rHcCs tj|S)zw**DEPRECATED** Reload the module and return it. The module must have been successfully imported before. ) importlibreload)r_r r r!r3src Cs"yt|Stk rdSXdS)zl**DEPRECATED** Load and return a built-in module by name, or None is such module doesn't exist N)rrB)rr r r!rp>srpcCs0ddl}|jj||}|jj|||d}t|S)z:**DEPRECATED** Load an extension module. rN)rrWorigin)importlib.machineryrExtensionFileLoader ModuleSpecr)rr.rOrrWr^r r r!rmKs  rm)N)N)N)N)N);rL_imprrrrrrrr r r rBZimportlib._bootstrapr r rrZimportlib._bootstrap_externalrrrrrCr%rrr*warnDeprecationWarningZ SEARCH_ERRORr7r8r2Z PY_RESOURCErnrorqZPY_CODERESOURCEZIMP_HOOKr"r$r(r-r0r?r@rMrZrVr`rarbrirwrHrrprmr r r r!s^,          # 4   posixpath.cpython-36.opt-2.pyc000064400000021431152462730460012163 0ustar003 i?'@sbdZdZdZdZdZdZdZdZddlZddl Z ddl Z ddl Z ddl Td d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/g'Z d0d1Z d2d Zd3d Zd4d Zd5d Zd6dZe jje_d7d Zd8dZd9dZd:dZd;dZddZd?dZd@dZ dAdBdCd+Z!dDdEZ"e j#dFkZ$dIdGd-Z%dHd.Z&dS)J.z../:z:/bin:/usr/binNz /dev/null)*normcaseisabsjoin splitdrivesplitsplitextbasenamedirname commonprefixgetsizegetmtimegetatimegetctimeislinkexistslexistsisdirisfileismount expanduser expandvarsnormpathabspathsamefile sameopenfilesamestatcurdirpardirseppathsepdefpathaltsepextsepdevnullrealpathsupports_unicode_filenamesrelpath commonpath ALLOW_MISSINGcCst|trdSdSdS)N/r) isinstancebytes)pathr1!/usr/lib64/python3.6/posixpath.py_get_sep)s r3cCs.tj|}t|ttfs*tdj|jj|S)Nz2normcase() argument must be str or bytes, not '{}') osfspathr.r/str TypeErrorformat __class____name__)sr1r1r2r4s   cCstj|}t|}|j|S)N)r4r5r3 startswith)r;r"r1r1r2r@s c Gstj|}t|}|}yd|s,|dd|xJttj|D]:}|j|rN|}q:| s^|j|rh||7}q:|||7}q:WWn.tttfk rt j d|f|YnX|S)Nrr) r4r5r3mapr<endswithr7AttributeError BytesWarning genericpath_check_arg_types)apr"r0br1r1r2rKs    cCs`tj|}t|}|j|d}|d|||d}}|rX||t|krX|j|}||fS)N)r4r5r3rfindlenrstrip)rDr"iheadtailr1r1r2r hs  cCs6tj|}t|trd}d}nd}d}tj||d|S)Nr-.rr)r4r5r.r/rA _splitext)rDr"r&r1r1r2r ys  cCstj|}|dd|fS)Nr)r4r5)rDr1r1r2r s cCs,tj|}t|}|j|d}||dS)NrF)r4r5r3rG)rDr"rJr1r1r2r s cCsNtj|}t|}|j|d}|d|}|rJ||t|krJ|j|}|S)NrF)r4r5r3rGrHrI)rDr"rJrKr1r1r2r s   c Cs4ytj|}Wnttfk r&dSXtj|jS)NF)r4lstatOSErrorr?statS_ISLNKst_mode)r0str1r1r2rs c Cs(ytj|Wntk r"dSXdS)NFT)r4rOrP)r0r1r1r2rs cCsytj|}Wntk r"dSXtj|jr4dSt|trJt|d}n t|d}t |}ytj|}Wntk r~dSX|j }|j }||krdS|j }|j }||krdSdS)NFs..z..T) r4rOrPrQrRrSr.r/rr(st_devst_ino)r0s1parents2dev1dev2ino1ino2r1r1r2rs.    c Cs4tj|}t|trd}nd}|j|s,|St|}|j|d}|dkrPt|}|dkrdtjkrddl }y|j tj j }Wqt k r|SXqtjd}nRddl }|d|}t|trt|d}y|j|}Wnt k r|SX|j }t|trtj|}d}nd}|j|}|||dp2|S) N~~rFrHOMEASCIIr-r)r4r5r.r/r<r3findrHenvironpwdgetpwuidgetuidpw_dirKeyErrorr6getpwnamfsencoderI) r0tilder"rJrduserhomenamepwentrootr1r1r2rsB            c Cs\tj|}t|trVd|kr |Sts:ddl}|jd|jatj}d}d}t tdd}n:d|krb|St s|ddl}|jd|ja t j}d }d }tj }d}x|||}|sP|j d\}}|j d } | j|r| j|r| d d } y.|dkrtjtj tj| } n|| } Wntk r&|}YqX||d} |d|| }t|}|| 7}qW|S) N$rs\$(\w+|\{[^}]*\}){}environb$z\$(\w+|\{[^}]*\}){}rF)r4r5r.r/ _varprogbrecompilerasearchgetattr_varprogrcspangroupr<r>rjfsdecoderhrH) r0ryr{startendrcrJmjrmvaluerLr1r1r2rsP          c Cstj|}t|tr&d}d}d}d}nd}d}d}d}||krB|S|j|}|rr|j|d rr|j|d  rrd }|j|}g}xV|D]N}|||fkrq||ks| r| s|r|d |kr|j|q|r|jqW|}|j|}|r|||}|p|S) Nr-rMs..rrz..rFrw) r4r5r.r/r<r appendpopr) r0r"emptydotdotdotinitial_slashescomps new_compscompr1r1r2rRs>          cCs@tj|}t|s8t|tr&tj}ntj}t||}t|S)N) r4r5rr.r/getcwdbgetcwdrr)r0cwdr1r1r2rxs    F)strictcCs,tj|}t|dd||i\}}t|S)Nr)r4r5 _joinrealpathr)filenamerr0okr1r1r2r(s c Cst|trd}d}d}nd}d}d}tj}|tkr8t}n|rBf}nt}d} t|rb|dd}|}x"|r|j|\} } }| sf| |krqf| |kr|rt |\}} | |krt |||}qf|}qft || } ytj | } Wn|k rd}YnXt j | j}|s | }qf| |krH|| }|dk r(qf|r:tj | nt | |dfSd|| <t|tj| ||\}}|s|t ||dfS||| <qfW|d fS) Nr-rMs..rrz..rFFT)r.r/r4rr,FileNotFoundErrorrPr partitionr rrOrQrRrSrreadlink)r0restrseenr"r r!r ignored_errormaxlinksrm_newpathrTis_linkrr1r1r2rsd           rdarwinc Cs|s tdtj|}t|tr.d}d}d}n d}d}d}|dkrH|}n tj|}yndd t|j|D}d d t|j|D}tt||g}|gt||||d}|s|St |St t t t fk rtjd ||YnXdS) Nzno path specifiedrMr-s..rrz..cSsg|] }|r|qSr1r1).0xr1r1r2 szrelpath..cSsg|] }|r|qSr1r1)rrr1r1r2rsr*) ValueErrorr4r5r.r/rr rHrrr7r?r@DeprecationWarningrArB) r0rr r"r! start_list path_listrJrel_listr1r1r2r*s0   c s2|s tdtttj|}t|dtr4ddnddyƇfdd|D}ytfd d |D\}Wntk rtd dYnXfd d|D}t|}t |}|}x.t |D]"\}}|||kr|d|}PqW|rn dd}|j |St t fk r,tjd|YnXdS)Nz%commonpath() arg is an empty sequencerr-rMrrcsg|]}|jqSr1)r )rr0)r"r1r2rszcommonpath..c3s|]}|ddkVqdS)NrFr1)rrD)r"r1r2 szcommonpath..z%Can't mix absolute and relative pathscsg|]}fdd|DqS)csg|]}|r|kr|qSr1r1)rc)r r1r2rsz)commonpath...r1)rr;)r r1r2rsr+)r+)rtupler=r4r5r.r/setminmax enumeraterr7r?rArB) paths split_pathsrrWrYcommonrJrprefixr1)r r"r2r+s6  )N)'r r!r&r"r#r$r%r'r4sysrQrA__all__r3rrrr r rN__doc__r r r rrrrr}rxrrrr(rplatformr)r*r+r1r1r1r2sX           *25& F  )aifc.cpython-36.pyc000064400000062531152462730460010114 0ustar003 \~@s>dZddlZddlZddlZdddgZGdddeZdZdd Zd d Z d d Z ddZ ddZ dZ ddZddZddZddZddZddZdd Zdd!lmZdd"lmZed#d$Zd%ej_d&ej_d'ej_d(ej_d)ej_d*ej_Gd+d,d,Z Gd-d.d.Z!d@d/dZ"e"Z#e$d0kr:ddl%Z%e%j&d1dsHe%j&j'd2e%j&d1Z(e"e(d3Z)e*d4e(e*d5e)j+e*d6e)j,e*d7e)j-e*d8e)j.e*d9e)j/e*d:e)j0e%j&d;dr0e%j&d;Z1e*dZ6e6sPe2j7e6qWWdQRXe*d?WdQRXdS)AaJStuff to parse AIFF-C and AIFF files. Unless explicitly stated otherwise, the description below is true both for AIFF-C files and AIFF files. An AIFF-C file has the following structure. +-----------------+ | FORM | +-----------------+ | | +----+------------+ | | AIFC | | +------------+ | | | | | . | | | . | | | . | +----+------------+ An AIFF file has the string "AIFF" instead of "AIFC". A chunk consists of an identifier (4 bytes) followed by a size (4 bytes, big endian order), followed by the data. The size field does not include the size of the 8 byte header. The following chunk types are recognized. FVER (AIFF-C only). MARK <# of markers> (2 bytes) list of markers: (2 bytes, must be > 0) (4 bytes) ("pstring") COMM <# of channels> (2 bytes) <# of sound frames> (4 bytes) (2 bytes) (10 bytes, IEEE 80-bit extended floating point) in AIFF-C files only: (4 bytes) ("pstring") SSND (4 bytes, not used by this program) (4 bytes, not used by this program) A pstring consists of 1 byte length, a string of characters, and 0 or 1 byte pad to make the total length even. Usage. Reading AIFF files: f = aifc.open(file, 'r') where file is either the name of a file or an open file pointer. The open file pointer must have methods read(), seek(), and close(). In some types of audio files, if the setpos() method is not used, the seek() method is not necessary. This returns an instance of a class with the following public methods: getnchannels() -- returns number of audio channels (1 for mono, 2 for stereo) getsampwidth() -- returns sample width in bytes getframerate() -- returns sampling frequency getnframes() -- returns number of audio frames getcomptype() -- returns compression type ('NONE' for AIFF files) getcompname() -- returns human-readable version of compression type ('not compressed' for AIFF files) getparams() -- returns a namedtuple consisting of all of the above in the above order getmarkers() -- get the list of marks in the audio file or None if there are no marks getmark(id) -- get mark with the specified id (raises an error if the mark does not exist) readframes(n) -- returns at most n frames of audio rewind() -- rewind to the beginning of the audio stream setpos(pos) -- seek to the specified position tell() -- return the current position close() -- close the instance (make it unusable) The position returned by tell(), the position given to setpos() and the position of marks are all compatible and have nothing to do with the actual position in the file. The close() method is called automatically when the class instance is destroyed. Writing AIFF files: f = aifc.open(file, 'w') where file is either the name of a file or an open file pointer. The open file pointer must have methods write(), tell(), seek(), and close(). This returns an instance of a class with the following public methods: aiff() -- create an AIFF file (AIFF-C default) aifc() -- create an AIFF-C file setnchannels(n) -- set the number of channels setsampwidth(n) -- set the sample width setframerate(n) -- set the frame rate setnframes(n) -- set the number of frames setcomptype(type, name) -- set the compression type and the human-readable compression type setparams(tuple) -- set all parameters at once setmark(id, pos, name) -- add specified mark to the list of marks tell() -- return current position in output file (useful in combination with setmark()) writeframesraw(data) -- write audio frames without pathing up the file header writeframes(data) -- write audio frames and patch up the file header close() -- patch up the file header and close the output file You should set the parameters before the first writeframesraw or writeframes. The total number of frames does not need to be set, but when it is set to the correct value, the header does not have to be patched up. It is best to first set all parameters, perhaps possibly the compression type, and then write audio frames using writeframesraw. When all frames have been written, either call writeframes(b'') or close() to patch up the sizes in the header. Marks can be added anytime. If there are any marks, you must call close() after all frames have been written. The close() method is called automatically when the class instance is destroyed. When a file is opened with the extension '.aiff', an AIFF file is written, otherwise an AIFF-C file is written. This default can be changed by calling aiff() or aifc() before the first writeframes or writeframesraw. NErroropenopenfpc@s eZdZdS)rN)__name__ __module__ __qualname__rr/usr/lib64/python3.6/aifc.pyrsl@QEc Cs6ytjd|jddStjk r0tYnXdS)Nz>lr)structunpackreaderrorEOFError)filerrr _read_longsrc Cs6ytjd|jddStjk r0tYnXdS)Nz>Lr r)r r r rr)rrrr _read_ulongsrc Cs6ytjd|jddStjk r0tYnXdS)Nz>hr)r r r rr)rrrr _read_shortsrc Cs6ytjd|jddStjk r0tYnXdS)Nz>Hrr)r r r rr)rrrr _read_ushortsrcCs@t|jd}|dkrd}n |j|}|d@dkr<|jd}|S)Nr)ordr )rlengthdatadummyrrr _read_strings   rgcCst|}d}|dkr d }|d}t|}t|}||koL|koLdknrXd}n0|dkrft}n"|d}|d|td|d }||S) Nrrigii?lg@?)rr _HUGE_VALpow)fexponsignhimantlomantrrr _read_floats"r&cCs|jtjd|dS)Nz>h)writer pack)r!xrrr _write_shortsr*cCs|jtjd|dS)Nz>H)r'r r()r!r)rrr _write_ushortsr+cCs|jtjd|dS)Nz>l)r'r r()r!r)rrr _write_longsr,cCs|jtjd|dS)Nz>L)r'r r()r!r)rrr _write_ulongsr-cCsRt|dkrtd|jtjdt||j|t|d@dkrN|jddS)Nz%string exceeds maximum pstring lengthBrr)len ValueErrorr'r r()r!srrr _write_strings   r4c Csddl}|dkrd}|d}nd}|dkr8d}d}d}n|j|\}}|dks^|dks^||krp|dB}d}d}nh|d}|dkr|j||}d}||B}|j|d}|j|}t|}|j||d}|j|}t|}t||t||t||dS) Nriri@ii? r)mathZfrexpZldexpZfloorintr+r-) r!r)r6r#r"r$r%ZfmantZfsmantrrr _write_floats8       r8)Chunk) namedtuple _aifc_paramsz7nchannels sampwidth framerate nframes comptype compnamez3Number of audio channels (1 for mono, 2 for stereo)zSample width in byteszSampling frequencyzNumber of audio framesz(Compression type ("NONE" for AIFF files)zRA human-readable version of the compression type ('not compressed' for AIFF files)c@seZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1ZdS)2 Aifc_readNc Cs<d|_d|_g|_d|_||_t|}|jdkr:td|jd}|dkrTd|_ n|dkrdd|_ ntdd|_ d|_ xd|_ yt|j}Wnt k rPYnX|j}|d kr|j|d|_ nH|d kr||_ |jd }d|_ n(|d krt||_n|d kr|j||jqzW|j s0|j r8tddS)NrsFORMz file does not start with FORM idr sAIFFsAIFCrznot an AIFF or AIFF-C filesCOMMsSSNDsFVERsMARKz$COMM chunk and/or SSND chunk missing)_version_convert_markers _soundpos_filer9Zgetnamerr _aifcZ_comm_chunk_read _ssnd_chunk_ssnd_seek_neededr_read_comm_chunkr _readmarkskip)selfrchunkZformdataZ chunknamerrrr initfp4sJ        zAifc_read.initfpc CsLt|tr>tj|d}y|j|WqH|jYqHXn |j|dS)Nrb) isinstancestrbuiltinsrrKclose)rIr! file_objectrrr __init__\s   zAifc_read.__init__cCs|S)Nr)rIrrr __enter__hszAifc_read.__enter__cGs |jdS)N)rP)rIargsrrr __exit__kszAifc_read.__exit__cCs|jS)N)rB)rIrrr getfpqszAifc_read.getfpcCsd|_d|_dS)Nrr)rErA)rIrrr rewindtszAifc_read.rewindcCs |j}|dk rd|_|jdS)N)rBrP)rIrrrr rPxszAifc_read.closecCs|jS)N)rA)rIrrr tell~szAifc_read.tellcCs|jS)N) _nchannels)rIrrr getnchannelsszAifc_read.getnchannelscCs|jS)N)_nframes)rIrrr getnframesszAifc_read.getnframescCs|jS)N) _sampwidth)rIrrr getsampwidthszAifc_read.getsampwidthcCs|jS)N) _framerate)rIrrr getframerateszAifc_read.getframeratecCs|jS)N) _comptype)rIrrr getcomptypeszAifc_read.getcomptypecCs|jS)N) _compname)rIrrr getcompnameszAifc_read.getcompnamecCs*t|j|j|j|j|j|jS)N)r;rZr^r`r\rbrd)rIrrr getparamss zAifc_read.getparamscCst|jdkrdS|jS)Nr)r1r@)rIrrr getmarkersszAifc_read.getmarkerscCs2x|jD]}||dkr|SqWtdj|dS)Nrzmarker {0!r} does not exist)r@rformat)rIidmarkerrrr getmarks  zAifc_read.getmarkcCs*|dks||jkrtd||_d|_dS)Nrzposition not in ranger)r[rrArE)rIposrrr setposszAifc_read.setposcCs|jrD|jjd|jjd}|j|j}|r>|jj|dd|_|dkrPdS|jj||j}|jrv|rv|j|}|jt||j|j |_|S)Nrr=r) rErDseekr rA _framesizer?r1rYr])rInframesrrkrrrr readframess     zAifc_read.readframescCsddl}|j|dS)Nrr)audioopZalaw2lin)rIrrqrrr _alaw2linszAifc_read._alaw2lincCsddl}|j|dS)Nrr)rqZulaw2lin)rIrrqrrr _ulaw2linszAifc_read._ulaw2lincCs2ddl}t|dsd|_|j|d|j\}|_|S)Nr _adpcmstater)rqhasattrrtZ adpcm2lin)rIrrqrrr _adpcm2lins  zAifc_read._adpcm2lincCs.t||_t||_t|dd|_tt||_|j|j|_|j rd}|j dkrld}t j dd|_ |j d|_|rt|jj d}|d@dkr|d}|j ||_ |jjddt||_|jd kr*|jd kr|j|_n2|jdkr|j|_n|jdkr|j|_ntdd|_n d |_d|_dS)Nr=rrzWarning: bad COMM chunk sizer sNONEsG722ulawULAWalawALAWzunsupported compression typersnot compressedr)rzr{)r|r})rrYrr[r]r7r&r_rnrCZ chunksizewarningswarnr rarrrmrrcrvr?rsrrr)rIrJZkludgerrrr rFs<               zAifc_read._read_comm_chunkc Cst|}yHxBt|D]6}t|}t|}t|}|s8|r|jj|||fqWWnDtk rdt|jt|jdkr|dnd|f}tj |YnXdS)Nz;Warning: MARK chunk contains only %s marker%s instead of %srr3) rrangerrr@appendrr1r~r)rIrJZnmarkersirhrknamewrrr rGszAifc_read._readmark)rrrrBrKrRrSrUrVrWrPrXrZr\r^r`rbrdrerfrjrlrprrrsrvrFrGrrrr r<s2$( &r<c@s0eZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Zd:d;Z dd?Z"d@dAZ#dBdCZ$dDdEZ%dFdGZ&dHdIZ'dS)J Aifc_writeNc Cs\t|trNtj|d}y|j|Wn|jYnX|jdrXd|_n |j|dS)Nwbz.aiffr)rMrNrOrrKrPendswithrC)rIr!rQrrr rR+s   zAifc_write.__init__cCs^||_t|_d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ d|_ g|_ d|_d|_dS)NsNONEsnot compressedrr)rB _AIFC_versionr>rarcr?rYr]r_r[_nframeswritten _datawritten _datalengthr@ _marklengthrC)rIrrrr rK;szAifc_write.initfpcCs |jdS)N)rP)rIrrr __del__LszAifc_write.__del__cCs|S)Nr)rIrrr rSOszAifc_write.__enter__cGs |jdS)N)rP)rIrTrrr rURszAifc_write.__exit__cCs|jrtdd|_dS)Nz0cannot change parameters after starting to writer)rrrC)rIrrr aiffXszAifc_write.aiffcCs|jrtdd|_dS)Nz0cannot change parameters after starting to writer)rrrC)rIrrr aifc]szAifc_write.aifccCs(|jrtd|dkrtd||_dS)Nz0cannot change parameters after starting to writerzbad # of channels)rrrY)rI nchannelsrrr setnchannelsbs zAifc_write.setnchannelscCs|jstd|jS)Nznumber of channels not set)rYr)rIrrr rZiszAifc_write.getnchannelscCs0|jrtd|dks|dkr&td||_dS)Nz0cannot change parameters after starting to writerr zbad sample width)rrr])rI sampwidthrrr setsampwidthns zAifc_write.setsampwidthcCs|jstd|jS)Nzsample width not set)r]r)rIrrr r^uszAifc_write.getsampwidthcCs(|jrtd|dkrtd||_dS)Nz0cannot change parameters after starting to writerzbad frame rate)rrr_)rI frameraterrr setframeratezs zAifc_write.setframeratecCs|jstd|jS)Nzframe rate not set)r_r)rIrrr r`szAifc_write.getframeratecCs|jrtd||_dS)Nz0cannot change parameters after starting to write)rrr[)rIrorrr setnframesszAifc_write.setnframescCs|jS)N)r)rIrrr r\szAifc_write.getnframescCs.|jrtd|d krtd||_||_dS) Nz0cannot change parameters after starting to writeNONEulawULAWalawALAWG722zunsupported compression type)rrrrrr)rrrarc)rIcomptypecompnamerrr setcomptypeszAifc_write.setcomptypecCs|jS)N)ra)rIrrr rbszAifc_write.getcomptypecCs|jS)N)rc)rIrrr rdszAifc_write.getcompnamecCsf|\}}}}}}|jrtd|d kr.td|j||j||j||j||j||dS) Nz0cannot change parameters after starting to writeNONEulawULAWalawALAWG722zunsupported compression type)rrrrrr)rrrrrrr)rIZparamsrrrrorrrrr setparamss    zAifc_write.setparamscCs>|j s|j s|j r tdt|j|j|j|j|j|jS)Nznot all parameters set)rYr]r_rr;r[rarc)rIrrr reszAifc_write.getparamscCs|dkrtd|dkr tdt|ts2tdx 0zmarker position must be >= 0zmarker name must be bytes)rrMbytesrr1r@r)rIrhrkrrrrr setmarks zAifc_write.setmarkcCs2x|jD]}||dkr|SqWtdj|dS)Nrzmarker {0!r} does not exist)r@rrg)rIrhrirrr rjs  zAifc_write.getmarkcCst|jdkrdS|jS)Nr)r1r@)rIrrr rfszAifc_write.getmarkerscCs|jS)N)r)rIrrr rXszAifc_write.tellcCszt|ttfst|jd}|jt|t||j|j}|j rN|j |}|j j ||j ||_ |j t||_ dS)Nr/)rMr bytearray memoryviewcast_ensure_header_writtenr1r]rYr?rBr'rr)rIrrorrr writeframesraws   zAifc_write.writeframesrawcCs.|j||j|jks"|j|jkr*|jdS)N)rrr[rr _patchheader)rIrrrr writeframess   zAifc_write.writeframesc Cs|jdkrdSz^|jd|jd@r<|jjd|jd|_|j|j|jksb|j|jksb|jrj|j Wdd|_ |j}d|_|j XdS)Nrrr0) rBrrr' _writemarkersrr[rrrr?rP)rIr!rrr rPs         zAifc_write.closecCsddl}|j|dS)Nrr)rqZlin2alaw)rIrrqrrr _lin2alawszAifc_write._lin2alawcCsddl}|j|dS)Nrr)rqZlin2ulaw)rIrrqrrr _lin2ulawszAifc_write._lin2ulawcCs2ddl}t|dsd|_|j|d|j\}|_|S)Nrrtr)rqrurtZ lin2adpcm)rIrrqrrr _lin2adpcms  zAifc_write._lin2adpcmcCsf|jsb|jd kr.|jsd|_|jdkr.td|js|jdkr|j|_n&|jdkr(|j|_n|jdkr:|j|_dS)NsG722ulawULAWalawALAW)rr)rr)rarr?rr)rIrrr _init_compressions      zAifc_write._init_compressioncCsL|jr|jdkr|j|jjd|js<||j|j|_|j|j|j|_|jd@rf|jd|_|jr|jdkr|jd|_|jd@r|jd|_n0|jd kr|jd d |_|jd@r|jd|_y|jj |_ Wn t t fk rd|_ YnX|j |j}|jrD|jjd |jjd t|jd t|j|jn |jjd|jjdt|j|t|j|j|j dk r|jj |_t|j|j|jdkrt|jdnt|j|jdt|j|j|jr|jj|jt|j|j|jjd|j dk r|jj |_t|j|jdt|jdt|jddS)NsNONEsFORMrulawULAWalawALAWrG722r sAIFCsFVERsAIFFsCOMMr=sSSNDr)rrrr)rrrrr)rCrarrBr'r[rYr]rrX_form_length_posAttributeErrorOSError_write_form_lengthr-r>r* _nframes_posr8r_r4rc_ssnd_length_pos)rIZ initlength commlengthrrr r!s^                        zAifc_write._write_headercCs\|jr*d t|j}|d@r$|d}d}nd}d}t|jd||jd|d||S) Nrxr rr r=ry)rCr1rcr-rBr)rI datalengthrZ verslengthrrr rTs zAifc_write._write_form_lengthcCs|jj}|jd@r,|jd}|jjdn|j}||jkrd|j|jkrd|jdkrd|jj|ddS|jj|j d|j |}|jj|j dt |j|j|jj|j dt |j|d|jj|d|j|_||_dS)Nrr0rr=)rBrXrr'rr[rrrmrrrr-r)rIZcurposrrrrr ras&       zAifc_write._patchheadercCst|jdkrdS|jjdd}xD|jD]:}|\}}}|t|dd}t|d@dkr*|d}q*Wt|j||d|_t|jt|jx<|jD]2}|\}}}t|j|t|j|t|j|qWdS)NrsMARKrrr=)r1r@rBr'r-rr*r4)rIrrirhrkrrrr rws"          zAifc_write._writemarkers)(rrrrBrRrKrrSrUrrrrZrr^rr`rr\rrbrdrrerrjrfrXrrrPrrrrrrrrrrrrr r sJ    3 rcCsJ|dkrt|dr|j}nd}|dkr.t|S|dkr>t|StddS) NmoderLrrrz$mode must be 'r', 'rb', 'w', or 'wb')rrL)rr)rurr<rr)r!rrrr rs __main__rz/usr/demos/data/audio/bach.aiffrZReadingz nchannels =z nframes =z sampwidth =z framerate =z comptype =z compname =rZWritingrizDone.)N)8__doc__r rOr~__all__ Exceptionrrrrrrrrr&r*r+r,r-r4r8rJr9 collectionsr:r;rrrrorrr<rrrrsysargvrfnr!printrZr\r^r`rbrdZgngrrerprrrrrr sz  !  ~          _sysconfigdata_dm_linux_x86_64-linux-gnu.cpython-36.pyc000064400000056413152462730460017052 0ustar003 iu@sdddddddddddd d dd d d dddddddddddddddddddddddd dd!d"d#d$d%dddd&d'd d(d)d*d&d+dd!dddd,d-ddddddd.d&d&d&d&dd&dd&d&d&d&d&dddddddddd&dd&d&d&d&d&d&d&d&dd&d&d&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&dd&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&dd&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&dd&d&d&d&d&ddd&d&dd&dddd&d&d&ddd&d&dddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&dd&dd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd&d&d&d&d&d&dd&d&d&d&d&d&d&d&ddd&d&dd&d&ddd&d&d&d&d&d&d&dddddd&dd&d&ddddddd&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&d&ddd&d&d&d&ddd&d&d&d&d&d&d&d&d&d&d&d&d&d&d&dd d/ddd0d1d0d0d2d3d4d d5d6dd7dd d8ddd9dd:d;ddd d d?d@dAdBdd+ddCdDdddEddddddd&dFdGdHddIdJd dKdLd&dMd dNdddddddd dOdPdQd dRdSdd ddTd&ddd ddUddddVdWd d ddXd&dYdZdd[d6d\d]dd&d&d&dd^d_d`dadbd9dddcd?dddddedfdgdfdedgdededfded]dededededfd&dhdidjd&dkdlddmd:d&d&dddddnddodpdqdd&dd ddrd&d&dsdtdd&d&d&dddd&d&d&ddudvdtdwdxdxdtdyZdzS){Zdmarrcsz!-Wno-unused-result -Wsign-comparez-IObjects -IInclude -IPythonz/usr/binz/usr/lib64/python3.6z-L. -lpython3.6dmzOgcc -pthread -shared -Wl,-z,relro -Wl,-z,now -g -Wl,-z,relro -Wl,-z,now -gpythonzx86_64-redhat-linux-gnu\z gcc -pthreadz-fPICav-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapvz?configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.ina-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapva=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-typez-Wl,-z,relro -Wl,-z,now -gz-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fno-semantic-interposition -g -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -ga'--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-ipv6' '--enable-shared' '--with-computed-gotos=yes' '--with-dbmliborder=gdbm:ndbm:bdb' '--with-system-expat' '--with-system-ffi' '--enable-loadable-sqlite-extensions' '--with-dtrace' '--with-lto' '--with-ssl-default-suites=openssl' '--with-valgrind' '--without-ensurepip' '--with-pydebug' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS= -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv ' 'LDFLAGS= -Wl,-z,relro -Wl,-z,now -g ' 'CPPFLAGS=' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'z /usr/includez/usr/include/python3.6dm:zLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/debugz/bin/shz.sozcpython-36dm-x86_64-linux-gnuz&Parser Objects Python Modules Programsz9/builddir/build/BUILD/Python-3.6.8/Tools/gdb/libpython.pyz"/* Don't use ncurses extensions */z-szInclude Lib MisczGLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/debug ./pythonzLD_LIBRARY_PATH=/builddir/build/BUILD/Python-3.6.8/build/debug ./python /builddir/build/BUILD/Python-3.6.8/Tools/scripts/run_tests.pyizPython/thread.ozIpython3.6 /builddir/build/BUILD/Python-3.6.8/Tools/scripts/update_file.pyz3.6z"/builddir/build/BUILD/Python-3.6.8z)xml xml/dom xml/etree xml/parsers xml/saxz./builddir/build/BUILD/Python-3.6.8/build/debugz /usr/sharez/usr(ABIFLAGSAC_APPLE_UNIVERSAL_BUILDAIX_GENUINE_CPLUSPLUSANDROID_API_LEVELARARFLAGS BASECFLAGS BASECPPFLAGS BASEMODLIBSBINDIR BINLIBDEST BLDLIBRARY BLDSHAREDBUILDEXE BUILDPYTHONBUILD_GNU_TYPE BYTESTR_DEPSCCCCSHAREDCFLAGSCFLAGSFORSHAREDCFLAGS_ALIASING CONFIGFILESCONFIGURE_CFLAGSCONFIGURE_CFLAGS_NODISTCONFIGURE_CPPFLAGSCONFIGURE_LDFLAGSCONFIGURE_LDFLAGS_NODIST CONFIG_ARGSCONFINCLUDEDIR CONFINCLUDEPYCOREPYTHONPATH COVERAGE_INFOCOVERAGE_REPORTCOVERAGE_REPORT_OPTIONSCPPFLAGSCXXDESTDIRSDESTLIBDESTPATH DESTSHAREDDFLAGSDIRMODEDISTDISTDIRS DISTFILES DLINCLDIR DLLLIBRARY"DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754DOUBLE_IS_BIG_ENDIAN_IEEE754DOUBLE_IS_LITTLE_ENDIAN_IEEE754DTRACE DTRACE_DEPSDTRACE_HEADERS DTRACE_OBJS DYNLOADFILE ENABLE_IPV6 ENSUREPIPEXEEXEMODEEXTRAMACHDEPPATH EXTRATESTOPTS EXTRA_CFLAGS EXT_SUFFIXFILEMODEFLOCK_NEEDS_LIBBSDGETPGRP_HAVE_ARGGETTIMEOFDAY_NO_TZ GITBRANCHGITTAG GITVERSIONGNULD HAVE_ACCEPT4 HAVE_ACOSH HAVE_ADDRINFO HAVE_ALARMHAVE_ALIGNED_REQUIRED HAVE_ALLOCA_H HAVE_ALTZONE HAVE_ASINHHAVE_ASM_TYPES_H HAVE_ATANHHAVE_BIND_TEXTDOMAIN_CODESETHAVE_BLUETOOTH_BLUETOOTH_HHAVE_BLUETOOTH_HHAVE_BROKEN_MBSTOWCSHAVE_BROKEN_NICEHAVE_BROKEN_PIPE_BUFHAVE_BROKEN_POLLHAVE_BROKEN_POSIX_SEMAPHORESHAVE_BROKEN_PTHREAD_SIGMASKHAVE_BROKEN_SEM_GETVALUEHAVE_BROKEN_UNSETENVHAVE_BUILTIN_ATOMIC HAVE_CHFLAGS HAVE_CHOWN HAVE_CHROOT HAVE_CLOCKHAVE_CLOCK_GETRESHAVE_CLOCK_GETTIMEHAVE_CLOCK_SETTIMEHAVE_COMPUTED_GOTOS HAVE_CONFSTR HAVE_CONIO_H HAVE_COPYSIGN HAVE_CRYPT_H HAVE_CTERMIDHAVE_CTERMID_RHAVE_CURSES_FILTER HAVE_CURSES_HHAVE_CURSES_HAS_KEYHAVE_CURSES_IMMEDOKHAVE_CURSES_IS_PADHAVE_CURSES_IS_TERM_RESIZEDHAVE_CURSES_RESIZETERMHAVE_CURSES_RESIZE_TERMHAVE_CURSES_SYNCOKHAVE_CURSES_TYPEAHEADHAVE_CURSES_USE_ENVHAVE_CURSES_WCHGATHAVE_DECL_ISFINITEHAVE_DECL_ISINFHAVE_DECL_ISNANHAVE_DECL_RTLD_DEEPBINDHAVE_DECL_RTLD_GLOBALHAVE_DECL_RTLD_LAZYHAVE_DECL_RTLD_LOCALHAVE_DECL_RTLD_NODELETEHAVE_DECL_RTLD_NOLOADHAVE_DECL_RTLD_NOWHAVE_DECL_TZNAMEHAVE_DEVICE_MACROS HAVE_DEV_PTC HAVE_DEV_PTMX HAVE_DIRECT_HHAVE_DIRENT_D_TYPE HAVE_DIRENT_H HAVE_DIRFD HAVE_DLFCN_H HAVE_DLOPEN HAVE_DUP2 HAVE_DUP3HAVE_DYNAMIC_LOADING HAVE_ENDIAN_H HAVE_EPOLLHAVE_EPOLL_CREATE1HAVE_ERF HAVE_ERFC HAVE_ERRNO_H HAVE_EXECV HAVE_EXPM1HAVE_FACCESSAT HAVE_FCHDIR HAVE_FCHMOD HAVE_FCHMODAT HAVE_FCHOWN HAVE_FCHOWNAT HAVE_FCNTL_HHAVE_FDATASYNCHAVE_FDOPENDIR HAVE_FEXECVE HAVE_FINITE HAVE_FLOCK HAVE_FORK HAVE_FORKPTYHAVE_FPATHCONF HAVE_FSEEK64 HAVE_FSEEKO HAVE_FSTATAT HAVE_FSTATVFS HAVE_FSYNC HAVE_FTELL64 HAVE_FTELLO HAVE_FTIMEHAVE_FTRUNCATE HAVE_FUTIMENS HAVE_FUTIMESHAVE_FUTIMESATHAVE_GAI_STRERROR HAVE_GAMMAHAVE_GCC_ASM_FOR_MC68881HAVE_GCC_ASM_FOR_X64HAVE_GCC_ASM_FOR_X87HAVE_GCC_UINT128_THAVE_GETADDRINFOHAVE_GETC_UNLOCKEDHAVE_GETENTROPYHAVE_GETGROUPLISTHAVE_GETGROUPSHAVE_GETHOSTBYNAMEHAVE_GETHOSTBYNAME_RHAVE_GETHOSTBYNAME_R_3_ARGHAVE_GETHOSTBYNAME_R_5_ARGHAVE_GETHOSTBYNAME_R_6_ARGHAVE_GETITIMERHAVE_GETLOADAVG HAVE_GETLOGINHAVE_GETNAMEINFOHAVE_GETPAGESIZEHAVE_GETPEERNAME HAVE_GETPGID HAVE_GETPGRP HAVE_GETPIDHAVE_GETPRIORITY HAVE_GETPWENTHAVE_GETRANDOMHAVE_GETRANDOM_SYSCALLHAVE_GETRESGIDHAVE_GETRESUID HAVE_GETSID HAVE_GETSPENT HAVE_GETSPNAMHAVE_GETTIMEOFDAY HAVE_GETWDHAVE_GLIBC_MEMMOVE_BUG HAVE_GRP_HHAVE_HSTRERROR HAVE_HTOLE64 HAVE_HYPOT HAVE_IEEEFP_HHAVE_IF_NAMEINDEXHAVE_INET_ATONHAVE_INET_PTONHAVE_INITGROUPSHAVE_INTTYPES_H HAVE_IO_HHAVE_IPA_PURE_CONST_BUG HAVE_KILL HAVE_KILLPG HAVE_KQUEUEHAVE_LANGINFO_HHAVE_LARGEFILE_SUPPORT HAVE_LCHFLAGS HAVE_LCHMOD HAVE_LCHOWN HAVE_LGAMMA HAVE_LIBDL HAVE_LIBDLD HAVE_LIBIEEEHAVE_LIBINTL_HHAVE_LIBREADLINEHAVE_LIBRESOLVHAVE_LIBSENDFILEHAVE_LIBUTIL_H HAVE_LINK HAVE_LINKATHAVE_LINUX_CAN_BCM_HHAVE_LINUX_CAN_HHAVE_LINUX_CAN_RAW_FD_FRAMESHAVE_LINUX_CAN_RAW_HHAVE_LINUX_NETLINK_HHAVE_LINUX_RANDOM_HHAVE_LINUX_TIPC_H HAVE_LOCKF HAVE_LOG1P HAVE_LOG2HAVE_LONG_DOUBLE HAVE_LSTAT HAVE_LUTIMES HAVE_MAKEDEV HAVE_MBRTOWC HAVE_MEMMOVE HAVE_MEMORY_H HAVE_MEMRCHR HAVE_MKDIRAT HAVE_MKFIFO HAVE_MKFIFOAT HAVE_MKNOD HAVE_MKNODAT HAVE_MKTIME HAVE_MMAP HAVE_MREMAPHAVE_NCURSES_H HAVE_NDIR_HHAVE_NETPACKET_PACKET_H HAVE_NET_IF_H HAVE_NICE HAVE_OPENAT HAVE_OPENPTY HAVE_PATHCONF HAVE_PAUSE HAVE_PIPE2 HAVE_PLOCK HAVE_POLL HAVE_POLL_HHAVE_POSIX_FADVISEHAVE_POSIX_FALLOCATE HAVE_PREAD HAVE_PRLIMITHAVE_PROCESS_HHAVE_PROTOTYPESHAVE_PTHREAD_ATFORKHAVE_PTHREAD_CONDATTR_SETCLOCKHAVE_PTHREAD_DESTRUCTORHAVE_PTHREAD_HHAVE_PTHREAD_INITHAVE_PTHREAD_KILLHAVE_PTHREAD_SIGMASK HAVE_PTY_H HAVE_PUTENV HAVE_PWRITE HAVE_READLINKHAVE_READLINKAT HAVE_READV HAVE_REALPATH HAVE_RENAMEATHAVE_RL_APPEND_HISTORYHAVE_RL_CALLBACKHAVE_RL_CATCH_SIGNAL#HAVE_RL_COMPLETION_APPEND_CHARACTER'HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOKHAVE_RL_COMPLETION_MATCHES"HAVE_RL_COMPLETION_SUPPRESS_APPENDHAVE_RL_PRE_INPUT_HOOKHAVE_RL_RESIZE_TERMINAL HAVE_ROUNDHAVE_SCHED_GET_PRIORITY_MAX HAVE_SCHED_HHAVE_SCHED_RR_GET_INTERVALHAVE_SCHED_SETAFFINITYHAVE_SCHED_SETPARAMHAVE_SCHED_SETSCHEDULER HAVE_SELECTHAVE_SEM_GETVALUE HAVE_SEM_OPENHAVE_SEM_TIMEDWAITHAVE_SEM_UNLINK HAVE_SENDFILE HAVE_SETEGID HAVE_SETEUID HAVE_SETGIDHAVE_SETGROUPSHAVE_SETHOSTNAMEHAVE_SETITIMERHAVE_SETLOCALE HAVE_SETPGID HAVE_SETPGRPHAVE_SETPRIORITY HAVE_SETREGIDHAVE_SETRESGIDHAVE_SETRESUID HAVE_SETREUID HAVE_SETSID HAVE_SETUID HAVE_SETVBUF HAVE_SHADOW_HHAVE_SIGACTIONHAVE_SIGALTSTACKHAVE_SIGINTERRUPT HAVE_SIGNAL_HHAVE_SIGPENDING HAVE_SIGRELSEHAVE_SIGTIMEDWAIT HAVE_SIGWAITHAVE_SIGWAITINFO HAVE_SNPRINTFHAVE_SOCKADDR_ALGHAVE_SOCKADDR_SA_LENHAVE_SOCKADDR_STORAGEHAVE_SOCKETPAIR HAVE_SPAWN_H HAVE_SSIZE_T HAVE_STATVFSHAVE_STAT_TV_NSECHAVE_STAT_TV_NSEC2HAVE_STDARG_PROTOTYPES HAVE_STDINT_H HAVE_STDLIB_HHAVE_STD_ATOMIC HAVE_STRDUP HAVE_STRFTIMEHAVE_STRINGS_H HAVE_STRING_H HAVE_STRLCPYHAVE_STROPTS_HHAVE_STRUCT_PASSWD_PW_GECOSHAVE_STRUCT_PASSWD_PW_PASSWDHAVE_STRUCT_STAT_ST_BIRTHTIMEHAVE_STRUCT_STAT_ST_BLKSIZEHAVE_STRUCT_STAT_ST_BLOCKSHAVE_STRUCT_STAT_ST_FLAGSHAVE_STRUCT_STAT_ST_GENHAVE_STRUCT_STAT_ST_RDEVHAVE_STRUCT_TM_TM_ZONE HAVE_SYMLINKHAVE_SYMLINKAT HAVE_SYNC HAVE_SYSCONFHAVE_SYSEXITS_HHAVE_SYS_AUDIOIO_HHAVE_SYS_BSDTTY_HHAVE_SYS_DEVPOLL_HHAVE_SYS_DIR_HHAVE_SYS_ENDIAN_HHAVE_SYS_EPOLL_HHAVE_SYS_EVENT_HHAVE_SYS_FILE_HHAVE_SYS_IOCTL_HHAVE_SYS_KERN_CONTROL_HHAVE_SYS_LOADAVG_HHAVE_SYS_LOCK_HHAVE_SYS_MKDEV_HHAVE_SYS_MODEM_HHAVE_SYS_NDIR_HHAVE_SYS_PARAM_HHAVE_SYS_POLL_HHAVE_SYS_RANDOM_HHAVE_SYS_RESOURCE_HHAVE_SYS_SELECT_HHAVE_SYS_SENDFILE_HHAVE_SYS_SOCKET_HHAVE_SYS_STATVFS_HHAVE_SYS_STAT_HHAVE_SYS_SYSCALL_HHAVE_SYS_SYSMACROS_HHAVE_SYS_SYS_DOMAIN_HHAVE_SYS_TERMIO_HHAVE_SYS_TIMES_HHAVE_SYS_TIME_HHAVE_SYS_TYPES_HHAVE_SYS_UIO_H HAVE_SYS_UN_HHAVE_SYS_UTSNAME_HHAVE_SYS_WAIT_HHAVE_SYS_XATTR_HHAVE_TCGETPGRPHAVE_TCSETPGRP HAVE_TEMPNAMHAVE_TERMIOS_H HAVE_TERM_H HAVE_TGAMMA HAVE_TIMEGM HAVE_TIMES HAVE_TMPFILE HAVE_TMPNAM HAVE_TMPNAM_R HAVE_TM_ZONE HAVE_TRUNCATE HAVE_TZNAME HAVE_UCS4_TCL HAVE_UNAME HAVE_UNISTD_H HAVE_UNLINKAT HAVE_UNSETENVHAVE_USABLE_WCHAR_T HAVE_UTIL_HHAVE_UTIMENSAT HAVE_UTIMES HAVE_UTIME_H HAVE_WAIT3 HAVE_WAIT4 HAVE_WAITID HAVE_WAITPID HAVE_WCHAR_H HAVE_WCSCOLL HAVE_WCSFTIME HAVE_WCSXFRM HAVE_WMEMCMPHAVE_WORKING_TZSET HAVE_WRITEVHAVE_ZLIB_COPY HAVE__GETPTY HOST_GNU_TYPEINCLDIRSTOMAKE INCLUDEDIR INCLUDEPYINSTALL INSTALL_DATAINSTALL_PROGRAMINSTALL_SCRIPTINSTALL_SHARED INSTSONAMEIO_HIO_OBJS LDCXXSHAREDLDFLAGSLDLAST LDLIBRARY LDLIBRARYDIRLDSHARED LDVERSIONLIBCLIBDESTLIBDIRLIBFFI_INCLUDEDIRLIBM LIBOBJDIRLIBOBJSLIBPCLIBPLLIBRARY LIBRARY_OBJSLIBRARY_OBJS_OMIT_FROZENLIBS LIBSUBDIRSLINKCC LINKFORSHAREDLIPO_32BIT_FLAGS LLVM_PROF_ERRLLVM_PROF_FILELLVM_PROF_MERGERLN LOCALMODLIBSLOG1P_DROPS_ZERO_SIGNMACHDEP MACHDEPPATH MACHDEP_OBJS MACHDESTLIBMACOSX_DEPLOYMENT_TARGETMAINCCMAJOR_IN_MKDEVMAJOR_IN_SYSMACROS MAKESETUPMANDIRMKDIR_PMODLIBSMODNAMESMODOBJS MODULE_OBJS MULTIARCHMULTIARCH_CPPFLAGSMVWDELCH_IS_EXPRESSION NO_AS_NEEDED OBJECT_OBJSOPTOTHER_LIBTOOL_OPTPACKAGE_BUGREPORT PACKAGE_NAMEPACKAGE_STRINGPACKAGE_TARNAME PACKAGE_URLPACKAGE_VERSIONPARSER_HEADERS PARSER_OBJSPGENPGENOBJSPGOBJSPGO_PROF_GEN_FLAGPGO_PROF_USE_FLAGPLATDIRPOBJSPOSIX_SEMAPHORES_NOT_ENABLED PROFILE_TASKPTHREAD_SYSTEM_SCHED_SUPPORTED PY3LIBRARYPYLONG_BITS_IN_DIGITPYTHONPYTHONFRAMEWORKPYTHONFRAMEWORKDIRPYTHONFRAMEWORKINSTALLDIRPYTHONFRAMEWORKPREFIX PYTHONPATHPYTHON_FOR_BUILDPYTHON_FOR_REGENPYTHON_HEADERS PYTHON_OBJS PY_CFLAGSPY_CFLAGS_NODISTPY_COERCE_C_LOCALEPY_CORE_CFLAGSPY_CORE_LDFLAGS PY_CPPFLAGSPY_FORMAT_SIZE_T PY_LDFLAGSPY_LDFLAGS_NODISTPY_SSL_DEFAULT_CIPHERSPY_SSL_DEFAULT_CIPHER_STRINGPY_WARN_ON_C_LOCALEPy_DEBUGPy_ENABLE_SHAREDPy_HASH_ALGORITHM QUICKTESTOPTSREADELF RESSRCDIR RETSIGTYPE RUNSHARED SCRIPTDIRSETPGRP_HAVE_ARGSGI_ABISHELLSHLIBS SHLIB_SUFFIXSIGNED_RIGHT_SHIFT_ZERO_FILLSSITEPATH SIZEOF_DOUBLE SIZEOF_FLOAT SIZEOF_FPOS_T SIZEOF_INT SIZEOF_LONGSIZEOF_LONG_DOUBLESIZEOF_LONG_LONG SIZEOF_OFF_T SIZEOF_PID_TSIZEOF_PTHREAD_T SIZEOF_SHORT SIZEOF_SIZE_T SIZEOF_TIME_TSIZEOF_UINTPTR_T SIZEOF_VOID_PSIZEOF_WCHAR_T SIZEOF__BOOLSOABISRCDIRS SRC_GDB_HOOKS STDC_HEADERSSTRICT_SYSV_CURSES STRIPFLAGSUBDIRS SUBDIRSTOOSYSLIBSSYS_SELECT_WITH_SYS_TIMETANH_PRESERVES_ZERO_SIGNTCLTK_INCLUDES TCLTK_LIBSTESTOPTSTESTPATH TESTPYTHONTESTPYTHONOPTS TESTRUNNER TESTTIMEOUT THREADOBJTIMEMODULE_LIBTIME_WITH_SYS_TIMETM_IN_SYS_TIME UNICODE_DEPS UNIVERSALSDK UPDATE_FILEUSE_COMPUTED_GOTOS USE_INLINEVERSIONVPATHWANT_SIGFPE_HANDLERWINDOW_HAS_FLAGSWITH_DOC_STRINGS WITH_DTRACE WITH_DYLD WITH_LIBINTLWITH_NEXT_FRAMEWORK WITH_PYMALLOC WITH_THREAD WITH_VALGRINDX87_DOUBLE_ROUNDING XMLLIBSUBDIRS abs_builddir abs_srcdir datarootdir exec_prefixprefixsrcdirN)build_time_varsrr@/usr/lib64/python3.6/_sysconfigdata_dm_linux_x86_64-linux-gnu.pys *operator.cpython-36.opt-1.pyc000064400000033133152462730460012000 0ustar003 \o*6@s(dZddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6g6Zd7d8lmZd9d&Zd:d#Zd;d Zdd Z d?d-Z d@d5Z dAdZ dBdZdCdZdDdZdEdZdFd ZdGdZdHdZeZdId%ZdJd)ZdKd*ZdLd'ZdMd,ZdNd.ZdOd/ZdPd0ZdQd1ZdRd3ZdSd4ZdTd6Z dUdZ!dVdZ"dWdZ#dXdZ$dYd Z%dZdZ&d[d2Z'dqd\d$Z(Gd]ddZ)Gd^d d Z*Gd_d(d(Z+d`dZ,dadZ-dbdZ.dcdZ/dddZ0dedZ1dfdZ2dgdZ3dhdZ4didZ5djdZ6dkdZ7dld!Z8dmd"Z9y d7dnl:TWne;k rbYnXd7dol:mZeZeZ?e Z@e ZAe ZBeZCeZDeZEeZFeZGeZHeZIeZJeZKeZLeZMeZNeZOeZPeZQeZReZSeZTe ZUe!ZVe"ZWe$ZXe%ZYe'ZZe,Z[e-Z\e.Z]e/Z^e0Z_e1Z`e2Zae3Zbe4Zce5Zde6Zee7Zfe8Zge9ZhdpS)ras Operator Interface This module exports a set of functions corresponding to the intrinsic operators of Python. For example, operator.add(x, y) is equivalent to the expression x+y. The function names are those used for special methods; variants without leading and trailing '__' are also provided for convenience. This is the pure Python implementation of the module. absaddand_ attrgetterconcatcontainscountOfdelitemeqfloordivgegetitemgtiaddiandiconcat ifloordivilshiftimatmulimodimulindexindexOfinvinvertioripowirshiftis_is_notisub itemgetteritruedivixorle length_hintlshiftltmatmul methodcallermodmulnenegnot_or_pospowrshiftsetitemsubtruedivtruthxor)rcCs||kS)zSame as a < b.)abr8r8 /usr/lib64/python3.6/operator.pyr&scCs||kS)zSame as a <= b.r8)r9r:r8r8r;r#scCs||kS)zSame as a == b.r8)r9r:r8r8r;r #scCs||kS)zSame as a != b.r8)r9r:r8r8r;r+'scCs||kS)zSame as a >= b.r8)r9r:r8r8r;r +scCs||kS)zSame as a > b.r8)r9r:r8r8r;r /scCs| S)zSame as not a.r8)r9r8r8r;r-5scCs |rdSdS)z*Return True if a is true, False otherwise.TFr8)r9r8r8r;r59scCs||kS)zSame as a is b.r8)r9r:r8r8r;r=scCs||k S)zSame as a is not b.r8)r9r:r8r8r;rAscCst|S)zSame as abs(a).)_abs)r9r8r8r;rGscCs||S)zSame as a + b.r8)r9r:r8r8r;rKscCs||@S)zSame as a & b.r8)r9r:r8r8r;rOscCs||S)zSame as a // b.r8)r9r:r8r8r;r SscCs|jS)zSame as a.__index__().) __index__)r9r8r8r;rWscCs|S)z Same as ~a.r8)r9r8r8r;r[scCs||>S)zSame as a << b.r8)r9r:r8r8r;r%`scCs||S)zSame as a % b.r8)r9r:r8r8r;r)dscCs||S)zSame as a * b.r8)r9r:r8r8r;r*hscCs||S)zSame as a @ b.r8)r9r:r8r8r;r'lscCs| S)z Same as -a.r8)r9r8r8r;r,pscCs||BS)zSame as a | b.r8)r9r:r8r8r;r.tscCs| S)z Same as +a.r8)r9r8r8r;r/xscCs||S)zSame as a ** b.r8)r9r:r8r8r;r0|scCs||?S)zSame as a >> b.r8)r9r:r8r8r;r1scCs||S)zSame as a - b.r8)r9r:r8r8r;r3scCs||S)zSame as a / b.r8)r9r:r8r8r;r4scCs||AS)zSame as a ^ b.r8)r9r:r8r8r;r6scCs(t|ds dt|j}t|||S)z%Same as a + b, for a and b sequences. __getitem__z!'%s' object can't be concatenated)hasattrtype__name__ TypeError)r9r:msgr8r8r;rs cCs||kS)z(Same as b in a (note reversed operands).r8)r9r:r8r8r;rscCs&d}x|D]}||kr |d7}q W|S)z)Return the number of times b occurs in a.r7r8)r9r:countir8r8r;rs   cCs ||=dS)zSame as del a[b].Nr8)r9r:r8r8r;rscCs||S)z Same as a[b].r8)r9r:r8r8r;r scCs.x(t|D]\}}||kr |Sq WtddS)z!Return the first index of b in a.z$sequence.index(x): x not in sequenceN) enumerate ValueError)r9r:rFjr8r8r;rscCs |||<dS)zSame as a[b] = c.Nr8)r9r:cr8r8r;r2scCst|ts dt|j}t|yt|Stk r<YnXyt|j}Wntk r`|SXy ||}Wntk r|SX|tkr|St|tsdt|j}t||dkrd}t ||S)a2 Return an estimate of the number of items in obj. This is useful for presizing containers when building from an iterable. If the object supports len(), the result will be exact. Otherwise, it may over- or under-estimate by an arbitrary amount. The result will be an integer >= 0. z/'%s' object cannot be interpreted as an integerz'__length_hint__ must be integer, not %sr7z$__length_hint__() should return >= 0) isinstanceintr@rArBlen__length_hint__AttributeErrorNotImplementedrH)objdefaultrCZhintvalr8r8r;r$s4     c@s4eZdZdZd ZddZddZdd Zd d Zd S)raV Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter('name'), the call f(r) returns r.name. After g = attrgetter('name', 'date'), the call g(r) returns (r.name, r.date). After h = attrgetter('name.first', 'name.last'), the call h(r) returns (r.name.first, r.name.last). _attrs_callcsn|s.funccstfddDS)Nc3s|]}|VqdS)Nr8).0getter)rQr8r; sz4attrgetter.__init__..func..)tuple)rQ)getters)rQr;rZs) rKstrrBrTsplitrUr^mapr)selfattrZattrsrZr8)r_rYr;__init__s     zattrgetter.__init__cCs |j|S)N)rU)rcrQr8r8r;__call__szattrgetter.__call__cCs$d|jj|jjdjtt|jfS)Nz %s.%s(%s)z, ) __class__ __module__ __qualname__joinrbreprrT)rcr8r8r;__repr__szattrgetter.__repr__cCs |j|jfS)N)rgrT)rcr8r8r; __reduce__szattrgetter.__reduce__N)rTrU) rArhri__doc__ __slots__rerfrlrmr8r8r8r;rs c@s4eZdZdZd ZddZddZdd Zd d Zd S)r z Return a callable object that fetches the given item(s) from its operand. After f = itemgetter(2), the call f(r) returns r[2]. After g = itemgetter(2, 5, 3), the call g(r) returns (r[2], r[5], r[3]) _itemsrUcsFs f|_fdd}||_n"f|_fdd}||_dS)Ncs|S)Nr8)rQ)itemr8r;rZsz!itemgetter.__init__..funccstfddDS)Nc3s|]}|VqdS)Nr8)r[rF)rQr8r;r]sz4itemgetter.__init__..func..)r^)rQ)items)rQr;rZs)rprU)rcrqrrrZr8)rqrrr;res  zitemgetter.__init__cCs |j|S)N)rU)rcrQr8r8r;rfszitemgetter.__call__cCs$d|jj|jjdjtt|jfS)Nz %s.%s(%s)z, )rgrhrArjrbrkrp)rcr8r8r;rl szitemgetter.__repr__cCs |j|jfS)N)rgrp)rcr8r8r;rm%szitemgetter.__reduce__N)rprU) rArhrirnrorerfrlrmr8r8r8r;r s  c@s4eZdZdZdZddZddZd d Zd d Zd S)r(z Return a callable object that calls the given method on its operand. After f = methodcaller('name'), the call f(r) returns r.name(). After g = methodcaller('name', 'date', foo=1), the call g(r) returns r.name('date', foo=1). _name_args_kwargscOsVt|dkrd}t||d}|d|_t|jts>td|dd|_||_dS)Nz9methodcaller needs at least one argument, the method namer7rDzmethod name must be a string)rMrBrsrKr`rtru)argskwargsrCrcr8r8r;re1s   zmethodcaller.__init__cCst||j|j|jS)N)rWrsrtru)rcrQr8r8r;rf<szmethodcaller.__call__cCsTt|jg}|jtt|j|jdd|jjDd|jj|jj dj |fS)Ncss|]\}}d||fVqdS)z%s=%rNr8)r[kvr8r8r;r]Bsz(methodcaller.__repr__..z %s.%s(%s)z, ) rkrsextendrbrtrurrrgrhrArj)rcrwr8r8r;rl?s  zmethodcaller.__repr__cCsD|js|j|jf|jfSddlm}||j|jf|j|jfSdS)Nr7)partial)rurgrsrt functoolsr|)rcr|r8r8r;rmGs zmethodcaller.__reduce__N)rsrtru) rArhrirnrorerfrlrmr8r8r8r;r((s  cCs ||7}|S)zSame as a += b.r8)r9r:r8r8r;rQscCs ||M}|S)zSame as a &= b.r8)r9r:r8r8r;rVscCs,t|ds dt|j}t|||7}|S)z&Same as a += b, for a and b sequences.r>z!'%s' object can't be concatenated)r?r@rArB)r9r:rCr8r8r;r[s  cCs ||}|S)zSame as a //= b.r8)r9r:r8r8r;rcscCs ||K}|S)zSame as a <<= b.r8)r9r:r8r8r;rhscCs ||;}|S)zSame as a %= b.r8)r9r:r8r8r;rmscCs ||9}|S)zSame as a *= b.r8)r9r:r8r8r;rrscCs ||}|S)zSame as a @= b.r8)r9r:r8r8r;rwscCs ||O}|S)zSame as a |= b.r8)r9r:r8r8r;r|scCs ||C}|S)zSame as a **= b.r8)r9r:r8r8r;rscCs ||L}|S)zSame as a >>= b.r8)r9r:r8r8r;rscCs ||8}|S)zSame as a -= b.r8)r9r:r8r8r;rscCs ||}|S)zSame as a /= b.r8)r9r:r8r8r;r!scCs ||N}|S)zSame as a ^= b.r8)r9r:r8r8r;r"s)*)rnN)r7)irn__all__builtinsrr<r&r#r r+r r r-r5rrrrr rrrr%r)r*r'r,r.r/r0r1r3r4r6rrrrr rr2r$rr r(rrrrrrrrrrrrr!r" _operator ImportError__lt____le____eq____ne____ge____gt____not____abs____add____and__ __floordiv__r=__inv__ __invert__ __lshift____mod____mul__ __matmul____neg____or____pos____pow__ __rshift____sub__ __truediv____xor__ __concat__ __contains__ __delitem__r> __setitem____iadd____iand__ __iconcat__ __ifloordiv__ __ilshift____imod____imul__ __imatmul____ior____ipow__ __irshift____isub__ __itruediv____ixor__r8r8r8r; s    )')  calendar.cpython-36.pyc000064400000062434152462730460010765 0ustar003 \Z@sdZddlZddlZddlZddlmZdddddd d d d d ddddddddddddddgZeZ GdddeZ GdddeZ dZ dZ dd d!d d"d d"d d d"d d"d g ZGd#d$d$ZGd%d&d&Zed'Zed(Zed)Zed*Zed+\ZZZZZZZd,dZd-d Zd.d Zd/d Z Gd0dde!Z"Gd1dde"Z#Gd2dde"Z$Gd3d4d4Z%Gd5dde#Z&Gd6dde$Z'e#Z(e(j)Z*d7dZ+e(j,Z-e(j.Z.e(j/Z0e(j1Z2e(j3Z3e(j4Z5e(j6Z7e(j8Z9dDZ:d9Z;e:e;fd:d;ZZ>ej?e>ddj@ZAd?dZBd@dAZCeDdBkreCejEdS)Ea$Calendar printing functions Note when comparing these calendars to the ones printed by cal(1): By default, these calendars have Monday as the first day of the week, and Sunday as the last (the European convention). Use setfirstweekday() to set the first day of the week (0=Monday, 6=Sunday).N)repeatIllegalMonthErrorIllegalWeekdayErrorsetfirstweekday firstweekdayisleapleapdaysweekday monthrange monthcalendarprmonthmonthprcalcalendartimegm month_name month_abbrday_nameday_abbrCalendar TextCalendar HTMLCalendarLocaleTextCalendarLocaleHTMLCalendar weekheaderc@seZdZddZddZdS)rcCs ||_dS)N)r )selfr r /usr/lib64/python3.6/calendar.py__init__szIllegalMonthError.__init__cCs d|jS)Nz!bad month number %r; must be 1-12)r )rrrr__str__szIllegalMonthError.__str__N)__name__ __module__ __qualname__rrrrrrrsc@seZdZddZddZdS)rcCs ||_dS)N)r )rr rrrr szIllegalWeekdayError.__init__cCs d|jS)Nz7bad weekday number %r; must be 0 (Monday) to 6 (Sunday))r )rrrrr"szIllegalWeekdayError.__str__N)r r!r"rrrrrrrsc@sFeZdZddedDZejdddddZd d Zd d Zd S)_localized_monthcCs g|]}tjd|ddjqS)ir#)datetimedatestrftime).0irrr 4sz_localized_month. rcCsdS)Nr)xrrr5sz_localized_month.cCs ||_dS)N)format)rr3rrrr7sz_localized_month.__init__cs4j|}t|tr&fdd|DS|jSdS)Ncsg|]}|jqSr)r3)r,f)rrrr.=sz0_localized_month.__getitem__..)_months isinstanceslicer3)rr-funcsr)rr __getitem__:s  z_localized_month.__getitem__cCsdS)N r)rrrr__len__Asz_localized_month.__len__N) r r!r"ranger5insertrr9r;rrrrr(2s r(c@s6eZdZddedDZddZddZdd Zd S) _localized_daycCs g|]}tjdd|djqS)ir#)r)r*r+)r,r-rrrr.Hsz_localized_day.cCs ||_dS)N)r3)rr3rrrrJsz_localized_day.__init__cs4j|}t|tr&fdd|DS|jSdS)Ncsg|]}|jqSr)r3)r,r4)rrrr.Psz._localized_day.__getitem__..)_daysr6r7r3)rr-r8r)rrr9Ms  z_localized_day.__getitem__cCsdS)Nr?r)rrrrr;Tsz_localized_day.__len__N)r r!r"r<r@rr9r;rrrrr>Esr>z%Az%az%Bz%br?cCs$|ddko"|ddkp"|ddkS)z5Return True for leap years, False for non-leap years.rdir)yearrrrrdscCs@|d8}|d8}|d|d|d|d|d|dS)zFReturn number of leap years in range [y1, y2). Assume y1 <= y2.r#rArBir)Zy1Zy2rrrriscCstj|||jS)zTReturn weekday (0-6 ~ Mon-Sun) for year (1970-...), month (1-12), day (1-31).)r)r*r )rCr dayrrrr qscCsLd|kodkns t|t||d}t||tko@t|}||fS)zQReturn weekday (0-6 ~ Mon-Sun) and number of days (28-31) for year, month.r#r/)rr mdaysFebruaryr)rCr day1ndaysrrrr ws  c@seZdZdZdddZddZddZeeeZd d Z d d Z d dZ ddZ ddZ ddZddZd ddZd!ddZd"ddZdS)#rzo Base calendar class. This class doesn't do any formatting. It simply provides data to subclasses. rcCs ||_dS)N)r)rrrrrrszCalendar.__init__cCs |jdS)Nr?) _firstweekday)rrrrgetfirstweekdayszCalendar.getfirstweekdaycCs ||_dS)N)rI)rrrrrrszCalendar.setfirstweekdayccs*x$t|j|jdD]}|dVqWdS)zt Return an iterator for one week of weekday numbers starting with the configured first one. r?N)r<r)rr-rrr iterweekdaysszCalendar.iterweekdaysc cstj||d}|j|jd}|tj|d8}tjdd}xH|Vy ||7}Wntk rfPYnX|j|kr>|j|jkr>Pq>WdS)z Return an iterator for one month. The iterator will yield datetime.date values and will always iterate through complete weeks, so it will yield dates outside the specified month. r#r?)daysN)r)r*r rZ timedelta OverflowErrorr )rrCr r*rLZonedayrrritermonthdatess  zCalendar.itermonthdatesccs4x.t|j|||jD]\}}||dfVqWdS)z Like itermonthdates(), but will yield (day number, weekday number) tuples. For days outside the specified month the day number is 0. r?N) enumerate itermonthdaysr)rrCr r-drrritermonthdays2szCalendar.itermonthdays2ccsft||\}}||jd}td|EdHtd|dEdH|j||d}td|EdHdS)z Like itermonthdates(), but will yield day numbers. For days outside the specified month the day number is 0. r?rNr#)r rrr<)rrCr rGrHZ days_beforeZ days_afterrrrrPs zCalendar.itermonthdayscs.t|j||fddtdtdDS)z Return a matrix (list of lists) representing a month's calendar. Each row represents a week; week entries are datetime.date values. csg|]}||dqS)r?r)r,r-)datesrrr.sz/Calendar.monthdatescalendar..rr?)listrNr<len)rrCr r)rSrmonthdatescalendarszCalendar.monthdatescalendarcs.t|j||fddtdtdDS)z Return a matrix representing a month's calendar. Each row represents a week; week entries are (day number, weekday number) tuples. Day numbers outside this month are zero. csg|]}||dqS)r?r)r,r-)rLrrr.sz/Calendar.monthdays2calendar..rr?)rTrRr<rU)rrCr r)rLrmonthdays2calendarszCalendar.monthdays2calendarcs.t|j||fddtdtdDS)z Return a matrix representing a month's calendar. Each row represents a week; days outside this month are zero. csg|]}||dqS)r?r)r,r-)rLrrr.sz.Calendar.monthdayscalendar..rr?)rTrPr<rU)rrCr r)rLrmonthdayscalendarszCalendar.monthdayscalendarcs>fddtttdDfddtdtDS)a' Return the data for the specified year ready for formatting. The return value is a list of month rows. Each month row contains up to width months. Each month contains between 4 and 6 weeks and each week contains 1-7 days. Days are datetime.date objects. csg|]}j|qSr)rV)r,r-)rrCrrr.sz.Calendar.yeardatescalendar..r/csg|]}||qSrr)r,r-)monthswidthrrr.sr)r<JanuaryrU)rrCr[r)rZrr[rCryeardatescalendars zCalendar.yeardatescalendarcs>fddtttdDfddtdtDS)z Return the data for the specified year ready for formatting (similar to yeardatescalendar()). Entries in the week lists are (day number, weekday number) tuples. Day numbers outside this month are zero. csg|]}j|qSr)rW)r,r-)rrCrrr.sz.Calendar.yeardays2calendar..r/csg|]}||qSrr)r,r-)rZr[rrr.sr)r<r\rU)rrCr[r)rZrr[rCryeardays2calendars zCalendar.yeardays2calendarcs>fddtttdDfddtdtDS)z Return the data for the specified year ready for formatting (similar to yeardatescalendar()). Entries in the week lists are day numbers. Day numbers outside this month are zero. csg|]}j|qSr)rX)r,r-)rrCrrr.sz-Calendar.yeardayscalendar..r/csg|]}||qSrr)r,r-)rZr[rrr.sr)r<r\rU)rrCr[r)rZrr[rCryeardayscalendars zCalendar.yeardayscalendarN)r)rY)rY)rY)r r!r"__doc__rrJrpropertyrrKrNrRrPrVrWrXr]r^r_rrrrrs     c@sjeZdZdZddZddZddZdd Zd d Zdd dZ dddZ dddZ d ddZ d!ddZ dS)"rzr Subclass of Calendar that outputs a calendar as a simple plain text similar to the UNIX program cal. cCst|j||dddS)z3 Print a single week (no newline).  )endN)print formatweek)rtheweekr[rrrprweek szTextCalendar.prweekcCs |dkrd}nd|}|j|S)z* Returns a formatted day. rr0z%2i)center)rrDr r[srrr formatdayszTextCalendar.formatdaycsdjfdd|DS)zA Returns a single week in a string (no newline). rbc3s |]\}}j||VqdS)N)rj)r,rQwd)rr[rr sz*TextCalendar.formatweek..)join)rrfr[r)rr[rreszTextCalendar.formatweekcCs(|dkrt}nt}||d|j|S)z4 Returns a formatted week day name. N)rrrh)rrDr[namesrrr formatweekday szTextCalendar.formatweekdaycsdjfddjDS)z- Return a header for a week. rbc3s|]}j|VqdS)N)rp)r,r-)rr[rrrl.sz0TextCalendar.formatweekheader..)rmrK)rr[r)rr[rformatweekheader*szTextCalendar.formatweekheaderTcCs"t|}|rd||f}|j|S)z0 Return a formatted month name. z%s %r)rrh)rtheyearthemonthr[withyearrirrrformatmonthname0s zTextCalendar.formatmonthnamercCst|j||||dddS)z+ Print a month's calendar. r0)rcN)rd formatmonth)rrrrswlrrrr 9szTextCalendar.prmonthcCstd|}td|}|j||d|dd}|j}|d|7}||j|j7}|d|7}x4|j||D]$}||j||j7}|d|7}qnW|S)z@ Return a month's calendar string (multi-line). r$r#r? )maxrurstriprqrWre)rrrrsrwrxriweekrrrrv?s    zTextCalendar.formatmonthr$r#rYcstd|}td|}td|}|dddg}|j}|tj|||dj|d|j|x@tj|D]*\}} t||dt ||ddd} |d|fdd| D} |t | |j|d|fdd| D} |t | |j|d|td d| D} xvt| D]j}g}x>| D]6}|t |krr|jd n|jj |||qTW|t ||j|d|qFWqWd j |S) zC Returns a year's calendar as a multi-line string. r$r#r?ryr:c3s|]}j|dVqdS)FN)ru)r,k)colwidthrrrrrrl`sz*TextCalendar.formatyear..c3s|] }VqdS)Nr)r,r~)headerrrrldscss|]}t|VqdS)N)rU)r,calrrrrlhsr0)rzappendreprrhr{rqrOr^r<min formatstringrUrerm)rrrrwrxcmvar-rowrZroZheadersZheightjZweeksrr)rrrrrr formatyearOs:   &  $     zTextCalendar.formatyearcCst|j|||||dS)zPrint a year's calendar.N)rdr)rrrrwrxrrrrrpryeartszTextCalendar.pryearN)T)rr)rr)r$r#r}rY)rrr}rY)r r!r"r`rgrjrerprqrur rvrrrrrrrs     %c@sjeZdZdZdddddddgZd d Zd d Zd dZddZdddZ dddZ dddZ d ddZ dS)!rz4 This calendar returns complete HTML pages. ZmonZtueZwedZthuZfriZsatZsuncCs"|dkr dSd|j||fSdS)z/ Return a day as a table cell. rz z%dN) cssclasses)rrDr rrrrjszHTMLCalendar.formatdaycs djfdd|D}d|S)z8 Return a complete week as a table row. r0c3s|]\}}j||VqdS)N)rj)r,rQrk)rrrrlsz*HTMLCalendar.formatweek..z %s)rm)rrfrir)rrreszHTMLCalendar.formatweekcCsd|j|t|fS)z: Return a weekday name as a table header. z%s)rr)rrDrrrrpszHTMLCalendar.formatweekdaycs$djfddjD}d|S)z< Return a header for a week as a table row. r0c3s|]}j|VqdS)N)rp)r,r-)rrrrlsz0HTMLCalendar.formatweekheader..z %s)rmrK)rrir)rrrqszHTMLCalendar.formatweekheaderTcCs*|rdt||f}n dt|}d|S)z5 Return a month name as a table row. z%s %sz%sz.%s)r)rrrrsrtrirrrrus zHTMLCalendar.formatmonthnamecCsg}|j}|d|d||j|||d|d||j|dx*|j||D]}||j||dqXW|d|ddj|S)z6 Return a formatted month as a table. z@ry)rtz
r0)rrurqrWrerm)rrrrsrtrrr|rrrrvs  zHTMLCalendar.formatmonthrYcCsg}|j}t|d}|d|d|d||fxntttd|D]Z}t|t||d}|dx0|D](}|d||j||d d |d qlW|d qFW|d dj|S)z? Return a formatted year as a table of tables. r#z?ryz.r/r:zzzz
%s
F)rtz
r0)rrzr<r\rrvrm)rrrr[rrr-rZrrrrrs     zHTMLCalendar.formatyear calendar.cssNcCs|dkrtj}g}|j}|d||d|d|d|d||dk r^|d||d||d |d ||j|||d |d d j|j|dS)zB Return a formatted year as a complete HTML page. Nz$ zn z z zC z4 zCalendar for %d z z z z r0xmlcharrefreplace)sysgetdefaultencodingrrrmencode)rrrr[cssencodingrrrrrformatyearpages$    zHTMLCalendar.formatyearpage)T)T)rY)rYrN) r r!r"r`rrjrerprqrurvrrrrrrrys   c@s$eZdZddZddZddZdS)different_localecCs ||_dS)N)locale)rrrrrrszdifferent_locale.__init__cCs"tjtj|_tjtj|jdS)N)_localeZ getlocaleLC_TIME oldlocale setlocaler)rrrr __enter__szdifferent_locale.__enter__cGstjtj|jdS)N)rrrr)rargsrrr__exit__szdifferent_locale.__exit__N)r r!r"rrrrrrrrsrc@s,eZdZdZd ddZddZd d d ZdS) ra This class can be passed a locale name in the constructor and will return month and weekday names in the specified locale. If this locale includes an encoding all strings containing month and weekday names will be returned as unicode. rNcCs&tj|||dkrtj}||_dS)N)rrrgetdefaultlocaler)rrrrrrrs zLocaleTextCalendar.__init__c CsBt|j.|dkrt}nt}||}|d|j|SQRXdS)Nrn)rrrrrh)rrDr[ronamerrrrps  z LocaleTextCalendar.formatweekdayTc Cs8t|j$t|}|r$d||f}|j|SQRXdS)Nz%s %r)rrrrh)rrrrsr[rtrirrrru s   z"LocaleTextCalendar.formatmonthname)rN)T)r r!r"r`rrprurrrrrs  c@s,eZdZdZd ddZddZd d d ZdS) ra This class can be passed a locale name in the constructor and will return month and weekday names in the specified locale. If this locale includes an encoding all strings containing month and weekday names will be returned as unicode. rNcCs&tj|||dkrtj}||_dS)N)rrrrr)rrrrrrrs zLocaleHTMLCalendar.__init__c Cs0t|jt|}d|j||fSQRXdS)Nz%s)rrrr)rrDrirrrrp!s z LocaleHTMLCalendar.formatweekdayTc Cs6t|j"t|}|r$d||f}d|SQRXdS)Nz%s %sz.%s)rrr)rrrrsrtrirrrru&s   z"LocaleHTMLCalendar.formatmonthname)rN)T)r r!r"r`rrprurrrrrs cCs*t|kotkns t||t_dS)N)MONDAYSUNDAYrrr)rrrrr3srYr}cCstt|||dS)z1Prints multi-column formatting for year calendarsN)rdr)colsrspacingrrrr3Gsr3cs |d9}|jfdd|DS)zEReturns a string formatted from n strings, centered within n columns.rbc3s|]}|jVqdS)N)rh)r,r)rrrrlOszformatstring..)rm)rrrr)rrrLsric Cs^|dd\}}}}}}tj||djt|d}|d|}|d|} | d|} | S)zBUnrelated but handy function to calculate Unix timestamp from GMT.Nr}r#<)r)r* toordinal _EPOCH_ORD) tuplerCr rDZhourZminutesecondrLZhoursZminutesZsecondsrrrrVs    c Csddl}|j}|jd}|jd}|jddtddd|jd d td d d|jd dtddd|jddtddd|jddddd|jddddd|jddddd|jd d!d"d3d$d%|jd&d'td(d)|jd*d'td+d)|j|d d}|jr|j r|jd,t j d |j|jf}|j d#kr|jrFt |d-}nt }|j}|dkrdt j}t||jd.} t jjj} |jdkr| |jtjjjf| n6|jdkr| |j|jf| n|jd/t j d n|jrt|d-}nt}t|j|jd0} |jdkr&|j| d1<|j| d2<|jdkrJ|j tjjjf| } n2|jdkrh|j |jf| } n|j!|j|jf| } t jj} |jr| j"|j} t jjj} | | dS)4Nrztext only argumentszhtml only argumentsz-wz--widthr$z width of date column (default 2))typedefaulthelpz-lz--linesr#z)number of lines for each week (default 1)z-sz --spacingr}z"spacing between months (default 6)z-mz--monthsrYzmonths per row (default 3)z-cz--cssz calendar.csszCSS to use for page)rrz-Lz--localez.locale to be used from month and weekday namesz-ez --encodingzencoding to use for outputz-tz--typetexthtmlzoutput type (text or html))rchoicesrrC?zyear number (1-9999))nargsrrr zmonth number (1-12, text only)z/if --locale is specified --encoding is required)r)rrzincorrect number of arguments)rwrxrr)rr)#argparseArgumentParserZadd_argument_group add_argumentint parse_argsrrerrorrexitrrrrdictrstdoutbufferwriterCrr)r*Ztodayr rrr[linesrrZrrvr) rrparserZ textgroupZ htmlgroupZoptionsrrrZoptdictrresultrrrmain`s                     r__main__)Fr`rr)rr itertoolsr__all__ ValueErrorrrrr\rFrEr(r>rrrrr<rZTUESDAYZ WEDNESDAYZTHURSDAYZFRIDAYZSATURDAYrrrr r objectrrrrrrrrJrrrXr rgrer|rqrr rvr rrrrZ _colwidthZ_spacingr3rZEPOCHr*rrrrr argvrrrrsn     up  h py_compile.cpython-36.opt-1.pyc000064400000014622152462730460012307 0ustar003 \ @sdZddlZddlZddlZddlZddlZddlZddlZdddgZ Gddde Z d d dZ dd dZ ed kr~eje dS)zqRoutine to "compile" a .py file to a .pyc file. This module has intimate knowledge of the format of .pyc files. NcompilemainPyCompileErrorc@s"eZdZdZdddZddZdS) raException raised when an error occurs while attempting to compile the file. To raise this exception, use raise PyCompileError(exc_type,exc_value,file[,msg]) where exc_type: exception type to be used in error message type name can be accesses as class variable 'exc_type_name' exc_value: exception value to be used in error message can be accesses as class variable 'exc_value' file: name of file being compiled to be used in error message can be accesses as class variable 'file' msg: string message to be written as error message If no value is given, a default exception message will be given, consistent with 'standard' py_compile output. message (or default) can be accesses as class variable 'msg' cCst|j}|tkr2djtj||}|jdd|}n d||f}tj||pJ||||||_||_ ||_ |pl||_ dS)NrzFile ""z File "%s"z Sorry: %s: %s) __name__ SyntaxErrorjoin tracebackformat_exception_onlyreplace Exception__init__ exc_type_name exc_valuefilemsg)selfexc_typerrrrtbtexterrmsgr"/usr/lib64/python3.6/py_compile.pyr -s  zPyCompileError.__init__cCs|jS)N)r)rrrr__str__=szPyCompileError.__str__N)r)r __module__ __qualname____doc__r rrrrrrs FcCs|dkr>|dkr2|dkr|nd}tjj||d}n tjj|}tjj|r^d}t|j|n,tjj|rtjj | rd}t|j|tj j d|}|j |}y|j ||p||d } WnVtk r} z8t| j| |p|} |r| ntjj| jd dSWYdd} ~ XnXy tjj|} | r0tj| Wntk rHYnX|j|} tjj| | d | d }tjj|}tjj||||S) a)Byte-compile one Python source file to Python bytecode. :param file: The source file name. :param cfile: The target byte compiled file name. When not given, this defaults to the PEP 3147/PEP 488 location. :param dfile: Purported file name, i.e. the file name that shows up in error messages. Defaults to the source file name. :param doraise: Flag indicating whether or not an exception should be raised when a compile error is found. If an exception occurs and this flag is set to False, a string indicating the nature of the exception will be printed, and the function will return to the caller. If an exception occurs and this flag is set to True, a PyCompileError exception will be raised. :param optimize: The optimization level for the compiler. Valid values are -1, 0, 1 and 2. A value of -1 means to use the optimization level of the current interpreter, as given by -O command line options. :return: Path to the resulting byte compiled file. Note that it isn't necessary to byte-compile Python modules for execution efficiency -- Python itself byte-compiles a module when it is loaded, and if it can, writes out the bytecode to the corresponding .pyc file. However, if a Python installation is shared between users, it is a good idea to byte-compile all modules upon installation, since other users may not be able to write in the source directories, and thus they won't be able to write the .pyc file, and then they would be byte-compiling every module each time it is loaded. This can slow down program start-up considerably. See compileall.py for a script/module that uses this module to byte-compile all installed files (or all files in selected directories). Do note that FileExistsError is raised if cfile ends up pointing at a non-regular file or symlink. Because the compilation uses a file renaming, the resulting file would be regular and thus not the same type of file as it was previously. Nrrr) optimizationzc{} is a symlink and will be changed into a regular file if import writes a byte-compiled file to itzk{} is a non-regular file and will be changed into a regular one if import writes a byte-compiled file to itz ) _optimize mtimesize) importlibutilcache_from_sourceospathislinkFileExistsErrorformatexistsisfile machinerySourceFileLoaderget_datasource_to_coder r __class__sysstderrwriterdirnamemakedirs path_stats_bootstrap_external_code_to_bytecode _calc_mode _write_atomic)rcfiledfiledoraiseoptimizerrloader source_bytescodeerrpy_excr4 source_statsbytecodemoderrrrAsF)         cCs"|dkrtjdd}d}|dgkrxtjj}|s6P|jd}yt|ddWq&tk r}zd}tjjd|j WYdd}~Xq&t k r}zd}tjjd|WYdd}~Xq&Xq&WnZxX|D]P}yt|ddWqtk r}zd}tjjd|j WYdd}~XqXqW|S) aCompile several source files. The files named in 'args' (or on the command line, if 'args' is not specified) are compiled and the resulting bytecode is cached in the normal manner. This function does not search a directory structure to locate source files; it only compiles files named explicitly. If '-' is the only parameter in args, the list of files is taken from standard input. Nrr-rT)r=z%s ) r1argvstdinreadlinerstriprrr2r3rOSError)argsrvfilenameerrorrrrrs0    "( (__main__)NNFrR)N)rZimportlib._bootstrap_externalr"importlib.machineryimportlib.utilr%Zos.pathr1r __all__r rrrrexitrrrrs 0 R &enum.cpython-36.opt-1.pyc000064400000055637152462730460011126 0ustar003 \F@s>ddlZddlmZmZddlmZddlmZyddl m Z Wn e k r`ddl m Z YnXdddd d d d gZ d dZddZddZddZeZGdd d ZGdddeZdZGdddeZGdddedZGdddeeZddZGdd d eZGdd d eeZd d!Zd"d Z d#d$Z!d%d&Z"dS)'N)MappingProxyTypeDynamicClassAttribute)reduce)or_) OrderedDictEnumMetaEnumIntEnumFlagIntFlagautouniquecCst|dpt|dpt|dS)z5Returns True if obj is a descriptor, False otherwise.__get____set__ __delete__)hasattr)objr/usr/lib64/python3.6/enum.py_is_descriptors  rcCsT|dd|ddko"dknoR|dddkoR|dd dkoRt|dkS) z3Returns True if a __dunder__ name, False otherwise.N___r)len)namerrr _is_dunders(rcCsL|d|dkodknoJ|dddkoJ|dddkoJt|dkS)z1Returns True if a _sunder_ name, False otherwise.rrrrr!)r)rrrr _is_sunder$s r"cCsdd}||_d|_dS)z"Make the given class un-picklable.cSstd|dS)Nz%r cannot be pickled) TypeError)selfprotorrr_break_on_call_reduce-sz6_make_class_unpicklable.._break_on_call_reducez N) __reduce_ex__ __module__)clsr&rrr_make_class_unpicklable+sr*c@seZdZdZeZdS)r zP Instances are replaced with an appropriate value in Enum class suites. N)__name__r( __qualname____doc__ _auto_nullvaluerrrrr 3scs,eZdZdZfddZfddZZS) _EnumDictzTrack enum member order and ensure member names are not reused. EnumMeta will use the names found in self._member_names as the enumeration member names. cstjg|_g|_dS)N)super__init__ _member_names _last_values)r$) __class__rrr2As z_EnumDict.__init__cst|r.|d krtd|dkrt|d|nt|rD|dkrd}n||jkr\td|nxt|s||krtd |||ft|tr|j t kr|j |d t |j|j d d |_ |j }|jj||j j|tj||d S) zChanges anything not dundered or not a descriptor. If an enum member name is used twice, an error is raised; duplicate values are not checked for. Single underscore (sunder) names are reserved. _order__create_pseudo_member__generate_next_value_ _missing_z(_names_ are reserved for future Enum use_generate_next_value __order__zAttempted to reuse key: %rz%r already defined as: %rr N)r6r7r8r9)r" ValueErrorsetattrrr3r#r isinstancer r/r.r:rr4appendr1 __setitem__)r$keyr/)r5rrr@Fs,    "  z_EnumDict.__setitem__)r+r(r,r-r2r@ __classcell__rr)r5rr0:s r0cseZdZdZeddZfddZddZd)dddd d d d Zd dZ fddZ ddZ ddZ ddZ ddZddZeddZddZdd Zfd!d"Zdddd d d#d$Zed%d&Zed'd(ZZS)*rzMetaclass for EnumcCs0t}|j|\}}|dk r,t|dd|d<|S)Nr8)r0 _get_mixins_getattr)metaclsr)bases enum_dict member_type first_enumrrr __prepare__rs zEnumMeta.__prepare__c s|j|\}|j|\}}}fddjD}xjD] } | =q>Wjdd} t|dh@} | r~tdjdj| dkrdd<tj |||} g| _ t | _ | _ d d | jD} i| _d krtk rd}tfdd|Dst| x6jD]*}||}t|ts0|f}n|}tkrD|f}|sf|| }t|ds||_n6|| f|}t|dstkr||_n ||_|j}||_| |_|j|x8| j jD]\} }|j|jkr|}PqW| j j||| krt| |||| j |<y|| j|<Wntk r6YnXqWxPdD]H} t| | }t| d}t|| d}|dk rD||krDt| | |qDWtdk r|r|| _ tj | _ | dk rt| t!r| j"ddj#} | | j krtd| S)Ncsi|]}||qSrr).0k) classdictrr sz$EnumMeta.__new__..r6mrozInvalid enum member name: {0},r-zAn enumeration.cSs.h|]&}|jjD]\}}t|tr|qqSr)__dict__itemsr>r)rKcrLvrrr sz#EnumMeta.__new__..r'__getnewargs_ex____getnewargs__ __reduce__c3s|]}|jkVqdS)N)rQ)rKm)rHrr sz#EnumMeta.__new__.._value___repr____str__ __format__ z#member order does not match _order_)rVrWr'rX)r\r]r^r')$rC _find_new_r3popsetr<formatjoinr1__new___member_names_r _member_map_ _member_type_rO_value2member_map_objectanyr*r>tuplerr[_name_ __objclass__r2rRr?r=r#rDr__new_member__strreplacesplit)rEr)rFrMrIresave_newuse_args enum_membersrr6 invalid_names enum_classdynamic_attributesmethods member_namer/args enum_membercanonical_member class_method obj_method enum_method)r5)rMrHrre|s                          zEnumMeta.__new__cCsdS)z6 classes/types should always be True. Tr)r$rrr__bool__szEnumMeta.__bool__Nr )modulequalnametypestartcCs*|dkr|j||S|j||||||dS)aEither returns an existing member, or creates a new enum class. This method is used both when an enum class is given a value to match to an enumeration member (i.e. Color(3)) and for the functional API (i.e. Color = Enum('Color', names='RED GREEN BLUE')). When used for the functional API: `value` will be the name of the new class. `names` should be either a string of white-space/comma delimited names (values will start at `start`), or an iterator/mapping of name, value pairs. `module` should be set to the module this class is being created in; if it is not set, an attempt to find that module will be made, but if it fails the class will not be picklable. `qualname` should be set to the actual location this class can be found at in its module; by default it is set to the global scope. If this is not correct, unpickling will fail in some circumstances. `type`, if set, will be mixed in as the first base class. N)rrrr)re_create_)r)r/namesrrrrrrr__call__ s zEnumMeta.__call__cCst||o|j|jkS)N)r>rmrg)r)memberrrr __contains__)szEnumMeta.__contains__cs(||jkrtd|jtj|dS)Nz%s: cannot delete Enum member.)rgAttributeErrorr+r1 __delattr__)r)attr)r5rrr,s  zEnumMeta.__delattr__cCsddddg|jS)Nr5r- __members__r()rf)r$rrr__dir__4s zEnumMeta.__dir__c Cs>t|rt|y |j|Stk r8t|dYnXdS)a5Return the enum member matching `name` We use __getattr__ instead of descriptors or inserting into the enum class' __dict__ in order to support `name` and `value` being both properties for enum members (which live in the class' __dict__) and enum members themselves. N)rrrgKeyError)r)rrrr __getattr__8s  zEnumMeta.__getattr__cCs |j|S)N)rg)r)rrrr __getitem__HszEnumMeta.__getitem__csfddjDS)Nc3s|]}j|VqdS)N)rg)rKr)r)rrrZLsz$EnumMeta.__iter__..)rf)r)r)r)r__iter__KszEnumMeta.__iter__cCs t|jS)N)rrf)r)rrr__len__NszEnumMeta.__len__cCs t|jS)zReturns a mapping of member name->value. This mapping lists all enum members, including aliases. Note that this is a read-only view of the internal mapping. )rrg)r)rrrrQszEnumMeta.__members__cCs d|jS)Nz )r+)r)rrrr\[szEnumMeta.__repr__csfddtjDS)Nc3s|]}j|VqdS)N)rg)rKr)r)rrrZ_sz(EnumMeta.__reversed__..)reversedrf)r)r)r)r __reversed__^szEnumMeta.__reversed__cs0|jjdi}||krtdtj||dS)zBlock attempts to reassign Enum members. A simple assignment to the class namespace only changes one of the several possible ways to get an Enum member from the Enum class, resulting in an inconsistent Enumeration. rgzCannot reassign members.N)rQgetrr1 __setattr__)r)rr/ member_map)r5rrraszEnumMeta.__setattr__cCs|j}|dkr|fn||f}|j|\} } |j||} t|trP|jddj}t|ttfr|rt|dtr|g} }g} xDt | D]8\}}| j |||| dd}| j ||j ||fqWx6|D].}t|tr|||}}n|\}}|| |<qW|j |||| }|dkrTyt jdjd}Wn(ttfk rR}zWYdd}~XnX|dkrht|n||_|dk r~||_|S)aConvenience method to create a new Enum class. `names` can be: * A string containing member names, separated either with spaces or commas. Values are incremented by 1 from `start`. * An iterable of member names. Values are incremented by 1 from `start`. * An iterable of (member name, value) pairs. * A mapping of member name -> value pairs. NrPr_rrr+)r5rCrJr>rprqrrrllist enumerater8r?resys _getframe f_globalsrr<r*r(r,)r) class_namerrrrrrErFrrIrMoriginal_names last_valuescountrr/itemrz member_valuerwexcrrrrns<             zEnumMeta._create_cCs|s ttfSd}}x,|D]$}|tk rt|tr|jrtdqWt|tsTtdt|dtst|d}|d}n8x6|djD](}t|tr|dkr|}q|dkr|}qW||fS)zReturns the type for creating enum members, and the first inherited enum class. bases: the tuple of bases that was given to __new__ NzCannot extend enumerationszHnew enumerations must be created as `ClassName([mixin_type,] enum_type)`rr r!)rjr issubclassrfr#__mro__)rFrHrIbaserrrrCs(      zEnumMeta._get_mixins_c Cs|jdd}|dk }|dkrtxVdD]H}x8||fD],}t||d}|ddjtjtjhkr0|}Pq0W|dk r"Pq"Wtj}|tjkrd}nd}|||fS)a Returns the __new__ to be used for creating the enum members. classdict: the class dictionary given to __new__ member_type: the data type whose __new__ will be used by default first_enum: enumeration to check for an overriding __new__ reNroFT)rore)rrDrerjr) rMrHrIrersmethodpossibletargetrtrrrr`s(     zEnumMeta._find_new_)N)r+r(r,r- classmethodrJrerrrrrrrrrpropertyrr\rrr staticmethodrCr`rBrr)r5rrps(     5 -c@seZdZdZddZddZeddZdd Zd d Z d d Z ddZ ddZ ddZ eddZeddZedddZdS)rzRGeneric enumeration. Derive from this class to define new enumerations. c Csjt||kr|Sy||jkr&|j|SWn6tk r^x |jjD]}|j|krD|SqDWYnX|j|S)N)rrir#rgvaluesr[r9)r)r/rrrrres   z Enum.__new__c Cs8x2t|D]"}y|dStk r*Yq Xq W|SdS)Nr )rr#)rrrr last_valuerrrr8s  zEnum._generate_next_value_cCstd||jfdS)Nz%r is not a valid %s)r<r+)r)r/rrrr9"szEnum._missing_cCsd|jj|j|jfS)Nz <%s.%s: %r>)r5r+rmr[)r$rrrr\&sz Enum.__repr__cCsd|jj|jfS)Nz%s.%s)r5r+rm)r$rrrr]*sz Enum.__str__cs&fddjjD}dddg|S)Ncs2g|]*}|jD]}|ddkr|jkr|qqS)rr)rQrg)rKr)rY)r$rr /s z Enum.__dir__..r5r-r()r5rO)r$added_behaviorr)r$rr-s z Enum.__dir__cCs0|jtkrt}t|}n |j}|j}|j||S)N)rhrjrpr[r^)r$ format_specr)valrrrr^6s   zEnum.__format__cCs t|jS)N)hashrm)r$rrr__hash__Esz Enum.__hash__cCs|j|jffS)N)r5r[)r$r%rrrr'HszEnum.__reduce_ex__cCs|jS)zThe name of the Enum member.)rm)r$rrrrRsz Enum.namecCs|jS)zThe value of the Enum member.)r[)r$rrrr/Wsz Enum.valueNc sttj|}rtn|fddjD}y|jdddWn$tk rp|jdddYnX||||d}t|_|j|j |||<|S)z[ Create a new Enum subclass that replaces a collection of global constants cs g|]}|r||fqSrr)rKr)filtersourcerrrqsz!Enum._convert..cSs|d|dfS)Nr rr)trrrvszEnum._convert..)rAcSs|dS)Nrr)rrrrrys)r) varsrmoduleskeyssortr#_reduce_ex_by_namer'updater)r)rrrrmodule_globalsmembersr)rrr_convert\s     z Enum._convert)N)r+r(r,r-rer8rr9r\r]rr^rr'rrr/rrrrrrs    ) metaclassc@seZdZdZdS)r z.Enum where members are also (and must be) intsN)r+r(r,r-rrrrr scCs|jS)N)r)r$r%rrrrsrc@speZdZdZddZeddZeddZdd Zd d Z d d Z ddZ ddZ ddZ ddZddZdS)r zSupport for flagsc Csd|s|dk r|SdSxBt|D]6}yt|}PWqtk rRtd|dYqXqWd|dS)z Generate the next value when not given. name: the name of the member start: the initital start value or None count: the number of existing members last_value: the last value assigned or None Nr zInvalid Flag value: %rr)r _high_bit Exceptionr#)rrrrrhigh_bitrrrr8s zFlag._generate_next_value_cCs.|}|dkr|}|j|}|dkr*|}|S)Nr)r7)r)r/original_valuepossible_memberrrrr9s zFlag._missing_cCsb|jj|d}|dkr^t||\}}|r:td||jftj|}d|_||_|jj ||}|S)zL Create a composite member iff value contains only members. Nz%r is not a valid %s) rir _decomposer<r+rjrermr[ setdefault)r)r/ pseudo_memberr extra_flagsrrrr7s zFlag._create_pseudo_member_cCs"t||jstS|j|j@|jkS)N)r>r5NotImplementedr[)r$otherrrrrs zFlag.__contains__cCsV|j}|jdk r$d|j|j|jfSt||j\}}d|jdjdd|D|jfS)Nz <%s.%s: %r>|cSsg|]}t|jp|jqSr)rprmr[)rKrYrrrrsz!Flag.__repr__..)r5rmr+r[rrd)r$r)r uncoveredrrrr\s z Flag.__repr__cCs|j}|jdk r d|j|jfSt||j\}}t|dkr^|djdkr^d|j|djfSd|jdjdd|DfSdS)Nz%s.%sr rz%s.%rrcSsg|]}t|jp|jqSr)rprmr[)rKrYrrrrsz Flag.__str__..)r5rmr+rr[rrd)r$r)rrrrrr]s z Flag.__str__cCs t|jS)N)boolr[)r$rrrrsz Flag.__bool__cCs"t||jstS|j|j|jBS)N)r>r5rr[)r$rrrr__or__s z Flag.__or__cCs"t||jstS|j|j|j@S)N)r>r5rr[)r$rrrr__and__s z Flag.__and__cCs"t||jstS|j|j|jAS)N)r>r5rr[)r$rrrr__xor__s z Flag.__xor__csDtjj\}fddjD}tt|jd}j|S)Ncs&g|]}|kr|jj@ r|qSr)r[)rKrY)rr$rrrsz#Flag.__invert__..r)rr5r[r_or_)r$rinverted_membersinvertedr)rr$r __invert__szFlag.__invert__N)r+r(r,r-r8rr9r7rr\r]rrrrrrrrrr s   c@sTeZdZdZeddZeddZddZdd Zd d Z eZ eZ e Z d d Z dS)r zSupport for integer-based FlagscCs*t|tstd||jf|j|}|S)Nz%r is not a valid %s)r>intr<r+r7)r)r/ new_memberrrrr9s  zIntFlag._missing_cCs|jj|d}|dkr|g}t||\}}xL|rvt|}d|}||jkr\||kr\|j||| krld}q,||N}q,Wx6t|D]*}tj||}d|_||_ |jj ||}qW|S)Nrr) rirrrr?rrrermr[r)r)r/rneed_to_createrrbit flag_valuerrrr7s&     zIntFlag._create_pseudo_member_cCs0t||jtfstS|j|j|j|jB}|S)N)r>r5rrr[)r$rresultrrrrszIntFlag.__or__cCs,t||jtfstS|j|j|j|j@S)N)r>r5rrr[)r$rrrrr#szIntFlag.__and__cCs,t||jtfstS|j|j|j|jAS)N)r>r5rrr[)r$rrrrr(szIntFlag.__xor__cCs|j|j}|S)N)r5r[)r$rrrrr1szIntFlag.__invert__N)r+r(r,r-rr9r7rrr__ror____rand____rxor__rrrrrr s  cCs |jdS)z@returns index of highest bit, or -1 if value is zero or negativer ) bit_length)r/rrrr6srcCsbg}x0|jjD]"\}}||jkr|j||jfqW|r^djdd|D}td||f|S)z?Class decorator for enumerations ensuring unique member values.z, cSsg|]\}}d||fqS)z%s -> %sr)rKaliasrrrrrBszunique..z duplicate values found in %r: %s)rrRrr?rdr<) enumeration duplicatesrr alias_detailsrrrr :s  cCs|}|dk}|r*ddt|jjD}nddt|jjD}g}x4|D],\}}|rL||@|krL|j|||M}qLW| r||jkr|j|j||jddddt|d kr|dj|kr|jd||fS) z#Extract all members from the value.rcSs"g|]\}}|jdk r||fqS)N)r)rKrTrYrrrrRsz_decompose..cSs*g|]"\}}|jdk st|r||fqS)N)r _power_of_two)rKrTrYrrrrYscSs|jS)N)r[)rYrrrrdsz_decompose..T)rAreverser )rrirRr?rrr/ra)flagr/ not_coverednegativeflags_to_checkrrrrrrrGs$  rcCs|dkr dS|dt|kS)Nr Fr)r)r/rrrrjsr)#rtypesrr functoolsroperatorrr _collectionsr ImportError collections__all__rrr"r*rjr.r dictr0rrrrr rr r rr rrrrrrs@  3mA #os.cpython-36.opt-2.pyc000064400000042565152462730460010600 0ustar003 \0@sddlZddlZddlZddlZejZdddddddd d d d d dddddddgZddZddZ dekrdZ dZ ddl Tyddl m Z ejdWnek rYnXddlZyddl mZWnek rYnXddl Z eje e [ ndekrdZ d Z ddlTyddlm Z ejdWnek r:YnXddlZddlZeje e[yddlmZWnek rYnXned!eejd"<dd#lmZmZmZmZmZmZmZmZ[ed$re Z!d%d&Z"e#Z$e"d'd(e"d)d*e"d+d,e"d-d.e"d/d0e"d1d2e"d3d4e"d5d6e"d7d8e"d9d:e"d;d<e"d=d>e"d?d@e"dAdBe"dAdCe"dDd0e$Z%e#Z$e"d'd(e$Z&e#Z$e"dEdFe"dGd*e"dHd,e"dIdJe"dKdLe$j'ee"dMdNe"dOd0e"dPd0e"dQdRedSr edTr e"dUdSe$Z(e#Z$e"d'd(e"d+d,e"d-d.e"dVdWe"dXd*edYrpe"dZd,e"d1d2e"d[d0e"d\d.e"d-d.e"dDd0e"d]d.e$Z)[$[[!["dZ*d^Z+d_Z,ddbdcZ-dddeZ.dfdgZ/ejdcdedggddidjZ0ejdje1ehe%krBe2ehe(krBddaddldmdnZ3dodpZ4ejdnye5Wne6k rdiZ5YnXdqdrZ7dsdtZ8dudvZ9dwdxZ:dydzZ;d{d|Zddl?m@Z@Gddde@ZAyeBZCWne6k rddZCYnXdekrejdyeDZEWne6k r>ddZEYnXdekrTejdddZFeFZ5[FdddZGe dkZHejdeHrddZIeAe5jJeIeKeIeKeCeEZL[IdddZMejdddZNeN\ZOZP[NedrDed rDedrDdZQd^ZRZSejdddgddZTddZUddZVddZWddZXejddddgedrlddZYddZZejddgedrddZ[ddZ\ejddgdddZ]GdddZ^ddZ_ddZ`edse`Zadea_bGdddejcZddS)NaltsepcurdirpardirseppathseplinesepdefpathnamepathdevnullSEEK_SETSEEK_CURSEEK_ENDfsencodefsdecode get_exec_pathfdopenpopenextsepcCs |tkS)N)globals)r r/usr/lib64/python3.6/os.py_exists%src Cs2y t|jStk r,ddt|DSXdS)NcSsg|]}|ddkr|qS)r_r).0nrrr ,sz%_get_exports_list..)list__all__AttributeErrordir)modulerrr_get_exports_list(s r"posix )*)_exitr&)_have_functionsntz zno os specific module foundzos.path)rrrrrrrr r'cCs"|tkr|tkrtjt|dS)N)_globalsr'_setadd)strfnrrr_adddsr.HAVE_FACCESSATaccess HAVE_FCHMODATchmod HAVE_FCHOWNATchown HAVE_FSTATATstatHAVE_FUTIMESATutime HAVE_LINKATlink HAVE_MKDIRATmkdir HAVE_MKFIFOATmkfifo HAVE_MKNODATmknod HAVE_OPENATopenHAVE_READLINKATreadlink HAVE_RENAMEATrenameHAVE_SYMLINKATsymlink HAVE_UNLINKATunlinkrmdirHAVE_UTIMENSAT HAVE_FCHDIRchdir HAVE_FCHMOD HAVE_FCHOWNHAVE_FDOPENDIRlistdir HAVE_FEXECVEexecveHAVE_FTRUNCATEtruncate HAVE_FUTIMENS HAVE_FUTIMESHAVE_FPATHCONFpathconfstatvfsfstatvfs HAVE_FSTATVFS HAVE_LCHFLAGSZchflags HAVE_LCHMODlchown HAVE_LCHOWN HAVE_LUTIMES HAVE_LSTATZ MS_WINDOWSFcCstj|\}}|s tj|\}}|r~|r~tj| r~yt|||Wntk rXYnXt}t|trrttd}||kr~dSyt||Wn(t k r| stj | rYnXdS)NASCII) r splitexistsmakedirsFileExistsErrorr isinstancebytesr<OSErrorisdir)r modeexist_okheadtailcdirrrrrjs$   rjc Cslt|tj|\}}|s(tj|\}}x>|rf|rfy t|Wntk rTPYnXtj|\}}q*WdS)N)rKr rhrn)r rrrsrrr removedirss   ruc Csptj|\}}|r*|r*tj| r*t|t||tj|\}}|rl|rly t|Wntk rjYnXdS)N)r rhrirjrFrurn)oldnewrrrsrrrrenamess  rxTc6cst|}g}g}g}y t|}Wn0tk rP}z|dk rB||dSd}~XnX|xy(y t|} Wntk rPYnXWn0tk r}z|dk r||dSd}~XnXy | j} Wntk rd} YnX| r|j| jn |j| j| r^| r^|rd} n.y | j} Wntk r8d} YnX| } | r^|j| j q^WWdQRX|r|||fVt j t j } }xp|D]6}|||}|s| | rt ||||EdHqWn0x"|D]}t ||||EdHqW|||fVdS)NFT) fspathscandirrnnext StopIterationis_dirappendr is_symlinkr islinkjoinwalk)toptopdownonerror followlinksdirsnondirs walk_dirs scandir_iterrorentryr} walk_intorrrdirnamenew_pathrrrrs`:             r.)follow_symlinksdir_fdc cst|t st|d r t|}t|d|d}t|t|d}z:|s^tj|j rtt j |t|rtt |||||EdHWdt |XdS)N __index__F)rr)r)rlinthasattrryr6rBO_RDONLYstS_ISDIRst_moder samestat_fwalkclose)rrrrrorig_sttopfdrrrfwalks!rc cs|t|}gg}}x|D]}y.tjt||djr>|j|n |j|Wqtk ry$tjt||ddjr||j|Wntk rwYnXYqXqW|r||||fVx|D]}y t|||d} t|t |d} Wn8tk r} z|dk r|| wWYdd} ~ XnXz>|s0t j | t| rRt j ||} t | | |||EdHWdt| XqW|sx||||fVdS)N)rF)rr)rRrrr6rr~rnS_ISLNKrBrr rrrr) rtoppathrrrnamesrrr rdirfderrdirpathrrrrs<      rcGst||dS)N)execv)fileargsrrrexecl srcGs |d}t||dd|dS)Nrdr)rT)rrenvrrrexeclesrcGst||dS)N)execvp)rrrrrexeclpsrcGs |d}t||dd|dS)Nrdrr)execvpe)rrrrrrexeclpe srcCst||dS)N)_execvpe)rrrrrr)srcCst|||dS)N)r)rrrrrrr1srcCs|dk rt}||f}nt}|f}t}tj|\}}|rH||f|dSd}}d} t|} tdkrvt|}tt| } x| D]~} tj | |} y|| f|Wq|t k r} z>| }t j d}| j t jkr| j t jkr|dkr| }|} WYdd} ~ Xq|Xq|W|r|j| |j|dS)Nr(re)rTrenvironr rhrr rmaprrnsysexc_infoerrnoENOENTENOTDIRwith_traceback)rrr exec_funcargrestrrrslast_exc saved_excsaved_tb path_listr fullnameetbrrrr<s<      rcCsddl}|dkrt}|j|jdty|jd}Wntk rPd}YnXtry |d}Wnttfk rzYnX|dk rt d|}|dk rt |t rt |}WdQRX|dkrt }|jtS)NrignorePATHsPATHz*env cannot contain 'PATH' and b'PATH' keys)warningsrcatch_warnings simplefilter BytesWarningget TypeErrorsupports_bytes_environKeyError ValueErrorrlrmrrrhr)rrr path_listbrrrr_s.     )MutableMappingc@sTeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ dS)_EnvironcCs.||_||_||_||_||_||_||_dS)N) encodekey decodekey encodevalue decodevalueputenvunsetenv_data)selfdatarrrrrrrrr__init__sz_Environ.__init__c Cs>y|j|j|}Wntk r2t|dYnX|j|S)N)rrrr)rkeyvaluerrr __getitem__s z_Environ.__getitem__cCs.|j|}|j|}|j||||j|<dS)N)rrrr)rrrrrr __setitem__s   z_Environ.__setitem__c CsD|j|}|j|y |j|=Wntk r>t|dYnXdS)N)rrrr)rr encodedkeyrrr __delitem__s    z_Environ.__delitem__ccs(t|j}x|D]}|j|VqWdS)N)rrr)rkeysrrrr__iter__s  z_Environ.__iter__cCs t|jS)N)lenr)rrrr__len__sz_Environ.__len__cs$djdjfddjjDS)Nzenviron({{{}}})z, c3s*|]"\}}djj|j|VqdS)z {!r}: {!r}N)formatrr)rrr)rrr sz$_Environ.__repr__..)rrritems)rr)rr__repr__s z_Environ.__repr__cCst|S)N)dict)rrrrcopysz _Environ.copycCs||kr|||<||S)Nr)rrrrrr setdefaultsz_Environ.setdefaultN) __name__ __module__ __qualname__rrrrrrrrrrrrrrs  rcCsdS)Nr)rrrrrsrrcCs t|dS)N)_putenv)rrrrrsrcstdkrLdd}|t}fdd}i}xJtjD]\}}||||<q2Wn(tjfddfdd }}t}t||||ttS) Nr(cSs t|tstdt|j|S)Nzstr expected, not %s)rlr,rtyper)rrrr check_strs z!_createenviron..check_strcs |jS)N)upper)r)encoderrrsz!_createenviron..encodekeycs(t|tstdt|j|jdS)Nzstr expected, not %ssurrogateescape)rlr,rrrr)r)encodingrrrs z_createenviron..encodecs |jdS)Nr)decode)r)rrrrsz_createenviron..decode) r r,rrrgetfilesystemencodingrr _unsetenv)rrrrrrr)rrr_createenvirons"   rcCs tj||S)N)rr)rdefaultrrrgetenvsrrcCs t|tstdt|j|S)Nzbytes expected, not %s)rlrmrrr)rrrr _check_bytess rcCs tj||S)N)environbr)rrrrrgetenvbsrrcs4tjtjfdd}fdd}||fS)Ncs&t|}t|tr|jS|SdS)N)ryrlr,r)filename)rerrorsrrrs  z_fscodec..fsencodecs&t|}t|tr|jS|SdS)N)ryrlrmr)r)rrrrr&s  z_fscodec..fsdecode)rrgetfilesystemencodeerrors)rrr)rrr_fscodecs   rforkspawnvrP_WAITP_NOWAIT P_NOWAITOc Cst|ttfstd| s&|d r.tdt}|sty$|dkrN|||n ||||WqtdYqXnV|tkr|SxHt|d\}}t |rqqt |rt | St |rt |StdqWdS)Nzargv must be a tuple or a listrz"argv first element cannot be emptyz"Not stopped, signaled or exited???)rltuplerrrrr&rwaitpid WIFSTOPPED WIFSIGNALEDWTERMSIG WIFEXITED WEXITSTATUSrn)rprrrfuncpidwpidstsrrr _spawnvefCs.  rcCst|||dtS)N)rr)rprrrrrrbscCst||||tS)N)rrT)rprrrrrrspawnveksrcCst|||dtS)N)rr)rprrrrrspawnvpwsrcCst||||tS)N)rr)rprrrrrrspawnvpesrcGs t|||S)N)r)rprrrrrspawnlsrcGs|d}t|||dd|S)Nrdrr)r)rprrrrrrspawnlesrcGs t|||S)N)r)rprrrrrspawnlpsrcGs|d}t|||dd|S)Nrdrr)r)rprrrrrrspawnlpesrrcCst|tstdt||d kr.td||dks>|dkrFtdddl}ddl}|dkr|j|d|j|d}t |j |j |S|j|d|j|d }t |j |j |SdS) Nz&invalid cmd type (%s, expected string)rwzinvalid mode %rrz+popen() does not support unbuffered streamsT)shellstdoutbufsize)r stdinr")rr) rlr,rrr subprocessioPopenPIPE _wrap_close TextIOWrapperr!r#)cmdrp bufferingr$r%procrrrrs$  c@s<eZdZddZddZddZddZd d Zd d Zd S)r(cCs||_||_dS)N)_stream_proc)rstreamr,rrrrsz_wrap_close.__init__cCs8|jj|jj}|dkr dStdkr,|S|d>SdS)Nrr()r-rr.waitr )r returncoderrrrs  z_wrap_close.closecCs|S)Nr)rrrr __enter__sz_wrap_close.__enter__cGs |jdS)N)r)rrrrr__exit__sz_wrap_close.__exit__cCs t|j|S)N)getattrr-)rr rrr __getattr__sz_wrap_close.__getattr__cCs t|jS)N)iterr-)rrrrrsz_wrap_close.__iter__N) rrrrrr3r4r6rrrrrr(s  r(cOs4t|tstdt|ddl}|j|f||S)Nz&invalid fd type (%s, expected integer)r)rlrrrr%rB)fdrkwargsr%rrrrs c Cst|ttfr|St|}y|j|}Wn0tk rXt|drFntd|jYnXt|ttfrl|Stdj |jt|jdS)N __fspath__z/expected str, bytes or os.PathLike object, not z7expected {}.__fspath__() to return str or bytes, not {}) rlr,rmrr:rrrrr)r path_type path_reprrrr_fspaths r=ryc@s&eZdZejddZeddZdS)PathLikecCstdS)N)NotImplementedError)rrrrr:&szPathLike.__fspath__cCs t|dS)Nr:)r)clssubclassrrr__subclasshook__+szPathLike.__subclasshook__N)rrrabcabstractmethodr: classmethodrBrrrrr>"sr>)rfF)TNF)rTN)N)N)N)rr)N)rrr)rr)erCrrr6rbuiltin_module_namesZ_namesrrr"r rr#r&r~ ImportError posixpathr r'extendr(ZntpathmodulesZos.pathrrrrrrrr rr)r.setr*supports_dir_fdsupports_effective_idsr+ supports_fdsupports_follow_symlinksr r rrjrurxrrBrRrrr NameErrorrrrrrrrr_collections_abcrrrrrrrrrrrrmrrrrrrrr rrrrrrrrrrr(rr=ryrABCr>rrrrsz       (                                             ./     # - 7                       colorsys.cpython-36.opt-1.pyc000064400000006361152462730460012025 0ustar003 \@s\dZddddddgZdZdZdZd dZd dZd dZddZddZ ddZ ddZ dS)aJConversion functions between RGB and other color systems. This modules provides two functions for each color system ABC: rgb_to_abc(r, g, b) --> a, b, c abc_to_rgb(a, b, c) --> r, g, b All inputs and outputs are triples of floats in the range [0.0...1.0] (with the exception of I and Q, which covers a slightly larger range). Inputs outside the valid range may cause exceptions or invalid outputs. Supported color systems: RGB: Red, Green, Blue components YIQ: Luminance, Chrominance (used by composite video signals) HLS: Hue, Luminance, Saturation HSV: Hue, Saturation, Value rgb_to_yiq yiq_to_rgb rgb_to_hls hls_to_rgb rgb_to_hsv hsv_to_rgbg?g@g@g@cCsRd|d|d|}d||d||}d||d||}|||fS)Ng333333?gzG?g)\(?gGz?gHzG?gQ?g= ףp=?)rgbyiqrr /usr/lib64/python3.6/colorsys.pyr(scCs|d|d|}|d|d|}|d|d|}|dkrHd}|dkrTd}|dkr`d}|dkrld}|dkrxd}|dkrd}|||fS) Ng2rL?g,?g:?gnєW?g6޷?gJ"X?gg?r)r r r rr r rrrr.s c Cst|||}t|||}||d}||kr6d|dfS|dkrP||||}n||d||}||||}||||}||||} ||kr| |} n"||krd|| } n d||} | dd} | ||fS)Ng@gg?g@g@g?)maxmin) rr r maxcminclsrcgcbchrrrrKs$       cCsn|dkr|||fS|dkr(|d|}n||||}d||}t|||tt|||t|||tfS)Ngg?g?g@)_v ONE_THIRD)rrrm2m1rrrrbs  cCsT|d}|tkr$||||dS|dkr0|S|tkrP|||t|dS|S)Ng?g@g?) ONE_SIXTH TWO_THIRD)rrZhuerrrrlsrc Cst|||}t|||}|}||kr.dd|fS|||}||||}||||}||||} ||kr|| |} n"||krd|| } n d||} | dd} | ||fS)Ngg@g@g@g?)rr) rr r rrvrrrrrrrrr|s        cCs|dkr|||fSt|d}|d|}|d|}|d||}|d|d|}|d}|dkrt|||fS|dkr|||fS|dkr|||fS|dkr|||fS|d kr|||fS|d kr|||fSdS) Ngg@g?)int)rrrr fpr trrrrs(         NgUUUUUU?gUUUUUU?gUUUUUU?) __doc____all__rrrrrrrrrrrrrrs  binhex.cpython-36.pyc000064400000027470152462730460010472 0ustar003 \6@sdZddlZddlZddlZddlZdddgZGdddeZdZdZ dZ d Z d Z Gd d d Z d dZGdddZGdddZGdddZGdddZddZGdddZGdddZGdddZddZdS)zMacintosh binhex compression/decompression. easy interface: binhex(inputfilename, outputfilename) hexbin(inputfilename, outputfilename) NbinhexhexbinErrorc@s eZdZdS)rN)__name__ __module__ __qualname__rr/usr/lib64/python3.6/binhex.pyrsi@c@seZdZddZdS)FInfocCsd|_d|_d|_dS)Nz????r)TypeCreatorFlags)selfrrr __init__0szFInfo.__init__N)rrrrrrrr r /sr c Cstt}tj|d2}|jd}d|kr,d|_|jdd|j}WdQRXtjj |\}}|j ddd}|||dfS) NrbirZTEXT:-r ) r ioopenreadrseektellospathsplitreplace)namefinfofpdataZdsizedirfilerrr getfileinfo5s  r&c@s,eZdZddZddZddZddZd S) openrsrccGsdS)Nr)rargsrrr rCszopenrsrc.__init__cGsdS)Nr)rr(rrr rFsz openrsrc.readcGsdS)Nr)rr(rrr writeIszopenrsrc.writecCsdS)Nr)rrrr closeLszopenrsrc.closeN)rrrrrr*r+rrrr r'Bsr'c@s0eZdZdZddZddZddZdd Zd S) _Hqxcoderenginez(Write data to the coder in 3-byte chunkscCs ||_d|_d|_td|_dS)Nr)r )ofpr#hqxdataLINELENlinelen)rr-rrr rRsz_Hqxcoderengine.__init__cCsh|j||_t|j}|dd}|jd|}|j|d|_|sHdS|jtj||_|jddS)Nr)r#lenr.binasciib2a_hqx_flush)rr#ZdatalenZtodorrr r*Xs   z_Hqxcoderengine.writecCsvd}xF|t|j|jkrJ||j}|jj|j||dt|_|}qW|j|d|_|rr|jj|jddS)Nr s: )r2r.r0r-r*r/)rZforcefirstZlastrrr r5cs z_Hqxcoderengine._flushcCs6|jr|jtj|j|_|jd|jj|`dS)Nr )r#r.r3r4r5r-r+)rrrr r+ns   z_Hqxcoderengine.closeN)rrr__doc__rr*r5r+rrrr r,Os   r,c@s(eZdZdZddZddZddZdS) _Rlecoderenginez4Write data to the RLE-coder in suitably large chunkscCs||_d|_dS)Nr))r-r#)rr-rrr rxsz_Rlecoderengine.__init__cCs@|j||_t|jtkrdStj|j}|jj|d|_dS)Nr))r#r2REASONABLY_LARGEr3 rlecode_hqxr-r*)rr#rledatarrr r*|s    z_Rlecoderengine.writecCs0|jrtj|j}|jj||jj|`dS)N)r#r3r;r-r*r+)rr<rrr r+s    z_Rlecoderengine.closeN)rrrr8rr*r+rrrr r9usr9c@sLeZdZddZddZddZddZd d Zd d Zd dZ ddZ dS)BinHexc Cs|\}}}}d}t|tr.|}tj|d}d}yR|jdt|} t| |_d|_|dkr`t }||_ ||_ |j ||t |_Wn|r|jYnXdS)NFwbTs0(This file must be converted with BinHex 4.0) :r) isinstancestrrrr*r,r9r-crcr dlenrlen _writeinfo _DID_HEADERstater+) rZname_finfo_dlen_rlenr-r r!rBrCZclose_on_errorZofnameZhqxerrrr rs*       zBinHex.__init__c Cst|}|dkrtdt|g|jdd}|j|j}}t|trR|jd}t|trf|jd}||}tj d|j }tj d|j |j } |||| } |j | |jdS)N?zFilename too longzlatin-1z>hz>ii)r2rbytesencoderrr?r@structpackrrBrC_write _writecrc) rr r!nldtpZcrZd2Zd3Zd4inforrr rDs     zBinHex._writeinfocCs tj||j|_|jj|dS)N)r3crc_hqxrAr-r*)rr#rrr rMsz BinHex._writecCs4|jdkrd}nd}|jjtj||jd|_dS)Nrz>hz>H)rAr-r*rKrL)rZfmtrrr rNs  zBinHex._writecrccCs0|jtkrtd|jt||_|j|dS)NzWriting data at the wrong time)rFrErrBr2rM)rr#rrr r*s z BinHex.writecCs,|jdkrtd|jf|jt|_dS)NrzIncorrect data size, diff=%r)rBrrCrN _DID_DATArF)rrrr close_datas zBinHex.close_datacCsB|jtkr|j|jtkr$td|jt||_|j|dS)Nz'Writing resource data at the wrong time)rFrTrUrrCr2rM)rr#rrr write_rsrcs   zBinHex.write_rsrcc Csx|jdkrdSzJ|jtkr"|j|jtkr4td|jdkrNtd|jf|jWdd|_|j}|`|jXdS)NzClose at the wrong timerz$Incorrect resource-datasize, diff=%r)rFrTrUrrCrNr-r+)rr-rrr r+s     z BinHex.closeN) rrrrrDrMrNr*rUrVr+rrrr r=s r=c Cst|}t||}tj|d.}x|jd}|s2P|j|q"W|jWdQRXt|d}x|jd}|snP|j|q^W|j |j dS)zEbinhex(infilename, outfilename): create binhex-encoded copy of a fileriN) r&r=rrrr*rUr'rVr+)inpoutr!r-ifprPrrr rs"    c@s(eZdZdZddZddZddZdS) _Hqxdecoderenginez*Read data via the decoder in 4-byte chunkscCs||_d|_dS)Nr)rYeof)rrYrrr rsz_Hqxdecoderengine.__init__c Csd}|}x|dkr|jr|S|ddd}|jj|}xRytj|\}|_PWntjk rfYnX|jjd}|std||}q:W||}|t|}| r |j r tdq W|S)z&Read at least wtd bytes (or until EOF)r)rrr1r zPremature EOF on binhex file)r[rYrr3Za2b_hqxZ Incompleterr2)rZtotalwtdZdecdatawtdr#Z decdatacurnewdatarrr rs,      z_Hqxdecoderengine.readcCs|jjdS)N)rYr+)rrrr r+%sz_Hqxdecoderengine.closeN)rrrr8rrr+rrrr rZs rZc@s0eZdZdZddZddZddZdd Zd S) _RledecoderenginezRead data via the RLE-codercCs||_d|_d|_d|_dS)Nr)r)rY pre_buffer post_bufferr[)rrYrrr r+sz_Rledecoderengine.__init__cCsD|t|jkr"|j|t|j|jd|}|j|d|_|S)N)r2ra_fill)rr]rvrrr r1s z_Rledecoderengine.readcCs|j|jj|d|_|jjr>|jtj|j|_d|_dSt|j}|jddtdtkrl|d}nX|jddtkr|d}n<|jd dtdkr|d}n|jd d tkrn|d}|jtj|jd||_|j|d|_dS) Nr\r)r1rHr rrfre) r`rYrr[rar3Z rledecode_hqxr2RUNCHAR)rr]Zmarkrrr rb8s&    z_Rledecoderengine._fillcCs|jjdS)N)rYr+)rrrr r+[sz_Rledecoderengine.closeN)rrrr8rrrbr+rrrr r_(s #r_c@sLeZdZddZddZddZddZd d Zd d Zd dZ ddZ dS)HexBincCsjt|trtj|d}x.|jd}|s.td|dkr8q|dkrPqWt|}t||_d|_ |j dS)Nrr zNo binhex data found :r) r?r@rrrrrZr_rYrA _readheader)rrYZchZhqxifprrr r_s    zHexBin.__init__cCs |jj|}tj||j|_|S)N)rYrr3rSrA)rr2r#rrr _readus z HexBin._readcCsNtjd|jjddd@}|jd@|_||jkrDtd|j|fd|_dS)Nz>hrrizCRC error, computed %x, read %x)rKunpackrYrrAr)rZfilecrcrrr _checkcrczs   zHexBin._checkcrccCs|jd}|jt|}|jd}|j|dd}|dd}tjd|ddd}tjd |dd d|_tjd |d d d|_||_t|_||j_ ||j_ ||j_ t |_ dS)Nr r\r z>h rz>lrorprqrrrs)rlordrnrKrmrBrCFNamer rrrrErF)rr2ZfnameresttypeZcreatorflagsrrr rks    zHexBin._readheadercGsn|jtkrtd|r,|d}t||j}n|j}d}x&t||kr\||j|t|}q8W|j||_|S)NzRead data at wrong timerr))rFrErminrBr2rl)rnrcrrr rs  z HexBin.readcCs6|jtkrtd|jr$|j|j}|jt|_dS)Nzclose_data at wrong time)rFrErrBrlrnrT)rdummyrrr rUs   zHexBin.close_datacGsZ|jtkr|j|jtkr$td|r>|d}t||j}n|j}|j||_|j|S)Nz Read resource data at wrong timer)rFrErUrTrryrCrl)rrzrrr read_rsrcs   zHexBin.read_rsrcc CsD|jdkrdSz|jr"|j|j}|jWdd|_|jjXdS)N)rFrCr|rnrYr+)rr{rrr r+s   z HexBin.closeN) rrrrrlrnrkrrUr|r+rrrr rh^s  rhc Cst|}|j}|s|j}tj|d&}x|jd}|s8P|j|q(WWdQRX|j|jd}|rt |d}|j|x|jd}|sP|j|q|W|j |j dS)z6hexbin(infilename, outfilename) - Decode binhexed filer>iN) rhr rurrrr*rUr|r'r+)rWrXrYr!r-rPrrr rs,     )r8rrrKr3__all__ ExceptionrrErTr:r/rgr r&r'r,r9r=rrZr_rhrrrrr s,   &^*6hsocket.cpython-36.opt-1.pyc000064400000052727152462730460011447 0ustar003 \3k @spdZddlZddlTddlZddlZddlZddlZddlmZmZy ddl Z Wne k rhdZ YnXe e ddZ e e ddZ e e d dZd d d d dgZejejeejd eddejdeddejdeddejdedddZdZddZeZejjjdriZded<ded<ded <d!ed"<d#ed$<d%ed&<d'ed(<d)ed*<d+ed,<d-ed.<d/ed0<d1ed2<d3ed4<d5ed6<d7ed8<ejd9Gd:d;d;eZGdd Z e!ejd?rd@dAZ"ejdAe!edBr de#dfdCdBZ$ne%e#dfdDdBZ$ejdBdEe$_e ehZ&GdFdGdGej'Z(dNdId Z)e*Z+e+dfdJd Z,dOdKdLZ-dS)Pa0This module provides socket operations and some related functions. On Unix, it supports IP (Internet Protocol) and Unix domain sockets. On other systems, it only supports IP. Functions specific for a socket are available as methods of the socket object. Functions: socket() -- create a new socket object socketpair() -- create a pair of new socket objects [*] fromfd() -- create a socket object from an open file descriptor [*] fromshare() -- create a socket object from data received from socket.share() [*] gethostname() -- return the current hostname gethostbyname() -- map a hostname to its IP number gethostbyaddr() -- map an IP number or hostname to DNS info getservbyname() -- map a service name and a protocol name to a port number getprotobyname() -- map a protocol name (e.g. 'tcp') to a number ntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order htons(), htonl() -- convert 16, 32 bit int from host to network byte order inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format inet_ntoa() -- convert 32-bit packed format IP to string (123.45.67.89) socket.getdefaulttimeout() -- get the default timeout value socket.setdefaulttimeout() -- set the default timeout value create_connection() -- connects to an address, with an optional timeout and optional source address. [*] not available on all platforms! Special objects: SocketType -- type object for socket objects error -- exception raised for I/O errors has_ipv6 -- boolean value indicating if IPv6 is supported IntEnum constants: AF_INET, AF_UNIX -- socket domains (first argument to socket() call) SOCK_STREAM, SOCK_DGRAM, SOCK_RAW -- socket types (second argument) Integer constants: Many other constants may be defined; these may be used in calls to the setsockopt() and getsockopt() methods. N)*)IntEnumIntFlagEBADF EAGAIN EWOULDBLOCKfromfdgetfqdncreate_connection AddressFamily SocketKindcCs|jo|jdS)NZAF_)isupper startswith)Cr/usr/lib64/python3.6/socket.pyLsrcCs|jo|jdS)NZSOCK_)rr)rrrrrQsZMsgFlagcCs|jo|jdS)NZMSG_)rr)rrrrrVsZ AddressInfocCs|jo|jdS)NZAI_)rr)rrrrr[sz 127.0.0.1z::1c Cs"y||Stk r|SXdS)z{Convert a numeric family value to an IntEnum member. If it's not a known member, return the numeric value itself. N) ValueError)valueZ enum_klassrrr_intenum_converterasrwinzThe operation was interrupted.i'zA bad file handle was passed.i'zPermission denied.i'z!A fault occurred on the network??i'z#An invalid operation was attempted.i&'z The socket operation would blocki3'z,A blocking operation is already in progress.i4'zThe network address is in use.i@'zThe connection has been reset.iF'zThe network has been shut down.iJ'zThe operation timed out.iL'zConnection refused.iM'zThe name is too long.iO'zThe host is down.iP'zThe host is unreachable.iQ'errorTabc@s eZdZdS)_GiveupOnSendfileN)__name__ __module__ __qualname__rrrrrsrcs4eZdZdZdddgZeeddfddZd d Zd d Z d dZ ddZ ddZ ddZ d8ddddddZeedrd9ddZn d:ddZd;ddZdd Zd) getattr __class__rrr(r%r&r' getsocknamestrerrorZ getpeername)r$closedsZladdrZraddrrrr__repr__s0   zsocket.__repr__cCs tddS)NzCannot serialize socket object) TypeError)r$rrr __getstate__szsocket.__getstate__cCs6t|j}|j|j|j|j|d}|j|j|S)zdup() -> socket object Duplicate the socket. Return a new socket object connected to the same system resource. The new socket is non-inheritable. )r()dupr(r0r%r&r' settimeout gettimeout)r$fdsockrrrr9s z socket.dupcCsZ|j\}}|jtjdd@}t|j||j|d}tdkrR|jrR|j d||fS)zaccept() -> (socket object, address info) Wait for an incoming connection. Return a new socket representing the connection, and the address of the client. For IP sockets, the address info is a pair (hostaddr, port). Z SOCK_NONBLOCKr)r(NT) Z_acceptr&globalsgetrr%r'Zgetdefaulttimeoutr; setblocking)r$r<addrr&r=rrraccepts   z socket.acceptr)encodingerrorsnewlinec Cst|dddhks td|fd|k}d|kp4| }d|k}d} |rN| d7} |rZ| d7} t|| } |jd7_|dkr~d }|dkrtj}|dkr|std | S|r|rtj| | |} n|rtj| |} n tj| |} |r| Stj | |||} || _ | S) zmakefile(...) -> an I/O stream connected to the socket The arguments are as for io.open() after the filename, except the only supported mode values are 'r' (default), 'w' and 'b'. rCwbz&invalid mode %r (only r, w, b allowed)r-Nrz!unbuffered streams must be binary) setrSocketIOr ioDEFAULT_BUFFER_SIZEBufferedRWPairBufferedReaderBufferedWriter TextIOWrappermode) r$rS bufferingrDrErFZwritingZreadingZbinaryZrawmoderawbuffertextrrrmakefiles<  zsocket.makefilesendfilec2Cs|j||||j}y |j}Wn0ttjfk rR}zt|WYdd}~XnXytj|j}Wn*t k r}zt|WYdd}~XnX|sdS|s|n|}|j } | dkrt dt t drt j} nt j} | j|t jd} | j} tj} zx| r| |  rtjd|r0|| }|dkr0Py| ||||}Wn^tk rf| s`| wYqt k r}z| dkrt||dWYdd}~XqX|dkrP||7}| |7} qW| S| dkrt |dr|j|XdS)Nrz&non-blocking sockets are not supported PollSelectorz timed outseek)_check_sendfile_paramsr(AttributeErrorrMUnsupportedOperationrosfstatst_sizeOSErrorr;rhasattr selectorsrZZSelectSelectorregisterZ EVENT_WRITEZselectrYr"timeoutBlockingIOErrorr[)r$fileoffsetcountZsocknor(errZfsize blocksizerfZselector total_sentZselector_selectZ os_sendfilesentrrr_sendfile_use_sendfiles`         zsocket._sendfile_use_sendfilecCs tddS)Nz,os.sendfile() not available on this platform)r)r$rhrirjrrrroGsc Cs|j||||jdkr"td|r0|j||r>t|dnd}d}|j}|j}zx|rrt|||}|dkrrPt||}|sPxLy ||} Wntk rwYqX|| 7}| t |kr|| d}qPqWqVW|S|dkot |dr|j||XdS)Nrz&non-blocking sockets are not supportedi r[) r\r;rr[minreadsend memoryviewrglenrc) r$rhrirjrlrmZ file_readZ sock_senddatarnrrr_sendfile_use_sendKs<      zsocket._sendfile_use_sendcCsddt|ddkrtd|jt@s*td|dk r`t|tsJtdj||dkr`tdj|dS)NrHrSz$file should be opened in binary modez+only SOCK_STREAM type sockets are supportedz+count must be a positive integer (got {!r})r)r/rr& SOCK_STREAM isinstanceintr7format)r$rhrirjrrrr\os   zsocket._check_sendfile_paramsc Cs2y|j|||Stk r,|j|||SXdS)a_sendfile(file[, offset[, count]]) -> sent Send a file until EOF is reached by using high-performance os.sendfile() and return the total number of bytes which were sent. *file* must be a regular file object opened in binary mode. If os.sendfile() is not available (e.g. Windows) or file is not a regular file socket.send() will be used instead. *offset* tells from where to start reading the file. If specified, *count* is the total number of bytes to transmit as opposed to sending the file until EOF is reached. File position is updated on return or also in case of error in which case file.tell() can be used to figure out the number of bytes which were sent. The socket must be of SOCK_STREAM type. Non-blocking sockets are not supported. N)rorrv)r$rhrirjrrrrY|szsocket.sendfilecCs*|jdkr|jd8_|jr&|jdS)NrrI)r r!r*)r$rrr_decref_socketioss zsocket._decref_socketioscCs|j|dS)N)r*)r$Z_ssrrr _real_closeszsocket._real_closecCsd|_|jdkr|jdS)NTr)r!r r|)r$rrrr*s z socket.closecsd|_tjS)a detach() -> file descriptor Close the socket object without closing the underlying file descriptor. The object cannot be used after this call, but the file descriptor can be reused for other purposes. The file descriptor is returned. T)r!superdetach)r$)r0rrr~sz socket.detachcsttjtS)z@Read-only access to the address family for this socket. )rr}r%r )r$)r0rrr%sz socket.familycsttjtS)z-Read-only access to the socket type. )rr}r&r)r$)r0rrr&sz socket.typentcCstj|jS)N)r_Zget_handle_inheritabler()r$rrrget_inheritableszsocket.get_inheritablecCstj|j|dS)N)r_Zset_handle_inheritabler()r$ inheritablerrrset_inheritableszsocket.set_inheritablecCstj|jS)N)r_rr()r$rrrrscCstj|j|dS)N)r_rr()r$rrrrrsz&Get the inheritable flag of the socketz&Set the inheritable flag of the socket)rCN)rN)rN)rN)rN)"rrr__doc__ __slots__AF_INETrwr#r)r,r6r8r9rBrXrcr_rorvr\rYr{r"rr|r*r~propertyr%r&namerr __classcell__rr)r0rrs<   )  A  $    rcCst|}t||||S)z fromfd(fd, family, type[, proto]) -> socket object Create a socket object from a duplicate of the given file descriptor. The remaining arguments are the same as for socket(). )r9r)r<r%r&r'Znfdrrrr sZsharecCstddd|S)z fromshare(info) -> socket object Create a socket object from the bytes object returned by socket.share(pid). r)r)inforrr fromsharesr socketpairc Csh|dkr*yt}Wntk r(t}YnXtj|||\}}t||||j}t||||j}||fS)aasocketpair([family[, type[, proto]]]) -> (socket object, socket object) Create a pair of socket objects from the sockets returned by the platform socketpair() function. The arguments are the same as for socket() except the default family is AF_UNIX if defined on the platform; otherwise, the default is AF_INET. N)ZAF_UNIX NameErrorrr"rrr~)r%r&r'arHrrrrs c Cs|tkrt}n|tkrt}ntd|tkr4td|dkrDtdt|||}z|j|df|j|j dd\}}t|||}yP|j dy|j ||fWnt t fk rYnX|j d|j\}} Wn|jYnXWd|jX||fS)Nz?Only AF_INET and AF_INET6 socket address families are supportedz)Only SOCK_STREAM socket type is supportedrzOnly protocol zero is supportedFT)r _LOCALHOSTZAF_INET6 _LOCALHOST_V6rrwrbindZlistenr1r@connectrgInterruptedErrorrBr*) r%r&r'hostZlsockrAportZcsockZssock_rrrrs8      a8socketpair([family[, type[, proto]]]) -> (socket object, socket object) Create a pair of socket objects from the sockets returned by the platform socketpair() function. The arguments are the same as for socket() except the default family is AF_UNIX if defined on the platform; otherwise, the default is AF_INET. cspeZdZdZddZddZddZdd Zd d Zfd d Z ddZ e ddZ e ddZ ddZZS)rLzRaw I/O implementation for stream sockets. This class supports the makefile() method on sockets. It provides the raw I/O interface on top of a socket object. cCsZ|d krtd|tjj|||_d|kr6|d7}||_d|k|_d|k|_d |_dS) NrCrGrwrbwbrwbzinvalid mode: %rrHF)rCrGrrrr) rrM RawIOBaser#_sock_mode_reading_writing_timeout_occurred)r$r=rSrrrr#0s    zSocketIO.__init__cCs|j|j|jrtdxby |jj|Stk rHd|_Yq tk r|}z|jdt krjdSWYdd}~Xq Xq WdS)a3Read up to len(b) bytes into the writable buffer *b* and return the number of bytes read. If the socket is non-blocking and no bytes are available, None is returned. If *b* is non-empty, a 0 return value indicates that the connection was shutdown at the other end. z!cannot read from timed out objectTrN) _checkClosed_checkReadablerrbrZ recv_intorfr3r+_blocking_errnos)r$rHerrrreadinto<s zSocketIO.readintocCsX|j|jy |jj|Stk rR}z|jdtkr@dSWYdd}~XnXdS)aWrite the given bytes or bytearray object *b* to the socket and return the number of bytes written. This can be less than len(b) if not all data could be written. If the socket is non-blocking and no bytes could be written None is returned. rN)r_checkWritablerrrr3r+r)r$rHrrrrwriteSs zSocketIO.writecCs|jrtd|jS)z2True if the SocketIO is open for reading. zI/O operation on closed socket.)r4rr)r$rrrreadablecszSocketIO.readablecCs|jrtd|jS)z2True if the SocketIO is open for writing. zI/O operation on closed socket.)r4rr)r$rrrwritablejszSocketIO.writablecs|jrtdtjS)z2True if the SocketIO is open for seeking. zI/O operation on closed socket.)r4rr}seekable)r$)r0rrrqszSocketIO.seekablecCs|j|jjS)z=Return the file descriptor of the underlying socket. )rrr()r$rrrr(xszSocketIO.filenocCs|js|jSdSdS)NrIrJ)r4r()r$rrrr~sz SocketIO.namecCs|jS)N)r)r$rrrrSsz SocketIO.modecCs*|jr dStjj||jjd|_dS)zClose the SocketIO object. This doesn't close the underlying socket, except if all references to it have disappeared. N)r4rMrr*rr{)r$rrrr*s   zSocketIO.close)rrrrr#rrrrrr(rrrSr*rrr)r0rrLs     rLr-c Csp|j}| s|dkrt}yt|\}}}Wntk rBYn*X|jd|x|D]}d|krVPqVW|}|S)aGet fully qualified domain name from name. An empty argument is interpreted as meaning the local host. First the hostname returned by gethostbyaddr() is checked, then possibly existing aliases. In case no FQDN is available, hostname from gethostname() is returned. z0.0.0.0r.)stripZ gethostnameZ gethostbyaddrr3insert)rZhostnamealiasesZipaddrsrrrr s   cCs|\}}d}xt||dtD]}|\}}} } } d} y>t||| } |tk rR| j||r`| j|| j| d}| Stk r} z| }| dk r| jWYdd} ~ XqXqW|dk r|ntddS)acConnect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. A host of '' or port 0 tells the OS to use the default. Nrz!getaddrinfo returns an empty list) getaddrinforwr_GLOBAL_DEFAULT_TIMEOUTr:rrr3r*)ZaddressrfZsource_addressrrrkresafsocktyper' canonnamesar=rrrrr s*    c CsTg}xJtj||||||D]2}|\}} }} } |jt|tt| t|| | fqW|S)aResolve host and port into list of address info entries. Translate the host/port argument into a sequence of 5-tuples that contain all the necessary arguments for creating a socket connected to that service. host is a domain name, a string representation of an IPv4/v6 address or None. port is a string service name such as 'http', a numeric port number or None. By passing None as the value of host and port, you can pass NULL to the underlying C API. The family, type and proto arguments can be optionally specified in order to narrow the list of addresses returned. Passing zero as a value for each of these arguments selects the full range of results. )r"rappendrr r) rrr%r&r'flagsZaddrlistrrrrrrrrrs r)r)r-)rrrr).rr"r_sysrMrdenumrrerrno ImportErrorr/rrr __all__extend_get_exports_list_convertrrrrrZ _realsocketplatformlowerrrr Exceptionrr rcrrwrrrrrLr objectrr rrrrr/s            C   $ u  'mailcap.cpython-36.opt-1.pyc000064400000016053152462730460011555 0ustar003 ik#@sdZddlZddlZddlZddgZddZejdjZGdd d e Z d dZ d d Z d dZ ddZddZddZddgfddZd#ddZgfddZddZddZd d!Zed"kredS)$z%Mailcap file handling. See RFC 1524.Ngetcaps findmatchcCsd|krd|dfSdSdS)Nlinenor)rr)entryrr/usr/lib64/python3.6/mailcap.pylineno_sort_key s r z[^\xa1-\U0010FFFF\w@+=:,./-]c@seZdZdZdS)UnsafeMailcapInputz)Warning raised when refusing unsafe inputN)__name__ __module__ __qualname____doc__rrrrr sr cCsi}d}xtD]}yt|d}Wntk r8wYnX|t||\}}WdQRXx6|jD]*\}}||kr||||<qb|||||<qbWqW|S)aReturn a dictionary containing the mailcap database. The dictionary maps a MIME type (in all lowercase, e.g. 'text/plain') to a list of dictionaries corresponding to mailcap entries. The list collects all the entries for that MIME type from all available mailcap files. Each dictionary contains key-value pairs for that MIME type, where the viewing command is stored with the key "view". rrN)listmailcapfilesopenOSError_readmailcapfileitems)capsrZmailcapfpZmorecapskeyvaluerrrrs   cCsPdtjkr"tjd}|jtj}n*dtjkr8tjd}nd}|ddddg}|S)z7Return a list of all mailcap files found on the system.ZMAILCAPSHOME.z /.mailcapz /etc/mailcapz/usr/etc/mailcapz/usr/local/etc/mailcap)osenvironsplitpathsep)ZpathstrZmailcapshomerrrr3s    rcCs tjdtdt|d\}}|S)z?Read a mailcap file and return a dictionary keyed by MIME type.z2readmailcapfile is deprecated, use getcaps insteadN)warningswarnDeprecationWarningr)rr_rrrreadmailcapfileEsr%c Csi}x|j}|sP|ddks|jdkr.q|}x4|d ddkrf|j}|sTd}|dd |}q4Wt|\}}|oz|s~q|dk r||d<|d 7}|jd }x$tt|D]}||j||<qWd j|j}||kr||j|q|g||<qW||fS) aRead a mailcap file and return a dictionary keyed by MIME type. Each MIME type is mapped to an entry consisting of a list of dictionaries; the list will contain more than one such dictionary if a given MIME type appears more than once in the mailcap file. Each dictionary contains key-value pairs for that MIME type, where the viewing command is stored with the key "view". r#r Nz\  rr/r*) readlinestrip parselinerrangelenjoinlowerappend) rrrlineZnextlinerfieldstypesjrrrrMs6   rc Csg}dt|}}x.||kr@t|||\}}|j||d}qWt|dkrRdS|d|d|dd}}}d|i}x^|D]V}|jd}|dkr|}d} n$|d|j}||ddj} ||krq| ||<qW||fS) zParse one entry in a mailcap file and return a dictionary. The viewing command is stored as the value with the key "view", and the rest of the fields produce key-value pairs in the dict. rrr Nview=r')NN)r/ parsefieldr2findr,) r3r4infieldrr7restZfkeyZfvaluerrrr-vs*        r-cCsT|}x:||kr>||}|dkr"Pq|dkr4|d}q|d}qW|||j|fS)z/Separate one key-value pair in a mailcap entry.;\r r)r,)r3r;r<startcrrrr9s   r9r7z /dev/nullc Cst|r"d|f}tj|tdSt|||}xd|D]\}d|krnt|d||}|dkrZq4|rntj|dkrnq4t|||||} | dk r4| |fSq4WdS)aFind a match for a mailcap entry. Return a tuple containing the command line, and the mailcap entry used; (None, None) if no match is found. This may invoke the 'test' command of several matching entries before deciding which entry to use. zHRefusing to use mailcap with filename %r. Use a safe temporary filename.Ntestr)NN)NN) _find_unsafer!r"r lookupsubstrsystem) rMIMEtyperfilenameplistmsgentrieserCcommandrrrrs      cslg}||kr|||}|jd}|dd}||krB|||}dk r\fdd|D}t|td}|S)Nr)rz/*csg|]}|kr|qSrr).0rM)rrr szlookup..)r)rsortedr )rrHrrLZ MIMEtypesr)rrrEs     rEc Cs\d}dt|}}xB||krV||}|d}|dkrb|dkrX|||d}|d}||}q||}|d}|dkr||}q|dkr||}q|dkrt|rd|f}tj|tdS||}q|d krH|} x ||kr||d kr|d}qW|| |} |d}t| |} t| r>d | | f}tj|tdS|| }q|d|}qW|S) Nr'rr%r@stz9Refusing to substitute MIME type %r into a shell command.{}z=Refusing to substitute parameter %r (%s) into a shell command)r/rDr!r"r findparam) r=rHrIrJresr;r<rBrKrAnameZparamrrrrFsH              rFcCsF|jd}t|}x,|D]$}|d|j|kr||dSqWdS)Nr8r')r1r/)rYrJr<prrrrWs   rWc Csddl}t}|jdds(t|dSxtdt|jdD]}|j||d}t|dkrjtddS|d}|d}t||d|\}}|stdtqs* ) ) copyreg.cpython-36.pyc000064400000010226152462730460010654 0ustar003 \_ @sdZdddddgZiZdddZddZyeWnek rDYnXd d Zeeeed d ZdZ ddZ ddZ ddZ ddZ iZiZiZddZddZddZdS)zHelper to provide extensibility for pickle. This is only useful to add pickle support for extension types defined in C, not for instances of user-defined classes. pickle constructor add_extensionremove_extensionclear_extension_cacheNcCs,t|std|t|<|dk r(t|dS)Nz$reduction functions must be callable)callable TypeErrordispatch_tabler)ob_typepickle_functionconstructor_obr /usr/lib64/python3.6/copyreg.pyr s cCst|stddS)Nzconstructors must be callable)rr)objectr r r rscCst|j|jffS)N)complexrealimag)cr r r pickle_complex"srcCs<|tkrtj|}n$|j||}|jtjkr8|j|||S)N)r__new____init__)clsbasestateobjr r r _reconstructor)s     r cCs|dks tx,|jjD]}t|dr|jt@ rPqWt}|tkrHd}n ||jkr`td|j||}|j||f}y |j }WnLt k rt |ddrtdy |j }Wnt k rd}YnXYnX|}|rt ||fSt |fSdS)N __flags__zcan't pickle %s objects __slots__zNa class that defines __slots__ without defining __getstate__ cannot be pickled)AssertionError __class____mro__hasattrr _HEAPTYPErr__name__ __getstate__AttributeErrorgetattr__dict__r)selfprotorrargsgetstatedictr r r _reduce_ex6s0       r/cGs|j|f|S)N)r)rr,r r r __newobj__Wsr0cCs|j|f||S)zUsed by pickle protocol 4, instead of __newobj__ to allow classes with keyword-only arguments to be pickled correctly. )r)rr,kwargsr r r __newobj_ex__Zsr2c Cs|jjd}|dk r|Sg}t|ds(nx|jD]}d|jkr0|jd}t|trX|f}xh|D]`}|d krnq^q^|jdr|jd r|jj d}|r|j d||fq|j |q^|j |q^Wq0Wy ||_ Wn YnX|S) aReturn a list of slot names for a given class. This needs to find slots defined by the class and its bases, so we can't simply return the __slots__ attribute. We must walk down the Method Resolution Order and concatenate the __slots__ of each class found there. (This assumes classes don't modify their __slots__ attribute to misrepresent their slots after the class is defined.) __slotnames__Nrr) __weakref_____z_%s%s)r)r4) r)getr#r" isinstancestr startswithendswithr%lstripappendr3)rnamesrslotsnamestrippedr r r _slotnames`s2          rBcCst|}d|kodkns(td||f}tj||krPtj||krPdS|tkrltd|t|f|tkrtd|t|f|t|<|t|<dS)zRegister an extension code.rizcode out of rangeNz)key %s is already registered with code %sz$code %s is already in use for key %s)int ValueError_extension_registryr7_inverted_registry)moduler@codekeyr r r rscCsR||f}tj||ks$tj||kr4td||ft|=t|=|tkrNt|=dS)z0Unregister an extension code. For testing only.z%key %s is not registered with code %sN)rEr7rFrD_extension_cache)rGr@rHrIr r r rs cCs tjdS)N)rJclearr r r r rs)Ni)__doc____all__rrrr NameErrorrrr$r/r0r2rBrErFrJrrrr r r r s.    !< _weakrefset.cpython-36.opt-1.pyc000064400000017226152462730460012451 0ustar003 \I@s2ddlmZdgZGdddZGdddZdS))refWeakSetc@s$eZdZddZddZddZdS)_IterationGuardcCst||_dS)N)r weakcontainer)selfrr#/usr/lib64/python3.6/_weakrefset.py__init__sz_IterationGuard.__init__cCs |j}|dk r|jj||S)N)r _iteratingadd)rwrrr __enter__s z_IterationGuard.__enter__cCs0|j}|dk r,|j}|j||s,|jdS)N)rr remove_commit_removals)retbr srrr__exit__s  z_IterationGuard.__exit__N)__name__ __module__ __qualname__r r rrrrrr src@seZdZd>ddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZddZddZeZd d!Zd"d#Zd$d%ZeZd&d'Zd(d)Zd*d+ZeZd,d-Zd.d/ZeZd0d1Zd2d3Zd4d5Z e Z!d6d7Z"d8d9Z#d:d;Z$e$Z%d|j|dS)NcSs2|}|dk r.|jr"|jj|n |jj|dS)N)r _pending_removalsappenddatadiscard)itemselfrefrrrr_remove&s z!WeakSet.__init__.._remove)setrrrrr update)rrrrrrr $szWeakSet.__init__cCs(|j}|jj}x|r"||jqWdS)N)rrrpop)rlrrrrr4szWeakSet._commit_removalsc cs<t|*x"|jD]}|}|dk r|VqWWdQRXdS)N)rr)ritemrefrrrr__iter__:s   zWeakSet.__iter__cCst|jt|jS)N)lenrr)rrrr__len__CszWeakSet.__len__c Cs,y t|}Wntk r dSX||jkS)NF)r TypeErrorr)rrwrrrr __contains__Fs  zWeakSet.__contains__cCs|jt|ft|ddfS)N__dict__) __class__listgetattr)rrrr __reduce__Ms zWeakSet.__reduce__cCs&|jr|j|jjt||jdS)N)rrrr rr)rrrrrr Qsz WeakSet.addcCs|jr|j|jjdS)N)rrrclear)rrrrr/Vsz WeakSet.clearcCs |j|S)N)r+)rrrrcopy[sz WeakSet.copyc CsV|jr|jxBy|jj}Wntk r:tdYnX|}|dk r|SqWdS)Nzpop from empty WeakSet)rrrr!KeyError)rr#rrrrr!^sz WeakSet.popcCs"|jr|j|jjt|dS)N)rrrrr)rrrrrrjszWeakSet.removecCs"|jr|j|jjt|dS)N)rrrrr)rrrrrroszWeakSet.discardcCs*|jr|jx|D]}|j|qWdS)N)rrr )rotherelementrrrr ts zWeakSet.updatecCs|j||S)N)r )rr2rrr__ior__zs zWeakSet.__ior__cCs|j}|j||S)N)r0difference_update)rr2newsetrrr difference~s zWeakSet.differencecCs|j|dS)N)__isub__)rr2rrrr5szWeakSet.difference_updatecCs<|jr|j||kr"|jjn|jjdd|D|S)Ncss|]}t|VqdS)N)r).0rrrr sz#WeakSet.__isub__..)rrrr/r5)rr2rrrr8s  zWeakSet.__isub__csjfdd|DS)Nc3s|]}|kr|VqdS)Nr)r9r)rrrr:sz'WeakSet.intersection..)r+)rr2r)rr intersectionszWeakSet.intersectioncCs|j|dS)N)__iand__)rr2rrrintersection_updateszWeakSet.intersection_updatecCs(|jr|j|jjdd|D|S)Ncss|]}t|VqdS)N)r)r9rrrrr:sz#WeakSet.__iand__..)rrrr=)rr2rrrr<szWeakSet.__iand__cCs|jjdd|DS)Ncss|]}t|VqdS)N)r)r9rrrrr:sz#WeakSet.issubset..)rissubset)rr2rrrr>szWeakSet.issubsetcCs|jtdd|DkS)Ncss|]}t|VqdS)N)r)r9rrrrr:sz!WeakSet.__lt__..)rr)rr2rrr__lt__szWeakSet.__lt__cCs|jjdd|DS)Ncss|]}t|VqdS)N)r)r9rrrrr:sz%WeakSet.issuperset..)r issuperset)rr2rrrr@szWeakSet.issupersetcCs|jtdd|DkS)Ncss|]}t|VqdS)N)r)r9rrrrr:sz!WeakSet.__gt__..)rr)rr2rrr__gt__szWeakSet.__gt__cCs(t||jstS|jtdd|DkS)Ncss|]}t|VqdS)N)r)r9rrrrr:sz!WeakSet.__eq__..) isinstancer+NotImplementedrr)rr2rrr__eq__s zWeakSet.__eq__cCs|j}|j||S)N)r0symmetric_difference_update)rr2r6rrrsymmetric_differences zWeakSet.symmetric_differencecCs|j|dS)N)__ixor__)rr2rrrrEsz#WeakSet.symmetric_difference_updatecs@jrj|kr"jjnjjfdd|DS)Nc3s|]}t|jVqdS)N)rr)r9r)rrrr:sz#WeakSet.__ixor__..)rrrr/rE)rr2r)rrrGs  zWeakSet.__ixor__cCs|jdd||fDS)Ncss|]}|D] }|Vq qdS)Nr)r9rrrrrr:sz WeakSet.union..)r+)rr2rrrunionsz WeakSet.unioncCst|j|dkS)Nr)r%r;)rr2rrr isdisjointszWeakSet.isdisjoint)N)'rrrr rr$r&r)r.r r/r0r!rrr r4r7__sub__r5r8r;__and__r=r<r>__le__r?r@__ge__rArDrF__xor__rErGrH__or__rIrrrrr#sH     N)_weakrefr__all__rrrrrrs pydoc.cpython-36.opt-2.pyc000064400000221004152462730460011260 0ustar003 iM@sdgZdZdZdZddlZddlZddlZddlZddl Zddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZddlZddlZddlmZddlmZddlmZd d Zd d Zd dZddZddZ ddZ!ddZ"ej#dej$Z%ddZ&ddZ'ddZ(ddZ)d d!Z*dtd"d#Z+d$d%Z,d&d'Z-d(d)Z.d*d+Z/ifd,d-Z0Gd.d/d/e1Z2d0d1Z3difd2d3Z4Gd4d5d5Z5Gd6d7d7eZ6Gd8d9d9e5Z7Gd:d;d;eZ8Gdd?d?e9Z:d@dAa;dBdCZdHdIZ?dJdKZ@dLdMZAdNdOZBdPdQZCdudRdSZDe9ZEe:ZFe7ZGdvdTdUZHdwdWdXZIdxdYdZZJdyd[d\ZKdzd^d_ZLGd`dadaZMeMZNGdbdcdcZOdddeZPdfdgZQd{didjZRd|dkdldmdnZSdodpZTdqdrZUeVdskreUdS)}helpzKa-Ping Yee z26 February 2001zGuido van Rossum, for an excellent programming language. Tommy Burnette, the original creator of manpy. Paul Prescod, for all his work on onlinehelp. Richard Chamberlain, for the first implementation of textdoc. N)deque)Repr)format_exception_onlycCs`g}g}xRtjD]H}tjj|p d}tjj|}||krtjj|r|j||j|qW|S)N.)syspathosabspathnormcaseisdirappend)dirsZnormdirsdirZnormdirr/usr/lib64/python3.6/pydoc.pypathdirsLs   rcCs.tj|ptj|}|r*tjdd|jp,dS)Nz^ * )inspectgetdocZ getcommentsresubrstrip)objectresultrrrrXsrcCsh|jjd}t|dkr&|ddfSt|dkrZ|dj rZ|ddj|ddfSddj|fS)N rr)stripsplitlenrjoin)doclinesrrrsplitdoc]s   r$cCs"|j}|j|kr|jd|}|S)Nr)__name__ __module__)rmodnamenamerrr classnamefs r)cCs>tj|p:tj|p:tj|p:tj|p:tj|p:tj| S)N)rismoduleisclass isroutineZisframeZ istracebackZiscode)rrrrisdatamsr-cGs2x,|r,|dj|j|d}|dd}qW|S)Nrrr)r!r)textZpairsrrrreplacessr/cCsXt||krTtd|dd}td|d|}|d|d|t||dS|S)Nrrz...)r max)r.maxlenZpreZpostrrrcramzs  $r3z at 0x[0-9a-f]{6,16}(>+)$cCs tjd|S)Nz\1) _re_stripidr)r.rrrstripidsr5cCs(tj|p&tj|p&tj|p&tj|S)N)r isfunctionismethod isbuiltinZismethoddescriptor)objrrr_is_some_methods   r:cCs<tj|rdStj|r8t|dd}tj|p4|dk SdS)NT__self__F)rr7r8getattrr*)fnselfrrr_is_bound_methods    r?cCshi}x tj|tD]\}}d||<qWx|jD]}|jt|q.Wx|jD]}t||||<qNW|S)Nr)r getmembersr: __bases__update allmethodskeysr<)clmethodskeyvaluebaserrrrCs  rCcCs<g}g}x*|D]"}||r&|j|q|j|qW||fS)N)r )s predicateyesnoxrrr _split_lists  rOcCs\|dkr dS|jdr$|jdr$dS|jdrr[r\rWr&rZrXrQrVrTrRr%rSr]rUrPrY) startswithendswithhasattr)r(allr9rrr visiblenamesrecCsDg}x:tj|D],\}}}}tj|r*d}|j||||fqW|S)Nzdata descriptor)rclassify_class_attrsisdatadescriptorr )rresultsr(kindclsrHrrrrfs  rfc s\t|dgyfddtDWntk r>iYnXfdd}|j|ddS)Nr`csi|]\}}|t|qSr)r ).0ir()fieldsrr sz#sort_attributes..csj|dd|dfS)Nr)get)attr) field_orderrrsz!sort_attributes..)rG)r< enumerate TypeErrorsort)attrsrZkeyfuncr)rqrmrsort_attributess   rwcCs<tjj|r8x*dD]"}tjjtjj|d|rdSqWdS)N.py.pyc__init__TF)rxry)r rr isfiler!)rextrrr ispackages   r}cCs|j}x,|dddks$|j r4|j}|s Pq W|j}|dddkrZ|dd}|dddkr|dd}|d ddkr|dd }x|js|j}|sPqW|jddj}nd}|S) Nr#zr"""r0z"""\rr)readlinerr)filelinerrrrsource_synopsiss&    rc Cstj|j}|j|d\}}|dks.||kr|jttjjrJtjj }n |jttjj rftjj }nd}|dkryt j |}Wntk rdSX|t|}WdQRXnZ|d|}tjjd||d}ytjj|} Wn dStjd=| jr| jjdnd}||f||<|S)NZ__temp__)loaderr)NN)r statst_mtimerorbtuple importlib machineryBYTECODE_SUFFIXESSourcelessFileLoaderEXTENSION_SUFFIXESExtensionFileLoadertokenizeopenOSErrorrutilspec_from_file_location _bootstrap_loadrmodulesrU splitlines) filenamecachemtimeZ lastupdaterZ loader_clsrrspecmodulerrrsynopsiss4      rc@seZdZddZddZdS)ErrorDuringImportcCs||_|\|_|_|_dS)N)rexcrHtb)r>rexc_inforrrrz#szErrorDuringImport.__init__cCs|jj}d|j||jfS)Nzproblem in %s - %s: %s)rr%rrH)r>rrrr__str__'szErrorDuringImport.__str__N)r%r&r[rzrrrrrr!src Cstjj}t|d}||jt|k}WdQRXtjj|}tjj |\}}|r`tj j ||}ntj j ||}tjj |||d}y tjj|St|tjYnXdS)Nrb)r)rr MAGIC_NUMBERrreadr r rbasenamesplitext_bootstrap_externalrSourceFileLoaderrrrrrr) rmagicrZ is_bytecoderr(r|rrrrr importfile+s   rc s"yb|rXtjkrXtjkrXfddtjD}x(g|D]}tj|||<tj|=q:Wt}Wnxtj\}}}} tjkrttjj| n<|tkrt|j| n&t |t r|j krdSttjYnXx@j dddD]*} yt || }Wqtk rdSXqW|S)Ncsg|]}|jdr|qS)r)ra)rkm)rrr Qszsafeimport..rr)rrbuiltin_module_names __import__rrrV SyntaxErrorr issubclass ImportErrorr(rr<AttributeError) r forceloadrZsubsrGrrrHrinfopartr)rr safeimport=s.     rc@s|eZdZejjddejddZd ddZ dddZ e Z Z Z ZZZejjejd d ejddfd d ZdS)Doc PYTHONDOCSz%https://docs.python.org/%d.%d/libraryNrc Gs||f|}tj|r |j|Stj|r4|j|Sy@tj|rJ|j|Stj|r^|j|Stj|rr|j |SWnt k rYnXt |t r|j |S|j|S)N)risgetsetdescriptordocdataismemberdescriptorr* docmoduler+docclassr, docroutiner isinstanceproperty docpropertydocother)r>rr(argsrrrdocumentss"       z Doc.documentcGs*d|odt|t|jf}t|dS)Nz.don't know how to document object%s of type %s )reprtyper%rt)r>rr(rmessagerrrfailszDoc.faillibz python%d.%dcCsytj|}Wntk r&d}YnXtjjd|j}tjj|}t |t tr|j dks||j |r|j tjj |d  r|j dkr|j drd|jd|j jf}qtjj ||j jd}nd}|S)Nz (built-in)rerrno exceptionsgcimpmarshalposixsignalr_thread zipimportz site-packages xml.etreetest.pydoc_modhttp://https://z%s/%s/z.html) rrrrrrrrrr)rr)rr)r getabsfilertr environrorrr rrr%rar!rlower)r>rZbasedirrdoclocrrr getdoclocs$     z Doc.getdocloc)N)N)r%r&r[r rror version_inforrrrrrrrrrr!base_exec_prefixrrrrrrms   rc@sDeZdZddZddZddZddZd d ZeZd d Z eZ d S)HTMLReprcCs,tj|d|_|_d|_d|_|_dS)N d)rrzmaxlistmaxtuplemaxdict maxstringmaxother)r>rrrrzs  zHTMLRepr.__init__cCst|ddddddS)N&z&z>)r/)r>r.rrrescapeszHTMLRepr.escapecCs tj||S)N)rr)r>rrrrrsz HTMLRepr.reprcCsZtt|dr@ddjt|jj}t||r@t||||S|jttt ||j S)Nr%repr_r_) rcrr!r%rr<rr3r5rr)r>rNlevel methodnamerrrrepr1s  zHTMLRepr.repr1cCs^t||j}t|}d|krJdt|ddkrJd|d|j||dStjdd|j|S)Nrz\\rrrz-((\\[\\abfnrtv\'"]|\\[0-9]..|\\x..|\\u....)+)z\1)r3rrr/rrr)r>rNrtesttestreprrrr repr_strings zHTMLRepr.repr_stringc Cs8y|jttt||jS|jd|jjSdS)Nz <%s instance>)rr3r5rr __class__r%)r>rNrrrr repr_instanceszHTMLRepr.repr_instanceN) r%r&r[rzrrrrrepr_strrZ repr_unicoderrrrrs rc@s eZdZeZejZejZddZd4ddZd5d d Z d d Z d dZ d6ddZ ddZ ddZddZddZddZddZdiiifddZd7d d!Zd8d"d#Zddiifd$d%Zd&d'Zddiiidfd(d)Zd*d+Zd9d,d-Zd:d.d/Zd;d0d1Zd Python: %s %s r)r>titlecontentsrrrpagesz HTMLDoc.pagercCsd|||||pdfS)Na'
 
 
%s
%s
z r)r>rfgcolbgcolZextrasrrrheadings zHTMLDoc.headingN c Cs^|dkrdd|d}d|||f} |r@| d||||f} n| d|||f} | d|S)Nzz zz

zR z( z'
 
%s
%s %s
%s
%s%s%s
r) r>rrrrwidthZpreludeZ marginaliaZgaprrrrsectionszHTMLDoc.sectioncGsd|}|j|f|S)Nz%s)r)r>rrrrr bigsection szHTMLDoc.bigsectionc Cs&|j|j}t|dddddddd S)Nz z rz rz
)r expandtabsr/)r>r.rrr preformats zHTMLDoc.preformatrcCsd}t||d|}xht|D]\}|dd|}x>t|||||D]$}|t|krN||||d}qNW|d}q"Wd|S)Nrrzrz
zz7%s
)r range)r>listformatZcolsrrowscolrlrrr multicolumns  zHTMLDoc.multicolumncCsd|S)Nz%sr)r>r.rrrgrey sz HTMLDoc.greycGs*x$|D]}||krd|||fSqW|S)Nz
%sr)r>r(Zdictsdictrrrnamelink"s zHTMLDoc.namelinkcCsN|jtjj|j}}t||rDt|||krDd|j|t||fSt||S)Nz%s)r%rrror&rcr<r))r>rr'r(rrrr classlink)s zHTMLDoc.classlinkcCsd|j|jfS)Nz%s)r%)r>rrrr modulelink1szHTMLDoc.modulelinkcCsR|\}}}}|r|j|S|r,d||f}nd|}|rBd|}n|}d||fS)Nz %s.%s.htmlz%s.htmlz"%s (package)z%s)r)r>Z modpkginfor(rr}shadowedurlr.rrr modpkglink5s   zHTMLDoc.modpkglinkcCs d||fS)Nz%sr)r>rrrrrfilelinkDszHTMLDoc.filelinkcCs|p|j}g}d}tjd}xL|j||} | s2P| j\} } |j|||| | j\} } }}}}| r|| jdd}|jd||fn|rdt|}|jd||| fn|rdt|}|jd||| fn|r$|| | dd kr|jd |j ||n|jd |n@|| | dd krR|j|j ||||n|j|j ||| }q W|j|||dd j |S) NrzD\b((http|ftp)://\S+[\w/]|RFC[- ]?(\d+)|PEP[- ]?(\d+)|(self\.)?(\w+))"z"z%sz'http://www.rfc-editor.org/rfc/rfc%d.txtz(http://www.python.org/dev/peps/pep-%04d/r(zself.zself.%sr) rrcompilesearchspanr groupsr/intrr!)r>r.rfuncsclassesrFrhherepatternmatchstartendrdschemeZrfcZpepZselfdotr(rrrrmarkupHs<      zHTMLDoc.markupc Csd}x|D]}t|tfkr|\}}|d}||j||}|r||fkrg}x|D]} |j|j| |qVW|ddj|d}|d}q t|tgkr |d|j|||}q Wd|S) Nrz"

rz, )z
z
%s
z
%s
)rrr r! formattree) r>treer'parentrentrycbasesparentsrIrrrr(ss    zHTMLDoc.formattreec#s|j}y |j}Wntk r(d}YnX|jd}g}x@tt|dD],}|jddj|d|d||fqJWdj||d-d} d| } y&tj |} t j j | } j | | } Wntk rd} YnXg}t|dr:t|j}|ddd.kr&|d/ddkr&|dd0j}|jd j|t|d r\|jjt|j|rt| d d j|} j|}|dk rdt}nd}j| ddd| |}tj|tj}gi}}xltj|tjD]Z\}}|dk stj|p||krt|||r|j||fd|||<||<qWx|D]\}}xx|jD]n}|j|j}}tj j!|}||krL|rLt||rLt"|||krL||krL|d|||<||<qLWq%sz)%sz (built-in)r] $z Revision: z version %srTz (%s)z, z-
Module Referencerz#ffffffz#7799eezindex
r~z.html#z#-z %sz

%s

rZrzPackage Contentsz#aa55cccsj|dS)Nr)r)t)r>rrrrsz#HTMLDoc.docmodule..ModulescSsg|] \}}|qSrr)rkrGrHrrrrsz%HTMLDoc.docmodule..ZClassesz#ee77aarZ Functionsz#eeaa77ZDataz#55aa55z
rPZAuthorrSZCreditsrz $Revision: rr)6r%__all__rrrr r r!rrurllibparseZquoterrtrcstrr]rrrTrlocalsrr@r*r+ getmodulererAr&rrror<r,r8r6r-r&rrpkgutil iter_modulesrZrur rrr( getclasstreerrPrS)#r>rr(modignoredrdpartsZlinksrlZ linkednameheadrrrrversionrrrrZcdictrGrHrIr'rrZfdictdatar"modpkgsimporterispkgr classlistr)r>rrs   &     $         $        zHTMLDoc.docmodulecsj}|p |}j}g} | jGfddd} | ttj} t| dkrjdx"| D]} dj| j qfWdfdd} fd d }fd d }fd dt D}ixv|D]n\}}}}d|d||<}yt |}Wnt k r:YnXy ||<Wqt k r^YqXqWx|rT| r|| jn |ddt|fdd\}}tjkr|}qfn"krd}ndjj }|d7}t|| d||dd}| d||dd}| d||dd}|d||dd}|d||d d}|}qfWd!j| } ||krxd"||f}nd#|||f}|rg}x"|D]} |jj| j qW|d$d%j|}jtj}|od&|}j|d'd(| d)|S)*Ncs eZdZddZfddZdS)z(HTMLDoc.docclass..HorizontalRulecSs d|_dS)Nr)needone)r>rrrrz sz1HTMLDoc.docclass..HorizontalRule.__init__cs|jrdd|_dS)Nz
r)rF)r>)pushrrmaybe sz.HTMLDoc.docclass..HorizontalRule.maybeN)r%r&r[rzrHr)rGrrHorizontalRule srIrz&
Method resolution order:
z
%s
z
cst||\}}|rj|xl|D]d\}}}}yt|}Wn&tk rhj||YnXj||dq(W|S)Nr)rOrHr< Exception_docdescriptorr)msgrvrKokr(rihomeclsrH)rrhrmdictr<rrGr>rrspills  zHTMLDoc.docclass..spillcsNt||\}}|rJj|x&|D]\}}}}j||q(W|S)N)rOrHrK)rLrvrKrMr(rirNrH)rOr<rGr>rrspilldescriptors/sz*HTMLDoc.docclass..spilldescriptorsc st||\}}|rj|x|D]\}}}}jt||}t|sZtj|rht|dd} nd} | dkrd|n0jt|j } d| } d|| fdq(W|S)NrUz
%s
z
%sz
%s%s
r) rOrHrr<callablerrgr&rr) rLrvrKrMr(rirNrHrIr")rrrOrPr<rrGr>rr spilldata8s"  z#HTMLDoc.docclass..spilldatacs,g|]$\}}}}t|dr||||fqS))r9)re)rkr(rirjrH)rrrrMs z$HTMLDoc.docclass..r~-rcs |dkS)Nrr)r1) thisclassrrrrfsz"HTMLDoc.docclass..z defined herezinherited from %sz:
z Methods %scSs |ddkS)Nrmethodr)r1rrrrrvszClass methods %scSs |ddkS)Nrz class methodr)r1rrrrrxszStatic methods %scSs |ddkS)Nrz static methodr)r1rrrrrzszData descriptors %scSs |ddkS)Nrzdata descriptorr)r1rrrrr|szData and other attributes %scSs |ddkS)NrrAr)r1rrrrr~srz*class %sz/%s = class %sz(%s)z, z%s
 
z#000000z#ffc8d8r0)r%rAr rrgetmror rHrr&rfr<rJrtpopleftrObuiltinsrrwr!r&rrr)r>rr(r<rrr=realnamer-rrImrorIrQrRrTrvrGrirNrHanchor inheritedtagrr.r"r) rrrOrPr<rrGr>rVrrs                              zHTMLDoc.docclasscCs|jd|j|S)N=)rr)r>rrrr formatvalueszHTMLDoc.formatvaluecCs|j}|p |}|r|jpdd|} d} d} t|r|jj} |rZ| |k rd|j| |} n0|jdk rzd|j|jj|} nd|j| |} ||krd| |f} nD|rtj||g|krd|jd||f}d } n|}d | ||f} d}tj|rNytj|}Wnt t fk r d}YnX|rNt |}|d krNd |} |d d}|sXd }| |j || ov|j d| }| rd|S|jt||j|||}|od|}d||fSdS)NrrUrz from z method of %s instancez unbound %s methodz$%sz%srz)%s = %szz$%s lambda z(...)z'%sz
%s
z
%s
z
%s
%s
r)r%r?r;rrrgetattr_staticr, signature ValueErrorrtr6rrr&rr)r>rr(r<rrrFrEr[r]noteskipdocsimclassrZreallinkargspecrcdeclr"rrrrsX       zHTMLDoc.docroutinecCsTg}|j}|r|d||jdk rB|jt||j}|d||ddj|S)Nz!
%s
z
%s
z
r)r rUr&rrr!)r>r(rHr<rhrGr"rrrrKs   zHTMLDoc._docdescriptorcCs|j|||S)N)rK)r>rr(r<rErrrrszHTMLDoc.docpropertycGs|r d|pd}||j|S)Nz%s = r)r)r>rr(r<r=ZlhsrrrrszHTMLDoc.docothercCs|j|||S)N)rK)r>rr(r<rErrrrszHTMLDoc.docdatacCsg}|dkri}xLtj|gD]<\}}}tdd|Drsz HTMLDoc.index..rrz#ffffffz#ee77aa)r9r:anyr rur rr)r>rrrBrCr(rDrrrrindexs z HTMLDoc.index)r)rrNr)r)N)NN)NNN)NN)NNN)N)r%r&r[r_repr_instancerrrrrrrr rrrrrrr&r(rrrarrKrrrrnrrrrrs:   +  y:   rc@s0eZdZddZddZddZeZddZd S) TextReprcCs,tj|d|_|_d|_d|_|_dS)Nrrr)rrzrrrrr)r>rrrrzs  zTextRepr.__init__cCsTtt|dr@ddjt|jj}t||r@t||||Sttt||j S)Nr%rr_) rcrr!r%rr<r3r5rr)r>rNrrrrrrs  zTextRepr.repr1cCsHt||j}t|}d|krDdt|ddkrDd|d||dS|S)Nrz\\rrr)r3rrr/)r>rNrrrrrrr s  zTextRepr.repr_stringc Cs,yttt||jSd|jjSdS)Nz <%s instance>)r3r5rrrr%)r>rNrrrrrszTextRepr.repr_instanceN)r%r&r[rzrrrrrrrrrps  rpc@seZdZeZejZddZdddZddZdd d Z dd d Z dddZ ddZ d ddZ ddZd!ddZd"ddZd#ddZdS)$TextDoccCsdjdd|DS)Nrcss|]}|d|VqdS)Nr)rkrkrrrrl(szTextDoc.bold..)r!)r>r.rrrbold&sz TextDoc.bold cs>|sdSfdd|jdD}|r4|dj|d<dj|S)Nrcsg|] }|qSrr)rkr)prefixrrr-sz"TextDoc.indent..rrrr)rrr!)r>r.rur#r)rurindent*s zTextDoc.indentcCs$|j|j}|j|d|dS)Nrz )rvrrs)r>rrZclean_contentsrrrr1szTextDoc.sectionNrc sd}x|D]}t|tfkrt|\}}||t|}|rj||fkrjfdd|D} |ddj| }|d}q t|tgkr ||j|||d}q W|S)Nrc3s|]}t|VqdS)N)r))rkr,)r'rrrl@sz%TextDoc.formattree..z(%s)z, rz )rr)r!r() r>r)r'r*rurr+r,r-r.r)r'rr(8s  zTextDoc.formattreec CsD|j}tt|\}}|jd||o(d|}t|dd}|j|}|dk r`||jd|d}|rt||jd|}g} xNtj|tjD]<\} } |dk stj | p||krt | ||r| j | | fqWg} xXtj|tj D]F\} } |dk stj | stj | |krt | ||r| j | | fqWg} x6tj|tD]&\} } t | ||r8| j | | fq8Wg}t}t|drxFtj|jD]6\}}}|j||r|j |dn |j |qW|j||jd d j|}g}xBtj|tjD]0\} } | jj|d r| |kr|j | qW|rJ|j||jd d j|}| rd d| D}|jtj|d|g}x&| D]\} } |j |j| | |qzW||jdd j|}| rg}x&| D]\} } |j |j| | |qW||jdd j|}| rFg}x*| D]"\} } |j |j| | |ddq W||jdd j|}t|drt|j}|ddd"kr|d#ddkr|dd$j}||jd|}t|dr||jdt|j }t|dr||jdt|j!}t|dr||jdt|j"}ytj#|}Wnt$k r.d }YnX||jd!|}|S)%NNAMEz - r3zMODULE REFERENCEa. The following documentation is automatically generated from the Python source files. It may be incomplete, incorrect or include features that are considered implementation detail and may vary between Python implementations. When in doubt, consult the module reference at the location listed above. Z DESCRIPTIONrZz (package)zPACKAGE CONTENTSrrZ SUBMODULEScSsg|] \}}|qSrr)rkrGrHrrrrsz%TextDoc.docmodule..rCLASSES FUNCTIONSF)r2ZDATAr]r/r0z Revision: VERSIONrTZDATErPZAUTHORrSZCREDITSz (built-in)ZFILEz $Revision: rr)%r%r$rrr<rrr@r+r8rer r,r8r-setrcr9r:rZaddrur!r*rar(r;rrr6r]rrTrPrSrrt)r>rr(r<ZsynopdescrrdrrrGrHrrArBZ modpkgs_namesrCr'rDZ submodulesrErr@rrrrrHs           $    zTextDoc.docmodulecsXj}|p |}j}jfdd}||kr:dj|}nj|d|}|rlt||} |ddj| }t} | r| dgpg} | jtt j } t | dkrԈd x| D]} d || qWd Gfd d d }|fdd}fdd}fdd}fddt D}x|r"| rT| j n |ddt|fdd\}}tjkr|}q>n krd}ndtj}t||d||dd}|d||dd}|d||d d}|d!||d"d}|d#||d$d}|}q>Wdj| } | s<|dS|dj| jd%dS)&NcSs t||S)N)r))r,rrrrmakenamesz"TextDoc.docclass..makenamezclass z = class z(%s)z, rrzMethod resolution order:z rcs eZdZddZfddZdS)z(TextDoc.docclass..HorizontalRulecSs d|_dS)Nr)rF)r>rrrrzsz1TextDoc.docclass..HorizontalRule.__init__cs|jrddd|_dS)NrUrzr)rF)r>)rGrrrHs z.TextDoc.docclass..HorizontalRule.maybeN)r%r&r[rzrHr)rGrrrIsrIcst||\}}|rj|x^|D]V\}}}}yt|}Wn&tk rhj||Yq(Xj||q(W|S)N)rOrHr<rJrKr)rLrvrKrMr(rirNrH)rOr<rrGr>rrrQszTextDoc.docclass..spillcsNt||\}}|rJj|x&|D]\}}}}j||q(W|S)N)rOrHrK)rLrvrKrMr(rirNrH)rOr<rGr>rrrRsz*TextDoc.docclass..spilldescriptorsc st||\}}|rj|x~|D]v\}}}}t|sFtj|rPt|}nd}yt|} Wntk r|j|} YnXj | |d|ddq(W|S)Nrz)r2r"r) rOrHrSrrgrr<r__dict__r) rLrvrKrMr(rirNrHr"r9)rOr<rrGr>rrrTs  z#TextDoc.docclass..spilldatacs,g|]$\}}}}t|dr||||fqS))r9)re)rkr(rirjrH)rrrrs z$TextDoc.docclass..rcs |dkS)Nrr)r1)rVrrrr sz"TextDoc.docclass..z defined herezinherited from %sz Methods %s: cSs |ddkS)NrrWr)r1rrrrrszClass methods %s: cSs |ddkS)Nrz class methodr)r1rrrrrszStatic methods %s: cSs |ddkS)Nrz static methodr)r1rrrrrszData descriptors %s: cSs |ddkS)Nrzdata descriptorr)r1rrrrrszData and other attributes %s: cSs |ddkS)NrrAr)r1rrrrr sz | )r%rAr&rsmapr!rr rrrXr rfrYrOrZrr)rwrvr)r>rr(r<r=r[r-rrr.r"rr\rIrIrQrRrTrvr^r_r)rOr<rrGr>rVrrsl                        zTextDoc.docclasscCsd|j|S)Nr`)r)r>rrrrra*szTextDoc.formatvaluec Csr|j}|p |}d}d}t|rn|jj}|rB||k rndt||}n,|jdk r`dt|jj|}ndt||}||kr|j|} n,|rtj||g|krd}|j|d|} d} tj|rytj |} Wnt t fk rd} YnX| rt | } |dkr|j|d } | dd } | s&d } | | |} |r@| d St |pLd} | d | oj|j| jd SdS) Nrrz from z method of %s instancez unbound %s methodrz = zz lambda z(...)rr)r%r?r;rr)rsrrbr,rcrdrtr6rrvr)r>rr(r<rEr[rerfrgrrhrcrir"rrrr.sH       zTextDoc.docroutinecCsTg}|j}|r$||j||dt|p.d}|rJ||j||ddj|S)Nrr)r rsrrvr!)r>r(rHr<rhrGr"rrrrK_s zTextDoc._docdescriptorcCs|j|||S)N)rK)r>rr(r<rErrrrlszTextDoc.docpropertycCs|j|||S)N)rK)r>rr(r<rErrrrpszTextDoc.docdatac Cs|j|}|rF|r|dpd|}|t|} | dkrF|d| d}|rX|j|dpZd|}|dk r~|d|jt|7}|S)Nz = rrz...r)rr rsrvr6) r>rr(r<r*r2r"rrZchoprrrrts  zTextDoc.docother)rt)Nr)NN)NN)NNN)NNN)NNN)NNNNN)r%r&r[rprorrsrvrr(rrrarrKrrrrrrrrqs   e } 1  rqc@seZdZddZdS) _PlainTextDoccCs|S)Nr)r>r.rrrrssz_PlainTextDoc.boldN)r%r&r[rsrrrrrsrcCstat|dS)N)getpagerpager)r.rrrrsrc s<ttjdstSttjds tStjj s8tjj r.ZTERMdumbemacscstt|S)N) pipepagerr)r.)rrrrrscs t|S)N)r)r.)rrrrrscSstt|dS)Nzmore <)rr)r.rrrrrssystemz(less) 2>/dev/nullrcSs t|dS)NZless)r)r.rrrrrsz more "%s"cSs t|dS)NZmore)r)r.rrrrrs)rr)rr)rcrstdin plainpagerstdoutrr rroplatformrtempfileZmkstempclosettypagerunlink)rfdrr)rrrs6          rcCstjdd|S)Nz.r)rr)r.rrrrsrc Csddl}|j|d|jd}yDtj|jdd*}y|j|Wntk rPYnXWdQRXWntk rrYnXx(y|j PWqvtk rYqvXqvWdS)NrT)shellrbackslashreplace)errors) subprocessPopenPIPEio TextIOWrapperrwriteKeyboardInterruptrwait)r.cmdrprocpiperrrrs rcCs`ddl}|j}t|ddd}|j|WdQRXztj|d|dWdtj|XdS)Nrwr)rz "r)rZmktemprrr rr)r.rrrrrrrrsrcCs$ttjddpd}|j|dj|S)Nencodingzutf-8r)r<rrencodedecode)r.rrrr_escape_stdoutsrc Cstt|jd}y2ddl}tjj}|j|}|j|dd}Wn(t t t j fk rld}dd}YnXz2yt tjjdd}Wntk rd}YnX|dkrd}|d}}tjjdj|d|dx||drtjjd tjj|} | dkrtjjd Pn,| dkrJtjjd ||d|d}q| dkrn|||}|dkrnd}tjjddj||||d||}qWWd|r|j||j|XdS)NrrcSs tjjdS)Nr)rrrrrrrrrszttypager..cSstjjddddS)Nrr)rrrrrrrrrsZLINESrz -- more --qQz  bB)rr)rr)rrr)rrrttyrrfilenoZ tcgetattrZ setcbreakrrrUnsupportedOperationrr rrordrrr!flushZ tcsetattrZ TCSAFLUSH) r.r#rroldZgetcharhrZincr,rrrrsL              &rcCstjjtt|dS)N)rrrrr)r.rrrrsrcCstj|r>|jtjkr d|jSt|dr4d|jSd|jStj|rRd|jStj|rtd|jj |jj|jfStj |rd|jj |jj|jfStj |rd|jStj |rd |jStj |rd |jSt|jS) Nzbuilt-in module rZzpackage zmodule zbuilt-in function zgetset descriptor %s.%s.%szmember descriptor %s.%s.%szclass z function zmethod )rr*r%rrrcr8r __objclass__r&rr+r6r7r)thingrrrdescribe s.                    rc Csdd|jdD}d\}}xB|t|kr^tdj|d|d|}|rZ||d}}qPqW|rj|}nt}x8||dD](}yt||}Wq|tk rdSXq|W|S)NcSsg|] }|r|qSrr)rkrrrrr'szlocate..rrr)Nr)rr rr!rZr<r)rrr>rnZ nextmodulerrrrrlocate%s  rcCsVt|tr0t||}|dkr(td|||fSt|dd}|t|trL|ndfSdS)Nz~No Python documentation found for %r. Use help() to get the interactive help utility. Use help(str) for help on the str class.r%)rr6rrr<)rrrr(rrrresolve>s    r Python Library Documentation: %scCs|dkr t}t||\}}t|}tj|}|rTd|krT|d|d|jd7}n|rn||k rn|d|j7}tj|ptj|ptj |ptj |ptj |pt |t st|}|d7}||d|j||S)Nrz in z in module z objectz )r.rrrr8rfindr%r*r+r,rrrrrr)rrrZrendererrr(r~rrrr render_docLs$         rcCsfy2|dkrtt|||n|jt|||tWn.ttfk r`}zt|WYdd}~XnXdS)N)rrr plaintextrrprint)rrroutputrHrrrr"es r"cCsy`t||\}}tjt|tj||}t|dddd}|j|WdQRXtd|dWn.tt fk r}zt|WYdd}~XnXdS)Nz.htmlrzutf-8)rZwrote) rhtmlrrrrrrrr)rrrr(rrrHrrrwritedocpsrrcCs6|dkr i}x$tj|g|D]\}}}t|qWdS)N)r9 walk_packagesr)rpkgpathdonerCr'rDrrr writedocs{s  rcJ@seZdZdddddddddddd dddddddddddddddddddddd&!Zd'd(dDZdedddd d d dSZdTdUdVdWdXdYdZd[d\d]d^d_d_d`d`daZxPejD]D\ZZ x8e D]0Z ej e eZ ee kre dbeZ e ee <qWqWd d dddddddddvdddddddddddddddd d!d"d#d$d%d&d'd(d)d*ddd+d,d-d.d/d0dd1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@ddAdBd d!dd dCdDdEdFdʜIZ dGdd̈́Z eddτZeddτZdd҄ZeZefddԄZddքZdd؄ZddڄZdd܄ZdHddZddZddZddZdIddZdJddZddZdKddZ dS(LHelperrBOOLEANwithassertbreak while forclassCLASSES SPECIALMETHODScontinuefunctiondel BASICMETHODSifelsetryforbreak continue whileimportglobalnonlocal NAMESPACES TRUTHVALUEMODULESinSEQUENCEMETHODS COMPARISONlambdarynonlocalglobal NAMESPACESpassraise EXCEPTIONSreturnwhilebreak continue if TRUTHVALUE CONTEXTMANAGERS EXCEPTIONS yieldyield)!FalseNoneTrueandasrrrrdefrelifrexceptfinallyrfromrrrrisrrnotorrrrrrrrcCsg|]}dD] }||q qS)'r)rrr)rkprrrrrszHelper.rfrur'''r"""+rU***r//%<<>>r|^~rr<=>===!=<>+=-=*=/=%=&=|=^=<<=>>=**=//=jJ)STRINGS OPERATORSrUNARYAUGMENTEDASSIGNMENTBITWISECOMPLEXzOPERATORS FORMATTINGPOWERzTUPLES LISTS FUNCTIONSz ATTRIBUTES FLOAT MODULES OBJECTSELLIPSISzSLICINGS DICTIONARYLITERALSz def classr PRIVATENAMESzPRIVATENAMES SPECIALMETHODSZ BACKQUOTESzTUPLES FUNCTIONS CALLSzLISTS SUBSCRIPTS SLICINGS)rz**,rz...:@rr_r^`rr'[]rtypesRSTRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspectstrings4str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPESstring-methodsSTRINGS FORMATTING formatstringsr:encodings unicode SEQUENCES STRINGMETHODS FORMATTING TYPESnumbersINTEGER FLOAT COMPLEX TYPESintegers int rangefloating float math imaginary complex cmathtypesseq$STRINGMETHODS FORMATTING range LISTS DICTIONARIEStypesfunctions def TYPES typesmethodsclass def CLASSES TYPESbltin-code-objectscompile FUNCTIONS TYPESbltin-type-objects types TYPESTYPESbltin-null-objectbltin-ellipsis-objectSLICINGS specialattrs!class SPECIALMETHODS PRIVATENAMES typesmodulesoperator-summarylambda or and not in is BOOLEAN COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES LISTS DICTIONARIES EXPRESSIONSobjects specialnamesbBASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS MAPPINGMETHODS NUMBERMETHODS CLASSES customizationhash repr str SPECIALMETHODSattribute-accessATTRIBUTES SPECIALMETHODScallable-typesCALLS SPECIALMETHODSsequence-types(SEQUENCES SEQUENCEMETHODS SPECIALMETHODSMAPPINGS SPECIALMETHODS numeric-types*NUMBERS AUGMENTEDASSIGNMENT SPECIALMETHODS execmodel%NAMESPACES DYNAMICFEATURES EXCEPTIONSnaming3global nonlocal ASSIGNMENT DELETION DYNAMICFEATURESdynamic-features NAMESPACESrtry except finally raise conversions identifierskeywords SPECIALIDENTIFIERS id-classesatom-identifiers atom-literals=STRINGS NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALS SEQUENCES exprlistsTUPLES LITERALStypesseq-mutable LISTLITERALSlistsLISTS LITERALS typesmappingDICTIONARYLITERALSrDICTIONARIES LITERALSattribute-references(getattr hasattr setattr ATTRIBUTEMETHODS subscriptionsslicingscallspowerunarybinaryshiftingbitwise comparisonsEXPRESSIONS BASICMETHODSbooleansEXPRESSIONS TRUTHVALUE assignmentr augassign NUMBERMETHODScompoundfor while break continuetruth if while and or not BASICMETHODSdebuggerpdbcontext-managers)IrFrZ STRINGMETHODSZ FORMATTINGUNICODEZNUMBERSZINTEGERZFLOATr!rlZMAPPINGSryZMETHODSZ CODEOBJECTSZ TYPEOBJECTSZ FRAMEOBJECTSZ TRACEBACKSZNONEr#ZSPECIALATTRIBUTESrxrZPACKAGESrOrZ PRECEDENCEZOBJECTSZSPECIALMETHODSrZATTRIBUTEMETHODSZCALLABLEMETHODSrZMAPPINGMETHODSrZ EXECUTIONrcZDYNAMICFEATURESZSCOPINGZFRAMESrZ CONVERSIONSZ IDENTIFIERSZSPECIALIDENTIFIERSr$ZLITERALSZTUPLESZ TUPLELITERALSZLISTSrpr=rtZ ATTRIBUTESZ SUBSCRIPTSrIZCALLSr"rZBINARYZSHIFTINGr rrZ ASSERTIONZ ASSIGNMENTrZDELETIONZ RETURNINGZ IMPORTINGZ CONDITIONALZLOOPINGrZ DEBUGGINGZCONTEXTMANAGERSNcCs||_||_dS)N)_input_output)r>inputrrrrrz/szHelper.__init__cCs |jp tjS)N)rrr)r>rrrrr3szHelper.cCs |jp tjS)N)rrr)r>rrrrr4scCs2tjdddkr|dSd|jj|jjfS)Nrr0?rz<%s.%s instance>)rstackrr&r[)r>rrr__repr__6s zHelper.__repr__cCs6||jk r|j|n|j|j|jjddS)Na You are now leaving help and returning to the Python interpreter. If you want to ask for help on a particular object directly from the interpreter, you can type "help(object)". Executing "help('string')" has the same effect as typing a particular string at the help> prompt. )_GoInteractiverintrointeractrr)r>requestrrr__call__>s   zHelper.__call__c Cs|jjdxy|jd}|s PWnttfk r<PYnX|j}t|dkr|d|d kold knr|d|dd kr|dd}|jdkrP|d kr|jq|j |qWdS)Nrzhelp> rrrrrrquitrr)rrrr)rr) rrgetlinerEOFErrorrr rrr)r>rrrrrKs"  ,   zHelper.interactcCs8|jtjkrt|S|jj||jj|jjSdS)N)rrrrrrr)r>promptrrrr`s    zHelper.getlinecCs<t|tdkr|j}|dkr,|jn|dkr>|jn|dkrP|jn|dkrb|jn|dddkr|j|jdn||jkr|j|nj|dkrt t |d nR||j kr|j |n<||j kr|j |n&|rt |d |jd nt td |jd n$t|tr|nt |d |jd |jjddS)Nrkeywordssymbolstopicsrzmodules rrrrz Help on %s:)rr)rrr)rr listkeywords listsymbols listtopics listmodulesrr showsymbolr"evalr showtopicrrr6rrrr)r>rrrrris6        z Helper.helpcCs$|jjdjdtjdddS)Na Welcome to Python {0}'s help utility! If this is your first time using Python, you should definitely check out the tutorial on the Internet at https://docs.python.org/{0}/tutorial/. Enter the name of any module, keyword, or topic to get help on writing Python programs and using Python modules. To quit this help utility and return to the interpreter, just type "quit". To get a list of available modules, keywords, symbols, or topics, type "modules", "keywords", "symbols", or "topics". Each module also comes with a one-line summary of what it does; to list the modules whose name or summary contain a given string such as "spam", type "modules spam". z%d.%dr)rrr rr)r>rrrr~sz Helper.introrPc Cstt|}||}t||d|}xt|D]z}xht|D]\}|||}|t|kr@|jj||||dkr@|jjdd|dt||q@W|jjdq2WdS)Nrrr)r sortedr rrr) r>itemscolumnsrZcolwr rowr rlrrrr s    (z Helper.listcCs |jjd|j|jjdS)NzN Here is a list of the Python keywords. Enter any keyword to get more help. )rrr rrD)r>rrrrszHelper.listkeywordscCs |jjd|j|jjdS)Nzx Here is a list of the punctuation symbols which Python assigns special meaning to. Enter any symbol to get more help. )rrr rrD)r>rrrrszHelper.listsymbolscCs |jjd|j|jjdS)NzN Here is a list of available topics. Enter any topic name to get more help. )rrr rrD)r>rrrrszHelper.listtopicsc Cs,y ddl}Wn tk r,|jjddSX|jj||jj|}|s`|jjdt|dSt|tdkr||j ||S|\}}y|jj|}Wn(t k r|jjdt|dSX|j d}|r|pdd|}|r ddl }ddj |jd} |j| d } |d dj | 7}t|dS) Nrzt Sorry, topic and keyword documentation is not available because the module "pydoc_data.topics" could not be found. zno documentation found for %s rrrzRelated help topics: z, Hz %s )pydoc_data.topicsrrrrrorrrrKeyErrorrtextwrapr!rZwrapr) r>topic more_xrefs pydoc_datatargetlabelxrefsr"rr.Z wrapped_textrrrrs6    zHelper.showtopicc Csy ddl}Wntk r dSX|jj||jj|}|sDtdt|trZ|j||S|\}}|jj|}|r|pxdd|}||fS)Nrt Sorry, topic and keyword documentation is not available because the module "pydoc_data.topics" could not be found. rzcould not find topicr)rr) rrrrorrdrr6 _gettopic)r>rrrrrrr"rrrrs     zHelper._gettopiccCs*|j|}|jd\}}}|j||dS)Nr)r partitionr)r>symbolrrr_rrrrrs zHelper.showsymbolcsv|r |jjdj|t|nR|jjdi}|fddfdd}tj|d|j|j|jjddS) Nzy Here is a list of modules whose name or summary contains '{}'. If there are any, enter a module name to get more help. zI Please wait a moment while I gather a list of all available modules... cSs>|r$|dddkr$|ddd}|jddkr:d||<dS) N z .__init__z (package)rrrii)find)rr'r~rrrrcallbacksz$Helper.listmodules..callbackcsd|ddS)Nr)r')rrronerrorsz#Helper.listmodules..onerror)rz Enter any module name to get more help. Or, type "modules spam" to search for modules whose name or summary contain the string "spam". )rrr apropos ModuleScannerrunr rD)r>rGrrr)rrrs    zHelper.listmodules)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rry)rr)rr)rr)rry)rr)rr)rr)rr)rrrr)rrrr)rrUrrrrrrrrrrrrrr r r r r )rrr r r r r )rUr) rrrrrrrrrrrr)rrrrrr)rr)r+r,)r-r.)r/r0)r1r)r-r2)r3r4)r5r6)r7r8)r9r:)r;r<)r>r?)r@rA)rBrC)rDrE)rGr)rHrI)rJr)r+rK)rLr)rMrN)rPrF)rQrR)rSrT)rUrV)rWrX)rYrZ)rYr[)r\r])r^r_)r`ra)rbr)rrd)rer)rfrg)rhr)rir)rjrk)rmrn)rorp)rqrr)rsrt)rru)rvrw)rxr)ryr)rzrO)r{rO)r|rO)r}rO)r~rO)rrO)rr)rr)rr)rr)rr)rr)rr)rr)NN)rr)r)r)r)!r%r&r[rZ _strprefixesZ_symbols_inverserrrZsymbols_rrorrzrrrrrrrrrrrr rrrrrrrrrrrrs6              rc@seZdZdddZdS)rNcCs |r |j}d|_i}xztjD]p}|dkrd||<|dkrH|d|dqt|jpTd}|jdd}|d|}|jj|dkr|d||qWxdtj |dD]R\} }} |jrP|dkr|d|dqytj | |} Wnt k rwYnX| j } t | d rny| j|} Wn&tk r:|r4||wYnXttj| pNd}t | d rh| j|}nd}n^ytjj| }Wn&tk r|r||wYnX|jr|jjdnd}t|d d}|d|}|jj|dkr||||qW|r|dS) NF__main__rrrrz - )r get_source get_filenamerV)rrrrrrUrrr9r _get_specrrrcrrJrrStringIOrrrrrrr<)r>rrGZ completerrseenr'r(r~rCrDrrsourcerrrrrrs`       zModuleScanner.run)NNN)r%r&r[rrrrrrsrc CsDdd}dd}tj"tjdtj|||dWdQRXdS)NcSs6|dddkr |ddd}t||o.d|dS)Nrz .__init__z (package)z- ii)r)rr'r~rrrrOszapropos..callbackcSsdS)Nr)r'rrrrSszapropos..onerrorignore)r)warningscatch_warningsfilterwarningsrr)rGrrrrrrMs   rcsddlddlddlddlGdddjjGfdddjjGfdddj}|||}|jx|j r|j rt j dq~W|S) Nrc@seZdZddZddZdS)z!_start_server..DocHandlercSsX|jjdrd}nd}|jd|jdd||j|jj|j|j|jddS)Nz.cssztext/cssz text/htmlz Content-Typez%s; charset=UTF-8zutf-8) rrbZ send_responseZ send_headerZ end_headersZwfiler urlhandlerr)r> content_typerrrdo_GETs   z(_start_server..DocHandler.do_GETcWsdS)Nr)r>rrrr log_messagesz-_start_server..DocHandler.log_messageN)r%r&r[rrrrrr DocHandlersrcs(eZdZddZfddZddZdS)z _start_server..DocServercSs6d|_|j|f|_||_|jj||j|jd|_dS)NZ localhostF)hostZaddressrrIrzhandlerr)r>portrrrrrzs  z)_start_server..DocServer.__init__csBx4|js4j|jjgggd\}}}|r|jqW|jdS)Nr)rselectZsocketrZhandle_requestZ server_close)r>ZrdwrZex)rrrserve_until_quits  z1_start_server..DocServer.serve_until_quitcSs |jj||jr|j|dS)N)rIserver_activater)r>rrrrs z0_start_server..DocServer.server_activateN)r%r&r[rzrrr)rrr DocServers rcs:eZdZfddZfddZddZddZd S) z#_start_server..ServerThreadcs,||_t||_jj|d|_d|_dS)NF)rrrThreadrzservingerror)r>rr) threadingrrrzs   z,_start_server..ServerThread.__init__cstyFjj__jj_t|j_|j |j }||_ |j Wn(t k rn}z ||_WYdd}~XnXdS)N)server HTTPServerrIrrZMessageZ MessageClass staticmethodrrready docserverrrJr)r>Zdocsvre)rremailhttprrrs    z'_start_server..ServerThread.runcSs,d|_|j|_|j|_d|j|jf|_dS)NTz http://%s:%d/)rrZ server_portrr)r>rrrrrsz)_start_server..ServerThread.readycSs&d|j_|jd|_d|_d|_dS)NTF)rrr!rr)r>rrrstops z(_start_server..ServerThread.stopN)r%r&r[rzrrrr)rrrrrrr ServerThreads  rg{Gz?) Z http.serverZ email.messagerrrZBaseHTTPRequestHandlerrrr#rrtimeZsleep)rrrZthreadr)rrrrrrr _start_server[s8& r text/htmlc sGfdddt}|fddfddfddfd d fd d fd dfddfddfdd}|jdr|dd}|dkrtjjtjjt}tjj||}t|}dj|j SQRXn|dkr||St d||fdS)NcseZdZfddZdS)z_url_handler.._HTMLDoccsd}d|}d|||fS)Nzpydoc_data/_pydoc.cssz1a  Pydoc: %s %s%s
%s
r)r>rrcss_pathZcss_link) html_navbarrrrsz#_url_handler.._HTMLDoc.pageN)r%r&r[rr)rrr_HTMLDocsrcs>jdtjtjdtjf}d|jtjddfS)Nz %s [%s, %s]raZ
Python %s
%s
T)Zterse)rrZpython_versionZ python_buildZpython_compiler)r@)rrrr s  z!_url_handler..html_navbarcsdd}jddd}ddtjD}j||}|djd dd |g}i}x tjD]}|jj||qVW|jd d d j|fS)NcSs d||fS)Nz%sr)r(rrr bltinlink+ sz3_url_handler..html_index..bltinlinkz7Index of Modulesz#ffffffz#7799eecSsg|]}|dkr|qS)rr)rkr(rrrr1 sz4_url_handler..html_index..z

zBuilt-in Modulesz#ee77aaz|

pydoc by Ka-Ping Yee<ping@lfw.org>zIndex of Modulesr) rrrr rrr rnr!)rrnamesrrr)rrr html_index( s  z _url_handler..html_indexc sgfdd}tj*tjddd}tj|||dWdQRXdd}g}jd d d }x"D]\}}|j|||qhW|jd |d d dj|}d|fS)Ncs:|dddkr |ddd}j||o0d|fdS)Nrz .__init__z (package)z- ii)r )rr'r~) search_resultrrrF sz3_url_handler..html_search..callbackrcSsdS)Nr)r'rrrrM sz2_url_handler..html_search..onerror)rcSs d||fS)Nz%sr)r(rrrrR sz4_url_handler..html_search..bltinlinkz5Search Resultsz#ffffffz#7799eezkey = %sz#ee77aaz
zSearch Results) rrrrrrr rr!) rGrrrrhrr(r~r)r)rr html_searchA s    z!_url_handler..html_searchcsLdd}jddd}ttjj}j||}|jddd|}d|fS)NcSs d||fS)Nz%sr)r(rrrrb sz4_url_handler..html_topics..bltinlinkz,INDEXz#ffffffz#7799eeZTopicsz#ee77aa)rrrrrDr r)rrrr)rrr html_topics_ s z!_url_handler..html_topicscsLjddd}ttjj}dd}j||}|jddd|}d|fS)Nz,INDEXz#ffffffz#7799eecSs d||fS)Nz%sr)r(rrrrv sz6_url_handler..html_keywords..bltinlinkZKeywordsz#ee77aa)rrrrrDr r)rrrr)rrr html_keywordso s z#_url_handler..html_keywordscstj}t||}|j|\}}||jkr0d}nd}jd|dd}dj|}j|dd|}|rt|j }dd }j ||}j d dd|}d ||fd j |||ffS) NZKEYWORDZTOPICz)%sz#ffffffz#7799eez

%s
z#ee77aacSs d||fS)Nz%sr)r(rrrr sz7_url_handler..html_topicpage..bltinlinkzRelated help topics: z%s %sr) rrrrrrr&rrrr rr!)rZbufZhtmlhelprrrrr)rrrhtml_topicpage~ s&      z$_url_handler..html_topicpagecs@t|dd}|dkr$|dkr$tdt|}j||}||fS)Nr)rrzcould not find object)rrdrr)rr9rcontent)rrr html_getobj s   z!_url_handler..html_getobjcsPjddd}djfddtt||D}|j|dd|}d||fS) Nz,Errorz#ffffffz#7799eez
c3s|]}j|VqdS)N)r)rkr)rrrrl sz3_url_handler..html_error..z#bb0000z Error - %s)rr!rrr)rrrr)rrr html_error s z _url_handler..html_errorcst|}|jdr|dd }y|d kr4\}}n|dkrH\}}n|dkr\\}}nd|kr&|jd\}}}|dkr|\}}n|d kry|\}}Wn tk r|\}}YnXn\|d kr|dkr\}}n4y|\}}Wn"tk r|\}}YnXntd n |\}}Wn2tk rf}z||\}}WYdd}~XnXj||S)Nz.htmlrrnrrr`z search?keyz topic?keyzget?keyz bad pydoc url)rrn)rrn)rbrrdrJr)rZ complete_urlrropr_r)rrrrrrrrrr get_html_page s>         z#_url_handler..get_html_pagerrztext/cssrz text/htmlz"unknown content type %r for url %s) rrar rdirnamerealpathrVr!r readlinesrt)rrrrZ path_hererfpr) rrrrrrrrrr _url_handlers*         (    rT) open_browsercCsddl}tt|}|jr&t|jdS|jrd}|r@|j|jzy^td|jt|xD|jrtd}|j }|dkr|PqZ|dkr|j|jqZt|qZWWnt t fk rtYnXWd|jr|j tdXdS)Nrz"Server commands: [b]rowser, [q]uitzServer ready atzserver> rrzServer stopped) webbrowserrrrrrrrrrrrr)rrrZ serverthreadZserver_help_msgrrrrbrowse s2    rcCst|to|jtjdkS)Nr)rr6rr sep)rNrrrispath srcCsddl}Gdddt}dtjkrXtjjtjd}|tjkrJtjj|tjjddyp|jtjddd\}}d}d}d}d}xP|D]H\} } | d krd }d }| d krt | dS| d krd }| }| d krd }qW|r|dkrd}t ||ddS|s|x|D]} t | r4tjj |  r4t d| Py`t | rVtjj| rVt| } |rt | r~tjj| r~t| nt| n tj| Wn,tk r} zt | WYdd} ~ XnXqWWnN|j|fk rtjjtjjtjdd} t dj| tjdYnXdS)Nrc@s eZdZdS)zcli..BadUsageN)r%r&r[rrrrBadUsage sr rrrzbk:p:wFz-bTz-kz-pz-w)rzfile %r does not existapydoc - the Python documentation tool {cmd} ... Show text documentation on something. may be the name of a Python keyword, topic, function, module, or package, or a dotted reference to a class or function within a module or module in a package. If contains a '{sep}', it is used as the path to a Python source file to document. If name is 'keywords', 'topics', or 'modules', a listing of these things is displayed. {cmd} -k Search for a keyword in the synopsis lines of all available modules. {cmd} -p Start an HTTP server on the given port on the local machine. Port number 0 can be used to get an arbitrary unused port. {cmd} -b Start an HTTP server on an arbitrary unused port and open a Web browser to interactively browse documentation. The -p option can be used with the -b option to explicitly specify the server port. {cmd} -w ... Write out the HTML documentation for a module to a file in the current directory. If contains a '{sep}', it is treated as a filename; if it names a directory, documentation is written for all the contents. )rr)getoptrJrrr rargvremoveinsertrrrexistsrr{rr rrrrrrrr r)r r Z scriptdirZoptsrZwritingZ start_serverrroptvalargrHrrrrcli sd        $rr)NN)r)r)rrN)rrN)r)rN)r)r)Wr3rPrTrSrZZimportlib._bootstraprZimportlib._bootstrap_externalimportlib.machineryimportlib.utilrrr r9rrrrrZ urllib.parser4r collectionsrreprlibr tracebackrrrr$r)r-r/r3r IGNORECASEr4r5r:r?rCrOrerfrwr}rrrJrrrrrrrprqrrrrrrrrrrrr.rrrrr"rrrrrrrrrrrr%rrrr$s           ' 0>*- d" ,    = n%V fileinput.cpython-36.pyc000064400000031542152462730460011207 0ustar003 \8 @sdZddlZddlZddddddd d d d d dg Zdad!ddZddZddZddZddZ ddZ dd Z dd Z dd Z Gdd d Zdd Zd"ddZddZed kredS)#a Helper class to quickly write a loop over all standard input files. Typical use is: import fileinput for line in fileinput.input(): process(line) This iterates over the lines of all files listed in sys.argv[1:], defaulting to sys.stdin if the list is empty. If a filename is '-' it is also replaced by sys.stdin. To specify an alternative list of filenames, pass it as the argument to input(). A single file name is also allowed. Functions filename(), lineno() return the filename and cumulative line number of the line that has just been read; filelineno() returns its line number in the current file; isfirstline() returns true iff the line just read is the first line of its file; isstdin() returns true iff the line was read from sys.stdin. Function nextfile() closes the current file so that the next iteration will read the first line from the next file (if any); lines not read from the file will not count towards the cumulative line count; the filename is not changed until after the first line of the next file has been read. Function close() closes the sequence. Before any lines have been read, filename() returns None and both line numbers are zero; nextfile() has no effect. After all lines have been read, filename() and the line number functions return the values pertaining to the last line read; nextfile() has no effect. All files are opened in text mode by default, you can override this by setting the mode parameter to input() or FileInput.__init__(). If an I/O error occurs during opening or reading a file, the OSError exception is raised. If sys.stdin is used more than once, the second and further use will return no lines, except perhaps for interactive use, or if it has been explicitly reset (e.g. using sys.stdin.seek(0)). Empty files are opened and immediately closed; the only time their presence in the list of filenames is noticeable at all is when the last file opened is empty. It is possible that the last line of a file doesn't end in a newline character; otherwise lines are returned including the trailing newline. Class FileInput is the implementation; its methods filename(), lineno(), fileline(), isfirstline(), isstdin(), nextfile() and close() correspond to the functions in the module. In addition it has a readline() method which returns the next input line, and a __getitem__() method which implements the sequence behavior. The sequence must be accessed in strictly sequential order; sequence access and readline() cannot be mixed. Optional in-place filtering: if the keyword argument inplace=1 is passed to input() or to the FileInput constructor, the file is moved to a backup file and standard output is directed to the input file. This makes it possible to write a filter that rewrites its input file in place. If the keyword argument backup="." is also given, it specifies the extension for the backup file, and the backup file remains around; by default, the extension is ".bak" and it is deleted when the output file is closed. In-place filtering is disabled when standard input is read. XXX The current implementation does not work for MS-DOS 8+3 filesystems. XXX Possible additions: - optional getopt argument processing - isatty() - read(), read(size), even readlines() Ninputclosenextfilefilenamelineno filelinenofileno isfirstlineisstdin FileInputhook_compressed hook_encodedFrcCs(trtjrtdt||||||atS)aReturn an instance of the FileInput class, which can be iterated. The parameters are passed to the constructor of the FileInput class. The returned instance, in addition to being an iterator, keeps global state for the functions of this module,. zinput() already active)_state_file RuntimeErrorr )filesinplacebackupbufsizemodeopenhookr!/usr/lib64/python3.6/fileinput.pyrSs cCst}da|r|jdS)zClose the sequence.N)rr)staterrrrascCsts tdtjS)a Close the current file so that the next iteration will read the first line from the next file (if any); lines not read from the file will not count towards the cumulative line count. The filename is not changed until after the first line of the next file has been read. Before the first line has been read, this function has no effect; it cannot be used to skip the first file. After the last line of the last file has been read, this function has no effect. zno active input())rrrrrrrris cCsts tdtjS)zr Return the name of the file currently being read. Before the first line has been read, returns None. zno active input())rrrrrrrrwscCsts tdtjS)z Return the cumulative line number of the line that has just been read. Before the first line has been read, returns 0. After the last line of the last file has been read, returns the line number of that line. zno active input())rrrrrrrrscCsts tdtjS)z Return the line number in the current file. Before the first line has been read, returns 0. After the last line of the last file has been read, returns the line number of that line within the file. zno active input())rrrrrrrrscCsts tdtjS)zg Return the file number of the current file. When no file is currently opened, returns -1. zno active input())rrrrrrrrscCsts tdtjS)ze Returns true the line just read is the first line of its file, otherwise returns false. zno active input())rrr rrrrr scCsts tdtjS)z] Returns true if the last line was read from sys.stdin, otherwise returns false. zno active input())rrr rrrrr sc@seZdZdZd)ddZd d Zd d Zd dZddZddZ ddZ ddZ ddZ ddZ ddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(ZdS)*r a?FileInput([files[, inplace[, backup[, bufsize, [, mode[, openhook]]]]]]) Class FileInput is the implementation of the module; its methods filename(), lineno(), fileline(), isfirstline(), isstdin(), fileno(), nextfile() and close() correspond to the functions of the same name in the module. In addition it has a readline() method which returns the next input line, and a __getitem__() method which implements the sequence behavior. The sequence must be accessed in strictly sequential order; random access and readline() cannot be mixed. NFrrrcCst|tr|f}n(|dkr(tjdd}|s2d}nt|}||_||_||_|rhddl}|j dt ddd|_ d|_ d|_ d|_d|_d|_d|_d|_|dkrtd d |krddl}|j d t d||_|r|rtdt|std||_dS)N-rz!bufsize is deprecated and ignored) stacklevelFrrUUrbz=FileInput opening mode must be one of 'r', 'rU', 'U' and 'rb'z'U' mode is deprecatedz4FileInput cannot use an opening hook in inplace modez#FileInput openhook must be callable)r)rr r!r") isinstancestrsysargvtuple_files_inplace_backupwarningswarnDeprecationWarning _savestdout_output _filename _startlineno _filelinenor_isstdin_backupfilename ValueError_modecallable _openhook)selfrrrrrrr+rrr__init__sF  zFileInput.__init__cCs |jdS)N)r)r9rrr__del__szFileInput.__del__c Csz |jWdf|_XdS)N)rr()r9rrrrs zFileInput.closecCs|S)Nr)r9rrr __enter__szFileInput.__enter__cCs |jdS)N)r)r9typevalue tracebackrrr__exit__szFileInput.__exit__cCs|S)Nr)r9rrr__iter__szFileInput.__iter__cCs:x4|j}|r |jd7_|S|js*t|jqWdS)Nr) _readliner2r StopIterationr)r9linerrr__next__szFileInput.__next__c Cs>||jkrtdy|jStk r8tdYnXdS)Nzaccessing lines out of orderzend of input reached)rrrErC IndexError)r9irrr __getitem__s  zFileInput.__getitem__c%Cs|j}d|_|r|t_|j}d|_z|r0|jWd|j}d|_y|`Wntk r\YnXz|rt|j rt|jWd|j }d|_ |r|j ryt j |Wnt k rYnXd|_XXdS)NF)r.r%stdoutr/rrrBAttributeErrorr3r4r*osunlinkOSError)r9Z savestdoutoutputfileZbackupfilenamerrrr s4    zFileInput.nextfilecCs:x4|j}|r |jd7_|S|js*|S|jqWdS)Nr)rBr2rr)r9rDrrrreadline)szFileInput.readlinecCs|jsd|jkrdSdS|jd|_|jdd|_|j|_d|_d|_d|_d|_|jdkrd|_d|jkrt t j d t j |_nt j |_d |_nV|j r|j|j pd |_ytj|jWntk rYnXtj|j|jt|j|j|_ytj|jjj}Wn$tk r0t|jd |_Yn~XtjtjBtjB}ttd rZ|tjO}tj|j||}tj|d |_yttdrtj|j|Wntk rYnXt j|_|jt _n,|j r|j |j|j|_nt|j|j|_|jj!|_"|j"S)NbrrrFrzbufferTz.bakwO_BINARYchmod)#r(r6r0rr1r2rr3r4getattrr%stdinr)r*rKrLrMrenameopenfstatrst_moder/O_CREATO_WRONLYO_TRUNChasattrrUfdopenrVrIr.r8rPrB)r9ZpermrfdrrrrB4s\           zFileInput._readlinecCs|jS)N)r0)r9rrrrnszFileInput.filenamecCs |j|jS)N)r1r2)r9rrrrqszFileInput.linenocCs|jS)N)r2)r9rrrrtszFileInput.filelinenoc Cs0|jr(y |jjStk r$dSXndSdS)Nrrc)rrr5)r9rrrrws  zFileInput.filenocCs |jdkS)Nr)r2)r9rrrr szFileInput.isfirstlinecCs|jS)N)r3)r9rrrr szFileInput.isstdin)NFrrrN)__name__ __module__ __qualname____doc__r:r;rr<r@rArErHrrPrBrrrrr r rrrrr s&  )  : cCsVtjj|d}|dkr,ddl}|j||S|dkrHddl}|j||St||SdS)Nrz.gzrz.bz2)rKpathsplitextgziprZbz2ZBZ2File)rrZextrjrkrrrr s  csfdd}|S)Ncst||dS)N)encodingerrors)rZ)rr)rlrmrrrszhook_encoded..openhookr)rlrmrr)rlrmrr scCsddl}d}d}|jtjddd\}}x(|D] \}}|dkrDd}|dkr0|}q0Wxtt|||dD]b}|ddd kr|dd}|ddd kr|dd}td ttttrd pd |fqdWtdtttfdS)NrFrzib:z-iTz-b)rr  z%d: %s[%d]%s %s*rz %d: %s[%d]rcrcrcrc) getoptr%r&rprintrrrr )rqrrZoptsargsoarDrrr_tests"  rv__main__)NFrrrN)N)rgr%rK__all__rrrrrrrrr r r r r rvrdrrrrIs,         Y sre_parse.cpython-36.opt-2.pyc000064400000047451152462730460012141 0ustar003 \ @sddlTdZdZedZedZedZedZedZee e hZ ee e eeeehZeed feed feed feed feed feedfeedfeedfdZeefeefeefeeefgfeeefgfeeefgfeeefgfeeefgfeeefgfeefd Z e!e"e#e$e%e&e'e(dZ)e&e"Be(Be*Be'BZ+Gddde,Z-GdddZ.GdddZ/GdddZ0ddZ1ddZ2d d!Z3d"d#Z4d2d%d&Z5d'd(Z6d)d*Z7d3d,d-Z8d.d/Z9d0d1Z:d+S)4)*z .\[{()*+?^$|z*+?{ 0123456789Z01234567Z0123456789abcdefABCDEFZ4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZz      \)z\az\bz\fz\nz\rz\tz\vz\\) z\Az\bz\Bz\dz\Dz\sz\Sz\wz\Wz\Z)iLmsxatuc@s eZdZdS)VerboseN)__name__ __module__ __qualname__rr!/usr/lib64/python3.6/sre_parse.pyrGsrc@sBeZdZddZeddZdddZdd Zd d Zd d Z dS)PatterncCsd|_i|_dg|_d|_dS)Nr)flags groupdict groupwidthslookbehindgroups)selfrrr__init__LszPattern.__init__cCs t|jS)N)lenr)rrrrgroupsQszPattern.groupsNcCsb|j}|jjd|jtkr$td|dk r^|jj|d}|dk rTtd|||f||j|<|S)Nztoo many groupsz7redefinition of group name %r as group %d; was group %d)r"rappend MAXGROUPSerrorrget)rnamegidogidrrr opengroupTs   zPattern.opengroupcCs|j|j|<dS)N)getwidthr)rr(prrr closegroup`szPattern.closegroupcCs||jko|j|dk S)N)r"r)rr(rrr checkgroupbszPattern.checkgroupcCs6|jdk r2|j|s|jd||jkr2|jddS)Nzcannot refer to an open groupz?cannot refer to group defined in the same lookbehind subpattern)rr.r%)rr(sourcerrrchecklookbehindgroupes     zPattern.checklookbehindgroup)N) rrrr propertyr"r*r-r.r0rrrrrJs   rc@s`eZdZdddZdddZddZd d Zd d Zd dZddZ ddZ ddZ ddZ dS) SubPatternNcCs"||_|dkrg}||_d|_dS)N)patterndatawidth)rr3r4rrrr os zSubPattern.__init__rc Csd}ttf}x|jD]\}}t|dt|dd|tkrttx*|D]"\}}t|ddt||qLWq|tkrtx:t|dD]*\}}|rt|dd|j|dqWq|t kr|\}} } td|| j|d| rt|dd| j|dqt ||rd}x\|D]T}t |t rX|sDt|j|dd}n"|sjtd ddt|ddd}q(W|stqtd|qWdS) NTz )endORELSEF ) tuplelistr4printstrINBRANCH enumeratedumpGROUPREF_EXISTS isinstancer2) rlevelnlseqtypesopavrr condgroupitem_yesitem_norrrrCusH          zSubPattern.dumpcCs t|jS)N)reprr4)rrrr__repr__szSubPattern.__repr__cCs t|jS)N)r!r4)rrrr__len__szSubPattern.__len__cCs |j|=dS)N)r4)rindexrrr __delitem__szSubPattern.__delitem__cCs&t|trt|j|j|S|j|S)N)rEslicer2r3r4)rrQrrr __getitem__s zSubPattern.__getitem__cCs||j|<dS)N)r4)rrQcoderrr __setitem__szSubPattern.__setitem__cCs|jj||dS)N)r4insert)rrQrUrrrrWszSubPattern.insertcCs|jj|dS)N)r4r#)rrUrrrr#szSubPattern.appendc Cs|jdk r|jSd}}x|jD]\}}|tkrtd}d}x0|dD]$}|j\}}t||}t||}qJW||}||}q"|tkr|j\}}||}||}q"|tkr|dj\}}||}||}q"|t kr|dj\}}|||d}|||d}q"|t kr,|d}|d}q"|t krX|j j |\}}||}||}q"|tkr|dj\}}|ddk r|dj\}}t||}t||}nd}||}||}q"|tkr"Pq"Wt|tdt|tf|_|jS)Nrr8)r5r4rA MAXREPEATr+minmaxCALL SUBPATTERN _REPEATCODES _UNITCODESGROUPREFr3rrDSUCCESS) rlohirIrJr jlhrrrr+sZ                zSubPattern.getwidth)N)r) rrrr rCrOrPrRrTrVrWr#r+rrrrr2ms  (r2c@sbeZdZddZddZddZddZd d Zd d Ze d dZ ddZ ddZ dddZ dS) TokenizercCs@t|t|_||_|js"t|d}||_d|_d|_|jdS)Nlatin1r)rEr?istextstringdecoded_stringrQnext_Tokenizer__next)rrkrrrr s  zTokenizer.__init__cCs|j}y|j|}Wntk r.d|_dSX|dkr|d7}y||j|7}Wn.tk rtd|jt|jddYnX|d|_||_dS)Nr r8zbad escape (end of pattern))rQrl IndexErrorrmr%rkr!)rrQcharrrr__nexts zTokenizer.__nextcCs||jkr|jdSdS)NTF)rmrn)rrprrrmatchs zTokenizer.matchcCs|j}|j|S)N)rmrn)rthisrrrr&sz Tokenizer.getcCs:d}x0t|D]$}|j}||kr"P||7}|jqW|S)Nr6)rangermrn)rncharsetresult_crrrgetwhiles zTokenizer.getwhilecCshd}x^|j}|j|dkr>|s*|jd|jd|t|||krX|sV|jddP||7}qW|S)Nr6zmissing group namezmissing %s, unterminated namer8)rmrnr%r!)r terminatorrwryrrrgetuntil s     zTokenizer.getuntilcCs|jt|jpdS)Nr6)rQr!rm)rrrrpossz Tokenizer.poscCs|jt|jpdS)Nr6)rQr!rm)rrrrtellszTokenizer.tellcCs||_|jdS)N)rQrn)rrQrrrseekszTokenizer.seekrcCst||j|j|S)N)r%rkr~)rmsgoffsetrrrr%#szTokenizer.errorN)r)rrrr rnrrr&rzr|r1r}r~rr%rrrrrhs   rhc Cstj|}|r|Stj|}|r0|dtkr0|Sy|dd}|dkr||jdt7}t|dkrx|jd|t|tt |dddfS|dkr|j r||jdt7}t|d kr|jd|t|tt |dddfS|d ko|j rF||jd t7}t|d kr$|jd|t|t |ddd}t |t|fS|t kr||jdt 7}t |ddd }|d kr|jd|t|t|fS|t krtt|dkr|tkr|jd|t|tt|dfSWntk rYnX|jd|t|dS)Nrr8rXrzincomplete escape %srU z.octal escape value %s outside of range 0-0o377z bad escape %s)ESCAPESr& CATEGORIESr@rz HEXDIGITSr!r%LITERALintrjchr OCTDIGITSDIGITS ValueError ASCIILETTERSord)r/escaperUryrrr _class_escape&sR         rc Cstj|}|r|Stj|}|r$|Syt|dd}|dkr||jdt7}t|dkrl|jd|t|tt|dddfS|dkr|j r||jdt7}t|dkr|jd|t|tt|dddfS|d ko|j r:||jd t7}t|d kr|jd|t|t|ddd}t |t|fS|d krj||jdt 7}tt|ddd fS|t kr\|j t kr||j7}|dt kr|dt kr|j t kr||j7}t|ddd }|d kr|jd|t|t|fSt|dd}||jkrD|j|s0|jdt||j||t|fS|jd|t|dt|dkr|tkr|jd|t|tt|dfSWntk rYnX|jd|t|dS)Nr8rXrrzincomplete escape %srrrrrr0rz.octal escape value %s outside of range 0-0o377zcannot refer to an open groupzinvalid group reference %dz bad escape %s)rr&rrzrr!r%rrrjrrrrmr"r.r0rarrr)r/rstaterUrygrouprrr_escapeVsn                  rc Cs$g}|j}|j}|j}x.|t||||d| o4| |dsPqWt|dkr\|dSt|}|j} x\d} xP|D]*} | sP| dkr| d} qv| d| krvPqvWx|D] } | d=qW| | qlPqlWxD|D]"} t| dks| ddtk rPqW| tdd|Df|S|jtd|ff|S)Nr8|rcSsg|] }|dqS)rr).0itemrrr sz_parse_sub..) r#rrr~_parser!r2rr@rA) r/rverbosenesteditems itemsappend sourcematchstart subpatternsubpatternappendprefixrrrr _parse_subsD       rcCsht||||d}|jdrDt||||d}|jdkrH|jdnd}t|}|jt|||ff|S)Nr8rz/conditional backref with more than two branches)rrrrmr%r2r#rD)r/rrKrrrLrMrrrr_parse_sub_conds   rFc)Cs t|}|j}|j}|j}t} t} x|j} | dkr6P| dkr@P||r|| tkrTq&| dkr|x|} | dkst| dkr^Pq^Wq&| ddkrt|| |} || q&| t kr|t | | fq&| dkr4|j d} g}|j}|dr|t df|dd}x|} | dkr |j d |j | | d kr8||kr8Pn&| ddkrRt|| }n t | | f}|d r|}|dkr|j d |j | |d kr|dtkr|dd}|||t | d fP|ddkrt||}n t | |f}|dt ks |dt kr4d | |f}|j |t| dt||d}|d}||krvd | |f}|j |t| dt||t||ffn"|dtkr|dd}||qW| |dkr|ddt kr||dnT| |d kr&|ddt kr&|ddt kr&|t|ddfn |t|fq&| tkrb|j } | dkr\d7\}}nJ| dkrtdt}}n2| dkrdt}}n| dkr|jdkr|t | | fq&dt}}d}}x|jtkr||7}qW|drx"|jtkr ||7}qWn|}|ds8|t | | f|j| q&|rXt|}|tkrXtd|rt|}|tkrxtd||kr|j d|j | ntd|f|r|d8d}nd}| s| |dkr|ddtkr|j d|j | t| |ddtkr0|j d|j | t| |drNt|||ff|d9<nt|||ff|d:<q&| dkrz|tdfq&| dk r|j d}d}d}d}d}d}|d r|}|dkr|j d|dkr|dr|jd }|jsd!|}|j |t|dn|d"r|jd#}|jsHd!|}|j |t|d|j j|} | dkrzd$|}|j |t|d|j!| s|j d%t|d|j"| ||t#| fq&n2|}|dkr|j d|j d&|t|d n|d'krd}n|dkrDx4|jdkr*|j d(|j ||d#kr Pq Wq&n|d)kr0d}!|dkr|}|dkrv|j d|d*kr|j d+|t|d d;}!|j$}"|"dkr|j%|_$t&||||d}#|!dkr|"dkrd|_$|d#s|j d,|j ||d"kr|t'|!|#ffq&|t(|!|#ffq&n|dk r$|jd#}$d}|$jr|j j|$}|dk rd$|$}|j |t|$dnyt|$}|dkrt)Wn4t)k rd!|$}|j |t|$ddYnX|s|j d-t|$d|t*k rd.|}|j |t|$d|j"||n|t+k s8|d k rt,|||}%|%dk r| s\| rddl-}&|&j.d/|j/dd0t|j/d0k rd1ndft0|d2d3|j1t2@r&| r&t3q&|%\}}d}n|j d4|t|d|dk r0y|j4|}Wn<t k r.}'z|j |'j5t|ddWYdd}'~'XnX| rLt6|||||d}#n,| s\|t2@ od|t2@ }(t&|||(|d}#|jd# s|j d,|j ||dk r|j7||#|t8||||#ffq&| dk r|tt9fq&| d5k r|jtt:fq&td6|fq&W|S)zbad character in group name %r=)zunknown group name %rzcannot refer to an open groupzunknown extension ?P:zmissing ), unterminated commentz=!|t@rtd|t@s,|tO}qf|t@rftdn(|t@rNtd|t@rf|t@rftd|S)Nz)cannot use LOCALE flag with a str patternz(ASCII and UNICODE flags are incompatiblez,cannot use UNICODE flag with a bytes patternz'ASCII and LOCALE flags are incompatible)rEr?SRE_FLAG_LOCALErSRE_FLAG_ASCIISRE_FLAG_UNICODE)srcrrrr fix_flags<s   rNc Cst|}|dkrt}||_||_yt|||t@d}WnBtk rzt}|tB|_||_|jdt||dd}YnXt||j j|j _|j dk r|j d|t @r|j |S)NrTzunbalanced parenthesis)rhrrr?rrrrrr3rmr%SRE_FLAG_DEBUGrC)r?rr3r/r,rrrparseLs&    rc st|j}gggj}fdd}j}x|}|dkrNP|ddkr|d}|dkrJd}jdsjd jd }|jry ||} Wn tk rt d |YnXnlyt |} | dkrt Wn0t k rjd |t |ddYnX| t kr4jd | t |d|| t |dq|dkrjtkr||7}jtkr||7}|tt |dddd@q|tkrZd} jtkr4||7}|tkr4|dtkr4jtkr4||7}d} t |ddd}|dkr(jd|t ||t|| s|t |ddt |dnZytt|d}Wn<tk r|tkrddl} | jd|tddYnX||q>||q>Wr؈jdjt|tsddDfS)NcsX|jkrjd||r8jdjdd=jt|fjddS)Nzinvalid group reference %dr6)r"r%r#joinr!)rQr})r"literalliteralsr3rrraddgroupus  z parse_template..addgrouprr r8gr6rz missing .)rhr&r# groupindexrrr%r|rKeyErrorrorrr!r$rmrrrrrrrrrrEr?) r/r3sgetlappendrrrsryr'rQisoctalrr)r"rrr3rrparse_templatels             "             rc Csz|j}|jdd}|\}}|dd}y&x |D]\}}||pB|||<q0WWn tk rntd|YnX|j|S)Nrzinvalid group reference %d)rrkror%r)templaterrremptyr"rrQrrrrexpand_templates r)F)rN); sre_constantsrr frozensetrrrrrrrr_rrr@rrCATEGORYr`rrrZAT_BEGINNING_STRINGZ AT_BOUNDARYZAT_NON_BOUNDARYZCATEGORY_DIGITZCATEGORY_NOT_DIGITZCATEGORY_SPACEZCATEGORY_NOT_SPACEZ CATEGORY_WORDZCATEGORY_NOT_WORDZ AT_END_STRINGrSRE_FLAG_IGNORECASErSRE_FLAG_MULTILINESRE_FLAG_DOTALLrrSRE_FLAG_TEMPLATErrrr Exceptionrrr2rhrrrrrrrrrrrrrrsh               #qH0A3 <, Wstringprep.cpython-36.opt-2.pyc000064400000023032152462730460012340 0ustar003 \u2@sddlmZddZedddddd d d d d dg eeddZddZdddddddddddddd d!d"d#d$d%d&dd'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d3d4d5d6d7d8d9d:d;dd?d@dAdBd;dd?d@dAdBdCdDdEdFdGdHdIdJdCdDdEdFdGdHdIdJdKdLdMdNdOdLddPdQdRdSdTdQdUddVdWdXddYdZd[d\d]d^d_d`d]dadbdcdddedfdfdfdgdgdhdidjdkdldmdmdmdndodpdqdqdrdbdsdtdudvd$dwdxdydzd{d|d}d~ddddddddddddd{ddddddddddddddddddddddddddddddddddddddddddddrdbdwdsdtddfdgdddhdudiddkdldmddddddddqddrdbdwdsdtddfdgdddhdudiddkdldmddddddddqddrdbdwdsdtddfdgdddhdudiddkdldmddddddddqddbdwddddiddkdlddddddddqddrdbdwdsdtddfdgdddhdudiddkdldmddddddddqddrdwdsdtddddhdudiddkdldddddddddrdwdsdtddgdddhduddddddddddrdbdwdsdtddfdgdddhdudiddkdldmddddddddqddrdbdwdsdtddfdgdddhdudiddkdldmddddddddqddrdbdwdsdtddfdgdddhdudiddkdldmddddddddqddrdbdwdsdtddfdgdddhdudiddkdldmddddddddqddrdbdwdsdtddfdgdddhdudiddkdldmddddddddqddrdbdwdsdtddfdgdddhdudiddkdldmddddddddqdddvdd'ddddd%dddddd$d&dddd d#dddddddvdd'ddddd%dddddd$d&dddd d#dddddddvdd'ddddd%dddddd$d&dddd d#dddddddvdd'ddddd%dddddd$d&dddd d#dddddddvdd'ddddd%dddddd$d&dddd d#dddddɐZdd˄Z dd̈́Z ddτZ ddфZ ddӄZ ddՄZedddd d dddgeed dۃeedd݃eedd߃eeddZddZddZddZddZddZeeddZddZeeddZddZeddddgeeddeedd݃ZddZedgeeddZddZddZddZdS() ucd_3_2_0cCsBtj|dkrdSt|}d|ko,dknr6dS|d@dkS)NZCnFii)rr) unicodedatacategoryord)codecr "/usr/lib64/python3.6/stringprep.py in_table_a1 s r iOii i i i i i i` iiicCs t|tkS)N)rb1_set)rr r r in_table_b1sruμZssui̇uʼnsuǰuιu ιuΐuΰuσuβuθuυuύuϋuφuπuκuρuεuեւuẖuẗuẘuẙuaʾuṡuὐuὒuὔuὖuἀιuἁιuἂιuἃιuἄιuἅιuἆιuἇιuἠιuἡιuἢιuἣιuἤιuἥιuἦιuἧιuὠιuὡιuὢιuὣιuὤιuὥιuὦιuὧιuὰιuαιuάιuᾶuᾶιuὴιuηιuήιuῆuῆιuῒuῖuῗuῢuῤuῦuῧuὼιuωιuώιuῶuῶιZrsr u°cuɛu°fhilnnopqrZsmZtelZtmzbefmuγdZhpaZauZovZpaZnauμaZmaZkaZkbZmbZgbZpfZnfuμfhzZkhzZmhzZghzZthzZkpaZmpaZgpaZpvZnvuμvZmvZkvZpwZnwuμwZmwkwukωumωZbquc∕kgzco.ZdbZgyZhpZkkZkmZphZppmZprZsvwbZffZfiZflZffiZfflstuմնuմեuմիuվնuմխagjkotuvwxyuαuδuζuηuλuνuξuοuτuχuψuω(i0iIiiiEiziiiiiiiiiiiiiiiiiiiiiiPiRiTiViiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i!i!i!i !i !i !i !i!i!i!i!i!i!i!i!i!i!i !i!!i"!i$!i(!i,!i-!i0!i1!i3!i>!i?!iE!iq3is3iu3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3i3iiiiiiiiiiiiiiiiiiiiii i i i i iiiiiiiiiiiii4i5i6i7i8i9i:i;i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMihiiijikiliminioipiqirisitiuiviwixiyizi{i|i}i~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i i iiiiiiiiiiiiiii8i9i;i<i=i>i@iAiBiCiDiFiJiKiLiMiNiOiPiliminioipiqirisitiuiviwixiyizi{i|i}i~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii i i i i iiiiiiiiiiiiiiiiiii i!i<i=i>i?i@iAiBiCiDiEiFiGiHiIiJiKiLiMiNiOiPiQiRiSiTiUipiqirisitiuiviwixiyizi{i|i}i~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4iGiViWiXiYiZi[i\i]i^i_i`iaibicidieifigihiiijikiliminiiiiiiiiiiiiiiiiiiiiiiiiiiicCs"tjt|}|dk r|S|jS)N) b3_exceptionsgetrlower)rrr r r map_table_b3sr3cCsHt|}tjd|}djdd|D}tjd|}||kr@|S|SdS)NZNFKCcSsg|] }t|qSr )r3).0Zchr r r sz map_table_b2..)r3rZ normalizejoin)r#ZalrZblr r r r map_table_b2s  r8cCs|dkS)N r )rr r r in_table_c11sr:cCstj|dko|dkS)NZsr9)rr)rr r r in_table_c12sr<cCstj|dkS)Nr;)rr)rr r r in_table_c11_c12sr=cCst|dkotj|dkS)NCc)rrr)rr r r in_table_c21sr@iiii( i) id ij ip iiisi{cCs.t|}|dkrdStj|dkr&dS|tkS)Nr>Fr?T)rrr c22_specials)rr r r r in_table_c22s rBcCstj|dkpt|tkS)Nr?)rrrrA)rr r r in_table_c21_c22srCcCstj|dkS)NZCo)rr)rr r r in_table_c3srDcCs0t|}|dkrdS|dkr dSt|d@dkS)NiFiT)rFrE)r)rr r r r in_table_c4s rGcCstj|dkS)NZCs)rr)rr r r in_table_c5srHicCs t|tkS)N)rc6_set)rr r r in_table_c6srJi/i/cCs t|tkS)N)rc7_set)rr r r in_table_c7srLi@iAi i i* i/ cCs t|tkS)N)rc8_set)rr r r in_table_c8srNii icCs t|tkS)N)rc9_set)rr r r in_table_c9srPcCstj|dkS)NRAL)rQrR)r bidirectional)rr r r in_table_d1 srTcCstj|dkS)NL)rrS)rr r r in_table_d2srVN)rrr setlistrangerrr0r3r8r:r<r=r@rArBrCrDrGrHrIrJrKrLrMrNrOrPrTrVr r r r sx ,  P, typing.cpython-36.opt-1.pyc000064400000216304152462730460011462 0ustar003 \9D@s ddlZddlmZmZddlZddlZddlZddlZddlZddl Z yddl jZ Wne k rrddlZ YnXej dddkrddlZyddl mZmZmZWn4e k reejZeejZeejZYnXddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:g4Zd;d<Zd=d>ZGd?d@d@eZGdAdBdBedCdDZGdEdFdFedCdGZGdHdIdIedCdGZGdJdKdKedCdGZdLdMZ dNdOZ!dPdQZ"dRdSZ#dTdUZ$GdVdWdWedCdGZ%e%dCdGZ&GdXdYdYedCdGZ'e'dCdGZ(GdZddedCdGZ)e)d[Z*e)d\Z+e)d]Z,e)d^dCd_Z-e)d`dCd_Z.e)dadCd_Z/e)dbdCdcZ0e)d2e1eZ2dddeZ3ddfdgZ4dhdiZ5djdkZ6gZ7dldmZ8GdndodoedCdGZ9e9dCdGZ:GdpdqdqedCdGZ;e;dCdGZdvdwZ?Gdxddeej@ZAdZBdydzZCGd{d d eAd|ZBGd}d~d~ZDGdddZEGdddeAZFGdd d eGeGeFdZHGdddeAZIGddde jJeIdZJGdddedCdGZKeKdCdGZLdd3ZMddZNe jOe jPe jQe jReeefZSddd4ZTdd6ZUdd7ZVddZWdd8ZXGdddeAZYGdddeYd|ZZe j[Z[e\e drjGdddeBe-e j]dZ]ej^de\e drGddde]e.eBe-e0e.fe j_dZ_ej^de\e drGdddeBe-e j`dZ`Gddde`e-e jadZaej^dej^dGdddeBe-e jbdZbGdddebe-e jcdZcGdd'd'eZZdGdd&d&eZZeGdd%d%eZZfGdd$d$eZZgGdd#d#eZe-ZhGdd(d(eZe-Zie\e d"rGdd"d"ebe-e jjdZjnGdd"d"eZe-Zje jkZkGdddeBe-e jldZle\e dr*Gdddekebe-ele-e jmdZmej^de\e drRGdddeme-e jndZon"Gdddekebe-ele-e jndZoGdddeoe*e jpdZpe\e drGdddeme+eBe+e/fe jqdZqn,Gdddekebe+ele+eBe+e/fe jqdZqGdddeqe+e,fe jrdZre\e d"rhe\e drDGdddeje-eme-e jsdZsn"Gdddekeje-ele-e jsdZsn"Gdddekebe-ele-e jsdZsGdddese*e jtdZtGdddeseue jvdZvGdd-d-ewete*ewdZxGdd*d*ejyete*ejydZzGdd.d.e{epe*e{dZnGdd/d/e|eoe-e|dZ}Gdddekebe-e j~dZ~Gddde~e+eoe+e jdZGddde~eHe+e/feoeHe+e/feBe+e/fe jdZGdd!d!e~e/e jdZe\edrGdddeBe-ejdZnGdddeBe-Ze\edà r(GddńdeBe-ejdZej^dŃnej dddk rDedǃGdd+d+eere+e,fedZGdd,d,ejere+e,fejdZGdd)d)ejee*eufejdZe\ed˃ rej^d˃Gdd˄dejere+e,fejdZe\e d1 re jZne jZGdd1d1ece-eBe-e0e.fedZe\e d΃ rVGdd΄deae-eBe-e0fe jdZej^d΃e)ddCedэZGdd d eBeedZddԄZej dddkZdZdZGdddeZGdd0d0ed|Zdd5ZeZdZGdddeBe2ZGdddee1ZGdddeeZGdddZede_eejej<ede2eejdddZede2eejddddZGdddZede_eejej<dS(N)abstractmethodabstractproperty)WrapperDescriptorTypeMethodWrapperTypeMethodDescriptorTypeAnyCallableClassVarGenericOptionalTupleTypeTypeVarUnion AbstractSet GenericMeta ByteString ContainerContextManagerHashable ItemsViewIterableIteratorKeysViewMapping MappingViewMutableMappingMutableSequence MutableSetSequenceSized ValuesView Reversible SupportsAbs SupportsBytesSupportsComplex SupportsFloat SupportsInt SupportsRoundCounterDequeDict DefaultDictListSet FrozenSet NamedTuple GeneratorAnyStrcastget_type_hintsNewType no_type_checkno_type_check_decoratoroverloadText TYPE_CHECKINGcCs"tjdddkr|jS|jSdS)Nrr)rr)sys version_info __qualname____name__)xrC/usr/lib64/python3.6/typing.py _qualnamegsrEcCs&d}|jdr"||kr"|dd}|S)N _TypeAlias _ForwardRef _TypingBase_FinalTypingBase_)rFrGrHrI) startswith)ZnmZ whitelistrCrCrD _trim_nameos rMcsJeZdZdZdZddfdd ZddZdd Zd d Zd d Z Z S) TypingMetaaMetaclass for most types defined in typing module (not a part of public API). This overrides __new__() to require an extra keyword parameter '_root', which serves as a guard against naive subclassing of the typing classes. Any legitimate class defined using a metaclass derived from TypingMeta must pass _root=True. This also defines a dummy constructor (all the work for most typing constructs is done in __new__) and a nicer repr(). F)_rootcs2|s tddjtt|pdtj||||S)NzCannot subclass %sz, z()) TypeErrorjoinmap _type_reprsuper__new__)clsnamebases namespacerO) __class__rCrDrUszTypingMeta.__new__cOsdS)NrC)selfargskwdsrCrCrD__init__szTypingMeta.__init__cCs|S)a'Override this in subclasses to interpret forward references. For example, List['C'] is internally stored as List[_ForwardRef('C')], which should evaluate to List[C], where C is an object found in globalns or localns (searching localns first, of course). rC)r[globalnslocalnsrCrCrD _eval_typeszTypingMeta._eval_typecCsdS)NrC)r[tvarsrCrCrD_get_type_varsszTypingMeta._get_type_varscCstt|}d|j|fS)Nz%s.%s)rMrE __module__)r[qnamerCrCrD__repr__s zTypingMeta.__repr__) rArdr@__doc__ _is_protocolrUr^rarcrf __classcell__rCrC)rZrDrNvs  rNcsLeZdZdZdZddZfddZddZd d Zd d Z d dZ Z S)rHz0Internal indicator of special typing constructs. __weakref__cOsdS)NrC)r[r\r]rCrCrDr^sz_TypingBase.__init__cs@t|dkr4t|dtr4t|dtr4td|tj|S)zConstructor. This only exists to give a better error message in case someone tries to subclass a special typing object (not a good idea). rrrKzCannot subclass %r)len isinstancestrtuplerPrTrU)rVr\r])rZrCrDrUs   z_TypingBase.__new__cCs|S)NrC)r[r_r`rCrCrDrasz_TypingBase._eval_typecCsdS)NrC)r[rbrCrCrDrcsz_TypingBase._get_type_varscCs"t|}tt|}d|j|fS)Nz%s.%s)typerMrErd)r[rVrerCrCrDrfs z_TypingBase.__repr__cOstdt|dS)NzCannot instantiate %r)rPro)r[r\r]rCrCrD__call__sz_TypingBase.__call__)rj) rArdr@rg __slots__r^rUrarcrfrprirCrC)rZrDrHs rHT) metaclassrOcs2eZdZdZfZddfdd ZddZZS)rIzInternal mix-in class to prevent instantiation. Prevents instantiation unless _root=True is given in class call. It is used to create pseudo-singleton instances Any, Union, Optional, etc. F)rOcs0tj|f||}|dkr |Std|dS)NTzCannot instantiate %r)rTrUrP)rVrOr\r]r[)rZrCrDrUsz_FinalTypingBase.__new__cCstt|jS)N)rMrorA)r[rCrCrD __reduce__sz_FinalTypingBase.__reduce__)rArdr@rgrqrUrsrirCrC)rZrDrIsrI)rOcsTeZdZdZdZfddZdd Zd d Zd d ZddZ ddZ ddZ Z S)rGz-Internal wrapper to hold a forward reference.__forward_arg____forward_code____forward_evaluated____forward_value__c sttj|t|ts$td|fyt|dd}Wn"tk rVtd|fYnX||_||_d|_ d|_ dS)Nz,Forward reference must be a string -- got %rzevalz1Forward reference must be an expression -- got %rF) rTr^rlrmrPcompile SyntaxErrorrtrurvrw)r[argcode)rZrCrDr^s  z_ForwardRef.__init__cCsf|j s||k r`|dkr*|dkr*i}}n|dkr8|}n |dkrD|}tt|j||d|_d|_|jS)Nz*Forward references must evaluate to types.T)rv _type_checkrxrurw)r[r_r`rCrCrDras  z_ForwardRef._eval_typecCs&t|tstS|j|jko$|j|jkS)N)rlrGNotImplementedrtrw)r[otherrCrCrD__eq__s  z_ForwardRef.__eq__cCst|j|jfS)N)hashrtrw)r[rCrCrD__hash__sz_ForwardRef.__hash__cCs tddS)Nz4Forward references cannot be used with isinstance().)rP)r[objrCrCrD__instancecheck__sz_ForwardRef.__instancecheck__cCs tddS)Nz4Forward references cannot be used with issubclass().)rP)r[rVrCrCrD__subclasscheck__sz_ForwardRef.__subclasscheck__cCs d|jfS)Nz_ForwardRef(%r))rt)r[rCrCrDrf sz_ForwardRef.__repr__)rtrurvrw) rArdr@rgrqr^rarrrrrfrirCrC)rZrDrGs rGc@sLeZdZdZdZddZdd Zd d Zd d ZddZ ddZ ddZ dS)rFa:Internal helper class for defining generic variants of concrete types. Note that this is not a type; let's call it a pseudo-type. It cannot be used in instance and subclass checks in parameterized form, i.e. ``isinstance(42, Match[str])`` raises ``TypeError`` instead of returning ``False``. rWtype_var impl_type type_checkercCs||_||_||_||_dS)atInitializer. Args: name: The name, e.g. 'Pattern'. type_var: The type parameter, e.g. AnyStr, or the specific type, e.g. str. impl_type: The implementation type. type_checker: Function that takes an impl_type instance. and returns a value that should be a type_var instance. N)rWrrr)r[rWrrrrCrCrDr^sz_TypeAlias.__init__cCsd|jt|jfS)Nz%s[%s])rWrSr)r[rCrCrDrf,sz_TypeAlias.__repr__cCst|jtstd||jjrJt|trJt||jjsJtd||jft|trj||jk rjtd||j|j||j |j S)Nz#%s cannot be further parameterized.z&%s is not a valid substitution for %s.z%s cannot be re-parameterized.) rlrrrP__constraints__ro issubclassrZrWrr)r[Z parameterrCrCrD __getitem__/s    z_TypeAlias.__getitem__cCs&t|tstS|j|jko$|j|jkS)N)rlrFr~rWr)r[rrCrCrDr;s z_TypeAlias.__eq__cCst|j|jfS)N)rrWr)r[rCrCrDr@sz_TypeAlias.__hash__cCs t|jtstdt||jS)Nz NoReturn: raise Exception('no way') This type is invalid in other positions, e.g., ``List[NoReturn]`` will fail in static type checkers. cCs tddS)Nz*NoReturn cannot be used with isinstance().)rP)r[rrCrCrDrsz_NoReturn.__instancecheck__cCs tddS)Nz*NoReturn cannot be used with issubclass().)rP)r[rVrCrCrDrsz_NoReturn.__subclasscheck__N)rArdr@rgrqrrrCrCrCrDrs rcsNeZdZdZdZdddd fd d Zd d ZddZddZddZ Z S)raType variable. Usage:: T = TypeVar('T') # Can be anything A = TypeVar('A', str, bytes) # Must be str or bytes Type variables exist primarily for the benefit of static type checkers. They serve as the parameters for generic types as well as for generic function definitions. See class Generic for more information on generic types. Generic functions work as follows: def repeat(x: T, n: int) -> List[T]: '''Return a list containing n references to x.''' return [x]*n def longest(x: A, y: A) -> A: '''Return the longest of two strings.''' return x if len(x) >= len(y) else y The latter example's signature is essentially the overloading of (str, str) -> str and (bytes, bytes) -> bytes. Also note that if the arguments are instances of some subclass of str, the return type is still plain str. At runtime, isinstance(x, T) and issubclass(C, T) will raise TypeError. Type variables defined with covariant=True or contravariant=True can be used do declare covariant or contravariant generic types. See PEP 484 for more details. By default generic types are invariant in all type variables. Type variables can be introspected. e.g.: T.__name__ == 'T' T.__constraints__ == () T.__covariant__ == False T.__contravariant__ = False A.__constraints__ == (str, bytes) rA __bound__r __covariant____contravariant__NF)bound covariant contravariantcstj|f||||d||_|r2|r2tdt||_t||_|rZ|dk rZtd|rrt|dkrrtddt fdd|D|_ |rt |d |_ nd|_ dS) N)rrrz"Bivariant types are not supported.z-Constraints cannot be combined with bound=...rKz"A single constraint is not allowedz:TypeVar(name, constraint, ...): constraints must be types.c3s|]}t|VqdS)N)r}).0r)rrCrD sz#TypeVar.__init__..zBound must be a type.) rTr^rA ValueErrorboolrrrPrkrnrr}r)r[rWrrrZ constraints)rZ)rrDr^s     zTypeVar.__init__cCs||kr|j|dS)N)append)r[rbrCrCrDrcszTypeVar._get_type_varscCs&|jr d}n|jrd}nd}||jS)N+-~)rrrA)r[prefixrCrCrDrf s zTypeVar.__repr__cCs tddS)Nz0Type variables cannot be used with isinstance().)rP)r[instancerCrCrDrszTypeVar.__instancecheck__cCs tddS)Nz0Type variables cannot be used with issubclass().)rP)r[rVrCrCrDrszTypeVar.__subclasscheck__)rArrrr) rArdr@rgrqr^rcrfrrrirCrC)rZrDrs( TKTVTT_co)rV_coVT_coT_contra)rcCsd|dkr g}t|dr0t|ttfr0|j||St|tr`x$t|D]\}}||krD||SqDW|S)zAn internal helper function: replace arg if it is a type variable found in tvars with corresponding substitution from args or with corresponding substitution sub-tree if arg is a generic type. N _subs_tree)hasattrrlrrHrr enumerate)r{rbr\iZtvarrCrCrD _replace_arg)s   rc Cs|jdkr|S|j}g}x|jdk r6|j||j}qWg}x |jD]}|jt|||qDWx8|D]0}g}x"|jD]}|jt||j|qtW|}qdW|S)aAn internal helper function: calculate substitution tree for generic cls after replacing its type parameters with substitutions in tvars -> args (if any). Repeat the same following __origin__'s. Return a list of arguments with all possible substitutions performed. Arguments that are generic classes themselves are represented as tuples (so that no new classes are created by this function). For example: _subs_tree(List[Tuple[int, T]][str]) == [(Tuple, int, str)] N)rr__args__r__parameters__) rVrbr\ZcurrentZ orig_chain tree_argsr{ZoclsZ new_tree_argsrCrCrDrDs       rcsg}xn|D]f}t|tr0|jtkr0|j|jq t|trft|dkrf|dtkrf|j|ddq |j|q Wt |tt|krg}x(|D] }|kr|j|j |qW|}t |x>|D]6tt sqt fddhDr̈j qWtfdd|DS)zAn internal helper for Union creation and substitution: flatten Union's among parameters, then remove duplicates and strict subclasses. rrKNc3s6|].}t|to|jdk st|to,t|VqdS)N)rlrrror)rZt2)t1rCrDrs z'_remove_dups_flatten..c3s|]}|kr|VqdS)NrC)rr) all_paramsrCrDrs) rlrrrextendrrnrkrsetremoveroany) parametersparamspZ new_paramsrrC)rrrD_remove_dups_flattenes. "     rcCsX|jstdt|t|}t|j}||krTtd||kr@dndt|||fdS)Nz%s is not a generic classz0Too %s parameters for %s; actual %s, expected %sZmanyZfew)rrPrrk)rVrZalenZelenrCrCrD_check_generics rcs4tjtjjtjfdd}|S)zInternal wrapper caching __getitem__ of generic types with a fallback to original function for non-hashable arguments. c s*y ||Stk rYnX||S)N)rP)r\r])cachedfuncrCrDinners  z_tp_cache..inner) functools lru_cache _cleanupsr cache_clearwraps)rrrC)rrrD _tp_caches  rcseZdZdZdZd ddfd d Zd d Zd dZfddZfddZ e ddZ d!ddZ ddZ ddZddZddZZS)"raUnion type; Union[X, Y] means either X or Y. To define a union, use e.g. Union[int, str]. Details: - The arguments must be types and there must be at least one. - None as an argument is a special case and is replaced by type(None). - Unions of unions are flattened, e.g.:: Union[Union[int, str], float] == Union[int, str, float] - Unions of a single argument vanish, e.g.:: Union[int] == int # The constructor actually returns int - Redundant arguments are skipped, e.g.:: Union[int, str, int] == Union[int, str] - When comparing unions, the argument order is ignored, e.g.:: Union[int, str] == Union[str, int] - When two arguments have a subclass relationship, the least derived argument is kept, e.g.:: class Employee: pass class Manager(Employee): pass Union[int, Employee, Manager] == Union[int, Employee] Union[Manager, int, Employee] == Union[int, Employee] Union[Employee, Manager] == Employee - Similar for object:: Union[int, object] == object - You cannot subclass or instantiate a union. - You can use Optional[X] as a shorthand for Union[X, None]. rrr __tree_hash__NF)rOcstj|||f|d|i}|dkrHd|_d|_d|_ttd|_|St|t sZt d|t kr~t |}t |dkr~|dSt||_||_||_|j}t|t rtt||_n t||_|S)NrOrzExpected parameters=rKr)r)rTrUrrrr frozensetrrlrnrPrrrkrr)rVroriginrOr\r[Z subs_tree)rZrCrDrUs*     z_Union.__new__cs^|jdkr|Stfdd|jD}t|j}||jkrN||jkrN|S|j||ddS)Nc3s|]}t|VqdS)N)ra)rr)r_r`rCrDrsz$_Union._eval_type..T)rO)rrnrarrZ)r[r_r`ev_args ev_originrC)r_r`rDras z_Union._eval_typecCs|jr|jrt|j|dS)N)rrrc)r[rbrCrCrDrcs z_Union._get_type_varscs<|jdkrtjS|j}t|ts.t|S|dj|S)Nr)rrTrfrrlrnr _tree_repr)r[tree)rZrCrDrfs    z_Union.__repr__cs`g}xB|ddD]2}t|ts0|jt|q|j|dj|qWtjddj|S)NrKrz[%s]z, )rlrnrrSrrTrfrQ)r[rarg_listr{)rZrCrDr s  z_Union._tree_reprcsl|fkrtdt|ts |f}|jdkr0dndtfdd|D}|tk r\t|||j||ddS)Nz Cannot take a Union of no types.z)Union[arg, ...]: each arg must be a type.z*Parameters to generic types must be types.c3s|]}t|VqdS)N)r})rr)rrCrDr sz%_Union.__getitem__..T)rrO)rPrlrnrrrrZ)r[rrC)rrDrs   z_Union.__getitem__cCs>|tkr tSt|||}t|}t|dkr4|dStf|S)NrKr)rrrrk)r[rbr\rrCrCrDr%s  z_Union._subs_treecCs6t|tr|j|jkS|tk r*|j|kS||kSdS)N)rlrrrr)r[rrCrCrDr.s    z _Union.__eq__cCs|jS)N)r)r[rCrCrDr6sz_Union.__hash__cCs tddS)Nz(Unions cannot be used with isinstance().)rP)r[rrCrCrDr9sz_Union.__instancecheck__cCs tddS)Nz(Unions cannot be used with issubclass().)rP)r[rVrCrCrDr<sz_Union.__subclasscheck__)rrrr)NN)NN)rArdr@rgrqrUrarcrfrrrrrrrrrirCrC)rZrDrs*    rc@s eZdZdZfZeddZdS)rzEOptional type. Optional[X] is equivalent to Union[X, None]. cCst|d}t|tdfS)Nz#Optional[t] requires a single type.)r}rro)r[r{rCrCrDrKs z_Optional.__getitem__N)rArdr@rgrqrrrCrCrCrDrCsrcCsJt}x@t|jddD]*\}}t|tr|jtkr|j|d}qW|S)zHelper for Generic.__new__. Returns the class after the last occurrence of Generic or Generic[...] in cls.__mro__. NrK)objectr__mro__rlrrr )rVZ next_in_mrorcrCrCrD _next_in_mroTs rcs,tjtjrfdd}n fdd}|S)zConstruct a __subclasshook__ callable that incorporates the associated __extra__ class in subclass checks performed against cls. csZjj|}|tk r|Sj|jkr(dSx,jjD]}t|trDq4t||r4dSq4WtS)NT) __extra____subclasshook__r~r__subclasses__rlrr)subclassresscls)rVrCrD __extrahook__ks    z)_make_subclasshook..__extrahook__csjrt|jrdStS)NT)rrr~)r)rVrCrDrys)rlrabcABCMeta)rVrrC)rVrD_make_subclasshookbs rcCs2t|}d|kr.x|dD]}|j|dqW|S)zInternal helper: copy class __dict__ and clean slots class variables. (They will be re-created if necessary by normal class machinery.) rqN)dictpop)ZdctZ dict_copyZslotrCrCrD_no_slots_copys rcseZdZdZd!fdd ZeddZejddZedd Zejd d Zd d Z d dZ fddZ fddZ d"ddZ ddZddZeddZfddZddZfdd ZZS)#racMetaclass for generic types. This is a metaclass for typing.Generic and generic ABCs defined in typing module. User defined subclasses of GenericMeta can override __new__ and invoke super().__new__. Note that GenericMeta.__new__ has strict rules on what is allowed in its bases argument: * plain Generic is disallowed in bases; * Generic[...] should appear in bases at most once; * if Generic[...] is present, then it should list all type variables that appear in other bases. In addition, type of all generic bases is erased, e.g., C[int] is stripped to plain C. Nc sX|dk r nt|}d} xF|D]>} | tkr0tdt| tr| jtkr| dk rTtd| j} qW| dkrl|} nPt|} t| | kstddjfdd|Ddjdd| Df| }|} |dk rt |t j kr||kr|f|}t d d|D}t d d|Dr t d d|D}|j|||s2dn|jd tj||||d d} tt| jd|sj| n|j|| _|rt dd|Dnd| _t| | _|dkr| | _d|kr|st| jdddkrt| | _t|t j r|j| _|j| _n|dk r|j| _|j| _|r2t|dr2|j| _|rDt| jn tt| j | _!| S)zCreate a new generic class. GenericMeta.__new__ accepts keyword arguments that are used for internal bookkeeping, therefore an override should pass unused keyword arguments to super(). Nz!Cannot inherit from plain Genericz0Cannot inherit from Generic[...] multiple types.z6Some type variables (%s) are not listed in Generic[%s]z, c3s|]}|krt|VqdS)N)rm)rr)gvarsetrCrDrsz&GenericMeta.__new__..css|]}t|VqdS)N)rm)rgrCrCrDrscss"|]}t|tr|jn|VqdS)N)rlrr)rbrCrCrDrscss |]}t|to|tk VqdS)N)rlrr )rrrCrCrDrscss|]}|tk r|VqdS)N)r )rrrCrCrDrs)rrrT)rOrcss*|]"}|tkrdn|tkrfn|VqdS).N)_TypingEllipsis _TypingEmpty)rarCrCrDrsrrArr@)"rr rPrlrrrrrQrorrrnrupdaterrTrU __setattr__rr__next_in_mro____orig_bases__rrr _abc_registry _abc_cacherr@rrrr)rVrWrXrYrbr\rextra orig_basesZgvarsbaseZtvarsetZ initial_basesr[)rZ)rrDrUsj           zGenericMeta.__new__cCst|jtjr|jjS|jjS)N)rlrrr_abc_negative_cacher_abc_generic_negative_cache)r[rCrCrDrszGenericMeta._abc_negative_cachecCs,|jdkr(t|jtjr"||j_n||_dS)N)rrlrrrrr)r[valuerCrCrDrs  cCst|jtjr|jjS|jjS)N)rlrrr_abc_negative_cache_versionr#_abc_generic_negative_cache_version)r[rCrCrDr sz'GenericMeta._abc_negative_cache_versioncCs,|jdkr(t|jtjr"||j_n||_dS)N)rrlrrrrr)r[rrCrCrDrs  cCs|jr|jrt|j|dS)N)rrrc)r[rbrCrCrDrcs zGenericMeta._get_type_varsc s|jr|jjnd}|jr8tfdd|jDnd}||jkrT||jkrT|S|j|j|jt|j|rtt |nd|||j |j dS)Nc3s|]}t|VqdS)N)ra)rr)r_r`rCrDrsz)GenericMeta._eval_type..)rbr\rrr) rrarrnrZrA __bases__r__dict__rrr)r[r_r`rrrC)r_r`rDras$zGenericMeta._eval_typecs"|jdkrtjS|j|jS)N)rrTrfrr)r[)rZrCrDrf+s  zGenericMeta.__repr__cstg}xV|ddD]F}|fkr*|jdqt|tsD|jt|q|j|dj|qWtjddj|S)NrKz()rz[%s]z, )rrlrnrSrrTrfrQ)r[rrr{)rZrCrDr0s  zGenericMeta._tree_reprcCs*|jdkr|St|||}|jft|S)N)rrrrn)r[rbr\rrCrCrDr;s  zGenericMeta._subs_treecCs6t|tstS|jdks"|jdkr*||kS|j|jkS)N)rlrr~rr)r[rrCrCrDrAs  zGenericMeta.__eq__cCs|jS)N)r)r[rCrCrDrHszGenericMeta.__hash__c s6t|ts|f}| r0|jtk r0tdt|dtfdd|D}|tkrtdd|Dsltdtt |t|krtd|}|}nb|tt fkrt |}|}nH|t kr|}|}n6|j tt fkrtdt|nt||t |}|}|j dkr|fnf}|j|j||jt|j||||j|jd S) Nz)Parameter list to %s[...] cannot be emptyz*Parameters to generic types must be types.c3s|]}t|VqdS)N)r})rr)rrCrDrSsz*GenericMeta.__getitem__..css|]}t|tVqdS)N)rlr)rrrCrCrDrVsz5Parameters to Generic[...] must all be type variablesz-Parameters to Generic[...] must all be uniquez'Cannot subscript already-subscripted %s)rbr\rrr)rlrnrrrPrEr allrkrr rrrrrrZrArrrrr)r[rrbr\ZprependrC)rrDrKsJ   zGenericMeta.__getitem__csJ|jdk r*tjdjddkr&tddS|tkr>td|tj|S) NrKrArrzCParameterized generics cannot be used with class or instance checksFz5Class %r cannot be used with class or instance checks)rr)rr> _getframe f_globalsrPr rTr)r[rV)rZrCrDrys zGenericMeta.__subclasscheck__cCs t|j|S)N)rrZ)r[rrCrCrDrszGenericMeta.__instancecheck__csT|jdr|jds(|jds(|jdkr VT: ... # Etc. This class can then be used as follows:: def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default cOs&|jtkrtdt|j|f||S)NzHType Generic cannot be instantiated; it can be used only as a base class)rr rPr r)rVr\r]rCrCrDrUs zGeneric.__new__N)rArdr@rgrqrUrCrCrCrDr s)rrc@seZdZdZdS)rzInternal placeholder for () or []. Used by TupleMeta and CallableMeta to allow empty list/tuple in specific places, without allowing them to sneak in where prohibited. N)rArdr@rgrCrCrCrDrsrc@seZdZdZdS)rz(Internal placeholder for ... (ellipsis).N)rArdr@rgrCrCrCrDrsrcs4eZdZdZefddZddZddZZS) TupleMetazMetaclass for Tuple (internal).cs|jdk s|jtk r tj|S|fkr6tjtfSt|tsF|f}t|dkr|ddkrdt |d}tj|t fSdtfdd|D}tj|S) NrrK.z Tuple[t, ...]: t must be a type.rz*Tuple[t0, t1, ...]: each t must be a type.c3s|]}t|VqdS)N)r})rr)rrCrDrsz(TupleMeta.__getitem__..) rrrrTrrrlrnrkr}r)r[rr)rZ)rrDrs  zTupleMeta.__getitem__cCs |jdkrt|tStddS)Nz5Parameterized Tuple cannot be used with isinstance().)rrlrnrP)r[rrCrCrDrs  zTupleMeta.__instancecheck__cCs |jdkrt|tStddS)Nz5Parameterized Tuple cannot be used with issubclass().)rrrnrP)r[rVrCrCrDrs  zTupleMeta.__subclasscheck__) rArdr@rgrrrrrirCrC)rZrDr sr c@seZdZdZfZddZdS)ra@Tuple type; Tuple[X, Y] is the cross-product type of X and Y. Example: Tuple[T1, T2] is a tuple of two elements corresponding to type variables T1 and T2. Tuple[int, float, str] is a tuple of an int, a float and a string. To specify a variable-length tuple of homogeneous type, use Tuple[T, ...]. cOs$|jtkrtdtt|f||S)Nz6Type Tuple cannot be instantiated; use tuple() instead)rrrPr rn)rVr\r]rCrCrDrU s z Tuple.__new__N)rArdr@rgrqrUrCrCrCrDrs)rrrcsHeZdZdZfddZfddZfddZefdd ZZ S) CallableMetaz"Metaclass for Callable (internal).cs"|jdkrtjS|j|jS)N)rrTrfrr)r[)rZrCrDrfs  zCallableMeta.__repr__cs|jtk rtj|Sg}xB|ddD]2}t|tsF|jt|q(|j|dj|q(W|ddkrt|dd|dSt|dddj |dd|dfS) NrKrz...z [..., %s]z [[%s], %s]z, rr) rr rTrrlrnrrSrrQ)r[rrr{)rZrCrDrs     zCallableMeta._tree_reprcs|jdk s|jtk r tj|St|t s8t|dkr@td|\}}|t krZt |f}n$t|t srtd|ft||f}|j |S)zxA thin wrapper around __getitem_inner__ to provide the latter with hashable arguments to improve speed. Nrz6Callable must be used as Callable[[arg, ...], result].z8Callable[args, result]: args must be a list. Got %.100r.) rrr rTrrlrnrkrPEllipsislist__getitem_inner__)r[rr\result)rZrCrDr*s     zCallableMeta.__getitem__cs^|\}}dt|}|tkr.tjt|fSdtfdd|D}||f}tj|S)Nz.Callable[args, result]: result must be a type.z6Callable[[arg, ...], result]: each arg must be a type.c3s|]}t|VqdS)N)r})rr{)rrCrDrFsz1CallableMeta.__getitem_inner__..)r}rrTrrrn)r[rr\r)rZ)rrDr>s  zCallableMeta.__getitem_inner__) rArdr@rgrfrrrrrirCrC)rZrDr s    r c@seZdZdZfZddZdS)r aCallable type; Callable[[int], str] is a function of (int) -> str. The subscription syntax must always be used with exactly two values: the argument list and the return type. The argument list must be a list of types or ellipsis; the return type must be a single type. There is no syntax to indicate optional or keyword arguments, such function types are rarely used as callback types. cOs&|jtkrtdt|j|f||S)NzIType Callable cannot be instantiated; use a non-abstract subclass instead)rr rPr r)rVr\r]rCrCrDrUXs zCallable.__new__N)rArdr@rgrqrUrCrCrCrDr Ks csNeZdZdZdZdddZddZdd Zfd d Zd d Z ddZ Z S)ra3Special type construct to mark class variables. An annotation wrapped in ClassVar indicates that a given attribute is intended to be used as a class variable and should not be set on instances of that class. Usage:: class Starship: stats: ClassVar[Dict[str, int]] = {} # class variable damage: int = 10 # instance variable ClassVar accepts only types and cannot be further subscribed. Note that ClassVar is not a class itself, and should not be used with isinstance() or issubclass(). __type__NcKs ||_dS)N)r)r[tpr]rCrCrDr^rsz_ClassVar.__init__cCsPt|}|jdkr4|t|dj|jddddStdj|jdddS)Nz{} accepts only single type.rKT)rOz {} cannot be further subscripted)rorr}formatrArP)r[itemrVrCrCrDrus z_ClassVar.__getitem__cCs,t|j||}||jkr|St||ddS)NT)rO)rarro)r[r_r`Znew_tprCrCrDra~s z_ClassVar._eval_typecs,tj}|jdk r(|djt|j7}|S)Nz[{}])rTrfrrrS)r[r)rZrCrDrfs  z_ClassVar.__repr__cCstt|j|jfS)N)rrorAr)r[rCrCrDrsz_ClassVar.__hash__cCs,t|tstS|jdk r$|j|jkS||kS)N)rlrr~r)r[rrCrCrDrs    z_ClassVar.__eq__)r)N) rArdr@rgrqr^rrarfrrrirCrC)rZrDr_s   rcCs|S)zCast a value to a type. This returns the value unchanged. To the type checker this signals that the return value has the designated type, but at runtime we intentionally don't check anything (we want this to be as fast as possible). rC)typvalrCrCrDr6sc Csy |j}Wntk riSX|j}|j}|d|}|jp@f}|j}|rTt|ni}|t|}x&t||d|D]\}} | ||<qxW|S)z:Internal helper to extract the default arguments, by name.N) __code__r  co_argcount co_varnames __defaults____kwdefaults__rrkzip) rr|Z pos_countZ arg_namesdefaultsZ kwdefaultsrZ pos_offsetrWrrCrCrD _get_defaultss     r c Cst|ddriSt|tri}xt|jD]z}|dkrFtj|jj}n|}|jj di}xJ|j D]>\}}|dkrztd}t|t rt |}t |||}|||<qbWq*W|S|dkrt|tjr|j}n t|di}|dkr|}n |dkr|}t|dd}|dkr"t|triStdj|t|} t|}xp|j D]d\}}|dkrVtd}t|t rjt |}t |||}|| kr| |dkrt|}|||<qmodulesrdrgetitemsrmrGrar ModuleType_allowed_typesrPrr rr) rr_r`ZhintsrZ base_globalsZannrWrrrCrCrDr7sV            c Cst|tr||jj}x0|jjD]"\}}||j|fkr |j|q Wx4|jD](}t|tj rfd|_ t|trPt |qPWy d|_ Wnt k rYnX|S)aIDecorator to indicate that annotations are not type hints. The argument must be a class or function; if it is a class, it applies recursively to all methods and classes defined in that class (but not to methods defined in its superclasses or subclasses). This mutates the function(s) or class(es) in place. T) rlrorcopyr'rrvaluesrrr!r9rP)r{Z arg_attrsrrrrCrCrDr9s      cstjfdd}|S)zDecorator to give another decorator the @no_type_check effect. This wraps the decorator with something that wraps the decorated function in @no_type_check. cs||}t|}|S)N)r9)r\r]r) decoratorrCrDwrapped_decorator/s z2no_type_check_decorator..wrapped_decorator)rr)r,r-rC)r,rDr:(scOs tddS)z*Helper for @overload to raise when called.zYou should not call an overloaded function. A series of @overload-decorated functions outside a stub module should always be followed by an implementation that is not @overload-ed.N)NotImplementedError)r\r]rCrCrD_overload_dummy8sr/cCstS)a Decorator for overloaded functions/methods. In a stub file, place two or more stub definitions for the same function in a row, each decorated with @overload. For example: @overload def utf8(value: None) -> None: ... @overload def utf8(value: bytes) -> bytes: ... @overload def utf8(value: str) -> bytes: ... In a non-stub file (i.e. a regular .py file), do the same but follow it with an implementation. The implementation should *not* be decorated with @overload. For example: @overload def utf8(value: None) -> None: ... @overload def utf8(value: bytes) -> bytes: ... @overload def utf8(value: str) -> bytes: ... def utf8(value): # implementation goes here )r/)rrCrCrDr;Ascs0eZdZdZfddZddZddZZS) _ProtocolMetaz~Internal metaclass for _Protocol. This exists so _Protocol classes can be generic without deriving from Generic. cs"t|jkrtj|StddS)Nz+Protocols cannot be used with isinstance().)rrrTrrP)r[r)rZrCrDres  z_ProtocolMeta.__instancecheck__csL|js tS|tkrdS|j}x(|D] tfdd|jDs$dSq$WdS)NTc3s|]}|jkVqdS)N)r)rd)rrCrDrwsz2_ProtocolMeta.__subclasscheck__..F)rhr~r_get_protocol_attrsrr)r[rVattrsrC)rrDrjs z_ProtocolMeta.__subclasscheck__cCs,g}x.|jD]$}t|ddr |jdkr |j|q Wt}x|D]}x|jjD]}x|jD]&}||k r`||jkr`t|dd r`Pq`W|jd rT|dkrT|dkrT|dkrT|dkrT|dkrT|d krT|d krT|d krT|d krT|d krT|dkrT|dkrT|dkrT|dkrT|dkrT|dkrT|j|qTWqBW|S)NrhFrr__abstractmethods__r"rjrrrrqr2rrrrrrrd) rrrArrrkeysrLadd)r[Zprotocol_basesrr3rrrCrCrDr2{s<   z!_ProtocolMeta._get_protocol_attrs)rArdr@rgrrr2rirCrC)rZrDr0^s r0c@seZdZdZfZdZdS)rzInternal base class for protocol classes. This implements a simple-minded structural issubclass check (similar but more general than the one-offs in collections.abc such as Hashable). TN)rArdr@rgrqrhrCrCrCrDrsr Awaitablec@seZdZfZdS)r7N)rArdr@rqrCrCrCrDr7s)r Coroutinec@seZdZfZdS)r8N)rArdr@rqrCrCrCrDr8s AsyncIterablec@seZdZfZdS)r9N)rArdr@rqrCrCrCrDr9sc@seZdZfZdS) AsyncIteratorN)rArdr@rqrCrCrCrDr:sr:c@seZdZfZdS)rN)rArdr@rqrCrCrCrDrsc@seZdZfZdS)rN)rArdr@rqrCrCrCrDrsc@s"eZdZfZeedddZdS)r*)returncCsdS)NrC)r[rCrCrD__int__szSupportsInt.__int__N)rArdr@rqrintr<rCrCrCrDr*sc@s"eZdZfZeedddZdS)r))r;cCsdS)NrC)r[rCrCrD __float__szSupportsFloat.__float__N)rArdr@rqrfloatr>rCrCrCrDr)sc@s"eZdZfZeedddZdS)r()r;cCsdS)NrC)r[rCrCrD __complex__szSupportsComplex.__complex__N)rArdr@rqrcomplexr@rCrCrCrDr(sc@s"eZdZfZeedddZdS)r')r;cCsdS)NrC)r[rCrCrD __bytes__szSupportsBytes.__bytes__N)rArdr@rqrbytesrBrCrCrCrDr'sc@s"eZdZfZeedddZdS)r&)r;cCsdS)NrC)r[rCrCrD__abs__szSupportsAbs.__abs__N)rArdr@rqrrrDrCrCrCrDr&sc@s&eZdZfZedeedddZdS)r+r)ndigitsr;cCsdS)NrC)r[rErCrCrD __round__szSupportsRound.__round__N)r)rArdr@rqrr=rrFrCrCrCrDr+sc@seZdZfZdS)r%N)rArdr@rqrCrCrCrDr% sc@s"eZdZfZeddddZdS)r%zIterator[T_co])r;cCsdS)NrC)r[rCrCrD __reversed__szReversible.__reversed__N)rArdr@rqrrGrCrCrCrDr% sc@seZdZfZdS)rN)rArdr@rqrCrCrCrDrs Collectionc@seZdZfZdS)rHN)rArdr@rqrCrCrCrDrHsc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr'sc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr+sc@seZdZfZdS)r!N)rArdr@rqrCrCrCrDr!0sc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr6sc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr:sc@seZdZfZdS)rN)rArdr@rqrCrCrCrDr?sc@seZdZfZdS)r"N)rArdr@rqrCrCrCrDr"Esc@seZdZfZdS)r"N)rArdr@rqrCrCrCrDr"Isc@seZdZfZdS)r"N)rArdr@rqrCrCrCrDr"Msc@seZdZfZdS)r N)rArdr@rqrCrCrCrDr Rsc@seZdZfZdS)rN)rArdr@rqrCrCrCrDrVsc@seZdZfZddZdS)r0cOs$|jtkrtdtt|f||S)Nz4Type List cannot be instantiated; use list() instead)rr0rPr r)rVr\r]rCrCrDrU^s z List.__new__N)rArdr@rqrUrCrCrCrDr0Zsc@seZdZfZddZdS)r-cOs*|jtkrtj||Sttj|f||S)N)rr- collectionsdequer )rVr\r]rCrCrDrUis  z Deque.__new__N)rArdr@rqrUrCrCrCrDr-esc@seZdZfZddZdS)r1cOs$|jtkrtdtt|f||S)Nz2Type Set cannot be instantiated; use set() instead)rr1rPr r)rVr\r]rCrCrDrUss z Set.__new__N)rArdr@rqrUrCrCrCrDr1osc@seZdZfZddZdS)r2cOs$|jtkrtdtt|f||S)Nz>Type FrozenSet cannot be instantiated; use frozenset() instead)rr2rPr r)rVr\r]rCrCrDrU}s zFrozenSet.__new__N)rArdr@rqrUrCrCrCrDr2zsc@seZdZfZdS)rN)rArdr@rqrCrCrCrDrsc@seZdZfZdS)rN)rArdr@rqrCrCrCrDrsc@seZdZfZdS)rN)rArdr@rqrCrCrCrDrsc@seZdZfZdS)r$N)rArdr@rqrCrCrCrDr$sAbstractContextManagerc@seZdZfZdS)rN)rArdr@rqrCrCrCrDrsc@s2eZdZfZddZejddZeddZ dS)rcCs|S)NrC)r[rCrCrD __enter__szContextManager.__enter__cCsdS)NrC)r[exc_type exc_value tracebackrCrCrD__exit__szContextManager.__exit__cCs8|tkr4tdd|jDr4tdd|jDr4dStS)Ncss|]}d|jkVqdS)rLN)r)rBrCrCrDrsz2ContextManager.__subclasshook__..css|]}d|jkVqdS)rPN)r)rrQrCrCrDrsT)rrrr~)rVCrCrCrDrs zContextManager.__subclasshook__N) rArdr@rqrLrrrP classmethodrrCrCrCrDrsAbstractAsyncContextManagerc@seZdZfZdS)AsyncContextManagerN)rArdr@rqrCrCrCrDrUsrUa class AsyncContextManager(Generic[T_co]): __slots__ = () async def __aenter__(self): return self @abc.abstractmethod async def __aexit__(self, exc_type, exc_value, traceback): return None @classmethod def __subclasshook__(cls, C): if cls is AsyncContextManager: if sys.version_info[:2] >= (3, 6): return _collections_abc._check_methods(C, "__aenter__", "__aexit__") if (any("__aenter__" in B.__dict__ for B in C.__mro__) and any("__aexit__" in B.__dict__ for B in C.__mro__)): return True return NotImplemented __all__.append('AsyncContextManager') c@seZdZfZddZdS)r.cOs$|jtkrtdtt|f||S)Nz4Type Dict cannot be instantiated; use dict() instead)rr.rPr r)rVr\r]rCrCrDrUs z Dict.__new__N)rArdr@rqrUrCrCrCrDr.sc@seZdZfZddZdS)r/cOs*|jtkrtj||Sttj|f||S)N)rr/rI defaultdictr )rVr\r]rCrCrDrUs  zDefaultDict.__new__N)rArdr@rqrUrCrCrCrDr/sc@seZdZfZddZdS)r,cOs*|jtkrtj||Sttj|f||S)N)rr,rIr )rVr\r]rCrCrDrUs  zCounter.__new__N)rArdr@rqrUrCrCrCrDr,sChainMapc@seZdZfZddZdS)rXcOs*|jtkrtj||Sttj|f||S)N)rrXrIr )rVr\r]rCrCrDrUs  zChainMap.__new__N)rArdr@rqrUrCrCrCrDrXsc@seZdZfZddZdS)r4cOs$|jtkrtdtt|f||S)Nz@Type Generator cannot be instantiated; create a subclass instead)rr4rPr _G_base)rVr\r]rCrCrDrUs zGenerator.__new__N)rArdr@rqrUrCrCrCrDr4 sAsyncGeneratorc@seZdZfZdS)rZN)rArdr@rqrCrCrCrDrZsCT_co)rrc@seZdZdZfZdS)raA special construct usable to annotate class objects. For example, suppose we have the following classes:: class User: ... # Abstract base for User classes class BasicUser(User): ... class ProUser(User): ... class TeamUser(User): ... And a function that takes a class argument that's a subclass of User and returns an instance of the corresponding class:: U = TypeVar('U', bound=User) def new_user(user_class: Type[U]) -> U: user = user_class() # (Here we could write the user object to a database) return user joe = new_user(BasicUser) At this point the type checker knows that joe has type BasicUser. N)rArdr@rgrqrCrCrCrDr$sc svdfdd|D}tj|dd|D}tj||_|_ytjdjjdd|_ Wnt t fk rpYnX|S)NzDNamedTuple('Name', [(f0, t0), (f1, t1), ...]); each t must be a typecsg|]\}}|t|fqSrC)r})rnr)rrCrD Asz!_make_nmtuple..cSsg|] \}}|qSrCrC)rr\rrCrCrDr]BsrrA__main__) rI namedtuple OrderedDictr" _field_typesr>rrr&rdr r)rWrnm_tplrC)rrD _make_nmtuple?srcrUr^rq__getnewargs___fields_field_defaultsra_make_replace_asdict_sourcerdrAr@r"cseZdZfddZZS)NamedTupleMetac s|jddrtj||||Sts*td|jdi}t||j}g}i}xP|D]H}||krz||} |j| | ||<qR|rRtdj|dj |j dqRWt j ||j_ t||j_||_xD|D]<} | tkrtd| q| tko| |jkrt|| || qW|S) NrOFz= 3.6:: class Employee(NamedTuple): name: str id: int This is equivalent to:: Employee = collections.namedtuple('Employee', ['name', 'id']) The resulting class has extra __annotations__ and _field_types attributes, giving an ordered dict mapping field names to types. __annotations__ should be preferred, while _field_types is kept to maintain pre PEP 526 compatibility. (The field names are in the _fields attribute, which is part of the namedtuple API.) Alternative equivalent keyword syntax is also accepted:: Employee = NamedTuple('Employee', name=str, id=int) In Python versions <= 3.5 use:: Employee = NamedTuple('Employee', [('name', str), ('id', int)]) TNcKs:|rt rtd|dkr$|j}n |r0tdt||S)Nz>Keyword syntax for NamedTuple is only supported in Python 3.6+zIEither list of fields or keywords can be provided to NamedTuple, not both)rmrPr'rc)r[rqZfieldskwargsrCrCrDrUs  zNamedTuple.__new__)N)rArdr@rgrOrUrCrCrCrDr3yscCsdd}||_||_|S)a%NewType creates simple unique types with almost zero runtime overhead. NewType(name, tp) is considered a subtype of tp by static type checkers. At runtime, NewType(name, tp) returns a dummy function that simply returns its argument. Usage:: UserId = NewType('UserId', int) def name_by_id(user_id: UserId) -> str: ... UserId('user') # Fails type check name_by_id(42) # Fails type check name_by_id(UserId(42)) # OK num = UserId(5) + 1 # type: int cSs|S)NrC)rBrCrCrDnew_typeszNewType..new_type)rAZ __supertype__)rWrrurCrCrDr8sFc@seZdZdZfZeedddZeedddZe dddd Z e e dd d Z e e dd d Ze ddddZe e dddZe d7e edddZe e dddZe d9e edddZe d;e eedddZe dIOaGeneric base class for TextIO and BinaryIO. This is an abstract, generic version of the return of open(). NOTE: This does not distinguish between the different possible classes (text vs. binary, read vs. write vs. read/write, append-only, unbuffered). The TextIO and BinaryIO subclasses below capture the distinctions between text vs. binary, which is pervasive in the interface; however we currently do not offer a way to track the other distinctions in the type system. )r;cCsdS)NrC)r[rCrCrDmodeszIO.modecCsdS)NrC)r[rCrCrDrWszIO.nameNcCsdS)NrC)r[rCrCrDcloseszIO.closecCsdS)NrC)r[rCrCrDclosedsz IO.closedcCsdS)NrC)r[rCrCrDfilenosz IO.filenocCsdS)NrC)r[rCrCrDflushszIO.flushcCsdS)NrC)r[rCrCrDisattysz IO.isattyrK)r\r;cCsdS)NrC)r[r\rCrCrDreadszIO.readcCsdS)NrC)r[rCrCrDreadablesz IO.readable)limitr;cCsdS)NrC)r[rrCrCrDreadlinesz IO.readline)hintr;cCsdS)NrC)r[rrCrCrD readlinessz IO.readlinesr)offsetwhencer;cCsdS)NrC)r[rrrCrCrDseekszIO.seekcCsdS)NrC)r[rCrCrDseekable sz IO.seekablecCsdS)NrC)r[rCrCrDtell szIO.tell)sizer;cCsdS)NrC)r[rrCrCrDtruncate sz IO.truncatecCsdS)NrC)r[rCrCrDwritable sz IO.writable)sr;cCsdS)NrC)r[rrCrCrDwrite szIO.write)linesr;cCsdS)NrC)r[rrCrCrD writelines sz IO.writelinesz IO[AnyStr]cCsdS)NrC)r[rCrCrDrL sz IO.__enter__cCsdS)NrC)r[rorrOrCrCrDrP sz IO.__exit__r)rr)rr)r)r)N) rArdr@rgrqrrmrwrWrrxrryr=rzr{r|r5r}r~rr0rrrrrrrrrLrPrCrCrCrDrvsT rvc@sBeZdZdZfZeeeefe dddZ eddddZ dS) BinaryIOz5Typed version of the return of open() in binary mode.)rr;cCsdS)NrC)r[rrCrCrDr) szBinaryIO.write)r;cCsdS)NrC)r[rCrCrDrL- szBinaryIO.__enter__N) rArdr@rgrqrrrC bytearrayr=rrLrCrCrCrDr$ s rc@seZdZdZfZeedddZeedddZ ee edddZ ee dd d Z eedd d Zeddd dZdS)TextIOz3Typed version of the return of open() in text mode.)r;cCsdS)NrC)r[rCrCrDbuffer7 sz TextIO.buffercCsdS)NrC)r[rCrCrDencoding; szTextIO.encodingcCsdS)NrC)r[rCrCrDerrors? sz TextIO.errorscCsdS)NrC)r[rCrCrDline_bufferingC szTextIO.line_bufferingcCsdS)NrC)r[rCrCrDnewlinesG szTextIO.newlinescCsdS)NrC)r[rCrCrDrLK szTextIO.__enter__N)rArdr@rgrqrrrrmrrrrrr rrrLrCrCrCrDr2 src@s&eZdZdZdddgZeZeZeZdS)ioz)Wrapper namespace for IO generic classes.rvrrN)rArdr@rg__all__rvrrrCrCrCrDrP s  rz.ioPatternrcCs|jS)N)pattern)rrCrCrD^ srMatchcCs|jjS)N)rer)mrCrCrDr` sc@s eZdZdZddgZeZeZdS)rz&Wrapper namespace for re type aliases.rrN)rArdr@rgrrrrCrCrCrDrc srz.re)rr)NN)NN)rrV)rr) rUr^rqrdrerfrargrhrirj)rdrAr@r")rrrrI contextlibrrZ stdlib_rer>rcollections.abcZcollections_abc ImportErrorr?_collections_abcrrr rorr^__str__rmrQrrErMrNrHrIrGrFrcrrar}rSrr rZNoReturnrrrrrrrrrCr5rrrrrrrrrrrrrrrr r rrr rnrr r rr r6r rBuiltinFunctionType MethodTyper(r)r7r9r:r/r;r0rrrr7rr8r9r:rrr*r)r(r'r&r+r%r#rrHr1rr!rrr"r r=rrr0rJr-rrr2rrrr$rKrrTrUexecrr.rWr/r,rXr4rY GeneratorTyperZr[rrcrmrnrorkr3r8r<r=rvrrrrAr%ryrmatchrrCrCrCrDs   *%5C  W      !)    "96    R D                  "                   "      "(`     sunau.cpython-36.pyc000064400000041054152462730460010342 0ustar003 \F@sdZddlmZeddZdZdZdZdZd Zd Z d Z d Z d Z dZ dZdZdZdZeeeee egZGdddeZddZddZGdddZGdddZd ddZeZdS)!aStuff to parse Sun and NeXT audio files. An audio file consists of a header followed by the data. The structure of the header is as follows. +---------------+ | magic word | +---------------+ | header size | +---------------+ | data size | +---------------+ | encoding | +---------------+ | sample rate | +---------------+ | # of channels | +---------------+ | info | | | +---------------+ The magic word consists of the 4 characters '.snd'. Apart from the info field, all header fields are 4 bytes in size. They are all 32-bit unsigned integers encoded in big-endian byte order. The header size really gives the start of the data. The data size is the physical size of the data. From the other parameters the number of frames can be calculated. The encoding gives the way in which audio samples are encoded. Possible values are listed below. The info field currently consists of an ASCII string giving a human-readable description of the audio file. The info field is padded with NUL bytes to the header size. Usage. Reading audio files: f = sunau.open(file, 'r') where file is either the name of a file or an open file pointer. The open file pointer must have methods read(), seek(), and close(). When the setpos() and rewind() methods are not used, the seek() method is not necessary. This returns an instance of a class with the following public methods: getnchannels() -- returns number of audio channels (1 for mono, 2 for stereo) getsampwidth() -- returns sample width in bytes getframerate() -- returns sampling frequency getnframes() -- returns number of audio frames getcomptype() -- returns compression type ('NONE' or 'ULAW') getcompname() -- returns human-readable version of compression type ('not compressed' matches 'NONE') getparams() -- returns a namedtuple consisting of all of the above in the above order getmarkers() -- returns None (for compatibility with the aifc module) getmark(id) -- raises an error since the mark does not exist (for compatibility with the aifc module) readframes(n) -- returns at most n frames of audio rewind() -- rewind to the beginning of the audio stream setpos(pos) -- seek to the specified position tell() -- return the current position close() -- close the instance (make it unusable) The position returned by tell() and the position given to setpos() are compatible and have nothing to do with the actual position in the file. The close() method is called automatically when the class instance is destroyed. Writing audio files: f = sunau.open(file, 'w') where file is either the name of a file or an open file pointer. The open file pointer must have methods write(), tell(), seek(), and close(). This returns an instance of a class with the following public methods: setnchannels(n) -- set the number of channels setsampwidth(n) -- set the sample width setframerate(n) -- set the frame rate setnframes(n) -- set the number of frames setcomptype(type, name) -- set the compression type and the human-readable compression type setparams(tuple)-- set all parameters at once tell() -- return current position in output file writeframesraw(data) -- write audio frames without pathing up the file header writeframes(data) -- write audio frames and patch up the file header close() -- patch up the file header and close the output file You should set the parameters before the first writeframesraw or writeframes. The total number of frames does not need to be set, but when it is set to the correct value, the header does not have to be patched up. It is best to first set all parameters, perhaps possibly the compression type, and then write audio frames using writeframesraw. When all frames have been written, either call writeframes(b'') or close() to patch up the sizes in the header. The close() method is called automatically when the class instance is destroyed. ) namedtuple _sunau_paramsz7nchannels sampwidth framerate nframes comptype compnameidns.lc@s eZdZdS)ErrorN)__name__ __module__ __qualname__rr/usr/lib64/python3.6/sunau.pyrsrcCs<d}x2tdD]&}|jd}|s$t|dt|}qW|S)Nrrr)rangereadEOFErrorord)filexiZbyterrr _read_u32s rcCsJg}x2tdD]&}t|d\}}|jdt||}qW|jt|dS)Nrrr)rdivmodinsertintwritebytes)rrdatardmrrr _write_u32s r'c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)S)*Au_readcCs@t|tdkr,ddl}|j|d}d|_nd|_|j|dS)NrrbTF)typebuiltinsopen_openedinitfp)selffr,rrr__init__s  zAu_read.__init__cCs|jr|jdS)N)_fileclose)r0rrr__del__szAu_read.__del__cCs|S)Nr)r0rrr __enter__szAu_read.__enter__cGs |jdS)N)r4)r0argsrrr__exit__szAu_read.__exit__c Cs||_d|_tt|}|tkr(tdtt||_|jdkrHtd|jdkrZtdt||_|jtkrzt|j|_tt||_ |j t krtd|j t t fkrd|_ d |_nj|j tkrd |_|_ nR|j tkrd|_|_ n:|j tkrd |_|_ n"|j tkrd |_|_ ntd tt||_tt||_|j|j|_|jdkr~|j|jd|_|jjd \|_}}nd|_y|j|_Wn ttfk rd|_YnXdS)Nrzbad magic numberr zheader size too smalldzheader size ridiculously largezencoding not (yet) supportedrrrrzunknown encoding)r3 _soundposr!rAUDIO_FILE_MAGICrZ _hdr_size _data_sizeAUDIO_UNKNOWN_SIZE _encoding_simple_encodingsAUDIO_FILE_ENCODING_MULAW_8AUDIO_FILE_ENCODING_ALAW_8 _sampwidth _framesizeAUDIO_FILE_ENCODING_LINEAR_8AUDIO_FILE_ENCODING_LINEAR_16AUDIO_FILE_ENCODING_LINEAR_24AUDIO_FILE_ENCODING_LINEAR_32 _framerate _nchannelsr_info partitiontell _data_posAttributeErrorOSError)r0rmagic_rrrr/sP            zAu_read.initfpcCs|jS)N)r3)r0rrrgetfpsz Au_read.getfpcCs|jS)N)rK)r0rrr getnchannelsszAu_read.getnchannelscCs|jS)N)rD)r0rrr getsampwidthszAu_read.getsampwidthcCs|jS)N)rJ)r0rrr getframerateszAu_read.getframeratecCs(|jtkrtS|jtkr$|j|jSdS)Nr)r>r?r@rArE)r0rrr getnframess    zAu_read.getnframescCs$|jtkrdS|jtkrdSdSdS)NULAWALAWNONE)r@rBrC)r0rrr getcomptypes   zAu_read.getcomptypecCs$|jtkrdS|jtkrdSdSdS)NzCCITT G.711 u-lawzCCITT G.711 A-lawznot compressed)r@rBrC)r0rrr getcompnames   zAu_read.getcompnamecCs*t|j|j|j|j|j|jS)N)rrUrVrWrXr\r])r0rrr getparamss zAu_read.getparamscCsdS)Nr)r0rrr getmarkersszAu_read.getmarkerscCs tddS)Nzno marks)r)r0idrrrgetmarkszAu_read.getmarkcCsp|jtkrl|tkr|jj}n|jj||j}|jt||j7_|jtkrhddl }|j ||j }|SdS)Nr) r@rAr?r3rrEr<lenrBaudioopZulaw2linrD)r0nframesr$rcrrr readframes s   zAu_read.readframescCs*|jdkrtd|jj|jd|_dS)Nz cannot seekr)rOrQr3seekr<)r0rrrrewinds zAu_read.rewindcCs|jS)N)r<)r0rrrrNsz Au_read.tellcCsP|dks||jkrtd|jdkr.td|jj|j||j||_dS)Nrzposition not in rangez cannot seek)rXrrOrQr3rfrEr<)r0posrrrsetpos!s  zAu_read.setposcCs"|j}|rd|_|jr|jdS)N)r3r.r4)r0rrrrr4)s z Au_read.closeN)rrrr2r5r6r8r/rTrUrVrWrXr\r]r^r_rarergrNrir4rrrrr(s( , r(c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3S)4Au_writecCs@t|tdkr,ddl}|j|d}d|_nd|_|j|dS)Nr)rwbTF)r+r,r-r.r/)r0r1r,rrrr22s  zAu_write.__init__cCs|jr|jd|_dS)N)r3r4)r0rrrr5;szAu_write.__del__cCs|S)Nr)r0rrrr6@szAu_write.__enter__cGs |jdS)N)r4)r0r7rrrr8CszAu_write.__exit__cCsF||_d|_d|_d|_d|_t|_d|_d|_d|_ d|_ d|_ dS)Nrr;rY) r3rJrKrDrEr?_nframes_nframeswritten _datawritten _datalengthrL _comptype)r0rrrrr/FszAu_write.initfpcCs(|jrtd|dkrtd||_dS)Nz0cannot change parameters after starting to writerrrz"only 1, 2, or 4 channels supported)rrr)rmrrK)r0 nchannelsrrr setnchannelsSs zAu_write.setnchannelscCs|jstd|jS)Nznumber of channels not set)rKr)r0rrrrUZszAu_write.getnchannelscCs(|jrtd|dkrtd||_dS)Nz0cannot change parameters after starting to writerrrrzbad sample width)rrrr)rmrrD)r0 sampwidthrrr setsampwidth_s zAu_write.setsampwidthcCs|jstd|jS)Nzsample width not specified)rJrrD)r0rrrrVfszAu_write.getsampwidthcCs|jrtd||_dS)Nz0cannot change parameters after starting to write)rmrrJ)r0 frameraterrr setframeratekszAu_write.setframeratecCs|jstd|jS)Nzframe rate not set)rJr)r0rrrrWpszAu_write.getframeratecCs(|jrtd|dkrtd||_dS)Nz0cannot change parameters after starting to writerz# of frames cannot be negative)rmrrl)r0rdrrr setnframesus zAu_write.setnframescCs|jS)N)rm)r0rrrrX|szAu_write.getnframescCs|dkr||_ntddS)Nr[rYzunknown compression type)r[rY)rpr)r0r+namerrr setcomptypeszAu_write.setcomptypecCs|jS)N)rp)r0rrrr\szAu_write.getcomptypecCs$|jdkrdS|jdkrdSdSdS)NrYzCCITT G.711 u-lawrZzCCITT G.711 A-lawznot compressed)rp)r0rrrr]s   zAu_write.getcompnamecCsH|\}}}}}}|j||j||j||j||j||dS)N)rrrtrvrwry)r0ZparamsrqrsrurdZcomptypeZcompnamerrr setparamss     zAu_write.setparamscCs*t|j|j|j|j|j|jS)N)rrUrVrWrXr\r])r0rrrr^s zAu_write.getparamscCs|jS)N)rm)r0rrrrNsz Au_write.tellcCs~t|ttfst|jd}|j|jdkrDddl}|j||j }t ||j }|j j ||j||_|jt ||_dS)NBrYr) isinstancer# bytearray memoryviewcast_ensure_header_writtenrprcZlin2ulawrDrbrEr3r"rmrn)r0r$rcrdrrrwriteframesraws   zAu_write.writeframesrawcCs.|j||j|jks"|j|jkr*|jdS)N)rrmrlrorn _patchheader)r0r$rrr writeframess   zAu_write.writeframesc Cs^|jrZz6|j|j|jks(|j|jkr0|j|jjWd|j}d|_|jrX|j XdS)N) r3rrmrlrornrflushr.r4)r0rrrrr4s  zAu_write.closecCs<|js8|jstd|js"td|js0td|jdS)Nz# of channels not specifiedzsample width not specifiedzframe rate not specified)rmrKrrDrJ _write_header)r0rrrrszAu_write._ensure_header_writtenc Cs|jdkrl|jdkr t}d|_q|jdkr6t}d|_q|jdkrLt}d|_q|jdkrbt}d|_qtdn|jdkrt}d|_ntd|j|j |_t |j t dt |j}|d d @}t |j ||jtkrt}n |j|j}y|j j|_Wn ttfk rd|_YnXt |j |||_t |j |t |j |jt |j |j |j j|j|j jd |t |jd dS) Nr[rrrrzinternal errorrYr r r:r i)rprDrFrErGrHrIrrBrKr'r3r=rbrLrlr?rN_form_length_posrPrQrorJr")r0encodingZ header_sizeZlengthrrrrsJ               zAu_write._write_headercCsH|jdkrtd|jj|jt|j|j|j|_|jjdddS)Nz cannot seekrr)rrQr3rfr'rnro)r0rrrrs  zAu_write._patchheaderN)rrrr2r5r6r8r/rrrUrtrVrvrWrwrXryr\r]rzr^rNrrr4rrrrrrrrj0s2    *rjNcCsJ|dkrt|dr|j}nd}|dkr.t|S|dkr>t|StddS) Nmoder*rwrkz$mode must be 'r', 'rb', 'w', or 'wb')rr*)rrk)hasattrrr(rjr)r1rrrrr-s r-)N)__doc__ collectionsrrr=rBrFrGrHrIZAUDIO_FILE_ENCODING_FLOATZAUDIO_FILE_ENCODING_DOUBLEZAUDIO_FILE_ENCODING_ADPCM_G721ZAUDIO_FILE_ENCODING_ADPCM_G722Z AUDIO_FILE_ENCODING_ADPCM_G723_3Z AUDIO_FILE_ENCODING_ADPCM_G723_5rCr?rA Exceptionrrr'r(rjr-Zopenfprrrrhs@  Q contextlib.cpython-36.opt-1.pyc000064400000025630152462730460012323 0ustar003 \j3@sdZddlZddlZddlZddlmZddlmZddddd d d d gZGd ddej Z Gddde Z Gddde e Z ddZGddde ZGddde ZGdd d eZGdd d eZGdd d e ZGdd d e ZdS)z4Utilities for with-statement contexts. See PEP 343.N)deque)wrapscontextmanagerclosingAbstractContextManagerContextDecorator ExitStackredirect_stdoutredirect_stderrsuppressc@s2eZdZdZddZejddZeddZ dS) rz,An abstract base class for context managers.cCs|S)z0Return `self` upon entering the runtime context.)selfr r "/usr/lib64/python3.6/contextlib.py __enter__sz AbstractContextManager.__enter__cCsdS)z9Raise any exception triggered within the runtime context.Nr )r exc_type exc_value tracebackr r r__exit__szAbstractContextManager.__exit__cCs|tkrtj|ddStS)Nrr)r_collections_abc_check_methodsNotImplemented)clsCr r r__subclasshook__sz'AbstractContextManager.__subclasshook__N) __name__ __module__ __qualname____doc__rabcabstractmethodr classmethodrr r r rr sc@s eZdZdZddZddZdS)rzJA base class or mixin that enables context managers to work as decorators.cCs|S)a6Return a recreated instance of self. Allows an otherwise one-shot context manager like _GeneratorContextManager to support use as a decorator via implicit recreation. This is a private interface just for _GeneratorContextManager. See issue #11647 for details. r )r r r r _recreate_cm$s zContextDecorator._recreate_cmcstfdd}|S)Nc sj ||SQRXdS)N)r!)argskwds)funcr r rinner1s z(ContextDecorator.__call__..inner)r)r r$r%r )r$r r__call__0szContextDecorator.__call__N)rrrrr!r&r r r rr!s c@s0eZdZdZddZddZddZdd Zd S) _GeneratorContextManagerz%Helper for @contextmanager decorator.cCsJ||||_||||_|_|_t|dd}|dkr@t|j}||_dS)Nr)genr$r"r#getattrtyper)r r$r"r#docr r r__init__;s    z!_GeneratorContextManager.__init__cCs|j|j|j|jS)N) __class__r$r"r#)r r r rr!Isz%_GeneratorContextManager._recreate_cmc Cs.y t|jStk r(tddYnXdS)Nzgenerator didn't yield)nextr( StopIteration RuntimeError)r r r rrOs z"_GeneratorContextManager.__enter__cCs|dkr6yt|jWntk r*dSXtdn|dkrD|}y|jj|||Wntk r|}z||k Sd}~Xnftk r}z*||krdS|tkr|j|krdSWYdd}~Xn"tjd|krdSYnXtddS)NFzgenerator didn't stopz#generator didn't stop after throw())r.r(r/r0throw __cause__sysexc_info)r r*valuerexcr r rrUs. z!_GeneratorContextManager.__exit__N)rrrrr,r!rrr r r rr'8s r'cstfdd}|S)a@contextmanager decorator. Typical usage: @contextmanager def some_generator(): try: yield finally: This makes this: with some_generator() as : equivalent to this: try: = finally: cs t||S)N)r')r"r#)r$r rhelperszcontextmanager..helper)r)r$r8r )r$rrsc@s(eZdZdZddZddZddZdS) ra2Context to automatically close something at the end of a block. Code like this: with closing(.open()) as f: is equivalent to this: f = .open() try: finally: f.close() cCs ||_dS)N)thing)r r9r r rr,szclosing.__init__cCs|jS)N)r9)r r r rrszclosing.__enter__cGs|jjdS)N)r9close)r r5r r rrszclosing.__exit__N)rrrrr,rrr r r rrsc@s(eZdZdZddZddZddZdS)_RedirectStreamNcCs||_g|_dS)N) _new_target _old_targets)r new_targetr r rr,sz_RedirectStream.__init__cCs*|jjtt|jtt|j|j|jS)N)r=appendr)r4_streamsetattrr<)r r r rrsz_RedirectStream.__enter__cCstt|j|jjdS)N)rAr4r@r=pop)r exctypeexcinstexctbr r rrsz_RedirectStream.__exit__)rrrr@r,rrr r r rr;sr;c@seZdZdZdZdS)r aAContext manager for temporarily redirecting stdout to another file. # How to send help() to stderr with redirect_stdout(sys.stderr): help(dir) # How to write help() to a file with open('help.txt', 'w') as f: with redirect_stdout(f): help(pow) stdoutN)rrrrr@r r r rr s c@seZdZdZdZdS)r zCContext manager for temporarily redirecting stderr to another file.stderrN)rrrrr@r r r rr sc@s(eZdZdZddZddZddZdS) r a?Context manager to suppress specified exceptions After the exception is suppressed, execution proceeds with the next statement following the with statement. with suppress(FileNotFoundError): os.remove(somefile) # Execution still resumes here if the file was already removed cGs ||_dS)N) _exceptions)r exceptionsr r rr,szsuppress.__init__cCsdS)Nr )r r r rrszsuppress.__enter__cCs|dk ot||jS)N) issubclassrH)r rCrDrEr r rrs zsuppress.__exit__N)rrrrr,rrr r r rr s c@sPeZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ dS)raContext manager for dynamic management of a stack of exit callbacks For example: with ExitStack() as stack: files = [stack.enter_context(open(fname)) for fname in filenames] # All opened files will automatically be closed at the end of # the with statement, even if attempts to open files later # in the list raise an exception cCs t|_dS)N)r_exit_callbacks)r r r rr,szExitStack.__init__cCst|}|j|_t|_|S)z?Preserve the context stack by transferring it to a new instance)r*rKr)r new_stackr r rpop_alls zExitStack.pop_allcs"fdd}|_|j|dS)z:Helper to correctly register callbacks to __exit__ methodscsf|S)Nr ) exc_details)cmcm_exitr r _exit_wrappersz.ExitStack._push_cm_exit.._exit_wrapperN)__self__push)r rOrPrQr )rOrPr _push_cm_exitszExitStack._push_cm_exitc CsDt|}y |j}Wn tk r2|jj|YnX|j|||S)aRegisters a callback with the standard __exit__ method signature Can suppress exceptions the same way __exit__ methods can. Also accepts any object with an __exit__ method (registering a call to the method instead of the object itself) )r*rAttributeErrorrKr?rT)r exit_cb_type exit_methodr r rrS s   zExitStack.pushcs$fdd}|_|j|S)z\Registers an arbitrary callback and arguments. Cannot suppress exceptions. csdS)Nr )rr7tb)r"callbackr#r rrQ9sz)ExitStack.callback.._exit_wrapper) __wrapped__rS)r rZr"r#rQr )r"rZr#rrZ4s zExitStack.callbackcCs(t|}|j}|j|}|j|||S)zEnters the supplied context manager If successful, also pushes its __exit__ method as a callback and returns the result of the __enter__ method. )r*rrrT)r rO_cm_type_exitresultr r r enter_contextAs   zExitStack.enter_contextcCs|jddddS)z$Immediately unwind the context stackN)r)r r r rr:NszExitStack.closec s|ddk }tjdfdd}d}d}x\|jr|jj}y||rTd}d}d}Wq.tj}||d|dd}|}Yq.Xq.W|ry|dj}|dWn tk r||d_YnX|o|S)Nrr1cs8x,|j}||krdS|dks$|kr&P|}qW||_dS)N) __context__)new_excold_exc exc_context) frame_excr r_fix_exception_contextXsz2ExitStack.__exit__.._fix_exception_contextFT)NNN)r4r5rKrBr` BaseException) r rN received_excresuppressed_exc pending_raisecbnew_exc_details fixed_ctxr )rdrrRs2       zExitStack.__exit__N) rrrrr,rMrTrSrZr_r:rr r r rrs   )rrr4r collectionsr functoolsr__all__ABCrobjectrr'rrr;r r r rr r r rs$  I"typing.cpython-36.opt-2.pyc000064400000155361152462730460011470 0ustar003 \9D@s ddlZddlmZmZddlZddlZddlZddlZddlZddl Z yddl jZ Wne k rrddlZ YnXej dddkrddlZyddl mZmZmZWn4e k reejZeejZeejZYnXddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:g4Zd;d<Zd=d>ZGd?d@d@eZGdAdBdBedCdDZGdEdFdFedCdGZGdHdIdIedCdGZGdJdKdKedCdGZdLdMZ dNdOZ!dPdQZ"dRdSZ#dTdUZ$GdVdWdWedCdGZ%e%dCdGZ&GdXdYdYedCdGZ'e'dCdGZ(GdZddedCdGZ)e)d[Z*e)d\Z+e)d]Z,e)d^dCd_Z-e)d`dCd_Z.e)dadCd_Z/e)dbdCdcZ0e)d2e1eZ2dddeZ3ddfdgZ4dhdiZ5djdkZ6gZ7dldmZ8GdndodoedCdGZ9e9dCdGZ:GdpdqdqedCdGZ;e;dCdGZdvdwZ?Gdxddeej@ZAdZBdydzZCGd{d d eAd|ZBGd}d~d~ZDGdddZEGdddeAZFGdd d eGeGeFdZHGdddeAZIGddde jJeIdZJGdddedCdGZKeKdCdGZLdd3ZMddZNe jOe jPe jQe jReeefZSddd4ZTdd6ZUdd7ZVddZWdd8ZXGdddeAZYGdddeYd|ZZe j[Z[e\e drjGdddeBe-e j]dZ]ej^de\e drGddde]e.eBe-e0e.fe j_dZ_ej^de\e drGdddeBe-e j`dZ`Gddde`e-e jadZaej^dej^dGdddeBe-e jbdZbGdddebe-e jcdZcGdd'd'eZZdGdd&d&eZZeGdd%d%eZZfGdd$d$eZZgGdd#d#eZe-ZhGdd(d(eZe-Zie\e d"rGdd"d"ebe-e jjdZjnGdd"d"eZe-Zje jkZkGdddeBe-e jldZle\e dr*Gdddekebe-ele-e jmdZmej^de\e drRGdddeme-e jndZon"Gdddekebe-ele-e jndZoGdddeoe*e jpdZpe\e drGdddeme+eBe+e/fe jqdZqn,Gdddekebe+ele+eBe+e/fe jqdZqGdddeqe+e,fe jrdZre\e d"rhe\e drDGdddeje-eme-e jsdZsn"Gdddekeje-ele-e jsdZsn"Gdddekebe-ele-e jsdZsGdddese*e jtdZtGdddeseue jvdZvGdd-d-ewete*ewdZxGdd*d*ejyete*ejydZzGdd.d.e{epe*e{dZnGdd/d/e|eoe-e|dZ}Gdddekebe-e j~dZ~Gddde~e+eoe+e jdZGddde~eHe+e/feoeHe+e/feBe+e/fe jdZGdd!d!e~e/e jdZe\edrGdddeBe-ejdZnGdddeBe-Ze\edà r(GddńdeBe-ejdZej^dŃnej dddk rDedǃGdd+d+eere+e,fedZGdd,d,ejere+e,fejdZGdd)d)ejee*eufejdZe\ed˃ rej^d˃Gdd˄dejere+e,fejdZe\e d1 re jZne jZGdd1d1ece-eBe-e0e.fedZe\e d΃ rVGdd΄deae-eBe-e0fe jdZej^d΃e)ddCedэZGdd d eBeedZddԄZej dddkZdZdZGdddeZGdd0d0ed|Zdd5ZeZdZGdddeBe2ZGdddee1ZGdddeeZGdddZede_eejej<ede2eejdddZede2eejddddZGdddZede_eejej<dS(N)abstractmethodabstractproperty)WrapperDescriptorTypeMethodWrapperTypeMethodDescriptorTypeAnyCallableClassVarGenericOptionalTupleTypeTypeVarUnion AbstractSet GenericMeta ByteString ContainerContextManagerHashable ItemsViewIterableIteratorKeysViewMapping MappingViewMutableMappingMutableSequence MutableSetSequenceSized ValuesView Reversible SupportsAbs SupportsBytesSupportsComplex SupportsFloat SupportsInt SupportsRoundCounterDequeDict DefaultDictListSet FrozenSet NamedTuple GeneratorAnyStrcastget_type_hintsNewType no_type_checkno_type_check_decoratoroverloadText TYPE_CHECKINGcCs"tjdddkr|jS|jSdS)Nrr)rr)sys version_info __qualname____name__)xrC/usr/lib64/python3.6/typing.py _qualnamegsrEcCs&d}|jdr"||kr"|dd}|S)N _TypeAlias _ForwardRef _TypingBase_FinalTypingBase_)rFrGrHrI) startswith)ZnmZ whitelistrCrCrD _trim_nameos rMcsFeZdZdZddfdd ZddZddZd d Zd d ZZ S) TypingMetaF)_rootcs2|s tddjtt|pdtj||||S)NzCannot subclass %sz, z()) TypeErrorjoinmap _type_reprsuper__new__)clsnamebases namespacerO) __class__rCrDrUszTypingMeta.__new__cOsdS)NrC)selfargskwdsrCrCrD__init__szTypingMeta.__init__cCs|S)NrC)r[globalnslocalnsrCrCrD _eval_typeszTypingMeta._eval_typecCsdS)NrC)r[tvarsrCrCrD_get_type_varsszTypingMeta._get_type_varscCstt|}d|j|fS)Nz%s.%s)rMrE __module__)r[qnamerCrCrD__repr__s zTypingMeta.__repr__) rArdr@ _is_protocolrUr^rarcrf __classcell__rCrC)rZrDrNvs   rNcsHeZdZdZddZfddZddZdd Zd d Zd d Z Z S)rH __weakref__cOsdS)NrC)r[r\r]rCrCrDr^sz_TypingBase.__init__cs@t|dkr4t|dtr4t|dtr4td|tj|S)NrrrKzCannot subclass %r)len isinstancestrtuplerPrTrU)rVr\r])rZrCrDrUs   z_TypingBase.__new__cCs|S)NrC)r[r_r`rCrCrDrasz_TypingBase._eval_typecCsdS)NrC)r[rbrCrCrDrcsz_TypingBase._get_type_varscCs"t|}tt|}d|j|fS)Nz%s.%s)typerMrErd)r[rVrerCrCrDrfs z_TypingBase.__repr__cOstdt|dS)NzCannot instantiate %r)rPrn)r[r\r]rCrCrD__call__sz_TypingBase.__call__)ri) rArdr@ __slots__r^rUrarcrfrorhrCrC)rZrDrHs rHT) metaclassrOcs.eZdZfZddfdd ZddZZS)rIF)rOcs0tj|f||}|dkr |Std|dS)NTzCannot instantiate %r)rTrUrP)rVrOr\r]r[)rZrCrDrUsz_FinalTypingBase.__new__cCstt|jS)N)rMrnrA)r[rCrCrD __reduce__sz_FinalTypingBase.__reduce__)rArdr@rprUrrrhrCrC)rZrDrIsrI)rOcsPeZdZdZfddZddZd d Zd d Zd dZddZ ddZ Z S)rG__forward_arg____forward_code____forward_evaluated____forward_value__c sttj|t|ts$td|fyt|dd}Wn"tk rVtd|fYnX||_||_d|_ d|_ dS)Nz,Forward reference must be a string -- got %rzevalz1Forward reference must be an expression -- got %rF) rTr^rkrlrPcompile SyntaxErrorrsrtrurv)r[argcode)rZrCrDr^s  z_ForwardRef.__init__cCsf|j s||k r`|dkr*|dkr*i}}n|dkr8|}n |dkrD|}tt|j||d|_d|_|jS)Nz*Forward references must evaluate to types.T)ru _type_checkrwrtrv)r[r_r`rCrCrDras  z_ForwardRef._eval_typecCs&t|tstS|j|jko$|j|jkS)N)rkrGNotImplementedrsrv)r[otherrCrCrD__eq__s  z_ForwardRef.__eq__cCst|j|jfS)N)hashrsrv)r[rCrCrD__hash__sz_ForwardRef.__hash__cCs tddS)Nz4Forward references cannot be used with isinstance().)rP)r[objrCrCrD__instancecheck__sz_ForwardRef.__instancecheck__cCs tddS)Nz4Forward references cannot be used with issubclass().)rP)r[rVrCrCrD__subclasscheck__sz_ForwardRef.__subclasscheck__cCs d|jfS)Nz_ForwardRef(%r))rs)r[rCrCrDrf sz_ForwardRef.__repr__)rsrtrurv) rArdr@rpr^rarrrrrfrhrCrC)rZrDrGs rGc@sHeZdZdZddZddZd d Zd d Zd dZddZ ddZ dS)rFrWtype_var impl_type type_checkercCs||_||_||_||_dS)N)rWrrr)r[rWrrrrCrCrDr^sz_TypeAlias.__init__cCsd|jt|jfS)Nz%s[%s])rWrSr)r[rCrCrDrf,sz_TypeAlias.__repr__cCst|jtstd||jjrJt|trJt||jjsJtd||jft|trj||jk rjtd||j|j||j |j S)Nz#%s cannot be further parameterized.z&%s is not a valid substitution for %s.z%s cannot be re-parameterized.) rkrrrP__constraints__rn issubclassrZrWrr)r[Z parameterrCrCrD __getitem__/s    z_TypeAlias.__getitem__cCs&t|tstS|j|jko$|j|jkS)N)rkrFr}rWr)r[r~rCrCrDr;s z_TypeAlias.__eq__cCst|j|jfS)N)rrWr)r[rCrCrDr@sz_TypeAlias.__hash__cCs t|jtstdt||jS)Nzsz#TypeVar.__init__..zBound must be a type.) rTr^rA ValueErrorboolrrrPrjrmrr|r)r[rWrrrZ constraints)rZ)rrDr^s     zTypeVar.__init__cCs||kr|j|dS)N)append)r[rbrCrCrDrcszTypeVar._get_type_varscCs&|jr d}n|jrd}nd}||jS)N+-~)rrrA)r[prefixrCrCrDrf s zTypeVar.__repr__cCs tddS)Nz0Type variables cannot be used with isinstance().)rP)r[instancerCrCrDrszTypeVar.__instancecheck__cCs tddS)Nz0Type variables cannot be used with issubclass().)rP)r[rVrCrCrDrszTypeVar.__subclasscheck__)rArrrr) rArdr@rpr^rcrfrrrhrCrC)rZrDrs* TKTVTT_co)rV_coVT_coT_contra)rcCsd|dkr g}t|dr0t|ttfr0|j||St|tr`x$t|D]\}}||krD||SqDW|S)N _subs_tree)hasattrrkrrHrr enumerate)rzrbr\iZtvarrCrCrD _replace_arg)s   rc Cs|jdkr|S|j}g}x|jdk r6|j||j}qWg}x |jD]}|jt|||qDWx8|D]0}g}x"|jD]}|jt||j|qtW|}qdW|S)N)rr__args__r__parameters__) rVrbr\ZcurrentZ orig_chain tree_argsrzZoclsZ new_tree_argsrCrCrDrDs       rcsg}xn|D]f}t|tr0|jtkr0|j|jq t|trft|dkrf|dtkrf|j|ddq |j|q Wt |tt|krg}x(|D] }|kr|j|j |qW|}t |x>|D]6tt sqt fddhDr̈j qWtfdd|DS)NrrKc3s6|].}t|to|jdk st|to,t|VqdS)N)rkrrrnr)rZt2)t1rCrDrs z'_remove_dups_flatten..c3s|]}|kr|VqdS)NrC)rr) all_paramsrCrDrs) rkrrrextendrrmrjrsetremovernany) parametersparamspZ new_paramsrrC)rrrD_remove_dups_flattenes. "     rcCsX|jstdt|t|}t|j}||krTtd||kr@dndt|||fdS)Nz%s is not a generic classz0Too %s parameters for %s; actual %s, expected %sZmanyZfew)rrPrrj)rVrZalenZelenrCrCrD_check_generics rcs4tjtjjtjfdd}|S)Nc s*y ||Stk rYnX||S)N)rP)r\r])cachedfuncrCrDinners  z_tp_cache..inner) functools lru_cache _cleanupsr cache_clearwraps)rrrC)rrrD _tp_caches  rcseZdZdZdddfdd Zd d Zd d ZfddZfddZe ddZ d ddZ ddZ ddZ ddZddZZS)!rrrr __tree_hash__NF)rOcstj|||f|d|i}|dkrHd|_d|_d|_ttd|_|St|t sZt d|t kr~t |}t |dkr~|dSt||_||_||_|j}t|t rtt||_n t||_|S)NrOrzExpected parameters=rKr)r)rTrUrrrr frozensetrrkrmrPrrrjrr)rVroriginrOr\r[Z subs_tree)rZrCrDrUs*     z_Union.__new__cs^|jdkr|Stfdd|jD}t|j}||jkrN||jkrN|S|j||ddS)Nc3s|]}t|VqdS)N)ra)rr)r_r`rCrDrsz$_Union._eval_type..T)rO)rrmrarrZ)r[r_r`ev_args ev_originrC)r_r`rDras z_Union._eval_typecCs|jr|jrt|j|dS)N)rrrc)r[rbrCrCrDrcs z_Union._get_type_varscs<|jdkrtjS|j}t|ts.t|S|dj|S)Nr)rrTrfrrkrmr _tree_repr)r[tree)rZrCrDrfs    z_Union.__repr__cs`g}xB|ddD]2}t|ts0|jt|q|j|dj|qWtjddj|S)NrKrz[%s]z, )rkrmrrSrrTrfrQ)r[rarg_listrz)rZrCrDr s  z_Union._tree_reprcsl|fkrtdt|ts |f}|jdkr0dndtfdd|D}|tk r\t|||j||ddS)Nz Cannot take a Union of no types.z)Union[arg, ...]: each arg must be a type.z*Parameters to generic types must be types.c3s|]}t|VqdS)N)r|)rr)rrCrDr sz%_Union.__getitem__..T)rrO)rPrkrmrrrrZ)r[rrC)rrDrs   z_Union.__getitem__cCs>|tkr tSt|||}t|}t|dkr4|dStf|S)NrKr)rrrrj)r[rbr\rrCrCrDr%s  z_Union._subs_treecCs6t|tr|j|jkS|tk r*|j|kS||kSdS)N)rkrrrr)r[r~rCrCrDr.s    z _Union.__eq__cCs|jS)N)r)r[rCrCrDr6sz_Union.__hash__cCs tddS)Nz(Unions cannot be used with isinstance().)rP)r[rrCrCrDr9sz_Union.__instancecheck__cCs tddS)Nz(Unions cannot be used with issubclass().)rP)r[rVrCrCrDr<sz_Union.__subclasscheck__)rrrr)NN)NN)rArdr@rprUrarcrfrrrrrrrrrhrCrC)rZrDrs,    rc@seZdZfZeddZdS)rcCst|d}t|tdfS)Nz#Optional[t] requires a single type.)r|rrn)r[rzrCrCrDrKs z_Optional.__getitem__N)rArdr@rprrrCrCrCrDrCsrcCsJt}x@t|jddD]*\}}t|tr|jtkr|j|d}qW|S)NrK)objectr__mro__rkrrr )rVZ next_in_mrorcrCrCrD _next_in_mroTs rcs,tjtjrfdd}n fdd}|S)NcsZjj|}|tk r|Sj|jkr(dSx,jjD]}t|trDq4t||r4dSq4WtS)NT) __extra____subclasshook__r}r__subclasses__rkrr)subclassresscls)rVrCrD __extrahook__ks    z)_make_subclasshook..__extrahook__csjrt|jrdStS)NT)rrr})r)rVrCrDrys)rkrabcABCMeta)rVrrC)rVrD_make_subclasshookbs rcCs2t|}d|kr.x|dD]}|j|dqW|S)Nrp)dictpop)ZdctZ dict_copyZslotrCrCrD_no_slots_copys rcseZdZd fdd ZeddZejddZeddZejd dZd d Zd d Z fddZ fddZ d!ddZ ddZ ddZeddZfddZddZfddZZS)"rNc sX|dk r nt|}d} xF|D]>} | tkr0tdt| tr| jtkr| dk rTtd| j} qW| dkrl|} nPt|} t| | kstddjfdd|Ddjdd| Df| }|} |dk rt |t j kr||kr|f|}t dd|D}t d d|Dr t d d|D}|j|||s2dn|jd tj||||d d } tt| jd|sj| n|j|| _|rt dd|Dnd| _t| | _|dkr| | _d|kr|st| jdddkrt| | _t|t j r|j| _|j| _n|dk r|j| _|j| _|r2t|dr2|j| _|rDt| jn tt| j | _!| S)Nz!Cannot inherit from plain Genericz0Cannot inherit from Generic[...] multiple types.z6Some type variables (%s) are not listed in Generic[%s]z, c3s|]}|krt|VqdS)N)rl)rr)gvarsetrCrDrsz&GenericMeta.__new__..css|]}t|VqdS)N)rl)rgrCrCrDrscss"|]}t|tr|jn|VqdS)N)rkrr)rbrCrCrDrscss |]}t|to|tk VqdS)N)rkrr )rrrCrCrDrscss|]}|tk r|VqdS)N)r )rrrCrCrDrs)rrrT)rOrcss*|]"}|tkrdn|tkrfn|VqdS).N)_TypingEllipsis _TypingEmpty)rarCrCrDrsrrArr@)"rr rPrkrrrrrQrnrrrmrupdaterrTrU __setattr__rr__next_in_mro____orig_bases__rrr _abc_registry _abc_cacherr@rrrr)rVrWrXrYrbr\rextra orig_basesZgvarsbaseZtvarsetZ initial_basesr[)rZ)rrDrUsj           zGenericMeta.__new__cCst|jtjr|jjS|jjS)N)rkrrr_abc_negative_cacher_abc_generic_negative_cache)r[rCrCrDrszGenericMeta._abc_negative_cachecCs,|jdkr(t|jtjr"||j_n||_dS)N)rrkrrrrr)r[valuerCrCrDrs  cCst|jtjr|jjS|jjS)N)rkrrr_abc_negative_cache_versionr#_abc_generic_negative_cache_version)r[rCrCrDr sz'GenericMeta._abc_negative_cache_versioncCs,|jdkr(t|jtjr"||j_n||_dS)N)rrkrrrrr)r[rrCrCrDrs  cCs|jr|jrt|j|dS)N)rrrc)r[rbrCrCrDrcs zGenericMeta._get_type_varsc s|jr|jjnd}|jr8tfdd|jDnd}||jkrT||jkrT|S|j|j|jt|j|rtt |nd|||j |j dS)Nc3s|]}t|VqdS)N)ra)rr)r_r`rCrDrsz)GenericMeta._eval_type..)rbr\rrr) rrarrmrZrA __bases__r__dict__rrr)r[r_r`rrrC)r_r`rDras$zGenericMeta._eval_typecs"|jdkrtjS|j|jS)N)rrTrfrr)r[)rZrCrDrf+s  zGenericMeta.__repr__cstg}xV|ddD]F}|fkr*|jdqt|tsD|jt|q|j|dj|qWtjddj|S)NrKz()rz[%s]z, )rrkrmrSrrTrfrQ)r[rrrz)rZrCrDr0s  zGenericMeta._tree_reprcCs*|jdkr|St|||}|jft|S)N)rrrrm)r[rbr\rrCrCrDr;s  zGenericMeta._subs_treecCs6t|tstS|jdks"|jdkr*||kS|j|jkS)N)rkrr}rr)r[r~rCrCrDrAs  zGenericMeta.__eq__cCs|jS)N)r)r[rCrCrDrHszGenericMeta.__hash__c s6t|ts|f}| r0|jtk r0tdt|dtfdd|D}|tkrtdd|Dsltdtt |t|krtd|}|}nb|tt fkrt |}|}nH|t kr|}|}n6|j tt fkrtdt|nt||t |}|}|j dkr|fnf}|j|j||jt|j||||j|jd S) Nz)Parameter list to %s[...] cannot be emptyz*Parameters to generic types must be types.c3s|]}t|VqdS)N)r|)rr)rrCrDrSsz*GenericMeta.__getitem__..css|]}t|tVqdS)N)rkr)rrrCrCrDrVsz5Parameters to Generic[...] must all be type variablesz-Parameters to Generic[...] must all be uniquez'Cannot subscript already-subscripted %s)rbr\rrr)rkrmrrrPrEr allrjrr rrrrrrZrArrrrr)r[rrbr\ZprependrC)rrDrKsJ   zGenericMeta.__getitem__csJ|jdk r*tjdjddkr&tddS|tkr>td|tj|S) NrKrArrzCParameterized generics cannot be used with class or instance checksFz5Class %r cannot be used with class or instance checks)rr)rr> _getframe f_globalsrPr rTr)r[rV)rZrCrDrys zGenericMeta.__subclasscheck__cCs t|j|S)N)rrZ)r[rrCrCrDrszGenericMeta.__instancecheck__csT|jdr|jds(|jds(|jdkr.) rrrrTrrrkrmrjr|r)r[rr)rZ)rrDrs  zTupleMeta.__getitem__cCs |jdkrt|tStddS)Nz5Parameterized Tuple cannot be used with isinstance().)rrkrmrP)r[rrCrCrDrs  zTupleMeta.__instancecheck__cCs |jdkrt|tStddS)Nz5Parameterized Tuple cannot be used with issubclass().)rrrmrP)r[rVrCrCrDrs  zTupleMeta.__subclasscheck__)rArdr@rrrrrhrCrC)rZrDr sr c@seZdZfZddZdS)rcOs$|jtkrtdtt|f||S)Nz6Type Tuple cannot be instantiated; use tuple() instead)rrrPr rm)rVr\r]rCrCrDrU s z Tuple.__new__N)rArdr@rprUrCrCrCrDrs )rrqcsDeZdZfddZfddZfddZefddZZS) CallableMetacs"|jdkrtjS|j|jS)N)rrTrfrr)r[)rZrCrDrfs  zCallableMeta.__repr__cs|jtk rtj|Sg}xB|ddD]2}t|tsF|jt|q(|j|dj|q(W|ddkrt|dd|dSt|dddj |dd|dfS) NrKrz...z [..., %s]z [[%s], %s]z, rr) rr rTrrkrmrrSrrQ)r[rrrz)rZrCrDrs     zCallableMeta._tree_reprcs|jdk s|jtk r tj|St|t s8t|dkr@td|\}}|t krZt |f}n$t|t srtd|ft||f}|j |S)Nrz6Callable must be used as Callable[[arg, ...], result].z8Callable[args, result]: args must be a list. Got %.100r.) rrr rTrrkrmrjrPEllipsislist__getitem_inner__)r[rr\result)rZrCrDr*s     zCallableMeta.__getitem__cs^|\}}dt|}|tkr.tjt|fSdtfdd|D}||f}tj|S)Nz.Callable[args, result]: result must be a type.z6Callable[[arg, ...], result]: each arg must be a type.c3s|]}t|VqdS)N)r|)rrz)rrCrDrFsz1CallableMeta.__getitem_inner__..)r|r rTrrrm)r[rr\r)rZ)rrDr>s  zCallableMeta.__getitem_inner__) rArdr@rfrrrrrhrCrC)rZrDr s   r c@seZdZfZddZdS)r cOs&|jtkrtdt|j|f||S)NzIType Callable cannot be instantiated; use a non-abstract subclass instead)rr rPr r)rVr\r]rCrCrDrUXs zCallable.__new__N)rArdr@rprUrCrCrCrDr Ks csJeZdZdZdddZddZddZfd d Zd d Zd dZ Z S)r__type__NcKs ||_dS)N)r)r[tpr]rCrCrDr^rsz_ClassVar.__init__cCsPt|}|jdkr4|t|dj|jddddStdj|jdddS)Nz{} accepts only single type.rKT)rOz {} cannot be further subscripted)rnrr|formatrArP)r[itemrVrCrCrDrus z_ClassVar.__getitem__cCs,t|j||}||jkr|St||ddS)NT)rO)rarrn)r[r_r`Znew_tprCrCrDra~s z_ClassVar._eval_typecs,tj}|jdk r(|djt|j7}|S)Nz[{}])rTrfrrrS)r[r)rZrCrDrfs  z_ClassVar.__repr__cCstt|j|jfS)N)rrnrAr)r[rCrCrDrsz_ClassVar.__hash__cCs,t|tstS|jdk r$|j|jkS||kS)N)rkrr}r)r[r~rCrCrDrs    z_ClassVar.__eq__)r)N) rArdr@rpr^rrarfrrrhrCrC)rZrDr_s   rcCs|S)NrC)typvalrCrCrDr6sc Csy |j}Wntk riSX|j}|j}|d|}|jp@f}|j}|rTt|ni}|t|}x&t||d|D]\}} | ||<qxW|S)N) __code__r  co_argcount co_varnames __defaults____kwdefaults__rrjzip) rr{Z pos_countZ arg_namesdefaultsZ kwdefaultsrZ pos_offsetrWrrCrCrD _get_defaultss     rc Cst|ddriSt|tri}xt|jD]z}|dkrFtj|jj}n|}|jj di}xJ|j D]>\}}|dkrztd}t|t rt |}t |||}|||<qbWq*W|S|dkrt|tjr|j}n t|di}|dkr|}n |dkr|}t|dd}|dkr"t|triStdj|t|} t|}xp|j D]d\}}|dkrVtd}t|t rjt |}t |||}|| kr| |dkrt|}|||<qmodulesrdrgetitemsrlrGrar ModuleType_allowed_typesrPrrrr) rr_r`ZhintsrZ base_globalsZannrWrrrCrCrDr7sV            c Cst|tr||jj}x0|jjD]"\}}||j|fkr |j|q Wx4|jD](}t|tj rfd|_ t|trPt |qPWy d|_ Wnt k rYnX|S)NT) rkrnrcopyr&rrvaluesrrr r9rP)rzZ arg_attrsrrrrCrCrDr9s      cstjfdd}|S)Ncs||}t|}|S)N)r9)r\r]r) decoratorrCrDwrapped_decorator/s z2no_type_check_decorator..wrapped_decorator)rr)r+r,rC)r+rDr:(scOs tddS)NzYou should not call an overloaded function. A series of @overload-decorated functions outside a stub module should always be followed by an implementation that is not @overload-ed.)NotImplementedError)r\r]rCrCrD_overload_dummy8sr.cCstS)N)r.)rrCrCrDr;Ascs,eZdZfddZddZddZZS) _ProtocolMetacs"t|jkrtj|StddS)Nz+Protocols cannot be used with isinstance().)rrrTrrP)r[r)rZrCrDres  z_ProtocolMeta.__instancecheck__csL|js tS|tkrdS|j}x(|D] tfdd|jDs$dSq$WdS)NTc3s|]}|jkVqdS)N)r)rd)rrCrDrwsz2_ProtocolMeta.__subclasscheck__..F)rgr}r_get_protocol_attrsrr)r[rVattrsrC)rrDrjs z_ProtocolMeta.__subclasscheck__cCs,g}x.|jD]$}t|ddr |jdkr |j|q Wt}x|D]}x|jjD]}x|jD]&}||k r`||jkr`t|dd r`Pq`W|jd rT|dkrT|dkrT|dkrT|dkrT|dkrT|d krT|d krT|d krT|d krT|d krT|dkrT|dkrT|dkrT|dkrT|dkrT|dkrT|j|qTWqBW|S)NrgFrr__abstractmethods__r!rirrrrpr1rrrrrrrd) rrrArrrkeysrLadd)r[Zprotocol_basesrr2rrrCrCrDr1{s<   z!_ProtocolMeta._get_protocol_attrs)rArdr@rrr1rhrCrC)rZrDr/^s r/c@seZdZfZdZdS)rTN)rArdr@rprgrCrCrCrDrsr Awaitablec@seZdZfZdS)r6N)rArdr@rprCrCrCrDr6s)r Coroutinec@seZdZfZdS)r7N)rArdr@rprCrCrCrDr7s AsyncIterablec@seZdZfZdS)r8N)rArdr@rprCrCrCrDr8sc@seZdZfZdS) AsyncIteratorN)rArdr@rprCrCrCrDr9sr9c@seZdZfZdS)rN)rArdr@rprCrCrCrDrsc@seZdZfZdS)rN)rArdr@rprCrCrCrDrsc@s"eZdZfZeedddZdS)r*)returncCsdS)NrC)r[rCrCrD__int__szSupportsInt.__int__N)rArdr@rprintr;rCrCrCrDr*sc@s"eZdZfZeedddZdS)r))r:cCsdS)NrC)r[rCrCrD __float__szSupportsFloat.__float__N)rArdr@rprfloatr=rCrCrCrDr)sc@s"eZdZfZeedddZdS)r()r:cCsdS)NrC)r[rCrCrD __complex__szSupportsComplex.__complex__N)rArdr@rprcomplexr?rCrCrCrDr(sc@s"eZdZfZeedddZdS)r')r:cCsdS)NrC)r[rCrCrD __bytes__szSupportsBytes.__bytes__N)rArdr@rprbytesrArCrCrCrDr'sc@s"eZdZfZeedddZdS)r&)r:cCsdS)NrC)r[rCrCrD__abs__szSupportsAbs.__abs__N)rArdr@rprrrCrCrCrCrDr&sc@s&eZdZfZedeedddZdS)r+r)ndigitsr:cCsdS)NrC)r[rDrCrCrD __round__szSupportsRound.__round__N)r)rArdr@rprr<rrErCrCrCrDr+sc@seZdZfZdS)r%N)rArdr@rprCrCrCrDr% sc@s"eZdZfZeddddZdS)r%zIterator[T_co])r:cCsdS)NrC)r[rCrCrD __reversed__szReversible.__reversed__N)rArdr@rprrFrCrCrCrDr% sc@seZdZfZdS)rN)rArdr@rprCrCrCrDrs Collectionc@seZdZfZdS)rGN)rArdr@rprCrCrCrDrGsc@seZdZfZdS)rN)rArdr@rprCrCrCrDr'sc@seZdZfZdS)rN)rArdr@rprCrCrCrDr+sc@seZdZfZdS)r!N)rArdr@rprCrCrCrDr!0sc@seZdZfZdS)rN)rArdr@rprCrCrCrDr6sc@seZdZfZdS)rN)rArdr@rprCrCrCrDr:sc@seZdZfZdS)rN)rArdr@rprCrCrCrDr?sc@seZdZfZdS)r"N)rArdr@rprCrCrCrDr"Esc@seZdZfZdS)r"N)rArdr@rprCrCrCrDr"Isc@seZdZfZdS)r"N)rArdr@rprCrCrCrDr"Msc@seZdZfZdS)r N)rArdr@rprCrCrCrDr Rsc@seZdZfZdS)rN)rArdr@rprCrCrCrDrVsc@seZdZfZddZdS)r0cOs$|jtkrtdtt|f||S)Nz4Type List cannot be instantiated; use list() instead)rr0rPr r)rVr\r]rCrCrDrU^s z List.__new__N)rArdr@rprUrCrCrCrDr0Zsc@seZdZfZddZdS)r-cOs*|jtkrtj||Sttj|f||S)N)rr- collectionsdequer )rVr\r]rCrCrDrUis  z Deque.__new__N)rArdr@rprUrCrCrCrDr-esc@seZdZfZddZdS)r1cOs$|jtkrtdtt|f||S)Nz2Type Set cannot be instantiated; use set() instead)rr1rPr r)rVr\r]rCrCrDrUss z Set.__new__N)rArdr@rprUrCrCrCrDr1osc@seZdZfZddZdS)r2cOs$|jtkrtdtt|f||S)Nz>Type FrozenSet cannot be instantiated; use frozenset() instead)rr2rPr r)rVr\r]rCrCrDrU}s zFrozenSet.__new__N)rArdr@rprUrCrCrCrDr2zsc@seZdZfZdS)rN)rArdr@rprCrCrCrDrsc@seZdZfZdS)rN)rArdr@rprCrCrCrDrsc@seZdZfZdS)rN)rArdr@rprCrCrCrDrsc@seZdZfZdS)r$N)rArdr@rprCrCrCrDr$sAbstractContextManagerc@seZdZfZdS)rN)rArdr@rprCrCrCrDrsc@s2eZdZfZddZejddZeddZ dS)rcCs|S)NrC)r[rCrCrD __enter__szContextManager.__enter__cCsdS)NrC)r[exc_type exc_value tracebackrCrCrD__exit__szContextManager.__exit__cCs8|tkr4tdd|jDr4tdd|jDr4dStS)Ncss|]}d|jkVqdS)rKN)r)rBrCrCrDrsz2ContextManager.__subclasshook__..css|]}d|jkVqdS)rON)r)rrPrCrCrDrsT)rrrr})rVCrCrCrDrs zContextManager.__subclasshook__N) rArdr@rprKrrrO classmethodrrCrCrCrDrsAbstractAsyncContextManagerc@seZdZfZdS)AsyncContextManagerN)rArdr@rprCrCrCrDrTsrTa class AsyncContextManager(Generic[T_co]): __slots__ = () async def __aenter__(self): return self @abc.abstractmethod async def __aexit__(self, exc_type, exc_value, traceback): return None @classmethod def __subclasshook__(cls, C): if cls is AsyncContextManager: if sys.version_info[:2] >= (3, 6): return _collections_abc._check_methods(C, "__aenter__", "__aexit__") if (any("__aenter__" in B.__dict__ for B in C.__mro__) and any("__aexit__" in B.__dict__ for B in C.__mro__)): return True return NotImplemented __all__.append('AsyncContextManager') c@seZdZfZddZdS)r.cOs$|jtkrtdtt|f||S)Nz4Type Dict cannot be instantiated; use dict() instead)rr.rPr r)rVr\r]rCrCrDrUs z Dict.__new__N)rArdr@rprUrCrCrCrDr.sc@seZdZfZddZdS)r/cOs*|jtkrtj||Sttj|f||S)N)rr/rH defaultdictr )rVr\r]rCrCrDrUs  zDefaultDict.__new__N)rArdr@rprUrCrCrCrDr/sc@seZdZfZddZdS)r,cOs*|jtkrtj||Sttj|f||S)N)rr,rHr )rVr\r]rCrCrDrUs  zCounter.__new__N)rArdr@rprUrCrCrCrDr,sChainMapc@seZdZfZddZdS)rWcOs*|jtkrtj||Sttj|f||S)N)rrWrHr )rVr\r]rCrCrDrUs  zChainMap.__new__N)rArdr@rprUrCrCrCrDrWsc@seZdZfZddZdS)r4cOs$|jtkrtdtt|f||S)Nz@Type Generator cannot be instantiated; create a subclass instead)rr4rPr _G_base)rVr\r]rCrCrDrUs zGenerator.__new__N)rArdr@rprUrCrCrCrDr4 sAsyncGeneratorc@seZdZfZdS)rYN)rArdr@rprCrCrCrDrYsCT_co)rrc@seZdZfZdS)rN)rArdr@rprCrCrCrDr$sc svdfdd|D}tj|dd|D}tj||_|_ytjdjjdd|_ Wnt t fk rpYnX|S)NzDNamedTuple('Name', [(f0, t0), (f1, t1), ...]); each t must be a typecsg|]\}}|t|fqSrC)r|)rnr)rrCrD Asz!_make_nmtuple..cSsg|] \}}|qSrCrC)rr[rrCrCrDr\BsrrA__main__) rH namedtuple OrderedDictr! _field_typesr>rrr%rdr r)rWrnm_tplrC)rrD _make_nmtuple?srbrUr^rp__getnewargs___fields_field_defaultsr`_make_replace_asdict_sourcerdrAr@r!cseZdZfddZZS)NamedTupleMetac s|jddrtj||||Sts*td|jdi}t||j}g}i}xP|D]H}||krz||} |j| | ||<qR|rRtdj|dj |j dqRWt j ||j_ t||j_||_xD|D]<} | tkrtd| q| tko| |jkrt|| || qW|S) NrOFzKeyword syntax for NamedTuple is only supported in Python 3.6+zIEither list of fields or keywords can be provided to NamedTuple, not both)rlrPr&rb)r[rpZfieldskwargsrCrCrDrUs  zNamedTuple.__new__)N)rArdr@rOrUrCrCrCrDr3yscCsdd}||_||_|S)NcSs|S)NrC)rBrCrCrDnew_typeszNewType..new_type)rAZ __supertype__)rWrrtrCrCrDr8sFc@seZdZfZeedddZeedddZeddddZ ee dd d Z ee dd d Z eddd dZee dddZed6e edddZee dddZed8e edddZed:e eedddZed;e e e ddd Zee dd!d"Zee dd#d$ZedeZdZfZeeeefedddZ eddddZ dS)BinaryIO)rr:cCsdS)NrC)r[rrCrCrDr) szBinaryIO.write)r:cCsdS)NrC)r[rCrCrDrK- szBinaryIO.__enter__N) rArdr@rprrrB bytearrayr<rrKrCrCrCrDr$ s rc@seZdZfZeedddZeedddZee edddZ ee ddd Z ee dd d Zeddd d ZdS)TextIO)r:cCsdS)NrC)r[rCrCrDbuffer7 sz TextIO.buffercCsdS)NrC)r[rCrCrDencoding; szTextIO.encodingcCsdS)NrC)r[rCrCrDerrors? sz TextIO.errorscCsdS)NrC)r[rCrCrDline_bufferingC szTextIO.line_bufferingcCsdS)NrC)r[rCrCrDnewlinesG szTextIO.newlinescCsdS)NrC)r[rCrCrDrKK szTextIO.__enter__N)rArdr@rprrrrlrrrrrr rrrKrCrCrCrDr2 src@s"eZdZdddgZeZeZeZdS)iorurrN)rArdr@__all__rurrrCrCrCrDrP s rz.ioPatternrcCs|jS)N)pattern)rrCrCrD^ srMatchcCs|jjS)N)rer)mrCrCrDr` sc@seZdZddgZeZeZdS)rrrN)rArdr@rrrrCrCrCrDrc srz.re)rr)NN)NN)rrU)rr) rUr^rprcrdrer`rfrgrhri)rdrAr@r!)rrrrH contextlibrrZ stdlib_rer>rcollections.abcZcollections_abc ImportErrorr?_collections_abcrrr rnrr^__str__rlrQrrErMrNrHrIrGrFrcrrar|rSrr rZNoReturnrrrrrrrrrBr5rrrrrrrrrrrrrrrr r rrr rmrr r rr r6rrBuiltinFunctionType MethodTyper'r(r7r9r:r.r;r/rrrr6rr7r8r9rrr*r)r(r'r&r+r%r#rrGr1rr!rrr"r r<rrr0rIr-rrr2rrrr$rJrrSrTexecrr.rVr/r,rWr4rX GeneratorTyperYrZrrbrlrmrnrjr3r8r<r=rurrrrAr$rxrmatchrrCrCrCrDs   *%5C  W      !)    "96    R D                  "                   "      "(`     uu.cpython-36.opt-1.pyc000064400000006654152462730460010606 0ustar003 \k@sddZddlZddlZddlZdddgZGdddeZd ddZdd dZd d Z e d kr`e dS)zImplementation of the UUencode and UUdecode functions. encode(in_file, out_file [,name, mode]) decode(in_file [, out_file, mode]) NErrorencodedecodec@s eZdZdS)rN)__name__ __module__ __qualname__rr/usr/lib64/python3.6/uu.pyr'scCsBg}z|dkrtjj}n`t|trz|dkr8tjj|}|dkrfytj|j }Wnt k rdYnXt |d}|j ||dkrtj j}nt|trt |d}|j ||dkrd}|dkrd}|jd|d@|fjd|jd }x,t|d kr|jtj||jd }qW|jd Wdx|D]}|jq*WXdS) z Uuencode file-Nrbwbiz begin %o %s iascii-rs end )sysstdinbuffer isinstancestrospathbasenamestatst_modeAttributeErroropenappendstdoutwriterreadlenbinasciiZb2a_uuclose)in_fileout_filenamemode opened_filesdatafrrr r*s>           Fc Cs:g}|dkrtjj}nt|tr4t|d}|j|zxr|j}|sNtd|j dsZq:|j dd}t |dkr:|ddkr:yt |d d PWq:t k rYq:Xq:W|d kr|djd jd }tjj|rtd||d krt |d d }|dkr tjj}nNt|trXt|d}ytjj||Wntk rHYnX|}|j||j}x|r|jd dkrytj|} Wnjtjk r} zJ|ddd@ddd} tj|d | } |stjjd| WYd d } ~ XnX|j| |j}qbW|stdWd x|D]} | jq"WXd S)zDecode uuencoded filer r z'No valid begin line found in input filesbegin rNs r z"Cannot overwrite existing file: %sr send ?z Warning: %s zTruncated input file)rrrrrrrreadliner startswithsplitrint ValueErrorrstriprrrexistsrchmodrstripr Za2b_uustderrrr!) r"r#r%quietr&ZhdrZ hdrfieldsfpsr'vnbytesr(rrr rZsf              "   cCs4ddl}|jdd}|jddddd d d |jd d ddd d d |j\}}t|dkrl|jdtjdtjj }tj j }t|dkr|d}t|dkr|d}|j r|j rt |trt|d}nttjddtjdt ||nD|j r&t |tr t|d}nttjddtjdt||dS)zuuencode/uudecode main programrNz'usage: %prog [-d] [-t] [input [output]])Zusagez-dz--decoderzDecode (instead of encode)?F store_true)desthelpdefaultactionz-tz--texttextz2data is text, encoded format unix-compatible text?r*zincorrect number of argumentsr,r z: cannot do -t to stdoutr z: cannot do -t from stdin)optparseZ OptionParserZ add_option parse_argsrerrorrexitrrrrrFrrrprintargvr)rGparserZoptionsargsinputoutputrrr tests6              rQ__main__)NN)NNF) __doc__r rr__all__ ExceptionrrrrQrrrrr s  0 F&contextlib.cpython-36.pyc000064400000025630152462730460011364 0ustar003 \j3@sdZddlZddlZddlZddlmZddlmZddddd d d d gZGd ddej Z Gddde Z Gddde e Z ddZGddde ZGddde ZGdd d eZGdd d eZGdd d e ZGdd d e ZdS)z4Utilities for with-statement contexts. See PEP 343.N)deque)wrapscontextmanagerclosingAbstractContextManagerContextDecorator ExitStackredirect_stdoutredirect_stderrsuppressc@s2eZdZdZddZejddZeddZ dS) rz,An abstract base class for context managers.cCs|S)z0Return `self` upon entering the runtime context.)selfr r "/usr/lib64/python3.6/contextlib.py __enter__sz AbstractContextManager.__enter__cCsdS)z9Raise any exception triggered within the runtime context.Nr )r exc_type exc_value tracebackr r r__exit__szAbstractContextManager.__exit__cCs|tkrtj|ddStS)Nrr)r_collections_abc_check_methodsNotImplemented)clsCr r r__subclasshook__sz'AbstractContextManager.__subclasshook__N) __name__ __module__ __qualname____doc__rabcabstractmethodr classmethodrr r r rr sc@s eZdZdZddZddZdS)rzJA base class or mixin that enables context managers to work as decorators.cCs|S)a6Return a recreated instance of self. Allows an otherwise one-shot context manager like _GeneratorContextManager to support use as a decorator via implicit recreation. This is a private interface just for _GeneratorContextManager. See issue #11647 for details. r )r r r r _recreate_cm$s zContextDecorator._recreate_cmcstfdd}|S)Nc sj ||SQRXdS)N)r!)argskwds)funcr r rinner1s z(ContextDecorator.__call__..inner)r)r r$r%r )r$r r__call__0szContextDecorator.__call__N)rrrrr!r&r r r rr!s c@s0eZdZdZddZddZddZdd Zd S) _GeneratorContextManagerz%Helper for @contextmanager decorator.cCsJ||||_||||_|_|_t|dd}|dkr@t|j}||_dS)Nr)genr$r"r#getattrtyper)r r$r"r#docr r r__init__;s    z!_GeneratorContextManager.__init__cCs|j|j|j|jS)N) __class__r$r"r#)r r r rr!Isz%_GeneratorContextManager._recreate_cmc Cs.y t|jStk r(tddYnXdS)Nzgenerator didn't yield)nextr( StopIteration RuntimeError)r r r rrOs z"_GeneratorContextManager.__enter__cCs|dkr6yt|jWntk r*dSXtdn|dkrD|}y|jj|||Wntk r|}z||k Sd}~Xnftk r}z*||krdS|tkr|j|krdSWYdd}~Xn"tjd|krdSYnXtddS)NFzgenerator didn't stopz#generator didn't stop after throw())r.r(r/r0throw __cause__sysexc_info)r r*valuerexcr r rrUs. z!_GeneratorContextManager.__exit__N)rrrrr,r!rrr r r rr'8s r'cstfdd}|S)a@contextmanager decorator. Typical usage: @contextmanager def some_generator(): try: yield finally: This makes this: with some_generator() as : equivalent to this: try: = finally: cs t||S)N)r')r"r#)r$r rhelperszcontextmanager..helper)r)r$r8r )r$rrsc@s(eZdZdZddZddZddZdS) ra2Context to automatically close something at the end of a block. Code like this: with closing(.open()) as f: is equivalent to this: f = .open() try: finally: f.close() cCs ||_dS)N)thing)r r9r r rr,szclosing.__init__cCs|jS)N)r9)r r r rrszclosing.__enter__cGs|jjdS)N)r9close)r r5r r rrszclosing.__exit__N)rrrrr,rrr r r rrsc@s(eZdZdZddZddZddZdS)_RedirectStreamNcCs||_g|_dS)N) _new_target _old_targets)r new_targetr r rr,sz_RedirectStream.__init__cCs*|jjtt|jtt|j|j|jS)N)r=appendr)r4_streamsetattrr<)r r r rrsz_RedirectStream.__enter__cCstt|j|jjdS)N)rAr4r@r=pop)r exctypeexcinstexctbr r rrsz_RedirectStream.__exit__)rrrr@r,rrr r r rr;sr;c@seZdZdZdZdS)r aAContext manager for temporarily redirecting stdout to another file. # How to send help() to stderr with redirect_stdout(sys.stderr): help(dir) # How to write help() to a file with open('help.txt', 'w') as f: with redirect_stdout(f): help(pow) stdoutN)rrrrr@r r r rr s c@seZdZdZdZdS)r zCContext manager for temporarily redirecting stderr to another file.stderrN)rrrrr@r r r rr sc@s(eZdZdZddZddZddZdS) r a?Context manager to suppress specified exceptions After the exception is suppressed, execution proceeds with the next statement following the with statement. with suppress(FileNotFoundError): os.remove(somefile) # Execution still resumes here if the file was already removed cGs ||_dS)N) _exceptions)r exceptionsr r rr,szsuppress.__init__cCsdS)Nr )r r r rrszsuppress.__enter__cCs|dk ot||jS)N) issubclassrH)r rCrDrEr r rrs zsuppress.__exit__N)rrrrr,rrr r r rr s c@sPeZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ dS)raContext manager for dynamic management of a stack of exit callbacks For example: with ExitStack() as stack: files = [stack.enter_context(open(fname)) for fname in filenames] # All opened files will automatically be closed at the end of # the with statement, even if attempts to open files later # in the list raise an exception cCs t|_dS)N)r_exit_callbacks)r r r rr,szExitStack.__init__cCst|}|j|_t|_|S)z?Preserve the context stack by transferring it to a new instance)r*rKr)r new_stackr r rpop_alls zExitStack.pop_allcs"fdd}|_|j|dS)z:Helper to correctly register callbacks to __exit__ methodscsf|S)Nr ) exc_details)cmcm_exitr r _exit_wrappersz.ExitStack._push_cm_exit.._exit_wrapperN)__self__push)r rOrPrQr )rOrPr _push_cm_exitszExitStack._push_cm_exitc CsDt|}y |j}Wn tk r2|jj|YnX|j|||S)aRegisters a callback with the standard __exit__ method signature Can suppress exceptions the same way __exit__ methods can. Also accepts any object with an __exit__ method (registering a call to the method instead of the object itself) )r*rAttributeErrorrKr?rT)r exit_cb_type exit_methodr r rrS s   zExitStack.pushcs$fdd}|_|j|S)z\Registers an arbitrary callback and arguments. Cannot suppress exceptions. csdS)Nr )rr7tb)r"callbackr#r rrQ9sz)ExitStack.callback.._exit_wrapper) __wrapped__rS)r rZr"r#rQr )r"rZr#rrZ4s zExitStack.callbackcCs(t|}|j}|j|}|j|||S)zEnters the supplied context manager If successful, also pushes its __exit__ method as a callback and returns the result of the __enter__ method. )r*rrrT)r rO_cm_type_exitresultr r r enter_contextAs   zExitStack.enter_contextcCs|jddddS)z$Immediately unwind the context stackN)r)r r r rr:NszExitStack.closec s|ddk }tjdfdd}d}d}x\|jr|jj}y||rTd}d}d}Wq.tj}||d|dd}|}Yq.Xq.W|ry|dj}|dWn tk r||d_YnX|o|S)Nrr1cs8x,|j}||krdS|dks$|kr&P|}qW||_dS)N) __context__)new_excold_exc exc_context) frame_excr r_fix_exception_contextXsz2ExitStack.__exit__.._fix_exception_contextFT)NNN)r4r5rKrBr` BaseException) r rN received_excresuppressed_exc pending_raisecbnew_exc_details fixed_ctxr )rdrrRs2       zExitStack.__exit__N) rrrrr,rMrTrSrZr_r:rr r r rrs   )rrr4r collectionsr functoolsr__all__ABCrobjectrr'rrr;r r r rr r r rs$  I"macurl2path.cpython-36.opt-1.pyc000064400000003515152462730460012370 0ustar003 \ @s8dZddlZddlZddgZddZddZddZdS) zqMacintosh-specific module for conversion between pathnames and URLs. Do not import directly; use urllib instead.N url2pathname pathname2urlcCsttjj|d}|r$|dkr$td|dddkrB|dd}n|dddkrZtd|jd }d}x|t|kr||d kr||=qj||d kr|dkr||d dkr||d |d =|d }qj||d kr|dkr||d d kr||=qj|d }qjW|ds"dj|d d}nFd}x2|t|krX||d krXd ||<|d }q(Wddj|}tjj|S)z{OS-specific conversion from a relative URL of the 'file' scheme to a file system path; not recommended for general use.rfilez(Cannot convert non-local URL to pathnameNz///z///...:)r r )urllibparseZ splittype RuntimeErrorsplitlenjoinZunquote)pathnametp componentsirvr#/usr/lib64/python3.6/macurl2path.pyr s6    $  cCsd|krtd|jd}|ddkr,|d=|d dkr>|d =x(tt|D]}||dkrLd||<qLWtt|}tjj|rddj |Sdj |SdS) z{OS-specific conversion from a file system path to a relative URL of the 'file' scheme; not recommended for general use.rz*Cannot convert pathname containing slashesr rr r z..Nr) rrrangermap _pncomp2urlospathisabsr)rrrrrrr4s       cCstjj|ddddS)Nr )Zsafe)r rZquote)Z componentrrrrKsr)__doc__Z urllib.parser r__all__rrrrrrrs *difflib.cpython-36.pyc000064400000164374152462730460010621 0ustar003 \I @s8dZddddddddd d d d g Zd dlmZd dlmZed dZddZ GdddZ d8ddZ ddZ GdddZ d dlZejdjfddZd9ddZdd Zd:d#d Zd$d%Zd;d&dZd'd(Zd" lines in HTML files). That may be because this is the only method of the 3 that has a *concept* of "junk" . Example, comparing two strings, and considering blanks to be "junk": >>> s = SequenceMatcher(lambda x: x == " ", ... "private Thread currentThread;", ... "private volatile Thread currentThread;") >>> .ratio() returns a float in [0, 1], measuring the "similarity" of the sequences. As a rule of thumb, a .ratio() value over 0.6 means the sequences are close matches: >>> print(round(s.ratio(), 3)) 0.866 >>> If you're only interested in where the sequences match, .get_matching_blocks() is handy: >>> for block in s.get_matching_blocks(): ... print("a[%d] and b[%d] match for %d elements" % block) a[0] and b[0] match for 8 elements a[8] and b[17] match for 21 elements a[29] and b[38] match for 0 elements Note that the last tuple returned by .get_matching_blocks() is always a dummy, (len(a), len(b), 0), and this is the only case in which the last tuple element (number of elements matched) is 0. If you want to know how to change the first sequence into the second, use .get_opcodes(): >>> for opcode in s.get_opcodes(): ... print("%6s a[%d:%d] b[%d:%d]" % opcode) equal a[0:8] b[0:8] insert a[8:8] b[8:17] equal a[8:29] b[17:38] See the Differ class for a fancy human-friendly file differencer, which uses SequenceMatcher both to compare sequences of lines, and to compare sequences of characters within similar (near-matching) lines. See also function get_close_matches() in this module, which shows how simple code building on SequenceMatcher can be used to do useful work. Timing: Basic R-O is cubic time worst case and quadratic time expected case. SequenceMatcher is quadratic time for the worst case and has expected-case behavior dependent in a complicated way on how many elements the sequences have in common; best case time is linear. Methods: __init__(isjunk=None, a='', b='') Construct a SequenceMatcher. set_seqs(a, b) Set the two sequences to be compared. set_seq1(a) Set the first sequence to be compared. set_seq2(b) Set the second sequence to be compared. find_longest_match(alo, ahi, blo, bhi) Find longest matching block in a[alo:ahi] and b[blo:bhi]. get_matching_blocks() Return list of triples describing matching subsequences. get_opcodes() Return list of 5-tuples describing how to turn a into b. ratio() Return a measure of the sequences' similarity (float in [0,1]). quick_ratio() Return an upper bound on .ratio() relatively quickly. real_quick_ratio() Return an upper bound on ratio() very quickly. NTcCs(||_d|_|_||_|j||dS)a!Construct a SequenceMatcher. Optional arg isjunk is None (the default), or a one-argument function that takes a sequence element and returns true iff the element is junk. None is equivalent to passing "lambda x: 0", i.e. no elements are considered to be junk. For example, pass lambda x: x in " \t" if you're comparing lines as sequences of characters, and don't want to synch up on blanks or hard tabs. Optional arg a is the first of two sequences to be compared. By default, an empty string. The elements of a must be hashable. See also .set_seqs() and .set_seq1(). Optional arg b is the second of two sequences to be compared. By default, an empty string. The elements of b must be hashable. See also .set_seqs() and .set_seq2(). Optional arg autojunk should be set to False to disable the "automatic junk heuristic" that treats popular elements as junk (see module documentation for more information). N)isjunkabautojunkset_seqs)selfrrrrrrr__init__s; zSequenceMatcher.__init__cCs|j||j|dS)zSet the two sequences to be compared. >>> s = SequenceMatcher() >>> s.set_seqs("abcd", "bcde") >>> s.ratio() 0.75 N)set_seq1set_seq2)rrrrrrrs zSequenceMatcher.set_seqscCs$||jkrdS||_d|_|_dS)aMSet the first sequence to be compared. The second sequence to be compared is not changed. >>> s = SequenceMatcher(None, "abcd", "bcde") >>> s.ratio() 0.75 >>> s.set_seq1("bcde") >>> s.ratio() 1.0 >>> SequenceMatcher computes and caches detailed information about the second sequence, so if you want to compare one sequence S against many sequences, use .set_seq2(S) once and call .set_seq1(x) repeatedly for each of the other sequences. See also set_seqs() and set_seq2(). N)rmatching_blocksopcodes)rrrrrrs zSequenceMatcher.set_seq1cCs2||jkrdS||_d|_|_d|_|jdS)aMSet the second sequence to be compared. The first sequence to be compared is not changed. >>> s = SequenceMatcher(None, "abcd", "bcde") >>> s.ratio() 0.75 >>> s.set_seq2("abcd") >>> s.ratio() 1.0 >>> SequenceMatcher computes and caches detailed information about the second sequence, so if you want to compare one sequence S against many sequences, use .set_seq2(S) once and call .set_seq1(x) repeatedly for each of the other sequences. See also set_seqs() and set_seq1(). N)rrr fullbcount_SequenceMatcher__chain_b)rrrrrrs   zSequenceMatcher.set_seq2c Cs|j}i|_}x*t|D]\}}|j|g}|j|qWt|_}|j}|rx"|jD]}||r\|j |q\Wx|D] }||=q|Wt|_ }t |} |j r| dkr| dd} x*|j D]\}} t | | kr|j |qWx|D] }||=qWdS)Nd)rb2j enumerate setdefaultappendsetbjunkrkeysaddZbpopularlenritems) rrr&ieltindicesZjunkrZpopularnZntestZidxsrrrZ __chain_b)s,          zSequenceMatcher.__chain_bcCsN|j|j|j|jjf\}}}}||d} } } i} g} xt||D]}| j}i}xn|j||| D]Z}||krpqb||krzP||ddd}||<|| krb||d||d|} } } qbW|} qBWxb| |kr*| |kr*||| d r*|| d|| dkr*| d| d| d} } } qWxX| | |kr| | |kr||| |  r|| | || | kr| d7} q.Wxb| |kr| |kr||| dr|| d|| dkr| d| d| d} } } qWxV| | |kr@| | |kr@||| | r@|| | || | kr@| d} qWt| | | S)aFind longest matching block in a[alo:ahi] and b[blo:bhi]. If isjunk is not defined: Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where alo <= i <= i+k <= ahi blo <= j <= j+k <= bhi and for all (i',j',k') meeting those conditions, k >= k' i <= i' and if i == i', j <= j' In other words, of all maximal matching blocks, return one that starts earliest in a, and of all those maximal matching blocks that start earliest in a, return the one that starts earliest in b. >>> s = SequenceMatcher(None, " abcd", "abcd abcd") >>> s.find_longest_match(0, 5, 0, 9) Match(a=0, b=4, size=5) If isjunk is defined, first the longest matching block is determined as above, but with the additional restriction that no junk element appears in the block. Then that block is extended as far as possible by matching (only) junk elements on both sides. So the resulting block never matches on junk except as identical junk happens to be adjacent to an "interesting" match. Here's the same example as before, but considering blanks to be junk. That prevents " abcd" from matching the " abcd" at the tail end of the second sequence directly. Instead only the "abcd" can match, and matches the leftmost "abcd" in the second sequence: >>> s = SequenceMatcher(lambda x: x==" ", " abcd", "abcd abcd") >>> s.find_longest_match(0, 5, 0, 9) Match(a=1, b=0, size=4) If no blocks match, return (alo, blo, 0). >>> s = SequenceMatcher(None, "ab", "c") >>> s.find_longest_match(0, 2, 0, 1) Match(a=0, b=0, size=0) r r%)rrr&r+ __contains__rangegetr )raloahiblobhirrr&ZisbjunkZbestiZbestjZbestsizeZj2lenZnothingr0Zj2lengetZnewj2lenjkrrrfind_longest_matchPsB8$  "z"SequenceMatcher.find_longest_matchcCs|jdk r|jSt|jt|j}}d|d|fg}g}x|r|j\}}}}|j||||\} } } } | r:|j| || kr|| kr|j|| || f| | |kr:| | |kr:|j| | || | |fq:W|jd} }}g}x^|D]V\}}}| ||kr|||kr||7}q|r2|j| ||f|||} }}qW|r\|j| ||f|j||dftt t j ||_|jS)aReturn list of triples describing matching subsequences. Each triple is of the form (i, j, n), and means that a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in i and in j. New in Python 2.5, it's also guaranteed that if (i, j, n) and (i', j', n') are adjacent triples in the list, and the second is not the last triple in the list, then i+n != i' or j+n != j'. IOW, adjacent triples never describe adjacent equal blocks. The last triple is a dummy, (len(a), len(b), 0), and is the only triple with n==0. >>> s = SequenceMatcher(None, "abxcd", "abcd") >>> list(s.get_matching_blocks()) [Match(a=0, b=0, size=2), Match(a=3, b=2, size=2), Match(a=5, b=4, size=0)] Nr ) rr.rrpopr=r)sortlistmapr _make)rlalbZqueuerr7r8r9r:r0r;r<xi1j1Zk1Z non_adjacenti2j2Zk2rrrget_matching_blockss8    z#SequenceMatcher.get_matching_blockscCs|jdk r|jSd}}g|_}x|jD]\}}}d}||krP||krPd}n||kr^d}n ||krjd}|r|j|||||f||||}}|r,|jd||||fq,W|S)a[Return list of 5-tuples describing how to turn a into b. Each tuple is of the form (tag, i1, i2, j1, j2). The first tuple has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the tuple preceding it, and likewise for j1 == the previous j2. The tags are strings, with these meanings: 'replace': a[i1:i2] should be replaced by b[j1:j2] 'delete': a[i1:i2] should be deleted. Note that j1==j2 in this case. 'insert': b[j1:j2] should be inserted at a[i1:i1]. Note that i1==i2 in this case. 'equal': a[i1:i2] == b[j1:j2] >>> a = "qabxcd" >>> b = "abycdf" >>> s = SequenceMatcher(None, a, b) >>> for tag, i1, i2, j1, j2 in s.get_opcodes(): ... print(("%7s a[%d:%d] (%s) b[%d:%d] (%s)" % ... (tag, i1, i2, a[i1:i2], j1, j2, b[j1:j2]))) delete a[0:1] (q) b[0:0] () equal a[1:3] (ab) b[0:2] (ab) replace a[3:4] (x) b[2:3] (y) equal a[4:6] (cd) b[3:5] (cd) insert a[6:6] () b[5:6] (f) Nr rreplacedeleteinsertequal)r rJr))rr0r;Zansweraibjsizetagrrr get_opcodess$  zSequenceMatcher.get_opcodesc csr|j}|sdg}|dddkrZ|d\}}}}}|t||||t||||f|d<|dddkr|d\}}}}}||t||||t|||f|d<||}g} x|D]\}}}}}|dko|||kr(| j||t||||t|||f| Vg} t|||t|||}}| j|||||fqW| rnt| dkob| dddk rn| VdS) a Isolate change clusters by eliminating ranges with no changes. Return a generator of groups with up to n lines of context. Each group is in the same format as returned by get_opcodes(). >>> from pprint import pprint >>> a = list(map(str, range(1,40))) >>> b = a[:] >>> b[8:8] = ['i'] # Make an insertion >>> b[20] += 'x' # Make a replacement >>> b[23:28] = [] # Make a deletion >>> b[30] += 'y' # Make another replacement >>> pprint(list(SequenceMatcher(None,a,b).get_grouped_opcodes())) [[('equal', 5, 8, 5, 8), ('insert', 8, 8, 8, 9), ('equal', 8, 11, 9, 12)], [('equal', 16, 19, 17, 20), ('replace', 19, 20, 20, 21), ('equal', 20, 22, 21, 23), ('delete', 22, 27, 23, 23), ('equal', 27, 30, 23, 26)], [('equal', 31, 34, 27, 30), ('replace', 34, 35, 30, 31), ('equal', 35, 38, 31, 34)]] rNr r%N)rNr r%r r%rUrU)rSmaxminr)r.) rr3ZcodesrRrFrHrGrIZnngrouprrrget_grouped_opcodes<s(&&((z#SequenceMatcher.get_grouped_opcodescCs0tdd|jD}t|t|jt|jS)aReturn a measure of the sequences' similarity (float in [0,1]). Where T is the total number of elements in both sequences, and M is the number of matches, this is 2.0*M / T. Note that this is 1 if the sequences are identical, and 0 if they have nothing in common. .ratio() is expensive to compute if you haven't already computed .get_matching_blocks() or .get_opcodes(), in which case you may want to try .quick_ratio() or .real_quick_ratio() first to get an upper bound. >>> s = SequenceMatcher(None, "abcd", "bcde") >>> s.ratio() 0.75 >>> s.quick_ratio() 0.75 >>> s.real_quick_ratio() 1.0 css|]}|dVqdS)r%NrUr).0Ztriplerrr sz(SequenceMatcher.ratio..)sumrJrr.rr)rrrrrrationszSequenceMatcher.ratiocCs|jdkr8i|_}x"|jD]}|j|dd||<qW|j}i}|jd}}xH|jD]>}||rl||}n |j|d}|d||<|dkrV|d}qVWt|t|jt|jS)zReturn an upper bound on ratio() relatively quickly. This isn't defined beyond that it is an upper bound on .ratio(), and is faster to compute. Nr r%)r!rr6r4rrr.)rr!r1ZavailZavailhasrZnumbrrr quick_ratios         zSequenceMatcher.quick_ratiocCs*t|jt|j}}tt||||S)zReturn an upper bound on ratio() very quickly. This isn't defined beyond that it is an upper bound on .ratio(), and is faster to compute than either .ratio() or .quick_ratio(). )r.rrrrW)rrCrDrrrreal_quick_ratiosz SequenceMatcher.real_quick_ratio)NrrT)rT)__name__ __module__ __qualname____doc__rrrrr"r=rJrSrYr]r^r_rrrrr+sj @ ,'nG7 2rT333333?cCs|dkstd|fd|ko(dkns 0. Optional arg cutoff (default 0.6) is a float in [0, 1]. Possibilities that don't score at least that similar to word are ignored. The best (no more than n) matches among the possibilities are returned in a list, sorted by similarity score, most similar first. >>> get_close_matches("appel", ["ape", "apple", "peach", "puppy"]) ['apple', 'ape'] >>> import keyword as _keyword >>> get_close_matches("wheel", _keyword.kwlist) ['while'] >>> get_close_matches("Apple", _keyword.kwlist) [] >>> get_close_matches("accept", _keyword.kwlist) ['except'] r zn must be > 0: %rgg?z cutoff must be in [0.0, 1.0]: %rcSsg|] \}}|qSrr)rZZscorerErrr sz%get_close_matches..) ValueErrorrrrr_r^r]r) _nlargest)ZwordZ possibilitiesr3cutoffresultsrErrrrs       cCs4dt|}}x ||kr.|||kr.|d7}qW|S)z} Return number of `ch` characters at the start of `line`. Example: >>> _count_leading(' abc', ' ') 3 r r%)r.)linechr0r3rrr_count_leadings  rmc@sJeZdZdZdddZddZddZd d Zd d Zd dZ ddZ dS)ra Differ is a class for comparing sequences of lines of text, and producing human-readable differences or deltas. Differ uses SequenceMatcher both to compare sequences of lines, and to compare sequences of characters within similar (near-matching) lines. Each line of a Differ delta begins with a two-letter code: '- ' line unique to sequence 1 '+ ' line unique to sequence 2 ' ' line common to both sequences '? ' line not present in either input sequence Lines beginning with '? ' attempt to guide the eye to intraline differences, and were not present in either input sequence. These lines can be confusing if the sequences contain tab characters. Note that Differ makes no claim to produce a *minimal* diff. To the contrary, minimal diffs are often counter-intuitive, because they synch up anywhere possible, sometimes accidental matches 100 pages apart. Restricting synch points to contiguous matches preserves some notion of locality, at the occasional cost of producing a longer diff. Example: Comparing two texts. First we set up the texts, sequences of individual single-line strings ending with newlines (such sequences can also be obtained from the `readlines()` method of file-like objects): >>> text1 = ''' 1. Beautiful is better than ugly. ... 2. Explicit is better than implicit. ... 3. Simple is better than complex. ... 4. Complex is better than complicated. ... '''.splitlines(keepends=True) >>> len(text1) 4 >>> text1[0][-1] '\n' >>> text2 = ''' 1. Beautiful is better than ugly. ... 3. Simple is better than complex. ... 4. Complicated is better than complex. ... 5. Flat is better than nested. ... '''.splitlines(keepends=True) Next we instantiate a Differ object: >>> d = Differ() Note that when instantiating a Differ object we may pass functions to filter out line and character 'junk'. See Differ.__init__ for details. Finally, we compare the two: >>> result = list(d.compare(text1, text2)) 'result' is a list of strings, so let's pretty-print it: >>> from pprint import pprint as _pprint >>> _pprint(result) [' 1. Beautiful is better than ugly.\n', '- 2. Explicit is better than implicit.\n', '- 3. Simple is better than complex.\n', '+ 3. Simple is better than complex.\n', '? ++\n', '- 4. Complex is better than complicated.\n', '? ^ ---- ^\n', '+ 4. Complicated is better than complex.\n', '? ++++ ^ ^\n', '+ 5. Flat is better than nested.\n'] As a single multi-line string it looks like this: >>> print(''.join(result), end="") 1. Beautiful is better than ugly. - 2. Explicit is better than implicit. - 3. Simple is better than complex. + 3. Simple is better than complex. ? ++ - 4. Complex is better than complicated. ? ^ ---- ^ + 4. Complicated is better than complex. ? ++++ ^ ^ + 5. Flat is better than nested. Methods: __init__(linejunk=None, charjunk=None) Construct a text differencer, with optional filters. compare(a, b) Compare two sequences of lines; generate the resulting delta. NcCs||_||_dS)a Construct a text differencer, with optional filters. The two optional keyword parameters are for filter functions: - `linejunk`: A function that should accept a single string argument, and return true iff the string is junk. The module-level function `IS_LINE_JUNK` may be used to filter out lines without visible characters, except for at most one splat ('#'). It is recommended to leave linejunk None; the underlying SequenceMatcher class has an adaptive notion of "noise" lines that's better than any static definition the author has ever been able to craft. - `charjunk`: A function that should accept a string of length 1. The module-level function `IS_CHARACTER_JUNK` may be used to filter out whitespace characters (a blank or tab; **note**: bad idea to include newline in this!). Use of IS_CHARACTER_JUNK is recommended. N)linejunkcharjunk)rrnrorrrrMszDiffer.__init__c cst|j||}x|jD]\}}}}}|dkrD|j||||||} n\|dkr^|jd|||} nB|dkrx|jd|||} n(|dkr|jd|||} ntd|f| Ed HqWd S) a Compare two sequences of lines; generate the resulting delta. Each sequence must contain individual single-line strings ending with newlines. Such sequences can be obtained from the `readlines()` method of file-like objects. The delta generated also consists of newline- terminated strings, ready to be printed as-is via the writeline() method of a file-like object. Example: >>> print(''.join(Differ().compare('one\ntwo\nthree\n'.splitlines(True), ... 'ore\ntree\nemu\n'.splitlines(True))), ... end="") - one ? ^ + ore ? ^ - two - three ? - + tree + emu rKrL-rM+rN zunknown tag %rN)rrnrS_fancy_replace_dumprf) rrrcruncherrRr7r8r9r:grrrcomparedszDiffer.compareccs*x$t||D]}d|||fVq WdS)z4Generate comparison results for a same-tagged range.z%s %sN)r5)rrRrElohir0rrrrtsz Differ._dumpc cs||kr||kst||||krF|jd|||}|jd|||}n |jd|||}|jd|||}x||fD]} | EdHqpWdS)Nrqrp)AssertionErrorrt) rrr7r8rr9r:firstsecondrvrrr_plain_replaceszDiffer._plain_replaceccsHd\}}t|j} d\} } xt||D]} || } | j| xxt||D]j}||}|| krp| dkrH|| } } qH| j|| j|krH| j|krH| j|krH| j|| }}}qHWq&W||kr| dkr|j||||||EdHdS| | d}}}nd} |j ||||||EdH||||}}| dkrd}}| j ||x| j D]\}}}}}||||}}|dkr|d|7}|d|7}nb|dkr|d |7}nJ|d kr|d |7}n2|d kr|d |7}|d |7}nt d|fqTW|j ||||EdHn d|V|j ||d|||d|EdHdS)aL When replacing one block of lines with another, search the blocks for *similar* lines; the best-matching pair (if any) is used as a synch point, and intraline difference marking is done on the similar pair. Lots of work, but often worth it. Example: >>> d = Differ() >>> results = d._fancy_replace(['abcDefghiJkl\n'], 0, 1, ... ['abcdefGhijkl\n'], 0, 1) >>> print(''.join(results), end="") - abcDefghiJkl ? ^ ^ ^ + abcdefGhijkl ? ^ ^ ^ Gz??Ng?rrK^rLrprMrqrNrrzunknown tag %rz r%)r~r)NN)rror5rrr_r^r]r} _fancy_helperrrSrf_qformat)rrr7r8rr9r:Z best_ratiorhruZeqiZeqjr;rPr0rOZbest_iZbest_jZaeltZbeltatagsbtagsrRZai1Zai2Zbj1Zbj2rCrDrrrrssX                 zDiffer._fancy_replaceccsbg}||kr<||kr*|j||||||}qT|jd|||}n||krT|jd|||}|EdHdS)Nrprq)rsrt)rrr7r8rr9r:rvrrrrszDiffer._fancy_helperccstt|dt|d}t|t|d|d}t|t|d|d}||dj}||dj}d|V|rdd||fVd|V|rdd||fVdS)a Format "?" output and deal with leading tabs. Example: >>> d = Differ() >>> results = d._qformat('\tabcDefghiJkl\n', '\tabcdefGhijkl\n', ... ' ^ ^ ^ ', ' ^ ^ ^ ') >>> for line in results: print(repr(line)) ... '- \tabcDefghiJkl\n' '? \t ^ ^ ^\n' '+ \tabcdefGhijkl\n' '? \t ^ ^ ^\n'  Nrrz- z? %s%s z+ )rWrmrstrip)rZalineZblinerrcommonrrrr s    zDiffer._qformat)NN) r`rarbrcrrwrtr}rsrrrrrrrs\ )^ Nz \s*(?:#\s*)?$cCs ||dk S)z Return 1 for ignorable line: iff `line` is blank or contains a single '#'. Examples: >>> IS_LINE_JUNK('\n') True >>> IS_LINE_JUNK(' # \n') True >>> IS_LINE_JUNK('hello\n') False Nr)rkZpatrrrr>s cCs||kS)z Return 1 for ignorable character: iff `ch` is a space or tab. Examples: >>> IS_CHARACTER_JUNK(' ') True >>> IS_CHARACTER_JUNK('\t') True >>> IS_CHARACTER_JUNK('\n') False >>> IS_CHARACTER_JUNK('x') False r)rlZwsrrrrNscCs:|d}||}|dkr"dj|S|s.|d8}dj||S)z Convert range to the "ed" formatr%z{}z{},{})format)startstop beginningrrrr_format_range_unifiedes rr ccsht|||||||d}xHtd||j|D]0} |sd}|rJdj|nd} |r\dj|nd} dj|| |Vdj|| |V| d| d} } t| d | d }t| d | d }d j|||Vx| D]\}}}}}|dkrx|||D]}d|VqWq|dkr2x |||D]}d|VqW|dkrx |||D]}d|VqHWqWq.WdS)a Compare two sequences of lines; generate the delta as a unified diff. Unified diffs are a compact way of showing line changes and a few lines of context. The number of context lines is set by 'n' which defaults to three. By default, the diff control lines (those with ---, +++, or @@) are created with a trailing newline. This is helpful so that inputs created from file.readlines() result in diffs that are suitable for file.writelines() since both the inputs and outputs have trailing newlines. For inputs that do not have trailing newlines, set the lineterm argument to "" so that the output will be uniformly newline free. The unidiff format normally has a header for filenames and modification times. Any or all of these may be specified using strings for 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'. The modification times are normally expressed in the ISO 8601 format. Example: >>> for line in unified_diff('one two three four'.split(), ... 'zero one tree four'.split(), 'Original', 'Current', ... '2005-01-26 23:30:50', '2010-04-02 10:20:52', ... lineterm=''): ... print(line) # doctest: +NORMALIZE_WHITESPACE --- Original 2005-01-26 23:30:50 +++ Current 2010-04-02 10:20:52 @@ -1,4 +1,4 @@ +zero one -two -three +tree four FNTz {}rz --- {}{}{}z +++ {}{}{}r r%rTz@@ -{} +{} @@{}rNrrrKrLrprMrqrU>rLrK>rMrK) _check_typesrrYrr)rrfromfiletofile fromfiledate tofiledater3linetermstartedrXfromdatetodater{last file1_range file2_rangerRrFrHrGrIrkrrrr ps0)  cCsB|d}||}|s|d8}|dkr.dj|Sdj|||dS)z Convert range to the "ed" formatr%z{}z{},{})r)rrrrrrr_format_range_contexts rccst|||||||tddddd}d} xztd||j|D]b} | sd} |rZd j|nd } |rld j|nd } d j|| |Vd j|| |V| d | d} }d|Vt| d|d}dj||Vtdd| Dr&xD| D]<\}}}}}|dkrx$|||D]}|||Vq WqWt| d|d}dj||Vtdd| Dr>xH| D]@\}}}}}|dkr^x$|||D]}|||VqWq^Wq>WdS)ah Compare two sequences of lines; generate the delta as a context diff. Context diffs are a compact way of showing line changes and a few lines of context. The number of context lines is set by 'n' which defaults to three. By default, the diff control lines (those with *** or ---) are created with a trailing newline. This is helpful so that inputs created from file.readlines() result in diffs that are suitable for file.writelines() since both the inputs and outputs have trailing newlines. For inputs that do not have trailing newlines, set the lineterm argument to "" so that the output will be uniformly newline free. The context diff format normally has a header for filenames and modification times. Any or all of these may be specified using strings for 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'. The modification times are normally expressed in the ISO 8601 format. If not specified, the strings default to blanks. Example: >>> print(''.join(context_diff('one\ntwo\nthree\nfour\n'.splitlines(True), ... 'zero\none\ntree\nfour\n'.splitlines(True), 'Original', 'Current')), ... end="") *** Original --- Current *************** *** 1,4 **** one ! two ! three four --- 1,4 ---- + zero one ! tree four z+ z- z! z )rMrLrKrNFNTz {}rz *** {}{}{}z --- {}{}{}r r%z***************rz *** {} ****{}css |]\}}}}}|dkVqdS)rKrLN>rLrKr)rZrR_rrrr[szcontext_diff..rMrTrz --- {} ----{}css |]\}}}}}|dkVqdS)rKrMN>rMrKr)rZrRrrrrr[ srLrU)rdictrrYrrany)rrrrrrr3rprefixrrXrrr{rrrRrFrHrrkrrGrIrrrrs4,  cGs|r2t|dt r2tdt|dj|df|rdt|dt rdtdt|dj|dfx$|D]}t|tsjtd|fqjWdS)Nr z)lines to compare must be str, not %s (%r)z"all arguments must be str, not: %r) isinstancestr TypeErrortyper`)rrargsargrrrrs  r c csdd} tt| |}tt| |}| |}| |}| |}| |}| |}|||||||||} x| D]} | jddVqhWdS)a Compare `a` and `b`, two sequences of lines represented as bytes rather than str. This is a wrapper for `dfunc`, which is typically either unified_diff() or context_diff(). Inputs are losslessly converted to strings so that `dfunc` only has to worry about strings, and encoded back to bytes on return. This is necessary to compare files with unknown or inconsistent encoding. All other inputs (except `n`) must be bytes rather than str. cSsPy |jddStk rJ}z"dt|j|f}t||WYdd}~XnXdS)Nasciisurrogateescapez(all arguments must be bytes, not %s (%r))decodeAttributeErrorrr`r)rjerrmsgrrrr-s  zdiff_bytes..decoderrN)r@rAencode) Zdfuncrrrrrrr3rrlinesrkrrrr "s  cCst||j||S)aJ Compare `a` and `b` (lists of strings); return a `Differ`-style delta. Optional keyword parameters `linejunk` and `charjunk` are for filter functions, or can be None: - linejunk: A function that should accept a single string argument and return true iff the string is junk. The default is None, and is recommended; the underlying SequenceMatcher class has an adaptive notion of "noise" lines. - charjunk: A function that accepts a character (string of length 1), and returns true iff the character is junk. The default is the module-level function IS_CHARACTER_JUNK, which filters out whitespace characters (a blank or tab; note: it's a bad idea to include newline in this!). Tools/scripts/ndiff.py is a command-line front-end to this function. Example: >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True), ... 'ore\ntree\nemu\n'.splitlines(keepends=True)) >>> print(''.join(diff), end="") - one ? ^ + ore ? ^ - two - three ? - + tree + emu )rrw)rrrnrorrrr@s#c #sddl}|jdt||||ddgffdd fddfdd }|}|dkrj|EdHn.|d 7}d}xddg|} } d } xR| d kryt|\} } } Wntk rdSX| |}| | | f| |<| d 7} qW| |krd V|}n| }d} x.|r.| |}| d 7} | |V|d 8}qW|d }yDx>|rxt|\} } } | r`|d }n|d 8}| | | fVq._make_line..record_sub_inforr)r>subreversed) rZ format_keysideZ num_linestextZmarkersrrkeyZbeginend) change_rerr _make_lines   4z_mdiff.._make_linec3sg}d\}}xlx t|dkr0|jtdqWdjdd|D}|jdrX|}n|jdr|dd|dd d fVqn|jd r|d 8}|d dd d fVqnl|jdrވ|d dd }}|d d}}n>|jdr |d d|dd d fVqn|jdr8|dd|d d d fVqn|jd rd|d 8}|d dd d fVqn|jdr|d 7}d |dd d fVqn|jdrd |dd }}|d d}}n^|jdr|d 7}d |dd d fVqn2|jdr|d d d d|d d dfVqx|dkr:|d 7}dVqWx|dkrZ|d 8}d Vq>W|jdrld S||d fVqWd S)!aYields from/to lines of text with a change indication. This function is an iterator. It itself pulls lines from a differencing iterator, processes them and yields them. When it can it yields both a "from" and a "to" line, otherwise it will yield one or the other. In addition to yielding the lines of from/to text, a boolean flag is yielded to indicate if the text line(s) have differences in them. Note, this function is purposefully not defined at the module scope so that data it needs from its parent function (within whose context it is defined) does not need to be of module scope. r rXrcSsg|] }|dqS)r r)rZrkrrrresz2_mdiff.._line_iterator..z-?+?rr%Tz--++rpN--?+--+- z-+?z-?+z+--rq+ +-rrFr)r r )rrr)rrrr)NrTrr)rNT)r.r)nextjoin startswith)rZnum_blanks_pendingZnum_blanks_to_yieldrj from_lineto_line)rdiff_lines_iteratorrr_line_iteratorsf           $     z_mdiff.._line_iteratorc 3s}gg}}xxpt|dks,t|dkryt|\}}}Wntk rRdSX|dk rj|j||f|dk r|j||fqW|jd\}}|jd\}}|||p|fVqWdS)atYields from/to lines of text with a change indication. This function is an iterator. It itself pulls lines from the line iterator. Its difference from that iterator is that this function always yields a pair of from/to text lines (with the change indication). If necessary it will collect single from/to lines until it has a matching pair from/to pair to yield. Note, this function is purposefully not defined at the module scope so that data it needs from its parent function (within whose context it is defined) does not need to be of module scope. r N)r.r StopIterationr)r>)Z line_iterator fromlinestolinesrr found_diffZfromDiffZto_diff)rrr_line_pair_iterators  z#_mdiff.._line_pair_iteratorr%F)NNN)recompilerrr)rrcontextrnrorrZline_pair_iteratorZlines_to_writeindexZ contextLinesrrrr0r)rrrrr_mdiffesT" 8X !     ran %(table)s%(legend)s aH table.diff {font-family:Courier; border:medium;} .diff_header {background-color:#e0e0e0} td.diff_header {text-align:right} .diff_next {background-color:#c0c0c0} .diff_add {background-color:#aaffaa} .diff_chg {background-color:#ffff77} .diff_sub {background-color:#ffaaaa}aZ %(header_row)s %(data_rows)s
a
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op
c@seZdZdZeZeZeZeZdZddde fddZ dd d d d Z ddZ ddZ ddZddZddZddZddZdddZdS) r a{For producing HTML side by side comparison with change highlights. This class can be used to create an HTML table (or a complete HTML file containing the table) showing a side by side, line by line comparison of text with inter-line and intra-line change highlights. The table can be generated in either full or contextual difference mode. The following methods are provided for HTML generation: make_table -- generates HTML for a single side by side table make_file -- generates complete HTML file with a single side by side table See tools/scripts/diff.py for an example usage of this class. r NcCs||_||_||_||_dS)aHtmlDiff instance initializer Arguments: tabsize -- tab stop spacing, defaults to 8. wrapcolumn -- column number where lines are broken and wrapped, defaults to None where lines are not wrapped. linejunk,charjunk -- keyword arguments passed into ndiff() (used by HtmlDiff() to generate the side by side HTML differences). See ndiff() documentation for argument default values and descriptions. N)_tabsize _wrapcolumn _linejunk _charjunk)rtabsizeZ wrapcolumnrnrorrrrs zHtmlDiff.__init__rFzutf-8)charsetc Cs:|jt|j|j|j||||||d|dj|dj|S)aReturns HTML file of side by side comparison with change highlights Arguments: fromlines -- list of "from" lines tolines -- list of "to" lines fromdesc -- "from" file column header string todesc -- "to" file column header string context -- set to True for contextual differences (defaults to False which shows full differences). numlines -- number of context lines. When context is set True, controls number of lines displayed before and after the change. When context is False, controls the number of lines to place the "next" link anchors before the next change (so click of "next" link jumps to just before the change). charset -- charset of the HTML document )rnumlines)ZstylesZlegendtablerxmlcharrefreplace)_file_templater_styles_legend make_tablerr)rrrfromdesctodescrrrrrr make_files  zHtmlDiff.make_filecs8fddfdd|D}fdd|D}||fS)aReturns from/to line lists with tabs expanded and newlines removed. Instead of tab characters being replaced by the number of spaces needed to fill in to the next tab stop, this function will fill the space with tab characters. This is done so that the difference algorithms can identify changes in a file when tabs are replaced by spaces and vice versa. At the end of the HTML generation, the tab characters will be replaced with a nonbreakable space. cs6|jdd}|jj}|jdd}|jddjdS)Nrrrrr)rK expandtabsrr)rk)rrr expand_tabss   z2HtmlDiff._tab_newline_replace..expand_tabscsg|] }|qSrr)rZrk)rrrresz1HtmlDiff._tab_newline_replace..csg|] }|qSrr)rZrk)rrrresr)rrrr)rrr_tab_newline_replaces zHtmlDiff._tab_newline_replacec Cs|s|j||fdSt|}|j}||ksB||jdd|krT|j||fdSd}d}d}xd||kr||kr||dkr|d7}||}|d7}qb||dkr|d7}d}qb|d7}|d7}qbW|d|} ||d} |r| d} d|| } |j|| f|j|d| dS) aBuilds list of text lines by splitting text lines at wrap point This function will determine if the input text line needs to be wrapped (split) into separate lines. If so, the first wrap point will be determined and the first line appended to the output text line list. This function is used recursively to handle the second part of the split line to further split it. NrrTr rr%r>)r)r.rcount _split_line) rZ data_listZline_numrrQrVr0r3ZmarkZline1Zline2rrrrs8        zHtmlDiff._split_linec csx|D]\}}}|dkr&|||fVq||\}}\}}gg} } |j| |||j| ||x@| sh| r| rx| jd}nd}| r| jd}nd}|||fVq`WqWdS)z5Returns iterator that splits (wraps) mdiff text linesNr rrr)rrr)rrr)rr>) rdiffsfromdatatodataflagZfromlineZfromtextZtolineZtotextfromlisttolistrrr _line_wrapper;s      zHtmlDiff._line_wrapperc Csggg}}}xz|D]r\}}}y4|j|jd|f||j|jd|f|Wn(tk r||jd|jdYnX|j|qW|||fS)zCollects mdiff output into separate lists Before storing the mdiff from/to data into a list, it is converted into a single line of text with HTML markup. r r%N)r) _format_liner)rrrrflaglistrrrrrr_collect_linesWs zHtmlDiff._collect_linesc Csryd|}d|j||f}Wntk r6d}YnX|jddjddjdd }|jd d j}d |||fS) aReturns HTML markup of "from" / "to" text lines side -- 0 or 1 indicating "from" or "to" text flag -- indicates if difference on line linenum -- line number (used for line number column) text -- line text to be marked up z%dz id="%s%s"r&z&rz>%s%s)_prefixrrKr)rrrZlinenumridrrrrls zHtmlDiff._format_linecCs0dtj}dtj}tjd7_||g|_dS)zCreate unique anchor prefixeszfrom%d_zto%d_r%N)r _default_prefixr)rZ fromprefixtoprefixrrr _make_prefixs  zHtmlDiff._make_prefixcCs|jd}dgt|}dgt|}d \} } d} xbt|D]V\} } | r| sd} | } td| |g} d|| f|| <| d7} d|| f|| <qnz2 No Differences Found z( Empty File z!fz#t)r F)rr.r'rV)rrrrrrrnext_id next_hrefZnum_chgZ in_changerr0rrrr_convert_flagss:    zHtmlDiff._convert_flagsc CsV|j|j||\}}|r"|}nd}t||||j|jd}|jrL|j|}|j|\} } } |j| | | ||\} } } } } g}d}x`t t | D]P}| |dkr|dkr|j dq|j || || || || || |fqW|s|rddd |dd |f}nd }|j t d j|||jd d }|jd djddjddjddjddS)aReturns HTML table of side by side comparison with change highlights Arguments: fromlines -- list of "from" lines tolines -- list of "to" lines fromdesc -- "from" file column header string todesc -- "to" file column header string context -- set to True for contextual differences (defaults to False which shows full differences). numlines -- number of context lines. When context is set True, controls number of lines displayed before and after the change. When context is False, controls the number of lines to place the "next" link anchors before the next change (so click of "next" link jumps to just before the change). N)rnroz1 %s%sz%%s%s r z) z %s%s%s%sz!
z+%srr%)Z data_rows header_rowrz+zz-zz^zrzrz zV %s%s%s%s )rrrrrrrrrr5r.r)_table_templaterrrrK)rrrrrrrZ context_linesrrrrrrrjZfmtr0rrrrrrsJ       zHtmlDiff.make_table)rrFr)rrFr)r`rarbrcrrrrrrrrrrrrrrrrrrrrr s& 7 /c cspydddt|}Wn tk r6td|YnXd|f}x*|D]"}|dd|krF|ddVqFWdS)a0 Generate one of the two sequences that generated a delta. Given a `delta` produced by `Differ.compare()` or `ndiff()`, extract lines originating from file 1 or 2 (parameter `which`), stripping off line prefixes. Examples: >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True), ... 'ore\ntree\nemu\n'.splitlines(keepends=True)) >>> diff = list(diff) >>> print(''.join(restore(diff, 1)), end="") one two three >>> print(''.join(restore(diff, 2)), end="") ore tree emu z- z+ )r%rz)unknown delta choice (must be 1 or 2): %rz Nr)intKeyErrorrf)ZdeltaZwhichrRprefixesrkrrrr s cCsddl}ddl}|j|S)Nr )doctestdifflibZtestmod)r r rrr_test,sr __main__)rTrd)r)rrrrrTr)rrrrrTr)rrrrrTr)$rc__all__heapqrrg collectionsrZ _namedtupler rrrrmrrrmatchrrrr rrrr rrrrrrobjectr rr r`rrrrs^     0O   H  K % !  a  selectors.cpython-36.pyc000064400000042443152462730460011215 0ustar003 \K@sdZddlmZmZddlmZmZddlZddlZddl Z d)Z d*Z ddZ edd d d d gZ d e _e jd+krde j_de j_de j_de j_GdddeZGdddedZGdddeZGdddeZeedrGdddeZeed rGd!d"d"eZeed#r"Gd$d%d%eZeed&r>Gd'd(d(eZd(ekrPeZn:d"ekrbeZn(d%ekrteZndekreZneZdS),z|Selectors module. This module allows high-level and efficient I/O multiplexing, built upon the `select` module primitives. )ABCMetaabstractmethod) namedtupleMappingNc Csft|tr|}nsz_SelectorMapping.__init__cCs t|jjS)N)lenr _fd_to_key)rrrr__len__Asz_SelectorMapping.__len__c CsBy|jj|}|jj|Stk r<tdj|dYnXdS)Nz{!r} is not registered)r_fileobj_lookuprKeyErrorr )rrrrrr __getitem__Ds   z_SelectorMapping.__getitem__cCs t|jjS)N)iterrr)rrrr__iter__Ksz_SelectorMapping.__iter__N)__name__ __module__ __qualname____doc__rrr!r#rrrrr;s rc@sneZdZdZedddZeddZdddZedd d Zd d Z d dZ eddZ ddZ ddZ dS) BaseSelectora-Selector abstract base class. A selector supports registering file objects to be monitored for specific I/O events. A file object is a file descriptor or any object with a `fileno()` method. An arbitrary object can be attached to the file object, which can be used for example to store context information, a callback, etc. A selector can use various implementations (select(), poll(), epoll()...) depending on the platform. The default `Selector` class uses the most efficient implementation on the current platform. NcCstdS)a3Register a file object. Parameters: fileobj -- file object or file descriptor events -- events to monitor (bitwise mask of EVENT_READ|EVENT_WRITE) data -- attached data Returns: SelectorKey instance Raises: ValueError if events is invalid KeyError if fileobj is already registered OSError if fileobj is closed or otherwise is unacceptable to the underlying system call (if a system call is made) Note: OSError may or may not be raised N)NotImplementedError)rrrrrrrregister^szBaseSelector.registercCstdS)ajUnregister a file object. Parameters: fileobj -- file object or file descriptor Returns: SelectorKey instance Raises: KeyError if fileobj is not registered Note: If fileobj is registered but has since been closed this does *not* raise OSError (even if the wrapped syscall does) N)r))rrrrr unregisteruszBaseSelector.unregistercCs|j||j|||S)ayChange a registered file object monitored events or attached data. Parameters: fileobj -- file object or file descriptor events -- events to monitor (bitwise mask of EVENT_READ|EVENT_WRITE) data -- attached data Returns: SelectorKey instance Raises: Anything that unregister() or register() raises )r+r*)rrrrrrrmodifys zBaseSelector.modifycCstdS)aqPerform the actual selection, until some monitored file objects are ready or a timeout expires. Parameters: timeout -- if timeout > 0, this specifies the maximum wait time, in seconds if timeout <= 0, the select() call won't block, and will report the currently ready file objects if timeout is None, select() will block until a monitored file object becomes ready Returns: list of (key, events) for ready file objects `events` is a bitwise mask of EVENT_READ|EVENT_WRITE N)r))rtimeoutrrrselectszBaseSelector.selectcCsdS)zmClose the selector. This must be called to make sure that any underlying resource is freed. Nr)rrrrcloseszBaseSelector.closec CsJ|j}|dkrtdy||Stk rDtdj|dYnXdS)zzReturn the key associated to a registered file object. Returns: SelectorKey for this file object NzSelector is closedz{!r} is not registered)get_map RuntimeErrorr r )rrmappingrrrget_keyszBaseSelector.get_keycCstdS)z2Return a mapping of file objects to selector keys.N)r))rrrrr0szBaseSelector.get_mapcCs|S)Nr)rrrr __enter__szBaseSelector.__enter__cGs |jdS)N)r/)rargsrrr__exit__szBaseSelector.__exit__)N)N)N)r$r%r&r'rr*r+r,r.r/r3r0r4r6rrrrr(Os      r() metaclassc@sTeZdZdZddZddZdddZd d Zdd d Zd dZ ddZ ddZ dS)_BaseSelectorImplzBase selector implementation.cCsi|_t||_dS)N)rr_map)rrrrrsz_BaseSelectorImpl.__init__c CsHyt|Stk rBx"|jjD]}|j|kr$|jSq$WYnXdS)alReturn a file descriptor from a file object. This wraps _fileobj_to_fd() to do an exhaustive search in case the object is invalid but we still have it in our map. This is used by unregister() so we can unregister an object that was previously registered even if it is closed. It is also used by _SelectorMapping. N)rr rvaluesrr)rrkeyrrrrs   z!_BaseSelectorImpl._fileobj_lookupNcCsd| s|ttB@r"tdj|t||j|||}|j|jkrTtdj||j||j|j<|S)NzInvalid events: {!r}z"{!r} (FD {}) is already registered) EVENT_READ EVENT_WRITEr r rrrrr )rrrrr;rrrr*s   z_BaseSelectorImpl.registerc Cs@y|jj|j|}Wn$tk r:tdj|dYnX|S)Nz{!r} is not registered)rpoprr r )rrr;rrrr+s z_BaseSelectorImpl.unregisterc Csy|j|j|}Wn$tk r8tdj|dYnX||jkr^|j||j|||}n"||jkr|j|d}||j|j <|S)Nz{!r} is not registered)r) rrr r rr+r*r_replacer)rrrrr;rrrr,s     z_BaseSelectorImpl.modifycCs|jjd|_dS)N)rclearr9)rrrrr/ s z_BaseSelectorImpl.closecCs|jS)N)r9)rrrrr0sz_BaseSelectorImpl.get_mapc Cs$y |j|Stk rdSXdS)zReturn the key associated to a given file descriptor. Parameters: fd -- file descriptor Returns: corresponding key, or None if not found N)rr )rrrrr _key_from_fds  z_BaseSelectorImpl._key_from_fd)N)N) r$r%r&r'rrr*r+r,r/r0rArrrrr8s  r8cs`eZdZdZfddZdfdd ZfddZejd krHdd d Z ne j Z dd d Z Z S)SelectSelectorzSelect-based selector.cstjt|_t|_dS)N)superrset_readers_writers)r) __class__rrr%s zSelectSelector.__init__Ncs@tj|||}|t@r&|jj|j|t@r<|jj|j|S)N)rCr*r<rEaddrr=rF)rrrrr;)rGrrr**s zSelectSelector.registercs,tj|}|jj|j|jj|j|S)N)rCr+rEdiscardrrF)rrr;)rGrrr+2s zSelectSelector.unregisterZwin32cCs$tj||||\}}}|||gfS)N)r.)rrw_r-xrrr_select9szSelectSelector._selectc Cs|dkr dnt|d}g}y|j|j|jg|\}}}Wntk rL|SXt|}t|}xV||BD]J}d}||kr|tO}||kr|tO}|j|}|rh|j |||j @fqhW|S)Nr) maxrNrErFInterruptedErrorrDr<r=rAappendr) rr-readyrJrKrLrrr;rrrr.?s$ zSelectSelector.select)N)N)N) r$r%r&r'rr*r+sysplatformrNr. __classcell__rr)rGrrB"s    rBpollcsDeZdZdZfddZd fdd ZfddZd d d ZZS) PollSelectorzPoll-based selector.cstjtj|_dS)N)rCrr.rV_poll)r)rGrrrZs zPollSelector.__init__NcsLtj|||}d}|t@r&|tjO}|t@r8|tjO}|jj|j||S)Nr) rCr*r<r.POLLINr=POLLOUTrXr)rrrrr; poll_events)rGrrr*^s  zPollSelector.registercstj|}|jj|j|S)N)rCr+rXr)rrr;)rGrrr+hs zPollSelector.unregisterc Cs|dkrd}n|dkrd}ntj|d}g}y|jj|}Wntk rR|SXx^|D]V\}}d}|tj@rz|tO}|tj@r|t O}|j |}|rZ|j |||j @fqZW|S)Nrg@@) mathceilrXrVrPr.rYr=rZr<rArQr)rr-rR fd_event_listreventrr;rrrr.ms(   zPollSelector.select)N)N) r$r%r&r'rr*r+r.rUrr)rGrrWWs   rWepollcsXeZdZdZfddZddZdfdd Zfd d Zdd d Zfd dZ Z S) EpollSelectorzEpoll-based selector.cstjtj|_dS)N)rCrr.r`_epoll)r)rGrrrs zEpollSelector.__init__cCs |jjS)N)rbr )rrrrr szEpollSelector.filenoNc sttj|||}d}|t@r&|tjO}|t@r8|tjO}y|jj|j|Wn"t k rntj |YnX|S)Nr) rCr*r<r.EPOLLINr=EPOLLOUTrbr BaseExceptionr+)rrrrr;Z epoll_events)rGrrr*s   zEpollSelector.registerc s8tj|}y|jj|jWntk r2YnX|S)N)rCr+rbrOSError)rrr;)rGrrr+s  zEpollSelector.unregisterc Cs|dkrd}n |dkrd}ntj|dd}tt|jd}g}y|jj||}Wntk rh|SXx^|D]V\}}d}|tj @r|t O}|tj @r|t O}|j |}|rp|j|||j@fqpW|S)Nrrg@@gMbP?)r\r]rOrrrbrVrPr.rcr=rdr<rArQr) rr-max_evrRr^rr_rr;rrrr.s*   zEpollSelector.selectcs|jjtjdS)N)rbr/rC)r)rGrrr/s zEpollSelector.close)N)N) r$r%r&r'rr r*r+r.r/rUrr)rGrras  radevpollcsXeZdZdZfddZddZdfdd Zfd d Zdd d Zfd dZ Z S)DevpollSelectorzSolaris /dev/poll selector.cstjtj|_dS)N)rCrr.ri_devpoll)r)rGrrrs zDevpollSelector.__init__cCs |jjS)N)rkr )rrrrr szDevpollSelector.filenoNcsLtj|||}d}|t@r&|tjO}|t@r8|tjO}|jj|j||S)Nr) rCr*r<r.rYr=rZrkr)rrrrr;r[)rGrrr*s  zDevpollSelector.registercstj|}|jj|j|S)N)rCr+rkr)rrr;)rGrrr+s zDevpollSelector.unregisterc Cs|dkrd}n|dkrd}ntj|d}g}y|jj|}Wntk rR|SXx^|D]V\}}d}|tj@rz|tO}|tj@r|t O}|j |}|rZ|j |||j @fqZW|S)Nrg@@) r\r]rkrVrPr.rYr=rZr<rArQr)rr-rRr^rr_rr;rrrr.s(   zDevpollSelector.selectcs|jjtjdS)N)rkr/rC)r)rGrrr/s zDevpollSelector.close)N)N) r$r%r&r'rr r*r+r.r/rUrr)rGrrjs   rjkqueuecsXeZdZdZfddZddZdfdd Zfd d Zdd d Zfd dZ Z S)KqueueSelectorzKqueue-based selector.cstjtj|_dS)N)rCrr.rl_kqueue)r)rGrrrs zKqueueSelector.__init__cCs |jjS)N)rnr )rrrrr szKqueueSelector.filenoNc stj|||}y`|t@r@tj|jtjtj}|jj |gdd|t @rntj|jtj tj}|jj |gddWn"t k rtj |YnX|S)Nr)rCr*r<r.keventrKQ_FILTER_READZ KQ_EV_ADDrncontrolr=KQ_FILTER_WRITErer+)rrrrr;kev)rGrrr*s   zKqueueSelector.registercstj|}|jt@rVtj|jtjtj}y|j j |gddWnt k rTYnX|jt @rtj|jtj tj}y|j j |gddWnt k rYnX|S)Nr)rCr+rr<r.rorrpZ KQ_EV_DELETErnrqrfr=rr)rrr;rs)rGrrr+'s      zKqueueSelector.unregisterc Cs|dkr dnt|d}t|j}g}y|jjd||}Wntk rL|SXxb|D]Z}|j}|j}d}|tj krz|t O}|tj kr|t O}|j |} | rT|j| || j@fqTW|S)Nr)rOrrrnrqrPZidentfilterr.rpr<rrr=rArQr) rr-rhrRZkev_listrsrflagrr;rrrr.<s&     zKqueueSelector.selectcs|jjtjdS)N)rnr/rC)r)rGrrr/Rs zKqueueSelector.close)N)N) r$r%r&r'rr r*r+r.r/rUrr)rGrrm s   rmr)rr)r'abcrr collectionsrrr\r.rSr<r=rr version_inforrrrrr(r8rBhasattrrWrarjrmglobalsZDefaultSelectorrrrrsH ~U3 1 G 8 M    gettext.cpython-36.opt-1.pyc000064400000033567152462730460011644 0ustar003 \T@sdZddlZddlZddlZddlZddlZddlZddlZddlm Z dddddd d d d d dddddddgZ ej j ej ddZejdejejBZddZddZdPZd)d*eed+DZd,d-d.d/ZdRd0d1Zd2d3Zd4d5Zd6d7ZGd8ddZGd9ddeZdSd;dZiZdTda$dVd?d Z%dWd@d Z&dXdAd Z'dBd Z(dCdZ)dDdZ*dEdZ+dFdZ,dGdZ-dHdZ.dIdZ/e Z0dS)YaInternationalization and localization support. This module provides internationalization (I18N) and localization (L10N) support for your Python programs by providing an interface to the GNU gettext message catalog library. I18N refers to the operation by which a program is made aware of multiple languages. L10N refers to the adaptation of your program, once internationalized, to the local language and cultural habits. N)ENOENTNullTranslationsGNUTranslationsCatalogfind translationinstall textdomainbindtextdomainbind_textdomain_codesetdgettext dngettextgettextlgettext ldgettext ldngettext lngettextngettextZsharelocalea (?P[ \t]+) | # spaces and horizontal tabs (?P[0-9]+\b) | # decimal integer (?Pn\b) | # only n is allowed (?P[()]) | (?P[-*/%+?:]|[>, # <=, >=, ==, !=, &&, ||, # ? : # unary and bitwise ops # not allowed (?P\w+|.) # invalid token ccsTxHtjt|D]8}|j}|dkr"q|j|}|dkr@td||VqWdVdS)NZ WHITESPACESZINVALIDz invalid token in plural form: %s)refinditer_token_pattern lastgroupgroup ValueError)pluralZmoZkindvaluer/usr/lib64/python3.6/gettext.py _tokenizeTs   r cCs|rtd|StdSdS)Nz#unexpected token in plural form: %szunexpected end of plural form)r)rrrr_error_s r!||&&==!=<><=>=+-*/%cCs i|]\}}|D] }||qqSrr).0iZopsoprrr msr2orandz//)z||z&&r-c Csd}t|}x|dkr(|d7}t|}qW|dkr\t|\}}d||f}|dkrtdnP|dkrrd ||f}n:yt|d }Wntk rt|dYnXd ||f}t|}d }xh|tkr t|}||krP|dkr|dkrd|}tj||}t||d\} }d||| f}|}qW||ko6dknrFd|}|dkr|dkrt|d\} }|dkrzt|t|\} }d| || f}|dkrd|}||fS)Nr!znot (z%s(%s))z%unbalanced parenthesis in plural formnz%s%s z%s%ddz(%s)r3z%s %s %s?r:z%s if %s else %s)r<r=)r<r=)next_parserintr! _binary_ops _c2py_opsget) tokensZpriorityresultnexttoksubrjr0r1rightZif_trueZif_falserrrrApsP           rAc Cs:y t|}Wn(tk r4td|jjfdYnX|S)Nz'Plural value must be an integer, got %s)round TypeError __class____name__)r9r0rrr_as_ints  rPc Cst|dkrtdy~tt|\}}|r2t|d}x>|D]6}|dkrb|d7}|dkrrtdq<|dkr<|d8}qt|D]\}}!t |!||||f<qWnt |||t ||<| d7} | d7} qWdS)z8Override this method to support alternative .mo formats.namercSs t|dkS)Nr3)rB)r9rrrUsz(GNUTranslations._parse..z4Iz>IIzBad magic numberzBad version number zFile is corrupt r?r3 z content-typezcharset=z plural-forms;zplural=ascii)structunpackgetattr_catalogrreadrSLE_MAGICBE_MAGICOSErrorrVERSIONSstrr]splitdecodestriplowerrfrgrX enumerate)"rjrkrfilenameZcatalogZbufZbuflenmagicrZmsgcountZ masteridxZtransidxZiiZ major_versionZ minor_versionr0ZmlenZmoffZmendZtlenZtoffZtendmsgrtZlastkZb_itemitemkvrrvrrrsxrrrrANsr                     zGNUTranslations._parsecCsRt}|jj||}||kr2|jr.|jj|S|}|jrD|j|jS|jtjS)N) objectrrErirrhrprrq)rjromissingrtrrrrs  zGNUTranslations.lgettextc Csvy|j||j|f}Wn<tk rT|jr>|jj|||S|dkrL|}n|}YnX|jrh|j|jS|jtjS)Nr3) rrKeyErrorrirrhrprrq)rjrrrsr9rtrrrrs  zGNUTranslations.lngettextcCs6t}|jj||}||kr2|jr.|jj|S|S|S)N)rrrErir)rjrorrtrrrrs zGNUTranslations.gettextc CsZy|j||j|f}Wn<tk rT|jr>|jj|||S|dkrL|}n|}YnX|S)Nr3)rrrrir)rjrrrsr9rtrrrrs zGNUTranslations.ngettextN)rr3) rOr~rrrrrrArrrrrrrrrBsT  Fc Cs|dkr t}|dkrTg}x(dD] }tjj|}|r|jd}PqWd|krT|jdg}x0|D](}x"t|D]}||krl|j|qlWq^W|rg} nd} xL|D]D}|dkrPtjj||dd|} tjj | r|r| j| q| SqW| S) NLANGUAGELC_ALL LC_MESSAGESLANGr?Cz%s.mo)rrrr) _default_localedirosenvironrErr^repathjoinexists) domain localedir languagesallZenvarrdZnelangsZlangZnelangrGmofilerrrrs8        c Cs|dkr t}t|||dd}|s6|r*tSttd|d}x|D]|}|tjj|f} tj | } | dkrt |d} tj | || } WdQRXt j | } |r| j ||dkr| }q@|j| q@W|S)NT)rz$No translation file found for domainrb)rrrrrrrabspath _translationsrEopen setdefaultcopyrxrm) rrrZclass_rnrcZmofilesrGrkeytrkrrrrs*      cCst||d|d}|j|dS)NT)rnrc)rr)rrrcr}rrrrrsZmessagescCs|dk r |atS)N)_current_domain)rrrrr 'scCs|dk r|t|<tj|tS)N) _localedirsrEr)rrrrrr .scCs|dk r|t|<tj|S)N)_localecodesetsrE)rrcrrrr 5sc Cs@y t|tj|dtj|d}Wntk r4|SX|j|S)N)rc)rrrErrr)rrorrrrr <s c CsRtj|}yt|tj|d|d}Wn"tk rF|j|pBtjSX|j|S)N)rc) rrErrrrprrqr)rrorcrrrrrDs  c CsTy t|tj|dtj|d}Wn$tk rD|dkr<|S|SYnX|j|||S)N)rcr3)rrrErrr)rrrrsr9rrrrr Ls c Cshtj|}yt|tj|d|d}Wn4tk rX|dkrB|}n|}|j|pTtjSX|j|||S)N)rcr3) rrErrrrprrqr)rrrrsr9rcrrtrrrrWs cCs tt|S)N)r r)rorrrrcscCs tt|S)N)rr)rorrrrfscCstt|||S)N)r r)rrrsr9rrrriscCstt|||S)N)rr)rrrsr9rrrrlsr"r#r$r%r&r'r(r)r*r+r,r-r.)rrrrrr)r)NNF)NNNFN)NNN)N)N)N)1__doc__rriorrrsyserrnor__all__rr base_prefixrcompileVERBOSEDOTALLrr r!rCrrDrArPrXrerrrrrrrrrr r r r rr rrrrrrrrrr s^&8         1$*K &       platform.cpython-36.opt-1.pyc000064400000067751152462730460012006 0ustar003 in@sBdZdZdZddlZddlZddlZddlZddlZddlZy ej Z Wn(e k rnej dkrfdZ nd Z YnXd Z d d d d d dddddd ZejdZddZejdejZejdddfddZddZejdejZejdejZejdejZdZd/d0Zddded1fd2d3Zd4d5Zdddefd6d7Zdd9d:Zdd;d<Z ejd=Z!dd>d?Z"ddAddBddDddEddGddHddIddKddLddMddNi Z#ddDddOddPddQddRddSiZ$ddTdUZ%dVdWZ&ddXdYZ'dZd[Z(dd\d]Z)d^d_Z*d`daZ+ddbdcZ,dddeZ-ddfdgZ.ddhdiZ/ddddmZ0ejddfdndoZ1ej2dpdqZ3da4drdsZ5dtduZ6dvdwZ7dxdyZ8dzd{Z9d|d}Z:d~dZ;ejdejZejdZ?iZ@dddZAddZBddZCddZDddZEddZFddZGddZHiZIdddZ eJdkr>dejKkpdejKkZLdejKko$dejKkZMeNe eMeLejOddS)a8 This module tries to retrieve as much platform-identifying data as possible. It makes this information available via function APIs. If called from the command line, it prints the platform information concatenated as single string to stdout. The output format is useable as part of a filename. a Copyright (c) 1999-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com Copyright (c) 2000-2010, eGenix.com Software GmbH; mailto:info@egenix.com Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee or royalty is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation or portions thereof, including modifications, that you make. EGENIX.COM SOFTWARE GMBH DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE ! z1.0.8Ndoswin32win16ZNULz /dev/nullz/etc (2) ZdevZalphaaZbetabcZRCrcplpz([0-9]+|[._+-])c Csfg}x\tj|D]N}|dkryt|d}d}Wn tk rNtj|d}YnX|j||fqW|S)Nz._+-rdr) _component_resplitint ValueError _ver_stagesgetextend)versionresultvtr /usr/lib64/python3.6/platform.py_comparable_versions rsC(__libc_init)|(GLIBC_([0-9.]+))|(libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)i@c Cst}ttjdrtjj|}t|d`}|j|}d}xH|t|krd|ksZd|krhtj ||}nd}| s|j t|kr|j|} | r|t |t|dd| }d}q<|sPdd |j D\} } } } }}| r| rd }n| r|d krd }| }n|| ||krx| }n^| rx|d krxd }|rR| sN||||krR|}|rx|t| d|krx||}|j }qszlibc_ver..Zlibcglibc) rhasattrospathr!openreadlen _libc_searchsearchendmaxgroups) executablelibrZ chunksizeVfZbinaryposmchunkZlibcinitr(Z glibcversionZsoZthreadsZ soversionrrrlibc_versJ        r;c Csptjjdrd}td`}xX|D]P}|j}t|dkr |\}}nq |dkrV|j}q |dkr |jd}|d}q WWdQRX|||fStjjdrtdD}x<|D]4}|jd} t| dkr| d d krd | d |fSqWWdQRXtjjd rftjd } x:t t| d ddD]"} | | dd dkr| | =qW| rf| j d}| dd d}|||fS|||fS)z Tries some special tricks to get the distribution information in case the default method fails. Currently supports older SuSE Linux, Caldera OpenLinux and Slackware Linux distributions. z/var/adm/inst-log/infoSuSEZMIN_DIST_VERSIONZ DIST_IDENT-Nz/etc/.installedrZ OpenLinuxz/usr/lib/setupzslack-version- slackwarerBrB) r*r+existsr,rr.stripisdirlistdirrangesort) distnameridr7lineZtvtagvaluevaluesZpkgZverfilesnrrr_dist_try_harders>               rPz(\w+)[-_](release|version)z'(.+) release ([\d.]+)[^(]*(?:\((.+)\))?z1([^0-9]+)(?: release )?([\d.]+)[^(]*(?:\((.+)\))?r<debianfedoraredhatcentos almalinuxmandrakemandrivarocksrA yellowdoggentoo UnitedLinux turbolinuxarchmageiacCszd}d}tj|}|dk r&t|jStj|}|dk rDt|jS|jj}|rp|d}t|dkrp|d}d||fS)Nr rr?)_lsb_release_versionmatchtupler3_release_versionrDrr.) firstlinerrJr9lrrr_parse_release_file0s      rer?cCs(ddl}|jdtddt|||||S)NrzFdist() and linux_distribution() functions are deprecated in Python 3.5r=) stacklevel)warningswarnPendingDeprecationWarning_linux_distribution)rIrrJsupported_distsfull_distribution_namergrrrlinux_distributionKs   rmcCsytjt}Wntk r(|||fSX|jxD|D]0}tj|}|dk r8|j\}} ||kr8|}Pq8Wt|||St tj j t|dddd} | j } WdQRXt | \}} } |r|r|}| r| }| r| }|||fS)a Tries to determine the name of the Linux OS distribution name. The function first looks for a distribution release file in /etc and then reverts to _dist_try_harder() in case no suitable files are found. supported_dists may be given to define the set of Linux distributions to look for. It defaults to a list of currently supported Linux distributions identified by their release file name. If full_distribution_name is true (default), the full distribution read from the OS is returned. Otherwise the short name taken from supported_dists is used. Returns a tuple (distname, version, id) which default to the args given as parameters. Nrzutf-8surrogateescape)encodingerrors)r*rF _UNIXCONFDIROSErrorrH_release_filenamer`r3rPr,r+joinreadlinere)rIrrJrkrlZetcfiler9Z _distnameZdummyr7rcZ_versionZ_idrrrrjUs0      rjcCs*ddl}|jdtddt||||ddS)aS Tries to determine the name of the Linux OS distribution name. The function first looks for a distribution release file in /etc and then reverts to _dist_try_harder() in case no suitable files are found. Returns a tuple (distname, version, id) which default to the args given as parameters. rNzFdist() and linux_distribution() functions are deprecated in Python 3.5r=)rf)rkrl)rgrhrirj)rIrrJrkrgrrrdists  rxrncCs&ddl}|jdtddtj|||S)z! Portable popen() interface. rNzuse os.popen insteadr=)rf)rgrhDeprecationWarningr*popen)cmdmodebufsizergrrrrzsrzc Csd|jd}|r|j|ytt|}Wntk r>|}YnXttt|}dj|dd}|S)z Normalize the version and build strings and return a single version string using the format major.minor.build (or patchlevel). .N)rappendmaprrliststrru)rbuildrdZintsZstringsrrr _norm_versions   rz'(?:([\w ]+) ([\w.]+) .*\[.* ([\d.]+)\])c Cstj|kr|||fSxddD]R}y&tj|}|j}|jrBtdWn$tk rh}zwWYdd}~XqXPqW|||fS|j}tj |}|dk r|j \}}}|d dkr|dd }|d dkr|dd }t |}|||fS) a+ Tries to figure out the OS version used and returns a tuple (system, release, version). It uses the "ver" shell command for this which is known to exists on Windows, DOS. XXX Others too ? In case this fails, the given parameters are used as defaults. vercommand /c ver cmd /c verzcommand failedNr?r~)rrrrBrBrBrB) sysplatformr*rzr-closersrD _ver_outputr`r3r) systemreleaserZsupported_platformsr{pipeinfoZwhyr9rrr _syscmd_vers,           rZ2000ZXPr=Z 2003ServerZpost2003Vista78rz8.1zpost8.1Z10Zpost10Z 2008ServerZ 2008ServerR2Z 2012ServerZ 2012ServerR2Zpost2012ServerR2c(Csyddlm}Wntk r,||||fSXyddlm}m}m}m}Wn,tk rvddlm}m}m}m}YnX|} | j p| dd\} } } dj | | | }t j | | fpt j | dfp|}| dd| | fkr$ydj | j }Wn8tk r"|ddd krd |dd}YnXt| d ddkrZtj | | fpXtj | dfpX|}d} z.y||d } || d d}Wn YnXWd| r|| X||||fS)Nr)getwindowsversion) OpenKeyEx QueryValueExCloseKeyHKEY_LOCAL_MACHINErz {0}.{1}.{2}r=zSP{} z Service Pack ZSPZ product_typez,SOFTWARE\Microsoft\Windows NT\CurrentVersionZ CurrentType)rr ImportErrorwinregrrrr_winregZplatform_versionformat_WIN32_CLIENT_RELEASESrZservice_pack_majorAttributeErrorgetattr_WIN32_SERVER_RELEASES)rrcsdptyperrrrrZwinverZmajminrkeyrrr win32_versD  rcCsd}tjj|sdSy ddl}Wntk r4dSXt|d}|j|}WdQRX|d}d }tjj}|d krxd}|||fS) Nz0/System/Library/CoreServices/SystemVersion.plistrr"ZProductVersionr ppcPower MacintoshZPowerPC)r r r )rr) r*r+rCplistlibrr,loadunamemachine)fnrr7rr versioninforrrr _mac_ver_xmlEs    rcCst}|dk r|S|||fS)a< Get MacOS version information and return it as tuple (release, versioninfo, machine) with versioninfo being a tuple (version, dev_stage, non_release_version). Entries which cannot be determined are set to the parameter values which default to ''. All tuple entries are strings. N)r)rrrrrrrmac_ver[s rc Cs@ddlm}y|j|}|dkr$|S|Stk r:|SXdS)Nr)System) java.langrZ getPropertyr)namedefaultrrMrrr _java_getpropns  rc Csy ddl}Wntk r(||||fSXtd|}td|}|\}}}td|}td|}td|}|||f}|\}} } td| } td |}td | } || | f}||||fS) a] Version interface for Jython. Returns a tuple (release, vendor, vminfo, osinfo) with vminfo being a tuple (vm_name, vm_release, vm_vendor) and osinfo being a tuple (os_name, os_version, os_arch). Values which cannot be determined are set to the defaults given as parameters (which all default to ''). rNz java.vendorz java.versionz java.vm.namezjava.vm.vendorzjava.vm.versionz java.os.archz java.os.namezjava.os.version)rrr) rvendorvminfoosinfojavaZvm_nameZ vm_releaseZ vm_vendoros_name os_versionos_archrrrjava_verys"              rc Cs|dkrd|||fS|dkr|dkr0|||fS|jd}|ryt|d}Wntk rbYn X|d}t||d<dj|}|dkrd }qd }n,|d krd }|r|d }qd }n |dkrd}|||fS)z Returns (system, release, version) aliased to common marketing names used for some systems. It also does some reordering of the information in some cases where it would otherwise cause confusion. ZRhapsodyzMacOS X ServerZSunOS5r~rr6ZSolarisZIRIX64ZIRIXz (64bit)64bitrrWindows)rr)rrrrru)rrrrdmajorrrr system_aliass2      rcGsdjddtt|D}|jdd}|jdd}|jdd}|jdd}|jd d}|jd d}|jd d}|jd d}|jd d}x|jdd}||krP|}qWx|ddkr|dd}qW|S)zq Helper to format the platform string in a filename compatible format e.g. "system-version-machine". r>css|]}|jVqdS)N)rD)r%xrrr sz_platform.. _/\:;"()unknownr z--r?NrBrB)rufilterr.replace)argsrZcleanedrrr _platforms$          rcCsDy ddl}Wntk r |SXy|jStk r>|SXdS)z8 Helper to determine the node name of this machine. rN)socketrZ gethostnamers)rrrrr_nodes rcCsFtjj|}x4tjj|r@tjjtjjtjj|tj|}qW|S)zT In case filepath is a symlink, follow it until a real file is reached. )r*r+abspathislinknormpathrudirnamereadlink)filepathrrr_follow_symlinkss  "rc Cshtjdkr|Sytjd|tf}Wnttfk r<|SX|jj}|j }| s\|r`|S|SdS)z. Interface to the system's uname command. rrrzuname %s 2> %sN)rrr) rrr*rzDEV_NULLrrsr-rDr)Zoptionrr7outputrrrr _syscmd_uname s   rc Cs|tjd kr|St|}ytjd|gtjtjd}Wnttfk rJ|SX|j dj d}|j }| sp|rt|S|SdS) z Interface to the system's file command. The function uses the -b option of the file command to have it omit the filename in its output. Follow the symlinks. It returns default in case the command should fail. rrrrw)stdoutstderrrzlatin-1N)rrr) rrr subprocessPopenPIPEZSTDOUTrrsZ communicater$wait)targetrprocrrrrr _syscmd_files   r WindowsPErMSDOS)rrrc Cs.|sLddl}y|jd}Wn |jk r:|jd}YnXt|dd}|r\t|d}nd}| r|tjkrtjtkrttj\}}|r|}|r|}||fSd|kr||fSd |krd }nd |krd }n d |krd}d|krd}n@d|krd|krd}nd}n d|krd}nd|kr&d}n||fS)a Queries the given executable (defaults to the Python interpreter binary) for various architecture information. Returns a tuple (bits, linkage) which contains information about the bit architecture and the linkage format used for the executable. Both values are returned as strings. Values that cannot be determined are returned as given by the parameter presets. If bits is given as '', the sizeof(pointer) (or sizeof(long) on Python version < 1.5.2) is used as indicator for the supported pointer size. The function relies on the system's "file" command to do the actual work. This is available on most if not all Unix platforms. On some non-Unix platforms where the "file" command does not exist and the executable is set to the Python interpreter binary defaults from _default_architecture are used. rNPrdbitr r4z32-bit32bitZN32Zn32bitz64-bitrZELFZPErrZCOFFzMS-DOSr) structZcalcsizeerrorrrrr4r_default_architecture)r4bitslinkagersizeZfileoutr rdrrr architectureBsL       r uname_resultz-system node release version machine processorcCsd}tdk rtSd}ytj\}}}}}Wntk rBd}YnX|sdttd|||||f r|rtj}d}d}t}d}d}|dkrt \}}}} |r|rd}|sdtj krtj j dd}ntj j dd}|stj j d|}|r se      :2 6    0 0  #6   T       k      [ csv.cpython-36.opt-1.pyc000064400000027121152462730460010740 0ustar003 \4?@sLdZddlZddlmZmZmZmZmZmZm Z m Z m Z m Z m Z mZmZmZddlmZddlmZddlmZddd d d d d ddddddddddddddgZGdd d ZGdddeZedeGdddeZedeGd ddeZed!eGd"ddZGd#ddZyeWnek r8eZYnXGd$ddZdS)%z+ csv.py - read/write/investigate CSV files N)Error __version__writerreaderregister_dialectunregister_dialect get_dialect list_dialectsfield_size_limit QUOTE_MINIMAL QUOTE_ALLQUOTE_NONNUMERIC QUOTE_NONE__doc__)Dialect) OrderedDict)StringIOr r r rrrrexcel excel_tabr rrrrr Snifferrr DictReader DictWriter unix_dialectc@sDeZdZdZdZdZdZdZdZdZ dZ dZ dZ ddZ ddZdS) rzDescribe a CSV dialect. This must be subclassed (see csv.excel). Valid attributes are: delimiter, quotechar, escapechar, doublequote, skipinitialspace, lineterminator, quoting. FNcCs|jtkrd|_|jdS)NT) __class__r_valid _validate)selfr/usr/lib64/python3.6/csv.py__init__+s zDialect.__init__cCs@y t|Wn.tk r:}ztt|WYdd}~XnXdS)N)_Dialect TypeErrorrstr)rerrrr0s zDialect._validate)__name__ __module__ __qualname__r_namer delimiter quotecharZ escapechar doublequoteskipinitialspacelineterminatorquotingr rrrrrrsc@s(eZdZdZdZdZdZdZdZe Z dS)rz;Describe the usual properties of Excel-generated CSV files.,"TFz N) r%r&r'rr)r*r+r,r-r r.rrrrr7sc@seZdZdZdZdS)rzEDescribe the usual properties of Excel-generated TAB-delimited files. N)r%r&r'rr)rrrrrAsz excel-tabc@s(eZdZdZdZdZdZdZdZe Z dS)rz:Describe the usual properties of Unix-generated CSV files.r/r0TF N) r%r&r'rr)r*r+r,r-r r.rrrrrFsZunixc@s@eZdZd ddZddZeddZejd dZd d ZdS) rNrcOs6||_||_||_t||f|||_||_d|_dS)Nr) _fieldnamesrestkeyrestvalrdialectline_num)rf fieldnamesr4r5r6argskwdsrrrr Rs zDictReader.__init__cCs|S)Nr)rrrr__iter__[szDictReader.__iter__c Cs@|jdkr0yt|j|_Wntk r.YnX|jj|_|jS)N)r3nextr StopIterationr7)rrrrr9^s  zDictReader.fieldnamescCs ||_dS)N)r3)rvaluerrrr9hscCs|jdkr|jt|j}|jj|_x|gkr:t|j}q&Wtt|j|}t|j}t|}||krz||d||j<n*||krx |j|dD]}|j||<qW|S)Nr) r7r9r=rrziplenr4r5)rrowdZlfZlrkeyrrr__next__ls     zDictReader.__next__)NNNr) r%r&r'r r<propertyr9setterrErrrrrQs   c@s6eZdZdddZddZdd Zd d Zd d ZdS)rrraisercOsB||_||_|jdkr$td|||_t||f|||_dS)NrHignorez-extrasaction (%s) must be 'raise' or 'ignore')rHrI)r9r5lower ValueError extrasactionr)rr8r9r5rLr6r:r;rrrr s zDictWriter.__init__cCs tt|j|j}|j|dS)N)dictr@r9writerow)rheaderrrr writeheaderszDictWriter.writeheadercsNjdkr8jj}|r8tddjdd|DfddjDS)NrHz(dict contains fields not in fieldnames: z, cSsg|] }t|qSr)repr).0xrrr sz,DictWriter._dict_to_list..c3s|]}j|jVqdS)N)getr5)rRrD)rowdictrrr sz+DictWriter._dict_to_list..)rLkeysr9rKjoin)rrVZ wrong_fieldsr)rVrr _dict_to_lists  zDictWriter._dict_to_listcCs|jj|j|S)N)rrNrZ)rrVrrrrNszDictWriter.writerowcCs|jjt|j|S)N)r writerowsmaprZ)rZrowdictsrrrr[szDictWriter.writerowsN)rrHr)r%r&r'r rPrZrNr[rrrrrs  c@s:eZdZdZddZd ddZddZd d Zd d ZdS)rze "Sniffs" the format of a CSV file (i.e. delimiter, quotechar) Returns a Dialect object. cCsdddddg|_dS)Nr/r1; :) preferred)rrrrr szSniffer.__init__NcCsd|j||\}}}}|s(|j||\}}|s4tdGdddt}||_||_|pVd|_||_|S)zI Returns a dialect (or None) corresponding to the sample zCould not determine delimiterc@seZdZdZdZeZdS)zSniffer.sniff..dialectZsniffedz N)r%r&r'r(r-r r.rrrrr6sr6r0)_guess_quote_and_delimiter_guess_delimiterrrr+r)r*r,)rsample delimitersr*r+r)r,r6rrrsniffs  z Sniffer.sniffcCsg}x0dD](}tj|tjtjB}|j|}|r Pq W|s>dSi}i}d}|j} x|D]} | d d } | | } | r|j| dd || <y| d d } | | } Wntk rwVYnX| r|dks| |kr|j| dd || <y| d d } Wntk rwVYnX| | rV|d 7}qVWt||jd } |rZt||jd }|||k}|dkrbd}nd}d}tjdtj || dtj}|j |rd}nd}| |||fS)a Looks for text enclosed between two identical quotes (the probable quotechar) which are preceded and followed by the same character (the probable delimiter). For example: ,'some text', The quote with the most wins, same with the delimiter. If there is no quotechar the delimiter can't be determined this way. I(?P[^\w\n"\'])(?P ?)(?P["\']).*?(?P=quote)(?P=delim)G(?:^|\n)(?P["\']).*?(?P=quote)(?P[^\w\n"\'])(?P ?)G(?P[^\w\n"\'])(?P ?)(?P["\']).*?(?P=quote)(?:$|\n)-(?:^|\n)(?P["\']).*?(?P=quote)(?:$|\n)rFNrquotedelimZspace)rDr2z]((%(delim)s)|^)\W*%(quote)s[^%(delim)s\n]*%(quote)s[^%(delim)s\n]*%(quote)s\W*((%(delim)s)|$))rlrjT)rfrgrhri)rFNr) recompileDOTALL MULTILINEfindall groupindexrUKeyErrormaxescapesearch)rdatardZmatchesZrestrZregexpZquotesdelimsZspacesrrmnrDr*rlr,Z dq_regexpr+rrrras`          z"Sniffer._guess_quote_and_delimitercCsttd|jd}ddtdD}tdt|}d}i}i}i}dt|t|} } x| t|krn|d7}xT|| | D]D} x>|D]6} |j| i} | j| }| j|dd| |<| || <qWqWx|jD]} t|| j }t|dkr|dddkrqt|dkrht |d d d || <|j || || d|| dt d d |Df|| <q|d|| <qW|j }t ||}d}d}xt|dkr||krx\|D]T\}}|ddkr|ddkr|d||kr|dks||kr|||<qW|d8}qWt|dkr`t|jd}|dj||djd|k}||fS| } | |7} q\W|szdSt|dkrxF|jD]<}||jkr|dj||djd|k}||fSqWdd|j D}|j|dd}|dj||djd|k}||fS)a The delimiter /should/ occur the same number of times on each row. However, due to malformed data, it may not. We don't want an all or nothing approach, so we allow for small variations in this number. 1) build a table of the frequency of each character on every line. 2) build a table of frequencies of this frequency (meta-frequency?), e.g. 'x occurred 5 times in 10 rows, 6 times in 1000 rows, 7 times in 2 rows' 3) use the mode of the meta-frequency to determine the /expected/ frequency for that character 4) find out how often the character actually meets that goal 5) the character that best meets its goal is the delimiter For performance reasons, the data is evaluated in chunks, so it can try and evaluate the smallest portion of the data possible, evaluating additional chunks as necessary. Nr2cSsg|] }t|qSr)chr)rRcrrrrT.sz,Sniffer._guess_delimiter.. rrkcSs|dS)Nrkr)rSrrrHsz*Sniffer._guess_delimiter..)rDcss|]}|dVqdS)rkNr)rRitemrrrrWMsz+Sniffer._guess_delimiter..g?g?g{Gz?z%c rcSsg|]\}}||fqSrr)rRkvrrrrTws)rr)listfiltersplitrangeminrArUcountrXitemsrtremovesumfloatr`sort)rrwrdasciiZ chunkLengthZ iterationZ charFrequencyZmodesrxstartendlinecharZ metaFrequencyZfreqrZmodeListZtotalZ consistencyZ thresholdrrrlr,rCrrrrbst           zSniffer._guess_delimiterc Cstt||j|}t|}t|}i}xt|D] }d||<q2Wd}x|D]}|dkrZP|d7}t||krpqLxt|jD]x} xJtt t gD]0} y| || PWqt t fk rYqXqWt|| } | || kr~|| dkr| || <q~|| =q~WqLWd} x|j D]~\} } t| tdkrLt|| | krB| d7} n| d8} ns2@       2 smtpd.cpython-36.pyc000064400000064075152462730460010346 0ustar003 \@s^dZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z mZddddd gZejdZd ZGd d d Zead ZdZdZd%ddZGdddejZGdddejZGdddeZGdddeZGdd d eZGdddZ ddZ!e"dkrZe!Z#e#j$Z$de$krpe$j%dZ&e'e$de&e(e)dgZ*e$e&ddZ$nddl+Z*e,e*e$Z-e-e#j.e#j/fe#j0e#j1fe#j2e#j3dZ4e#j5r6y ddl6Z6Wn.e7k re8d ej9d!ej:dYnXe6j;d"d#ZWne?k rXYnXdS)&aAn RFC 5321 smtp proxy with optional RFC 1870 and RFC 6531 extensions. Usage: %(program)s [options] [localhost:localport [remotehost:remoteport]] Options: --nosetuid -n This program generally tries to setuid `nobody', unless this flag is set. The setuid call will fail if this program is not run as root (in which case, use this flag). --version -V Print the version number and exit. --class classname -c classname Use `classname' as the concrete SMTP proxy class. Uses `PureProxy' by default. --size limit -s limit Restrict the total size of the incoming message to "limit" number of bytes via the RFC 1870 SIZE extension. Defaults to 33554432 bytes. --smtputf8 -u Enable the SMTPUTF8 extension and behave as an RFC 6531 smtp proxy. --debug -d Turn on debugging prints. --help -h Print this message and exit. Version: %(__version__)s If localhost is not given then `localhost' is used, and if localport is not given then 8025 is used. If remotehost is not given then `localhost' is used, and if remoteport is not given, then 25 is used. N)warn) get_addr_specget_angle_addr SMTPChannel SMTPServerDebuggingServer PureProxy MailmanProxyzPython SMTP proxy version 0.3c@seZdZddZddZdS)DevnullcCsdS)N)selfmsgr r /usr/lib64/python3.6/smtpd.pywritefsz Devnull.writecCsdS)Nr )r r r rflushgsz Devnull.flushN)__name__ __module__ __qualname__rrr r r rr esr  z, icCs4ttttjd|r&t|tjdtj|dS)N)file)print__doc__globalssysstderrexit)coder r r rusagepsrc@seZdZdZdZdZejefddZe ddZ e dd d fd d Z d d Z ddZe ddZejddZe ddZejddZe ddZejddZe ddZejddZe ddZejddZe dd Zejd!d Ze d"d#Zejd$d#Ze d%d&Zejd'd&Ze d(d)Zejd*d)Ze d+d,Zejd-d,Ze d.d/Zejd0d/Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Zd;d<Z d=d>Z!d?d@Z"dAdBZ#dCdDZ$dEdFZ%dGdHZ&dIdJZ'dKdLZ(dMdNZ)dOdPZ*dQdRZ+dS)SrricCs|S)Nr )xr r r|szSMTPChannel.c Cs*yt|jjStk r$|jSXdS)N)maxcommand_size_limitsvalues ValueErrorcommand_size_limit)r r r rmax_command_size_limit~sz"SMTPChannel.max_command_size_limitNFc Cstjj|||d||_||_||_||_||_||_|rF|rFt d|rdd|_ d|_ d|_ t |_nd|_ d|_ td|_ d |_|jd|_d |_|jjtj|_y|j|_Wn:tk r}z|j|jd tjkrdSd}~XnXtd t |jt!d |j"d|jt#fdS)N)mapzFdecode_data and enable_SMTPUTF8 cannot be set to True at the same timerz .s . FrzPeer:)rz 220 %s %s)$asynchat async_chat__init__ smtp_serverconnaddrdata_size_limitenable_SMTPUTF8 _decode_datar% _emptystring_linesep_dotsepNEWLINE_newlineord_set_rset_state seen_greeting extended_smtpr#clearsocketZgetfqdnfqdnZ getpeernamepeerOSErrorcloseargserrnoZENOTCONNrrepr DEBUGSTREAMpush __version__) r Zserverr1r2r3r(r4 decode_dataerrr r rr/s@   zSMTPChannel.__init__cCs.|j|_d|_g|_d|_d|_|jddS)z/Reset state variables to their post-DATA state.NFrs )COMMAND smtp_statemailfromrcpttosrequire_SMTPUTF8 num_bytesset_terminator)r r r r_set_post_data_states z SMTPChannel._set_post_data_statecCs|jd|_g|_dS)z.Reset all state variables except the greeting.rN)rT received_datareceived_lines)r r r rr<szSMTPChannel._set_rset_statecCstdtd|jS)NzTAccess to __server attribute on SMTPChannel is deprecated, use 'smtp_server' instead)rDeprecationWarningr0)r r r r__serverszSMTPChannel.__servercCstdtd||_dS)NzRSetting __server attribute on SMTPChannel is deprecated, set 'smtp_server' insteadrW)rrXr0)r valuer r rrYscCstdtd|jS)NzUAccess to __line attribute on SMTPChannel is deprecated, use 'received_lines' insteadrW)rrXrV)r r r r__lineszSMTPChannel.__linecCstdtd||_dS)NzSSetting __line attribute on SMTPChannel is deprecated, set 'received_lines' insteadrW)rrXrV)r rZr r rr[scCstdtd|jS)NzRAccess to __state attribute on SMTPChannel is deprecated, use 'smtp_state' insteadrW)rrXrN)r r r r__stateszSMTPChannel.__statecCstdtd||_dS)NzPSetting __state attribute on SMTPChannel is deprecated, set 'smtp_state' insteadrW)rrXrN)r rZr r rr\scCstdtd|jS)NzXAccess to __greeting attribute on SMTPChannel is deprecated, use 'seen_greeting' insteadrW)rrXr=)r r r r __greetingszSMTPChannel.__greetingcCstdtd||_dS)NzVSetting __greeting attribute on SMTPChannel is deprecated, set 'seen_greeting' insteadrW)rrXr=)r rZr r rr]scCstdtd|jS)NzSAccess to __mailfrom attribute on SMTPChannel is deprecated, use 'mailfrom' insteadrW)rrXrO)r r r r __mailfromszSMTPChannel.__mailfromcCstdtd||_dS)NzQSetting __mailfrom attribute on SMTPChannel is deprecated, set 'mailfrom' insteadrW)rrXrO)r rZr r rr^scCstdtd|jS)NzQAccess to __rcpttos attribute on SMTPChannel is deprecated, use 'rcpttos' insteadrW)rrXrP)r r r r __rcpttosszSMTPChannel.__rcpttoscCstdtd||_dS)NzOSetting __rcpttos attribute on SMTPChannel is deprecated, set 'rcpttos' insteadrW)rrXrP)r rZr r rr_scCstdtd|jS)NzTAccess to __data attribute on SMTPChannel is deprecated, use 'received_data' insteadrW)rrXrU)r r r r__dataszSMTPChannel.__datacCstdtd||_dS)NzRSetting __data attribute on SMTPChannel is deprecated, set 'received_data' insteadrW)rrXrU)r rZr r rr`scCstdtd|jS)NzKAccess to __fqdn attribute on SMTPChannel is deprecated, use 'fqdn' insteadrW)rrXrA)r r r r__fqdn szSMTPChannel.__fqdncCstdtd||_dS)NzISetting __fqdn attribute on SMTPChannel is deprecated, set 'fqdn' insteadrW)rrXrA)r rZr r rrascCstdtd|jS)NzKAccess to __peer attribute on SMTPChannel is deprecated, use 'peer' insteadrW)rrXrB)r r r r__peerszSMTPChannel.__peercCstdtd||_dS)NzISetting __peer attribute on SMTPChannel is deprecated, set 'peer' insteadrW)rrXrB)r rZr r rrbscCstdtd|jS)NzKAccess to __conn attribute on SMTPChannel is deprecated, use 'conn' insteadrW)rrXr1)r r r r__conn szSMTPChannel.__conncCstdtd||_dS)NzISetting __conn attribute on SMTPChannel is deprecated, set 'conn' insteadrW)rrXr1)r rZr r rrc%scCstdtd|jS)NzKAccess to __addr attribute on SMTPChannel is deprecated, use 'addr' insteadrW)rrXr2)r r r r__addr+szSMTPChannel.__addrcCstdtd||_dS)NzISetting __addr attribute on SMTPChannel is deprecated, set 'addr' insteadrW)rrXr2)r rZr r rrd0scCs&tjj|t|d|jrdnddS)Nz zutf-8ascii)r-r.rIbytesrQ)r r r r rrI7s zSMTPChannel.pushcCs|d}|j|jkr|j}n|j|jkr*|j}|r<|j|krr#r&getattrrgr3splitr7r8rir:rUrBrOrProrpr0process_messagerT) r lineZszicommandargZmax_szmethodrktextrEkwargsZstatusr r rfound_terminatorLsd        zSMTPChannel.found_terminatorcCsH|s|jddS|jr&|jddS|j||_|jd|jdS)Nz501 Syntax: HELO hostnamez503 Duplicate HELO/EHLOz250 %s)rIr=r<rA)r r{r r r smtp_HELOs  zSMTPChannel.smtp_HELOcCs|s|jddS|jr&|jddS|j||_d|_|jd|j|jrr|jd|j|jdd7<|js|jd|jr|jd |jdd 7<|jd dS) Nz501 Syntax: EHLO hostnamez503 Duplicate HELO/EHLOTz250-%sz 250-SIZE %sMAILz 250-8BITMIMEz 250-SMTPUTF8 z250 HELP) rIr=r<r>rAr3r#r5r4)r r{r r r smtp_EHLOs&    zSMTPChannel.smtp_EHLOcCs|r|jdn |jddS)Nz501 Syntax: NOOPz250 OK)rI)r r{r r r smtp_NOOPs zSMTPChannel.smtp_NOOPcCs|jd|jdS)Nz221 Bye)rIZclose_when_done)r r{r r r smtp_QUITs zSMTPChannel.smtp_QUITcCs0t|}|d|j|kr,||djSdS)Nr)rhrsrt)r keywordr{Zkeylenr r r_strip_command_keywordsz"SMTPChannel._strip_command_keywordcCsF|sdS|jjdr$t|\}}n t|\}}|s<||fS|j|fS)Nr<)rr)lstrip startswithrrZ addr_spec)r r{addressrestr r r_getaddrs zSMTPChannel._getaddrcCsNi}xD|D]<}|jd\}}}|j s2|r6| r6dS|r>|nd||<q W|S)N=T) partitionisalnum)r paramsresultZparameqrZr r r _getparamss zSMTPChannel._getparamscCs|rd}|j}|dkr$|jdq|dkr8|jdq|dkr^d}|jrR||7}|j|q|dkrd }|jrx||7}|j|q|d kr|jd q|d kr|jd q|dkr|jdq|dkr|jdq|dkr|jdq|jdn |jddS)Nz [SP ]ZEHLOz250 Syntax: EHLO hostnameZHELOz250 Syntax: HELO hostnamerz 250 Syntax: MAIL FROM:
ZRCPTz250 Syntax: RCPT TO:
rgz250 Syntax: DATAZRSETz250 Syntax: RSETZNOOPz250 Syntax: NOOPZQUITz250 Syntax: QUITZVRFYz250 Syntax: VRFY
zD501 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFYzD250 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFY)rsrIr>)r r{ZextendedZlc_argr r r r smtp_HELPs:          zSMTPChannel.smtp_HELPcCs@|r2|j|\}}|r"|jdq<|jd|n |jddS)NzB252 Cannot VRFY user, but will accept message and attempt deliveryz502 Could not VRFY %sz501 Syntax: VRFY
)rrI)r r{rrr r r smtp_VRFYs  zSMTPChannel.smtp_VRFYcCs|js|jddStd|tdd}|jr4|d7}|dkrJ|j|dS|jd|}|j|\}}|sv|j|dS|j r|r|j|dS|jr|jddS|jj |_ |j |j }|dkr|j|dS|j s|j dd }|dkr|jd dS|jr>|j d d }|dkr&d|_n|d k r>|jddS|j dd}|r|jsh|j|dS|jrt||jkr|jddSt|jdkr|jddS||_td|jtd|jddS)Nz503 Error: send HELO firstz ===> MAIL)rz 501 Syntax: MAIL FROM:
z [SP ]zFROM:z503 Error: nested MAIL commandZBODY7BIT8BITMIMEz1501 Error: BODY can only be one of 7BIT, 8BITMIMEZSMTPUTF8FTz&501 Error: SMTPUTF8 takes no argumentsZSIZEz:552 Error: message size exceeds fixed maximum message sizerz:555 MAIL FROM parameters not recognized or not implementedzsender:z250 OK)rr)r=rIrrHr>rrrOrsrvrorr5popr4rQisdigitr3intrhkeys)r r{ syntaxerrrrZbodysmtputf8sizer r r smtp_MAILsh                     zSMTPChannel.smtp_MAILcCs|js|jddStd|td|js6|jddSd}|jrH|d7}|dkr^|j|dS|jd|}|j|\}}|s|j|dS|j r|r|j|dS|jj |_ |j |j }|dkr|j|dSt |j dkr|jd dS|jj|td |jtd|jd dS) Nz503 Error: send HELO firstz ===> RCPT)rz503 Error: need MAIL commandz501 Syntax: RCPT TO:
z [SP ]zTO:rz8555 RCPT TO parameters not recognized or not implementedzrecips:z250 OK)r=rIrrHrOr>rrrsrvrprrhrrPri)r r{rrrr r r smtp_RCPT7s@           zSMTPChannel.smtp_RCPTcCs(|r|jddS|j|jddS)Nz501 Syntax: RSETz250 OK)rIr<)r r{r r r smtp_RSETZs  zSMTPChannel.smtp_RSETcCsZ|js|jddS|js(|jddS|r:|jddS|j|_|jd|jddS)Nz503 Error: send HELO firstz503 Error: need RCPT commandz501 Syntax: DATAs . z#354 End data with .)r=rIrPrgrNrS)r r{r r r smtp_DATAas    zSMTPChannel.smtp_DATAcCs|jddS)Nz502 EXPN not implemented)rI)r r{r r r smtp_EXPNpszSMTPChannel.smtp_EXPN),rrrrMrgr& collections defaultdictr#propertyr'DATA_SIZE_DEFAULTr/rTr<Z_SMTPChannel__serversetterZ_SMTPChannel__lineZ_SMTPChannel__stateZ_SMTPChannel__greetingZ_SMTPChannel__mailfromZ_SMTPChannel__rcpttosZ_SMTPChannel__dataZ_SMTPChannel__fqdnZ_SMTPChannel__peerZ_SMTPChannel__connZ_SMTPChannel__addrrIrmrrrrrrrrrrrrrrrr r r rrws` &            >   # 6#c@s2eZdZeZedddfddZddZddZdS) rNFc Cs||_||_||_||_||_|r.|r.tdtjj||dyNt j |dt j i}|j |dd|dd|j |j||jdWn|jYn(Xtd|jjtjtj||ftddS) NzFdecode_data and enable_SMTPUTF8 cannot be set to True at the same time)r(typerrz0%s started at %s Local addr: %s Remote addr:%s)r)Z _localaddr _remoteaddrr3r4r5r%asyncore dispatcherr/r@Z getaddrinfoZ SOCK_STREAMZ create_socketZset_reuse_addrZbindZlistenrDr __class__rtimectimerH)r Z localaddrZ remoteaddrr3r(r4rKZ gai_resultsr r rr/xs*  zSMTPServer.__init__cCs6tdt|td|j||||j|j|j|j}dS)NzIncoming connection from %s)r)rrGrH channel_classr3Z_mapr4r5)r r1r2Zchannelr r rhandle_acceptedszSMTPServer.handle_acceptedcKstdS)aOverride this abstract method to handle messages from the client. peer is a tuple containing (ipaddr, port) of the client that made the socket connection to our smtp port. mailfrom is the raw address the client claims the message is coming from. rcpttos is a list of raw addresses the client wishes to deliver the message to. data is a string containing the entire full text of the message, headers (if supplied) and all. It has been `de-transparencied' according to RFC 821, Section 4.5.2. In other words, a line containing a `.' followed by other text has had the leading dot removed. kwargs is a dictionary containing additional information. It is empty if decode_data=True was given as init parameter, otherwise it will contain the following keys: 'mail_options': list of parameters to the mail command. All elements are uppercase strings. Example: ['BODY=8BITMIME', 'SMTPUTF8']. 'rcpt_options': same, for the rcpt command. This function should return None for a normal `250 Ok' response; otherwise, it should return the desired response string in RFC 821 format. N)NotImplementedError)r rBrOrPrkr~r r rrwszSMTPServer.process_message) rrrrrrr/rrwr r r rrts  c@seZdZddZddZdS)rcCsrd}|j}x`|D]X}|rP| rPd|d}t|tsDt|jd}t|d}t|tsbt|}t|qWdS)NrzX-Peer: rzutf-8) splitlines isinstancerjrGencoder)r rBrkZ inheaderslinesrxZ peerheaderr r r_print_message_contents     z&DebuggingServer._print_message_contentcKsXtd|r@|jdr&td|d|jdr@td|d|j||tddS)Nz%---------- MESSAGE FOLLOWS ----------rozmail options: %srpzrcpt options: %s z%------------ END MESSAGE ------------)rgetr)r rBrOrPrkr~r r rrws   zDebuggingServer.process_messageN)rrrrrwr r r rrscs,eZdZfddZddZddZZS)rcs.d|kr|drtdtt|j||dS)Nr4z$PureProxy does not support SMTPUTF8.)r%superrr/)r rEr~)rr rr/szPureProxy.__init__c Csh|jd}d}x|D]}|sP|d7}qW|j|d|dtj|}|j|||}td|tddS)Nrrrz X-Peer: %szwe got some refusals:)r)rvinsertr9rq_deliverrrH) r rBrOrPrkrryrxrefusedr r rrws    zPureProxy.process_messagec Csddl}i}yB|j}|j|jd|jdz|j|||}Wd|jXWn|jk r}ztdtd|j }WYdd}~Xnjt |j fk r}zHtd|j tdt |dd }t |dd} x|D]} || f|| <qWWYdd}~XnX|S) Nrrzgot SMTPRecipientsRefused)rZgotZ smtp_codeZ smtp_errorignore)smtplibZSMTPZconnectrZsendmailquitZSMTPRecipientsRefusedrrHZ recipientsrCZ SMTPExceptionrru) r rOrPrkrrseZerrcodeerrmsgrr r rrs$    "zPureProxy._deliver)rrrr/rwr __classcell__r r )rrrs cs$eZdZfddZddZZS)r cs.d|kr|drtdtt|j||dS)Nr4z'MailmanProxy does not support SMTPUTF8.)r%rrr/)r rEr~)rr rr/ szMailmanProxy.__init__cCs:ddlm}ddlm}ddlm}ddlm}g} x~|D]v} | jjdd} | jd} t| dkrhq:| d} t| dkr| d }nd }|j |  s:|d!krq:| j | | |fq:Wx| D]\} } }|j | qWt ddj |td|r|j|||}t d|tdi}||}|j|}|jds2||d<|jdsPtjtj|d<x| D]\} } }t d| td|j| }|s|j| dd}||| <|d kr|j|d dn|d kr|j|d dnh|d kr|j|d dnN|d kr|j|d dn4|d"krV|dkrd|d<nd |d<|j|d dqVWdS)#Nr)StringIO)Utils)Message)MailList@-rWrradminownerrequestrqleavezforwarding recips:rn)rzwe got refusals:fromZFromZdateZDatezsending message to)lock)tolist)Ztoadmin)Ztoowner)Z torequestZ subscribeZSubjectZ unsubscribe)rrrrrqr)rqr)iorZMailmanrrrlowerrvrhZ list_existsriremoverrqrHrrrrZEnqueue)r rBrOrPrkrrrrZ listnamesZrcptZlocalpartsZlistnamerzrZmlistsrr Zmlistr r rrwsd                    zMailmanProxy.process_message)rrrr/rwrr r )rrr s c@seZdZdZdZdZdZdS)OptionsTrNF)rrrsetuid classname size_limitr4r r r rr_src !Csty.tjtjdddddddddd g\}}Wn.tjk r\}ztd|WYdd}~XnXt}x|D]\}}|d'krtd qj|d(krtttjd qj|d)krd|_ qj|d*kr||_ qj|d+krtj a qj|d,krd|_ qj|d-krjyt|}||_Wqjtd|tj dtjdYqjXqjWt|dkr@d}d}nPt|dkr\|d }d}n4t|d kr||d }|d}ntdd!tj||jd"} | d krtdd#||d| |_yt|| dd|_Wn$tk rtdd$|YnX|jd"} | d kr"tdd%||d| |_yt|| dd|_Wn$tk rntdd&|YnX|S).Nrz nVhc:s:duzclass=Znosetuidversionhelpzsize=debugr-h--helpr-V --version-n --nosetuidF-c--class-d--debug-u --smtputf8T-s--sizezInvalid size: )rzlocalhost:8025z localhost:25rWzInvalid arguments: %s:zBad local spec: %szBad local port: %szBad remote spec: %szBad remote port: %s)rr)rr)rr)rr)rr)rr)rr)getoptrargverrorrrrrJrrrrrHr4rrrh COMMASPACErqrr localhost localportr% remotehost remoteport) ZoptsrEroptionsoptr{Zint_sizeZ localspecZ remotespecryr r r parseargsfsp         r__main__r)r)r4z7Cannot import module "pwd"; try running with -n option.)rnobodyrWz3Cannot setuid "nobody"; try running with -n option.)r)@rrosrFrrr@rr-rwarningsrZemail._header_value_parserrr__all__rZprogramrJr rHr9rrrr.rrrrrr rrrrrrfindZlastdot __import__rlocalsmodrruZclass_rrrrrr4proxyrpwd ImportErrorrrrgetpwnamrPermissionErrorZloopKeyboardInterruptr r r r-sx#   M-SB        _compression.cpython-36.opt-1.pyc000064400000010012152462730460012634 0ustar003 \@s:dZddlZejZGdddejZGdddejZdS)z7Internal classes used by the gzip, lzma and bz2 modulesNc@s0eZdZdZddZddZddZdd Zd S) BaseStreamzMode-checking helper functions.cCs|jrtddS)NzI/O operation on closed file)closed ValueError)selfr$/usr/lib64/python3.6/_compression.py_check_not_closed szBaseStream._check_not_closedcCs|jstjddS)NzFile not open for reading)readableioUnsupportedOperation)rrrr_check_can_readszBaseStream._check_can_readcCs|jstjddS)NzFile not open for writing)writabler r )rrrr_check_can_writeszBaseStream._check_can_writecCs(|jstjd|js$tjddS)Nz3Seeking is only supported on files open for readingz3The underlying file object does not support seeking)r r r seekable)rrrr_check_can_seeks zBaseStream._check_can_seekN)__name__ __module__ __qualname____doc__rr rrrrrrr s rcsleZdZdZddZffddZfddZdd Zd d Zdd dZ ddZ e j fddZ ddZZS)DecompressReaderz5Adapts the decompressor API to a RawIOBase reader APIcCsdS)NTr)rrrrr $szDecompressReader.readablecKs>||_d|_d|_d|_||_||_|jf|j|_||_dS)NFr)_fp_eof_pos_size_decomp_factory _decomp_args _decompressor_trailing_error)rfpZdecomp_factoryZtrailing_errorZ decomp_argsrrr__init__'szDecompressReader.__init__csd|_tjS)N)rsuperclose)r) __class__rrr#;szDecompressReader.closecCs |jjS)N)rr)rrrrr?szDecompressReader.seekablecCsPt|:}|jd$}|jt|}||dt|<WdQRXWdQRXt|S)NB) memoryviewcastreadlen)rbZviewZ byte_viewdatarrrreadintoBs$zDecompressReader.readintorc Cs|dkr|jS| s|jr dSd}x|jjr|jjp@|jjt}|sHP|jf|j |_y|jj ||}Wq|j k rPYqXn4|jj r|jjt}|st dnd}|jj ||}|r&Pq&W|sd|_|j|_dS|jt|7_|S)NrzACompressed file ended before the end-of-stream marker was reachedT)readallrreofZ unused_datarr( BUFFER_SIZErrZ decompressrZ needs_inputEOFErrorrrr))rsizer+Zrawblockrrrr(Hs>      zDecompressReader.readcCs,|jjdd|_d|_|jf|j|_dS)NrF)rseekrrrrr)rrrr_rewindrs zDecompressReader._rewindcCs|tjkr nV|tjkr"|j|}n@|tjkrT|jdkrHx|jtjrFq8W|j|}ntdj |||jkrv|j n ||j8}x0|dkr|jt tj|}|sP|t |8}qW|jS)NrzInvalid value for whence: {}) r SEEK_SETSEEK_CURrSEEK_ENDrr(DEFAULT_BUFFER_SIZErformatr4minr))roffsetwhencer+rrrr3xs&          zDecompressReader.seekcCs|jS)z!Return the current file position.)r)rrrrtellszDecompressReader.tellr)r)rrrrr r!r#rr,r(r4r r5r3r= __classcell__rr)r$rr!s   *r)rr r8r0BufferedIOBaser RawIOBaserrrrrscodecs.cpython-36.opt-2.pyc000064400000043206152462730460011410 0ustar003 \:@sddlZddlZy ddlTWn.ek rJZzedeWYddZ[XnXdddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/g,Zd0Zd1ZZ d2Z Z d3Z d4Z ejd5kre ZZe Zn e ZZe Ze Ze Ze Ze ZGd6ddeZGd7ddZGd8ddeZGd9d:d:eZGd;ddeZGdddeZGd?ddeZGd@ddZ GdAddZ!d[dEdZ"d\dFdZ#dGdZ$dHdZ%dId Z&dJd!Z'dKd"Z(dLd#Z)d]dMd&Z*d^dNd'Z+dOdPZ,dQdRZ-y4e.dCZ/e.dSZ0e.dTZ1e.dUZ2e.dVZ3e.dWZ4Wn.e5k r\dZ/dZ0dZ1dZ2dZ3dZ4YnXdZ6e6rpddl7Z7e8dXkre#ej9dYdZe_9e#ej:dZdYe_:dS)_N)*z%Failed to load the builtin codecs: %sregisterlookupopen EncodedFileBOMBOM_BEBOM_LEBOM32_BEBOM32_LEBOM64_BEBOM64_LEBOM_UTF8 BOM_UTF16 BOM_UTF16_LE BOM_UTF16_BE BOM_UTF32 BOM_UTF32_LE BOM_UTF32_BE CodecInfoCodecIncrementalEncoderIncrementalDecoder StreamReader StreamWriterStreamReaderWriter StreamRecoder getencoder getdecodergetincrementalencodergetincrementaldecoder getreader getwriterencodedecode iterencode iterdecode strict_errors ignore_errorsreplace_errorsxmlcharrefreplace_errorsbackslashreplace_errorsnamereplace_errorsregister_error lookup_errorssssslittlec@s(eZdZdZdddddZddZdS) rTN)_is_text_encodingc CsPtj|||||f} || _|| _|| _|| _|| _|| _|| _|dk rL|| _ | S)N) tuple__new__namer#r$incrementalencoderincrementaldecoder streamwriter streamreaderr0) clsr#r$r7r6r4r5r3r0selfr:/usr/lib64/python3.6/codecs.pyr2]szCodecInfo.__new__cCsd|jj|jj|jt|fS)Nz%<%s.%s object for encoding %s at %#x>) __class__ __module__ __qualname__r3id)r9r:r:r;__repr__ls zCodecInfo.__repr__)NNNNN)__name__r=r>r0r2r@r:r:r:r;rRs   c@s eZdZdddZdddZdS) rstrictcCstdS)N)NotImplementedError)r9inputerrorsr:r:r;r#sz Codec.encodecCstdS)N)rC)r9rDrEr:r:r;r$sz Codec.decodeN)rB)rB)rAr=r>r#r$r:r:r:r;rqs c@s8eZdZdddZdddZddZd d Zd d Zd S)rrBcCs||_d|_dS)N)rEbuffer)r9rEr:r:r;__init__szIncrementalEncoder.__init__FcCstdS)N)rC)r9rDfinalr:r:r;r#szIncrementalEncoder.encodecCsdS)Nr:)r9r:r:r;resetszIncrementalEncoder.resetcCsdS)Nrr:)r9r:r:r;getstateszIncrementalEncoder.getstatecCsdS)Nr:)r9stater:r:r;setstateszIncrementalEncoder.setstateN)rB)F)rAr=r>rHr#rJrKrMr:r:r:r;rs  c@s@eZdZdddZddZdddZd d Zd d Zd dZdS)BufferedIncrementalEncoderrBcCstj||d|_dS)NrF)rrHrG)r9rEr:r:r;rHs z#BufferedIncrementalEncoder.__init__cCstdS)N)rC)r9rDrErIr:r:r;_buffer_encodesz)BufferedIncrementalEncoder._buffer_encodeFcCs0|j|}|j||j|\}}||d|_|S)N)rGrOrE)r9rDrIdataresultconsumedr:r:r;r#s z!BufferedIncrementalEncoder.encodecCstj|d|_dS)NrF)rrJrG)r9r:r:r;rJs z BufferedIncrementalEncoder.resetcCs |jpdS)Nr)rG)r9r:r:r;rKsz#BufferedIncrementalEncoder.getstatecCs|pd|_dS)NrF)rG)r9rLr:r:r;rMsz#BufferedIncrementalEncoder.setstateN)rB)F) rAr=r>rHrOr#rJrKrMr:r:r:r;rNs   rNc@s8eZdZdddZdddZddZd d Zd d Zd S)rrBcCs ||_dS)N)rE)r9rEr:r:r;rHszIncrementalDecoder.__init__FcCstdS)N)rC)r9rDrIr:r:r;r$ szIncrementalDecoder.decodecCsdS)Nr:)r9r:r:r;rJszIncrementalDecoder.resetcCsdS)Nr)rSrr:)r9r:r:r;rKs zIncrementalDecoder.getstatecCsdS)Nr:)r9rLr:r:r;rM&szIncrementalDecoder.setstateN)rB)F)rAr=r>rHr$rJrKrMr:r:r:r;rs  c@s@eZdZdddZddZdddZd d Zd d Zd dZdS)BufferedIncrementalDecoderrBcCstj||d|_dS)NrS)rrHrG)r9rEr:r:r;rH4s z#BufferedIncrementalDecoder.__init__cCstdS)N)rC)r9rDrErIr:r:r;_buffer_decode9sz)BufferedIncrementalDecoder._buffer_decodeFcCs0|j|}|j||j|\}}||d|_|S)N)rGrUrE)r9rDrIrPrQrRr:r:r;r$>s z!BufferedIncrementalDecoder.decodecCstj|d|_dS)NrS)rrJrG)r9r:r:r;rJFs z BufferedIncrementalDecoder.resetcCs |jdfS)Nr)rG)r9r:r:r;rKJsz#BufferedIncrementalDecoder.getstatecCs|d|_dS)Nr)rG)r9rLr:r:r;rMNsz#BufferedIncrementalDecoder.setstateN)rB)F) rAr=r>rHrUr$rJrKrMr:r:r:r;rT.s   rTc@sTeZdZdddZddZddZdd Zdd d Zefd dZ ddZ ddZ dS)rrBcCs||_||_dS)N)streamrE)r9rVrEr:r:r;rH[szStreamWriter.__init__cCs"|j||j\}}|jj|dS)N)r#rErVwrite)r9objectrPrRr:r:r;rWtszStreamWriter.writecCs|jdj|dS)NrF)rWjoin)r9listr:r:r; writelines{szStreamWriter.writelinescCsdS)Nr:)r9r:r:r;rJs zStreamWriter.resetrcCs*|jj|||dkr&|dkr&|jdS)Nr)rVseekrJ)r9offsetwhencer:r:r;r\szStreamWriter.seekcCs ||j|S)N)rV)r9r3getattrr:r:r; __getattr__szStreamWriter.__getattr__cCs|S)Nr:)r9r:r:r; __enter__szStreamWriter.__enter__cCs|jjdS)N)rVclose)r9typevaluetbr:r:r;__exit__szStreamWriter.__exit__N)rB)r) rAr=r>rHrWr[rJr\r_r`rarfr:r:r:r;rYs   c@seZdZeZdddZd ddZd#dd Zd$d d Zd%ddZ ddZ d&ddZ ddZ ddZ efddZddZddZd S)'rrBcCs.||_||_d|_|j|_|j|_d|_dS)NrS)rVrE bytebuffercharbuffertype_empty_charbuffer charbuffer linebuffer)r9rVrEr:r:r;rHs  zStreamReader.__init__cCstdS)N)rC)r9rDrEr:r:r;r$szStreamReader.decodeFc CsL|jr|jj|j|_d|_|dkr(|}x|dkrBt|j|krBP|dkrV|jj}n |jj|}|j|}|srPy|j||j \}}Wn`t k r}zD|r|j|d|j |j \}}|j dd} t| dkr؂nWYdd}~XnX||d|_|j|7_|s*Pq*W|dkr*|j} |j|_n|jd|} |j|d|_| S)NrT)keependsrl) rkrirYrjlenrVreadrgr$rEUnicodeDecodeErrorstart splitlines) r9sizechars firstlinenewdatarPnewchars decodedbytesexclinesrQr:r:r;rosD       zStreamReader.readNTc Cs|jrP|jd}|jd=t|jdkr8|jd|_d|_|sL|jddd}|S|pVd}|j}xr|j|dd}|rt|tr|jdst|t r|jd r||jddd 7}||7}|jdd}|rt|dkr:|d}|d=t|dkr|d |j7<||_d|_n|d|j|_|s8|jddd}P|d}|djddd}||kr|jj |dd|j|_|r|}n|}P| s|dk r|r| r|jddd}P|d krb|d 9}qbW|S)NrrlF)rmHT)ru  )rsrti@) rkrnrjrrriro isinstancestrendswithbytesrY) r9rsrmlinereadsizerPrz line0withendline0withoutendr:r:r;readlines^       zStreamReader.readlinecCs|j}|j|S)N)rorr)r9sizehintrmrPr:r:r; readlines]s zStreamReader.readlinescCsd|_|j|_d|_dS)NrS)rgrirjrk)r9r:r:r;rJls zStreamReader.resetrcCs|jj|||jdS)N)rVr\rJ)r9r]r^r:r:r;r\yszStreamReader.seekcCs|j}|r|StdS)N)r StopIteration)r9rr:r:r;__next__szStreamReader.__next__cCs|S)Nr:)r9r:r:r;__iter__szStreamReader.__iter__cCs ||j|S)N)rV)r9r3r_r:r:r;r`szStreamReader.__getattr__cCs|S)Nr:)r9r:r:r;raszStreamReader.__enter__cCs|jjdS)N)rVrb)r9rcrdrer:r:r;rfszStreamReader.__exit__)rB)rBrr)rrF)NT)NT)r)rAr=r>rrhrHr$rorrrJr\rrr_r`rarfr:r:r:r;rs   P K   c@seZdZdZd ddZd"ddZd#d d Zd$d d Zd dZddZ ddZ ddZ ddZ d%ddZ efddZddZddZdS)&runknownrBcCs(||_||||_||||_||_dS)N)rVreaderwriterrE)r9rVReaderWriterrEr:r:r;rHs   zStreamReaderWriter.__init__rlcCs |jj|S)N)rro)r9rsr:r:r;roszStreamReaderWriter.readNcCs |jj|S)N)rr)r9rsr:r:r;rszStreamReaderWriter.readlinecCs |jj|S)N)rr)r9rr:r:r;rszStreamReaderWriter.readlinescCs t|jS)N)nextr)r9r:r:r;rszStreamReaderWriter.__next__cCs|S)Nr:)r9r:r:r;rszStreamReaderWriter.__iter__cCs |jj|S)N)rrW)r9rPr:r:r;rWszStreamReaderWriter.writecCs |jj|S)N)rr[)r9rZr:r:r;r[szStreamReaderWriter.writelinescCs|jj|jjdS)N)rrJr)r9r:r:r;rJs zStreamReaderWriter.resetrcCs6|jj|||jj|dkr2|dkr2|jjdS)Nr)rVr\rrJr)r9r]r^r:r:r;r\s zStreamReaderWriter.seekcCs ||j|S)N)rV)r9r3r_r:r:r;r`szStreamReaderWriter.__getattr__cCs|S)Nr:)r9r:r:r;raszStreamReaderWriter.__enter__cCs|jjdS)N)rVrb)r9rcrdrer:r:r;rfszStreamReaderWriter.__exit__)rBr)r)N)N)r)rAr=r>encodingrHrorrrrrWr[rJr\r_r`rarfr:r:r:r;rs       c@seZdZdZdZdddZdddZd d d Zd!d d Zd dZ ddZ ddZ ddZ ddZ efddZddZddZdS)"rrrBcCs4||_||_||_||||_||||_||_dS)N)rVr#r$rrrE)r9rVr#r$rrrEr:r:r;rHs   zStreamRecoder.__init__rlcCs"|jj|}|j||j\}}|S)N)rror#rE)r9rsrP bytesencodedr:r:r;ro"s zStreamRecoder.readNcCs6|dkr|jj}n |jj|}|j||j\}}|S)N)rrr#rE)r9rsrPrr:r:r;r(s   zStreamRecoder.readlinecCs(|jj}|j||j\}}|jddS)NT)rm)rror#rErr)r9rrPrr:r:r;r1s zStreamRecoder.readlinescCs t|j}|j||j\}}|S)N)rrr#rE)r9rPrr:r:r;r7s zStreamRecoder.__next__cCs|S)Nr:)r9r:r:r;r>szStreamRecoder.__iter__cCs|j||j\}}|jj|S)N)r$rErrW)r9rP bytesdecodedr:r:r;rWAszStreamRecoder.writecCs(dj|}|j||j\}}|jj|S)NrF)rYr$rErrW)r9rZrPrr:r:r;r[Fs zStreamRecoder.writelinescCs|jj|jjdS)N)rrJr)r9r:r:r;rJLs zStreamRecoder.resetcCs ||j|S)N)rV)r9r3r_r:r:r;r`QszStreamRecoder.__getattr__cCs|S)Nr:)r9r:r:r;raXszStreamRecoder.__enter__cCs|jjdS)N)rVrb)r9rcrdrer:r:r;rf[szStreamRecoder.__exit__)rBr)r)N)N)rAr=r> data_encoding file_encodingrHrorrrrrWr[rJr_r`rarfr:r:r:r;rs    rrBrlcCsV|dk rd|kr|d}tj|||}|dkr2|St|}t||j|j|}||_|S)Nb)builtinsrrrr7r6r)filenamemoderrE bufferingfileinfosrwr:r:r;r`scCsF|dkr |}t|}t|}t||j|j|j|j|}||_||_|S)N)rrr#r$r7r6rr)rrrrE data_info file_infosrr:r:r;rs cCs t|jS)N)rr#)rr:r:r;rscCs t|jS)N)rr$)rr:r:r;rscCst|j}|dkrt||S)N)rr4 LookupError)rencoderr:r:r;rs cCst|j}|dkrt||S)N)rr5r)rdecoderr:r:r;r s cCs t|jS)N)rr7)rr:r:r;r!scCs t|jS)N)rr6)rr:r:r;r"scksLt||f|}x |D]}|j|}|r|VqW|jdd}|rH|VdS)NrFT)rr#)iteratorrrEkwargsrrDoutputr:r:r;r%s     cksLt||f|}x |D]}|j|}|r|VqW|jdd}|rH|VdS)NrST)r r$)rrrErrrDrr:r:r;r&s     cCsdd|DS)NcSsi|] }||qSr:r:).0ir:r:r; "sz&make_identity_dict..r:)rngr:r:r;make_identity_dictsrcCs8i}x.|jD]"\}}||kr(|||<qd||<qW|S)N)items) decoding_mapmkvr:r:r;make_encoding_map$s   rignorereplacexmlcharrefreplacebackslashreplace namereplace__main__zlatin-1zutf-8)rNrBrl)NrB)rB)rB);rsys_codecs ImportErrorZwhy SystemError__all__rr rrrrr byteorderrrrr r r r r1rrrXrrNrrTrrrrrrrrrr r!r"r%r&rrr.r'r(r)r*r+r,r_falseZ encodingsrAstdoutstdinr:r:r:r; s     B("1+IzWn * &         pipes.cpython-36.opt-2.pyc000064400000011511152462730460011262 0ustar003 \"@slddlZddlZddlZddlmZdgZdZdZdZdZ dZ d Z eeee e e gZ Gd ddZ d d ZdS) N)quoteTemplateZffz-fzf-z--z.-z-.c@sleZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZdS)rcCsd|_|jdS)Nr) debuggingreset)selfr/usr/lib64/python3.6/pipes.py__init__UszTemplate.__init__cCs d|jfS)Nz