Return a string which is the relative part of the path to the given 'relpath'.
(self, relpath)
| 429 | return FNMatcher(pattern)(self) |
| 430 | |
| 431 | def relto(self, relpath): |
| 432 | """Return a string which is the relative part of the path |
| 433 | to the given 'relpath'. |
| 434 | """ |
| 435 | if not isinstance(relpath, str | LocalPath): |
| 436 | raise TypeError(f"{relpath!r}: not a string or path object") |
| 437 | strrelpath = str(relpath) |
| 438 | if strrelpath and strrelpath[-1] != self.sep: |
| 439 | strrelpath += self.sep |
| 440 | # assert strrelpath[-1] == self.sep |
| 441 | # assert strrelpath[-2] != self.sep |
| 442 | strself = self.strpath |
| 443 | if sys.platform == "win32" or getattr(os, "_name", None) == "nt": |
| 444 | if os.path.normcase(strself).startswith(os.path.normcase(strrelpath)): |
| 445 | return strself[len(strrelpath) :] |
| 446 | elif strself.startswith(strrelpath): |
| 447 | return strself[len(strrelpath) :] |
| 448 | return "" |
| 449 | |
| 450 | def ensure_dir(self, *args): |
| 451 | """Ensure the path joined with args is a directory.""" |
no outgoing calls
no test coverage detected