MCPcopy Index your code
hub / github.com/python/cpython / from_uri

Method from_uri

Lib/pathlib/__init__.py:1470–1480  ·  view source on GitHub ↗

Return a new path from the given 'file' URI.

(cls, uri)

Source from the content-addressed store, hash-verified

1468
1469 @classmethod
1470 def from_uri(cls, uri):
1471 """Return a new path from the given 'file' URI."""
1472 from urllib.error import URLError
1473 from urllib.request import url2pathname
1474 try:
1475 path = cls(url2pathname(uri, require_scheme=True))
1476 except URLError as exc:
1477 raise ValueError(exc.reason) from None
1478 if not path.is_absolute():
1479 raise ValueError(f"URI is not absolute: {uri!r}")
1480 return path
1481
1482
1483class PosixPath(Path, PurePosixPath):

Calls 3

url2pathnameFunction · 0.90
is_absoluteMethod · 0.80
clsClass · 0.50