U e @sddlmZddlZddlZddlmZmZddlmZej dkrbddl m Z ddd d d d Z n dd l m Z GdddeeZ dgZdS)) annotationsN)ABCabstractmethod) Activator) )filesstrbytes) module_namefilenamereturncCst||SN)r read_bytes)r r rP/opt/hc_python/lib/python3.8/site-packages/virtualenv/activation/via_template.py read_binary sr)rc@sLeZdZeddZddZddZddZd d Zd d Z e d dZ dS)ViaTemplateActivatorcCstdSr)NotImplementedError)selfrrr templatesszViaTemplateActivator.templatescCs@|j}|||}|||||}|jdk r<|j|jd<|S)Nprompt)bin_dir replacements _generater flag_promptZ pyenv_cfg)rcreator dest_folderr generatedrrrgenerates    zViaTemplateActivator.generatecCs8|jdkrdn|jt|j|jt|j|jtjdS)N)Z__VIRTUAL_PROMPT__Z__VIRTUAL_ENV__Z__VIRTUAL_NAME__Z __BIN_NAME__Z __PATH_SEP__)rr destenv_namer relative_toospathsep)rrrrrrr s z!ViaTemplateActivator.replacementsc CsXg}|D]J}||||}|||}|r8|||d||q|S)Nutf-8)instantiate_templateas_nameexistsunlink write_bytesencodeappend) rrrZ to_folderrrtemplatetextr"rrrr)s zViaTemplateActivator._generatecCs|Srr)rr/rrrr)7szViaTemplateActivator.as_namec CsHt|j|}|jddd}|D] \}}|||}|||}q"|S)Nr'strict)errors)r __module__decodeitems _repr_unicodereplace) rrr/rbinaryr0keyvalueZ value_unirrrr(:s   z)ViaTemplateActivator.instantiate_templatecCs|Srr)rr:rrrr6Csz"ViaTemplateActivator._repr_unicodeN) __name__r3 __qualname__rrr rrr)r( staticmethodr6rrrrrs   r) __future__rr%sysabcrrZ activatorr version_infoimportlib.resourcesr rr__all__rrrrs     6