@@ -0,0 +1,1537 @@
+# coding: utf-8%0A%22%22%22This module provides support for Unix shell-style wildcards%22%22%22%0Afrom __future__ import unicode_literals, absolute_import%0A%0Aimport fnmatch%0A%0Afrom monty.string import list_strings%0A%0A%0Aclass WildCard(object):%0A    %22%22%22%0A    This object provides an easy-to-use interface for filename matching with%0A    shell patterns (fnmatch).%0A%0A    %3E%3E%3E w = WildCard(%22*.nc%7C*.pdf%22)%0A    %3E%3E%3E w.filter(%5B%22foo.nc%22, %22bar.pdf%22, %22hello.txt%22%5D)%0A    %5B'foo.nc', 'bar.pdf'%5D%0A%0A    %3E%3E%3E w.filter(%22foo.nc%22)%0A    %5B'foo.nc'%5D%0A    %22%22%22%0A    def __init__(self, wildcard, sep=%22%7C%22):%0A        %22%22%22%0A        Initializes a WildCard.%0A%0A        Args:%0A            wildcard (str): String of tokens separated by sep. Each token%0A                represents a pattern.%0A            sep (str): Separator for shell patterns.%0A        %22%22%22%0A        self.pats = %5B%22*%22%5D%0A        if wildcard:%0A            self.pats = wildcard.split(sep)%0A%0A    def __str__(self):%0A        return %22%3C%25s, patterns = %25s%3E%22 %25 (self.__class__.__name__, self.pats)%0A%0A    def filter(self, names):%0A        %22%22%22%0A        Returns a list with the names matching the pattern.%0A        %22%22%22%0A        names = list_strings(names)%0A%0A        fnames = %5B%5D%0A        for f in names:%0A            for pat in self.pats:%0A                if fnmatch.fnmatch(f, pat):%0A                    fnames.append(f)%0A%0A        return fnames%0A%0A    def match(self, name):%0A        %22%22%22%0A        Returns True if name matches one of the patterns.%0A        %22%22%22%0A        for pat in self.pats:%0A            if fnmatch.fnmatch(name, pat):%0A                return True%0A%0A        return False%0A

Revert "Remove WildCard module. Functionality is already available in glob. Not sure why"