# Path: mom/builtins.py
# def byte(number):
# def bytes_leading(raw_bytes, needle=_compat.ZERO_BYTE):
# def bytes_trailing(raw_bytes, needle=_compat.ZERO_BYTE):
# def bin(number, prefix="0b"):
# def hex(number, prefix="0x"):
# def is_sequence(obj):
# def is_unicode(obj):
# def is_bytes(obj):
# def is_bytes_or_unicode(obj):
# def is_integer(obj):
# def integer_byte_length(number):
# def integer_byte_size(number):
# def integer_bit_length(number):
# def integer_bit_size(number):
# def integer_bit_count(number):
# def is_even(num):
# def is_odd(num):
# def is_positive(num):
# def is_negative(num):
# 
# Path: mom/itertools.py
# class chain(object):
#   """An iterator which yields elements from the given `iterables` until each
#   iterable is exhausted.
# 
#   .. versionadded:: 0.2
#   """
# 
#   @classmethod
#   def from_iterable(cls, iterable):
#     """Alternative constructor which takes an `iterable` yielding iterators,
#     this can be used to chain an infinite number of iterators.
#     """
#     rv = object.__new__(cls)
#     rv._init(iterable)
#     return rv
# 
#   def __init__(self, *iterables):
#     self._init(iterables)
# 
#   def _init(self, iterables):
#     self.iterables = iter(iterables)
#     self.current_iterable = iter([])
# 
#   def __iter__(self):
#     return self
# 
#   def next(self):
#     try:
#       return self.current_iterable.next()
#     except StopIteration:
#       self.current_iterable = iter(self.iterables.next())
#       return self.current_iterable.next()
# 
# Path: mom/itertools.py
# def starmap(function, iterable):
#   """Make an iterator that computes the function using arguments obtained from
#   the iterable. Used instead of :func:`itertools.imap` when an argument
#   parameters are already grouped in tuples from a single iterable (the data
#   has been "pre-zipped"). The difference between :func:`itertools.imap` and
#   :func:`starmap` parallels the distinction between ``function(a, b)`` and
#   ``function(*c)``.
# 
#   .. note:: Software and documentation for this function are taken from
#             CPython, :ref:`license details <psf-license>`.
#   """
#   for args in iterable:
#     yield function(*args)


import collections
import functools
import itertools
  from itertools import ifilter as _ifilter
  from itertools import ifilterfalse as _ifilterfalse
  from itertools import imap as map
from mom import builtins
from mom.itertools import chain
from mom.itertools import starmap
    "truthy",
    "union",
    "unique",
    "without",
    ]


# Higher-order functions that generate other functions.


def compose(function, *functions):
  """Composes a sequence of functions such that::

      compose(g, f, s) -> g(f(s()))

  :param functions:
      An iterable of functions.
  :returns:
      A composition function.
  """

  def _composition(a_func, b_func):
    """Composition."""

    def _wrap(*args, **kwargs):
      """Wrapper."""
      return a_func(b_func(*args, **kwargs))

    return _wrap


# Path: mom/builtins.py
# def byte(number):
# def bytes_leading(raw_bytes, needle=_compat.ZERO_BYTE):
# def bytes_trailing(raw_bytes, needle=_compat.ZERO_BYTE):
# def bin(number, prefix="0b"):
# def hex(number, prefix="0x"):
# def is_sequence(obj):
# def is_unicode(obj):
# def is_bytes(obj):
# def is_bytes_or_unicode(obj):
# def is_integer(obj):
# def integer_byte_length(number):
# def integer_byte_size(number):
# def integer_bit_length(number):
# def integer_bit_size(number):
# def integer_bit_count(number):
# def is_even(num):
# def is_odd(num):
# def is_positive(num):
# def is_negative(num):
# 
# Path: mom/itertools.py
# class chain(object):
#   """An iterator which yields elements from the given `iterables` until each
#   iterable is exhausted.
# 
#   .. versionadded:: 0.2
#   """
# 
#   @classmethod
#   def from_iterable(cls, iterable):
#     """Alternative constructor which takes an `iterable` yielding iterators,
#     this can be used to chain an infinite number of iterators.
#     """
#     rv = object.__new__(cls)
#     rv._init(iterable)
#     return rv
# 
#   def __init__(self, *iterables):
#     self._init(iterables)
# 
#   def _init(self, iterables):
#     self.iterables = iter(iterables)
#     self.current_iterable = iter([])
# 
#   def __iter__(self):
#     return self
# 
#   def next(self):
#     try:
#       return self.current_iterable.next()
#     except StopIteration:
#       self.current_iterable = iter(self.iterables.next())
#       return self.current_iterable.next()
# 
# Path: mom/itertools.py
# def starmap(function, iterable):
#   """Make an iterator that computes the function using arguments obtained from
#   the iterable. Used instead of :func:`itertools.imap` when an argument
#   parameters are already grouped in tuples from a single iterable (the data
#   has been "pre-zipped"). The difference between :func:`itertools.imap` and
#   :func:`starmap` parallels the distinction between ``function(a, b)`` and
#   ``function(*c)``.
# 
#   .. note:: Software and documentation for this function are taken from
#             CPython, :ref:`license details <psf-license>`.
#   """
#   for args in iterable:
#     yield function(*args)


# Path: mom/functional.py
import collections
import functools
import itertools
  from itertools import ifilter as _ifilter
  from itertools import ifilterfalse as _ifilterfalse
  from itertools import imap as map
from mom import builtins
from mom.itertools import chain
from mom.itertools import starmap

    "truthy",
    "union",
    "unique",
    "without",
    ]


# Higher-order functions that generate other functions.


def compose(function, *functions):
  """Composes a sequence of functions such that::

      compose(g, f, s) -> g(f(s()))

  :param functions:
      An iterable of functions.
  :returns:
      A composition function.
  """

  def _composition(a_func, b_func):
    """Composition."""

    def _wrap(*args, **kwargs):
      """Wrapper."""
      return a_func(b_func(*args, **kwargs))

    return _wrap


  return builtins.reduce(_composition, functions, function)