Ñò ®XRc@sÍddkZddkZddkZddkiiZddkiZddki Z ddk i Z ddkiZddklZddkiZddklZlZlZddkZdeifd„ƒYZdeifd„ƒYZdeifd „ƒYZd eifd „ƒYZd efd „ƒYZdeifd„ƒYZdei fd„ƒYZ dei!fd„ƒYZ!dei"fd„ƒYZ"dei#fd„ƒYZ#dei$fd„ƒYZ$dS(iÿÿÿÿN(tchoose(tBooleanQueryExceptiont ParseErrortQueryLengthExceededt QueryLexercBseZRS((t__name__t __module__(((s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pyR&st QueryParsercBseZdZd„ZRS(sYThis class exists so that the classes the parent class query parser uses to build the AST are the ones defined in this module and not the parent class's module. This is done so that a single query parser can be shared between the client and server modules but will construct an AST using the appropriate classes.cCsztii||ƒtiti}h}xA|iiƒD]0}t||ƒpt ‚t ||ƒ||(R RRtRETURN_ACTIONS(R((s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pyt__str__PscCstii|_dS(s€Makes this node return packages instead of actions. Returns None because no changes need to be made to the tree.N(RRtRETURN_PACKAGESR tNone(R((s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pytpropagate_pkg_returnVs(RRR R"R$R&R)(((s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pyRFs     tOrQuerycBseZd„ZRS(cCso|ii|ƒ}|pt|iiƒ|_n|ii|ƒ}|pt|iiƒ|_n|p|S(N(RRRR R(RRRR((s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pyR^s(RRR(((s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pyR*]st PkgConversioncBseZd„ZRS(cCs|ii|ƒS(N(tqueryR(RR((s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pyRis(RRR(((s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pyR+hst PhraseQuerycBseZd„ZRS(cCs|ii|ƒS(N(R,R(RR((s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pyRns(RRR(((s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pyR-mst FieldQuerycBseZd„ZRS(cCs|ii|ƒS(N(R,R(RR((s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pyRss(RRR(((s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pyR.rstTopQuerycBsMeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z RS(sžThis class handles raising the exception if the search was conducted without using indexes. It yields all results, then raises the exception.cOs#tii|||Žt|_dS(N(RR/R tFalset_TopQuery__use_slow_search(RR!R#((s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pyR |scCs|iS(s)Return whether slow search has been used.(R1(R((s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pytget_use_slow_search€scCs ||_dS(s&Set whether slow search has been used.N(R1(Rtval((s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pytset_use_slow_search…scKs)tii|d|id|i|dS(snThis function provides the necessary information to the AST so that a search can be performed.R2R4N(RR/R$R2R4(RR#((s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pyR$Šs cgsCx"tii||ŒD] }|VqW|iotiƒ‚ndS(s¸This function performs performs local client side search. If slow search was used, then after all results have been returned, it raises SlowSearchUsed.N(RR/R"R1t api_errorstSlowSearchUsed(RR!ti((s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pyR"“s   cCs|ii|ƒS(N(R,R(RR((s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pyRžscCs<|i}t|tƒo |i}nt||ƒ|_dS(N(R,t isinstanceR/R*(RRR((s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pytadd_or¡s  ( RRRR R2R4R$R"RR9(((s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pyR/ws    t TermQuerycBs†eZdZhZhZd„Zd„Zd„Zd„Zd„Z d„Z d„Z d„Z d „Z d „Zd „Zd „ZRS( s`This class handles the client specific search logic for searching for a base query term.cCsDtii||ƒd|_d|_d|_d|_d|_dS(N( RR:R R(t_impl_fmri_to_patht_efnt_data_fast_removetfull_fmri_hasht_data_fast_add(Rtterm((s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pyR ¯s     cCs~|i}||jodStii||ƒ||}titiƒ|dR0tsetNoIndexExceptiontTrueRX(RRYR2R4R#RURN((s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pyR$Ós&       cCsÎ|o|i|ƒS|iƒp•y|ii|iƒWn"tij otiƒ‚nX|i|ƒ}|i ||ƒ}|i |ƒ}t i |i |ƒ|i|ƒƒ}|S|i|||ƒSdS(s6This function performs performs local client side search. The "restriction" parameter is a generator over the results that another branch of the AST has already found. If it exists, those results are treated as the domain for search. If it does not exist, search uses the set of actions from installed packages as the domain. The "fmris" parameter is a function which produces an object which iterates over the names of installed fmris. The "manifest_func" parameter is a function which takes a fmri and returns a path to the manifest for that fmri. The "excludes" parameter is a list of the variants defined for this image.N(t_restricted_search_internalR2R>tcheck_against_fileR<R[tIncorrectIndexFileHashR5t_search_internalt_search_fast_updatet_check_fast_removet itertoolstchaint _get_resultst_get_fast_resultst slow_search(Rt restrictiontfmrist manifest_functexcludestbase_rest client_restit((s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pyR"þs     cs‡fd†|DƒS(sñThis function removes any results from the generator "res" (the search results) that are actions from packages known to have been removed from the image since the last time the index was built.c3sNxG|]@\}}}}}ˆii|ƒp|||||fVqqWdS(N(R=t has_entity(t.0tp_strtotatstf(R(s=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pys ,s ((Rtres((Rs=/usr/lib/python2.6/vendor-packages/pkg/client/query_parser.pyRc%s c CsÙ|iiƒdj pt‚|i}|i}|i}|p t}nh}g}x |ii D]ÿ}|i p |i |ƒpqbnt i |ƒ} || ƒ} tii| dtd|ƒ} xœ| D]”} | \} }}}|ip ||ij p|ip ||ij oqÉn| |jog|| s,     1