📦 robzwolf / sm-ai-search

📄 __init__.cpython-36.opt-1.pyc · 500 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
5003

<6�Yз�$@s�dZddddddddd	g	Zd
dlTd
dlZeej7Zd
d
lmZmZd
dlm	Z
d
dlZd
dl
Zd
dlmZd
dlmZmZmZd
dlmZyd
dlmZWnek
r�YnXej e�yd
dlm!Z!Wnek
r�YnXGdd�de"�Z#Gdd�de$�Z%Gdd�de&�Z'Gdd�de(�Z)Gdd�de*�Z+yd
dlm+Z+Wnek
�rXYnXdZ,dZ-d Z.d!d!dd"�d#d�Z/d$d%�Z0yd
d&lm0Z0Wnek
�r�YnXGd'd�de*�Z1Gd(d	�d	e2�Z3Gd)d�de2�Z4Gd*d�de�Z5Gd+d�de6�Z7dS),a?This module implements specialized container datatypes providing
alternatives to Python's general purpose built-in containers, dict,
list, set, and tuple.

* namedtuple   factory function for creating tuple subclasses with named fields
* deque        list-like container with fast appends and pops on either end
* ChainMap     dict-like class for creating a single view of multiple mappings
* Counter      dict subclass for counting hashable objects
* OrderedDict  dict subclass that remembers the order entries were added
* defaultdict  dict subclass that calls a factory function to supply missing values
* UserDict     wrapper around dictionary objects for easier dict subclassing
* UserList     wrapper around list objects for easier list subclassing
* UserString   wrapper around string objects for easier string subclassing

�deque�defaultdict�
namedtuple�UserDict�UserList�
UserString�Counter�OrderedDict�ChainMap�)�*N)�
itemgetter�eq)�	iskeyword)�proxy)�repeat�chain�starmap)�recursive_repr)r)rc@seZdZdd�ZdS)�_OrderedDictKeysViewccst|j�EdHdS)N)�reversed�_mapping)�self�r�1D:\Python\Python36-32\Lib\collections\__init__.py�__reversed__5sz!_OrderedDictKeysView.__reversed__N)�__name__�
__module__�__qualname__rrrrrr3src@seZdZdd�ZdS)�_OrderedDictItemsViewccs(x"t|j�D]}||j|fVqWdS)N)rr)r�keyrrrr:sz"_OrderedDictItemsView.__reversed__N)rrrrrrrrr8src@seZdZdd�ZdS)�_OrderedDictValuesViewccs$xt|j�D]}|j|VqWdS)N)rr)rrrrrr@sz#_OrderedDictValuesView.__reversed__N)rrrrrrrrr >sr c@seZdZdZdS)�_Link�prev�nextr�__weakref__N)r"r#rr$)rrr�	__slots__rrrrr!Dsr!c@s�eZdZdZdd�Zejeefdd�Zej	fdd�Z	dd	�Z
d
d�Zdd
�Zd*dd�Z
d+dd�Zdd�ZejZZdd�Zdd�Zdd�ZejZe�Zefdd�Zd,dd�Ze�d d!��Zd"d#�Zd$d%�Zed-d&d'��Z d(d)�Z!dS).rz)Dictionary that remembers insertion ordercOs�|std��|^}}t|�dkr0tdt|���y
|jWn>tk
rxt�|_t|j�|_}||_|_i|_	YnX|j
||�dS)z�Initialize an ordered dictionary.  The signature is the same as
        regular dictionaries.  Keyword argument order is preserved.
        z?descriptor '__init__' of 'OrderedDict' object needs an argument�z$expected at most 1 arguments, got %dN)�	TypeError�len�_OrderedDict__root�AttributeErrorr!�_OrderedDict__hardroot�_proxyr"r#�_OrderedDict__map�_OrderedDict__update)�args�kwdsr�rootrrr�__init__Vs
zOrderedDict.__init__c	CsZ||krJ|�|j|<}|j}|j}||||_|_|_||_||�|_||||�dS)z!od.__setitem__(i, y) <==> od[i]=yN)r-r)r"r#r)	rr�valueZdict_setitemrZLink�linkr1�lastrrr�__setitem__is
zOrderedDict.__setitem__cCs>|||�|jj|�}|j}|j}||_||_d|_d|_dS)z od.__delitem__(y) <==> del od[y]N)r-�popr"r#)rrZdict_delitemr4�	link_prev�	link_nextrrr�__delitem__ws
zOrderedDict.__delitem__ccs,|j}|j}x||k	r&|jV|j}qWdS)zod.__iter__() <==> iter(od)N)r)r#r)rr1�currrrr�__iter__�s

zOrderedDict.__iter__ccs,|j}|j}x||k	r&|jV|j}qWdS)z#od.__reversed__() <==> reversed(od)N)r)r"r)rr1r;rrrr�s

zOrderedDict.__reversed__cCs*|j}||_|_|jj�tj|�dS)z.od.clear() -> None.  Remove all items from od.N)r)r"r#r-�clear�dict)rr1rrrr=�s
zOrderedDict.clearTcCsj|std��|j}|r0|j}|j}||_||_n|j}|j}||_||_|j}|j|=tj||�}||fS)z�Remove and return a (key, value) pair from the dictionary.

        Pairs are returned in LIFO order if last is true or FIFO order if false.
        zdictionary is empty)�KeyErrorr)r"r#rr-r>r7)rr5r1r4r8r9rr3rrr�popitem�s zOrderedDict.popitemc	Cst|j|}|j}|j}|j}||_||_|j}|rR|j}||_||_||_||_n|j}||_||_||_||_dS)z�Move an existing element to the end (or beginning if last==False).

        Raises KeyError if the element does not exist.
        When last=True, acts like a fast version of self[key]=self.pop(key).

        N)r-r"r#r))	rrr5r4r8r9Z	soft_linkr1�firstrrr�move_to_end�s$
zOrderedDict.move_to_endcCsVtj}t|�d}||j�}|||j�d7}|||j�|7}|||j�|7}|S)Nr&�)�_sys�	getsizeofr(�__dict__r-r+r))rZsizeof�n�sizerrr�
__sizeof__�s
zOrderedDict.__sizeof__cCst|�S)z:D.keys() -> a set-like object providing a view on D's keys)r)rrrr�keys�szOrderedDict.keyscCst|�S)z<D.items() -> a set-like object providing a view on D's items)r)rrrr�items�szOrderedDict.itemscCst|�S)z6D.values() -> an object providing a view on D's values)r )rrrr�values�szOrderedDict.valuescCs0||kr||}||=|S||jkr,t|��|S)z�od.pop(k[,d]) -> v, remove specified key and return the corresponding
        value.  If key is not found, d is returned if given, otherwise KeyError
        is raised.

        )�_OrderedDict__markerr?)rr�default�resultrrrr7�s
zOrderedDict.popNcCs||kr||S|||<|S)zDod.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in odr)rrrNrrr�
setdefault�szOrderedDict.setdefaultcCs*|sd|jjfSd|jjt|j��fS)zod.__repr__() <==> repr(od)z%s()z%s(%r))�	__class__r�listrK)rrrr�__repr__�szOrderedDict.__repr__cCsHt|�j�}xtt��D]}|j|d�qW|jf|p8ddt|j��fS)z%Return state information for picklingN)�vars�copyrr7rQ�iterrK)r�	inst_dict�krrr�
__reduce__szOrderedDict.__reduce__cCs
|j|�S)z!od.copy() -> a shallow copy of od)rQ)rrrrrU
szOrderedDict.copycCs |�}x|D]}|||<qW|S)zOD.fromkeys(S[, v]) -> New ordered dictionary with keys from S.
        If not specified, the value defaults to None.

        r)�cls�iterabler3rrrrr�fromkeyss
zOrderedDict.fromkeyscCs2t|t�r&tj||�o$ttt||��Stj||�S)z�od.__eq__(y) <==> od==y.  Comparison to another OD is order-sensitive
        while comparison to a regular mapping is order-insensitive.

        )�
isinstancerr>�__eq__�all�map�_eq)r�otherrrrr^s
zOrderedDict.__eq__)T)T)N)N)"rrr�__doc__r2r>r6r,r!r:r<rr=r@rBrI�MutableMapping�updater.rJrKrL�__ne__�objectrMr7rP�_recursive_reprrSrYrU�classmethodr\r^rrrrrGs0

		

	


)ra�from 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}')
F)�verbose�rename�modulecCst|t�r|jdd�j�}ttt|��}t|�}|r�t�}xNt|�D]B\}}|j�spt	|�sp|j
d�sp||kr|d|||<|j|�qDWxN|g|D]@}t|�tk	r�t
d��|j�s�td|��t	|�r�td|��q�Wt�}xJ|D]B}|j
d�o�|�rtd|��||k�rtd	|��|j|�q�Wtj|t|�t|�tt|��jd
d�dd�d
jdd�|D��djdd�t|�D��d�}td|d�}	t||	�|	|}
||
_|�r�t|
j�|dk�r�ytjd�jjdd�}Wnttfk
�r�YnX|dk	�r
||
_|
S)aCReturns 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 accessible 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)

    �,� �_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: %r�'�r&z, css|]}tj|d�VqdS))�nameN)�_repr_template�format)�.0rrrrr�	<genexpr>�sznamedtuple.<locals>.<genexpr>�
css |]\}}tj||d�VqdS))�indexrrN)�_field_templatert)rurxrrrrrrv�s)�typename�field_names�
num_fields�arg_list�repr_fmt�
field_defsz
namedtuple_%s)rNr�__main__�����)r]�str�replace�splitrRr`�set�	enumerate�isidentifier�
_iskeyword�
startswith�add�typer'�
ValueError�_class_templatert�tupler(�repr�joinr>�exec�_source�printrD�	_getframe�	f_globals�getr*r)rzr{rjrkrl�seenrxrr�class_definition�	namespacerOrrrresj










cCs*|j}x|D]}||d�d||<qWdS)z!Tally elements from the iterable.r
r&N)r�)�mappingr[Zmapping_get�elemrrr�_count_elements�s
r�)r�cs�eZdZdZ�fdd�Zdd�Zd/dd�Zd	d
�Zed0dd��Z	�fd
d�Z
dd�Zdd�Zdd�Z
�fdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Z�ZS)1ra�Dict subclass for counting hashable items.  Sometimes called a bag
    or multiset.  Elements are stored as dictionary keys and their counts
    are stored as dictionary values.

    >>> c = Counter('abcdeabcdabcaba')  # count elements from a string

    >>> c.most_common(3)                # three most common elements
    [('a', 5), ('b', 4), ('c', 3)]
    >>> sorted(c)                       # list all unique elements
    ['a', 'b', 'c', 'd', 'e']
    >>> ''.join(sorted(c.elements()))   # list elements with repetitions
    'aaaaabbbbcccdde'
    >>> sum(c.values())                 # total of all counts
    15

    >>> c['a']                          # count of letter 'a'
    5
    >>> for elem in 'shazam':           # update counts from an iterable
    ...     c[elem] += 1                # by adding 1 to each element's count
    >>> c['a']                          # now there are seven 'a'
    7
    >>> del c['b']                      # remove all 'b'
    >>> c['b']                          # now there are zero 'b'
    0

    >>> d = Counter('simsalabim')       # make another counter
    >>> c.update(d)                     # add in the second counter
    >>> c['a']                          # now there are nine 'a'
    9

    >>> c.clear()                       # empty the counter
    >>> c
    Counter()

    Note:  If a count is set to zero or reduced to zero, it will remain
    in the counter until the entry is deleted or the counter is cleared:

    >>> c = Counter('aaabbc')
    >>> c['b'] -= 2                     # reduce the count of 'b' by two
    >>> c.most_common()                 # 'b' is still in, but its count is zero
    [('a', 3), ('c', 1), ('b', 0)]

    csN|std��|^}}t|�dkr0tdt|���tt|�j�|j||�dS)a	Create a new, empty Counter object.  And if given, count elements
        from an input iterable.  Or, initialize the count from another mapping
        of elements to their counts.

        >>> c = Counter()                           # a new, empty counter
        >>> c = Counter('gallahad')                 # a new counter from an iterable
        >>> c = Counter({'a': 4, 'b': 2})           # a new counter from a mapping
        >>> c = Counter(a=4, b=2)                   # a new counter from keyword args

        z;descriptor '__init__' of 'Counter' object needs an argumentr&z$expected at most 1 arguments, got %dN)r'r(�superrr2re)r/r0r)rQrrr2szCounter.__init__cCsdS)z1The count of elements not in the Counter is zero.r
r)rrrrr�__missing__szCounter.__missing__NcCs6|dkrt|j�td�dd�Stj||j�td�d�S)z�List the n most common elements and their counts from the most
        common to the least.  If n is None, then list all element counts.

        >>> Counter('abcdeabcdabcaba').most_common(3)
        [('a', 5), ('b', 4), ('c', 3)]

        Nr&T)r�reverse)r)�sortedrK�_itemgetter�_heapq�nlargest)rrGrrr�most_commons	zCounter.most_commoncCstjtt|j���S)a�Iterator over elements repeating each as many times as its count.

        >>> c = Counter('ABCABC')
        >>> sorted(c.elements())
        ['A', 'A', 'B', 'B', 'C', 'C']

        # Knuth's example for prime factors of 1836:  2**2 * 3**3 * 17**1
        >>> prime_factors = Counter({2: 2, 3: 3, 17: 1})
        >>> product = 1
        >>> for factor in prime_factors.elements():     # loop over factors
        ...     product *= factor                       # and multiply them
        >>> product
        1836

        Note, if an element's count has been set to zero or is a negative
        number, elements() will ignore it.

        )�_chain�
from_iterable�_starmap�_repeatrK)rrrr�elements+szCounter.elementscCstd��dS)Nz@Counter.fromkeys() is undefined.  Use Counter(iterable) instead.)�NotImplementedError)rZr[�vrrrr\CszCounter.fromkeyscs�|std��|^}}t|�dkr0tdt|���|r<|dnd}|dk	r�t|t�r�|r�|j}x8|j�D]\}}|||d�||<qfWq�tt|�j|�n
t	||�|r�|j|�dS)a�Like dict.update() but add counts instead of replacing them.

        Source can be an iterable, a dictionary, or another Counter instance.

        >>> c = Counter('which')
        >>> c.update('witch')           # add elements from another iterable
        >>> d = Counter('watch')
        >>> c.update(d)                 # add elements from another counter
        >>> c['h']                      # four 'h' in which, witch, and watch
        4

        z9descriptor 'update' of 'Counter' object needs an argumentr&z$expected at most 1 arguments, got %dr
N)
r'r(r]�Mappingr�rKr�rrer�)r/r0rr[�self_getr��count)rQrrreJs 

zCounter.updatecOs�|std��|^}}t|�dkr0tdt|���|r<|dnd}|dk	r�|j}t|t�r�xH|j�D]\}}||d�|||<qbWn x|D]}||d�d||<q�W|r�|j|�dS)a�Like dict.update() but subtracts counts instead of replacing them.
        Counts can be reduced below zero.  Both the inputs and outputs are
        allowed to contain zero and negative counts.

        Source can be an iterable, a dictionary, or another Counter instance.

        >>> c = Counter('which')
        >>> c.subtract('witch')             # subtract elements from another iterable
        >>> c.subtract(Counter('watch'))    # subtract elements from another counter
        >>> c['h']                          # 2 in which, minus 1 in witch, minus 1 in watch
        0
        >>> c['w']                          # 1 in which, minus 1 in witch, minus 1 in watch
        -1

        z;descriptor 'subtract' of 'Counter' object needs an argumentr&z$expected at most 1 arguments, got %dr
N)r'r(r�r]r�rK�subtract)r/r0rr[r�r�r�rrrr�rs

zCounter.subtractcCs
|j|�S)zReturn a shallow copy.)rQ)rrrrrU�szCounter.copycCs|jt|�ffS)N)rQr>)rrrrrY�szCounter.__reduce__cs||krt�j|�dS)zGLike dict.__delitem__() but does not raise KeyError for missing values.N)r�r:)rr�)rQrrr:�szCounter.__delitem__cCs`|sd|jjSy&djtdj|j���}d|jj|fStk
rZdj|jjt|��SXdS)Nz%s()z, z%r: %rz%s({%s})z
{0}({1!r}))	rQrr�r`�__mod__r�r'rtr>)rrKrrrrS�szCounter.__repr__cCsxt|t�stSt�}x0|j�D]$\}}|||}|dkr|||<qWx,|j�D] \}}||krP|dkrP|||<qPW|S)zAdd counts from two counters.

        >>> Counter('abbb') + Counter('bcc')
        Counter({'b': 4, 'c': 2, 'a': 1})

        r
)r]r�NotImplementedrK)rrbrOr�r��newcountrrr�__add__�s
zCounter.__add__cCs|t|t�stSt�}x0|j�D]$\}}|||}|dkr|||<qWx0|j�D]$\}}||krP|dkrPd|||<qPW|S)z� Subtract count, but keep only results with positive counts.

        >>> Counter('abbbc') - Counter('bccd')
        Counter({'b': 2, 'a': 1})

        r
)r]rr�rK)rrbrOr�r�r�rrr�__sub__�s
zCounter.__sub__cCs�t|t�stSt�}x<|j�D]0\}}||}||kr:|n|}|dkr|||<qWx,|j�D] \}}||kr\|dkr\|||<q\W|S)z�Union is the maximum of value in either of the input counters.

        >>> Counter('abbb') | Counter('bcc')
        Counter({'b': 3, 'c': 2, 'a': 1})

        r
)r]rr�rK)rrbrOr�r��other_countr�rrr�__or__�s
zCounter.__or__cCsVt|t�stSt�}x<|j�D]0\}}||}||kr:|n|}|dkr|||<qW|S)z� Intersection is the minimum of corresponding counts.

        >>> Counter('abbb') & Counter('bcc')
        Counter({'b': 1})

        r
)r]rr�rK)rrbrOr�r�r�r�rrr�__and__�s
zCounter.__and__cCs0t�}x$|j�D]\}}|dkr|||<qW|S)zEAdds an empty counter, effectively stripping negative and zero countsr
)rrK)rrOr�r�rrr�__pos__�s
zCounter.__pos__cCs4t�}x(|j�D]\}}|dkrd|||<qW|S)z{Subtracts from an empty counter.  Strips positive and zero counts,
        and flips the sign on negative counts.

        r
)rrK)rrOr�r�rrr�__neg__s
zCounter.__neg__cCs*dd�|j�D�}x|D]
}||=qW|S)z?Internal method to strip elements with a negative or zero countcSsg|]\}}|dks|�qS)r
r)rur�r�rrr�
<listcomp>sz*Counter._keep_positive.<locals>.<listcomp>)rK)r�nonpositiver�rrr�_keep_positives

zCounter._keep_positivecCs.x$|j�D]\}}|||7<q
W|j�S)z�Inplace add from another counter, keeping only positive counts.

        >>> c = Counter('abbb')
        >>> c += Counter('bcc')
        >>> c
        Counter({'b': 4, 'c': 2, 'a': 1})

        )rKr�)rrbr�r�rrr�__iadd__s	zCounter.__iadd__cCs.x$|j�D]\}}|||8<q
W|j�S)z�Inplace subtract counter, but keep only results with positive counts.

        >>> c = Counter('abbbc')
        >>> c -= Counter('bccd')
        >>> c
        Counter({'b': 2, 'a': 1})

        )rKr�)rrbr�r�rrr�__isub__%s	zCounter.__isub__cCs6x,|j�D] \}}||}||kr
|||<q
W|j�S)z�Inplace union is the maximum of value from either counter.

        >>> c = Counter('abbb')
        >>> c |= Counter('bcc')
        >>> c
        Counter({'b': 3, 'c': 2, 'a': 1})

        )rKr�)rrbr�r�r�rrr�__ior__2s
	zCounter.__ior__cCs6x,|j�D] \}}||}||kr
|||<q
W|j�S)z�Inplace intersection is the minimum of corresponding counts.

        >>> c = Counter('abbb')
        >>> c &= Counter('bcc')
        >>> c
        Counter({'b': 1})

        )rKr�)rrbr�r�r�rrr�__iand__As
	zCounter.__iand__)N)N)rrrrcr2r�r�r�rir\rer�rUrYr:rSr�r�r�r�r�r�r�r�r�r�r��
__classcell__rr)rQrr�s0+

("

c@s�eZdZdZdd�Zdd�Zdd�Zd'd	d
�Zdd�Zd
d�Z	dd�Z
dd�Ze�dd��Z
edd��Zdd�ZeZd(dd�Zedd��Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�ZdS))r	a� A ChainMap groups multiple dicts (or other mappings) together
    to create a single, updateable view.

    The underlying mappings are stored in a list.  That list is public and can
    be accessed or updated using the *maps* attribute.  There is no other
    state.

    Lookups search the underlying mappings successively until a key is found.
    In contrast, writes, updates, and deletions only operate on the first
    mapping.

    cGst|�pig|_dS)z�Initialize a ChainMap by setting *maps* to the given mappings.
        If no mappings are provided, a single empty dictionary is used.

        N)rR�maps)rr�rrrr2cszChainMap.__init__cCst|��dS)N)r?)rrrrrr�jszChainMap.__missing__cCs8x,|jD]"}y||Stk
r(YqXqW|j|�S)N)r�r?r�)rrr�rrr�__getitem__ms
zChainMap.__getitem__NcCs||kr||S|S)Nr)rrrNrrrr�uszChainMap.getcCstt�j|j��S)N)r(r��unionr�)rrrr�__len__xszChainMap.__len__cCstt�j|j��S)N)rVr�r�r�)rrrrr<{szChainMap.__iter__cst�fdd�|jD��S)Nc3s|]}�|kVqdS)Nr)ru�m)rrrrvsz(ChainMap.__contains__.<locals>.<genexpr>)�anyr�)rrr)rr�__contains__~szChainMap.__contains__cCs
t|j�S)N)r�r�)rrrr�__bool__�szChainMap.__bool__cCsdj|djtt|j���S)Nz{0.__class__.__name__}({1})z, )rtr�r`r�r�)rrrrrS�szChainMap.__repr__cGs|tj|f|���S)z?Create a ChainMap with a single dict created from the iterable.)r>r\)rZr[r/rrrr\�szChainMap.fromkeyscCs$|j|jdj�f|jdd���S)zHNew ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]r
r&N)rQr�rU)rrrrrU�sz
ChainMap.copycCs|dkri}|j|f|j��S)zyNew ChainMap with a new map followed by all previous maps.
        If no map is provided, an empty dict is used.
        N)rQr�)rr�rrr�	new_child�szChainMap.new_childcCs|j|jdd��S)zNew ChainMap from maps[1:].r&N)rQr�)rrrr�parents�szChainMap.parentscCs||jd|<dS)Nr
)r�)rrr3rrrr6�szChainMap.__setitem__cCs8y|jd|=Wn"tk
r2tdj|���YnXdS)Nr
z(Key not found in the first mapping: {!r})r�r?rt)rrrrrr:�szChainMap.__delitem__cCs0y|jdj�Stk
r*td��YnXdS)zPRemove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.r
z#No keys found in the first mapping.N)r�r@r?)rrrrr@�szChainMap.popitemcGs>y|jdj|f|��Stk
r8tdj|���YnXdS)zWRemove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0].r
z(Key not found in the first mapping: {!r}N)r�r7r?rt)rrr/rrrr7�szChainMap.popcCs|jdj�dS)z'Clear maps[0], leaving maps[1:] intact.r
N)r�r=)rrrrr=�szChainMap.clear)N)N)rrrrcr2r�r�r�r�r<r�r�rhrSrir\rU�__copy__r��propertyr�r6r:r@r7r=rrrrr	Us(

c@sbeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zeddd��Z
dS)rcOs�|std��|^}}t|�dkr0tdt|���|r>|d}n0d|krj|jd�}ddl}|jdtdd�nd}i|_|dk	r�|j|�t|�r�|j|�dS)	Nz<descriptor '__init__' of 'UserDict' object needs an argumentr&z$expected at most 1 arguments, got %dr
r>z0Passing 'dict' as keyword argument is deprecatedrC)�
stacklevel)r'r(r7�warnings�warn�DeprecationWarning�datare)r/�kwargsrr>r�rrrr2�s$


zUserDict.__init__cCs
t|j�S)N)r(r�)rrrrr��szUserDict.__len__cCs:||jkr|j|St|jd�r.|jj||�St|��dS)Nr�)r��hasattrrQr�r?)rrrrrr��s


zUserDict.__getitem__cCs||j|<dS)N)r�)rr�itemrrrr6�szUserDict.__setitem__cCs|j|=dS)N)r�)rrrrrr:�szUserDict.__delitem__cCs
t|j�S)N)rVr�)rrrrr<�szUserDict.__iter__cCs
||jkS)N)r�)rrrrrr��szUserDict.__contains__cCs
t|j�S)N)r�r�)rrrrrS�szUserDict.__repr__cCsR|jtkrt|jj��Sddl}|j}zi|_|j|�}Wd||_X|j|�|S)Nr
)rQrr�rUre)rrUr��crrrrU�s

z
UserDict.copyNcCs |�}x|D]}|||<qW|S)Nr)rZr[r3�drrrrr\�s
zUserDict.fromkeys)N)rrrr2r�r�r6r:r<r�rSrUrir\rrrrr�sc@seZdZdZd>dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�ZeZd%d&�Zd'd(�Zd)d*�Zd@d,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Z d<d=�Z!dS)ArzAA more or less complete user-defined wrapper around list objects.NcCsbg|_|dk	r^t|�t|j�kr0||jdd�<n.t|t�rT|jdd�|jdd�<n
t|�|_dS)N)r�r�r]rrR)r�initlistrrrr2s
zUserList.__init__cCs
t|j�S)N)r�r�)rrrrrSszUserList.__repr__cCs|j|j|�kS)N)r��_UserList__cast)rrbrrr�__lt__szUserList.__lt__cCs|j|j|�kS)N)r�r�)rrbrrr�__le__szUserList.__le__cCs|j|j|�kS)N)r�r�)rrbrrrr^szUserList.__eq__cCs|j|j|�kS)N)r�r�)rrbrrr�__gt__szUserList.__gt__cCs|j|j|�kS)N)r�r�)rrbrrr�__ge__szUserList.__ge__cCst|t�r|jS|S)N)r]rr�)rrbrrr�__castszUserList.__castcCs
||jkS)N)r�)rr�rrrr�szUserList.__contains__cCs
t|j�S)N)r(r�)rrrrr�szUserList.__len__cCs
|j|S)N)r�)r�irrrr�szUserList.__getitem__cCs||j|<dS)N)r�)rr�r�rrrr6szUserList.__setitem__cCs|j|=dS)N)r�)rr�rrrr:szUserList.__delitem__cCsPt|t�r|j|j|j�St|t|j��r<|j|j|�S|j|jt|��S)N)r]rrQr�r�rR)rrbrrrr�s

zUserList.__add__cCsPt|t�r|j|j|j�St|t|j��r<|j||j�S|jt|�|j�S)N)r]rrQr�r�rR)rrbrrr�__radd__#s

zUserList.__radd__cCsRt|t�r|j|j7_n2t|t|j��r<|j|7_n|jt|�7_|S)N)r]rr�r�rR)rrbrrrr�)s
zUserList.__iadd__cCs|j|j|�S)N)rQr�)rrGrrr�__mul__1szUserList.__mul__cCs|j|9_|S)N)r�)rrGrrr�__imul__4szUserList.__imul__cCs|jj|�dS)N)r��append)rr�rrrr�7szUserList.appendcCs|jj||�dS)N)r��insert)rr�r�rrrr�8szUserList.insertr&cCs|jj|�S)N)r�r7)rr�rrrr79szUserList.popcCs|jj|�dS)N)r��remove)rr�rrrr�:szUserList.removecCs|jj�dS)N)r�r=)rrrrr=;szUserList.clearcCs
|j|�S)N)rQ)rrrrrU<sz
UserList.copycCs|jj|�S)N)r�r�)rr�rrrr�=szUserList.countcGs|jj|f|��S)N)r�rx)rr�r/rrrrx>szUserList.indexcCs|jj�dS)N)r�r�)rrrrr�?szUserList.reversecOs|jj||�dS)N)r��sort)rr/r0rrrr�@sz
UserList.sortcCs*t|t�r|jj|j�n|jj|�dS)N)r]rr��extend)rrbrrrr�As
zUserList.extend)Nr�)r�)"rrrrcr2rSr�r�r^r�r�r�r�r�r�r6r:r�r�r�r��__rmul__r�r�r�r7r�r=rUr�rxr�r�r�rrrrrs>


c@s`eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�ZeZd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1ejfd2d3�Zd�d5d6�Zd1ejfd7d8�Z d�d:d;�Z!d1ejfd<d=�Z"d>d?�Z#d@dA�Z$d1ejfdBdC�Z%dDdE�Z&dFdG�Z'dHdI�Z(dJdK�Z)dLdM�Z*dNdO�Z+dPdQ�Z,dRdS�Z-dTdU�Z.dVdW�Z/dXdY�Z0dZd[�Z1d\d]�Z2d^d_�Z3d�d`da�Z4e5j6Z6dbdc�Z7d�dedf�Z8d1ejfdgdh�Z9d1ejfdidj�Z:dkdl�Z;dmdn�Z<d�dodp�Z=d�dqdr�Z>d�dsdt�Z?d�dvdw�Z@d1ejfdxdy�ZAd�dzd{�ZBd|d}�ZCd~d�ZDd�d��ZEd�d��ZFd�d��ZGd4S)�rcCs<t|t�r||_n&t|t�r.|jdd�|_n
t|�|_dS)N)r]r�r�r)r�seqrrrr2Ns


zUserString.__init__cCs
t|j�S)N)r�r�)rrrr�__str__UszUserString.__str__cCs
t|j�S)N)r�r�)rrrrrSVszUserString.__repr__cCs
t|j�S)N)�intr�)rrrr�__int__WszUserString.__int__cCs
t|j�S)N)�floatr�)rrrr�	__float__XszUserString.__float__cCs
t|j�S)N)�complexr�)rrrr�__complex__YszUserString.__complex__cCs
t|j�S)N)�hashr�)rrrr�__hash__ZszUserString.__hash__cCs|jdd�fS)N)r�)rrrr�__getnewargs__[szUserString.__getnewargs__cCs t|t�r|j|jkS|j|kS)N)r]rr�)r�stringrrrr^^s
zUserString.__eq__cCs t|t�r|j|jkS|j|kS)N)r]rr�)rr�rrrr�bs
zUserString.__lt__cCs t|t�r|j|jkS|j|kS)N)r]rr�)rr�rrrr�fs
zUserString.__le__cCs t|t�r|j|jkS|j|kS)N)r]rr�)rr�rrrr�js
zUserString.__gt__cCs t|t�r|j|jkS|j|kS)N)r]rr�)rr�rrrr�ns
zUserString.__ge__cCst|t�r|j}||jkS)N)r]rr�)r�charrrrr�ss
zUserString.__contains__cCs
t|j�S)N)r(r�)rrrrr�xszUserString.__len__cCs|j|j|�S)N)rQr�)rrxrrrr�yszUserString.__getitem__cCsJt|t�r|j|j|j�St|t�r6|j|j|�S|j|jt|��S)N)r]rrQr�r�)rrbrrrr�zs


zUserString.__add__cCs.t|t�r|j||j�S|jt|�|j�S)N)r]r�rQr�)rrbrrrr��s
zUserString.__radd__cCs|j|j|�S)N)rQr�)rrGrrrr��szUserString.__mul__cCs|j|j|�S)N)rQr�)rr/rrrr��szUserString.__mod__cCs|j|t�S)N)rQr/)rrtrrr�__rmod__�szUserString.__rmod__cCs|j|jj��S)N)rQr��
capitalize)rrrrr��szUserString.capitalizecCs|j|jj��S)N)rQr��casefold)rrrrr��szUserString.casefoldcGs|j|jj|f|���S)N)rQr��center)r�widthr/rrrr��szUserString.centerr
cCs t|t�r|j}|jj|||�S)N)r]rr�r�)r�sub�start�endrrrr��s
zUserString.countNcCs>|r.|r|j|jj||��S|j|jj|��S|j|jj��S)N)rQr��encode)r�encoding�errorsrrrr��s
zUserString.encodecCs|jj|||�S)N)r��endswith)r�suffixr�r�rrrr�szUserString.endswith�cCs|j|jj|��S)N)rQr��
expandtabs)r�tabsizerrrr�szUserString.expandtabscCs t|t�r|j}|jj|||�S)N)r]rr��find)rr�r�r�rrrr�s
zUserString.findcOs|jj||�S)N)r�rt)rr/r0rrrrt�szUserString.formatcCs|jj|�S)N)r��
format_map)rr�rrrr�szUserString.format_mapcCs|jj|||�S)N)r�rx)rr�r�r�rrrrx�szUserString.indexcCs
|jj�S)N)r��isalpha)rrrrr�szUserString.isalphacCs
|jj�S)N)r��isalnum)rrrrr	�szUserString.isalnumcCs
|jj�S)N)r��	isdecimal)rrrrr
�szUserString.isdecimalcCs
|jj�S)N)r��isdigit)rrrrr�szUserString.isdigitcCs
|jj�S)N)r�r�)rrrrr��szUserString.isidentifiercCs
|jj�S)N)r��islower)rrrrr�szUserString.islowercCs
|jj�S)N)r��	isnumeric)rrrrr
�szUserString.isnumericcCs
|jj�S)N)r��isprintable)rrrrr�szUserString.isprintablecCs
|jj�S)N)r��isspace)rrrrr�szUserString.isspacecCs
|jj�S)N)r��istitle)rrrrr�szUserString.istitlecCs
|jj�S)N)r��isupper)rrrrr�szUserString.isuppercCs|jj|�S)N)r�r�)rr�rrrr��szUserString.joincGs|j|jj|f|���S)N)rQr��ljust)rr�r/rrrr�szUserString.ljustcCs|j|jj��S)N)rQr��lower)rrrrr�szUserString.lowercCs|j|jj|��S)N)rQr��lstrip)r�charsrrrr�szUserString.lstripcCs|jj|�S)N)r��	partition)r�seprrrr�szUserString.partitionr&cCs6t|t�r|j}t|t�r |j}|j|jj|||��S)N)r]rr�rQr�)r�old�new�maxsplitrrrr��s


zUserString.replacecCs t|t�r|j}|jj|||�S)N)r]rr��rfind)rr�r�r�rrrr�s
zUserString.rfindcCs|jj|||�S)N)r��rindex)rr�r�r�rrrr�szUserString.rindexcGs|j|jj|f|���S)N)rQr��rjust)rr�r/rrrr�szUserString.rjustcCs|jj|�S)N)r��
rpartition)rrrrrr�szUserString.rpartitioncCs|j|jj|��S)N)rQr��rstrip)rrrrrr�szUserString.rstripcCs|jj||�S)N)r�r�)rrrrrrr��szUserString.splitcCs|jj||�S)N)r��rsplit)rrrrrrr �szUserString.rsplitFcCs|jj|�S)N)r��
splitlines)r�keependsrrrr!�szUserString.splitlinescCs|jj|||�S)N)r�r�)r�prefixr�r�rrrr��szUserString.startswithcCs|j|jj|��S)N)rQr��strip)rrrrrr$�szUserString.stripcCs|j|jj��S)N)rQr��swapcase)rrrrr%�szUserString.swapcasecCs|j|jj��S)N)rQr��title)rrrrr&�szUserString.titlecGs|j|jj|��S)N)rQr��	translate)rr/rrrr'�szUserString.translatecCs|j|jj��S)N)rQr��upper)rrrrr(�szUserString.uppercCs|j|jj|��S)N)rQr��zfill)rr�rrrr)�szUserString.zfill)NN)r)Nr�)r�)Nr�)Nr�r�)Nr�)F)N)Hrrrr2r�rSr�r�r�r�r�r^r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rD�maxsizer�r�rrrrtrrxrr	r
rr�rr
rrrrr�rrrr��	maketransrr�rrrrrr�r r!r�r$r%r&r'r(r)rrrrrMs�








)8rc�__all__�_collections_abc�operatorrr�r
ra�keywordrr��sysrD�heapqr��_weakrefrr,�	itertoolsrr�rr�rr��reprlibrrh�_collectionsr�ImportError�MutableSequence�registerr�KeysViewr�	ItemsViewr�
ValuesViewr rgr!r>rr�rsryrr�rrdr	rr�Sequencerrrrr�<module>s`


`3blCI