Jelajahi Sumber

patterns: explicate translate source

Marian Beermann 8 tahun lalu
induk
melakukan
c5e3232187
1 mengubah file dengan 2 tambahan dan 2 penghapusan
  1. 2 2
      src/borg/patterns.py

+ 2 - 2
src/borg/patterns.py

@@ -1,11 +1,11 @@
 import argparse
 import argparse
+import fnmatch
 import os.path
 import os.path
 import re
 import re
 import sys
 import sys
 import unicodedata
 import unicodedata
 from collections import namedtuple
 from collections import namedtuple
 from enum import Enum
 from enum import Enum
-from fnmatch import translate
 
 
 from . import shellpattern
 from . import shellpattern
 from .helpers import clean_lines
 from .helpers import clean_lines
@@ -258,7 +258,7 @@ class FnmatchPattern(PatternBase):
 
 
         # fnmatch and re.match both cache compiled regular expressions.
         # fnmatch and re.match both cache compiled regular expressions.
         # Nevertheless, this is about 10 times faster.
         # Nevertheless, this is about 10 times faster.
-        self.regex = re.compile(translate(self.pattern))
+        self.regex = re.compile(fnmatch.translate(self.pattern))
 
 
     def _match(self, path):
     def _match(self, path):
         return (self.regex.match(path + os.path.sep) is not None)
         return (self.regex.match(path + os.path.sep) is not None)