# Path: misc/numerical.py
# INF = float('inf')


from collections import Iterator
from itertools import islice
from .numerical import INF

def safe_next(generator, i=None):
  if i is None:
    values = list(islice(generator, 1))
    if len(values) == 0: return None
    return values[0]
  return list(islice(generator, i))

def take(iterable, n=INF):

# Path: misc/numerical.py
# INF = float('inf')


# Path: misc/generators.py
from collections import Iterator
from itertools import islice
from .numerical import INF


def safe_next(generator, i=None):
  if i is None:
    values = list(islice(generator, 1))
    if len(values) == 0: return None
    return values[0]
  return list(islice(generator, i))

def take(iterable, n=INF):

  if n == INF: n = None # NOTE - islice takes None instead of INF