Viewing File: /usr/lib/python3.6/site-packages/pip/_vendor/distlib/__pycache__/markers.cpython-36.pyc

3

£éajŠã@sddZddlZddlZddlZddlZddlmZmZddlm	Z	dgZ
Gdd„deƒZd
d	d„Z
dS)zEParser for the environment markers micro-language defined in PEP 345.éNé)Úpython_implementationÚstring_types)Úin_venvÚ	interpretc
@sôeZdZdZdd„dd„dd„dd„dd„dd„d	d„d
d„dd„dœ	Zejd
ejdd…ejj	ddƒde
jee
ƒƒejƒejƒejƒeƒdœ	Zd*dd„Zdd„Zdd„Zd+dd„Zdd„Zdd„Zd d!„Zd"d#„Zd$d%„Zd&d'„Zd(d)„ZdS),Ú	Evaluatorz5
    A limited evaluator for Python expressions.
    cCs||kS)N©)ÚxÚyrrú/usr/lib/python3.6/markers.pyÚ<lambda>szEvaluator.<lambda>cCs||kS)Nr)r	r
rrrrscCs||kS)Nr)r	r
rrrrscCs||kS)Nr)r	r
rrrrscCs||kS)Nr)r	r
rrrrscCs||kS)Nr)r	r
rrrrscCs|S)Nr)r	rrrr scCs||kS)Nr)r	r
rrrr!scCs||kS)Nr)r	r
rrrr"s)	ÚeqÚgtZgteÚinÚltZlteÚnotZnoteqZnotinz%s.%sNéú rr)	Zsys_platformZpython_versionZpython_full_versionZos_nameZplatform_in_venvZplatform_releaseZplatform_versionZplatform_machineZplatform_python_implementationcCs|pi|_d|_dS)zu
        Initialise an instance.

        :param context: If specified, names are looked up in this mapping.
        N)ÚcontextÚsource)ÚselfrrrrÚ__init__3s
zEvaluator.__init__cCs8d}d|j|||…}||t|jƒkr4|d7}|S)zH
        Get the part of the source which is causing a problem.
        é
z%rz...)rÚlen)rÚoffsetZfragment_lenÚsrrrÚget_fragment<s
zEvaluator.get_fragmentcCst|d|dƒS)z@
        Get a handler for the specified AST node type.
        zdo_%sN)Úgetattr)rÚ	node_typerrrÚget_handlerFszEvaluator.get_handlercCsÄt|tƒrr||_ddi}|r$||d<ytj|f|Ž}Wn:tk
rp}z|j|jƒ}td|ƒ‚WYdd}~XnX|jj	j
ƒ}|j|ƒ}|dkr¼|jdkr d}n|j|jƒ}td||fƒ‚||ƒS)zf
        Evaluate a source string or node, using ``filename`` when
        displaying errors.
        ÚmodeÚevalÚfilenamezsyntax error %sNz(source not available)z don't know how to evaluate %r %s)
Ú
isinstancerrÚastÚparseÚSyntaxErrorrrÚ	__class__Ú__name__ÚlowerrÚ
col_offset)rÚnoder"ÚkwargsÚerrZhandlerrrrÚevaluateLs&


zEvaluator.evaluatecCs&t|tjƒstdƒ‚d|jj|jfS)Nzattribute node expectedz%s.%s)r#r$Z	AttributeÚAssertionErrorÚvalueÚidÚattr)rr+rrrÚget_attr_keyfszEvaluator.get_attr_keycCsft|jtjƒsd}n|j|ƒ}||jkp0||jk}|sBtd|ƒ‚||jkrX|j|}n
|j|}|S)NFzinvalid expression: %s)r#r0r$ÚNamer3rÚallowed_valuesr&)rr+ÚvalidÚkeyÚresultrrrÚdo_attributejs


zEvaluator.do_attributecCs„|j|jdƒ}|jjtjk}|jjtjk}|s8|s8t‚|r@|sJ|r€|r€x4|jdd…D]"}|j|ƒ}|rp|sz|rZ|rZPqZW|S)Nrr)r.ÚvaluesÚopr'r$ZOrZAndr/)rr+r8Zis_orZis_andÚnrrrÚ	do_boolopxs
zEvaluator.do_boolopc	s–‡‡fdd„}ˆj}ˆj|ƒ}d}xntˆjˆjƒD]\\}}|||ƒ|jjjƒ}|ˆjkrft	d|ƒ‚ˆj|ƒ}ˆj|||ƒ}|s†P|}|}q2W|S)Ncs@d}t|tjƒr t|tjƒr d}|s<ˆjˆjƒ}td|ƒ‚dS)NTFzInvalid comparison: %s)r#r$ZStrrr*r&)ÚlhsnodeÚrhsnoder6r)r+rrrÚsanity_check…sz*Evaluator.do_compare.<locals>.sanity_checkTzunsupported operation: %r)
Úleftr.ÚzipZopsZcomparatorsr'r(r)Ú	operatorsr&)	rr+r@r>Zlhsr8r;r?Zrhsr)r+rrÚ
do_compare„s 




zEvaluator.do_comparecCs|j|jƒS)N)r.Zbody)rr+rrrÚ
do_expression¢szEvaluator.do_expressioncCsTd}|j|jkr"d}|j|j}n|j|jkr>d}|j|j}|sPtd|jƒ‚|S)NFTzinvalid expression: %s)r1rr5r&)rr+r6r8rrrÚdo_name¥szEvaluator.do_namecCs|jS)N)r)rr+rrrÚdo_str±szEvaluator.do_str)N)N)r(Ú
__module__Ú__qualname__Ú__doc__rCÚsysÚplatformÚversion_infoÚversionÚsplitÚosÚnameÚstrrÚreleaseÚmachinerr5rrrr.r3r9r=rDrErFrGrrrrrs<

	

rcCst|ƒj|jƒƒS)zò
    Interpret a marker and return a result depending on environment.

    :param marker: The marker to interpret.
    :type marker: str
    :param execution_context: The context used for name lookup.
    :type execution_context: mapping
    )rr.Ústrip)ZmarkerZexecution_contextrrrrµs	)N)rJr$rPrKrLÚcompatrrÚutilrÚ__all__ÚobjectrrrrrrÚ<module>s"
Back to Directory File Manager