| | 1567 | def delete_files(self): |
|---|
| | 1568 | """ |
|---|
| | 1569 | Deletes all of the files associated with this cell. |
|---|
| | 1570 | |
|---|
| | 1571 | EXAMPLES: |
|---|
| | 1572 | sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir()) |
|---|
| | 1573 | sage: nb.add_user('sage','sage','sage@sagemath.org',force=True) |
|---|
| | 1574 | sage: W = nb.create_new_worksheet('Test', 'sage') |
|---|
| | 1575 | sage: C = sage.server.notebook.cell.Cell(0, 'plot(sin(x),0,5)', '', W) |
|---|
| | 1576 | sage: C.evaluate() |
|---|
| | 1577 | sage: W.check_comp(wait=9999) |
|---|
| | 1578 | ('d', Cell 0; in=plot(sin(x),0,5), out= |
|---|
| | 1579 | <BLANKLINE> |
|---|
| | 1580 | ) |
|---|
| | 1581 | sage: C.files() |
|---|
| | 1582 | ['sage0.png'] |
|---|
| | 1583 | sage: C.delete_files() |
|---|
| | 1584 | sage: C.files() |
|---|
| | 1585 | [] |
|---|
| | 1586 | |
|---|
| | 1587 | """ |
|---|
| | 1588 | try: |
|---|
| | 1589 | dir = self._directory_name() |
|---|
| | 1590 | except AttributeError: |
|---|
| | 1591 | return |
|---|
| | 1592 | if os.path.exists(dir): |
|---|
| | 1593 | shutil.rmtree(dir, ignore_errors=True) |
|---|
| | 1594 | |
|---|
| | 1595 | |
|---|
| | 1596 | |
|---|