Anonymous avatar Anonymous committed bc1ffcd

pycore: added PyCore.extension_modules

Comments (0)

Files changed (2)


             source_folder = source_folder.parent
         return module_name
+    @property
+    def extension_modules(self):
+        return self.project.prefs.get('extension_modules', [])
 class _ModuleCache(object):
 class _ExtensionCache(object):
     def __init__(self, pycore):
-        self.project = pycore.project
+        self.pycore = pycore
         self.extensions = {}
     def get_pymodule(self, name):
         if name == '__builtin__':
             return builtins.builtins
-        if name not in self.extensions and name in self.allowed:
-            self.extensions[name] = builtins.BuiltinModule(name, self.allowed)
+        allowed = self.pycore.extension_modules
+        if name not in self.extensions and name in allowed:
+            self.extensions[name] = builtins.BuiltinModule(name, allowed)
         return self.extensions.get(name)
-    @property
-    def allowed(self):
-        return self.project.prefs.get('extension_modules', [])
 def perform_soa_on_changed_scopes(project, resource, old_contents):
     pycore = project.pycore


     def _create_structural_attributes(self):
         result = {}
         modname = self.pycore.modname(self.resource)
-        for extension in self.pycore.extension_cache.allowed:
+        for extension in self.pycore.extension_modules:
             if extension.startswith(modname + '.'):
                 name = extension[len(modname) + 1:]
                 if '.' not in name:
                     module = rope.base.builtins.BuiltinModule(
-                        extension, self.pycore.extension_cache.allowed)
+                        extension, self.pycore.extension_modules)
                     result[name] = rope.base.builtins.BuiltinName(module)
         if self.resource is None:
             return result
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.