text/x-python;application/x-python
*.py;*.py2
#
.py2
(\.[\s\n\r]*[\w]+)[\s\n\r]*(?=\(.*\))
[_a-zA-Z][_a-zA-Z0-9]*
[1-9][0-9]*
(\%{identifier}\.)*\%{identifier}
(\.*\%{identifier-path}|\.+)
% # leading % sign
\(\%{identifier}\)? # mapping key
[#0\-\ \+]* # conversion flags
(\-?\%{number}|\*)? # minimum field width
(\.(\-?\%{number}|\*))? # precision
(hlL)? # length modifier
[diouxXeEfFgGcrs%] # conversion type
\\( # leading backslash
[\\'"abfnrtv] | # single escaped char
N\{[0-9A-Z\ -]+\} | # named unicode character
u[0-9A-Fa-f]{4} | # xxxx - character with 16-bit hex value xxxx
U[0-9A-Fa-f]{8} | # xxxxxxxx - character with 32-bit hex value xxxxxxxx
x[0-9A-Fa-f]{1,2} | # \xhh - character with hex value hh
[0-7]{1,3} # \ooo - character with octal value ooo
)
(u|U)?
(r|ur|R|UR|Ur|uR)
\%{string-prefix}"""
"""
\%{string-prefix}'''
'''
\%{string-prefix}"
"
\%{string-prefix}'
'
\%{raw-string-prefix}"""
"""
\%{raw-string-prefix}'''
'''
\%{raw-string-prefix}"
"
\%{raw-string-prefix}'
'
`
`
(?<![\w\.])
self
__name__
__debug__
(?<![\w\.])
False
True
( (\d+)?\.\d+ | \d+\. ) |
( (\d+|(\d+)?\.\d+|\d+\.)[eE][+-]?\d+ )
(?<![\w\.])(\%{float}|\d+)[jJ]\b
(?<![\w\.])\%{float}(?![\w\.])
(?<![\w\.])([1-9][0-9]*|0)[lL]?(?![\w\.])
(?<![\w\.])0[0-7]+[lL]?(?![\w\.])
(?<![\w\.])0[xX][0-9A-Fa-f]+[lL]?(?![\w\.])
(from)
\s+
(\%{relative-path})
import
from
as
(def)
\s+
(\%{identifier})
(class)
\s+
(\%{identifier})
@\%{identifier-path}
and
assert
break
class
continue
def
del
elif
else
except
finally
for
global
if
in
is
lambda
not
or
pass
raise
return
try
while
with
yield
exec
print
(?<![\w\.])
Ellipsis
None
NotImplemented
(?<![\w\.])
ArithmeticError
AssertionError
AttributeError
EnvironmentError
EOFError
Exception
FloatingPointError
ImportError
IndentationError
IndexError
IOError
KeyboardInterrupt
KeyError
LookupError
MemoryError
NameError
NotImplementedError
OSError
OverflowError
ReferenceError
RuntimeError
StandardError
StopIteration
SyntaxError
SystemError
SystemExit
TabError
TypeError
UnboundLocalError
UnicodeDecodeError
UnicodeEncodeError
UnicodeError
UnicodeTranslateError
ValueError
WindowsError
ZeroDivisionError
Warning
UserWarning
DeprecationWarning
PendingDeprecationWarning
SyntaxWarning
OverflowWarning
RuntimeWarning
FutureWarning
(?<![\w\.])
__import__
abs
all
any
bin
bool
callable
chr
classmethod
compile
complex
delattr
dict
dir
divmod
enumerate
eval
filter
float
format
frozenset
getattr
globals
hasattr
hash
hex
id
input
int
isinstance
issubclass
iter
len
list
locals
map
max
min
object
oct
open
ord
pow
property
range
repr
reversed
round
setattr
set
slice
sorted
staticmethod
str
sum
super
tuple
type
vars
zip
(?<![\w\.])
apply
basestring
buffer
cmp
coerce
execfile
file
intern
long
raw_input
reduce
reload
unichr
unicode
xrange