Skip to main content

NameProtocol

NameProtocol Objects

class NameProtocol(typing.Protocol)

format

def format(format: NameFormat) -> str

Formats a name into a string based on the available output formats. The default separator is .

is_sln

def is_sln() -> bool

Returns whether this name is a second-level name (Ex. test.iota)

is_subname

def is_subname() -> bool

Returns whether this name is a subname (Ex. sub.test.iota)

label

def label(index: int) -> typing.Optional[str]

Get the label at the given index

labels

def labels() -> typing.List[str]

Get all of the labels. NOTE: These are in reverse order starting with the top-level name and proceeding to subnames.

num_labels

def num_labels() -> int

Returns the number of labels including TLN.

parent

def parent() -> typing.Optional[Name]

parents; second-level names return None.