B 4]. @sdZddlZddlZddlZddlZddlZejdkZejdkZejdkZ ejdkZ ejdkZ ejdkZ ejdkZ ejd Zeed Zejd Ze oe ZejZejZejZeZed d ddddddgZy ddlZWnek rddlZYnXe r ddZneZddZ e r4ddl!Z!ddl"Z"ddl#Z#ddl$Z$ddl%Z%ddl&m'Z'ddl(m)Z*ddl(m+Z+ddl$m,Z,ddl-m.Z.m/Z/m0Z0m1Z1m2Z2efZ3e4fZ5e4Z6eZ7e8fZ9e:Z;e$jZ?e@ZAeBe"dZCeBe"dZDeBe"dZEd d!ZFd"d#ZGd$d%ZHd&d'ZId(d)ZJdWd*d+ZKd,d-ZLd.d/ZMe r(eNZNnd0d1ZNnZDd?d@ZEdAd-ZLdBd/ZMdCd'ZIdDdEZ[e\dFe rddGlm]Z]ddddHiiedIddJddKddLde]f dMdNZ^n(e rddOlm_Z`dPdNZ^n ddOlm_Z^erddlambZcnddlZcejdQdRZddYdSdTZedUdVZfdS)Zz1Handle Python version/platform incompatibilities.N))rr)r)r)rr)rrrjavaZpypy_version_infowin FullArgSpecargsvarargsvarkwdefaults kwonlyargskwonlydefaults annotationscCs|S)N)argrrI/opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/util/compat.py7rc Cst|r|j}t|s(td||j}t|sFtd||j}|j }t r\|j nd}t |d|}t ||||}||7}d}|j tj@r|j |}|d}d}|j tj@r|j |}t||||j|t r|jndt r|jniS)z9Fully vendored version of getfullargspec from Python 3.3.z{!r} is not a Python functionz{!r} is not a code objectrN)inspectZismethod__func__Z isfunction TypeErrorformat__code__Ziscode co_argcount co_varnamespy3kco_kwonlyargcountlistco_flagsZ CO_VARARGSZCO_VARKEYWORDSr __defaults____kwdefaults____annotations__) funcconargsnamesZnkwargsr r r r rrrinspect_getfullargspec<s8        r()reduce)BytesIO)StringIO) zip_longest) quote_plus unquote_plus parse_qslquoteunquoteexec __import__printcCs |dS)Nzlatin-1)encode)srrrbsr7cCst|dS)Nascii)base64 b64decoder5)xrrrr:sr:cCst|dS)Nr8)r9 b64encodedecode)r;rrrr<sr<cCs|j|ddS)Nbackslashreplace)errors)r=)textencodingrrrdecode_backslashreplacesrBcCs||k||kS)Nr)ar7rrrcmpsrDcCs:|dk r||k std||_|j|k r2|||dS)NzSame cause emitted)AssertionError __cause__ __traceback__with_traceback)tpvaluetbcauserrrreraises   rMcCs|S)Nr)r6rrrusrNcCs|S)Nr)r6rrruesrOcCs t|dS)N__call__)hasattr)fnrrrcallablesrS) izip_longest)r0)r-)r1)r.)r/cCs|S)Nr)r6rrrr7scCs|dkrtdntddS)Nzexec func_text in globals_zexec func_text in globals_, lcl)r2)Z func_textglobals_Zlclrrrexec_s rVcCsdd|DS)Ncss|]}t|VqdS)N)ord).0Zbyterrr sziterbytes..r)Zbufrrr iterbytessrZcGs4t|dkr,|dddd|dDf}t|S)NrrcSsg|] }t|qSr)str)rXrrrr szimport_..)lenr3)r rrrimport_s  r_cOsL|dtj}|dkrdSx,t|D] }t|ts:t|}||q$WdS)Nfile)popsysstdout enumerate isinstance basestringr\write)r kwargsfprrrrprint_s rjcCs t|dS)Nzutf-8)unicode)r6rrrrNscCs t|dS)NZunicode_escape)rk)r6rrrrOscCs4y ||Stk r.t|ddSXdS)Nr)r=UnicodeDecodeErrorrepr)r@rArrrrBs cCs<t|tst|jdddSt|tr4|jdddS|SdS)Nr8r>)r?)re string_typesrkr5)r@rrrsafe_bytestrings   rpzdef reraise(tp, value, tb=None, cause=None): if cause is not None: assert cause is not value, 'Same cause emitted' raise tp, value, tb )formatannotationrcCsd|S)N*r)namerrrrrcCsd|S)Nz**r)rsrrrrrcCs dt|S)N=)rn)rJrrrrrcCsd|S)Nz -> r)r@rrrrrc s(fdd} g}|r(t|t|}xFt|D]:\}}| |}|rb||krb|| |||}||q2W|dk r||| |n|r|d|rx:|D]2}| |}|r||kr|| ||7}||qW|dk r|| | |dd|d}dkr$|| d7}|S) aaCopy formatargspec from python 3.7 standard library. Python 3 has deprecated formatargspec and requested that Signature be used instead, however this requires a full reimplementation of formatargspec() in terms of creating Parameter objects and such. Instead of introducing all the object-creation overhead and having to reinvent from scratch, just copy their compatibility routine. Utimately we would need to rewrite our "decorator" routine completely which is not really worth it right now, until all Python 2.x support is dropped. cs(|}|kr$|d|7}|S)Nz: r)rresult)rrq formatargrrformatargandannotation-sz5inspect_formatargspec..formatargandannotationNrr(z, )return)r^rdappendjoin)r r r r r rrrvZ formatvarargsZ formatvarkwZ formatvalueZ formatreturnsrqrwZspecsZ firstdefaultirspecZ kwonlyargrur)rrqrvrinspect_formatargspecs2     r) formatargspeccOst|dd|S)Nrr[)_inspect_formatargspec)r~kwrrrrUsc gsg}g}d}zTy:x.|D]&}|j}|j}||||qW|VWnt}YnXWdx6|r|}y||r~d}Wqdt}YqdXqdW|dkrt|d|d|dXdS)zImplement contextlib.nested, mostly for unit tests. As tests still need to run on py2.6 we can't use multiple-with yet. Function is removed in py3k but also emits deprecation warning in 2.7 so just roll it here for everyone. )NNNNrrr)__exit__ __enter__r{rbexc_inforarM)ZmanagersZexitsZvars_excZmgrZexit_Zenterrrrnestedfs*    rcCsB|dkrt}|\}}}||k r&|nd}tt||||ddS)N)rKrL)rbrrMtype)Z exceptionrexc_type exc_valueZexc_tbrLrrrraise_from_causes  rcs"Gfddd}|ddiS)zCreate a base class with a metaclass. Drops the middle class upon creation. Source: http://lucumr.pocoo.org/2013/5/21/porting-to-python-3-redux/ cs&eZdZejZejZfddZdS)z!with_metaclass..metaclasscs$|dkrt||d|S||S)Nr)r__new__)clsrsZ this_basesd)basesmetarrrsz)with_metaclass..metaclass.__new__N)__name__ __module__ __qualname__rrP__init__rr)rrrr metaclasssrZtemporary_classNr)rrrr)rrrwith_metaclasss  r)NN)N)N)g__doc__ collections contextlibroperatorrb version_infoZpy36Zpy33Zpy35Zpy32rZpy2kZpy265platform startswithZjythonrQZpypyZwin32Zcpythoncontextmanager attrgetterZ dottedgetter namedtuplenextrZ threading ImportErrorZdummy_threadingZ safe_kwargr\r(r9builtinsZ configparser itertoolspickle functoolsr)ior*Z byte_bufferr+r,Z urllib.parser-r.r/r0r1robytesZ binary_typesZ binary_typeZ text_typeintZ int_typesiterrZ filterfalseZitertools_filterfalsefilterZitertools_filtermapZitertools_imapgetattrrVr_rjr7r:r<rBrDrMrNrOrSZ ConfigParserZ cStringIOrTZurllibZurlparseZcPicklerfrkZlongZ ifilterfalseZifilterZimaprpr2rqrrrZcollections.abcabcZcollections_abcrrrrrrrs              &                       5   #