Return the common part shared with the other path, or None if there is no common part. If one path is relative and one is absolute, returns None.
(path1: Path, path2: Path)
| 666 | |
| 667 | |
| 668 | def commonpath(path1: Path, path2: Path) -> Optional[Path]: |
| 669 | """Return the common part shared with the other path, or None if there is |
| 670 | no common part. |
| 671 | |
| 672 | If one path is relative and one is absolute, returns None. |
| 673 | """ |
| 674 | try: |
| 675 | return Path(os.path.commonpath((str(path1), str(path2)))) |
| 676 | except ValueError: |
| 677 | return None |
| 678 | |
| 679 | |
| 680 | def bestrelpath(directory: Path, dest: Path) -> str: |
no outgoing calls