Show More
@@ -358,9 +358,11 b' def expand_path(s):' | |||
|
358 | 358 | |
|
359 | 359 | def unescape_glob(string): |
|
360 | 360 | """Unescape glob pattern in `string`.""" |
|
361 | for pattern in '*[]!?': | |
|
362 | string = string.replace(r'\{0}'.format(pattern), pattern) | |
|
363 | return string | |
|
361 | def unescape(s): | |
|
362 | for pattern in '*[]!?': | |
|
363 | s = s.replace(r'\{0}'.format(pattern), pattern) | |
|
364 | return s | |
|
365 | return '\\'.join(map(unescape, string.split('\\\\'))) | |
|
364 | 366 | |
|
365 | 367 | |
|
366 | 368 | def shellglob(args): |
@@ -486,3 +486,7 b' def test_shellglob():' | |||
|
486 | 486 | |
|
487 | 487 | def test_unescape_glob(): |
|
488 | 488 | nt.assert_equals(path.unescape_glob(r'\*\[\!\]\?'), '*[!]?') |
|
489 | nt.assert_equals(path.unescape_glob(r'\\*'), r'\*') | |
|
490 | nt.assert_equals(path.unescape_glob(r'\\\*'), r'\*') | |
|
491 | nt.assert_equals(path.unescape_glob(r'\\a'), r'\a') | |
|
492 | nt.assert_equals(path.unescape_glob(r'\a'), r'\a') |
General Comments 0
You need to be logged in to leave comments.
Login now