##// END OF EJS Templates
util: rename 're' to 'remod'...
Siddharth Agarwal -
r21907:7e5dfa00 default
parent child Browse files
Show More
@@ -15,7 +15,8 b' hide platform-specific details from the '
15
15
16 from i18n import _
16 from i18n import _
17 import error, osutil, encoding
17 import error, osutil, encoding
18 import errno, re, shutil, sys, tempfile, traceback
18 import errno, shutil, sys, tempfile, traceback
19 import re as remod
19 import os, time, datetime, calendar, textwrap, signal, collections
20 import os, time, datetime, calendar, textwrap, signal, collections
20 import imp, socket, urllib
21 import imp, socket, urllib
21
22
@@ -728,16 +729,16 b' def compilere(pat, flags=0):'
728 _re2 = bool(re2.match(r'\[([^\[]+)\]', '[ui]'))
729 _re2 = bool(re2.match(r'\[([^\[]+)\]', '[ui]'))
729 except ImportError:
730 except ImportError:
730 _re2 = False
731 _re2 = False
731 if _re2 and (flags & ~(re.IGNORECASE | re.MULTILINE)) == 0:
732 if _re2 and (flags & ~(remod.IGNORECASE | remod.MULTILINE)) == 0:
732 if flags & re.IGNORECASE:
733 if flags & remod.IGNORECASE:
733 pat = '(?i)' + pat
734 pat = '(?i)' + pat
734 if flags & re.MULTILINE:
735 if flags & remod.MULTILINE:
735 pat = '(?m)' + pat
736 pat = '(?m)' + pat
736 try:
737 try:
737 return re2.compile(pat)
738 return re2.compile(pat)
738 except re2.error:
739 except re2.error:
739 pass
740 pass
740 return re.compile(pat, flags)
741 return remod.compile(pat, flags)
741
742
742 _fspathcache = {}
743 _fspathcache = {}
743 def fspath(name, root):
744 def fspath(name, root):
@@ -761,7 +762,7 b' def fspath(name, root):'
761 seps = seps + os.altsep
762 seps = seps + os.altsep
762 # Protect backslashes. This gets silly very quickly.
763 # Protect backslashes. This gets silly very quickly.
763 seps.replace('\\','\\\\')
764 seps.replace('\\','\\\\')
764 pattern = re.compile(r'([^%s]+)|([%s]+)' % (seps, seps))
765 pattern = remod.compile(r'([^%s]+)|([%s]+)' % (seps, seps))
765 dir = os.path.normpath(root)
766 dir = os.path.normpath(root)
766 result = []
767 result = []
767 for part, sep in pattern.findall(name):
768 for part, sep in pattern.findall(name):
@@ -1565,7 +1566,7 b' def interpolate(prefix, mapping, s, fn=N'
1565 else:
1566 else:
1566 prefix_char = prefix
1567 prefix_char = prefix
1567 mapping[prefix_char] = prefix_char
1568 mapping[prefix_char] = prefix_char
1568 r = re.compile(r'%s(%s)' % (prefix, patterns))
1569 r = remod.compile(r'%s(%s)' % (prefix, patterns))
1569 return r.sub(lambda x: fn(mapping[x.group()[1:]]), s)
1570 return r.sub(lambda x: fn(mapping[x.group()[1:]]), s)
1570
1571
1571 def getport(port):
1572 def getport(port):
@@ -1680,7 +1681,7 b' class url(object):'
1680
1681
1681 _safechars = "!~*'()+"
1682 _safechars = "!~*'()+"
1682 _safepchars = "/!~*'()+:\\"
1683 _safepchars = "/!~*'()+:\\"
1683 _matchscheme = re.compile(r'^[a-zA-Z0-9+.\-]+:').match
1684 _matchscheme = remod.compile(r'^[a-zA-Z0-9+.\-]+:').match
1684
1685
1685 def __init__(self, path, parsequery=True, parsefragment=True):
1686 def __init__(self, path, parsequery=True, parsefragment=True):
1686 # We slowly chomp away at path until we have only the path left
1687 # We slowly chomp away at path until we have only the path left
General Comments 0
You need to be logged in to leave comments. Login now