Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. @classmethod
  2. def _path_importer_cache(cls, path):
  3. """Get the finder for the path entry from sys.path_importer_cache.
  4.  
  5. If the path entry is not in the cache, find the appropriate finder
  6. and cache it. If no finder is available, store None.
  7.  
  8. """
  9. if path == '':
  10. try:
  11. path = _os.getcwd()
  12. except FileNotFoundError:
  13. # Don't cache the failure as the cwd can easily change to
  14. # a valid directory later on.
  15. return None
  16. try:
  17. finder = sys.path_importer_cache[path]
  18. except KeyError:
  19. finder = cls._path_hooks(path)
  20. sys.path_importer_cache[path] = finder
  21. return finder
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement