# Path: mom/functional.py
#   def _ifilterfalse(predicate, iterable):
#     def _complement(item):
# def compose(function, *functions):
#   def _composition(a_func, b_func):
#     def _wrap(*args, **kwargs):
# def _compose(function, *functions):
#   def _composition(*args_tuple):
# def complement(predicate):
#   def _negate(*args, **kwargs):
# def reduce(transform, iterable, *args):
# def each(walker, iterable):
# def some(predicate, iterable):
# def _some1(predicate, iterable):
# def _some2(predicate, iterable):
# def every(predicate, iterable):
# def none(predicate, iterable):
# def find(predicate, iterable, start=0):
# def leading(predicate, iterable, start=0):
# def _leading(predicate, iterable, start=0):
# def trailing(predicate, iterable, start=-1):
# def tally(predicate, iterable):
# def select(predicate, iterable):
# def iselect(predicate, iterable):
# def reject(predicate, iterable):
# def ireject(predicate, iterable):
# def partition(predicate, iterable):
#   def _partitioner(memo, item):
# def partition_dict(predicate, dictionary):
#   def _pred(tup):
# def map_dict(transform, dictionary):
# def select_dict(predicate, dictionary):
#   def _pred(tup):
# def reject_dict(predicate, dictionary):
#   def _pred(tup):
# def invert_dict(dictionary):
# def pluck(dicts, key, *args, **kwargs):
# def ipluck(dicts, key, *args, **kwargs):
#     def _get_value_from_dict(dictionary):
# def contains(iterable, item):
# def _contains_fallback(iterable, item):
# def omits(iterable, item):
# def difference(iterable1, iterable2):
# def idifference(iterable1, iterable2):
# def without(iterable, *values):
# def head(iterable):
# def tail(iterable):
# def itail(iterable):
# def nth(iterable, index, default=None):
# def last(iterable):
# def occurrences(iterable):
# def peel(iterable, count=1):
# def ipeel(iterable, count=1):
# def ichunks(iterable, size, *args, **kwargs):
# def chunks(iterable, size, *args, **kwargs):
# def truthy(iterable):
# def itruthy(iterable):
# def falsy(iterable):
# def ifalsy(iterable):
# def flatten(iterable):
#   def _flatten(memo, item):
# def flatten1(iterable):
#   def _flatten(memo, item):
# def group_consecutive(predicate, iterable):
# def flock(predicate, iterable):
# def unique(iterable, is_sorted=False):
#     def _unique(memo, item):
# def union(iterable, *iterables):
# def intersection(iterable, *iterables):
#   def _does_other_contain(item):
# def take(iterable, amount):
# def eat(iterator, amount):
# def _get_iter_next(iterator):
# def round_robin(*iterables):
# def ncycles(iterable, times):
# def identity(arg):
# def loob(arg):
# def always(_):
# def never(_):
# def constant(c):
#   def _func(*args, **kwargs):
# def nothing(*args, **kwargs):


  from itertools import imap as map
from mom import functional
import fnmatch
import functools
  Convenience function to lowercase a string.

  :param string:
      The string which will be lower-cased.
  :returns:
      Lower-cased copy of string s.
  """
  return string.lower()


def match_path_against(pathname, patterns, case_sensitive=True):
  """
  Determines whether the pathname matches any of the given wildcard patterns,
  optionally ignoring the case of the pathname and patterns.

  :param pathname:
      A path name that will be matched against a wildcard pattern.
  :param patterns:
      A list of wildcard patterns to match_path the filename against.
  :param case_sensitive:
      ``True`` if the matching should be case-sensitive; ``False`` otherwise.
  :returns:
      ``True`` if the pattern matches; ``False`` otherwise.
  """
  if case_sensitive:
    match_func = functools.partial(fnmatch.fnmatchcase, pathname)
    transform = functional.identity
  else:
    match_func = functools.partial(fnmatch.fnmatch, pathname.lower())
    transform = _string_lower

# Path: mom/functional.py
#   def _ifilterfalse(predicate, iterable):
#     def _complement(item):
# def compose(function, *functions):
#   def _composition(a_func, b_func):
#     def _wrap(*args, **kwargs):
# def _compose(function, *functions):
#   def _composition(*args_tuple):
# def complement(predicate):
#   def _negate(*args, **kwargs):
# def reduce(transform, iterable, *args):
# def each(walker, iterable):
# def some(predicate, iterable):
# def _some1(predicate, iterable):
# def _some2(predicate, iterable):
# def every(predicate, iterable):
# def none(predicate, iterable):
# def find(predicate, iterable, start=0):
# def leading(predicate, iterable, start=0):
# def _leading(predicate, iterable, start=0):
# def trailing(predicate, iterable, start=-1):
# def tally(predicate, iterable):
# def select(predicate, iterable):
# def iselect(predicate, iterable):
# def reject(predicate, iterable):
# def ireject(predicate, iterable):
# def partition(predicate, iterable):
#   def _partitioner(memo, item):
# def partition_dict(predicate, dictionary):
#   def _pred(tup):
# def map_dict(transform, dictionary):
# def select_dict(predicate, dictionary):
#   def _pred(tup):
# def reject_dict(predicate, dictionary):
#   def _pred(tup):
# def invert_dict(dictionary):
# def pluck(dicts, key, *args, **kwargs):
# def ipluck(dicts, key, *args, **kwargs):
#     def _get_value_from_dict(dictionary):
# def contains(iterable, item):
# def _contains_fallback(iterable, item):
# def omits(iterable, item):
# def difference(iterable1, iterable2):
# def idifference(iterable1, iterable2):
# def without(iterable, *values):
# def head(iterable):
# def tail(iterable):
# def itail(iterable):
# def nth(iterable, index, default=None):
# def last(iterable):
# def occurrences(iterable):
# def peel(iterable, count=1):
# def ipeel(iterable, count=1):
# def ichunks(iterable, size, *args, **kwargs):
# def chunks(iterable, size, *args, **kwargs):
# def truthy(iterable):
# def itruthy(iterable):
# def falsy(iterable):
# def ifalsy(iterable):
# def flatten(iterable):
#   def _flatten(memo, item):
# def flatten1(iterable):
#   def _flatten(memo, item):
# def group_consecutive(predicate, iterable):
# def flock(predicate, iterable):
# def unique(iterable, is_sorted=False):
#     def _unique(memo, item):
# def union(iterable, *iterables):
# def intersection(iterable, *iterables):
#   def _does_other_contain(item):
# def take(iterable, amount):
# def eat(iterator, amount):
# def _get_iter_next(iterator):
# def round_robin(*iterables):
# def ncycles(iterable, times):
# def identity(arg):
# def loob(arg):
# def always(_):
# def never(_):
# def constant(c):
#   def _func(*args, **kwargs):
# def nothing(*args, **kwargs):


# Path: mom/os/patterns.py
  from itertools import imap as map
from mom import functional
import fnmatch
import functools

  Convenience function to lowercase a string.

  :param string:
      The string which will be lower-cased.
  :returns:
      Lower-cased copy of string s.
  """
  return string.lower()


def match_path_against(pathname, patterns, case_sensitive=True):
  """
  Determines whether the pathname matches any of the given wildcard patterns,
  optionally ignoring the case of the pathname and patterns.

  :param pathname:
      A path name that will be matched against a wildcard pattern.
  :param patterns:
      A list of wildcard patterns to match_path the filename against.
  :param case_sensitive:
      ``True`` if the matching should be case-sensitive; ``False`` otherwise.
  :returns:
      ``True`` if the pattern matches; ``False`` otherwise.
  """
  if case_sensitive:
    match_func = functools.partial(fnmatch.fnmatchcase, pathname)
    transform = functional.identity
  else:
    match_func = functools.partial(fnmatch.fnmatch, pathname.lower())
    transform = _string_lower

  return functional.some(match_func, map(transform, set(patterns)))