Skip to content

Commit b388c61

Browse files
[3.14] gh-115075: Fix info about initialization of mimetypes.MimeTypes attributes (GH-150691) (GH-156626)
They are no longer depended on the current value of global variables since Python 3.9 (see gh-49213). (cherry picked from commit 19363f2) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent aa24c20 commit b388c61

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

Doc/library/mimetypes.rst

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ than one MIME-type database; it provides an interface similar to the one of the
203203
.. class:: MimeTypes(filenames=(), strict=True)
204204

205205
This class represents a MIME-types database. By default, it provides access to
206-
the same database as the rest of this module. The initial database is a copy of
207-
that provided by the module, and may be extended by loading additional
206+
the same database as the rest of this module. The initial database is created from
207+
Python's built-in MIME type tables. It may be extended by loading additional
208208
:file:`mime.types`\ -style files into the database using the :meth:`read` or
209209
:meth:`readfp` methods. The mapping dictionaries may also be cleared before
210210
loading additional data if the default data is not desired.
@@ -218,30 +218,32 @@ than one MIME-type database; it provides an interface similar to the one of the
218218
Dictionary mapping suffixes to suffixes. This is used to allow recognition of
219219
encoded files for which the encoding and the type are indicated by the same
220220
extension. For example, the :file:`.tgz` extension is mapped to :file:`.tar.gz`
221-
to allow the encoding and type to be recognized separately. This is initially a
222-
copy of the global :data:`suffix_map` defined in the module.
221+
to allow the encoding and type to be recognized separately.
222+
This is initialized with some predefined values.
223223

224224

225225
.. attribute:: MimeTypes.encodings_map
226226

227-
Dictionary mapping filename extensions to encoding types. This is initially a
228-
copy of the global :data:`encodings_map` defined in the module.
227+
Dictionary mapping filename extensions to encoding types.
228+
This is initialized with some predefined values.
229229

230230

231231
.. attribute:: MimeTypes.types_map
232232

233233
Tuple containing two dictionaries, mapping filename extensions to MIME types:
234234
the first dictionary is for the non-standards types and the second one is for
235-
the standard types. They are initialized by :data:`common_types` and
236-
:data:`types_map`.
235+
the standard types.
236+
They are initialized with some predefined values and MIME type
237+
information loaded from files specified by the *filenames* argument.
237238

238239

239240
.. attribute:: MimeTypes.types_map_inv
240241

241242
Tuple containing two dictionaries, mapping MIME types to a list of filename
242243
extensions: the first dictionary is for the non-standards types and the
243-
second one is for the standard types. They are initialized by
244-
:data:`common_types` and :data:`types_map`.
244+
second one is for the standard types.
245+
They are initialized with some predefined values and MIME type
246+
information loaded from files specified by the *filenames* argument.
245247

246248

247249
.. method:: MimeTypes.guess_extension(type, strict=True)

0 commit comments

Comments
 (0)