@@ -215,41 +215,7 @@ def _get_paths():
215215 return []
216216 return discover_runtime_directories (nvim )
217217
218- def _find_module (fullname , oldtail , path ):
219- import imp
220- idx = oldtail .find ('.' )
221- if idx > 0 :
222- name = oldtail [:idx ]
223- tail = oldtail [idx + 1 :]
224- fmr = imp .find_module (name , path )
225- module = imp .find_module (fullname [:- len (oldtail )] + name , * fmr )
226- return _find_module (fullname , tail , module .__path__ )
227- else :
228- return imp .find_module (fullname , path )
229-
230- class VimModuleLoader (object ):
231- def __init__ (self , module ):
232- self .module = module
233-
234- def load_module (self , fullname , path = None ):
235- # Check sys.modules, required for reload (see PEP302).
236- try :
237- return sys .modules [fullname ]
238- except KeyError :
239- pass
240- import imp
241- return imp .load_module (fullname , * self .module )
242-
243218 class VimPathFinder (object ):
244- @staticmethod
245- def find_module (fullname , path = None ):
246- """Method for Python 2.7 and 3.3."""
247- try :
248- return VimModuleLoader (
249- _find_module (fullname , fullname , path or _get_paths ()))
250- except ImportError :
251- return None
252-
253219 @staticmethod
254220 def find_spec (fullname , target = None ):
255221 """Method for Python 3.4+."""
@@ -258,8 +224,7 @@ def find_spec(fullname, target=None):
258224 def hook (path ):
259225 if path == nvim .VIM_SPECIAL_PATH :
260226 return VimPathFinder
261- else :
262- raise ImportError
227+ raise ImportError
263228
264229 return hook
265230
0 commit comments