/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/lazy_regex.py

  • Committer: Jelmer Vernooij
  • Date: 2017-07-23 22:06:41 UTC
  • mfrom: (6738 trunk)
  • mto: This revision was merged to the branch mainline in revision 6739.
  • Revision ID: jelmer@jelmer.uk-20170723220641-69eczax9bmv8d6kk
Merge trunk, address review comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
from . import errors
32
32
 
33
33
 
 
34
class InvalidPattern(errors.BzrError):
 
35
 
 
36
    _fmt = ('Invalid pattern(s) found. %(msg)s')
 
37
 
 
38
    def __init__(self, msg):
 
39
        self.msg = msg
 
40
 
 
41
 
34
42
class LazyRegex(object):
35
43
    """A proxy around a real regex, which won't be compiled until accessed."""
36
44
 
71
79
        except re.error as e:
72
80
            # raise InvalidPattern instead of re.error as this gives a
73
81
            # cleaner message to the user.
74
 
            raise errors.InvalidPattern('"' + args[0] + '" ' +str(e))
 
82
            raise InvalidPattern('"' + args[0] + '" ' +str(e))
75
83
 
76
84
    def __getstate__(self):
77
85
        """Return the state to use when pickling."""