summaryrefslogtreecommitdiff
path: root/pygments/lexers/_sourcemodbuiltins.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-03-04 14:17:10 +0100
committerGeorg Brandl <georg@python.org>2014-03-04 14:17:10 +0100
commit18348a61d7e90b03a624fdc78fafdcb46b92307d (patch)
treee4fe1541ad9e2ada2de394eb2e020e2a0916ce94 /pygments/lexers/_sourcemodbuiltins.py
parentcd9c0b70635f2a6c65ea97d042537478a0a95b7a (diff)
parent27895fe85076d2f1b44e7d30387b3f459fc60281 (diff)
downloadpygments-18348a61d7e90b03a624fdc78fafdcb46b92307d.tar.gz
merge with raichoo/pygments-main (pull request #210)
Diffstat (limited to 'pygments/lexers/_sourcemodbuiltins.py')
-rw-r--r--pygments/lexers/_sourcemodbuiltins.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/pygments/lexers/_sourcemodbuiltins.py b/pygments/lexers/_sourcemodbuiltins.py
index 0f6b4770..eee84d0b 100644
--- a/pygments/lexers/_sourcemodbuiltins.py
+++ b/pygments/lexers/_sourcemodbuiltins.py
@@ -8,10 +8,12 @@
Do not edit the FUNCTIONS list by hand.
- :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
+from __future__ import print_function
+
FUNCTIONS = ['TopMenuHandler',
'CreateTopMenu',
'LoadTopMenuConfig',
@@ -1012,7 +1014,10 @@ if __name__ == '__main__':
import pprint
import re
import sys
- import urllib
+ try:
+ from urllib import urlopen
+ except ImportError:
+ from urllib.request import urlopen
# urllib ends up wanting to import a module called 'math' -- if
# pygments/lexers is in the path, this ends badly.
@@ -1021,7 +1026,7 @@ if __name__ == '__main__':
del sys.path[i]
def get_version():
- f = urllib.urlopen('http://docs.sourcemod.net/api/index.php')
+ f = urlopen('http://docs.sourcemod.net/api/index.php')
r = re.compile(r'SourceMod v\.<b>([\d\.]+)</td>')
for line in f:
m = r.search(line)
@@ -1029,7 +1034,7 @@ if __name__ == '__main__':
return m.groups()[0]
def get_sm_functions():
- f = urllib.urlopen('http://docs.sourcemod.net/api/SMfuncs.js')
+ f = urlopen('http://docs.sourcemod.net/api/SMfuncs.js')
r = re.compile(r'SMfunctions\[\d+\] = Array \("(?:public )?([^,]+)",".+"\);')
functions = []
for line in f:
@@ -1057,13 +1062,13 @@ if __name__ == '__main__':
def run():
version = get_version()
- print '> Downloading function index for SourceMod %s' % version
+ print('> Downloading function index for SourceMod %s' % version)
functions = get_sm_functions()
- print '> %d functions found:' % len(functions)
+ print('> %d functions found:' % len(functions))
functionlist = []
for full_function_name in functions:
- print '>> %s' % full_function_name
+ print('>> %s' % full_function_name)
functionlist.append(full_function_name)
regenerate(__file__, functionlist)