b.r.Stanza(object) : class documentation

Part of bzrlib.rio View In Hierarchy

One stanza for rio.

Each stanza contains a set of named fields.

Names must be non-empty ascii alphanumeric plus _. Names can be repeated within a stanza. Names are case-sensitive. The ordering of fields is preserved.

Each field value must be either an int or a string.

Method __init__ Construct a new Stanza.
Method add Append a name and value to the stanza.
Class Method from_pairs Undocumented
Method __contains__ True if there is any field in this stanza with the given tag.
Method __len__ Return number of pairs in the stanza.
Method __eq__ Undocumented
Method __ne__ Undocumented
Method __repr__ Undocumented
Method iter_pairs Return iterator of tag, value pairs.
Method to_lines Generate sequence of lines for external version of this file.
Method to_string Return stanza as a single string
Method to_unicode Return stanza as a single Unicode string.
Method write Write stanza to a file
Method get Return the value for a field wih given tag.
Method get_all Undocumented
Method as_dict Return a dict containing the unique values of the stanza.
def __init__(self, **kwargs):
Construct a new Stanza.

The keyword arguments, if any, are added in sorted order to the stanza.

def add(self, tag, value):
Append a name and value to the stanza.
@classmethod
def from_pairs(cls, pairs):
Undocumented
def __contains__(self, find_tag):
True if there is any field in this stanza with the given tag.
def __len__(self):
Return number of pairs in the stanza.
def __eq__(self, other):
Undocumented
def __ne__(self, other):
Undocumented
def __repr__(self):
Undocumented
def iter_pairs(self):
Return iterator of tag, value pairs.
def to_lines(self):
Generate sequence of lines for external version of this file.

The lines are always utf-8 encoded strings.

def to_string(self):
Return stanza as a single string
def to_unicode(self):
Return stanza as a single Unicode string.

This is most useful when adding a Stanza to a parent Stanza

def write(self, to_file):
Write stanza to a file
def get(self, tag):
Return the value for a field wih given tag.

If there is more than one value, only the first is returned. If the tag is not present, KeyError is raised.

def get_all(self, tag):
Undocumented
def as_dict(self):
Return a dict containing the unique values of the stanza.
API Documentation for Bazaar, generated by pydoctor at 2019-09-16 00:30:59.