xref: /minix3/external/bsd/file/dist/magic/magdir/python (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1ef01931fSBen Gras
2ef01931fSBen Gras#------------------------------------------------------------------------------
3*0a6a1f1dSLionel Sambuc# $File: python,v 1.26 2014/08/04 05:58:40 christos Exp $
4ef01931fSBen Gras# python:  file(1) magic for python
5ef01931fSBen Gras#
608ff44c4SLionel Sambuc# Outlook puts """ too for urgent messages
7ef01931fSBen Gras# From: David Necas <yeti@physics.muni.cz>
8ef01931fSBen Gras# often the module starts with a multiline string
908ff44c4SLionel Sambuc0	string/t	"""	Python script text executable
10835f6802SDirk Vogt# MAGIC as specified in Python/import.c (1.5 to 2.7a0 and 3.1a0, assuming
11835f6802SDirk Vogt# that Py_UnicodeFlag is off for Python 2)
12ef01931fSBen Gras# 20121  ( YEAR - 1995 ) + MONTH  + DAY (little endian followed by "\r\n"
13ef01931fSBen Gras0	belong		0x994e0d0a	python 1.5/1.6 byte-compiled
14ef01931fSBen Gras0	belong		0x87c60d0a	python 2.0 byte-compiled
15ef01931fSBen Gras0	belong		0x2aeb0d0a	python 2.1 byte-compiled
16ef01931fSBen Gras0	belong		0x2ded0d0a	python 2.2 byte-compiled
17ef01931fSBen Gras0	belong		0x3bf20d0a	python 2.3 byte-compiled
18ef01931fSBen Gras0	belong		0x6df20d0a	python 2.4 byte-compiled
19ef01931fSBen Gras0	belong		0xb3f20d0a	python 2.5 byte-compiled
20ef01931fSBen Gras0	belong		0xd1f20d0a	python 2.6 byte-compiled
21835f6802SDirk Vogt0	belong		0x03f30d0a	python 2.7 byte-compiled
22835f6802SDirk Vogt0	belong		0x3b0c0d0a	python 3.0 byte-compiled
23835f6802SDirk Vogt0	belong		0x4f0c0d0a	python 3.1 byte-compiled
24835f6802SDirk Vogt0	belong		0x6c0c0d0a	python 3.2 byte-compiled
2584d9c625SLionel Sambuc0	belong		0x9e0c0d0a	python 3.3 byte-compiled
26*0a6a1f1dSLionel Sambuc0	belong		0xee0c0d0a	python 3.4 byte-compiled
27835f6802SDirk Vogt
28835f6802SDirk Vogt0	search/1/w	#!\ /usr/bin/python	Python script text executable
29835f6802SDirk Vogt!:mime text/x-python
30835f6802SDirk Vogt0	search/1/w	#!\ /usr/local/bin/python	Python script text executable
31835f6802SDirk Vogt!:mime text/x-python
32835f6802SDirk Vogt0	search/1	#!/usr/bin/env\ python	Python script text executable
33835f6802SDirk Vogt!:mime text/x-python
34835f6802SDirk Vogt0	search/1	#!\ /usr/bin/env\ python	Python script text executable
35835f6802SDirk Vogt!:mime text/x-python
36ef01931fSBen Gras
37ef01931fSBen Gras
38835f6802SDirk Vogt# from module.submodule import func1, func2
39835f6802SDirk Vogt0	regex	\^from\\s+(\\w|\\.)+\\s+import.*$	Python script text executable
40835f6802SDirk Vogt!:mime text/x-python
41ef01931fSBen Gras
42835f6802SDirk Vogt# def __init__ (self, ...):
43835f6802SDirk Vogt0	search/4096	def\ __init__
44835f6802SDirk Vogt>&0	search/64 self	Python script text executable
45835f6802SDirk Vogt!:mime text/x-python
46835f6802SDirk Vogt
47835f6802SDirk Vogt# comments
48*0a6a1f1dSLionel Sambuc#0	search/4096	'''
49*0a6a1f1dSLionel Sambuc#>&0	regex	.*'''$	Python script text executable
50*0a6a1f1dSLionel Sambuc#!:mime text/x-python
51835f6802SDirk Vogt
52*0a6a1f1dSLionel Sambuc#0	search/4096	"""
53*0a6a1f1dSLionel Sambuc#>&0	regex	.*"""$	Python script text executable
54*0a6a1f1dSLionel Sambuc#!:mime text/x-python
55835f6802SDirk Vogt
56835f6802SDirk Vogt# try:
57835f6802SDirk Vogt# except: or finally:
58835f6802SDirk Vogt# block
59835f6802SDirk Vogt0	search/4096	try:
60835f6802SDirk Vogt>&0	regex	\^\\s*except.*:	Python script text executable
61835f6802SDirk Vogt!:mime text/x-python
62835f6802SDirk Vogt>&0	search/4096	finally:	Python script text executable
63835f6802SDirk Vogt!:mime text/x-python
6484d9c625SLionel Sambuc
6584d9c625SLionel Sambuc# def name(args, args):
66*0a6a1f1dSLionel Sambuc0	regex	 \^(\ |\\t){0,50}def\ {1,50}[a-zA-Z]{1,100}
67*0a6a1f1dSLionel Sambuc>&0	regex	\ {0,50}\\(([a-zA-Z]|,|\ ){1,255}\\):$ Python script text executable
6884d9c625SLionel Sambuc!:mime text/x-python
69