ó ±2öYc@sŠddlZddlZddlZddlZddlZddljZddlm Z ej j ƒZ e ƒZ ddd„ƒYZdS(iÿÿÿÿN(tcommandst FunctionscBsbeZdZd„Zdd„Zd„Zd„Zd„Zd„Zd„Z d „Z d „Z RS( s Built-in functions cCstjƒ|_|jƒdS(N(t repositoryt Repositoryt _repositoryt _parse_init(tself((sF/usr/lib/python2.7/site-packages/tuned/profiles/functions/functions.pyt__init__stcCs7d|_||_t|ƒ|_g|_t|_dS(Ni(t_cntt_strtlent_lent_stacktFalset_esc(Rts((sF/usr/lib/python2.7/site-packages/tuned/profiles/functions/functions.pyRs    cCs$|j|jkr |j|jSdS(NR(R R R (R((sF/usr/lib/python2.7/site-packages/tuned/profiles/functions/functions.pyt _curr_charscCs|j|j|j|!S(N(R R (RR ((sF/usr/lib/python2.7/site-packages/tuned/profiles/functions/functions.pyt _curr_substr scCs|jj||jfƒdS(N(R tappendR (Rtesc((sF/usr/lib/python2.7/site-packages/tuned/profiles/functions/functions.pyt _push_pos#scCsu|j| ||j|d|_t|jƒ|_|jt|ƒ||d7_|jdkrqd|_ndS(Nii(R R R R (RtatbR((sF/usr/lib/python2.7/site-packages/tuned/profiles/functions/functions.pyt_sub&s #!cCsõtjd|j||j!ƒ}|ddkr3dStd„|ƒ}tjd|dƒsttjd|dƒdSy|jj |dƒ}Wn't k r·tjd|dƒdSX|j |d ƒ}|dkrÛdS|j ||j|ƒdS( Ns(?1ss\w+$isinvalid function name '%s'sfunction '%s' not implementedi(tretsplitR R tmaptmatchtlogterrorRt load_funct ImportErrortexecutetNoneR(Rt_fromtsltfR((sF/usr/lib/python2.7/site-packages/tuned/profiles/functions/functions.pyt _process_func-s   cCs|j|ƒxã|j|jkrò|jƒdkr‘y|jjƒ}Wn&tk rotjd|ƒ|j SX|ds¹|j |dƒq¹n(|j dƒdkr¹|j |j ƒn|jƒdkr×t|_ n t|_ |jd7_qWt|jƒrtjd|ƒn|j S( Nt}s.invalid variable syntax, non pair '}' in: '%s'iiis${s\s.invalid varialbe syntax, non pair '{' in: '%s'(RR R RR tpopt IndexErrorR"R#R R+RRRtTrueRR (RRtsi((sF/usr/lib/python2.7/site-packages/tuned/profiles/functions/functions.pyt_process?s&     cCs8|dks|dkr|Stjdd|j|ƒƒS(NRs \\(\${f:.*})s\1(R'RtsubR1(RR((sF/usr/lib/python2.7/site-packages/tuned/profiles/functions/functions.pytexpandVs( t__name__t __module__t__doc__RRRRRRR+R1R3(((sF/usr/lib/python2.7/site-packages/tuned/profiles/functions/functions.pyR s        ((tosRtglobRt tuned.logsttunedt tuned.conststconststtuned.utils.commandsRtlogstgetR"tcmdR(((sF/usr/lib/python2.7/site-packages/tuned/profiles/functions/functions.pyts