def touch(self, mode=0o666, exist_ok=True):
        """
        Create this file with the given access mode, if it doesn't exist.
        """
        if self._closed:
            self._raise_closed()
        if exist_ok:
            # First try to bump modification time
            # Implementation note: GNU touch uses the UTIME_NOW option of
            # the utimensat() / futimens() functions.
            try:
                self._accessor.utime(self, None)
            except OSError:
                # Avoid exception chaining
                pass
            else:
                return
        flags = os.O_CREAT | os.O_WRONLY
        if not exist_ok:
            flags |= os.O_EXCL
        fd = self._raw_open(flags, mode)
        os.close(fd)
def touch ( self , mode = 0o666 , exist_ok = True ) : if self . _closed : self . _raise_closed ( ) if exist_ok : try : self . _accessor . utime ( self , None ) except OSError : pass else : return flags = os . O_CREAT | os . O_WRONLY if not exist_ok : flags |= os . O_EXCL fd = self . _raw_open ( flags , mode ) os . close ( fd )
Create this file with the given access mode, if it doesn't exist.