| 1584 | |
| 1585 | |
| 1586 | class LocalFileClass: |
| 1587 | def __init__(self, file): |
| 1588 | self.file = file |
| 1589 | self.path = data_root / "local" / file |
| 1590 | if os.path.exists(self.path): |
| 1591 | self.ctime = time.strftime( |
| 1592 | "%Y-%m-%d %H:%M:%S", time.localtime(os.path.getctime(self.path)) |
| 1593 | ) |
| 1594 | self.size = os.path.getsize(self.path) |
| 1595 | else: |
| 1596 | self.ctime = None |
| 1597 | self.size = None |
| 1598 | |
| 1599 | async def read(self): |
| 1600 | return open(self.path, "rb") |
| 1601 | |
| 1602 | async def write(self, data): |
| 1603 | with open(self.path, "w") as f: |
| 1604 | f.write(data) |
| 1605 | |
| 1606 | async def delete(self): |
| 1607 | os.remove(self.path) |
| 1608 | |
| 1609 | async def exists(self): |
| 1610 | return os.path.exists(self.path) |
no outgoing calls
no test coverage detected