eric6/ThirdParty/Pygments/pygments/lexers/_php_builtins.py

changeset 7547
21b0534faebc
parent 6942
2602857055c5
child 7701
25f42e208e08
--- a/eric6/ThirdParty/Pygments/pygments/lexers/_php_builtins.py	Tue Apr 21 19:44:19 2020 +0200
+++ b/eric6/ThirdParty/Pygments/pygments/lexers/_php_builtins.py	Tue Apr 21 19:47:10 2020 +0200
@@ -12,12 +12,10 @@
              internet connection. don't run that at home, use
              a server ;-)
 
-    :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
+    :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
     :license: BSD, see LICENSE for details.
 """
 
-from __future__ import print_function
-
 MODULES = {'.NET': ('dotnet_load',),
  'APC': ('apc_add',
          'apc_bin_dump',
@@ -4698,18 +4696,19 @@
 
         for file in get_php_references():
             module = ''
-            for line in open(file):
-                if not module:
-                    search = module_re.search(line)
-                    if search:
-                        module = search.group(1)
-                        modules[module] = []
+            with open(file) as f:
+                for line in f:
+                    if not module:
+                        search = module_re.search(line)
+                        if search:
+                            module = search.group(1)
+                            modules[module] = []
 
-                elif 'href="function.' in line:
-                    for match in function_re.finditer(line):
-                        fn = match.group(1)
-                        if '->' not in fn and '::' not in fn and fn not in modules[module]:
-                            modules[module].append(fn)
+                    elif 'href="function.' in line:
+                        for match in function_re.finditer(line):
+                            fn = match.group(1)
+                            if '->' not in fn and '::' not in fn and fn not in modules[module]:
+                                modules[module].append(fn)
 
             if module:
                 # These are dummy manual pages, not actual functions
@@ -4726,9 +4725,8 @@
 
     def get_php_references():
         download = urlretrieve(PHP_MANUAL_URL)
-        tar = tarfile.open(download[0])
-        tar.extractall()
-        tar.close()
+        with tarfile.open(download[0]) as tar:
+            tar.extractall()
         for file in glob.glob("%s%s" % (PHP_MANUAL_DIR, PHP_REFERENCE_GLOB)):
             yield file
         os.remove(download[0])

eric ide

mercurial