]$@sdddddddddg Zd d lTd d lZeej7Zd d lmZmZd d lmZ d d l Z d d l Z d dlmZd dlmZmZmZd dlmZyd dlmZWnek rYnXejeyd dlm Z Wnek rYnXGddde!Z"Gddde#Z$Gddde%Z&Gddde'Z(Gddde)Z*yd dlm*Z*Wnek rYnXdZ+dZ,dZ-d d d!dZ.d"d#Z/yd d$lm/Z/Wnek r YnXGd%dde)Z0Gd&dde1Z2Gd'dde1Z3Gd(ddeZ4Gd)dde5Z6d S)*deque defaultdict namedtupleUserDictUserList UserStringCounter OrderedDictChainMap)*N) itemgettereq) iskeyword)proxy)repeatchainstarmap)recursive_repr)r)rc@seZdZddZdS)_OrderedDictKeysViewccst|jEdHdS)N)reversed_mapping)selfr-/opt/alt/python35/lib64/python3.5/__init__.py __reversed__5sz!_OrderedDictKeysView.__reversed__N)__name__ __module__ __qualname__rrrrrr3s rc@seZdZddZdS)_OrderedDictItemsViewccs0x)t|jD]}||j|fVqWdS)N)rr)rkeyrrrr:sz"_OrderedDictItemsView.__reversed__N)rrrrrrrrr8s rc@seZdZddZdS)_OrderedDictValuesViewccs*x#t|jD]}|j|VqWdS)N)rr)rrrrrr@sz#_OrderedDictValuesView.__reversed__N)rrrrrrrrr >s r c@seZdZdZdS)_Linkprevnextr __weakref__N)r"r#rr$)rrr __slots__rrrrr!Ds r!c@sCeZdZddZejeeddZejddZddZ d d Z d d Z d ddZ d ddZ ddZejZZddZddZddZejZeZeddZdddZedd Zd!d"Zd#d$Zedd%d&Zd'd(Z dS))rc Os|std|^}}t|dkrFtdt|y |jWnMtk rt|_t|j|_}||_|_i|_ YnX|j ||dS)Nz?descriptor '__init__' of 'OrderedDict' object needs an argumentz$expected at most 1 arguments, got %d) TypeErrorlen_OrderedDict__rootAttributeErrorr!_OrderedDict__hardroot_proxyr"r#_OrderedDict__map_OrderedDict__update)argskwdsrrootrrr__init__Vs     zOrderedDict.__init__c Cs{||krg||j|<}|j}|j}||||_|_|_||_|||_||||dS)N)r-r)r"r#r) rrvalueZ dict_setitemrZLinklinkr1lastrrr __setitem__ks    zOrderedDict.__setitem__cCsY||||jj|}|j}|j}||_||_d|_d|_dS)N)r-popr"r#)rrZ dict_delitemr4 link_prev link_nextrrr __delitem__ys      zOrderedDict.__delitem__ccs:|j}|j}x!||k r5|jV|j}qWdS)N)r)r#r)rr1currrrr__iter__s   zOrderedDict.__iter__ccs:|j}|j}x!||k r5|jV|j}qWdS)N)r)r"r)rr1r;rrrrs   zOrderedDict.__reversed__cCs7|j}||_|_|jjtj|dS)N)r)r"r#r-cleardict)rr1rrrr=s  zOrderedDict.clearTcCs|std|j}|rH|j}|j}||_||_n$|j}|j}||_||_|j}|j|=tj||}||fS)Nzdictionary is empty)KeyErrorr)r"r#rr-r>r7)rr5r1r4r8r9rr3rrrpopitems             zOrderedDict.popitemc Cs|j|}|j}|j}|j}||_||_|j}|ry|j}||_||_||_||_n-|j}||_||_||_||_dS)N)r-r"r#r)) rrr5r4r8r9Z soft_linkr1firstrrr move_to_ends$                zOrderedDict.move_to_endcCsqtj}t|d}||j}|||jd7}|||j|7}|||j|7}|S)Nr&)_sys getsizeofr(__dict__r-r+r))rZsizeofnsizerrr __sizeof__s zOrderedDict.__sizeof__cCs t|S)N)r)rrrrkeysszOrderedDict.keyscCs t|S)N)r)rrrritemsszOrderedDict.itemscCs t|S)N)r )rrrrvaluesszOrderedDict.valuescCs@||kr!||}||=|S||jkr<t||S)N)_OrderedDict__markerr?)rrdefaultresultrrrr7s   zOrderedDict.popNcCs"||kr||S|||<|S)Nr)rrrNrrr setdefaults  zOrderedDict.setdefaultcCs7|sd|jjfSd|jjt|jfS)Nz%s()z%s(%r)) __class__rlistrK)rrrr__repr__szOrderedDict.__repr__cCsdt|j}x'ttD]}|j|dq"W|jf|pNddt|jfS)N)varscopyrr7rQiterrK)r inst_dictkrrr __reduce__szOrderedDict.__reduce__cCs |j|S)N)rQ)rrrrrUszOrderedDict.copycCs(|}x|D]}|||__eq__allmap_eq)rotherrrrr^s(zOrderedDict.__eq__)!rrrr2r>r6r,r!r:r<rr=r@rBrIMutableMappingupdater.rJrKrL__ne__objectrMr7rP_recursive_reprrSrYrU classmethodr\r^rrrrrGs.             )rafrom builtins import property as _property, tuple as _tuple from operator import itemgetter as _itemgetter from collections import OrderedDict class {typename}(tuple): '{typename}({arg_list})' __slots__ = () _fields = {field_names!r} def __new__(_cls, {arg_list}): 'Create new instance of {typename}({arg_list})' return _tuple.__new__(_cls, ({arg_list})) @classmethod def _make(cls, iterable, new=tuple.__new__, len=len): 'Make a new {typename} object from a sequence or iterable' result = new(cls, iterable) if len(result) != {num_fields:d}: raise TypeError('Expected {num_fields:d} arguments, got %d' % len(result)) return result def _replace(_self, **kwds): 'Return a new {typename} 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' % list(kwds)) return result def __repr__(self): 'Return a nicely formatted representation string' return self.__class__.__name__ + '({repr_fmt})' % self def _asdict(self): 'Return a new OrderedDict which maps field names to their values.' return OrderedDict(zip(self._fields, self)) def __getnewargs__(self): 'Return self as a plain tuple. Used by copy and pickle.' return tuple(self) {field_defs} z {name}=%rzW {name} = _property(_itemgetter({index:d}), doc='Alias for field number {index:d}') Fc Cst|tr'|jddj}ttt|}t|}|rt}xit|D][\}}|j st |s|j ds||krd|||<|j |qdWxk|g|D]\}t |tkrt d|jstd|t |rtd|qWt}x]|D]U}|j drm| rmtd|||krtd ||j |qAWtjd |d t|d t|d tt|jddddddjdd|Dddjddt|D}tdd|}t||||} || _|rpt| jy%tjdjjdd| _Wnttfk rYnX| S)N, _z_%dz*Type names and field names must be stringsz8Type names and field names must be valid identifiers: %rz2Type names and field names cannot be a keyword: %rz/Field names cannot start with an underscore: %rz$Encountered duplicate field name: %rtypename field_names num_fieldsarg_list'r&repr_fmtz, css!|]}tjd|VqdS)nameN)_repr_templateformat).0rsrrr sznamedtuple.. field_defs css-|]#\}}tjd|d|VqdS)indexrsN)_field_templateru)rvrzrsrrrrwsrz namedtuple_%s__main__)r]strreplacesplitrRr`set enumerate isidentifier _iskeyword startswithaddtyper' ValueError_class_templaterutupler(reprjoinr>exec_sourceprintrD _getframe f_globalsgetrr*) rlrmverboserenameseenrzrsclass_definition namespacerOrrrrgsd                (     %cCs5|j}x%|D]}||dd||)rrrrrYszCounter.__reduce__cs ||krtj|dS)N)rr:)rr)rQrrr:s zCounter.__delitem__c Cs|sd|jjSy9djtdj|j}d|jj|fSWn.tk r}dj|jjt|SYnXdS)Nz%s()z, z%r: %rz%s({%s})z {0}({1!r})) rQrrr`__mod__rr'rur>)rrKrrrrSs! zCounter.__repr__cCst|tstSt}x>|jD]0\}}|||}|dkr)||||jD]0\}}|||}|dkr)|||s z*Counter._keep_positive..)rK)r nonpositiverrrr_keep_positives  zCounter._keep_positivecCs5x(|jD]\}}|||7.)anyr)rrr)rr __contains__|szChainMap.__contains__cCs t|jS)N)rr)rrrr__bool__szChainMap.__bool__cCs%dj|djtt|jS)Nz{0.__class__.__name__}({1})z, )rurr`rr)rrrrrSszChainMap.__repr__cGs|tj||S)N)r>r\)rZr[r/rrrr\szChainMap.fromkeyscCs*|j|jdj|jddS)Nr r&)rQrrU)rrrrrUsz ChainMap.copycCs%|dkri}|j||jS)N)rQr)rrrrr new_childs zChainMap.new_childcCs|j|jddS)Nr&)rQr)rrrrparentsszChainMap.parentscCs||jd|z0Passing 'dict' as keyword argument is deprecated stacklevelrC)r'r(r7warningswarnPendingDeprecationWarningdatard)r/kwargsrr>rrrrr2s$          zUserDict.__init__cCs t|jS)N)r(r)rrrrrszUserDict.__len__cCsO||jkr|j|St|jdr?|jj||St|dS)Nr)rhasattrrQrr?)rrrrrrs  zUserDict.__getitem__cCs||j|rNcCsg|_|dk rt|t|jkrF||jddsz UserList.sortcCs9t|tr%|jj|jn|jj|dS)N)r]rrextend)rrbrrrr?szUserList.extendr})!rrrr2rSrrr^rrrrrrr6r:rrrr__rmul__rrrr7rr=rUrrzrrrrrrrrs<                           c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&ZeZd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1ejd2d3Zd4d4d5d6Zd1ejd7d8Z d9d:d;Z!d1ejd<d=Z"d>d?Z#d@dAZ$d1ejdBdCZ%dDdEZ&dFdGZ'dHdIZ(dJdKZ)dLdMZ*dNdOZ+dPdQZ,dRdSZ-dTdUZ.dVdWZ/dXdYZ0dZd[Z1d\d]Z2d^d_Z3d4d`daZ4e5j6Z6dbdcZ7ddedfZ8d1ejdgdhZ9d1ejdidjZ:dkdlZ;dmdnZ<d4dodpZ=d4ddqdrZ>d4ddsdtZ?dudvdwZ@d1ejdxdyZAd4dzd{ZBd|d}ZCd~dZDddZEddZFddZGd4S)rcCsVt|tr||_n7t|trC|jdd|_nt||_dS)N)r]r~rr)rseqrrrr2Ls  zUserString.__init__cCs t|jS)N)r~r)rrrr__str__SszUserString.__str__cCs t|jS)N)rr)rrrrrSTszUserString.__repr__cCs t|jS)N)intr)rrrr__int__UszUserString.__int__cCs t|jS)N)floatr)rrrr __float__VszUserString.__float__cCs t|jS)N)complexr)rrrr __complex__WszUserString.__complex__cCs t|jS)N)hashr)rrrr__hash__XszUserString.__hash__cCs|jddfS)N)r)rrrr__getnewargs__YszUserString.__getnewargs__cCs,t|tr|j|jkS|j|kS)N)r]rr)rstringrrrr^\szUserString.__eq__cCs,t|tr|j|jkS|j|kS)N)r]rr)rrrrrr`szUserString.__lt__cCs,t|tr|j|jkS|j|kS)N)r]rr)rrrrrrdszUserString.__le__cCs,t|tr|j|jkS|j|kS)N)r]rr)rrrrrrhszUserString.__gt__cCs,t|tr|j|jkS|j|kS)N)r]rr)rrrrrrlszUserString.__ge__cCs%t|tr|j}||jkS)N)r]rr)rcharrrrrqs zUserString.__contains__cCs t|jS)N)r(r)rrrrrvszUserString.__len__cCs|j|j|S)N)rQr)rrzrrrrwszUserString.__getitem__cCsct|tr&|j|j|jSt|trI|j|j|S|j|jt|S)N)r]rrQrr~)rrbrrrrxs zUserString.__add__cCs=t|tr#|j||jS|jt||jS)N)r]r~rQr)rrbrrrr~szUserString.__radd__cCs|j|j|S)N)rQr)rrGrrrrszUserString.__mul__cCs|j|j|S)N)rQr)rr/rrrrszUserString.__mod__cCs|j|tS)N)rQr/)rrurrr__rmod__szUserString.__rmod__cCs|j|jjS)N)rQr capitalize)rrrrrszUserString.capitalizecCs|j|jjS)N)rQrcasefold)rrrrrszUserString.casefoldcGs|j|jj||S)N)rQrcenter)rwidthr/rrrrszUserString.centerr cCs.t|tr|j}|jj|||S)N)r]rrr)rsubstartendrrrrs zUserString.countNcCsW|rA|r(|j|jj||S|j|jj|S|j|jjS)N)rQrencode)rencodingerrorsrrrrs zUserString.encodecCs|jj|||S)N)rendswith)rsuffixrrrrrrszUserString.endswithcCs|j|jj|S)N)rQr expandtabs)rtabsizerrrrszUserString.expandtabscCs.t|tr|j}|jj|||S)N)r]rrfind)rrrrrrrrs zUserString.findcOs|jj||S)N)rru)rr/r0rrrruszUserString.formatcCs|jj|S)N)r format_map)rrrrrrszUserString.format_mapcCs|jj|||S)N)rrz)rrrrrrrrzszUserString.indexcCs |jjS)N)risalpha)rrrrrszUserString.isalphacCs |jjS)N)risalnum)rrrrrszUserString.isalnumcCs |jjS)N)r isdecimal)rrrrrszUserString.isdecimalcCs |jjS)N)risdigit)rrrrrszUserString.isdigitcCs |jjS)N)rr)rrrrrszUserString.isidentifiercCs |jjS)N)rislower)rrrrr szUserString.islowercCs |jjS)N)r isnumeric)rrrrr szUserString.isnumericcCs |jjS)N)r isprintable)rrrrr szUserString.isprintablecCs |jjS)N)risspace)rrrrr szUserString.isspacecCs |jjS)N)ristitle)rrrrr szUserString.istitlecCs |jjS)N)risupper)rrrrrszUserString.isuppercCs|jj|S)N)rr)rrrrrrszUserString.joincGs|j|jj||S)N)rQrljust)rrr/rrrrszUserString.ljustcCs|j|jjS)N)rQrlower)rrrrrszUserString.lowercCs|j|jj|S)N)rQrlstrip)rcharsrrrrszUserString.lstripcCs|jj|S)N)r partition)rseprrrrszUserString.partitionr&cCsOt|tr|j}t|tr0|j}|j|jj|||S)N)r]rrrQr)roldnewmaxsplitrrrrs   zUserString.replacecCs.t|tr|j}|jj|||S)N)r]rrrfind)rrrrrrrrs zUserString.rfindcCs|jj|||S)N)rrindex)rrrrrrrrszUserString.rindexcGs|j|jj||S)N)rQrrjust)rrr/rrrrszUserString.rjustcCs|jj|S)N)r rpartition)rrrrrrszUserString.rpartitioncCs|j|jj|S)N)rQrrstrip)rrrrrrszUserString.rstripcCs|jj||S)N)rr)rrrrrrrszUserString.splitcCs|jj||S)N)rrsplit)rrrrrrrszUserString.rsplitFcCs|jj|S)N)r splitlines)rkeependsrrrrszUserString.splitlinescCs|jj|||S)N)rr)rprefixrrrrrrszUserString.startswithcCs|j|jj|S)N)rQrstrip)rrrrrr!szUserString.stripcCs|j|jjS)N)rQrswapcase)rrrrr"szUserString.swapcasecCs|j|jjS)N)rQrtitle)rrrrr#szUserString.titlecGs|j|jj|S)N)rQr translate)rr/rrrr$szUserString.translatecCs|j|jjS)N)rQrupper)rrrrr%szUserString.uppercCs|j|jj|S)N)rQrzfill)rrrrrr&szUserString.zfillr}r}r})Hrrrr2rrSrrrrrr^rrrrrrrrrrrrrrrrrDmaxsizerrrrrrurrzrrrrrr r r r r rrrrrr~ maketransrrrrrrrrrrrr!r"r#r$r%r&rrrrrKs                                                 )7__all___collections_abcoperatorr rr rakeywordrrsysrDheapqr_weakrefrr, itertoolsrrrrrrreprlibrrg _collectionsr ImportErrorMutableSequenceregisterrKeysViewr ItemsViewr ValuesViewr rfr!r>rrrtr{rrrrcr rrSequencerrrrrsX         3^  lCI