Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
ó
ōEYc@sÇddlZddlZddlZddlmZejeƒZd„Zde	fd„ƒYZ
eje
ƒdefd„ƒYƒZ
d„Zd	„Zejd
ƒZd„Zd„Zd
„ZdS(iÿÿÿÿN(t_checkscs‡fd†}|S(sDecorator for reduction methods.

    Arguments are a sequence of tokens, in order, which should trigger running
    this reduction method.
    cs5t|dƒsg|_n|jjtˆƒƒ|S(Ntreducers(thasattrRtappendtlist(tfunc(ttokens(sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_policy/_parser.pyt	decorator$s((RR((RsH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_policy/_parser.pytreducers
tParseStateMetacBseZdZd„ZRS(sbMetaclass for the :class:`.ParseState` class.

    Facilitates identifying reduction methods.
    cCsˆg}xV|jƒD]H\}}t|dƒs4qnx$|jD]}|j||fƒq>WqW||d<tt|ƒj||||ƒS(s§Create the class.

        Injects the 'reducers' list, a list of tuples matching token sequences
        to the names of the corresponding reduction methods.
        R(titemsRRRtsuperR	t__new__(tmcstnametbasestcls_dictRtkeytvaluet	reduction((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_policy/_parser.pyR7s
(t__name__t
__module__t__doc__R(((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_policy/_parser.pyR	1st
ParseStatecBs(eZdZd„Zd„Zd„Zed„ƒZedddƒedddƒedd	dƒd
„ƒƒƒZ	edddƒd„ƒZ
ed	ddƒd
„ƒZedddƒd„ƒZedddƒedddƒd„ƒƒZ
ed	ddƒd„ƒZeddƒd„ƒZRS(sãImplement the core of parsing the policy language.

    Uses a greedy reduction algorithm to reduce a sequence of tokens into
    a single terminal, the value of which will be the root of the
    :class:`Check` tree.

    .. note::

        Error reporting is rather lacking.  The best we can get with this
        parser formulation is an overall "parse failed" error. Fortunately, the
        policy language is simple enough that this shouldn't be that big a
        problem.
    cCsg|_g|_dS(sInitialize the ParseState.N(Rtvalues(tself((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_policy/_parser.pyt__init__[s	cCsÜxÕ|jD]Ê\}}t|jƒt|ƒkr
|jt|ƒ|kr
t||ƒ}||jt|ƒŒ}g|D]}|d^q{|jt|ƒ)g|D]}|d^q¦|jt|ƒ)|jƒSq
WdS(séPerform a greedy reduction of the token stream.

        If a reducer method matches, it will be executed, then the
        :meth:`reduce` method will be called recursively to search for any more
        possible reductions.
        iiN(RtlenRtgetattrRtreduce(RRtmethnametmethtresultstr((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_policy/_parser.pyRas++cCs.|jj|ƒ|jj|ƒ|jƒdS(sIAdds one more token to the state.

        Calls :meth:`reduce`.
        N(RRRR(RttokR((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_policy/_parser.pytshiftyscCs/t|jƒdkr$tdƒ‚n|jdS(s}Obtain the final result of the parse.

        :raises ValueError: If the parse failed to reduce to a single result.
        isCould not parse rulei(RRt
ValueError(R((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_policy/_parser.pytresult…st(tcheckt)tand_exprtor_exprcCs
d|fgS(s4Turn parenthesized expressions into a 'check' token.R'((Rt_p1R't_p2((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_policy/_parser.pyt_wrap_checkstandcCsdtj||gƒfgS(sNCreate an 'and_expr'.

        Join two checks by the 'and' operator.
        R)(RtAndCheck(Rtcheck1t_andtcheck2((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_policy/_parser.pyt_make_and_expr˜scCse|jƒ\}}t|tjƒr:|}|j|ƒntj||gƒ}d|j|ƒfgS(sModify the case 'A or B and C'R*(t	pop_checkt
isinstanceRR/t	add_check(RR*R1R'R0R)((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_policy/_parser.pyt_mix_or_and_expr¡scCsd|j|ƒfgS(s.Extend an 'and_expr' by adding one more check.R)(R6(RR)R1R'((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_policy/_parser.pyt_extend_and_expr­storcCsdtj||gƒfgS(sLCreate an 'or_expr'.

        Join two checks by the 'or' operator.
        R*(RtOrCheck(RR0t_orR2((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_policy/_parser.pyt
_make_or_expr³scCsd|j|ƒfgS(s-Extend an 'or_expr' by adding one more check.R*(R6(RR*R;R'((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_policy/_parser.pyt_extend_or_expr½stnotcCsdtj|ƒfgS(s#Invert the result of another check.R'(RtNotCheck(Rt_notR'((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_policy/_parser.pyt_make_not_exprÃs(RRRRRR#tpropertyR%RR-R3R7R8R<R=RA(((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_policy/_parser.pyRKs			!		cCs×|dkrtjƒS|dkr,tjƒSy|jddƒ\}}Wn(tk
rrtjd|ƒtjƒSX|tjkr–tj|||ƒSdtjkr¹tjd||ƒStj	d|ƒtjƒSdS(s@Parse a single base check rule into an appropriate Check object.t!t@t:isFailed to understand rule %ss!No handler for matches of kind %sN(
Rt
FalseCheckt	TrueChecktsplitt	ExceptiontLOGt	exceptiontregistered_checkstNoneterror(truletkindtmatch((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_policy/_parser.pyt_parse_checkÊs


cCsã|stjƒSg}x“|D]‹}|s/qnt|tjƒrM|g}ng|D]}t|ƒ^qT}t|ƒdkr’|j|dƒq|jtj|ƒƒqW|s¼tj	ƒSt|ƒdkrÖ|dStj
|ƒS(suTranslates the old list-of-lists syntax into a tree of Check objects.

    Provided for backwards compatibility.
    ii(RRGR5tsixtstring_typesRRRRR/RFR:(ROtor_listt
inner_ruleR!tand_list((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_policy/_parser.pyt_parse_list_ruleäs"


s\s+ccsLxEtj|ƒD]4}|s|jƒr/qn|jdƒ}x)tt|ƒt|ƒƒD]}dVq[W|svqn|}|jdƒ}t|ƒt|ƒ}|jƒ}|dkrÇ||fVna|r(t|ƒdkr|d|dfddgkrd|dd!fVq(d
t|ƒfVnxt|ƒD]}dVq5WqWdS(s{Tokenizer for the policy language.

    Most of the single-character tokens are specified in the
    _tokenize_re; however, parentheses need to be handled specially,
    because they can appear inside a check string.  Thankfully, those
    parentheses that appear inside a check string can never occur at
    the very beginning or end ("%(variable)s" is the correct syntax).
    R&R(R.R9R>iiiÿÿÿÿt"t'tstringiR'N(R&R&(sandsorsnot(RYRY(RZRZ(R(R((	t_tokenize_reRHtisspacetlstriptrangeRtrstriptlowerRR(ROR"tcleantittrailtlowered((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_policy/_parser.pyt_parse_tokenizes*
#	#cCs€|stjƒStƒ}x*t|ƒD]\}}|j||ƒq&Wy|jSWn(tk
r{tjd|ƒtj	ƒSXdS(syParses policy to the tree.

    Translates a policy written in the policy language into a tree of
    Check objects.
    sFailed to understand rule %sN(
RRGRRfR#R%R$RJRKRF(ROtstateR"R((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_policy/_parser.pyt_parse_text_rule@s
	
cCs&t|tjƒrt|ƒSt|ƒS(s<Parses a policy rule into a tree of :class:`.Check` objects.(R5RSRTRhRX(RO((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_policy/_parser.pyt
parse_ruleZs
(tloggingtreRStoslo_policyRt	getLoggerRRJRttypeR	t
add_metaclasstobjectRRRRXtcompileR\RfRhRi(((sH/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_policy/_parser.pyt<module>s	~		(	1