URI

class esbonio.sphinx_agent.types.Uri(scheme, authority, path, query, fragment)[source]

Helper class for working with URIs.

as_fs_path(preserve_case=False)[source]

Return the file system path correspondin with this uri.

as_string(encode=True)[source]

Return a string representation of this Uri.

Parameters:

encode – If True (the default), encode any special characters.

Returns:

The string representation of the Uri

Return type:

str

classmethod create(*, scheme='', authority='', path='', query='', fragment='')[source]

Create a uri with the given attributes.

classmethod for_file(filepath)[source]

Create a uri based on the given filepath.

join(path)[source]

Join this Uri’s path component with the given path and return the resulting uri.

Parameters:

path (str) – The path segment to join

Returns:

The resulting uri

Return type:

Uri

classmethod parse(uri)[source]

Parse the given uri from its string representation.

resolve()[source]

Return the fully resolved version of this Uri.

where(**kwargs)[source]

Return an transformed version of this uri where certain components of the uri have been replace with the given arguments.

Passing a value of None will remove the given component entirely.

property fs_path: str | None

Return the equivalent fs path.