Commit Graph

103 Commits

Author SHA1 Message Date
Geoffrey Thomas ef172521a9
Remove almost all unpaired backticks in docstrings (#119231)
As reported in #117847 and #115366, an unpaired backtick in a docstring
tends to confuse e.g. Sphinx running on subclasses of standard library
objects, and the typographic style of using a backtick as an opening
quote is no longer in favor. Convert almost all uses of the form

    The variable `foo' should do xyz

to

    The variable 'foo' should do xyz

and also fix up miscellaneous other unpaired backticks (extraneous /
missing characters).

No functional change is intended here other than in human-readable
docstrings.
2024-05-22 12:35:18 -04:00
Serhiy Storchaka d6fa1d4bee
gh-66543: Add mimetypes.guess_file_type() (GH-117258) 2024-05-06 15:50:52 +03:00
Nikita Sobolev 1511bc95c4
gh-101137: Add `text/x-rst` to `mimetypes` (#118593) 2024-05-05 13:39:50 +00:00
Ryan Batchelder b6f0ab5b1c
gh-83505: Add markdown mimetype mapping (#17995) 2024-05-05 13:09:59 +00:00
Antonio 70969d53a7
gh-97901 add missing text/rtf to mimetypes (GH-97902)
Co-authored-by: Noam Cohen <noam@noam.me>
2024-03-26 15:10:29 +01:00
Serhiy Storchaka 9654daf793
gh-66543: Fix mimetype.guess_type() (GH-117217)
Fix parsing of the following corner cases:

* URLs with only a host name
* URLs containing a fragment
* URLs containing a query
* filenames with only a UNC sharepoint on Windows

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2024-03-26 13:26:45 +02:00
Nachtalb b905fad838
gh-111741: Recognise image/webp as a standard format in the mimetypes module (GH-111742)
Previously it was supported as a non-standard type.
2024-01-31 17:33:46 +02:00
Nick Drozd 024ac542d7
bpo-45975: Simplify some while-loops with walrus operator (GH-29347) 2022-11-26 14:33:25 -08:00
Noam Cohen 2a168355f0
gh-97646: Change `.js` and `.mjs` files mimetype to conform to RFC 9239 (#97934) 2022-10-07 12:00:53 -07:00
kixorz 6dee69577a
bpo-45639: Add webp and avif image formats to mimetypes (#29259)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-05-03 15:17:57 -06:00
Kumar Aditya 5dd7ec52b8
bpo-20392: Fix inconsistency with uppercase file extensions in mimetypes.guess_type (GH-30229) 2022-03-15 15:25:43 +02:00
Dylan Van Assche ef5305819f
bpo-42158: Add MIME types for n-triples, n-quads, n3 and trig (GH-23230)
Co-authored-by: Éric Araujo <merwok@netwok.org>
2021-11-20 16:52:00 +01:00
Josephine-Marie d74da9e140
bpo-45411: Update mimetypes.py (GH-28792)
.vtt and .srt files are common subtitle files, used by browsers.
2021-10-11 13:05:28 +02:00
Serhiy Storchaka 97ea18eced
bpo-35474: Fix mimetypes.guess_all_extensions() potentially mutating list (GH-28286)
* Calling guess_all_extensions() with strict=False potentially
  mutated types_map_inv.
* Mutating the result of guess_all_extensions() mutated types_map_inv.
2021-09-11 17:44:44 +03:00
Steve Dower bbf2fb6c7a
bpo-44582: Accelerate mimetypes.init on Windows with a native accelerator (GH-27059) 2021-07-08 16:48:42 +01:00
Andreas Jansson de14d709e3
Remove duplicate mime type mapping .bmp -> image/x-ms-bmp (GH-26300)
Thanks for the contribution @andreasjansson
2021-05-28 22:20:46 -03:00
Ilya Stepin 20a5b7e986
bpo-43542: Add heif/heic formats in mimetypes (GH-24917)
* bpo-43542: Add heif/heic formats in mimetypes

Add HEIF and HEIC format to list of media types. It has IANA registration.

IANA: https://www.iana.org/assignments/media-types/image/heic
HEIF Github: https://github.com/nokiatech/heif

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2021-03-20 16:06:27 -07:00
Nathan Beals 3a87e562ea
bpo-42994: Add MIME types for opus, AAC, 3gpp and 3gpp2 (#24287)
Co-authored-by: Nathan Beals <ndbeals@users.noreply.github.com>
2021-03-02 16:20:18 -08:00
Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి) 7f569c9bc0
bpo-41048: mimetypes should read the rule file using UTF-8, not the locale encoding (GH-20998) 2020-06-29 11:36:48 +03:00
MARK SCHWAB 60c2a810e3
bpo-40626: Support HDF5 in mimetypes (GH-20042)
Add hdf5 with .h5 file extension

See 'Recommendations' section for mime types from the HDF group:  https://www.hdfgroup.org/2018/06/citations-for-hdf-data-and-software/

Patch by Mark Schwab.
2020-06-11 15:04:13 -04:00
Karthikeyan Singaravelan d8efc14951
bpo-39299: Add more tests for mimetypes and its cli. (GH-17949)
* Add tests for case insensitive check of types and extensions as fallback.
* Add tests for data url with no comma.
* Add tests for read_mime_types.
* Add tests for the mimetypes cli and refactor __main__ code to private function.
* Restore mimetypes.knownfiles value at the end of the test.
2020-01-13 20:09:36 +05:30
Philip McMahon b2b4a51f74 bpo-32021: Support brotli .br encoding in mimetypes (#12200)
Add support for brotli encoding in the encoding_map.
2020-01-12 14:31:49 -08:00
Abhilash Raj 19a3d87300 bpo-38449: Revert "bpo-22347: Update mimetypes.guess_type to allow oper parsing of URLs (GH-15522)" (GH-16724)
This reverts commit 87bd2071c7.



https://bugs.python.org/issue38449
2019-10-11 22:41:35 -07:00
Filip Š 4b41745b3c bpo-37305: add MIME type for Web App Manifest (#14199)
* bpo-37305: add MIME type for Web App Manifest

* bpo-37305: add news entry

* Restore indentation and sort by value
2019-09-11 14:32:04 +01:00
Dong-hee Na 87bd2071c7 bpo-22347: Update mimetypes.guess_type to allow proper parsing of URLs (GH-15522)
https://bugs.python.org/issue22347
2019-09-04 17:34:35 -07:00
David K. Hess 9fc720e5e4 bpo-4963: Fix for initialization and non-deterministic behavior issues in mimetypes (GH-3062) 2019-06-24 16:46:59 -07:00
Mayank Asthana 7e18deef65 bpo-34926: Make mimetypes.guess_type accept os.PathLike objects (GH-9777)
:meth:`mimetypes.MimeTypes.guess_type` now accepts :term:`path-like object` in addition to url strings.
2018-10-10 16:46:44 +02:00
travisoneill 199a280af5 bpo-34758: add .wasm to recognized file extensions in mimetypes module (GH-9464) 2018-10-09 07:43:58 +03:00
Bradley Meck 0854b92cd2 bpo-31715 Add mimetype for extension .mjs (#3908) 2018-10-08 23:04:55 +03:00
Cheryl Sabella 0250de4819 bpo-27485: Rename and deprecate undocumented functions in urllib.parse (GH-2205) 2018-04-25 16:51:54 -07:00
Nitish Chandra ede157331b bpo-22589 Changed MIME type of .bmp to "image/bmp" (#4756)
Per rfc7903 this is the standard MIME type for this file format, and appears as such in the IANA MIME registry.
2017-12-08 07:48:44 -05:00
Henk-Jaap Wagenaar f02f5e5c3e bpo-31867: Remove duplicates in default mimetypes. (#4388) 2017-11-17 12:10:19 +02:00
Nate Tangsurat 8204b90368 bpo-30824: Add mimetype for .json (#3048) 2017-08-14 14:39:45 -04:00
Serhiy Storchaka 55fe1ae970 bpo-30022: Get rid of using EnvironmentError and IOError (except test… (#1051) 2017-04-16 10:46:38 +03:00
Martin Panter f8f3121775 Issue #27108: Add missing names to mimetypes.__all__, by Jacek Kołodziej 2016-06-06 01:59:19 +00:00
Berker Peksag d7fdc86153 Issue #16329: Add .webm to mimetypes.types_map
Patch by Giampaolo Rodola'.
2016-04-09 08:00:20 +03:00
Berker Peksag a2d7cf087f Issue #13952: Add .csv to mimetypes.types_map
Patch by Geoff Wilson.
2016-04-09 07:52:05 +03:00
Steve Dower ebb8c2d528 Issue #22028: Ensure mimetypes will not open registry keys with embedded nulls 2015-03-10 13:17:21 -07:00
Serhiy Storchaka c0b0bb6e01 Issue #20331: Fixed possible FD leaks in various modules:
http.server, imghdr, mailcap, mimetypes, xml.etree.
2014-01-25 19:43:56 +02:00
Serhiy Storchaka 91b0bc237c Issue #20331: Fixed possible FD leaks in various modules:
http.server, imghdr, mailcap, mimetypes, xml.etree.
2014-01-25 19:43:02 +02:00
Tim Golden a4df90ceb9 Issue #15207: Fix mimetypes to read from correct area in Windows registry (Original patch by Dave Chambers) 2013-10-22 20:03:47 +01:00
Tim Golden 27a856495e Issue #15207: Fix mimetypes to read from correct area in Windows registry (Original patch by Dave Chambers) 2013-10-22 19:27:34 +01:00
Brett Cannon cd171c8e92 Issue #18200: Back out usage of ModuleNotFoundError (8d28d44f3a9a) 2013-07-04 17:43:24 -04:00
Brett Cannon 0a140668fa Issue #18200: Update the stdlib (except tests) to use
ModuleNotFoundError.
2013-06-13 20:57:26 -04:00
Serhiy Storchaka 59115aa7c9 Issue #16316: mimetypes now recognizes the .xz and .txz (.tar.xz) extensions. 2013-05-04 15:12:55 +03:00
Andrew Svetlov f7a17b48d7 Replace IOError with OSError (#16715) 2012-12-25 16:47:37 +02:00
Andrew Svetlov 3438fa496d Get rig of EnvironmentError (#16705) 2012-12-17 23:35:18 +02:00
Nadeem Vawda 84833aa7b4 Issue #16316: mimetypes now recognizes the .xz and .txz (.tar.xz) extensions.
Patch by Serhiy Storchaka.
2012-10-28 14:52:34 +01:00
Petri Lehtinen df9c945070 #15199: Fix JavaScript's default MIME type to application/javascript 2012-08-20 21:30:03 +03:00
Petri Lehtinen c6fdafcdf3 #15199: Fix JavaScript's default MIME type to application/javascript 2012-08-20 21:28:58 +03:00