ó â\e[c@s\dZddlZddlZddlZddlZddlZddddddgZejd d kr‚eZ d d „Z ne Z d d „Z d„Z d„Z d„Zd„Zd„Zd„Zd„Zdefd„ƒYZejdkr=ddlZidd6dd6dd6Zd„Zd„Zd „Znd!„Zd"„Zd#„ZdS($sUtility functions.iÿÿÿÿNturlsafe_b64encodeturlsafe_b64decodetutf8tto_jsont from_jsontmatches_requirementiitasciicCs|S(N((tstencoding((s+/tmp/pip-install-0xiv62/wheel/wheel/util.pytnativescCs t|tƒr|j|ƒS|S(N(t isinstancetbytestdecode(RR((s+/tmp/pip-install-0xiv62/wheel/wheel/util.pyR s cCstj|ƒjtdƒƒS(s!urlsafe_b64encode without paddingt=(tbase64Rtrstriptbinary(tdata((s+/tmp/pip-install-0xiv62/wheel/wheel/util.pyRscCs)ddt|ƒd@}tj||ƒS(s!urlsafe_b64decode without paddingR ii(tlenRR(Rtpad((s+/tmp/pip-install-0xiv62/wheel/wheel/util.pyR"scCstj|dtƒS(sConvert given data to JSON.t sort_keys(tjsontdumpstTrue(to((s+/tmp/pip-install-0xiv62/wheel/wheel/util.pyR(scCs tj|ƒS(sDecode a JSON payload.(Rtloads(tj((s+/tmp/pip-install-0xiv62/wheel/wheel/util.pyR-scCsJtjddkr&i}|d7}nidd6dd6}t|||S(Niitbttnewlinesutf-8R(tsyst version_infotopen(tnametmodetkwargs((s+/tmp/pip-install-0xiv62/wheel/wheel/util.pyt open_for_csv2s  cCs t|tƒr|jdƒS|S(sUtf-8 encode data.sutf-8(R t text_typetencode(R((s+/tmp/pip-install-0xiv62/wheel/wheel/util.pyR<s cCs t|tƒr|jdƒS|S(NR(R R%R&(R((s+/tmp/pip-install-0xiv62/wheel/wheel/util.pyRCs t HashingFilecBsAeZdd„Zd„Zd„Zd„Zd„Zd„ZRS(tsha256cCs:t||ƒ|_||_tj|ƒ|_d|_dS(Ni(R tfdthashtypethashlibtnewthashtlength(tselftpathR"R*((s+/tmp/pip-install-0xiv62/wheel/wheel/util.pyt__init__Js cCs9|jj|ƒ|jt|ƒ7_|jj|ƒdS(N(R-tupdateR.RR)twrite(R/R((s+/tmp/pip-install-0xiv62/wheel/wheel/util.pyR3PscCs|jjƒdS(N(R)tclose(R/((s+/tmp/pip-install-0xiv62/wheel/wheel/util.pyR4UscCsF|jdkr|jjƒS|jjƒ}|jdtt|ƒƒS(Ntmd5R (R*R-t hexdigesttdigestR R(R/R7((s+/tmp/pip-install-0xiv62/wheel/wheel/util.pyR7Xs cCs|S(N((R/((s+/tmp/pip-install-0xiv62/wheel/wheel/util.pyt __enter__^scCs|jjƒdS(N(R)R4(R/texc_typetexc_valtexc_tb((s+/tmp/pip-install-0xiv62/wheel/wheel/util.pyt__exit__as(t__name__t __module__R1R3R4R7R8R<(((s+/tmp/pip-install-0xiv62/wheel/wheel/util.pyR'Is      twin32it CSIDL_APPDATAitCSIDL_LOCAL_APPDATAi#tCSIDL_COMMON_APPDATAcCsEd}tjtjjƒ}tjjjdt|d||ƒ|jS(Ni( tctypestcreate_unicode_buffertwintypestMAX_PATHtwindlltshell32tSHGetFolderPathWtcsidltvalue(R!tSHGFP_TYPE_CURRENTtbuf((s+/tmp/pip-install-0xiv62/wheel/wheel/util.pytget_pathks#cGsGtdƒ}tjj||Œ}tjj|ƒsCtj|ƒn|S(NRA(RNtosR0tjointisdirtmakedirs(tresourcetappdataR0((s+/tmp/pip-install-0xiv62/wheel/wheel/util.pytsave_config_pathqs  cgs\ddg}xI|D]A}t|ƒ}tjj||Œ}tjj|ƒr|VqqWdS(NRARB(RNROR0RPtexists(RStidstidtbaseR0((s+/tmp/pip-install-0xiv62/wheel/wheel/util.pytload_config_pathsxs    cGsddl}|jj|ŒS(Niÿÿÿÿ(txdg.BaseDirectoryt BaseDirectoryRU(RStxdg((s+/tmp/pip-install-0xiv62/wheel/wheel/util.pyRU€s cGsddl}|jj|ŒS(Niÿÿÿÿ(R[R\RZ(RSR]((s+/tmp/pip-install-0xiv62/wheel/wheel/util.pyRZ„s cCs°yddlm}m}Wntk r9tdƒ‚nX|j|ƒ}g}xZ|D]R}|j}|d|jdƒd|jdƒƒ}||krV|j|ƒqVqVW|S(s„List of wheels matching a requirement. :param req: The requirement to satisfy :param wheels: List of wheels to search. iÿÿÿÿ(t Distributiont Requirements-Cannot use requirements without pkg_resourcest project_nameR!tversiontver( t pkg_resourcesR^R_t ImportErrort RuntimeErrortparsetparsed_filenametgrouptappend(treqtwheelsR^R_tselectedtwftftdist((s+/tmp/pip-install-0xiv62/wheel/wheel/util.pyR‰s   ' (t__doc__RR+RRORt__all__RtunicodeR%R tstrRRRRR$RRtobjectR'tplatformtctypes.wintypesRCRJRNRURZR(((s+/tmp/pip-install-0xiv62/wheel/wheel/util.pyts: