ó ‚ß+Uc@såddlZddlZddlZddlZddlmZmZmZdefd„ƒYZde fd„ƒYZ d„Z dd „Z d „Z d „Zd „Zd „Zd„Zd„Ze ƒe ƒd„Zd„ZdS(iÿÿÿÿN(t str_typestMutableMappingturlsplittURIDictcBsVeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z RS( s9 Dictionary which uses normalized URIs as keys. cCst|ƒjƒS(N(Rtgeturl(tselfturi((s5/usr/lib/python2.7/site-packages/jsonschema/_utils.pyt normalizescOs#tƒ|_|jj||ŽdS(N(tdicttstoretupdate(Rtargstkwargs((s5/usr/lib/python2.7/site-packages/jsonschema/_utils.pyt__init__s cCs|j|j|ƒS(N(R R(RR((s5/usr/lib/python2.7/site-packages/jsonschema/_utils.pyt __getitem__scCs||j|j|ƒ((R((s5/usr/lib/python2.7/site-packages/jsonschema/_utils.pyR/s(RRRR(((s5/usr/lib/python2.7/site-packages/jsonschema/_utils.pyR)scCs1tjddj|ƒƒ}tj|jdƒƒS(sD Load a schema from ./schemas/``name``.json and return it. t jsonschemasschemas/{0}.jsonsutf-8(tpkgutiltget_datatformattjsontloadstdecode(tnametdata((s5/usr/lib/python2.7/site-packages/jsonschema/_utils.pyt load_schema3sics#dj‡fd†|jƒDƒƒS(sE A dumb version of :func:`textwrap.indent` from Python 3.3. s c3s!|]}ddˆ|VqdS(t iN((t.0tline(ttimes(s5/usr/lib/python2.7/site-packages/jsonschema/_utils.pys Cs(tjoint splitlines(tstringR)((R)s5/usr/lib/python2.7/site-packages/jsonschema/_utils.pytindent=scCs%|s dSddjd„|DƒƒS(s¢ Construct a single string containing indexing operations for the indices. For example, [1, 2, "foo"] -> [1][2]["foo"] :type indices: sequence ts[%s]s][css|]}t|ƒVqdS(N(R(R'tindex((s5/usr/lib/python2.7/site-packages/jsonschema/_utils.pys Rs(R*(tindices((s5/usr/lib/python2.7/site-packages/jsonschema/_utils.pytformat_as_indexFs ccst|jdiƒ}dj|jdiƒƒ}x@|D]8}||kr4|rdtj||ƒrdq4n|Vq4q4WdS(sî Return the set of additional properties for the given ``instance``. Weeds out properties that should have been validated by ``properties`` and / or ``patternProperties``. Assumes ``instance`` is dict-like already. t propertiest|tpatternPropertiesN(tgetR*tretsearch(tinstancetschemaR2tpatternstproperty((s5/usr/lib/python2.7/site-packages/jsonschema/_utils.pytfind_additional_propertiesUs   cCs>t|ƒdkrd}nd}djd„|Dƒƒ|fS(sA Create an error message for extra items or properties. itwastweres, css|]}t|ƒVqdS(N(R(R'textra((s5/usr/lib/python2.7/site-packages/jsonschema/_utils.pys ss(RR*(textrastverb((s5/usr/lib/python2.7/site-packages/jsonschema/_utils.pyt extras_msgis cCspg}xP|D]H}y|jt|dƒƒWq tk rT|jt|ƒƒq Xq Wd|dj|ƒfS(s, Create an error message for a failure to match the given types. If the ``instance`` is an object and contains a ``name`` property, it will be considered to be a description of that object and used as its type. Otherwise the message is simply the reprs of the given ``types``. R#s%r is not of type %ss, (tappendRt ExceptionR*(R8ttypestreprsttype((s5/usr/lib/python2.7/site-packages/jsonschema/_utils.pyt types_msgvs   cCsqtƒ}t|tƒs$|f}nx@|D]8}t|tƒrV|jt|ƒƒq+|j|ƒq+Wt|ƒS(sã isinstance() can accept a bunch of really annoying different types: * a single type * a tuple of types * an arbitrary nested tree of tuples Return a flattened tuple of the given argument. (tsett isinstancettupleR tflattentadd(tsuitable_for_isinstanceREtthing((s5/usr/lib/python2.7/site-packages/jsonschema/_utils.pyRLŠs   cCst|tƒr|gS|S(s^ Wrap ``thing`` in a list if it's a single str. Otherwise, return it unchanged. (RJR(RO((s5/usr/lib/python2.7/site-packages/jsonschema/_utils.pyt ensure_list¡scCs$|tkr|S|tkr |S|S(sI A hack to make True and 1 and False and 0 unique for ``uniq``. (tTruetFalse(telementttruetfalse((s5/usr/lib/python2.7/site-packages/jsonschema/_utils.pytunbool®s   cCsûy*ttd„|Dƒƒƒt|ƒkSWnÊtk röy_td„|Dƒƒ}tj|ddƒ}x-t||ƒD]\}}||krxtSqxWWq÷t tfk ròg}x;|D]/}t |ƒ}||krÞtS|j |ƒq¼Wq÷XnXt S(sÚ Check if all of a container's elements are unique. Successively tries first to rely that the elements are hashable, then falls back on them being sortable, and finally falls back on brute force. css|]}t|ƒVqdS(N(RV(R'ti((s5/usr/lib/python2.7/site-packages/jsonschema/_utils.pys Æscss|]}t|ƒVqdS(N(RV(R'RW((s5/usr/lib/python2.7/site-packages/jsonschema/_utils.pys ÉsiN( RRIt TypeErrortsortedt itertoolstislicetNonetzipRRtNotImplementedErrorRVRCRQ(t containertsorttslicedRWtjtseente((s5/usr/lib/python2.7/site-packages/jsonschema/_utils.pytuniq»s" *      (RZR RR6tjsonschema.compatRRRRtobjectRR%R-R1R<RBRHRLRPRVRe(((s5/usr/lib/python2.7/site-packages/jsonschema/_utils.pyts