Guess the extension for a file based on its MIME type. Return value is a string giving a filename extension, including the leading dot ('.'). The extension is not guaranteed to have been associated with any particular data stream, but would be mapped to the MIME type 'type' by gues
(type, strict=True)
| 370 | return _db.guess_all_extensions(type, strict) |
| 371 | |
| 372 | def guess_extension(type, strict=True): |
| 373 | """Guess the extension for a file based on its MIME type. |
| 374 | |
| 375 | Return value is a string giving a filename extension, including the |
| 376 | leading dot ('.'). The extension is not guaranteed to have been |
| 377 | associated with any particular data stream, but would be mapped to the |
| 378 | MIME type 'type' by guess_type(). If no extension can be guessed for |
| 379 | 'type', None is returned. |
| 380 | |
| 381 | Optional 'strict' argument when false adds a bunch of commonly found, |
| 382 | but non-standard types. |
| 383 | """ |
| 384 | if _db is None: |
| 385 | init() |
| 386 | return _db.guess_extension(type, strict) |
| 387 | |
| 388 | def add_type(type, ext, strict=True): |
| 389 | """Add a mapping between a type and an extension. |
no test coverage detected
searching dependent graphs…