uri

class tinychain.uri.URI(subject, *path)[source]

Bases: object

An absolute or relative link to a State.

Examples:
URI("https://example.com/myservice/value_name")
URI("$other_state/method_name")
URI("/state/scalar/value/none")
append(suffix)[source]

Construct a new URI beginning with this URI and ending with the given suffix.

Example:
value = OpRef.Get(URI("http://example.com/myapp").append("value/name"))
extend(*segments)[source]
host()[source]

Return the host segment of this URI, if present.

id()[source]

Return the ID segment of this URI, if present.

is_id()[source]

Return True if this URI is a simple ID, like $foo.

static join(segments)[source]

Join the given segments together to make a new URI.

path()[source]

Return the path segment of this URI, if present.

port()[source]

Return the port of this URI, if present.

protocol()[source]

Return the protocol of this URI (e.g. “http”), if present.

split()[source]

Split this URI into its individual segments.

The host (if absolute) or ID (if relative) is treated as the first segment, if present.

startswith(prefix)[source]

Return True if this URI starts with the given prefix.

tinychain.uri.validate(name, state=None)[source]

Return the given name as allowed for use as a path segment in a URI, or raise a KeyError.