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

  • Committer: John Arbash Meinel
  • Date: 2006-10-09 09:41:01 UTC
  • mto: This revision was merged to the branch mainline in revision 2069.
  • Revision ID: john@arbash-meinel.com-20061009094101-dd6f359aa5ae70a0
Add install and unistall functions, and tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
    """
83
83
    return LazyRegex(args, kwargs)
84
84
 
 
85
 
 
86
def install_lazy_compile():
 
87
    """Make lazy_compile the default compile mode for regex compilation.
 
88
 
 
89
    This overrides re.compile with lazy_compile. To restore the original
 
90
    functionality, call reset_compile().
 
91
    """
 
92
    re.compile = lazy_compile
 
93
 
 
94
 
 
95
def reset_compile():
 
96
    """Restore the original function to re.compile().
 
97
    
 
98
    It is safe to call reset_compile() multiple times, it will always
 
99
    restore re.compile() to the value that existed at import time.
 
100
    Though the first call will reset back to the original (it doesn't
 
101
    track nesting level)
 
102
    """
 
103
    re.compile = _real_re_compile