Skip to content

Commit faba42b

Browse files
authored
Merge branch 'master' into master
2 parents c118951 + 2693839 commit faba42b

File tree

12 files changed

+299
-211
lines changed

12 files changed

+299
-211
lines changed

.gitignore

Lines changed: 7 additions & 186 deletions
Original file line numberDiff line numberDiff line change
@@ -1,205 +1,26 @@
1-
# https://raw.githubusercontent.com/github/gitignore/master/Global/Archives.gitignore
2-
3-
# It's better to unpack these files and commit the raw source because
4-
# git has its own built in compression methods.
5-
*.7z
6-
*.jar
7-
*.rar
8-
*.zip
9-
*.gz
10-
*.tgz
11-
*.bzip
12-
*.bz2
13-
*.xz
14-
*.lzma
15-
*.cab
16-
17-
# Packing-only formats
18-
*.iso
19-
*.tar
20-
21-
# Package management formats
22-
*.dmg
23-
*.xpi
24-
*.gem
25-
*.egg
26-
*.deb
27-
*.rpm
28-
*.msi
29-
*.msm
30-
*.msp
31-
32-
33-
# https://raw.githubusercontent.com/github/gitignore/master/Global/Linux.gitignore
34-
35-
*~
36-
37-
# Temporary files which can be created if a process still has a handle open of a deleted file
38-
.fuse_hidden*
39-
40-
# KDE directory preferences
41-
.directory
42-
43-
# Linux trash folder which might appear on any partition or disk
44-
.Trash-*
45-
46-
# .nfs files are created when an open file is removed but is still being accessed
47-
.nfs*
48-
49-
50-
# https://raw.githubusercontent.com/github/gitignore/master/Global/Windows.gitignore
51-
52-
# Windows thumbnail cache files
53-
Thumbs.db
54-
ehthumbs.db
55-
ehthumbs_vista.db
56-
57-
# Dump file
58-
*.stackdump
59-
60-
# Folder config file
61-
Desktop.ini
62-
63-
# Recycle Bin used on file shares
64-
$RECYCLE.BIN/
65-
66-
# Windows Installer files
67-
*.cab
68-
*.msi
69-
*.msm
70-
*.msp
71-
72-
# Windows shortcuts
73-
*.lnk
74-
75-
76-
# https://raw.githubusercontent.com/github/gitignore/master/Global/macOS.gitignore
77-
78-
*.DS_Store
79-
.AppleDouble
80-
.LSOverride
81-
82-
# Icon must end with two \r
83-
Icon
84-
85-
# Thumbnails
86-
._*
87-
88-
# Files that might appear in the root of a volume
89-
.DocumentRevisions-V100
90-
.fseventsd
91-
.Spotlight-V100
92-
.TemporaryItems
93-
.Trashes
94-
.VolumeIcon.icns
95-
.com.apple.timemachine.donotpresent
96-
97-
# Directories potentially created on remote AFP share
98-
.AppleDB
99-
.AppleDesktop
100-
Network Trash Folder
101-
Temporary Items
102-
.apdisk
103-
104-
105-
# https://raw.githubusercontent.com/github/gitignore/master/Python.gitignore
106-
1071
# Byte-compiled / optimized / DLL files
1082
__pycache__/
1093
*.py[cod]
1104
*$py.class
1115

112-
# C extensions
113-
*.so
6+
# Unit test / coverage reports
7+
htmlcov/
8+
.tox/
9+
.coverage
10+
.coverage.*
11+
.cache
11412

11513
# Distribution / packaging
11614
.Python
11715
build/
11816
develop-eggs/
11917
dist/
120-
downloads/
12118
eggs/
12219
.eggs/
123-
lib/
124-
lib64/
125-
parts/
12620
sdist/
12721
var/
12822
wheels/
12923
*.egg-info/
13024
.installed.cfg
13125
*.egg
132-
133-
# PyInstaller
134-
# Usually these files are written by a python script from a template
135-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
136-
*.manifest
137-
*.spec
138-
139-
# Installer logs
140-
pip-log.txt
141-
pip-delete-this-directory.txt
142-
143-
# Unit test / coverage reports
144-
htmlcov/
145-
.tox/
146-
.coverage
147-
.coverage.*
148-
.cache
149-
nosetests.xml
150-
coverage.xml
151-
*.cover
152-
.hypothesis/
153-
154-
# Translations
155-
*.mo
156-
*.pot
157-
158-
# Django stuff:
159-
*.log
160-
local_settings.py
161-
162-
# Flask stuff:
163-
instance/
164-
.webassets-cache
165-
166-
# Scrapy stuff:
167-
.scrapy
168-
169-
# Sphinx documentation
170-
docs/_build/
171-
172-
# PyBuilder
173-
target/
174-
175-
# Jupyter Notebook
176-
.ipynb_checkpoints
177-
178-
# pyenv
179-
.python-version
180-
181-
# celery beat schedule file
182-
celerybeat-schedule
183-
184-
# SageMath parsed files
185-
*.sage.py
186-
187-
# Environments
188-
.env
189-
.venv
190-
env/
191-
venv/
192-
ENV/
193-
194-
# Spyder project settings
195-
.spyderproject
196-
.spyproject
197-
198-
# Rope project settings
199-
.ropeproject
200-
201-
# mkdocs documentation
202-
/site
203-
204-
# mypy
205-
.mypy_cache/
26+
docs/

.travis.yml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,27 @@ language: python
22

33
dist: xenial
44

5-
python:
6-
- 2.7
7-
- 3.5
8-
- 3.6
9-
- 3.7
10-
- 3.8
5+
jobs:
6+
include:
7+
- python: 2.7
8+
env: TOXENV=py27
9+
- python: 3.5
10+
env: TOXENV=py35
11+
- python: 3.6
12+
env: TOXENV=py36
13+
- python: 3.7
14+
env: TOXENV=py37
15+
- python: 3.8
16+
env: TOXENV=py3
17+
- python: 3.9
18+
env: TOXENV=py39
19+
- env: TOXENV=lint
1120

1221
install:
13-
- pip install coveralls
14-
- pip install -r requirements-dev.txt
22+
- pip install tox coveralls
1523

1624
script:
17-
- make lint
18-
- make test
25+
- tox
1926

2027
after_success:
21-
coveralls
28+
coveralls

README.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ Supported types
6262
Image
6363
^^^^^
6464

65+
- **dwg** - ``image/vnd.dwg``
66+
- **xcf** - ``image/x-xcf``
6567
- **jpg** - ``image/jpeg``
6668
- **jpx** - ``image/jpx``
6769
- **png** - ``image/png``
@@ -78,6 +80,7 @@ Image
7880
Video
7981
^^^^^
8082

83+
- **3gp** - ``video/3gpp``
8184
- **mp4** - ``video/mp4``
8285
- **m4v** - ``video/x-m4v``
8386
- **mkv** - ``video/x-matroska``
@@ -91,6 +94,7 @@ Video
9194
Audio
9295
^^^^^
9396

97+
- **aac** - ``audio/aac``
9498
- **mid** - ``audio/midi``
9599
- **mp3** - ``audio/mpeg``
96100
- **m4a** - ``audio/m4a``
@@ -102,6 +106,9 @@ Audio
102106
Archive
103107
^^^^^^^
104108

109+
- **br** - ``application/x-brotli``
110+
- **rpm** - ``application/x-rpm``
111+
- **dcm** - ``application/dicom``
105112
- **epub** - ``application/epub+zip``
106113
- **zip** - ``application/zip``
107114
- **tar** - ``application/x-tar``
@@ -124,7 +131,9 @@ Archive
124131
- **deb** - ``application/x-deb``
125132
- **ar** - ``application/x-unix-archive``
126133
- **Z** - ``application/x-compress``
134+
- **lzo** - ``application/x-lzop``
127135
- **lz** - ``application/x-lzip``
136+
- **lz4** - ``application/x-lz4``
128137

129138
Font
130139
^^^^
@@ -134,6 +143,11 @@ Font
134143
- **ttf** - ``application/font-sfnt``
135144
- **otf** - ``application/font-sfnt``
136145

146+
Application
147+
^^^^
148+
149+
- **wasm** - ``application/wasm``
150+
137151
.. _Python: http://python.org
138152
.. _magic numbers: https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files
139153
.. _filetype: https://github.com/h2non/filetype

filetype/match.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from .types import ARCHIVE as archive_matchers
66
from .types import AUDIO as audio_matchers
7+
from .types import APPLICATION as application_matchers
78
from .types import FONT as font_matchers
89
from .types import IMAGE as image_matchers
910
from .types import VIDEO as video_matchers
@@ -117,3 +118,20 @@ def archive_match(obj):
117118
TypeError: if obj is not a supported type.
118119
"""
119120
return match(obj, archive_matchers)
121+
122+
123+
def application_match(obj):
124+
"""
125+
Matches the given input againts the available
126+
application type matchers.
127+
128+
Args:
129+
obj: path to file, bytes or bytearray.
130+
131+
Returns:
132+
Type instance if matches. Otherwise None.
133+
134+
Raises:
135+
TypeError: if obj is not a supported type.
136+
"""
137+
return match(obj, application_matchers)

0 commit comments

Comments
 (0)