Skip to content

Commit 7fffa09

Browse files
phlogistonjohnmergify[bot]
authored andcommitted
sambacc: add is_rados_uri helper function
Add `is_rados_uri` that will return true if a uri string containes a rados-specific scheme. Signed-off-by: John Mulligan <[email protected]>
1 parent 3c42c69 commit 7fffa09

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sambacc/rados_opener.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,14 @@ def create_from_uri(cls, uri: str) -> Self:
380380
return cls(handler, uri)
381381

382382

383+
def is_rados_uri(uri: str) -> bool:
384+
"""Return true if the string can be used as a rados (pseudo) URI.
385+
This function does not require the rados libraries to be available.
386+
NB: It does not validate the structure of the URI.
387+
"""
388+
return uri.startswith("rados:")
389+
390+
383391
def enable_rados_url_opener(
384392
cls: typing.Type[url_opener.URLOpener],
385393
*,

0 commit comments

Comments
 (0)