Add file classification package

This commit is contained in:
Chris Kuehl 2015-08-10 17:32:18 -07:00 committed by Chris Kuehl
parent b1e6063e12
commit 464ac233dd
7 changed files with 324 additions and 0 deletions

View file

@ -0,0 +1,28 @@
"""List of known filename to file type mappings.
The list consists of tuples of (filename regex, list of types).
Most of these are extensions (e.g. *.py -> python), but some just use the
filename (e.g. Makefile -> make).
"""
KNOWN_EXTENSIONS = [
(r'\.js$', ['javascript']),
(r'\.json$', ['json']),
(r'\.py$', ['python']),
(r'\.rb$', ['ruby']),
(r'\.sh$', ['shell']),
(r'\.e?ya?ml$', ['yaml']),
(r'\.pp$', ['puppet']),
(r'\.erb$', ['erb']),
(r'\.json$', ['json']),
(r'\.xml$', ['xml']),
(r'\.c$', ['c']),
(r'^Makefile$', ['make']),
(r'\.mk$', ['make']),
(r'\.png$', ['png']),
(r'\.gif$', ['gif']),
(r'\.svg$', ['svg']),
(r'\.css$', ['css']),
(r'\.html?$', ['html']),
(r'\.php\d?$', ['php']),
]