Support joining in CloudPath construction
The constructor signature of pathlib's path classes is actually:
class pathlib.PurePath(*pathsegments)
with behavior that follows os.path.join's behavior.
https://docs.python.org/3/library/pathlib.html#pathlib.PurePath
Is this something we should support? It adds some complexity, because we'd have to decide what to do or how to error with multiple URI schemes or if people use a root slash. (Some of the behavior from pathlib/os.path.join is kind of confusing.)
It would also make an AnyPath (#77) more faithful when dispatching to pathlib.
Reproducible example...
# cloudpathlib[gs]==0.16.0
>>> from cloudpathlib import AnyPath
>>> AnyPath('gs://my-bucket', 'my-filename.txt')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ppa-rmh358/.local/lib/python3.10/site-packages/cloudpathlib/anypath.py", line 22, in __new__
return CloudPath(*args, **kwargs) # type: ignore
File "/home/ppa-rmh358/.local/lib/python3.10/site-packages/cloudpathlib/cloudpath.py", line 159, in __call__
path_class.__init__(new_obj, cloud_path, *args, **kwargs) # type: ignore[type-var]
File "/home/ppa-rmh358/.local/lib/python3.10/site-packages/cloudpathlib/cloudpath.py", line 232, in __init__
raise ClientMismatchError(
cloudpathlib.exceptions.ClientMismatchError: Client of type [<class 'str'>] is not valid for cloud path of type [<class 'cloudpathlib.gs.gspath.GSPath'>]; must be instance of [<class 'cloudpathlib.gs.gsclient.GSClient'>], or None to use default client for this cloud path class.
This is implemented for CloudPath as part of https://github.com/drivendataorg/cloudpathlib/pull/322
This should go in when that PR does.