~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/rio.py

  • Committer: Martin Pool
  • Date: 2006-02-17 20:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 1569.
  • Revision ID: mbp@sourcefrog.net-20060217204603-7cbfc062067a1c06
New Rio.as_dict method

Show diffs side-by-side

added added

removed removed

Lines of Context:
171
171
            if t == tag:
172
172
                r.append(v)
173
173
        return r
 
174
 
 
175
    def as_dict(self):
 
176
        """Return a dict containing the unique values of the stanza.
 
177
        """
 
178
        d = {}
 
179
        for tag, value in self.items:
 
180
            assert tag not in d
 
181
            d[tag] = value
 
182
        return d
174
183
         
175
184
_tag_re = re.compile(r'^[-a-zA-Z0-9_]+$')
176
185
def valid_tag(tag):