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||_|j|k r"|||dS)N) __cause__ __traceback__with_traceback)tpvaluetbcauserrrreraises   rLcCs|S)Nr)r6rrrusrMcCs|S)Nr)r6rrruesrNcCs t|dS)N__call__)hasattr)fnrrrcallablesrR) 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 rUcCsdd|DS)Ncss|]}t|VqdS)N)ord).0Zbyterrr sziterbytes..r)Zbufrrr iterbytessrYcGs4t|dkr,|dddd|dDf}t|S)NrrcSsg|] }t|qSr)str)rWrrrr 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 ricCs t|dS)Nzutf-8)unicode)r6rrrrMscCs t|dS)NZunicode_escape)rj)r6rrrrNscCs4y ||Stk r.t|ddSXdS)Nr)r=UnicodeDecodeErrorrepr)r@rArrrrBs cCs<t|tst|jdddSt|tr4|jdddS|SdS)Nr8r>)r?)rd string_typesrjr5)r@rrrsafe_bytestrings   rozdef 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)rrrrrrrcCs dt|S)N=)rm)rIrrrrrcCsd|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)rrp formatargrrformatargandannotation-sz5inspect_formatargspec..formatargandannotationNrq(z, )return)r]rcappendjoin)r r r r r rrruZ formatvarargsZ formatvarkwZ formatvalueZ formatreturnsrprvZspecsZ firstdefaultirspecZ kwonlyargrtr)rrprurinspect_formatargspecs2     r~) formatargspeccOst|dd|S)NrrZ)_inspect_formatargspec)r}kwrrrr~Usc 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__rzraexc_infor`rL)ZmanagersZexitsZvars_excZmgrZexit_Zenterrrrnestedfs*    rcCsB|dkrt}|\}}}||k r&|nd}tt||||ddS)N)rJrK)rarrLtype)Z exceptionrexc_type exc_valueZexc_tbrKrrrraise_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__)clsrrZ this_basesd)basesmetarrrsz)with_metaclass..metaclass.__new__N)__name__ __module__ __qualname__rrO__init__rr)rrrr metaclasssrZtemporary_classNr)rrrr)rrrwith_metaclasss  r)NN)N)N)g__doc__ collections contextlibroperatorra version_infoZpy36Zpy33Zpy35Zpy32rZpy2kZpy265platform startswithZjythonrPZpypyZwin32Zcpythoncontextmanager attrgetterZ dottedgetter namedtuplenextrZ threading ImportErrorZdummy_threadingZ safe_kwargr[r(r9builtinsZ configparser itertoolspickle functoolsr)ior*Z byte_bufferr+r,Z urllib.parser-r.r/r0r1rnbytesZ binary_typesZ binary_typeZ text_typeintZ int_typesiterrY filterfalseZitertools_filterfalsefilterZitertools_filtermapZitertools_imapgetattrrUr^rir7r:r<rBrDrLrMrNrRZ ConfigParserZ cStringIOrSZurllibZurlparseZcPicklererjZlongZ ifilterfalseZifilterZimapror2rpr~rrZcollections.abcabcZcollections_abcrrrrrrrs              &                       5   #