Returns True if the path exists and is a file Example: >>> f = SSHPath('is_file', ssh=ssh_conn) >>> f.is_file() False >>> f.touch() >>> f.is_file() True >>> f.unlink() >>> f.mkdir()
(self)
| 725 | return False |
| 726 | |
| 727 | def is_file(self): |
| 728 | """Returns True if the path exists and is a file |
| 729 | |
| 730 | Example: |
| 731 | |
| 732 | >>> f = SSHPath('is_file', ssh=ssh_conn) |
| 733 | >>> f.is_file() |
| 734 | False |
| 735 | >>> f.touch() |
| 736 | >>> f.is_file() |
| 737 | True |
| 738 | >>> f.unlink() |
| 739 | >>> f.mkdir() |
| 740 | >>> f.is_file() |
| 741 | False |
| 742 | """ |
| 743 | if not self.exists(): |
| 744 | return False |
| 745 | |
| 746 | if self.stat().st_mode & 0o040000: |
| 747 | return False |
| 748 | |
| 749 | return True |
| 750 | |
| 751 | def is_symlink(self): |
| 752 | raise NotImplementedError() |
no test coverage detected