/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/_rio_py.py

  • Committer: Jelmer Vernooij
  • Date: 2018-07-08 14:45:27 UTC
  • mto: This revision was merged to the branch mainline in revision 7036.
  • Revision ID: jelmer@jelmer.uk-20180708144527-codhlvdcdg9y0nji
Fix a bunch of merge tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Python implementation of _read_stanza_*."""
18
18
 
 
19
from __future__ import absolute_import
 
20
 
19
21
import re
20
22
 
21
 
from bzrlib.rio import (
 
23
from .rio import (
22
24
    Stanza,
23
25
    )
24
26
 
25
27
_tag_re = re.compile(r'^[-a-zA-Z0-9_]+$')
26
28
def _valid_tag(tag):
27
 
    if type(tag) != str:
 
29
    if not isinstance(tag, str):
28
30
        raise TypeError(tag)
29
31
    return bool(_tag_re.match(tag))
30
32
 
32
34
def _read_stanza_utf8(line_iter):
33
35
    def iter_unicode_lines():
34
36
        for line in line_iter:
35
 
            if type(line) != str:
 
37
            if not isinstance(line, bytes):
36
38
                raise TypeError(line)
37
39
            yield line.decode('utf-8')
38
40
    return _read_stanza_unicode(iter_unicode_lines())