ThirdParty/Pygments/pygments/lexers/_luabuiltins.py

branch
Py2 comp.
changeset 2669
11a6696ff868
parent 2525
8b507a9a2d40
child 3145
a9de05d4a22f
diff -r e5115553185a -r 11a6696ff868 ThirdParty/Pygments/pygments/lexers/_luabuiltins.py
--- a/ThirdParty/Pygments/pygments/lexers/_luabuiltins.py	Sun Apr 21 20:30:56 2013 +0200
+++ b/ThirdParty/Pygments/pygments/lexers/_luabuiltins.py	Thu May 23 19:58:41 2013 +0200
@@ -144,7 +144,11 @@
 
 if __name__ == '__main__':
     import re
-    import urllib.request, urllib.parse, urllib.error
+    try:  # Py3
+        import urllib.request as request
+    except (ImportError):
+        import urllib2 as request   # __IGNORE_WARNING__
+
     import pprint
 
     # you can't generally find out what module a function belongs to if you
@@ -190,7 +194,7 @@
 
 
     def get_newest_version():
-        f = urllib.request.urlopen('http://www.lua.org/manual/')
+        f = request.urlopen('http://www.lua.org/manual/')
         r = re.compile(r'^<A HREF="(\d\.\d)/">Lua \1</A>')
         for line in f:
             m = r.match(line)
@@ -198,7 +202,7 @@
                 return m.groups()[0]
 
     def get_lua_functions(version):
-        f = urllib.request.urlopen('http://www.lua.org/manual/%s/' % version)
+        f = request.urlopen('http://www.lua.org/manual/%s/' % version)
         r = re.compile(r'^<A HREF="manual.html#pdf-(.+)">\1</A>')
         functions = []
         for line in f:

eric ide

mercurial