xref: /freebsd/contrib/file/magic/Magdir/python (revision a0b956f5ac5e0941f9e74e24c1c53e05ad061a38)
1
2#------------------------------------------------------------------------------
3# $File: python,v 1.44 2021/10/20 11:15:35 christos Exp $
4# python:  file(1) magic for python
5#
6# Outlook puts """ too for urgent messages
7# From: David Necas <yeti@physics.muni.cz>
8# often the module starts with a multiline string
90	string/t	"""	Python script text executable
10# MAGIC as specified in Python/import.c (1.0 to 3.7)
11# and in Lib/importlib/_bootstrap_external.py (3.5+)
12# two bytes of magic followed by "\r\n" in little endian order
130	belong		0x02099900	python 1.0 byte-compiled
14!:mime application/x-bytecode.python
150	belong		0x03099900	python 1.1/1.2 byte-compiled
16!:mime application/x-bytecode.python
170	belong		0x892e0d0a	python 1.3 byte-compiled
18!:mime application/x-bytecode.python
190	belong		0x04170d0a	python 1.4 byte-compiled
20!:mime application/x-bytecode.python
210	belong		0x994e0d0a	python 1.5 byte-compiled
22!:mime application/x-bytecode.python
230	belong		0xfcc40d0a	python 1.6 byte-compiled
24!:mime application/x-bytecode.python
250	belong		0xfdc40d0a	python 1.6 byte-compiled
26!:mime application/x-bytecode.python
270	belong		0x87c60d0a	python 2.0 byte-compiled
28!:mime application/x-bytecode.python
290	belong		0x88c60d0a	python 2.0 byte-compiled
30!:mime application/x-bytecode.python
310	belong		0x2aeb0d0a	python 2.1 byte-compiled
32!:mime application/x-bytecode.python
330	belong		0x2beb0d0a	python 2.1 byte-compiled
34!:mime application/x-bytecode.python
350	belong		0x2ded0d0a	python 2.2 byte-compiled
36!:mime application/x-bytecode.python
370	belong		0x2eed0d0a	python 2.2 byte-compiled
38!:mime application/x-bytecode.python
390	belong		0x3bf20d0a	python 2.3 byte-compiled
40!:mime application/x-bytecode.python
410	belong		0x3cf20d0a	python 2.3 byte-compiled
42!:mime application/x-bytecode.python
430	belong		0x45f20d0a	python 2.3 byte-compiled
44!:mime application/x-bytecode.python
450	belong		0x59f20d0a	python 2.4 byte-compiled
46!:mime application/x-bytecode.python
470	belong		0x63f20d0a	python 2.4 byte-compiled
48!:mime application/x-bytecode.python
490	belong		0x6df20d0a	python 2.4 byte-compiled
50!:mime application/x-bytecode.python
510	belong		0x6ef20d0a	python 2.4 byte-compiled
52!:mime application/x-bytecode.python
530	belong		0x77f20d0a	python 2.5 byte-compiled
54!:mime application/x-bytecode.python
550	belong		0x81f20d0a	python 2.5 byte-compiled
56!:mime application/x-bytecode.python
570	belong		0x8bf20d0a	python 2.5 byte-compiled
58!:mime application/x-bytecode.python
590	belong		0x8cf20d0a	python 2.5 byte-compiled
60!:mime application/x-bytecode.python
610	belong		0x95f20d0a	python 2.5 byte-compiled
62!:mime application/x-bytecode.python
630	belong		0x9ff20d0a	python 2.5 byte-compiled
64!:mime application/x-bytecode.python
650	belong		0xa9f20d0a	python 2.5 byte-compiled
66!:mime application/x-bytecode.python
670	belong		0xb3f20d0a	python 2.5 byte-compiled
68!:mime application/x-bytecode.python
690	belong		0xb4f20d0a	python 2.5 byte-compiled
70!:mime application/x-bytecode.python
710	belong		0xc7f20d0a	python 2.6 byte-compiled
72!:mime application/x-bytecode.python
730	belong		0xd1f20d0a	python 2.6 byte-compiled
74!:mime application/x-bytecode.python
750	belong		0xd2f20d0a	python 2.6 byte-compiled
76!:mime application/x-bytecode.python
770	belong		0xdbf20d0a	python 2.7 byte-compiled
78!:mime application/x-bytecode.python
790	belong		0xe5f20d0a	python 2.7 byte-compiled
80!:mime application/x-bytecode.python
810	belong		0xeff20d0a	python 2.7 byte-compiled
82!:mime application/x-bytecode.python
830	belong		0xf9f20d0a	python 2.7 byte-compiled
84!:mime application/x-bytecode.python
850	belong		0x03f30d0a	python 2.7 byte-compiled
86!:mime application/x-bytecode.python
870	belong		0x04f30d0a	python 2.7 byte-compiled
88!:mime application/x-bytecode.python
890	belong		0xb80b0d0a	python 3.0 byte-compiled
90!:mime application/x-bytecode.python
910	belong		0xc20b0d0a	python 3.0 byte-compiled
92!:mime application/x-bytecode.python
930	belong		0xcc0b0d0a	python 3.0 byte-compiled
94!:mime application/x-bytecode.python
950	belong		0xd60b0d0a	python 3.0 byte-compiled
96!:mime application/x-bytecode.python
970	belong		0xe00b0d0a	python 3.0 byte-compiled
98!:mime application/x-bytecode.python
990	belong		0xea0b0d0a	python 3.0 byte-compiled
100!:mime application/x-bytecode.python
1010	belong		0xf40b0d0a	python 3.0 byte-compiled
102!:mime application/x-bytecode.python
1030	belong		0xf50b0d0a	python 3.0 byte-compiled
104!:mime application/x-bytecode.python
1050	belong		0xff0b0d0a	python 3.0 byte-compiled
106!:mime application/x-bytecode.python
1070	belong		0x090c0d0a	python 3.0 byte-compiled
108!:mime application/x-bytecode.python
1090	belong		0x130c0d0a	python 3.0 byte-compiled
110!:mime application/x-bytecode.python
1110	belong		0x1d0c0d0a	python 3.0 byte-compiled
112!:mime application/x-bytecode.python
1130	belong		0x1f0c0d0a	python 3.0 byte-compiled
114!:mime application/x-bytecode.python
1150	belong		0x270c0d0a	python 3.0 byte-compiled
116!:mime application/x-bytecode.python
1170	belong		0x3b0c0d0a	python 3.0 byte-compiled
118!:mime application/x-bytecode.python
1190	belong		0x450c0d0a	python 3.1 byte-compiled
120!:mime application/x-bytecode.python
1210	belong		0x4f0c0d0a	python 3.1 byte-compiled
122!:mime application/x-bytecode.python
1230	belong		0x580c0d0a	python 3.2 byte-compiled
124!:mime application/x-bytecode.python
1250	belong		0x620c0d0a	python 3.2 byte-compiled
126!:mime application/x-bytecode.python
1270	belong		0x6c0c0d0a	python 3.2 byte-compiled
128!:mime application/x-bytecode.python
1290	belong		0x760c0d0a	python 3.3 byte-compiled
130!:mime application/x-bytecode.python
1310	belong		0x800c0d0a	python 3.3 byte-compiled
132!:mime application/x-bytecode.python
1330	belong		0x8a0c0d0a	python 3.3 byte-compiled
134!:mime application/x-bytecode.python
1350	belong		0x940c0d0a	python 3.3 byte-compiled
136!:mime application/x-bytecode.python
1370	belong		0x9e0c0d0a	python 3.3 byte-compiled
138!:mime application/x-bytecode.python
1390	belong		0xb20c0d0a	python 3.4 byte-compiled
140!:mime application/x-bytecode.python
1410	belong		0xbc0c0d0a	python 3.4 byte-compiled
142!:mime application/x-bytecode.python
1430	belong		0xc60c0d0a	python 3.4 byte-compiled
144!:mime application/x-bytecode.python
1450	belong		0xd00c0d0a	python 3.4 byte-compiled
146!:mime application/x-bytecode.python
1470	belong		0xda0c0d0a	python 3.4 byte-compiled
148!:mime application/x-bytecode.python
1490	belong		0xe40c0d0a	python 3.4 byte-compiled
150!:mime application/x-bytecode.python
1510	belong		0xee0c0d0a	python 3.4 byte-compiled
152!:mime application/x-bytecode.python
1530	belong		0xf80c0d0a	python 3.5.1- byte-compiled
154!:mime application/x-bytecode.python
1550	belong		0x020d0d0a	python 3.5.1- byte-compiled
156!:mime application/x-bytecode.python
1570	belong		0x0c0d0d0a	python 3.5.1- byte-compiled
158!:mime application/x-bytecode.python
1590	belong		0x160d0d0a	python 3.5.1- byte-compiled
160!:mime application/x-bytecode.python
1610	belong		0x170d0d0a	python 3.5.2+ byte-compiled
162!:mime application/x-bytecode.python
1630	belong		0x200d0d0a	python 3.6 byte-compiled
164!:mime application/x-bytecode.python
1650	belong		0x210d0d0a	python 3.6 byte-compiled
166!:mime application/x-bytecode.python
1670	belong		0x2a0d0d0a	python 3.6 byte-compiled
168!:mime application/x-bytecode.python
1690	belong		0x2b0d0d0a	python 3.6 byte-compiled
170!:mime application/x-bytecode.python
1710	belong		0x2c0d0d0a	python 3.6 byte-compiled
172!:mime application/x-bytecode.python
1730	belong		0x2d0d0d0a	python 3.6 byte-compiled
174!:mime application/x-bytecode.python
1750	belong		0x2f0d0d0a	python 3.6 byte-compiled
176!:mime application/x-bytecode.python
1770	belong		0x300d0d0a	python 3.6 byte-compiled
178!:mime application/x-bytecode.python
1790	belong		0x310d0d0a	python 3.6 byte-compiled
180!:mime application/x-bytecode.python
1810	belong		0x320d0d0a	python 3.6 byte-compiled
182!:mime application/x-bytecode.python
1830	belong		0x330d0d0a	python 3.6 byte-compiled
184!:mime application/x-bytecode.python
1850	belong		0x3e0d0d0a	python 3.7 byte-compiled
186!:mime application/x-bytecode.python
1870	belong		0x3f0d0d0a	python 3.7 byte-compiled
188!:mime application/x-bytecode.python
1890	belong		0x400d0d0a	python 3.7 byte-compiled
190!:mime application/x-bytecode.python
1910	belong		0x410d0d0a	python 3.7 byte-compiled
192!:mime application/x-bytecode.python
1930	belong		0x420d0d0a	python 3.7 byte-compiled
194!:mime application/x-bytecode.python
1950	belong		0x480d0d0a	python 3.8 byte-compiled
196!:mime application/x-bytecode.python
1970	belong		0x490d0d0a	python 3.8 byte-compiled
198!:mime application/x-bytecode.python
1990	belong		0x520d0d0a	python 3.8 byte-compiled
200!:mime application/x-bytecode.python
2010	belong		0x530d0d0a	python 3.8 byte-compiled
202!:mime application/x-bytecode.python
2030	belong		0x540d0d0a	python 3.8 byte-compiled
204!:mime application/x-bytecode.python
2050	belong		0x550d0d0a	python 3.8 byte-compiled
206!:mime application/x-bytecode.python
2070	belong		0x5c0d0d0a	python 3.9 byte-compiled
208!:mime application/x-bytecode.python
2090	belong		0x5d0d0d0a	python 3.9 byte-compiled
210!:mime application/x-bytecode.python
2110	belong		0x5e0d0d0a	python 3.9 byte-compiled
212!:mime application/x-bytecode.python
2130	belong		0x5f0d0d0a	python 3.9 byte-compiled
214!:mime application/x-bytecode.python
2150	belong		0x600d0d0a	python 3.9 byte-compiled
216!:mime application/x-bytecode.python
2170	belong		0x610d0d0a	python 3.9 byte-compiled
218!:mime application/x-bytecode.python
2190	belong		0x660d0d0a	python 3.10 byte-compiled
220!:mime application/x-bytecode.python
2210	belong		0x670d0d0a	python 3.10 byte-compiled
222!:mime application/x-bytecode.python
2230	belong		0x680d0d0a	python 3.10 byte-compiled
224!:mime application/x-bytecode.python
2250	belong		0x690d0d0a	python 3.10 byte-compiled
226!:mime application/x-bytecode.python
2270	belong		0x6a0d0d0a	python 3.10 byte-compiled
228!:mime application/x-bytecode.python
2290	belong		0x6b0d0d0a	python 3.10 byte-compiled
230!:mime application/x-bytecode.python
2310	belong		0x6c0d0d0a	python 3.10 byte-compiled
232!:mime application/x-bytecode.python
2330	belong		0x6d0d0d0a	python 3.10 byte-compiled
234!:mime application/x-bytecode.python
2350	belong		0x6e0d0d0a	python 3.10 byte-compiled
236!:mime application/x-bytecode.python
2370	belong		0x6f0d0d0a	python 3.10 byte-compiled
238!:mime application/x-bytecode.python
2390	belong		0x7a0d0d0a	python 3.11 byte-compiled
240!:mime application/x-bytecode.python
2410	belong		0x7b0d0d0a	python 3.11 byte-compiled
242!:mime application/x-bytecode.python
2430	belong		0x7c0d0d0a	python 3.11 byte-compiled
244!:mime application/x-bytecode.python
2450	belong		0x7d0d0d0a	python 3.11 byte-compiled
246!:mime application/x-bytecode.python
2470	belong		0x7e0d0d0a	python 3.11 byte-compiled
248!:mime application/x-bytecode.python
2490	belong		0x7f0d0d0a	python 3.11 byte-compiled
250!:mime application/x-bytecode.python
2510	belong		0x800d0d0a	python 3.11 byte-compiled
252!:mime application/x-bytecode.python
2530	belong		0x810d0d0a	python 3.11 byte-compiled
254!:mime application/x-bytecode.python
2550	belong		0x820d0d0a	python 3.11 byte-compiled
256!:mime application/x-bytecode.python
2570	belong		0x830d0d0a	python 3.11 byte-compiled
258!:mime application/x-bytecode.python
2590	belong		0x840d0d0a	python 3.11 byte-compiled
260!:mime application/x-bytecode.python
2610	belong		0x850d0d0a	python 3.11 byte-compiled
262!:mime application/x-bytecode.python
263
2640	search/1/w	#!\040/usr/bin/python	Python script text executable
265!:strength + 15
266!:mime text/x-script.python
2670	search/1/w	#!\040/usr/local/bin/python	Python script text executable
268!:strength + 15
269!:mime text/x-script.python
2700	search/10/w	#!\040/usr/bin/env\040python	Python script text executable
271!:strength + 15
272!:mime text/x-script.python
273
274
275# from module.submodule import func1, func2
2760	search/8192	import
277>0	regex		\^from[\040\t]+([A-Za-z0-9_]|\\.)+[\040\t]+import.*$	Python script text executable
278!:strength + 15
279!:mime text/x-script.python
280
281# def __init__ (self, ...):
2820	search/4096	def\ __init__
283>&0	search/64 self	Python script text executable
284!:strength + 15
285!:mime text/x-script.python
286
287# if __name__ == "__main__":
2880 search/4096 if\ __name__
289>&0 search/64 '__main__'	Python script text executable
290>&0 search/64 "__main__"	Python script text executable
291!:strength + 15
292!:mime text/x-script.python
293
294# import module [as abrev]
2950	search/8192	import
296>0	regex	\^import\ [_[:alpha:]]+\ as\ [[:alpha:]][[:space:]]*$ Python script text executable
297!:mime text/x-script.python
298
299# comments
300#0	search/4096	'''
301#>&0	regex	.*'''$	Python script text executable
302#!:mime text/x-script.python
303
304#0	search/4096	"""
305#>&0	regex	.*"""$	Python script text executable
306#!:mime text/x-script.python
307
308# try:
309# except: or finally:
310# block
3110	search/4096	try:
312>&0	regex	\^[[:space:]]*except.*:$	Python script text executable
313!:strength + 15
314!:mime text/x-script.python
315>&0	search/4096	finally:	Python script text executable
316!:mime text/x-script.python
317
318# class name[(base classes,)]: [pass]
3190	search/8192	class
320>0	regex	\^class\ [_[:alpha:]]+(\\(.*\\))?(\ )*:([\ \t]+pass)?$		Python script text executable
321!:strength + 15
322!:mime text/x-script.python
323
324# def name(*args, **kwargs):
3250	search/8192	def\
326>0	regex	 \^[[:space:]]{0,50}def\ {1,50}[_a-zA-Z]{1,100}
327>>&0	regex	 \\(([[:alpha:]*_,\ ]){0,255}\\):$ Python script text executable
328!:strength + 15
329!:mime text/x-script.python
330
331# https://numpy.org/devdocs/reference/generated/numpy.lib.format.html
3320	string	\223NUMPY		NumPy data file
333!:mime  application/x-numpy-data
334>6	byte	x			\b, version %d
335>7	byte	x			\b.%d
336#>8	leshort	x			\b, header length=%d
337>10	string	x			\b, description %s
338