mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
Merged revisions 74493 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r74493 | tarek.ziade | 2009-08-17 23:28:34 +0200 (Mon, 17 Aug 2009) | 1 line fixed how fnmatch.translate is used (since it has changed in r74475 for #6665). Now the code is not harcoding the usage of $ anymore ........
This commit is contained in:
parent
8c6b0a5bcb
commit
74c23ac08d
2 changed files with 10 additions and 8 deletions
|
|
@ -312,7 +312,9 @@ def translate_pattern(pattern, anchor=1, prefix=None, is_regex=0):
|
|||
pattern_re = ''
|
||||
|
||||
if prefix is not None:
|
||||
prefix_re = (glob_to_re(prefix))[0:-1] # ditch trailing $
|
||||
# ditch end of pattern character
|
||||
empty_pattern = glob_to_re('')
|
||||
prefix_re = (glob_to_re(prefix))[:-len(empty_pattern)]
|
||||
pattern_re = "^" + os.path.join(prefix_re, ".*" + pattern_re)
|
||||
else: # no prefix -- respect anchor flag
|
||||
if anchor:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue