def fake_open(filename, flags, mode=511, _os_open=os.open):
 if (flags & ((os.O_RDWR | os.O_CREAT) | os.O_WRONLY)):
  raise OSError(errno.EROFS, 'Read-only file system', filename)
 elif (not FakeFile.is_file_accessible(filename)):
  raise OSError(errno.ENOENT, 'No such file or directory', filename)
 return _os_open(filename, flags, mode)

def fake_open ( filename , flags , mode = 511 , _os_open = os . open ) : if ( flags & ( ( os . O_RDWR | os . O_CREAT ) | os . O_WRONLY ) ) : raise OSError ( errno . EROFS , 'Read-only file system' , filename ) elif ( not FakeFile . is_file_accessible ( filename ) ) : raise OSError ( errno . ENOENT , 'No such file or directory' , filename ) return _os_open ( filename , flags , mode )
fake version of os .