- return re.escape(char)
-
-def _wildcard_glob_to_regex(glob):
- """Converts a single wildcard glob to a regex STRING."""
-
- # If it looks like a filename, make it not one
- if '.' in glob or '/' in glob:
- _, filename = os.path.split(glob)
- table_name, _ = os.path.splitext(filename)
- glob = table_name
-
- return u''.join(map(_wildcard_char_to_regex, glob))
-
-def _wildcards_to_regex(strings):
- """Converts a list of wildcard globs to a single regex object."""
-
- regex_parts = map(_wildcard_glob_to_regex, strings)
-
- regex = '^(?:' + '|'.join(regex_parts) + ')$'
-
- return re.compile(regex)