Skip to content

Commit 19363f2

Browse files
gh-115075: Fix info about initialization of mimetypes.MimeTypes attributes (GH-150691)
They are no longer depended on the current value of global variables since Python 3.9 (see gh-49213).
1 parent f81c03a commit 19363f2

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
@@ -211,8 +211,8 @@ than one MIME-type database; it provides an interface similar to the one of the
211211
.. class:: MimeTypes(filenames=(), strict=True)
212212

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

232232

233233
.. attribute:: MimeTypes.encodings_map
234234

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

238238

239239
.. attribute:: MimeTypes.types_map
240240

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

246247

247248
.. attribute:: MimeTypes.types_map_inv
248249

249250
Tuple containing two dictionaries, mapping MIME types to a list of filename
250251
extensions: the first dictionary is for the non-standards types and the
251-
second one is for the standard types. They are initialized by
252-
:data:`common_types` and :data:`types_map`.
252+
second one is for the standard types.
253+
They are initialized with some predefined values and MIME type
254+
information loaded from files specified by the *filenames* argument.
253255

254256

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

0 commit comments

Comments
 (0)