2# +==== BEGIN CatFeeder =================+
5# ...............)..(.')
7# ...............\(__)|
8# Inspired by Joan Stark
9# source https://www.asciiart.eu/
13# FILE: http_constants.py
14# CREATION DATE: 19-11-2025
15# LAST Modified: 22:21:27 23-01-2026
17# This is the backend server in charge of making the actual website work.
19# COPYRIGHT: (c) Cat Feeder
21# File containing the constants that are used by the http codes class.
22# Central definitions for HTTP-related constants:
24# - Known MIME types (DATA_TYPES)
25# - DataTypes Enum (auto-mapped from DATA_TYPES and sorted)
26# - Grouped categories: FILE_TYPES, HTML_TYPES, JSON_TYPES, PLAIN_TEXT_TYPES, etc.
27# - Redirect type added ("redirect")
29# This file is designed to be:
30# - Alphabetically sorted
35# +==== END CatFeeder =================+
38from __future__
import annotations
40from dataclasses
import dataclass
41from typing
import Dict, List, Tuple, ClassVar, Optional, Set
48AUTHORISED_STATUSES: List[int] = [
50 100, 101, 102, 103, 110,
52 200, 201, 202, 203, 204, 205, 206, 207, 208, 226,
54 300, 301, 302, 303, 304, 305, 306, 307, 308,
56 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411,
57 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423,
58 424, 425, 426, 428, 429, 430, 431, 451, 498,
60 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511
69 """Enumeration of common HTTP content (MIME) types.
71 Member names are uppercased, hyphen replaced by underscore, and
72 prefixed with an underscore if starting with a digit (e.g. _3GP).
73 The value of each member is the canonical MIME type string.
76 >>> DataTypes.JSON.value
78 >>> DataTypes.from_key('json') is DataTypes.JSON
81 Use `from_key()` to resolve a member from the original lower-case
82 dictionary key (case-insensitive, supports hyphenated keys).
85 _ignore_ = [
'_key_to_value_cache',
'_value_to_member_cache']
88 _7Z =
'application/x-7z-compressed'
89 DIGIT_7Z =
'application/x-7z-compressed'
90 BZ2 =
'application/x-bzip2'
91 DMG =
'application/x-apple-diskimage'
92 GZIP =
'application/gzip'
93 GZ =
'application/gzip'
94 ISO =
'application/x-iso9660-image'
95 OCTET_STREAM =
'application/octet-stream'
96 RAR =
'application/vnd.rar'
97 TAR =
'application/x-tar'
98 TAR_GZ =
'application/gzip'
99 TAR_BZ2 =
'application/x-bzip2'
100 TAR_XZ =
'application/x-xz'
101 XZ =
'application/x-xz'
102 ZIP =
'application/zip'
113 OGG_AUDIO =
'audio/ogg'
119 DOC =
'application/msword'
120 DOCX =
'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
121 EPUB =
'application/epub+zip'
122 GEOJSON =
'application/geo+json'
123 ICS =
'text/calendar'
124 JSON =
'application/json'
125 JSONLD =
'application/ld+json'
126 JSONPATCH =
'application/json-patch+json'
127 JSONSCHEMA =
'application/schema+json'
128 MARKDOWN =
'text/markdown'
130 ODS =
'application/vnd.oasis.opendocument.spreadsheet'
131 ODT =
'application/vnd.oasis.opendocument.text'
132 ODP =
'application/vnd.oasis.opendocument.presentation'
133 PDF =
'application/pdf'
135 PPT =
'application/vnd.ms-powerpoint'
136 PPTX =
'application/vnd.openxmlformats-officedocument.presentationml.presentation'
137 RTF =
'application/rtf'
139 TOML =
'application/toml'
141 XLS =
'application/vnd.ms-excel'
142 XLSX =
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
143 YAML =
'application/yaml'
144 YML =
'application/yaml'
145 XHTML =
"application/xhtml+xml"
146 RSS =
"application/rss+xml"
147 ATOM =
"application/atom+xml"
150 EOT =
'application/vnd.ms-fontobject'
158 FORM =
'application/x-www-form-urlencoded'
159 FORM_DATA =
'multipart/form-data'
160 MULTIPART =
'multipart/form-data'
162 JAVASCRIPT =
'application/javascript'
163 JS =
'application/javascript'
164 XML =
'application/xml'
172 ICO =
'image/vnd.microsoft.icon'
177 SVG =
'image/svg+xml'
180 XICON =
'image/x-icon'
182 GRIB =
'application/grib'
183 HDR =
'image/vnd.radiance'
185 H5 =
'application/x-hdf5'
186 HDF =
'application/x-hdf'
194 IIM =
'application/x-iim'
197 MSP =
'image/x-mspaint'
198 PALM =
'image/x-palm'
199 PCD =
'image/x-photo-cd'
201 PBM =
'image/portable-bitmap'
202 PGM =
'image/portable-graymap'
203 PPM =
'image/portable-pixmap'
204 PNM =
'image/portable-anymap'
205 PFM =
'image/portable-floatmap'
206 PSD =
'image/vnd.adobe.photoshop'
212 RAS =
'image/cmu-raster'
221 DDS =
"image/vnd.ms-dds"
222 EPS =
"application/postscript"
230 XBM =
"image/x-xbitmap"
231 XPM =
"image/x-xpixmap"
234 REDIRECT =
'application/redirect'
237 STREAM =
'application/octet-stream'
241 DIGIT_3G2 =
'video/3gpp2'
243 DIGIT_3GP =
'video/3gpp'
245 DIGIT_3GPP =
'video/3gpp'
246 _3GPP2 =
'video/3gpp2'
247 DIGIT_3GPP2 =
'video/3gpp2'
248 AVI =
'video/x-msvideo'
250 MKV =
'video/x-matroska'
251 MOV =
'video/quicktime'
255 OGG_VIDEO =
"video/ogg"
256 WMV =
"video/x-ms-wmv"
260 WASM =
'application/wasm'
261 OGG =
'application/ogg'
264 BASE16 =
'application/base16'
265 BASE32 =
'application/base32'
266 BASE64 =
'application/base64'
267 BASE85 =
'application/base85'
268 BYTES =
'application/bytes'
271 _key_to_value_cache: ClassVar[Dict[str, str]] = {}
272 _value_to_member_cache: ClassVar[Dict[str,
"DataTypes"]] = {}
276 """Initialize internal caches, called on first use."""
278 key_cache = cls.__dict__.get(
'_key_to_value_cache', {})
279 val_cache = cls.__dict__.get(
'_value_to_member_cache', {})
282 if key_cache
and val_cache:
286 key_to_value: Dict[str, str] = {}
287 for name, member
in cls.__members__.items():
292 value_to_member: Dict[str,
"DataTypes"] = {}
293 for member
in cls.__members__.values():
294 value_to_member[member.value] = member
299 """Convert enum member name to dictionary key."""
300 if name.startswith(
"_"):
301 return name[1:].lower()
302 if name.startswith(
"DIGIT_"):
303 return name[6:].lower()
307 def from_key(cls, key: str) -> Optional[
'DataTypes']:
308 """Return enum member matching original DATA_TYPES key (case-insensitive)."""
309 norm = key.strip().lower()
313 key_cache = cls.__dict__.get(
'_key_to_value_cache', {})
317 value = key_cache.get(norm)
321 val_cache = cls.__dict__.get(
'_value_to_member_cache', {})
325 return val_cache.get(value)
330 Return a dictionary mapping normalized lowercase keys to MIME type strings.
332 The keys correspond to the naming convention used in DATA_TYPES:
333 - enum names are lowercased
334 - a leading underscore becomes a leading digit key (e.g. _3GP -> "3gp")
335 - underscores become hyphens only if originally used to escape illegal names
338 >>> DataTypes.get_dict()["json"]
342 Dict[str, str]: A mapping of normalized string keys to MIME type strings.
346 return cls.__dict__.get(
'_key_to_value_cache', {})
354DATA_TYPES: Dict[str, str] = DataTypes.get_dict()
357FILE_TYPES: Tuple[DataTypes, ...] = (
359 DataTypes.ZIP, DataTypes.GZIP, DataTypes.TAR,
360 DataTypes._7Z, DataTypes.DIGIT_7Z,
361 DataTypes.BZ2, DataTypes.DMG, DataTypes.ISO, DataTypes.OCTET_STREAM, DataTypes.RAR,
362 DataTypes.TAR_GZ, DataTypes.TAR_BZ2, DataTypes.TAR_XZ, DataTypes.XZ,
364 DataTypes.EOT, DataTypes.OTF, DataTypes.TTF, DataTypes.WOFF, DataTypes.WOFF2,
366 DataTypes.MP3, DataTypes.WAV, DataTypes.FLAC, DataTypes.AAC, DataTypes.OGG_AUDIO, DataTypes.OPUS,
367 DataTypes.M4A, DataTypes.AIFF, DataTypes.AMR, DataTypes.MID, DataTypes.MIDI,
369 DataTypes.MP4, DataTypes.MPEG, DataTypes.AVI,
370 DataTypes._3GP, DataTypes.DIGIT_3GP,
371 DataTypes._3GPP, DataTypes.DIGIT_3GPP,
372 DataTypes._3G2, DataTypes.DIGIT_3G2,
373 DataTypes._3GPP2, DataTypes.DIGIT_3GPP2,
374 DataTypes.MOV, DataTypes.FLV, DataTypes.MKV, DataTypes.WEBM, DataTypes.OGG_VIDEO,
375 DataTypes.WMV, DataTypes.M4v,
377 DataTypes.PDF, DataTypes.RTF, DataTypes.DOC, DataTypes.DOCX,
378 DataTypes.XLS, DataTypes.XLSX, DataTypes.PPT, DataTypes.PPTX,
379 DataTypes.ODT, DataTypes.ODS, DataTypes.ODP, DataTypes.EPUB,
380 DataTypes.ICS, DataTypes.CSV, DataTypes.GEOJSON,
382 DataTypes.JPEG, DataTypes.JPG, DataTypes.JPE, DataTypes.PNG, DataTypes.GIF, DataTypes.BMP,
383 DataTypes.TIFF, DataTypes.WEBP, DataTypes.ICO, DataTypes.SVG, DataTypes.XICON, DataTypes.GRIB,
384 DataTypes.HDR, DataTypes.ICNS, DataTypes.H5, DataTypes.HDF, DataTypes.JP2, DataTypes.J2K,
385 DataTypes.JPC, DataTypes.JPF, DataTypes.JPX, DataTypes.J2C, DataTypes.IM, DataTypes.IIM,
386 DataTypes.JFIF, DataTypes.MPO, DataTypes.MSP, DataTypes.PALM, DataTypes.PCD, DataTypes.PXR,
387 DataTypes.PBM, DataTypes.PGM, DataTypes.PPM, DataTypes.PNM, DataTypes.PFM, DataTypes.PSD,
388 DataTypes.QOI, DataTypes.BW, DataTypes.RGB, DataTypes.RGBA, DataTypes.SGI, DataTypes.RAS,
389 DataTypes.ICB, DataTypes.VDA, DataTypes.VST, DataTypes.WMF, DataTypes.EMF, DataTypes.DIB,
390 DataTypes.CUR, DataTypes.PCX, DataTypes.DDS, DataTypes.EPS, DataTypes.FIT, DataTypes.FITS,
391 DataTypes.FLI, DataTypes.FLC, DataTypes.GBR, DataTypes.APNG, DataTypes.TIF, DataTypes.XBM,
394 DataTypes.OGG, DataTypes.STREAM,
396 DataTypes.JAVASCRIPT, DataTypes.JS,
398 DataTypes.FORM_DATA, DataTypes.MULTIPART
402HTML_TYPES: Tuple[DataTypes, ...] = (
411JSON_TYPES: Tuple[DataTypes, ...] = (
420PLAIN_TEXT_TYPES: Tuple[DataTypes, ...] = (
433REDIRECT_TYPES: Tuple[DataTypes, ...] = (
438STREAMING_TYPES: Tuple[DataTypes, ...] = (
440 DataTypes.OCTET_STREAM
444UJSON_TYPES: Tuple[DataTypes, ...] = JSON_TYPES
445ORJSON_TYPES: Tuple[DataTypes, ...] = JSON_TYPES
453 """Return a set of MIME type strings for the provided DataTypes group.
455 Using an explicit loop for clarity and easier debugging instead of a
456 comprehension per user preference.
458 result: Set[str] = set()
460 result.add(member.value)
478DEFAULT_MESSAGE_CONTENT: Dict[str, str] = {
'msg':
'message'}
480DEFAULT_MESSAGE_TYPE: str = DataTypes.JSON
486IMAGE_TYPES_UNIVERSAL: Tuple[DataTypes, ...] = (
487 DataTypes.PNG, DataTypes.JPEG, DataTypes.JPE,
488 DataTypes.JPG, DataTypes.GIF, DataTypes.SVG,
489 DataTypes.ICO, DataTypes.WEBP, DataTypes.APNG
491IMAGE_TYPES_NEED_CONVERTING: Tuple[DataTypes, ...] = (
492 DataTypes.BMP, DataTypes.HEIC, DataTypes.HEIF, DataTypes.XICON, DataTypes.AVIF,
493 DataTypes.GRIB, DataTypes.HDR, DataTypes.ICNS, DataTypes.H5, DataTypes.HDF,
494 DataTypes.JP2, DataTypes.J2K, DataTypes.JPC, DataTypes.JPF, DataTypes.JPX, DataTypes.J2C,
495 DataTypes.IM, DataTypes.IIM, DataTypes.JFIF, DataTypes.MPO, DataTypes.MSP,
496 DataTypes.PALM, DataTypes.PCD, DataTypes.PBM, DataTypes.PGM, DataTypes.PPM,
497 DataTypes.PNM, DataTypes.PFM, DataTypes.PSD, DataTypes.QOI, DataTypes.BW,
498 DataTypes.RGB, DataTypes.RGBA, DataTypes.SGI, DataTypes.RAS, DataTypes.ICB,
499 DataTypes.VDA, DataTypes.VST, DataTypes.WMF, DataTypes.EMF, DataTypes.DIB,
500 DataTypes.CUR, DataTypes.PCX, DataTypes.DDS, DataTypes.EPS, DataTypes.FIT,
501 DataTypes.FITS, DataTypes.FLI, DataTypes.FLC, DataTypes.GBR, DataTypes.TIF,
502 DataTypes.XBM, DataTypes.XPM
504IMAGE_TYPES_HEAVY: Tuple[DataTypes, ...] = (
521IMAGE_CONVERSION_TARGET: Dict[DataTypes, DataTypes] = {
522 DataTypes.BMP: DataTypes.WEBP,
523 DataTypes.HEIC: DataTypes.WEBP,
524 DataTypes.HEIF: DataTypes.WEBP,
525 DataTypes.XICON: DataTypes.PNG,
526 DataTypes.AVIF: DataTypes.WEBP,
527 DataTypes.TIFF: DataTypes.WEBP,
528 DataTypes.JPE: DataTypes.JPEG,
529 DataTypes.JPG: DataTypes.JPEG,
530 DataTypes.GRIB: DataTypes.PNG,
531 DataTypes.HDR: DataTypes.PNG,
532 DataTypes.ICNS: DataTypes.PNG,
533 DataTypes.H5: DataTypes.PNG,
534 DataTypes.HDF: DataTypes.PNG,
535 DataTypes.JP2: DataTypes.JPEG,
536 DataTypes.J2K: DataTypes.JPEG,
537 DataTypes.JPC: DataTypes.JPEG,
538 DataTypes.JPF: DataTypes.JPEG,
539 DataTypes.JPX: DataTypes.JPEG,
540 DataTypes.J2C: DataTypes.JPEG,
541 DataTypes.IM: DataTypes.PNG,
542 DataTypes.IIM: DataTypes.PNG,
543 DataTypes.JFIF: DataTypes.JPEG,
544 DataTypes.MPO: DataTypes.JPEG,
545 DataTypes.MSP: DataTypes.PNG,
546 DataTypes.PALM: DataTypes.PNG,
547 DataTypes.PCD: DataTypes.JPEG,
548 DataTypes.PBM: DataTypes.PNG,
549 DataTypes.PGM: DataTypes.PNG,
550 DataTypes.PPM: DataTypes.PNG,
551 DataTypes.PNM: DataTypes.PNG,
552 DataTypes.PFM: DataTypes.PNG,
553 DataTypes.PSD: DataTypes.PNG,
554 DataTypes.QOI: DataTypes.PNG,
555 DataTypes.BW: DataTypes.PNG,
556 DataTypes.RGB: DataTypes.PNG,
557 DataTypes.RGBA: DataTypes.PNG,
558 DataTypes.SGI: DataTypes.PNG,
559 DataTypes.RAS: DataTypes.PNG,
560 DataTypes.ICB: DataTypes.PNG,
561 DataTypes.VDA: DataTypes.PNG,
562 DataTypes.VST: DataTypes.PNG,
563 DataTypes.WMF: DataTypes.PNG,
564 DataTypes.EMF: DataTypes.PNG,
565 DataTypes.DIB: DataTypes.PNG,
566 DataTypes.CUR: DataTypes.PNG,
567 DataTypes.PCX: DataTypes.PNG,
568 DataTypes.DDS: DataTypes.PNG,
569 DataTypes.EPS: DataTypes.PNG,
570 DataTypes.FIT: DataTypes.PNG,
571 DataTypes.FITS: DataTypes.PNG,
572 DataTypes.FLI: DataTypes.GIF,
573 DataTypes.FLC: DataTypes.GIF,
574 DataTypes.GBR: DataTypes.PNG,
575 DataTypes.TIF: DataTypes.WEBP,
576 DataTypes.XBM: DataTypes.PNG,
577 DataTypes.XPM: DataTypes.PNG
581VIDEO_TYPES_UNIVERSAL: Tuple[DataTypes, ...] = (
586VIDEO_TYPES_NEED_CONVERTING: Tuple[DataTypes, ...] = (
598VIDEO_TYPES_HEAVY: Tuple[DataTypes, ...] = (
605VIDEO_CONVERSION_TARGET: Dict[DataTypes, DataTypes] = {
606 DataTypes.MKV: DataTypes.MP4,
607 DataTypes.AVI: DataTypes.MP4,
608 DataTypes.FLV: DataTypes.MP4,
609 DataTypes.MOV: DataTypes.MP4,
610 DataTypes.MPEG: DataTypes.MP4,
611 DataTypes._3GP: DataTypes.MP4,
612 DataTypes._3G2: DataTypes.MP4,
613 DataTypes._3GPP: DataTypes.MP4,
614 DataTypes._3GPP2: DataTypes.MP4,
618AUDIO_TYPES_UNIVERSAL: Tuple[DataTypes, ...] = (
624AUDIO_TYPES_NEED_CONVERTING: Tuple[DataTypes, ...] = (
635AUDIO_TYPES_HEAVY: Tuple[DataTypes, ...] = (
643AUDIO_CONVERSION_TARGET: Dict[DataTypes, DataTypes] = {
644 DataTypes.FLAC: DataTypes.MP3,
645 DataTypes.AIFF: DataTypes.MP3,
646 DataTypes.OPUS: DataTypes.MP3,
647 DataTypes.OGG_AUDIO: DataTypes.MP3,
648 DataTypes.M4A: DataTypes.MP3,
649 DataTypes.AMR: DataTypes.MP3,
650 DataTypes.MID: DataTypes.MP3,
651 DataTypes.MIDI: DataTypes.MP3,
655DOCUMENT_TYPES_UNIVERSAL: Tuple[DataTypes, ...] = (
666DOCUMENT_TYPES_NEED_CONVERTING: Tuple[DataTypes, ...] = (
685DOCUMENT_TYPES_HEAVY: Tuple[DataTypes, ...] = (
692DOCUMENT_CONVERSION_TARGET: Dict[DataTypes, DataTypes] = {
693 DataTypes.DOC: DataTypes.PDF,
694 DataTypes.DOCX: DataTypes.PDF,
695 DataTypes.PPT: DataTypes.PDF,
696 DataTypes.PPTX: DataTypes.PDF,
697 DataTypes.XLS: DataTypes.PDF,
698 DataTypes.XLSX: DataTypes.PDF,
699 DataTypes.ODS: DataTypes.PDF,
700 DataTypes.ODT: DataTypes.PDF,
701 DataTypes.ODP: DataTypes.PDF,
702 DataTypes.EPUB: DataTypes.PDF,
703 DataTypes.MARKDOWN: DataTypes.HTML,
704 DataTypes.MD: DataTypes.HTML,
705 DataTypes.RTF: DataTypes.PDF,
706 DataTypes.TOML: DataTypes.JSON,
707 DataTypes.YAML: DataTypes.JSON,
708 DataTypes.YML: DataTypes.JSON,
712ARCHIVE_TYPES_UNIVERSAL: Tuple[DataTypes, ...] = (
716ARCHIVE_TYPES_NEED_CONVERTING: Tuple[DataTypes, ...] = (
730ARCHIVE_TYPES_HEAVY: Tuple[DataTypes, ...] = (
740ARCHIVE_CONVERSION_TARGET: Dict[DataTypes, DataTypes] = {
741 DataTypes.RAR: DataTypes.ZIP,
742 DataTypes._7Z: DataTypes.ZIP,
743 DataTypes.BZ2: DataTypes.ZIP,
744 DataTypes.TAR: DataTypes.ZIP,
745 DataTypes.GZIP: DataTypes.ZIP,
746 DataTypes.ISO: DataTypes.ZIP,
747 DataTypes.DMG: DataTypes.ZIP,
748 DataTypes.TAR_GZ: DataTypes.ZIP,
749 DataTypes.TAR_BZ2: DataTypes.ZIP,
750 DataTypes.TAR_XZ: DataTypes.ZIP,
754FONT_TYPES_UNIVERSAL: Tuple[DataTypes, ...] = (
759FONT_TYPES_NEED_CONVERTING: Tuple[DataTypes, ...] = (
765FONT_TYPES_HEAVY: Tuple[DataTypes, ...] = (
770FONT_CONVERSION_TARGET: Dict[DataTypes, DataTypes] = {
771 DataTypes.TTF: DataTypes.WOFF2,
772 DataTypes.OTF: DataTypes.WOFF2,
773 DataTypes.EOT: DataTypes.WOFF2,
777BINARY_TYPES_UNIVERSAL: Tuple[DataTypes, ...] = (
778 DataTypes.OCTET_STREAM,
782BINARY_TYPES_NEED_CONVERTING: Tuple[DataTypes, ...] = ()
783BINARY_TYPES_HEAVY: Tuple[DataTypes, ...] = ()
784BINARY_CONVERSION_TARGET: Dict[DataTypes, DataTypes] = {}
787BASE_TYPES_UNIVERSAL: Tuple[DataTypes, ...] = (
793BASE_TYPES_NEED_CONVERTING: Tuple[DataTypes, ...] = ()
794BASE_TYPES_HEAVY: Tuple[DataTypes, ...] = ()
795BASE_TYPES_CONVERSION_TARGET: Dict[DataTypes, DataTypes] = {}
800CONVERSION_TARGETS: Dict[DataTypes, DataTypes] = {}
802 IMAGE_CONVERSION_TARGET, VIDEO_CONVERSION_TARGET,
803 AUDIO_CONVERSION_TARGET, DOCUMENT_CONVERSION_TARGET,
804 ARCHIVE_CONVERSION_TARGET, FONT_CONVERSION_TARGET,
805 BINARY_CONVERSION_TARGET, BASE_TYPES_CONVERSION_TARGET
807 CONVERSION_TARGETS.update(d)
814@dataclass(frozen=True)
816 """Registry of media type groupings and conversion targets."""
818 image_universal: Tuple[DataTypes, ...]
819 image_needs_converting: Tuple[DataTypes, ...]
820 image_heavy: Tuple[DataTypes, ...]
821 image_conversion_targets: Dict[DataTypes, DataTypes]
824 video_universal: Tuple[DataTypes, ...]
825 video_needs_converting: Tuple[DataTypes, ...]
826 video_heavy: Tuple[DataTypes, ...]
827 video_conversion_targets: Dict[DataTypes, DataTypes]
830 audio_universal: Tuple[DataTypes, ...]
831 audio_needs_converting: Tuple[DataTypes, ...]
832 audio_heavy: Tuple[DataTypes, ...]
833 audio_conversion_targets: Dict[DataTypes, DataTypes]
836 document_universal: Tuple[DataTypes, ...]
837 document_needs_converting: Tuple[DataTypes, ...]
838 document_heavy: Tuple[DataTypes, ...]
839 document_conversion_targets: Dict[DataTypes, DataTypes]
842 archive_universal: Tuple[DataTypes, ...]
843 archive_needs_converting: Tuple[DataTypes, ...]
844 archive_heavy: Tuple[DataTypes, ...]
845 archive_conversion_targets: Dict[DataTypes, DataTypes]
848 font_universal: Tuple[DataTypes, ...]
849 font_needs_converting: Tuple[DataTypes, ...]
850 font_heavy: Tuple[DataTypes, ...]
851 font_conversion_targets: Dict[DataTypes, DataTypes]
854 binary_universal: Tuple[DataTypes, ...]
855 binary_needs_converting: Tuple[DataTypes, ...]
856 binary_heavy: Tuple[DataTypes, ...]
857 binary_conversion_targets: Dict[DataTypes, DataTypes]
860 base_types_universal: Tuple[DataTypes, ...]
861 base_types_need_converting: Tuple[DataTypes, ...]
862 base_types_heavy: Tuple[DataTypes, ...]
863 base_types_conversion_targets: Dict[DataTypes, DataTypes]
866 conversion_targets: Dict[DataTypes, DataTypes]
869 """Check if the given MIME type is an image.
871 mime (DataTypes): The MIME type to check.
873 bool: True if it's an image, False otherwise.
878 """Check if the given MIME type is a video.
880 mime (DataTypes): The MIME type to check.
882 bool: True if it's a video, False otherwise.
887 """Check if the given MIME type is an audio.
889 mime (DataTypes): The MIME type to check.
891 bool: True if it's an audio, False otherwise.
896 """Check if the given MIME type is a document.
898 mime (DataTypes): The MIME type to check.
900 bool: True if it's a document, False otherwise.
905 """Check if the given MIME type is an archive.
907 mime (DataTypes): The MIME type to check.
909 bool: True if it's an archive, False otherwise.
914 """Check if the given MIME type is a font.
916 mime (DataTypes): The MIME type to check.
918 bool: True if it's a font, False otherwise.
923 """Check if the given MIME type is a binary stream.
925 mime (DataTypes): The MIME type to check.
927 bool: True if it's a binary stream, False otherwise.
932 """Check if the given MIME type is a base (universal) type.
934 mime (DataTypes): The MIME type to check.
936 bool: True if it's a base type, False otherwise.
941 """Check if the given MIME type is considered heavy.
943 mime (DataTypes): The MIME type to check.
945 bool: True if it's heavy, False otherwise.
958 """Check if the given MIME type is supported in any category.
960 mime (DataTypes): The MIME type to check.
962 bool: True if supported, False otherwise.
975 """Check if the given MIME type requires conversion.
977 mime (DataTypes): The MIME type to check.
979 bool: True if conversion is needed, False otherwise.
981 return mime
in MEDIA_TYPES.conversion_targets
984 """Get the conversion target MIME type for the given MIME type.
986 mime (DataTypes): The MIME type to check.
988 Optional[DataTypes]: The target MIME type if conversion is needed, None otherwise.
990 return MEDIA_TYPES.conversion_targets.get(mime)
994 image_universal=IMAGE_TYPES_UNIVERSAL,
995 image_needs_converting=IMAGE_TYPES_NEED_CONVERTING,
996 image_heavy=IMAGE_TYPES_HEAVY,
997 image_conversion_targets=IMAGE_CONVERSION_TARGET,
999 video_universal=VIDEO_TYPES_UNIVERSAL,
1000 video_needs_converting=VIDEO_TYPES_NEED_CONVERTING,
1001 video_heavy=VIDEO_TYPES_HEAVY,
1002 video_conversion_targets=VIDEO_CONVERSION_TARGET,
1004 audio_universal=AUDIO_TYPES_UNIVERSAL,
1005 audio_needs_converting=AUDIO_TYPES_NEED_CONVERTING,
1006 audio_heavy=AUDIO_TYPES_HEAVY,
1007 audio_conversion_targets=AUDIO_CONVERSION_TARGET,
1009 document_universal=DOCUMENT_TYPES_UNIVERSAL,
1010 document_needs_converting=DOCUMENT_TYPES_NEED_CONVERTING,
1011 document_heavy=DOCUMENT_TYPES_HEAVY,
1012 document_conversion_targets=DOCUMENT_CONVERSION_TARGET,
1014 archive_universal=ARCHIVE_TYPES_UNIVERSAL,
1015 archive_needs_converting=ARCHIVE_TYPES_NEED_CONVERTING,
1016 archive_heavy=ARCHIVE_TYPES_HEAVY,
1017 archive_conversion_targets=ARCHIVE_CONVERSION_TARGET,
1019 font_universal=FONT_TYPES_UNIVERSAL,
1020 font_needs_converting=FONT_TYPES_NEED_CONVERTING,
1021 font_heavy=FONT_TYPES_HEAVY,
1022 font_conversion_targets=FONT_CONVERSION_TARGET,
1024 binary_universal=BINARY_TYPES_UNIVERSAL,
1025 binary_needs_converting=BINARY_TYPES_NEED_CONVERTING,
1026 binary_heavy=BINARY_TYPES_HEAVY,
1027 binary_conversion_targets=BINARY_CONVERSION_TARGET,
1029 base_types_universal=BASE_TYPES_UNIVERSAL,
1030 base_types_need_converting=BASE_TYPES_NEED_CONVERTING,
1031 base_types_heavy=BASE_TYPES_HEAVY,
1032 base_types_conversion_targets=BASE_TYPES_CONVERSION_TARGET,
1034 conversion_targets=CONVERSION_TARGETS,
Dict[str, str] get_dict(cls)
dict _value_to_member_cache
str _normalize_key(str name)
Optional[ 'DataTypes'] from_key(cls, str key)
Set[str] _build_mime_set(Tuple[DataTypes,...] group)