1
0
forked from VimPlug/jedi

Add file_io for Jedi for listdir

This commit is contained in:
Dave Halter
2019-05-31 21:25:39 +02:00
parent 77bd393a92
commit 9c40c75136
5 changed files with 37 additions and 17 deletions

33
jedi/file_io.py Normal file
View File

@@ -0,0 +1,33 @@
import os
from parso import file_io
class _ListDirMixin(object):
def listdir(self):
directory = self.path
return os.listdir(directory)
class ZipFileIO(file_io.KnownContentFileIO):
"""For .zip and .egg archives"""
def __init__(self, path, code, zip_path):
super(ZipFileIO, self).__init__(path, code)
self._zip_path = zip_path
def get_last_modified(self):
try:
return os.path.getmtime(self._zip_path)
except OSError: # Python 3 would probably only need FileNotFoundError
return None
def listdir(self):
return []
class FileIO(_ListDirMixin, file_io.FileIO):
pass
class KnownContentFileIO(file_io.KnownContentFileIO):
pass