Ñò 6ÕUc @sÆdddgZddkTddkZeei7ZddklZlZddklZddkl Z ddk Z e d „Zed jo5dd klZlZed d eƒZeddddƒZeeeeƒƒjpt‚d ed dƒfd„ƒYZx/eddƒedddƒfD] ZeGHq,Wd ed dƒfd„ƒYZeddƒiddƒGHedeid!ƒZeiGHddkZedd ƒZeeiƒŒGHndS("tdequet defaultdictt namedtupleiÿÿÿÿ(t*N(RR(t itemgetter(t iskeywordcBsŠe|eƒo|iddƒiƒ}neee|ƒƒ}x†|f|D]w}ed„|Dƒƒped|ƒ‚ne |ƒoed|ƒ‚n|di ƒoed|ƒ‚qOqOWe ƒ}x`|D]X}|i dƒoed |ƒ‚n||joed |ƒ‚n|i |ƒqÚWe|ƒ}e|ƒid d ƒd d!}did„|Dƒƒ}did„e|ƒDƒƒ}deƒ} x.e|ƒD] \} }| d|| f7} q³W|o | GHnededd|dedeƒ} y | | UWn,ej o } e| id| ƒ‚nX| |} eedƒo%eid ƒiiddƒ| _n| S(s>Returns a new subclass of tuple with named fields. >>> Point = namedtuple('Point', 'x y') >>> Point.__doc__ # docstring for the new class 'Point(x, y)' >>> p = Point(11, y=22) # instantiate with positional args or keywords >>> p[0] + p[1] # indexable like a plain tuple 33 >>> x, y = p # unpack like a regular tuple >>> x, y (11, 22) >>> p.x + p.y # fields also accessable by name 33 >>> d = p._asdict() # convert to a dictionary >>> d['x'] 11 >>> Point(**d) # convert from a dictionary Point(x=11, y=22) >>> p._replace(x=100) # _replace() is like str.replace() but targets named fields Point(x=100, y=22) t,t css,x%|]}|iƒp |djVqWdS(t_N(tisalnum(t.0tc((s!/usr/lib/python2.6/collections.pys +s sWType names and field names can only contain alphanumeric characters and underscores: %rs2Type names and field names cannot be a keyword: %ris9Type names and field names cannot start with a number: %rRs/Field names cannot start with an underscore: %rs$Encountered duplicate field name: %rt'tiiÿÿÿÿs, cssx|]}d|VqWdS(s%s=%%rN((R tname((s!/usr/lib/python2.6/collections.pys <s css)x"|]\}}d||fVqWdS(s %r: t[%d]N((R tposR((s!/usr/lib/python2.6/collections.pys =s sªclass %(typename)s(tuple): '%(typename)s(%(argtxt)s)' __slots__ = () _fields = %(field_names)r def __new__(_cls, %(argtxt)s): return _tuple.__new__(_cls, (%(argtxt)s)) @classmethod def _make(cls, iterable, new=tuple.__new__, len=len): 'Make a new %(typename)s object from a sequence or iterable' result = new(cls, iterable) if len(result) != %(numfields)d: raise TypeError('Expected %(numfields)d arguments, got %%d' %% len(result)) return result def __repr__(self): return '%(typename)s(%(reprtxt)s)' %% self def _asdict(t): 'Return a new dict which maps field names to their values' return {%(dicttxt)s} def _replace(_self, **kwds): 'Return a new %(typename)s object replacing specified fields with new values' result = _self._make(map(kwds.pop, %(field_names)r, _self)) if kwds: raise ValueError('Got unexpected field names: %%r' %% kwds.keys()) return result def __getnewargs__(self): return tuple(self) s( %s = _property(_itemgetter(%d)) t _itemgettert__name__s namedtuple_%st _propertyt_tuples: t _getframet__main__(t isinstancet basestringtreplacetsplitttupletmaptstrtallt ValueErrort _iskeywordtisdigittsett startswithtaddtlentreprtjoint enumeratetlocalstdictRtpropertyt SyntaxErrortmessagethasattrt_sysRt f_globalstgett __module__(ttypenamet field_namestverboseRt seen_namest numfieldstargtxttreprtxttdicttxtttemplatetit namespacetetresult((s!/usr/lib/python2.6/collections.pyR sN         %R(tloadstdumpstPointsx, ytxi tyisx ycBs&eZdZed„ƒZd„ZRS(cCs|id|iddS(Nigà?(RBRC(tself((s!/usr/lib/python2.6/collections.pythypot~scCsd|i|i|ifS(Ns$Point: x=%6.3f y=%6.3f hypot=%6.3f(RBRCRE(RD((s!/usr/lib/python2.6/collections.pyt__str__s((RR1t __slots__R*RERF(((s!/usr/lib/python2.6/collections.pyRA|siiiig@cBs/eZdZdZeeiƒZed„Z RS(sHPoint class with optimized _make() and _replace() without error-checkingcKs|i||id|ƒƒS(NRBRC(RBRC(t_makeR0(RDt_maptkwds((s!/usr/lib/python2.6/collections.pyt_replace‹s(( RR1t__doc__RGt classmethodRt__new__RHRRK(((s!/usr/lib/python2.6/collections.pyRA‡si iidtPoint3Dtzt TestResultssfailed attempted(RP(t__all__t_abcollt _collectionsRRtoperatorRRtkeywordRRtsysR.tFalseRRtcPickleR?R@tTrueRAtptAssertionErrorRKt_fieldsRORLtdoctestRQttestmod(((s!/usr/lib/python2.6/collections.pyts0     g  #