The patch in review includes a PathBase.as_uri()
method that raises UnsupportedOperation
. I expect that some subclasses of PathBase
will override that method, e.g. to return s3://
or ftp://
URIs.
Q: Should we add a symmetrical PathBase.from_uri()
classmethod? This would provide an explicit means to contruct a path object (and its backend) from a URI - for example, an FTPPath.from_uri()
method could parse the host/port/user/passwd from the URI, construct an ftplib.FTP
object, and then wrap it in an FTPPath
object.
For Path.from_uri()
(local paths), I have a local branch that handles RFC 8089 file:
URIs, including the weird ones with 4 or 5 leading slashes, such as those produced by urllib.request.pathname2url()
.