# 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
  Taken from the Python documentation. Under the PSF license.

  :param amount:
      The number of items to obtain.
  :param iterable:
      Iterable sequence.
  :returns:
      First n items of the iterable as a tuple.
  """
  return tuple(itertools.islice(iterable, amount))


def eat(iterator, amount):
  """Advance an iterator n-steps ahead. If n is None, eat entirely.

  Taken from the Python documentation. Under the PSF license.

  :param iterator:
      An iterator.
  :param amount:
      The number of steps to advance.
  :yields:
      An iterator.
  """
  # Use functions that consume iterators at C speed.
  if amount is None:
    # Feed the entire iterator into a zero-length deque.
    collections.deque(iterator)
  else:
    # Advance to the empty slice starting at position n.

# 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

  Taken from the Python documentation. Under the PSF license.

  :param amount:
      The number of items to obtain.
  :param iterable:
      Iterable sequence.
  :returns:
      First n items of the iterable as a tuple.
  """
  return tuple(itertools.islice(iterable, amount))


def eat(iterator, amount):
  """Advance an iterator n-steps ahead. If n is None, eat entirely.

  Taken from the Python documentation. Under the PSF license.

  :param iterator:
      An iterator.
  :param amount:
      The number of steps to advance.
  :yields:
      An iterator.
  """
  # Use functions that consume iterators at C speed.
  if amount is None:
    # Feed the entire iterator into a zero-length deque.
    collections.deque(iterator)
  else:
    # Advance to the empty slice starting at position n.

    builtins.next(itertools.islice(iterator, amount, amount), None)