bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def listdir(self, path="./", wildcard=None, full=False, absolute=False, dirs_only=False, files_only=False): paths = os.listdir(self.getsyspath(path)) return self._listdir_helper(path, paths, wildcard, full, absolute, dirs_only, files_only)
def listdir(self, path="./", wildcard=None, full=False, absolute=False, dirs_only=False, files_only=False): paths = [self._decode_path(p) for p in os.listdir(self.getsyspath(path))] return self._listdir_helper(path, paths, wildcard, full, absolute, dirs_only, files_only)
448,900
def _copy(self,src,dst,overwrite=False): headers = {"Destination":self._path2url(dst)} if overwrite: headers["Overwrite"] = "T" else: headers["Overwrite"] = "F" response = self._request(src,"COPY",headers=headers) response.close() if response.status == 412: raise DestinationExistsError(dst) if response.status == 409: r...
def _copy(self,src,dst,overwrite=False): headers = {"Destination":self._path2url(dst)} if overwrite: headers["Overwrite"] = "T" else: headers["Overwrite"] = "F" response = self._request(src,"COPY",headers=headers) response.close() if response.status == 412: raise DestinationExistsError(dst) if response.status == 409: r...
448,901
def _move(self,src,dst,overwrite=False): headers = {"Destination":self._path2url(dst)} if overwrite: headers["Overwrite"] = "T" else: headers["Overwrite"] = "F" response = self._request(src,"MOVE",headers=headers) response.close() if response.status == 412: raise DestinationExistsError(dst) if response.status == 409: r...
def _move(self,src,dst,overwrite=False): headers = {"Destination":self._path2url(dst)} if overwrite: headers["Overwrite"] = "T" else: headers["Overwrite"] = "F" response = self._request(src,"MOVE",headers=headers) response.close() if response.status == 412: raise DestinationExistsError(dst) if response.status == 409: r...
448,902
def write(line): file_out.write(line.encode(file_out.encoding)+'\n')
def write(line): file_out.write(line.encode(file_out.encoding or 'utf-8')+'\n')
448,903
def getmeta(self, meta_name, default=NoDefaultMeta): if meta_name == 'free_space': if platform.system() == 'Windows': try: import ctypes free_bytes = ctypes.ulonglong(0) ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(self.root_path), None, None, ctypes.pointer(free_bytes)) return free_bytes.value except I...
def getmeta(self, meta_name, default=NoDefaultMeta): if meta_name == 'free_space': if platform.system() == 'Windows': try: import ctypes free_bytes = ctypes.c_ulonglong(0) ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(self.root_path), None, None, ctypes.pointer(free_bytes)) return free_bytes.value except...
448,904
def getmeta(self, meta_name, default=NoDefaultMeta): if meta_name == 'free_space': if platform.system() == 'Windows': try: import ctypes free_bytes = ctypes.ulonglong(0) ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(self.root_path), None, None, ctypes.pointer(free_bytes)) return free_bytes.value except I...
def getmeta(self, meta_name, default=NoDefaultMeta): if meta_name == 'free_space': if platform.system() == 'Windows': try: import ctypes free_bytes = ctypes.ulonglong(0) ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(self.root_path), None, None, ctypes.pointer(free_bytes)) return free_bytes.value except I...
448,905
def __init__(self,fs,path,mode,rfile=None, write_on_flush=True): """RemoteFileBuffer constructor.
def __init__(self,fs,path,mode,rfile=None, write_on_flush=True): """RemoteFileBuffer constructor.
448,906
def getcontents(self, path): if not self.exists(path): raise ResourceNotFoundError(path) path = normpath(path) try: contents = self.zf.read(path.encode(self.encoding)) except KeyError: raise ResourceNotFoundError(path) except RuntimeError: raise OperationFailedError("read file", path=path, msg="Zip file must be oppened...
def getcontents(self, path): if not self.exists(path): raise ResourceNotFoundError(path) path = normpath(relpath(path)) try: contents = self.zf.read(path.encode(self.encoding)) except KeyError: raise ResourceNotFoundError(path) except RuntimeError: raise OperationFailedError("read file", path=path, msg="Zip file must b...
448,907
def _errcheck_dword(value,func,args): if value == 0xFFFFFFFF: raise ctypes.WinError() return args
def _errcheck_dword(value,func,args): if value == 0xFFFFFFFF: raise ctypes.WinError() return args
448,908
def _errcheck_dword(value,func,args): if value == 0xFFFFFFFF: raise ctypes.WinError() return args
def _errcheck_dword(value,func,args): if value == 0xFFFFFFFF: raise ctypes.WinError() return args
448,909
def _errcheck_dword(value,func,args): if value == 0xFFFFFFFF: raise ctypes.WinError() return args
def _errcheck_dword(value,func,args): if value == 0xFFFFFFFF: raise ctypes.WinError() return args
448,910
def _errcheck_dword(value,func,args): if value == 0xFFFFFFFF: raise ctypes.WinError() return args
def _errcheck_dword(value,func,args): if value == 0xFFFFFFFF: raise ctypes.WinError() return args
448,911
def _errcheck_dword(value,func,args): if value == 0xFFFFFFFF: raise ctypes.WinError() return args
def _errcheck_dword(value,func,args): if value == 0xFFFFFFFF: raise ctypes.WinError() return args
448,912
def _errcheck_dword(value,func,args): if value == 0xFFFFFFFF: raise ctypes.WinError() return args
def _errcheck_dword(value,func,args): if value == 0xFFFFFFFF: raise ctypes.WinError() return args
448,913
def _errcheck_dword(value,func,args): if value == 0xFFFFFFFF: raise ctypes.WinError() return args
def _errcheck_dword(value,func,args): if value == 0xFFFFFFFF: raise ctypes.WinError() return args
448,914
def _errcheck_dword(value,func,args): if value == 0xFFFFFFFF: raise ctypes.WinError() return args
def _errcheck_dword(value,func,args): if value == 0xFFFFFFFF: raise ctypes.WinError() return args
448,915
def do_run(self, options, args): windows = platform == "Windows" if options.unmount:
def do_run(self, options, args): windows = platform == "Windows" if options.unmount:
448,916
def do_run(self, options, args): windows = platform == "Windows" if options.unmount:
def do_run(self, options, args): windows = platform == "Windows" if options.unmount:
448,917
def do_run(self, options, args): windows = platform == "Windows" if options.unmount:
def do_run(self, options, args): windows = platform == "Windows" if options.unmount:
448,918
def do_run(self, options, args): windows = platform == "Windows" if options.unmount:
def do_run(self, options, args): windows = platform == "Windows" if options.unmount:
448,919
def do_run(self, options, args): windows = platform == "Windows" if options.unmount:
def do_run(self, options, args): windows = platform == "Windows" if options.unmount:
448,920
def do_run(self, options, args): windows = platform == "Windows" if options.unmount:
def do_run(self, options, args): windows = platform == "Windows" if options.unmount:
448,921
def do_run(self, options, args): windows = platform == "Windows" if options.unmount:
def do_run(self, options, args): windows = platform == "Windows" if options.unmount:
448,922
def do_run(self, options, args): windows = platform == "Windows" if options.unmount:
def do_run(self, options, args): windows = platform == "Windows" if options.unmount:
448,923
def do_run(self, options, args): windows = platform == "Windows" if options.unmount:
def do_run(self, options, args): windows = platform == "Windows" if options.unmount:
448,924
def do_run(self, options, args): windows = platform == "Windows" if options.unmount:
def do_run(self, options, args):else: fs.close = lambda:None windows = platform == "Windows"else: fs.close = lambda:None if options.unmount:
448,925
def movedir(self,src,dst,overwrite=False,ignore_errors=False,chunk_size=16384): nsrc = self._normpath(src) ndst = self._normpath(dst) if overwrite and self.isdir(dst): self.removedir(dst) try: self.client.rename(nsrc,ndst) except IOError, e: if getattr(e,"errno",None) == 2: raise ResourceNotFoundError(path) if self.exi...
def movedir(self,src,dst,overwrite=False,ignore_errors=False,chunk_size=16384): nsrc = self._normpath(src) ndst = self._normpath(dst) if overwrite and self.isdir(dst): self.removedir(dst) try: self.client.rename(nsrc,ndst) except IOError, e: if getattr(e,"errno",None) == 2: raise ResourceNotFoundError(src) if self.exis...
448,926
def _info2attrmask(self,path,info,hinfo=None): """Convert a file/directory info dict to a win32 file attribute mask.""" attrs = 0 st_mode = info.get("st_mode",None) if st_mode: if statinfo.S_ISDIR(st_mode): attrs |= FILE_ATTRIBUTE_DIRECTORY elif statinfo.S_ISREG(st_mode): attrs |= FILE_ATTRIBUTE_NORMAL elif hinfo: if h...
def _info2attrmask(self,path,info,hinfo=None): """Convert a file/directory info dict to a win32 file attribute mask.""" attrs = 0 st_mode = info.get("st_mode",None) if st_mode: if statinfo.S_ISDIR(st_mode): attrs |= FILE_ATTRIBUTE_DIRECTORY elif statinfo.S_ISREG(st_mode): attrs |= FILE_ATTRIBUTE_NORMAL if not attrs and...
448,927
def _info2attrmask(self,path,info,hinfo=None): """Convert a file/directory info dict to a win32 file attribute mask.""" attrs = 0 st_mode = info.get("st_mode",None) if st_mode: if statinfo.S_ISDIR(st_mode): attrs |= FILE_ATTRIBUTE_DIRECTORY elif statinfo.S_ISREG(st_mode): attrs |= FILE_ATTRIBUTE_NORMAL elif hinfo: if h...
def _info2attrmask(self,path,info,hinfo=None): """Convert a file/directory info dict to a win32 file attribute mask.""" attrs = 0 st_mode = info.get("st_mode",None) if st_mode: if statinfo.S_ISDIR(st_mode): attrs |= FILE_ATTRIBUTE_DIRECTORY elif statinfo.S_ISREG(st_mode): attrs |= FILE_ATTRIBUTE_NORMAL elif hinfo: if h...
448,928
def __init__(self, root_path, thread_synchronize=_thread_synchronize_default, encoding=None, create=False, dir_mode=0700): """ Creates an FS object that represents the OS Filesystem under a given root path
def __init__(self, root_path, thread_synchronize=_thread_synchronize_default, encoding=None, create=False, dir_mode=0700): """ Creates an FS object that represents the OS Filesystem under a given root path
448,929
def makedir(self, path, recursive=False, allow_recreate=False): sys_path = self.getsyspath(path) try: if recursive: os.makedirs(sys_path, self.dir_mode) else: os.mkdir(sys_path, self.dir_mode) except OSError, e: if e.errno == errno.EEXIST or e.errno == 183: if self.isfile(path): raise ResourceInvalidError(path,msg="Can...
def makedir(self, path, recursive=False, allow_recreate=False): sys_path = self.getsyspath(path) try: if recursive: _os_makedirs(sys_path, self.dir_mode) else: os.mkdir(sys_path, self.dir_mode) except OSError, e: if e.errno == errno.EEXIST or e.errno == 183: if self.isfile(path): raise ResourceInvalidError(path,msg="Ca...
448,930
def makedir(self, path, recursive=False, allow_recreate=False): sys_path = self.getsyspath(path) try: if recursive: os.makedirs(sys_path, self.dir_mode) else: os.mkdir(sys_path, self.dir_mode) except OSError, e: if e.errno == errno.EEXIST or e.errno == 183: if self.isfile(path): raise ResourceInvalidError(path,msg="Can...
def makedir(self, path, recursive=False, allow_recreate=False): sys_path = self.getsyspath(path) try: if recursive: os.makedirs(sys_path, self.dir_mode) else: os.mkdir(sys_path, self.dir_mode) except OSError, e: if e.errno == errno.EEXIST or e.errno == 183: if self.isfile(path): raise ResourceInvalidError(path,msg="Can...
448,931
def getinfo(self, path): stats = self._stat(path) info = dict((k, getattr(stats, k)) for k in dir(stats) if not k.startswith('__') ) info['size'] = info['st_size'] # TODO: this doesn't actually mean 'creation time' on unix ct = info.get('st_ctime', None) if ct is not None: info['created_time'] = datetime.datetime.from...
def getinfo(self, path): stats = self._stat(path) info = dict((k, getattr(stats, k)) for k in dir(stats) if not k.startswith('__') ) info['size'] = info['st_size'] # TODO: this doesn't actually mean 'creation time' on unix ct = info.get('st_ctime', None) if ct is not None: info['created_time'] = datetime.datetime.from...
448,932
def get_fs(cls, registry, fs_name, fs_name_params, fs_path, writeable, create_dir): username, password, fs_path = _parse_credentials(fs_path) from fs.sftpfs import SFTPFS credentials = {} if username is not None: credentials['username'] = username if password is not None: credentials['password'] = password if '/' i...
def get_fs(cls, registry, fs_name, fs_name_params, fs_path, writeable, create_dir): username, password, fs_path = _parse_credentials(fs_path) from fs.sftpfs import SFTPFS credentials = {} if username is not None: credentials['username'] = username if password is not None: credentials['password'] = password if '/' i...
448,933
def get_fs(cls, registry, fs_name, fs_name_params, fs_path, writeable, create_dir): from fs.httpfs import HTTPFS if '/' in fs_path: dirname, resourcename = fs_path.rsplit('/') else: dirname = fs_path resourcename = '' fs = HTTPFS('http://' + dirname) return fs, resourcename
def get_fs(cls, registry, fs_name, fs_name_params, fs_path, writeable, create_dir): from fs.httpfs import HTTPFS if '/' in fs_path: dirname, resourcename = fs_path.rsplit('/') else: dirname = fs_path resourcename = '' fs = HTTPFS('http://' + dirname) return fs, resourcename
448,934
def __init__(self, fs, fsname="Dokan FS", volname="Dokan Volume"): if libdokan is None: raise OSError("dokan library is not available") self.fs = fs self.fsname = fsname self.volname = volname self._files_by_handle = {} self._files_lock = threading.Lock() self._next_handle = MIN_FH self._pending_delete = set() # TODO:...
def__init__(self,fs,fsname="DokanFS",volname="DokanVolume"):iflibdokanisNone:raiseOSError("dokanlibraryisnotavailable")self.fs=fsself.fsname=fsnameself.volname=volnameself._files_by_handle={}self._files_lock=threading.Lock()self._next_handle=MIN_FHself._pending_delete=set()#TODO:doweneedthisfordokan?It'sahangoverfromFU...
448,935
def __init__(self, fs, fsname="Dokan FS", volname="Dokan Volume"): if libdokan is None: raise OSError("dokan library is not available") self.fs = fs self.fsname = fsname self.volname = volname self._files_by_handle = {} self._files_lock = threading.Lock() self._next_handle = MIN_FH self._pending_delete = set() # TODO:...
def __init__(self, fs, fsname="Dokan FS", volname="Dokan Volume"): if libdokan is None: raise OSError("dokan library is not available") self.fs = fs self.fsname = fsname self.volname = volname self._files_by_handle = {} self._files_lock = threading.Lock() self._next_handle = MIN_FH self._pending_delete = set() # TODO:...
448,936
def Cleanup(self, path, info): path = normpath(path) if info.contents.DeleteOnClose: if info.contents.IsDirectory: self.fs.removedir(path) self._pending_delete.remove(path) else: (file,_,lock) = self._get_file(info.contents.Context) lock.acquire() try: file.close() self.fs.remove(path) self._pending_delete.remove(path)...
def Cleanup(self, path, info): path = normpath(path) if info.contents.IsDirectory: if info.contents.DeleteOnClose: self.fs.removedir(path) self._pending_delete.remove(path) else: (file,_,lock) = self._get_file(info.contents.Context) lock.acquire() try: file.close() self.fs.remove(path) self._pending_delete.remove(path)...
448,937
def Cleanup(self, path, info): path = normpath(path) if info.contents.DeleteOnClose: if info.contents.IsDirectory: self.fs.removedir(path) self._pending_delete.remove(path) else: (file,_,lock) = self._get_file(info.contents.Context) lock.acquire() try: file.close() self.fs.remove(path) self._pending_delete.remove(path)...
def Cleanup(self, path, info): path = normpath(path) if info.contents.DeleteOnClose: if info.contents.IsDirectory: self.fs.removedir(path) self._pending_delete.remove(path) else: (file,_,lock) = self._get_file(info.contents.Context) lock.acquire() try: if info.contents.DeleteOnClose: file.close() self.fs.remove(path) s...
448,938
def Cleanup(self, path, info): path = normpath(path) if info.contents.DeleteOnClose: if info.contents.IsDirectory: self.fs.removedir(path) self._pending_delete.remove(path) else: (file,_,lock) = self._get_file(info.contents.Context) lock.acquire() try: file.close() self.fs.remove(path) self._pending_delete.remove(path)...
def Cleanup(self, path, info): path = normpath(path) if info.contents.DeleteOnClose: if info.contents.IsDirectory: self.fs.removedir(path) self._pending_delete.remove(path) else: (file,_,lock) = self._get_file(info.contents.Context) lock.acquire() try: file.close() self.fs.remove(path) self._pending_delete.remove(path)...
448,939
def WriteFile(self, path, buffer, nBytesToWrite, nBytesWritten, offset, info): path = normpath(path) (file,_,lock) = self._get_file(info.contents.Context) lock.acquire() try: if info.contents.WriteToEndOfFile: file.seek(0,os.SEEK_END) else: file.seek(offset) data = ctypes.create_string_buffer(nBytesToWrite) ctypes.memm...
def WriteFile(self, path, buffer, nBytesToWrite, nBytesWritten, offset, info): path = normpath(path) fh = info.contents.Context (file,_,lock) = self._get_file(fh) lock.acquire() try: if info.contents.WriteToEndOfFile: file.seek(0,os.SEEK_END) else: file.seek(offset) data = ctypes.create_string_buffer(nBytesToWrite) cty...
448,940
def _info2finddataw(self,path,info,data=None,hinfo=None): """Convert a file/directory info dict into a WIN32_FIND_DATAW struct.""" if data is None: data = libdokan.WIN32_FIND_DATAW() data.dwFileAttributes = self._info2attrmask(path,info,hinfo) data.ftCreateTime = _datetime2filetime(info.get("created_time",None)) data.f...
def _info2finddataw(self,path,info,data=None,hinfo=None): """Convert a file/directory info dict into a WIN32_FIND_DATAW struct.""" if data is None: data = libdokan.WIN32_FIND_DATAW() data.dwFileAttributes = self._info2attrmask(path,info,hinfo) data.ftCreateTime = _datetime2filetime(info.get("created_time",None)) data.f...
448,941
def wrapper(*args,**kwds): try: return func(*args,**kwds) except xmlrpclib.Fault, f: #import traceback #traceback.print_exc() # Make sure it's in a form we can handle bits = f.faultString.split(" ") if bits[0] not in ["<type","<class"]: raise f # Find the class/type object bits = " ".join(bits[1:]).split(">:") cls = bi...
def wrapper(*args,**kwds): try: return func(*args,**kwds) except xmlrpclib.Fault, f: #import traceback #traceback.print_exc() # Make sure it's in a form we can handle bits = f.faultString.split(" ") if bits[0] not in ["<type","<class"]: raise f # Find the class/type object bits = " ".join(bits[1:]).split(">:") cls = bi...
448,942
def wrapper(*args,**kwds): try: return func(*args,**kwds) except xmlrpclib.Fault, f: #import traceback #traceback.print_exc() # Make sure it's in a form we can handle bits = f.faultString.split(" ") if bits[0] not in ["<type","<class"]: raise f # Find the class/type object bits = " ".join(bits[1:]).split(">:") cls = bi...
def wrapper(*args,**kwds): try: return func(*args,**kwds) except xmlrpclib.Fault, f: #import traceback #traceback.print_exc() # Make sure it's in a form we can handle bits = f.faultString.split(" ") if bits[0] not in ["<type","<class"]: raise f # Find the class/type object bits = " ".join(bits[1:]).split(">:") cls = bi...
448,943
def __getstate__(self): return self.__dict__.copy()
def __getstate__(self): return self.__dict__.copy()
448,944
def __init__(self, path, memory_fs, value, mode): self.closed = False self.path = path self.memory_fs = memory_fs self.mode = mode
def __init__(self, path, memory_fs, value, mode): self.closed = False self.path = path self.memory_fs = memory_fs self.mode = mode
448,945
def desc_contents(self): if self.isfile(): return "<file %s>"%self.name elif self.isdir(): return "<dir %s>"%"".join( "%s: %s"% (k, v.desc_contents()) for k, v in self.contents.iteritems())
def desc_contents(self): if self.isfile(): return "<file %s>" % self.name elif self.isdir(): return "<dir %s>"%"".join( "%s: %s"% (k, v.desc_contents()) for k, v in self.contents.iteritems())
448,946
def desc_contents(self): if self.isfile(): return "<file %s>"%self.name elif self.isdir(): return "<dir %s>"%"".join( "%s: %s"% (k, v.desc_contents()) for k, v in self.contents.iteritems())
def desc_contents(self): if self.isfile(): return "<file %s>"%self.name elif self.isdir(): return "<dir %s>"%"".join( "%s: %s"% (k, v.desc_contents()) for k, v in self.contents.iteritems())
448,947
def __str__(self): return "%s: %s" % (self.name, self.desc_contents())
def __str__(self): return "%s: %s" % (self.name, self.desc_contents())
448,948
def Cleanup(self, path, info): pass
def Cleanup(self, path, info): pass
448,949
def CloseFile(self, path, info): path = normpath(path) if info.contents.DeleteOnClose: assert path in self._pending_delete if info.contents.IsDirectory: self.fs.removedir(path) self._pending_delete.remove(path) else: (file,_,lock) = self._get_file(info.contents.Context) lock.acquire() try: file.close() self.fs.remove(p...
def CloseFile(self, path, info): path = normpath(path) if info.contents.DeleteOnClose: if info.contents.IsDirectory: self.fs.removedir(path) self._pending_delete.remove(path) else: (file,_,lock) = self._get_file(info.contents.Context) lock.acquire() try: file.close() self.fs.remove(path) self._pending_delete.remove(pat...
448,950
def WriteFile(self, path, buffer, nBytesToWrite, nBytesWritten, offset, info): path = normpath(path) (file,_,lock) = self._get_file(info.contents.Context) lock.acquire() try: file.seek(offset) data = ctypes.create_string_buffer(nBytesToWrite) ctypes.memmove(data,buffer,nBytesToWrite) file.write(data.raw) nBytesWritten[...
def WriteFile(self, path, buffer, nBytesToWrite, nBytesWritten, offset, info): path = normpath(path) (file,_,lock) = self._get_file(info.contents.Context) lock.acquire() try: if info.contents.WriteToEndOfFile: file.seek(0,os.SEEK_END) else: file.seek(offset) data = ctypes.create_string_buffer(nBytesToWrite) ctypes.memm...
448,951
def DeleteDirectory(self, path, info): path = normpath(path) if self.fs.listdir(path): raise DirectoryNotEmptyError(path) self._pending_delete.add(path) # the actual delete takes place in self.CloseFile()
def DeleteDirectory(self, path, info): path = normpath(path) for nm in self.fs.listdir(path): if not self._is_pending_delete(pathjoin(path,nm)): raise DirectoryNotEmptyError(path) self._pending_delete.add(path) # the actual delete takes place in self.CloseFile()
448,952
def _datetime2filetime(dtime): """Convert a FILETIME struct info datetime.datetime object.""" if dtime is None: return libdokan.FILETIME(0,0) if dtime == DATETIME_ZERO: return libdokan.FILETIME(0,0) return _timestamp2filetime(_datetime2timestamp(dtime))
def _datetime2filetime(dtime): """Convert a FILETIME struct info datetime.datetime object.""" if dtime is None: return libdokan.FILETIME(0,0) if dtime == DATETIME_ZERO: return libdokan.FILETIME(0,0) return _timestamp2filetime(_datetime2timestamp(dtime))
448,953
def mount(fs, drive, foreground=False, ready_callback=None, unmount_callback=None, **kwds): """Mount the given FS at the given drive letter, using Dokan. By default, this function spawns a new background process to manage the Dokan event loop. The return value in this case is an instance of the 'MountProcess' class, ...
def def check_alive(mp): if mp and mp.poll() != None: raise OSError("dokan mount process exited prematurely") mount(fs, def check_alive(mp): if mp and mp.poll() != None: raise OSError("dokan mount process exited prematurely") drive, def check_alive(mp): if mp and mp.poll() != None: raise OSError("dokan mount process...
448,954
def check_ready(mp=None): if ready_callback is not False: for _ in xrange(100): try: os.stat(drive+":\\") except EnvironmentError: time.sleep(0.05) else: if mp and mp.poll() != None: raise OSError("dokan mount process exited prematurely") if ready_callback: return ready_callback()
def check_ready(mp=None): if ready_callback is not False: for _ in xrange(100): try: os.stat(drive+":\\") except EnvironmentError, e: check_alive(mp) time.sleep(0.05) else: if mp and mp.poll() != None: raise OSError("dokan mount process exited prematurely") if ready_callback: return ready_callback()
448,955
def check_ready(mp=None): if ready_callback is not False: for _ in xrange(100): try: os.stat(drive+":\\") except EnvironmentError: time.sleep(0.05) else: if mp and mp.poll() != None: raise OSError("dokan mount process exited prematurely") if ready_callback: return ready_callback()
def check_ready(mp=None): if ready_callback is not False: for _ in xrange(100): try: os.stat(drive+":\\") except EnvironmentError: time.sleep(0.05) else: check_alive(mp) if ready_callback: return ready_callback()
448,956
def check_ready(mp=None): if ready_callback is not False: for _ in xrange(100): try: os.stat(drive+":\\") except EnvironmentError: time.sleep(0.05) else: if mp and mp.poll() != None: raise OSError("dokan mount process exited prematurely") if ready_callback: return ready_callback()
def check_ready(mp=None): if ready_callback is not False: for _ in xrange(100): try: os.stat(drive+":\\") except EnvironmentError: time.sleep(0.05) else: if mp and mp.poll() != None: raise OSError("dokan mount process exited prematurely") if ready_callback: return ready_callback()
448,957
def __init__(self, fs, drive, dokan_opts={}, nowait=False, **kwds): self.drive = drive[:1] self.path = self.drive + ":\\" cmd = 'from fs.expose.dokan import MountProcess; ' cmd = cmd + 'MountProcess._do_mount(%s)' cmd = cmd % (repr(pickle.dumps((fs,drive,dokan_opts,nowait),-1)),) cmd = [sys.executable,"-c",cmd] super(M...
def __init__(self, fs, drive, dokan_opts={}, nowait=False, **kwds): self.drive = _normalise_drive_string(drive) self.path = self.drive + ":\\" cmd = 'from fs.expose.dokan import MountProcess; ' cmd = cmd + 'MountProcess._do_mount(%s)' cmd = cmd % (repr(pickle.dumps((fs,drive,dokan_opts,nowait),-1)),) cmd = [sys.executa...
448,958
def check(self,p): return self.mounted_fs.exists(p)
def check(self,p): return self.mounted_fs.exists(p)
448,959
def test_remove(self): self.fs.createfile("a.txt") self.assertTrue(self.check("a.txt")) self.fs.remove("a.txt") self.assertFalse(self.check("a.txt")) self.assertRaises(ResourceNotFoundError,self.fs.remove,"a.txt") self.fs.makedir("dir1") # This appears to be a bug in Dokan - DeleteFile will happily # delete an empty ...
def test_remove(self): self.fs.createfile("a.txt") self.assertTrue(self.check("a.txt")) self.fs.remove("a.txt") self.assertFalse(self.check("a.txt")) self.assertRaises(ResourceNotFoundError,self.fs.remove,"a.txt") self.fs.makedir("dir1") # This appears to be a bug in Dokan - DeleteFile will happily # delete an empty ...
448,960
def _info2finddataw(self,path,info,data=None,hinfo=None): """Convert a file/directory info dict into a WIN32_FIND_DATAW struct.""" if data is None: data = libdokan.WIN32_FIND_DATAW() data.dwFileAttributes = self._info2attrmask(path,info,hinfo) data.ftCreateTime = _datetime2filetime(info.get("created_time",None)) data.f...
def _info2finddataw(self,path,info,data=None,hinfo=None): """Convert a file/directory info dict into a WIN32_FIND_DATAW struct.""" if data is None: data = libdokan.WIN32_FIND_DATAW() data.dwFileAttributes = self._info2attrmask(path,info,hinfo) data.ftCreationTime = _datetime2filetime(info.get("created_time",None)) data...
448,961
def _sync_set_contents(self,key,contents): """Synchronously set the contents of a key.""" if isinstance(key,basestring): key = self._s3bukt.new_key(key) if isinstance(contents,basestring): key.set_contents_from_string(contents) else: try: contents.seek(0) except (AttributeError,EnvironmentError): tf = tempfile.Temporar...
def_sync_set_contents(self,key,contents):"""Synchronouslysetthecontentsofakey."""ifisinstance(key,basestring):key=self._s3bukt.new_key(key)ifisinstance(contents,basestring):key.set_contents_from_string(contents)else:try:contents.seek(0)except(AttributeError,EnvironmentError):tf=tempfile.TemporaryFile()data=contents.rea...
448,962
def exists(self,path): """Check whether a path exists.""" s3path = self._s3path(path) s3pathD = s3path + self._separator # The root directory always exists if self._prefix.startswith(s3path): return True ks = self._s3bukt.list(prefix=s3path,delimiter=self._separator) for k in ks: # A regular file if k.name == s3path: r...
def exists(self,path): """Check whether a path exists.""" s3path = self._s3path(path) s3pathD = s3path + self._separator # The root directory always exists if self._prefix.startswith(s3path): return True ks = self._s3bukt.list(prefix=s3path,delimiter=self._separator) for k in ks: # A regular file if _eq_utf8(k.name,s3p...
448,963
def exists(self,path): """Check whether a path exists.""" s3path = self._s3path(path) s3pathD = s3path + self._separator # The root directory always exists if self._prefix.startswith(s3path): return True ks = self._s3bukt.list(prefix=s3path,delimiter=self._separator) for k in ks: # A regular file if k.name == s3path: r...
def exists(self,path): """Check whether a path exists.""" s3path = self._s3path(path) s3pathD = s3path + self._separator # The root directory always exists if self._prefix.startswith(s3path): return True ks = self._s3bukt.list(prefix=s3path,delimiter=self._separator) for k in ks: # A regular file if k.name == s3path: r...
448,964
def _filter_keys(self,path,keys,wildcard,full,absolute,dirs_only,files_only): """Filter out keys not matching the given criteria.
def _filter_keys(self,path,keys,wildcard,full,absolute,dirs_only,files_only): """Filter out keys not matching the given criteria.
448,965
def _filter_keys(self,path,keys,wildcard,full,absolute,dirs_only,files_only): """Filter out keys not matching the given criteria.
def _filter_keys(self,path,keys,wildcard,full,absolute,dirs_only,files_only): """Filter out keys not matching the given criteria.
448,966
def makedir(self,path,recursive=False,allow_recreate=False): """Create a directory at the given path.
def makedir(self,path,recursive=False,allow_recreate=False): """Create a directory at the given path.
448,967
def makedir(self,path,recursive=False,allow_recreate=False): """Create a directory at the given path.
def makedir(self,path,recursive=False,allow_recreate=False): """Create a directory at the given path.
448,968
def remove(self,path): """Remove the file at the given path.""" s3path = self._s3path(path) ks = self._s3bukt.list(prefix=s3path,delimiter=self._separator) for k in ks: if k.name == s3path: break if k.name.startswith(s3path + "/"): raise ResourceInvalidError(path,msg="that's not a file: %(path)s") else: raise ResourceN...
def remove(self,path): """Remove the file at the given path.""" s3path = self._s3path(path) ks = self._s3bukt.list(prefix=s3path,delimiter=self._separator) for k in ks: if _eq_utf8(k.name,s3path): break if k.name.startswith(s3path + "/"): raise ResourceInvalidError(path,msg="that's not a file: %(path)s") else: raise Re...
448,969
def remove(self,path): """Remove the file at the given path.""" s3path = self._s3path(path) ks = self._s3bukt.list(prefix=s3path,delimiter=self._separator) for k in ks: if k.name == s3path: break if k.name.startswith(s3path + "/"): raise ResourceInvalidError(path,msg="that's not a file: %(path)s") else: raise ResourceN...
def remove(self,path): """Remove the file at the given path.""" s3path = self._s3path(path) ks = self._s3bukt.list(prefix=s3path,delimiter=self._separator) for k in ks: if k.name == s3path: break if _startswith_utf8(k.name,s3path + "/"): raise ResourceInvalidError(path,msg="that's not a file: %(path)s") else: raise Res...
448,970
def removedir(self,path,recursive=False,force=False): """Remove the directory at the given path.""" s3path = self._s3path(path) if s3path != self._prefix: s3path = s3path + self._separator if force: # If we will be forcibly removing any directory contents, we # might as well get the un-delimited list straight away. k...
def removedir(self,path,recursive=False,force=False): """Remove the directory at the given path.""" s3path = self._s3path(path) if s3path != self._prefix: s3path = s3path + self._separator if force: # If we will be forcibly removing any directory contents, we # might as well get the un-delimited list straight away. k...
448,971
def rename(self,src,dst): """Rename the file at 'src' to 'dst'.""" # Actually, in S3 'rename' is exactly the same as 'move' self.move(src,dst)
def rename(self,src,dst): """Rename the file at 'src' to 'dst'.""" # Actually, in S3 'rename' is exactly the same as 'move' self.move(src,dst)
448,972
def copy(self,src,dst,overwrite=False,chunk_size=16384): """Copy a file from 'src' to 'dst'.
def copy(self,src,dst,overwrite=False,chunk_size=16384): """Copy a file from 'src' to 'dst'.
448,973
def copy(self,src,dst,overwrite=False,chunk_size=16384): """Copy a file from 'src' to 'dst'.
def copy(self,src,dst,overwrite=False,chunk_size=16384): """Copy a file from 'src' to 'dst'.
448,974
def truncate(self,size=None): self._lock.acquire() try: if isinstance(self.file,SpooledTemporaryFile): # SpooledTemporaryFile.truncate doesn't accept size argument. self.file._file.truncate(size) else: self.file.truncate(size) self.flush() finally: self._lock.release()
def truncate(self,size=None): self._lock.acquire() try: if isinstance(self.file,SpooledTemporaryFile): # SpooledTemporaryFile.truncate doesn't accept size argument. if size is None: self.file._file.truncate() else: self.file._file.truncate(size) else: self.file.truncate(size) self.flush() finally: self._lock.release()
448,975
def Cleanup(self, path, info): path = normpath(path) if info.contents.DeleteOnClose: if info.contents.IsDirectory: self.fs.removedir(path) self._pending_delete.remove(path) else: (file,_,lock) = self._get_file(info.contents.Context) lock.acquire() try: file.close() self.fs.remove(path) self._pending_delete.remove(path)...
def Cleanup(self, path, info): path = normpath(path) if info.contents.DeleteOnClose: if info.contents.IsDirectory: self.fs.removedir(path) self._pending_delete.remove(path) else: (file,_,lock) = self._get_file(info.contents.Context) lock.acquire() try: file.close() self.fs.remove(path) self._pending_delete.remove(path)...
448,976
def Cleanup(self, path, info): path = normpath(path) if info.contents.DeleteOnClose: if info.contents.IsDirectory: self.fs.removedir(path) self._pending_delete.remove(path) else: (file,_,lock) = self._get_file(info.contents.Context) lock.acquire() try: file.close() self.fs.remove(path) self._pending_delete.remove(path)...
def Cleanup(self, path, info): path = normpath(path) if info.contents.DeleteOnClose: if info.contents.IsDirectory: self.fs.removedir(path) self._pending_delete.remove(path) else: (file,_,lock) = self._get_file(info.contents.Context) lock.acquire() try: file.close() self.fs.remove(path) self._pending_delete.remove(path)...
448,977
def listdir(self,path="./",wildcard=None,full=False,absolute=False,dirs_only=False,files_only=False): """List contents of a directory.""" keys = self._list_keys(path) entries = self._filter_keys(path,keys,wildcard,full,absolute,dirs_only,files_only) return [nm for (nm,k) in entries]
def listdir(self,path="./",wildcard=None,full=False,absolute=False,dirs_only=False,files_only=False): """List contents of a directory.""" return list(self.ilistdir(path,wildcard,full,absolute,dirs_only,files_only)) def listdirinfo(self,path="./",wildcard=None,full=False,absolute=False,dirs_only=False,files_only=False)...
448,978
def listdir(self,path="./",wildcard=None,full=False,absolute=False,dirs_only=False,files_only=False): """List contents of a directory.""" keys = self._list_keys(path) entries = self._filter_keys(path,keys,wildcard,full,absolute,dirs_only,files_only) return [nm for (nm,k) in entries]
def listdir(self,path="./",wildcard=None,full=False,absolute=False,dirs_only=False,files_only=False): """List contents of a directory.""" keys = self._list_keys(path) entries = self._filter_keys(path,keys,wildcard,full,absolute,dirs_only,files_only) return [nm for (nm,k) in entries]
448,979
def listdirinfo(self,path="./",wildcard=None,full=False,absolute=False,dirs_only=False,files_only=False): keys = self._list_keys(path) entries = self._filter_keys(path,keys,wildcard,full,absolute,dirs_only,files_only) return [(nm,self._get_key_info(k)) for (nm,k) in entries]
def listdirinfo(self,path="./",wildcard=None,full=False,absolute=False,dirs_only=False,files_only=False): keys = self._list_keys(path) entries = self._filter_keys(path,keys,wildcard,full,absolute,dirs_only,files_only) return [(nm,self._get_key_info(k)) for (nm,k) in entries]
448,980
def _list_keys(self,path): s3path = self._s3path(path) + self._separator if s3path == "/": s3path = "" i = len(s3path) keys = [] isDir = False for k in self._s3bukt.list(prefix=s3path,delimiter=self._separator): if not isDir: isDir = True # Skip over the entry for the directory itself, if it exists if k.name[i:] != "":...
def _list_keys(self,path): s3path = self._s3path(path) + self._separator if s3path == "/": s3path = "" i = len(s3path) isDir = False for k in self._s3bukt.list(prefix=s3path,delimiter=self._separator): if not isDir: isDir = True # Skip over the entry for the directory itself, if it exists if k.name[i:] != "": k.name = ...
448,981
def _list_keys(self,path): s3path = self._s3path(path) + self._separator if s3path == "/": s3path = "" i = len(s3path) keys = [] isDir = False for k in self._s3bukt.list(prefix=s3path,delimiter=self._separator): if not isDir: isDir = True # Skip over the entry for the directory itself, if it exists if k.name[i:] != "":...
def _list_keys(self,path): s3path = self._s3path(path) + self._separator if s3path == "/": s3path = "" i = len(s3path) keys = [] isDir = False for k in self._s3bukt.list(prefix=s3path,delimiter=self._separator): if not isDir: isDir = True # Skip over the entry for the directory itself, if it exists if k.name[i:] != "":...
448,982
def _list_keys(self,path): s3path = self._s3path(path) + self._separator if s3path == "/": s3path = "" i = len(s3path) keys = [] isDir = False for k in self._s3bukt.list(prefix=s3path,delimiter=self._separator): if not isDir: isDir = True # Skip over the entry for the directory itself, if it exists if k.name[i:] != "":...
def _list_keys(self,path): s3path = self._s3path(path) + self._separator if s3path == "/": s3path = "" i = len(s3path) keys = [] isDir = False for k in self._s3bukt.list(prefix=s3path,delimiter=self._separator): if not isDir: isDir = True # Skip over the entry for the directory itself, if it exists if k.name[i:] != "":...
448,983
def _filter_keys(self,path,keys,wildcard,full,absolute,dirs_only,files_only): """Filter out keys not matching the given criteria.
def _filter_keys(self,path,keys,wildcard,full,absolute,dirs_only,files_only): """Filter out keys not matching the given criteria.
448,984
def _filter_keys(self,path,keys,wildcard,full,absolute,dirs_only,files_only): """Filter out keys not matching the given criteria.
def _filter_keys(self,path,keys,wildcard,full,absolute,dirs_only,files_only): """Filter out keys not matching the given criteria.
448,985
def _filter_keys(self,path,keys,wildcard,full,absolute,dirs_only,files_only): """Filter out keys not matching the given criteria.
def _filter_keys(self,path,keys,wildcard,full,absolute,dirs_only,files_only): """Filter out keys not matching the given criteria.
448,986
def _filter_keys(self,path,keys,wildcard,full,absolute,dirs_only,files_only): """Filter out keys not matching the given criteria.
def _filter_keys(self,path,keys,wildcard,full,absolute,dirs_only,files_only): """Filter out keys not matching the given criteria.
448,987
def _filter_keys(self,path,keys,wildcard,full,absolute,dirs_only,files_only): """Filter out keys not matching the given criteria.
def _filter_keys(self,path,keys,wildcard,full,absolute,dirs_only,files_only): """Filter out keys not matching the given criteria.
448,988
def _filter_keys(self,path,keys,wildcard,full,absolute,dirs_only,files_only): """Filter out keys not matching the given criteria.
def _filter_keys(self,path,keys,wildcard,full,absolute,dirs_only,files_only): """Filter out keys not matching the given criteria.
448,989
def _filter_keys(self,path,keys,wildcard,full,absolute,dirs_only,files_only): """Filter out keys not matching the given criteria.
def _filter_keys(self,path,keys,wildcard,full,absolute,dirs_only,files_only): """Filter out keys not matching the given criteria.
448,990
def __init__(self, root_path, thread_synchronize=_thread_synchronize_default, encoding=None, create=False, dir_mode=0700): """ Creates an FS object that represents the OS Filesystem under a given root path
def __init__(self, root_path, thread_synchronize=_thread_synchronize_default, encoding=None, create=False, dir_mode=0700): """ Creates an FS object that represents the OS Filesystem under a given root path
448,991
def _s3bukt(self): try: return self._tlocal.s3bukt except AttributeError: try: b = self._s3conn.get_bucket(self._bucket_name) except S3ResponseError, e: if "404 Not Found" not in str(e): raise e b = self._s3conn.create_bucket(self._bucket_name) self._tlocal.s3bukt = b return b
def _s3bukt(self): try: return self._tlocal.s3bukt except AttributeError: try: b = self._s3conn.get_bucket(self._bucket_name, validate=True) except S3ResponseError, e: if "404 Not Found" not in str(e): raise e b = self._s3conn.create_bucket(self._bucket_name) self._tlocal.s3bukt = b return b
448,992
def _s3bukt(self): try: return self._tlocal.s3bukt except AttributeError: try: b = self._s3conn.get_bucket(self._bucket_name) except S3ResponseError, e: if "404 Not Found" not in str(e): raise e b = self._s3conn.create_bucket(self._bucket_name) self._tlocal.s3bukt = b return b
def _s3bukt(self): try: return self._tlocal.s3bukt except AttributeError: try: b = self._s3conn.get_bucket(self._bucket_name) except S3ResponseError, e: if "404 Not Found" not in str(e): raise b = self._s3conn.create_bucket(self._bucket_name) self._tlocal.s3bukt = b return b
448,993
def listdirinfo(self,path="./",wildcard=None,full=False,absolute=False,dirs_only=False,files_only=False): keys = self._list_keys(path) entries = self._listdir_helper(path,keys,wildcard,full,absolute,dirs_only,files_only) return [(nm,self._get_key_info(k)) for (nm,k) in entries]
def listdirinfo(self,path="./",wildcard=None,full=False,absolute=False,dirs_only=False,files_only=False): keys = self._list_keys(path) entries = self._filter_keys(path,keys,wildcard,full,absolute,dirs_only,files_only) return [(nm,self._get_key_info(k)) for (nm,k) in entries]
448,994
def _filter_keys(self,path,keys,wildcard,full,absolute,info,dirs_only,files_only): """Filter out keys not matching the given criteria.
def _filter_keys(self,path,keys,wildcard,full,absolute,dirs_only,files_only): """Filter out keys not matching the given criteria.
448,995
def removedir(self,path,recursive=False,force=False): """Remove the directory at the given path.""" s3path = self._s3path(path) if s3path != self._prefix: s3path = s3path + self._separator if force: # If we will be forcibly removing any directory contents, we # might as well get the un-delimited list straight away. k...
def removedir(self,path,recursive=False,force=False): """Remove the directory at the given path.""" s3path = self._s3path(path) if s3path != self._prefix: s3path = s3path + self._separator if force: # If we will be forcibly removing any directory contents, we # might as well get the un-delimited list straight away. k...
448,996
def getsyspath(self, path, allow_none=False): fs, mount_path, delegate_path = self._delegate(path) if fs is self: if allow_none: return None else: raise NoSysPathError(path=path) return fs.getsyspath(delegate_path, allow_none=allow_none)
def getsyspath(self, path, allow_none=False): fs, mount_path, delegate_path = self._delegate(path) if fs is self or fs is None: if allow_none: return None else: raise NoSysPathError(path=path) return fs.getsyspath(delegate_path, allow_none=allow_none)
448,997
def clone(self,fs=None,path=None,data_changed=None): evt = super(MODIFIED,self).clone() if data_changed is None: data_changed = self.data_changed evt.data_changd = data_changed return evt
def clone(self,fs=None,path=None,data_changed=None): evt = super(MODIFIED,self).clone(fs,path) if data_changed is None: data_changed = self.data_changed evt.data_changd = data_changed return evt
448,998
def clone(self,fs=None,path=None,source=None): evt = super(MOVED_DST,self).clone() if source is None: source = self.source evt.source = source return evt
def clone(self,fs=None,path=None,source=None): evt = super(MOVED_DST,self).clone(fs,path) if source is None: source = self.source evt.source = source return evt
448,999