File: datastructures.rst

package info (click to toggle)
python-werkzeug 3.1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,148 kB
  • sloc: python: 22,015; javascript: 292; makefile: 39; sh: 17; xml: 16
file content (149 lines) | stat: -rw-r--r-- 3,357 bytes parent folder | download | duplicates (2)
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
===============
Data Structures
===============

.. module:: werkzeug.datastructures

Werkzeug provides some subclasses of common Python objects to extend them
with additional features.  Some of them are used to make them immutable, others
are used to change some semantics to better work with HTTP.

General Purpose
===============

.. versionchanged:: 0.6
   The general purpose classes are now pickleable in each protocol as long
   as the contained objects are pickleable.  This means that the
   :class:`FileMultiDict` won't be pickleable as soon as it contains a
   file.

.. autoclass:: TypeConversionDict
   :members:

.. autoclass:: ImmutableTypeConversionDict
   :members: copy

.. autoclass:: MultiDict
   :members:
   :inherited-members:

.. class:: OrderedMultiDict

    Works 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.

    .. deprecated:: 3.1
        Will be removed in Werkzeug 3.2. Use ``MultiDict`` instead.

.. class:: ImmutableMultiDict

    An immutable :class:`OrderedMultiDict`.

    .. deprecated:: 3.1
        Will be removed in Werkzeug 3.2. Use ``ImmutableMultiDict`` instead.

    .. versionadded:: 0.6

.. autoclass:: ImmutableOrderedMultiDict
   :members: copy

.. autoclass:: CombinedMultiDict

.. autoclass:: ImmutableDict
   :members: copy

.. autoclass:: ImmutableList

.. autoclass:: FileMultiDict
   :members:

.. _http-datastructures:

HTTP Related
============

.. autoclass:: Headers([defaults])
   :members:

.. autoclass:: EnvironHeaders

.. autoclass:: HeaderSet
   :members:

.. autoclass:: Accept
   :members:

.. autoclass:: MIMEAccept
   :members: accept_html, accept_xhtml, accept_json

.. autoclass:: CharsetAccept

.. autoclass:: LanguageAccept

.. autoclass:: RequestCacheControl
    :members:
    :inherited-members: ImmutableDictMixin, CallbackDict
    :member-order: groupwise

.. autoclass:: ResponseCacheControl
    :members:
    :inherited-members: CallbackDict
    :member-order: groupwise

.. autoclass:: ETags
   :members:

.. autoclass:: Authorization
   :members:

.. autoclass:: WWWAuthenticate
   :members:

.. autoclass:: IfRange
   :members:

.. autoclass:: Range
   :members:

.. autoclass:: ContentRange
   :members:


Others
======

.. autoclass:: FileStorage
   :members:

   .. attribute:: stream

      The input stream for the uploaded file.  This usually points to an
      open temporary file.

   .. attribute:: filename

      The filename of the file on the client. Can be a ``str``, or an
      instance of ``os.PathLike``.

   .. attribute:: name

      The name of the form field.

   .. attribute:: headers

      The multipart headers as :class:`Headers` object.  This usually contains
      irrelevant information but in combination with custom multipart requests
      the raw headers might be interesting.

      .. versionadded:: 0.6