MeUtils 2025.3.3.18.41.24__py3-none-any.whl → 2025.3.5.19.55.22__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {MeUtils-2025.3.3.18.41.24.dist-info → MeUtils-2025.3.5.19.55.22.dist-info}/METADATA +264 -264
- {MeUtils-2025.3.3.18.41.24.dist-info → MeUtils-2025.3.5.19.55.22.dist-info}/RECORD +61 -33
- examples/_openaisdk/open_router.py +2 -1
- examples/_openaisdk/openai_files.py +16 -5
- examples/_openaisdk/openai_images.py +1 -0
- examples/_openaisdk/openai_moon.py +22 -19
- examples/sh/__init__.py +11 -0
- meutils/apis/baidu/bdaitpzs.py +9 -17
- meutils/apis/chatglm/glm_video_api.py +2 -2
- meutils/apis/images/edits.py +7 -2
- meutils/apis/jimeng/common.py +1 -1
- meutils/apis/oneapi/common.py +4 -4
- meutils/apis/proxy/ips.py +2 -0
- meutils/caches/common.py +4 -0
- meutils/data/VERSION +1 -1
- meutils/data/oneapi/NOTICE.html +12 -0
- meutils/data/oneapi/__init__.py +1 -1
- meutils/data/oneapi/index.html +275 -0
- meutils/io/_openai_files.py +31 -0
- meutils/io/openai_files.py +138 -0
- meutils/io/parsers/__init__.py +10 -0
- meutils/io/parsers/fileparser/PDF/346/212/275/345/217/226.py +58 -0
- meutils/io/parsers/fileparser/__init__.py +11 -0
- meutils/io/parsers/fileparser/common.py +91 -0
- meutils/io/parsers/fileparser/demo.py +41 -0
- meutils/io/parsers/fileparser/filetype/__init__.py +10 -0
- meutils/io/parsers/fileparser/filetype/__main__.py +37 -0
- meutils/io/parsers/fileparser/filetype/filetype.py +98 -0
- meutils/io/parsers/fileparser/filetype/helpers.py +140 -0
- meutils/io/parsers/fileparser/filetype/match.py +155 -0
- meutils/io/parsers/fileparser/filetype/types/__init__.py +118 -0
- meutils/io/parsers/fileparser/filetype/types/application.py +22 -0
- meutils/io/parsers/fileparser/filetype/types/archive.py +687 -0
- meutils/io/parsers/fileparser/filetype/types/audio.py +212 -0
- meutils/io/parsers/fileparser/filetype/types/base.py +29 -0
- meutils/io/parsers/fileparser/filetype/types/document.py +256 -0
- meutils/io/parsers/fileparser/filetype/types/font.py +115 -0
- meutils/io/parsers/fileparser/filetype/types/image.py +383 -0
- meutils/io/parsers/fileparser/filetype/types/isobmff.py +33 -0
- meutils/io/parsers/fileparser/filetype/types/video.py +223 -0
- meutils/io/parsers/fileparser/filetype/utils.py +84 -0
- meutils/io/parsers/fileparser/filetype.py +41 -0
- meutils/io/parsers/fileparser/mineru.py +48 -0
- meutils/io/parsers/fileparser/pdf.py +30 -0
- meutils/io/parsers/fileparser//350/241/250/346/240/274/346/212/275/345/217/226.py +118 -0
- meutils/llm/check_utils.py +33 -2
- meutils/llm/clients.py +1 -0
- meutils/llm/completions/chat_gemini.py +72 -0
- meutils/llm/completions/chat_plus.py +78 -0
- meutils/llm/completions/{agents/file.py → chat_spark.py} +46 -26
- meutils/llm/completions/qwenllm.py +57 -16
- meutils/llm/completions/yuanbao.py +29 -3
- meutils/llm/openai_utils/common.py +2 -2
- meutils/schemas/oneapi/common.py +22 -19
- meutils/schemas/openai_types.py +65 -29
- meutils/schemas/yuanbao_types.py +6 -7
- meutils/types.py +2 -0
- meutils/data/oneapi/NOTICE.md +0 -1
- meutils/data/oneapi/_NOTICE.md +0 -140
- meutils/llm/completions/gemini.py +0 -69
- {MeUtils-2025.3.3.18.41.24.dist-info → MeUtils-2025.3.5.19.55.22.dist-info}/LICENSE +0 -0
- {MeUtils-2025.3.3.18.41.24.dist-info → MeUtils-2025.3.5.19.55.22.dist-info}/WHEEL +0 -0
- {MeUtils-2025.3.3.18.41.24.dist-info → MeUtils-2025.3.5.19.55.22.dist-info}/entry_points.txt +0 -0
- {MeUtils-2025.3.3.18.41.24.dist-info → MeUtils-2025.3.5.19.55.22.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
import sys
|
2
|
+
|
3
|
+
import filetype
|
4
|
+
|
5
|
+
|
6
|
+
def guess(path):
|
7
|
+
kind = filetype.guess(path)
|
8
|
+
if kind is None:
|
9
|
+
print('{}: File type determination failure.'.format(path))
|
10
|
+
else:
|
11
|
+
print('{}: {} ({})'.format(path, kind.extension, kind.mime))
|
12
|
+
|
13
|
+
|
14
|
+
def main():
|
15
|
+
import argparse
|
16
|
+
|
17
|
+
parser = argparse.ArgumentParser(
|
18
|
+
prog='filetype', description='Determine type of FILEs.'
|
19
|
+
)
|
20
|
+
parser.add_argument('-f', '--file', nargs='+')
|
21
|
+
parser.add_argument(
|
22
|
+
'-v', '--version', action='version',
|
23
|
+
version='%(prog)s ' + filetype.version,
|
24
|
+
help='output version information and exit'
|
25
|
+
)
|
26
|
+
|
27
|
+
args = parser.parse_args()
|
28
|
+
if len(sys.argv) < 2:
|
29
|
+
parser.print_help()
|
30
|
+
sys.exit(1)
|
31
|
+
|
32
|
+
for i in args.file:
|
33
|
+
guess(i)
|
34
|
+
|
35
|
+
|
36
|
+
if __name__ == '__main__':
|
37
|
+
main()
|
@@ -0,0 +1,98 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
from __future__ import absolute_import
|
4
|
+
|
5
|
+
from .match import match
|
6
|
+
from .types import TYPES, Type
|
7
|
+
|
8
|
+
# Expose supported matchers types
|
9
|
+
types = TYPES
|
10
|
+
|
11
|
+
|
12
|
+
def guess(obj):
|
13
|
+
"""
|
14
|
+
Infers the type of the given input.
|
15
|
+
|
16
|
+
Function is overloaded to accept multiple types in input
|
17
|
+
and peform the needed type inference based on it.
|
18
|
+
|
19
|
+
Args:
|
20
|
+
obj: path to file, bytes or bytearray.
|
21
|
+
|
22
|
+
Returns:
|
23
|
+
The matched type instance. Otherwise None.
|
24
|
+
|
25
|
+
Raises:
|
26
|
+
TypeError: if obj is not a supported type.
|
27
|
+
"""
|
28
|
+
return match(obj) if obj else None
|
29
|
+
|
30
|
+
|
31
|
+
def guess_mime(obj):
|
32
|
+
"""
|
33
|
+
Infers the file type of the given input
|
34
|
+
and returns its MIME type.
|
35
|
+
|
36
|
+
Args:
|
37
|
+
obj: path to file, bytes or bytearray.
|
38
|
+
|
39
|
+
Returns:
|
40
|
+
The matched MIME type as string. Otherwise None.
|
41
|
+
|
42
|
+
Raises:
|
43
|
+
TypeError: if obj is not a supported type.
|
44
|
+
"""
|
45
|
+
kind = guess(obj)
|
46
|
+
return kind.mime if kind else kind
|
47
|
+
|
48
|
+
|
49
|
+
def guess_extension(obj):
|
50
|
+
"""
|
51
|
+
Infers the file type of the given input
|
52
|
+
and returns its RFC file extension.
|
53
|
+
|
54
|
+
Args:
|
55
|
+
obj: path to file, bytes or bytearray.
|
56
|
+
|
57
|
+
Returns:
|
58
|
+
The matched file extension as string. Otherwise None.
|
59
|
+
|
60
|
+
Raises:
|
61
|
+
TypeError: if obj is not a supported type.
|
62
|
+
"""
|
63
|
+
kind = guess(obj)
|
64
|
+
return kind.extension if kind else kind
|
65
|
+
|
66
|
+
|
67
|
+
def get_type(mime=None, ext=None):
|
68
|
+
"""
|
69
|
+
Returns the file type instance searching by
|
70
|
+
MIME type or file extension.
|
71
|
+
|
72
|
+
Args:
|
73
|
+
ext: file extension string. E.g: jpg, png, mp4, mp3
|
74
|
+
mime: MIME string. E.g: image/jpeg, video/mpeg
|
75
|
+
|
76
|
+
Returns:
|
77
|
+
The matched file type instance. Otherwise None.
|
78
|
+
"""
|
79
|
+
for kind in types:
|
80
|
+
if kind.extension == ext or kind.mime == mime:
|
81
|
+
return kind
|
82
|
+
return None
|
83
|
+
|
84
|
+
|
85
|
+
def add_type(instance):
|
86
|
+
"""
|
87
|
+
Adds a new type matcher instance to the supported types.
|
88
|
+
|
89
|
+
Args:
|
90
|
+
instance: Type inherited instance.
|
91
|
+
|
92
|
+
Returns:
|
93
|
+
None
|
94
|
+
"""
|
95
|
+
if not isinstance(instance, Type):
|
96
|
+
raise TypeError('instance must inherit from filetype.types.Type')
|
97
|
+
|
98
|
+
types.insert(0, instance)
|
@@ -0,0 +1,140 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
from __future__ import absolute_import
|
4
|
+
from .types import TYPES
|
5
|
+
from .match import (
|
6
|
+
image_match, font_match, document_match,
|
7
|
+
video_match, audio_match, archive_match
|
8
|
+
)
|
9
|
+
|
10
|
+
|
11
|
+
def is_extension_supported(ext):
|
12
|
+
"""
|
13
|
+
Checks if the given extension string is
|
14
|
+
one of the supported by the file matchers.
|
15
|
+
|
16
|
+
Args:
|
17
|
+
ext (str): file extension string. E.g: jpg, png, mp4, mp3
|
18
|
+
|
19
|
+
Returns:
|
20
|
+
True if the file extension is supported.
|
21
|
+
Otherwise False.
|
22
|
+
"""
|
23
|
+
for kind in TYPES:
|
24
|
+
if kind.extension == ext:
|
25
|
+
return True
|
26
|
+
return False
|
27
|
+
|
28
|
+
|
29
|
+
def is_mime_supported(mime):
|
30
|
+
"""
|
31
|
+
Checks if the given MIME type string is
|
32
|
+
one of the supported by the file matchers.
|
33
|
+
|
34
|
+
Args:
|
35
|
+
mime (str): MIME string. E.g: image/jpeg, video/mpeg
|
36
|
+
|
37
|
+
Returns:
|
38
|
+
True if the MIME type is supported.
|
39
|
+
Otherwise False.
|
40
|
+
"""
|
41
|
+
for kind in TYPES:
|
42
|
+
if kind.mime == mime:
|
43
|
+
return True
|
44
|
+
return False
|
45
|
+
|
46
|
+
|
47
|
+
def is_image(obj):
|
48
|
+
"""
|
49
|
+
Checks if a given input is a supported type image.
|
50
|
+
|
51
|
+
Args:
|
52
|
+
obj: path to file, bytes or bytearray.
|
53
|
+
|
54
|
+
Returns:
|
55
|
+
True if obj is a valid image. Otherwise False.
|
56
|
+
|
57
|
+
Raises:
|
58
|
+
TypeError: if obj is not a supported type.
|
59
|
+
"""
|
60
|
+
return image_match(obj) is not None
|
61
|
+
|
62
|
+
|
63
|
+
def is_archive(obj):
|
64
|
+
"""
|
65
|
+
Checks if a given input is a supported type archive.
|
66
|
+
|
67
|
+
Args:
|
68
|
+
obj: path to file, bytes or bytearray.
|
69
|
+
|
70
|
+
Returns:
|
71
|
+
True if obj is a valid archive. Otherwise False.
|
72
|
+
|
73
|
+
Raises:
|
74
|
+
TypeError: if obj is not a supported type.
|
75
|
+
"""
|
76
|
+
return archive_match(obj) is not None
|
77
|
+
|
78
|
+
|
79
|
+
def is_audio(obj):
|
80
|
+
"""
|
81
|
+
Checks if a given input is a supported type audio.
|
82
|
+
|
83
|
+
Args:
|
84
|
+
obj: path to file, bytes or bytearray.
|
85
|
+
|
86
|
+
Returns:
|
87
|
+
True if obj is a valid audio. Otherwise False.
|
88
|
+
|
89
|
+
Raises:
|
90
|
+
TypeError: if obj is not a supported type.
|
91
|
+
"""
|
92
|
+
return audio_match(obj) is not None
|
93
|
+
|
94
|
+
|
95
|
+
def is_video(obj):
|
96
|
+
"""
|
97
|
+
Checks if a given input is a supported type video.
|
98
|
+
|
99
|
+
Args:
|
100
|
+
obj: path to file, bytes or bytearray.
|
101
|
+
|
102
|
+
Returns:
|
103
|
+
True if obj is a valid video. Otherwise False.
|
104
|
+
|
105
|
+
Raises:
|
106
|
+
TypeError: if obj is not a supported type.
|
107
|
+
"""
|
108
|
+
return video_match(obj) is not None
|
109
|
+
|
110
|
+
|
111
|
+
def is_font(obj):
|
112
|
+
"""
|
113
|
+
Checks if a given input is a supported type font.
|
114
|
+
|
115
|
+
Args:
|
116
|
+
obj: path to file, bytes or bytearray.
|
117
|
+
|
118
|
+
Returns:
|
119
|
+
True if obj is a valid font. Otherwise False.
|
120
|
+
|
121
|
+
Raises:
|
122
|
+
TypeError: if obj is not a supported type.
|
123
|
+
"""
|
124
|
+
return font_match(obj) is not None
|
125
|
+
|
126
|
+
|
127
|
+
def is_document(obj):
|
128
|
+
"""
|
129
|
+
Checks if a given input is a supported type document.
|
130
|
+
|
131
|
+
Args:
|
132
|
+
obj: path to file, bytes or bytearray.
|
133
|
+
|
134
|
+
Returns:
|
135
|
+
True if obj is a valid document. Otherwise False.
|
136
|
+
|
137
|
+
Raises:
|
138
|
+
TypeError: if obj is not a supported type.
|
139
|
+
"""
|
140
|
+
return document_match(obj) is not None
|
@@ -0,0 +1,155 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
from __future__ import absolute_import
|
4
|
+
|
5
|
+
from .types import ARCHIVE as archive_matchers
|
6
|
+
from .types import AUDIO as audio_matchers
|
7
|
+
from .types import APPLICATION as application_matchers
|
8
|
+
from .types import DOCUMENT as document_matchers
|
9
|
+
from .types import FONT as font_matchers
|
10
|
+
from .types import IMAGE as image_matchers
|
11
|
+
from .types import VIDEO as video_matchers
|
12
|
+
from .types import TYPES
|
13
|
+
from .utils import get_bytes
|
14
|
+
|
15
|
+
|
16
|
+
def match(obj, matchers=TYPES):
|
17
|
+
"""
|
18
|
+
Matches the given input against the available
|
19
|
+
file type matchers.
|
20
|
+
|
21
|
+
Args:
|
22
|
+
obj: path to file, bytes or bytearray.
|
23
|
+
|
24
|
+
Returns:
|
25
|
+
Type instance if type matches. Otherwise None.
|
26
|
+
|
27
|
+
Raises:
|
28
|
+
TypeError: if obj is not a supported type.
|
29
|
+
"""
|
30
|
+
buf = get_bytes(obj)
|
31
|
+
|
32
|
+
for matcher in matchers:
|
33
|
+
if matcher.match(buf):
|
34
|
+
return matcher
|
35
|
+
|
36
|
+
return None
|
37
|
+
|
38
|
+
|
39
|
+
def image_match(obj):
|
40
|
+
"""
|
41
|
+
Matches the given input against the available
|
42
|
+
image type matchers.
|
43
|
+
|
44
|
+
Args:
|
45
|
+
obj: path to file, bytes or bytearray.
|
46
|
+
|
47
|
+
Returns:
|
48
|
+
Type instance if matches. Otherwise None.
|
49
|
+
|
50
|
+
Raises:
|
51
|
+
TypeError: if obj is not a supported type.
|
52
|
+
"""
|
53
|
+
return match(obj, image_matchers)
|
54
|
+
|
55
|
+
|
56
|
+
def font_match(obj):
|
57
|
+
"""
|
58
|
+
Matches the given input against the available
|
59
|
+
font type matchers.
|
60
|
+
|
61
|
+
Args:
|
62
|
+
obj: path to file, bytes or bytearray.
|
63
|
+
|
64
|
+
Returns:
|
65
|
+
Type instance if matches. Otherwise None.
|
66
|
+
|
67
|
+
Raises:
|
68
|
+
TypeError: if obj is not a supported type.
|
69
|
+
"""
|
70
|
+
return match(obj, font_matchers)
|
71
|
+
|
72
|
+
|
73
|
+
def video_match(obj):
|
74
|
+
"""
|
75
|
+
Matches the given input against the available
|
76
|
+
video type matchers.
|
77
|
+
|
78
|
+
Args:
|
79
|
+
obj: path to file, bytes or bytearray.
|
80
|
+
|
81
|
+
Returns:
|
82
|
+
Type instance if matches. Otherwise None.
|
83
|
+
|
84
|
+
Raises:
|
85
|
+
TypeError: if obj is not a supported type.
|
86
|
+
"""
|
87
|
+
return match(obj, video_matchers)
|
88
|
+
|
89
|
+
|
90
|
+
def audio_match(obj):
|
91
|
+
"""
|
92
|
+
Matches the given input against the available
|
93
|
+
autio type matchers.
|
94
|
+
|
95
|
+
Args:
|
96
|
+
obj: path to file, bytes or bytearray.
|
97
|
+
|
98
|
+
Returns:
|
99
|
+
Type instance if matches. Otherwise None.
|
100
|
+
|
101
|
+
Raises:
|
102
|
+
TypeError: if obj is not a supported type.
|
103
|
+
"""
|
104
|
+
return match(obj, audio_matchers)
|
105
|
+
|
106
|
+
|
107
|
+
def archive_match(obj):
|
108
|
+
"""
|
109
|
+
Matches the given input against the available
|
110
|
+
archive type matchers.
|
111
|
+
|
112
|
+
Args:
|
113
|
+
obj: path to file, bytes or bytearray.
|
114
|
+
|
115
|
+
Returns:
|
116
|
+
Type instance if matches. Otherwise None.
|
117
|
+
|
118
|
+
Raises:
|
119
|
+
TypeError: if obj is not a supported type.
|
120
|
+
"""
|
121
|
+
return match(obj, archive_matchers)
|
122
|
+
|
123
|
+
|
124
|
+
def application_match(obj):
|
125
|
+
"""
|
126
|
+
Matches the given input against the available
|
127
|
+
application type matchers.
|
128
|
+
|
129
|
+
Args:
|
130
|
+
obj: path to file, bytes or bytearray.
|
131
|
+
|
132
|
+
Returns:
|
133
|
+
Type instance if matches. Otherwise None.
|
134
|
+
|
135
|
+
Raises:
|
136
|
+
TypeError: if obj is not a supported type.
|
137
|
+
"""
|
138
|
+
return match(obj, application_matchers)
|
139
|
+
|
140
|
+
|
141
|
+
def document_match(obj):
|
142
|
+
"""
|
143
|
+
Matches the given input against the available
|
144
|
+
document type matchers.
|
145
|
+
|
146
|
+
Args:
|
147
|
+
obj: path to file, bytes or bytearray.
|
148
|
+
|
149
|
+
Returns:
|
150
|
+
Type instance if matches. Otherwise None.
|
151
|
+
|
152
|
+
Raises:
|
153
|
+
TypeError: if obj is not a supported type.
|
154
|
+
"""
|
155
|
+
return match(obj, document_matchers)
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
from __future__ import absolute_import
|
4
|
+
|
5
|
+
from . import archive
|
6
|
+
from . import audio
|
7
|
+
from . import application
|
8
|
+
from . import document
|
9
|
+
from . import font
|
10
|
+
from . import image
|
11
|
+
from . import video
|
12
|
+
from .base import Type # noqa
|
13
|
+
|
14
|
+
# Supported image types
|
15
|
+
IMAGE = (
|
16
|
+
image.Dwg(),
|
17
|
+
image.Xcf(),
|
18
|
+
image.Jpeg(),
|
19
|
+
image.Jpx(),
|
20
|
+
image.Apng(),
|
21
|
+
image.Png(),
|
22
|
+
image.Gif(),
|
23
|
+
image.Webp(),
|
24
|
+
image.Tiff(),
|
25
|
+
image.Cr2(),
|
26
|
+
image.Bmp(),
|
27
|
+
image.Jxr(),
|
28
|
+
image.Psd(),
|
29
|
+
image.Ico(),
|
30
|
+
image.Heic(),
|
31
|
+
image.Dcm(),
|
32
|
+
image.Avif(),
|
33
|
+
)
|
34
|
+
|
35
|
+
# Supported video types
|
36
|
+
VIDEO = (
|
37
|
+
video.M3gp(),
|
38
|
+
video.Mp4(),
|
39
|
+
video.M4v(),
|
40
|
+
video.Mkv(),
|
41
|
+
video.Mov(),
|
42
|
+
video.Avi(),
|
43
|
+
video.Wmv(),
|
44
|
+
video.Mpeg(),
|
45
|
+
video.Webm(),
|
46
|
+
video.Flv(),
|
47
|
+
)
|
48
|
+
|
49
|
+
# Supported audio types
|
50
|
+
AUDIO = (
|
51
|
+
audio.Aac(),
|
52
|
+
audio.Midi(),
|
53
|
+
audio.Mp3(),
|
54
|
+
audio.M4a(),
|
55
|
+
audio.Ogg(),
|
56
|
+
audio.Flac(),
|
57
|
+
audio.Wav(),
|
58
|
+
audio.Amr(),
|
59
|
+
audio.Aiff(),
|
60
|
+
)
|
61
|
+
|
62
|
+
# Supported font types
|
63
|
+
FONT = (font.Woff(), font.Woff2(), font.Ttf(), font.Otf())
|
64
|
+
|
65
|
+
# Supported archive container types
|
66
|
+
ARCHIVE = (
|
67
|
+
archive.Br(),
|
68
|
+
archive.Rpm(),
|
69
|
+
archive.Dcm(),
|
70
|
+
archive.Epub(),
|
71
|
+
archive.Zip(),
|
72
|
+
archive.Tar(),
|
73
|
+
archive.Rar(),
|
74
|
+
archive.Gz(),
|
75
|
+
archive.Bz2(),
|
76
|
+
archive.SevenZ(),
|
77
|
+
archive.Pdf(),
|
78
|
+
archive.Exe(),
|
79
|
+
archive.Swf(),
|
80
|
+
archive.Rtf(),
|
81
|
+
archive.Nes(),
|
82
|
+
archive.Crx(),
|
83
|
+
archive.Cab(),
|
84
|
+
archive.Eot(),
|
85
|
+
archive.Ps(),
|
86
|
+
archive.Xz(),
|
87
|
+
archive.Sqlite(),
|
88
|
+
archive.Deb(),
|
89
|
+
archive.Ar(),
|
90
|
+
archive.Z(),
|
91
|
+
archive.Lzop(),
|
92
|
+
archive.Lz(),
|
93
|
+
archive.Elf(),
|
94
|
+
archive.Lz4(),
|
95
|
+
archive.Zstd(),
|
96
|
+
)
|
97
|
+
|
98
|
+
# Supported archive container types
|
99
|
+
APPLICATION = (
|
100
|
+
application.Wasm(),
|
101
|
+
)
|
102
|
+
|
103
|
+
# Supported document types
|
104
|
+
DOCUMENT = (
|
105
|
+
document.Doc(),
|
106
|
+
document.Docx(),
|
107
|
+
document.Odt(),
|
108
|
+
document.Xls(),
|
109
|
+
document.Xlsx(),
|
110
|
+
document.Ods(),
|
111
|
+
document.Ppt(),
|
112
|
+
document.Pptx(),
|
113
|
+
document.Odp(),
|
114
|
+
)
|
115
|
+
|
116
|
+
|
117
|
+
# Expose supported type matchers
|
118
|
+
TYPES = list(IMAGE + AUDIO + VIDEO + FONT + DOCUMENT + ARCHIVE + APPLICATION)
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
from __future__ import absolute_import
|
4
|
+
|
5
|
+
from .base import Type
|
6
|
+
|
7
|
+
|
8
|
+
class Wasm(Type):
|
9
|
+
"""Implements the Wasm image type matcher."""
|
10
|
+
|
11
|
+
MIME = 'application/wasm'
|
12
|
+
EXTENSION = 'wasm'
|
13
|
+
|
14
|
+
def __init__(self):
|
15
|
+
super(Wasm, self).__init__(
|
16
|
+
mime=Wasm.MIME,
|
17
|
+
extension=Wasm.EXTENSION
|
18
|
+
)
|
19
|
+
|
20
|
+
def match(self, buf):
|
21
|
+
return buf[:8] == bytearray([0x00, 0x61, 0x73, 0x6d,
|
22
|
+
0x01, 0x00, 0x00, 0x00])
|