def touch(self, mode=0o666, exist_ok=True):
        """Create a fake file for the path with the given access mode,
        if it doesn't exist.

        Args:
            mode: the file mode for the file if it does not exist
            exist_ok: if the file already exists and this is True, nothing
                happens, otherwise FileExistError is raised

        Raises:
            OSError: (Python 2 only) if the file exists and exits_ok is False.
            FileExistsError: (Python 3 only) if the file exists and exits_ok is
                False.
        """
        if self._closed:
            self._raise_closed()
        if self.exists():
            if exist_ok:
                self.filesystem.utime(self._path(), None)
            else:
                self.filesystem.raise_os_error(errno.EEXIST, self._path())
        else:
            fake_file = self.open('w')
            fake_file.close()
            self.chmod(mode)
def touch ( self , mode = 0o666 , exist_ok = True ) : if self . _closed : self . _raise_closed ( ) if self . exists ( ) : if exist_ok : self . filesystem . utime ( self . _path ( ) , None ) else : self . filesystem . raise_os_error ( errno . EEXIST , self . _path ( ) ) else : fake_file = self . open ( 'w' ) fake_file . close ( ) self . chmod ( mode )
Create a fake file for the path with the given access mode,
        if it doesn't exist.

        Args:
            mode: the file mode for the file if it does not exist
            exist_ok: if the file already exists and this is True, nothing
                happens, otherwise FileExistError is raised

        Raises:
            OSError: (Python 2 only) if the file exists and exits_ok is False.
            FileExistsError: (Python 3 only) if the file exists and exits_ok is
                False.