Return the path as a URI.
(self)
| 526 | return False |
| 527 | |
| 528 | def as_uri(self): |
| 529 | """Return the path as a URI.""" |
| 530 | import warnings |
| 531 | msg = ("pathlib.PurePath.as_uri() is deprecated and scheduled " |
| 532 | "for removal in Python 3.19. Use pathlib.Path.as_uri().") |
| 533 | warnings._deprecated("pathlib.PurePath.as_uri", msg, remove=(3, 19)) |
| 534 | if not self.is_absolute(): |
| 535 | raise ValueError("relative path can't be expressed as a file URI") |
| 536 | |
| 537 | drive = self.drive |
| 538 | if len(drive) == 2 and drive[1] == ':': |
| 539 | # It's a path on a local drive => 'file:///c:/a/b' |
| 540 | prefix = 'file:///' + drive |
| 541 | path = self.as_posix()[2:] |
| 542 | elif drive: |
| 543 | # It's a path on a network drive => 'file://host/share/a/b' |
| 544 | prefix = 'file:' |
| 545 | path = self.as_posix() |
| 546 | else: |
| 547 | # It's a posix path => 'file:///etc/hosts' |
| 548 | prefix = 'file://' |
| 549 | path = str(self) |
| 550 | from urllib.parse import quote_from_bytes |
| 551 | return prefix + quote_from_bytes(os.fsencode(path)) |
| 552 | |
| 553 | def full_match(self, pattern, *, case_sensitive=None): |
| 554 | """ |
nothing calls this directly
no test coverage detected