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
U
Þ=®d|ã@sXddlmZddlmZddlmZddlmZddlm    Z    ddl
m Z dd    l
m Z dd
l
m Z dd l
mZd d „Zdd„ZGdd„de eƒZGdd„deƒZGdd„de eƒZGdd„deƒZGdd„dƒZGdd„deƒZGdd„de eƒZGdd„de eƒZGd d!„d!e eƒZGd"d#„d#e eƒZGd$d%„d%eeƒZGd&d'„d'eƒZdd(lmZd)S)*é)Ú annotations)Ú
MutableSet©Údeepcopyé)Ú
exceptions)Ú_missingé)ÚImmutableDictMixin)ÚImmutableListMixin)ÚImmutableMultiDictMixin)ÚUpdateDictMixincCstt|ƒj›dƒ‚dS)Nz objects are immutable)Ú    TypeErrorÚtypeÚ__name__©Úself©rúYd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\werkzeug/datastructures/structures.pyÚ is_immutablesrccsxt|tƒr|jddEdHnVt|tƒrj| ¡D]6\}}t|ttfƒr\|D]}||fVqJq0||fVq0n
|EdHdS)zyIterates over the items of a mapping yielding keys and values
    without dropping any from more complex structures.
    T©ÚmultiN)Ú
isinstanceÚ    MultiDictÚitemsÚdictÚtupleÚlist)ÚmappingÚkeyÚvalueÚvrrrÚiter_multi_itemss
 
r"c@seZdZdZdd„ZdS)Ú ImmutableListzJAn immutable :class:`list`.
 
    .. versionadded:: 0.5
 
    :private:
    cCst|ƒj›dt |¡›dS©Nú(ú))rrrÚ__repr__rrrrr'+szImmutableList.__repr__N)rÚ
__module__Ú __qualname__Ú__doc__r'rrrrr##sr#c@seZdZdZddd„ZdS)ÚTypeConversionDictzèWorks like a regular dict but the :meth:`get` method can perform
    type conversions.  :class:`MultiDict` and :class:`CombinedMultiDict`
    are subclasses of this class and provide the same feature.
 
    .. versionadded:: 0.5
    NcCsXz ||}Wntk
r$|YSX|dk    rTz ||ƒ}Wntk
rR|}YnX|S)a‘Return the default value if the requested data doesn't exist.
        If `type` is provided and is a callable it should convert the value,
        return it or raise a :exc:`ValueError` if that is not possible.  In
        this case the function will return the default as if the value was not
        found:
 
        >>> d = TypeConversionDict(foo='42', bar='blub')
        >>> d.get('foo', type=int)
        42
        >>> d.get('bar', -1, type=int)
        -1
 
        :param key: The key to be looked up.
        :param default: The default value to be returned if the key can't
                        be looked up.  If not further specified `None` is
                        returned.
        :param type: A callable that is used to cast the value in the
                     :class:`MultiDict`.  If a :exc:`ValueError` is raised
                     by this callable the default value is returned.
        N)ÚKeyErrorÚ
ValueError)rrÚdefaultrÚrvrrrÚget7s 
 
zTypeConversionDict.get)NN)rr(r)r*r0rrrrr+/sr+c@s eZdZdZdd„Zdd„ZdS)ÚImmutableTypeConversionDictzpWorks like a :class:`TypeConversionDict` but does not support
    modifications.
 
    .. versionadded:: 0.5
    cCst|ƒS©zßReturn a shallow mutable copy of this object.  Keep in mind that
        the standard library's :func:`copy` function is a no-op for this class
        like for any other python immutable type (eg: :class:`tuple`).
        )r+rrrrÚcopy_sz ImmutableTypeConversionDict.copycCs|S©NrrrrrÚ__copy__fsz$ImmutableTypeConversionDict.__copy__N©rr(r)r*r3r5rrrrr1Xsr1c@sòeZdZdZd9dd„Zdd„Zdd„Zd    d
„Zd d „Zd d„Z    dd„Z
d:dd„Z dd„Z d;dd„Z d<dd„Zd=dd„Zdd„Zdd„Zd d!„Zd"d#„Zd>d$d%„Zd?d'd(„Zd)d*„Zefd+d,„Zd-d.„Zd/d0„Zd1d2„Zd3d4„Zd5d6„Zd7d8„ZdS)@raA :class:`MultiDict` is a dictionary subclass customized to deal with
    multiple values for the same key which is for example used by the parsing
    functions in the wrappers.  This is necessary because some HTML form
    elements pass multiple values for the same key.
 
    :class:`MultiDict` implements all standard dictionary methods.
    Internally, it saves all values for a key as a list, but the standard dict
    access methods will only return the first value for a key. If you want to
    gain access to the other values, too, you have to use the `list` methods as
    explained below.
 
    Basic Usage:
 
    >>> d = MultiDict([('a', 'b'), ('a', 'c')])
    >>> d
    MultiDict([('a', 'b'), ('a', 'c')])
    >>> d['a']
    'b'
    >>> d.getlist('a')
    ['b', 'c']
    >>> 'a' in d
    True
 
    It behaves like a normal dict thus all dict functions will only return the
    first value when multiple values for one key are found.
 
    From Werkzeug 0.3 onwards, the `KeyError` raised by this class is also a
    subclass of the :exc:`~exceptions.BadRequest` HTTP exception and will
    render a page for a ``400 BAD REQUEST`` if caught in a catch-all for HTTP
    exceptions.
 
    A :class:`MultiDict` can be constructed from an iterable of
    ``(key, value)`` tuples, a dict, a :class:`MultiDict` or from Werkzeug 0.2
    onwards some keyword parameters.
 
    :param mapping: the initial value for the :class:`MultiDict`.  Either a
                    regular dict, an iterable of ``(key, value)`` tuples
                    or `None`.
    NcCsÀt|tƒr&t |dd„| ¡Dƒ¡n–t|tƒrˆi}| ¡D]<\}}t|ttfƒrjt|ƒdkr`q<t|ƒ}n|g}|||<q<t ||¡n4i}|p’dD]\}}|     |g¡ 
|¡q”t ||¡dS)Ncss"|]\}}||dd…fVqdSr4r)Ú.0ÚkÚlrrrÚ    <genexpr>•sz%MultiDict.__init__.<locals>.<genexpr>rr) rrrÚ__init__ÚlistsrrrÚlenÚ
setdefaultÚappend)rrÚtmprr rrrr;“s 
 
 
 
zMultiDict.__init__cCs t| ¡ƒSr4)rr<rrrrÚ __getstate__§szMultiDict.__getstate__cCst |¡t ||¡dSr4)rÚclearÚupdate)rr rrrÚ __setstate__ªs
zMultiDict.__setstate__cCs
t |¡Sr4)rÚ__iter__rrrrrE®szMultiDict.__iter__cCs6||kr(t ||¡}t|ƒdkr(|dSt |¡‚dS)zºReturn the first data value for this key;
        raises KeyError if not found.
 
        :param key: The key to be looked up.
        :raise KeyError: if the key does not exist.
        rN)rÚ __getitem__r=rÚBadRequestKeyError)rrÚlstrrrrF´s
  zMultiDict.__getitem__cCst |||g¡dS)zLike :meth:`add` but removes an existing key first.
 
        :param key: the key for the value.
        :param value: the value to set.
        N)rÚ __setitem__©rrr rrrrIÂszMultiDict.__setitem__cCst ||g¡ |¡dS)z™Adds a new value for the key.
 
        .. versionadded:: 0.6
 
        :param key: the key for the value.
        :param value: the value to add.
        N)rr>r?rJrrrÚaddÊsz MultiDict.addc    Cstzt ||¡}Wntk
r(gYSX|dkr:t|ƒSg}|D],}z| ||ƒ¡WqBtk
rlYqBXqB|S)a]Return the list of items for a given key. If that key is not in the
        `MultiDict`, the return value will be an empty list.  Just like `get`,
        `getlist` accepts a `type` parameter.  All items will be converted
        with the callable defined there.
 
        :param key: The key to be looked up.
        :param type: A callable that is used to cast the value in the
                     :class:`MultiDict`.  If a :exc:`ValueError` is raised
                     by this callable the value will be removed from the list.
        :return: a :class:`list` of all the values for the key.
        N)rrFr,rr?r-©rrrr/ÚresultÚitemrrrÚgetlistÔs 
zMultiDict.getlistcCst ||t|ƒ¡dS)aRemove the old values for a key and add new ones.  Note that the list
        you pass the values in will be shallow-copied before it is inserted in
        the dictionary.
 
        >>> d = MultiDict()
        >>> d.setlist('foo', ['1', '2'])
        >>> d['foo']
        '1'
        >>> d.getlist('foo')
        ['1', '2']
 
        :param key: The key for which the values are set.
        :param new_list: An iterable with the new values for the key.  Old values
                         are removed first.
        N)rrIr)rrÚnew_listrrrÚsetlistîszMultiDict.setlistcCs||kr|||<n||}|S)aGReturns the value for the key if it is in the dict, otherwise it
        returns `default` and sets that value for `key`.
 
        :param key: The key to be looked up.
        :param default: The default value to be returned if the key is not
                        in the dict.  If not further specified it's `None`.
        r)rrr.rrrr>s
zMultiDict.setdefaultcCs4||kr$t|pdƒ}t |||¡n t ||¡}|S)a˜Like `setdefault` but sets multiple values.  The list returned
        is not a copy, but the list that is actually used internally.  This
        means that you can put new values into the dict by appending items
        to the list:
 
        >>> d = MultiDict({"foo": 1})
        >>> d.setlistdefault("foo").extend([2, 3])
        >>> d.getlist("foo")
        [1, 2, 3]
 
        :param key: The key to be looked up.
        :param default_list: An iterable of default values.  It is either copied
                             (in case it was a list) or converted into a list
                             before returned.
        :return: a :class:`list`
        r)rrrIrF©rrZ default_listrrrÚsetlistdefaults
  zMultiDict.setlistdefaultFccs@t |¡D]0\}}|r,|D]}||fVqq
||dfVq
dS)aReturn an iterator of ``(key, value)`` pairs.
 
        :param multi: If set to `True` the iterator returned will have a pair
                      for each value of each key.  Otherwise it will only
                      contain pairs for the first value of each key.
        rN)rr)rrrÚvaluesr rrrr&s
zMultiDict.itemsccs&t |¡D]\}}|t|ƒfVq
dS)zuReturn a iterator of ``(key, values)`` pairs, where values is the list
        of all values associated with the key.N)rrr)rrrTrrrr<4szMultiDict.listsccst |¡D]}|dVq
dS)zAReturns an iterator of the first value on every key's value list.rN©rrT)rrTrrrrT:szMultiDict.valuescCs
t |¡S)aReturn an iterator of all values associated with a key.  Zipping
        :meth:`keys` and this is the same as calling :meth:`lists`:
 
        >>> d = MultiDict({"foo": [1, 2, 3]})
        >>> zip(d.keys(), d.listvalues()) == d.lists()
        True
        rUrrrrÚ
listvalues?szMultiDict.listvaluescCs
| |¡S)z%Return a shallow copy of this object.)Ú    __class__rrrrr3IszMultiDict.copycCs| t|jdd|ƒ¡S)z"Return a deep copy of this object.F)Úflat)rWrÚto_dict©rÚmemorrrrMszMultiDict.deepcopyTcCs|rt| ¡ƒSt| ¡ƒS)a´Return the contents as regular dict.  If `flat` is `True` the
        returned dict will only have the first item present, if `flat` is
        `False` all values will be returned as lists.
 
        :param flat: If set to `False` the dict returned will have lists
                     with all the values in it.  Otherwise it will only
                     contain the first value for each key.
        :return: a :class:`dict`
        ©rrr<©rrXrrrrYQs
 zMultiDict.to_dictcCs$t|ƒD]\}}t |||¡qdS)aùupdate() extends rather than replaces existing key lists:
 
        >>> a = MultiDict({'x': 1})
        >>> b = MultiDict({'x': 2, 'y': 3})
        >>> a.update(b)
        >>> a
        MultiDict([('y', 3), ('x', 1), ('x', 2)])
 
        If the value list for a key in ``other_dict`` is empty, no new values
        will be added to the dict and the key will not be created:
 
        >>> x = {'empty_list': []}
        >>> y = MultiDict()
        >>> y.update(x)
        >>> y
        MultiDict([])
        N)r"rrK©rrrr rrrrC_szMultiDict.updatecCsbz,t ||¡}t|ƒdkr$t |¡‚|dWStk
r\|tk    rL|YSt |¡d‚YnXdS)aŸPop the first item for a list on the dict.  Afterwards the
        key is removed from the dict, so additional values are discarded:
 
        >>> d = MultiDict({"foo": [1, 2, 3]})
        >>> d.pop("foo")
        1
        >>> "foo" in d
        False
 
        :param key: the key to pop.
        :param default: if provided the value to return if the key was
                        not in the dictionary.
        rN)rÚpopr=rrGr,r)rrr.rHrrrr_ts  
 
z MultiDict.popc
Csxz>t |¡}t|dƒdkr*t |d¡‚|d|ddfWStk
rr}zt |jd¡d‚W5d}~XYnXdS)zPop an item from the dict.r    rN)rÚpopitemr=rrGr,Úargs)rrNÚerrrr`s
zMultiDict.popitemcCst ||g¡S)z÷Pop the list for a key from the dict.  If the key is not in the dict
        an empty list is returned.
 
        .. versionchanged:: 0.5
           If the key does no longer exist a list is returned instead of
           raising an error.
        )rr_©rrrrrÚpoplist›szMultiDict.poplistc
CsFz t |¡WStk
r@}zt |jd¡d‚W5d}~XYnXdS)z*Pop a ``(key, list)`` tuple from the dict.rN)rr`r,rrGra)rrbrrrÚ popitemlist¥s zMultiDict.popitemlistcCs| ¡Sr4)r3rrrrr5¬szMultiDict.__copy__cCs |j|dS)N)r[rrZrrrÚ __deepcopy__¯szMultiDict.__deepcopy__cCs"t|ƒj›dt|jddƒ›dS)Nr%Trr&)rrrrrrrrr'²szMultiDict.__repr__)N)N)N)N)F)N)T)rr(r)r*r;rArDrErFrIrKrOrQr>rSrr<rTrVr3rrYrCrr_r`rdrer5rfr'rrrrrjs6(
 
 
 
 
 
 
 
 
 
rc@s$eZdZdZdZdd„Zdd„ZdS)Ú _omd_bucketa Wraps values in the :class:`OrderedMultiDict`.  This makes it
    possible to keep an order over multiple different keys.  It requires
    a lot of extra memory and slows down access a lot, but makes it
    possible to access elements in O(1) and iterate in O(n).
    )Úprevrr ÚnextcCsF|j|_||_||_d|_|jdkr*||_|jdk    r<||j_||_dSr4)Ú _last_bucketrhrr riÚ _first_bucket)rÚomdrr rrrr;¿s
 
z_omd_bucket.__init__cCsH|jr|j|j_|jr |j|j_|j|kr2|j|_|j|krD|j|_dSr4)rhrirkrj)rrlrrrÚunlinkËs
 
 
 
z_omd_bucket.unlinkN)rr(r)r*Ú    __slots__r;rmrrrrrg¶s rgc@sØeZdZdZd2dd„Zdd„ZdZdd„Zd    d
„Zd d „Z    d d„Z
dd„Z dd„Z dd„Z dd„Zdd„Zd3dd„Zdd„Zdd„Zd d!„Zd4d"d#„Zd$d%„Zd5d&d'„Zd(d)„Zd*d+„Zefd,d-„Zd.d/„Zd0d1„ZdS)6ÚOrderedMultiDictaNWorks like a regular :class:`MultiDict` but preserves the
    order of the fields.  To convert the ordered multi dict into a
    list you can use the :meth:`items` method and pass it ``multi=True``.
 
    In general an :class:`OrderedMultiDict` is an order of magnitude
    slower than a :class:`MultiDict`.
 
    .. admonition:: note
 
       Due to a limitation in Python you cannot convert an ordered
       multi dict into a regular dict by using ``dict(multidict)``.
       Instead you have to use the :meth:`to_dict` method, otherwise
       the internal bucket objects are exposed.
    NcCs.t |¡d|_|_|dk    r*t ||¡dSr4)rr;rkrjrorC)rrrrrr;æs
 zOrderedMultiDict.__init__c
Csìt|tƒstSt|tƒr®t|jddƒ}t|jddƒ}z6|D],\}}t|ƒ\}}||ksb||kr>WdSq>Wntk
r„YdSXz t|ƒWntk
r¨YdSXdSt|ƒt|ƒkrÂdS|     ¡D]\}}    | 
|¡|    krÊdSqÊdS)NTrF) rrÚNotImplementedroÚiterrriÚ StopIterationr=r<rO)
rÚotherZiter1Ziter2Zk1Zv1Zk2Zv2rrTrrrÚ__eq__ìs.
 
   zOrderedMultiDict.__eq__cCst|ƒt|jddƒffS©NTr)rrr©rÚprotocolrrrÚ __reduce_ex__szOrderedMultiDict.__reduce_ex__cCst|jddƒSru)rrrrrrrA
szOrderedMultiDict.__getstate__cCs(t |¡|D]\}}| ||¡qdSr4)rrBrK)rrTrr rrrrD s
 zOrderedMultiDict.__setstate__cCs(||krt ||¡djSt |¡‚dS©Nr)rrFr rrGrcrrrrFszOrderedMultiDict.__getitem__cCs| |¡| ||¡dSr4©rdrKrJrrrrIs
zOrderedMultiDict.__setitem__cCs| |¡dSr4)r_rcrrrÚ __delitem__szOrderedMultiDict.__delitem__cCsdd„| ¡DƒS)Ncss|]\}}|VqdSr4r©r7rr rrrr:sz(OrderedMultiDict.keys.<locals>.<genexpr>©rrrrrÚkeysszOrderedMultiDict.keyscCs t| ¡ƒSr4©rqr~rrrrrE!szOrderedMultiDict.__iter__cCsdd„| ¡DƒS)Ncss|]\}}|VqdSr4rr|rrrr:%sz*OrderedMultiDict.values.<locals>.<genexpr>r}rrrrrT$szOrderedMultiDict.valuesFccsh|j}|r*|dk    rd|j|jfV|j}q
n:tƒ}|dk    rd|j|kr\| |j¡|j|jfV|j}q0dSr4)rkrr riÚsetrK)rrÚptrÚ returned_keysrrrr's
 
 zOrderedMultiDict.itemsccsJtƒ}|j}|dk    rF|j|kr>|j| |j¡fV| |j¡|j}q dSr4)r€rkrrOrKri)rr‚rrrrr<5s
 zOrderedMultiDict.listsccs| ¡D]\}}|VqdSr4©r<)rÚ_keyrTrrrrV>szOrderedMultiDict.listvaluescCs t ||g¡ t|||ƒ¡dSr4)rr>r?rgrJrrrrKBszOrderedMultiDict.addc    Cs|zt ||¡}Wntk
r(gYSX|dkr@dd„|DƒSg}|D].}z| ||jƒ¡WqHtk
rtYqHXqH|S)NcSsg|]
}|j‘qSr©r ©r7ÚxrrrÚ
<listcomp>Ksz,OrderedMultiDict.getlist.<locals>.<listcomp>)rrFr,r?r r-rLrrrrOEs
zOrderedMultiDict.getlistcCs$| |¡|D]}| ||¡qdSr4rz)rrrPr rrrrQTs
zOrderedMultiDict.setlistcCs tdƒ‚dS)Nz5setlistdefault is unsupported for ordered multi dicts)rrRrrrrSYszOrderedMultiDict.setlistdefaultcCs$t|ƒD]\}}t |||¡qdSr4)r"rorKr^rrrrC\szOrderedMultiDict.updatecCs0t ||d¡}|D]}| |¡qdd„|DƒS)NrcSsg|]
}|j‘qSrr…r†rrrrˆdsz,OrderedMultiDict.poplist.<locals>.<listcomp>)rr_rm)rrÚbucketsÚbucketrrrrd`s zOrderedMultiDict.poplistcCs`zt ||¡}Wn0tk
r@|tk    r0|YSt |¡d‚YnX|D]}| |¡qF|djSry)rr_r,rrrGrmr )rrr.r‰rŠrrrr_fs zOrderedMultiDict.popc
Csjzt |¡\}}Wn4tk
rF}zt |jd¡d‚W5d}~XYnX|D]}| |¡qL||djfSry)rr`r,rrGrarmr ©rrr‰rbrŠrrrr`ts$ zOrderedMultiDict.popitemc
Csnzt |¡\}}Wn4tk
rF}zt |jd¡d‚W5d}~XYnX|D]}| |¡qL|dd„|DƒfS)NrcSsg|]
}|j‘qSrr…r†rrrrˆˆsz0OrderedMultiDict.popitemlist.<locals>.<listcomp>)rr`r,rrGrarmr‹rrrres$ zOrderedMultiDict.popitemlist)N)F)N)N)rr(r)r*r;rtÚ__hash__rxrArDrFrIr{r~rErTrr<rVrKrOrQrSrCrdrr_r`rerrrrroÖs2
 
    
 
  roc@s°eZdZdZdd„Zd)dd„Zed*dd„ƒZd    d
„Zd+d d „Z    d,d d„Z
dd„Z dd„Z dd„Z d-dd„Zdd„Zdd„Zdd„Zdd„Zd.d!d"„Zd#d$„Zd%d&„Zd'd(„ZdS)/ÚCombinedMultiDicta>A read only :class:`MultiDict` that you can pass multiple :class:`MultiDict`
    instances as sequence and it will combine the return values of all wrapped
    dicts:
 
    >>> from werkzeug.datastructures import CombinedMultiDict, MultiDict
    >>> post = MultiDict([('foo', 'bar')])
    >>> get = MultiDict([('blub', 'blah')])
    >>> combined = CombinedMultiDict([get, post])
    >>> combined['foo']
    'bar'
    >>> combined['blub']
    'blah'
 
    This works for all read operations and will raise a `TypeError` for
    methods that usually change data which isn't possible.
 
    From Werkzeug 0.3 onwards, the `KeyError` raised by this class is also a
    subclass of the :exc:`~exceptions.BadRequest` HTTP exception and will
    render a page for a ``400 BAD REQUEST`` if caught in a catch-all for HTTP
    exceptions.
    cCst|ƒ|jffSr4)rÚdictsrvrrrrx¢szCombinedMultiDict.__reduce_ex__NcCst|ƒp
g|_dSr4)rrŽ)rrŽrrrr;¥szCombinedMultiDict.__init__cCstd|j›dƒ‚dS)Nzcannot create z instances by fromkeys)rr)Úclsr~r rrrÚfromkeys¨szCombinedMultiDict.fromkeyscCs.|jD]}||kr||Sqt |¡‚dSr4)rŽrrG©rrÚdrrrrF¬s
zCombinedMultiDict.__getitem__c    CsX|jD]L}||kr|dk    rFz|||ƒWStk
rDYqYnX||Sq|Sr4)rŽr-)rrr.rr’rrrr0²s
 
zCombinedMultiDict.getcCs&g}|jD]}| | ||¡¡q
|Sr4)rŽÚextendrO)rrrr/r’rrrrO½s
zCombinedMultiDict.getlistcCstƒ}|j|jŽ|S)z€This function exists so __len__ can be implemented more efficiently,
        saving one list creation from an iterator.
        )r€rCrŽ)rr/rrrÚ
_keys_implÃs zCombinedMultiDict._keys_implcCs| ¡Sr4)r”rrrrr~ËszCombinedMultiDict.keyscCs t| ¡ƒSr4rrrrrrEÎszCombinedMultiDict.__iter__FccsVtƒ}|jD]D}| |¡D]4\}}|r2||fVq||kr| |¡||fVqq dSr4)r€rŽrrK)rrÚfoundr’rr rrrrÑs
 
zCombinedMultiDict.itemsccs| ¡D]\}}|VqdSr4r})rr„r rrrrTÛszCombinedMultiDict.valuescCs@i}|jD](}| ¡D]\}}| |g¡ |¡qq
t| ¡ƒSr4)rŽr<r>r“rr)rr/r’rrTrrrr<ßs
 
zCombinedMultiDict.listscCsdd„| ¡DƒS)Ncss|]}|dVqdS)r    Nrr†rrrr:çsz/CombinedMultiDict.listvalues.<locals>.<genexpr>rƒrrrrrVæszCombinedMultiDict.listvaluescCst|ƒS)a0Return a shallow mutable copy of this object.
 
        This returns a :class:`MultiDict` representing the data at the
        time of copying. The copy will no longer reflect changes to the
        wrapped dicts.
 
        .. versionchanged:: 0.15
            Return a mutable :class:`MultiDict`.
        ©rrrrrr3és
zCombinedMultiDict.copyTcCs|rt| ¡ƒSt| ¡ƒS)a³Return the contents as regular dict.  If `flat` is `True` the
        returned dict will only have the first item present, if `flat` is
        `False` all values will be returned as lists.
 
        :param flat: If set to `False` the dict returned will have lists
                     with all the values in it.  Otherwise it will only
                     contain the first item for each key.
        :return: a :class:`dict`
        r\r]rrrrYõs
 zCombinedMultiDict.to_dictcCs t| ¡ƒSr4)r=r”rrrrÚ__len__szCombinedMultiDict.__len__cCs|jD]}||krdSqdS)NTF)rŽr‘rrrÚ __contains__s
zCombinedMultiDict.__contains__cCst|ƒj›d|j›dSr$)rrrŽrrrrr' szCombinedMultiDict.__repr__)N)N)NN)N)F)T)rr(r)r*rxr;Ú classmethodrrFr0rOr”r~rErrTr<rVr3rYr—r˜r'rrrrr‹s(
 
 
 
 
 
rc@s(eZdZdZdd„Zdd„Zdd„ZdS)    Ú ImmutableDictz;An immutable :class:`dict`.
 
    .. versionadded:: 0.5
    cCst|ƒj›dt |¡›dSr$©rrrr'rrrrr'szImmutableDict.__repr__cCst|ƒSr2)rrrrrr3szImmutableDict.copycCs|Sr4rrrrrr5!szImmutableDict.__copy__N)rr(r)r*r'r3r5rrrrršsršc@s eZdZdZdd„Zdd„ZdS)ÚImmutableMultiDictz@An immutable :class:`MultiDict`.
 
    .. versionadded:: 0.5
    cCst|ƒSr2r–rrrrr3+szImmutableMultiDict.copycCs|Sr4rrrrrr52szImmutableMultiDict.__copy__Nr6rrrrrœ%srœc@s(eZdZdZdd„Zdd„Zdd„ZdS)    ÚImmutableOrderedMultiDictzGAn immutable :class:`OrderedMultiDict`.
 
    .. versionadded:: 0.6
    cCst|jddƒSru)Ú    enumeraterrrrrÚ_iter_hashitems<sz)ImmutableOrderedMultiDict._iter_hashitemscCst|ƒSr2)rorrrrr3?szImmutableOrderedMultiDict.copycCs|Sr4rrrrrr5Fsz"ImmutableOrderedMultiDict.__copy__N)rr(r)r*rŸr3r5rrrrr6src@s"eZdZdZddd„Zdd„ZdS)Ú CallbackDictzwA dict that calls a function passed every time something is changed.
    The function is passed the dict instance.
    NcCst ||p d¡||_dS)Nr)rr;Ú    on_update)rÚinitialr¡rrrr;OszCallbackDict.__init__cCsdt|ƒj›dt |¡›dS)Nú<ú ú>r›rrrrr'SszCallbackDict.__repr__)NN)rr(r)r*r;r'rrrrr Js
r c@s¬eZdZdZd*dd„Zdd„Zdd„Zd    d
„Zd d „Zd d„Z    dd„Z
dd„Z d+dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zd d!„Zd"d#„Zd$d%„Zd&d'„Zd(d)„ZdS),Ú    HeaderSeta‡Similar to the :class:`ETags` class this implements a set-like structure.
    Unlike :class:`ETags` this is case insensitive and used for vary, allow, and
    content-language headers.
 
    If not constructed using the :func:`parse_set_header` function the
    instantiation works like this:
 
    >>> hs = HeaderSet(['foo', 'bar', 'baz'])
    >>> hs
    HeaderSet(['foo', 'bar', 'baz'])
    NcCs*t|pdƒ|_dd„|jDƒ|_||_dS)NrcSsh|] }| ¡’qSr)Úlowerr†rrrÚ    <setcomp>fsz%HeaderSet.__init__.<locals>.<setcomp>)rÚ_headersÚ_setr¡)rÚheadersr¡rrrr;dszHeaderSet.__init__cCs| |f¡dS)zAdd a new header to the set.N)rC©rÚheaderrrrrKisz HeaderSet.addcCsj| ¡}||jkrt|ƒ‚|j |¡t|jƒD] \}}| ¡|kr0|j|=qRq0|jdk    rf| |¡dS)aCRemove a header from the set.  This raises an :exc:`KeyError` if the
        header is not in the set.
 
        .. versionchanged:: 0.5
            In older versions a :exc:`IndexError` was raised instead of a
            :exc:`KeyError` if the object was missing.
 
        :param header: the header to be removed.
        N)r§rªr,Úremoveržr©r¡)rr­rÚidxrrrr®ms
 
 
zHeaderSet.removecCsXd}|D]2}| ¡}||jkr|j |¡|j |¡d}q|rT|jdk    rT| |¡dS)z†Add all the headers from the iterable to the set.
 
        :param iterable: updates the set with the items from the iterable.
        FTN)r§rªr©r?rKr¡)rÚiterableZ inserted_anyr­rrrrrC‚s
  zHeaderSet.updatecCs(z| |¡Wntk
r"YnXdS)zdLike :meth:`remove` but ignores errors.
 
        :param header: the header to be discarded.
        N)r®r,r¬rrrÚdiscard‘szHeaderSet.discardcCs4| ¡}t|jƒD]\}}| ¡|kr|SqdS)zReturn the index of the header in the set or return -1 if not found.
 
        :param header: the header to be looked up.
        éÿÿÿÿ)r§ržr©)rr­r¯rNrrrÚfind›s
 
zHeaderSet.findcCs| |¡}|dkrt|ƒ‚|S)zReturn the index of the header in the set or raise an
        :exc:`IndexError`.
 
        :param header: the header to be looked up.
        r)r³Ú
IndexError)rr­r/rrrÚindex¦s
zHeaderSet.indexcCs.|j ¡|jdd…=|jdk    r*| |¡dS)zClear the set.N)rªrBr©r¡rrrrrB±s
 
zHeaderSet.clearFcCs|rt|jƒSt|jƒS)aReturn the set as real python set type.  When calling this, all
        the items are converted to lowercase and the ordering is lost.
 
        :param preserve_casing: if set to `True` the items in the set returned
                                will have the original case like in the
                                :class:`HeaderSet`, otherwise they will
                                be lowercase.
        )r€r©rª)rZpreserve_casingrrrÚas_set¸s    
zHeaderSet.as_setcCsd ttj|jƒ¡S)z2Convert the header set into an HTTP header string.z, )ÚjoinÚmapÚhttpZquote_header_valuer©rrrrÚ    to_headerÅszHeaderSet.to_headercCs
|j|Sr4)r©)rr¯rrrrFÉszHeaderSet.__getitem__cCs4|j |¡}|j | ¡¡|jdk    r0| |¡dSr4)r©r_rªr®r§r¡)rr¯r/rrrr{Ìs 
zHeaderSet.__delitem__cCsL|j|}|j | ¡¡||j|<|j | ¡¡|jdk    rH| |¡dSr4)r©rªr®r§rKr¡)rr¯r ÚoldrrrrIÒs 
 
 
zHeaderSet.__setitem__cCs| ¡|jkSr4)r§rªr¬rrrr˜ÚszHeaderSet.__contains__cCs
t|jƒSr4)r=rªrrrrr—ÝszHeaderSet.__len__cCs
t|jƒSr4)rqr©rrrrrEàszHeaderSet.__iter__cCs
t|jƒSr4)ÚboolrªrrrrÚ__bool__ãszHeaderSet.__bool__cCs| ¡Sr4)rºrrrrÚ__str__æszHeaderSet.__str__cCst|ƒj›d|j›dSr$)rrr©rrrrr'észHeaderSet.__repr__)NN)F)rr(r)r*r;rKr®rCr±r³rµrBr¶rºrFr{rIr˜r—rEr½r¾r'rrrrr¦Ws(
 
 
r¦)r¹N) Ú
__future__rÚcollections.abcrr3rÚrÚ    _internalrZmixinsr
r r r rr"rr#rr+r1rrgrorršrœrr r¦r¹rrrrÚ<module>s8          )N 6