xref: /dflybsd-src/contrib/file/magic/Magdir/python (revision 82c5fa3ed529d94b87e8a4447aaa75bcff807696)
1327e51cbSPeter Avalos
2327e51cbSPeter Avalos#------------------------------------------------------------------------------
3*82c5fa3eSPeter Avalos# $File: python,v 1.26 2014/08/04 05:58:40 christos Exp $
4327e51cbSPeter Avalos# python:  file(1) magic for python
5327e51cbSPeter Avalos#
69f86ab30SPeter Avalos# Outlook puts """ too for urgent messages
7327e51cbSPeter Avalos# From: David Necas <yeti@physics.muni.cz>
8327e51cbSPeter Avalos# often the module starts with a multiline string
99f86ab30SPeter Avalos0	string/t	"""	Python script text executable
10e4d4ce0cSPeter Avalos# MAGIC as specified in Python/import.c (1.5 to 2.7a0 and 3.1a0, assuming
11f72f8299SJan Lentfer# that Py_UnicodeFlag is off for Python 2)
12327e51cbSPeter Avalos# 20121  ( YEAR - 1995 ) + MONTH  + DAY (little endian followed by "\r\n"
13327e51cbSPeter Avalos0	belong		0x994e0d0a	python 1.5/1.6 byte-compiled
14327e51cbSPeter Avalos0	belong		0x87c60d0a	python 2.0 byte-compiled
15327e51cbSPeter Avalos0	belong		0x2aeb0d0a	python 2.1 byte-compiled
16327e51cbSPeter Avalos0	belong		0x2ded0d0a	python 2.2 byte-compiled
17327e51cbSPeter Avalos0	belong		0x3bf20d0a	python 2.3 byte-compiled
18327e51cbSPeter Avalos0	belong		0x6df20d0a	python 2.4 byte-compiled
19327e51cbSPeter Avalos0	belong		0xb3f20d0a	python 2.5 byte-compiled
2079343712SPeter Avalos0	belong		0xd1f20d0a	python 2.6 byte-compiled
21e4d4ce0cSPeter Avalos0	belong		0x03f30d0a	python 2.7 byte-compiled
22f72f8299SJan Lentfer0	belong		0x3b0c0d0a	python 3.0 byte-compiled
23f72f8299SJan Lentfer0	belong		0x4f0c0d0a	python 3.1 byte-compiled
24ff91a668SPeter Avalos0	belong		0x6c0c0d0a	python 3.2 byte-compiled
25e8af9738SPeter Avalos0	belong		0x9e0c0d0a	python 3.3 byte-compiled
26*82c5fa3eSPeter Avalos0	belong		0xee0c0d0a	python 3.4 byte-compiled
2779343712SPeter Avalos
28f72f8299SJan Lentfer0	search/1/w	#!\ /usr/bin/python	Python script text executable
29f72f8299SJan Lentfer!:mime text/x-python
30f72f8299SJan Lentfer0	search/1/w	#!\ /usr/local/bin/python	Python script text executable
31f72f8299SJan Lentfer!:mime text/x-python
32f72f8299SJan Lentfer0	search/1	#!/usr/bin/env\ python	Python script text executable
33f72f8299SJan Lentfer!:mime text/x-python
34e4d4ce0cSPeter Avalos0	search/1	#!\ /usr/bin/env\ python	Python script text executable
35e4d4ce0cSPeter Avalos!:mime text/x-python
36e4d4ce0cSPeter Avalos
37e4d4ce0cSPeter Avalos
38e4d4ce0cSPeter Avalos# from module.submodule import func1, func2
39ff91a668SPeter Avalos0	regex	\^from\\s+(\\w|\\.)+\\s+import.*$	Python script text executable
40e4d4ce0cSPeter Avalos!:mime text/x-python
41e4d4ce0cSPeter Avalos
42e4d4ce0cSPeter Avalos# def __init__ (self, ...):
43e4d4ce0cSPeter Avalos0	search/4096	def\ __init__
44e4d4ce0cSPeter Avalos>&0	search/64 self	Python script text executable
45e4d4ce0cSPeter Avalos!:mime text/x-python
46e4d4ce0cSPeter Avalos
47e4d4ce0cSPeter Avalos# comments
48e8af9738SPeter Avalos#0	search/4096	'''
49e8af9738SPeter Avalos#>&0	regex	.*'''$	Python script text executable
50e8af9738SPeter Avalos#!:mime text/x-python
51e4d4ce0cSPeter Avalos
52e8af9738SPeter Avalos#0	search/4096	"""
53e8af9738SPeter Avalos#>&0	regex	.*"""$	Python script text executable
54e8af9738SPeter Avalos#!:mime text/x-python
55e4d4ce0cSPeter Avalos
56e4d4ce0cSPeter Avalos# try:
57e4d4ce0cSPeter Avalos# except: or finally:
58e4d4ce0cSPeter Avalos# block
59e4d4ce0cSPeter Avalos0	search/4096	try:
60e4d4ce0cSPeter Avalos>&0	regex	\^\\s*except.*:	Python script text executable
61e4d4ce0cSPeter Avalos!:mime text/x-python
62e4d4ce0cSPeter Avalos>&0	search/4096	finally:	Python script text executable
63f72f8299SJan Lentfer!:mime text/x-python
64e8af9738SPeter Avalos
65e8af9738SPeter Avalos# def name(args, args):
66e8af9738SPeter Avalos0	regex	 \^(\ |\\t){0,50}def\ {1,50}[a-zA-Z]{1,100}
67*82c5fa3eSPeter Avalos>&0	regex	\ {0,50}\\(([a-zA-Z]|,|\ ){1,255}\\):$ Python script text executable
68e8af9738SPeter Avalos!:mime text/x-python
69