Whether this path is a regular file.
(self, *, follow_symlinks=True)
| 688 | return S_ISDIR(st.st_mode) |
| 689 | |
| 690 | def is_file(self, *, follow_symlinks=True): |
| 691 | """Whether this path is a regular file.""" |
| 692 | if self._entry: |
| 693 | try: |
| 694 | return self._entry.is_file(follow_symlinks=follow_symlinks) |
| 695 | except OSError: |
| 696 | return False |
| 697 | if follow_symlinks: |
| 698 | if self._stat_result is _STAT_RESULT_ERROR: |
| 699 | return False |
| 700 | else: |
| 701 | if self._lstat_result is _STAT_RESULT_ERROR: |
| 702 | return False |
| 703 | try: |
| 704 | st = self._stat(follow_symlinks=follow_symlinks) |
| 705 | except (OSError, ValueError): |
| 706 | return False |
| 707 | return S_ISREG(st.st_mode) |
| 708 | |
| 709 | def is_symlink(self): |
| 710 | """Whether this path is a symbolic link.""" |