# Path: rx/internal/basic.py
# def identity(x):
#     return x


import itertools
from .basic import identity
            for value in self:
                if n <= 0:
                    raise StopIteration
                n -= 1
                yield value
            
            raise StopIteration
        return Enumerable(iterator())   

    @classmethod
    def range(cls, start, count):
        def iterator():
            value = start
            n = count
            while n > 0:
                yield value
                value += 1
                n -= 1

            raise StopIteration
        return cls(iterator())

    @classmethod
    def repeat(cls, value, count=None):
        if not count is None:
            return cls(value for _ in range(count))
        return cls(itertools.repeat(value))

    @classmethod
    def for_each(cls, source, selector=None):

# Path: rx/internal/basic.py
# def identity(x):
#     return x


# Path: rx/internal/enumerable.py
import itertools
from .basic import identity

            for value in self:
                if n <= 0:
                    raise StopIteration
                n -= 1
                yield value
            
            raise StopIteration
        return Enumerable(iterator())   

    @classmethod
    def range(cls, start, count):
        def iterator():
            value = start
            n = count
            while n > 0:
                yield value
                value += 1
                n -= 1

            raise StopIteration
        return cls(iterator())

    @classmethod
    def repeat(cls, value, count=None):
        if not count is None:
            return cls(value for _ in range(count))
        return cls(itertools.repeat(value))

    @classmethod
    def for_each(cls, source, selector=None):

        selector = selector or identity