MCPcopy Create free account
hub / github.com/twisted/twisted / touch

Method touch

src/twisted/python/filepath.py:1447–1460  ·  view source on GitHub ↗

Updates the access and last modification times of the file at this file path to the current time. Also creates the file if it does not already exist. @raise Exception: if unable to create or modify the last modification time of the file.

(self)

Source from the content-addressed store, hash-verified

1445 return f"FilePath({self.path!r})"
1446
1447 def touch(self) -> None:
1448 """
1449 Updates the access and last modification times of the file at this
1450 file path to the current time. Also creates the file if it does not
1451 already exist.
1452
1453 @raise Exception: if unable to create or modify the last modification
1454 time of the file.
1455 """
1456 try:
1457 self.open("a").close()
1458 except OSError:
1459 pass
1460 utime(self.path, None)
1461
1462 def remove(self) -> None:
1463 """

Calls 2

openMethod · 0.95
closeMethod · 0.45