# Path: expremigen/patterns/pattern.py
# class Pattern(metaclass=abc.ABCMeta):
#     """
#     abstract base class for a Pattern
#     """
# 
#     def __str__(self):
#         return "{0}".format(self.__class__.__name__)
# 
#     def __repr__(self):
#         return self.__str__()
# 
# Path: expremigen/patterns/utils.py
# def take(n, iterable):
#     """Return first n items of the iterable as a list"""
#     return itertools.islice(iterable, n)


import itertools
from expremigen.patterns.pattern import Pattern
from expremigen.patterns.utils import take



class Pseries(Pattern):
    """
    pattern to generate an arithmetic series, e.g. Pseries(0, 1, 5) -> 0, 1, 2, 3, 4
    """

    def __init__(self, frm=0, step=1, length=5):
        super().__init__()
        self.frm = frm
        self.step = step
        self.length = length

    def __iter__(self):

# Path: expremigen/patterns/pattern.py
# class Pattern(metaclass=abc.ABCMeta):
#     """
#     abstract base class for a Pattern
#     """
# 
#     def __str__(self):
#         return "{0}".format(self.__class__.__name__)
# 
#     def __repr__(self):
#         return self.__str__()
# 
# Path: expremigen/patterns/utils.py
# def take(n, iterable):
#     """Return first n items of the iterable as a list"""
#     return itertools.islice(iterable, n)


# Path: expremigen/patterns/pseries.py
import itertools
from expremigen.patterns.pattern import Pattern
from expremigen.patterns.utils import take




class Pseries(Pattern):
    """
    pattern to generate an arithmetic series, e.g. Pseries(0, 1, 5) -> 0, 1, 2, 3, 4
    """

    def __init__(self, frm=0, step=1, length=5):
        super().__init__()
        self.frm = frm
        self.step = step
        self.length = length

    def __iter__(self):

        return take(self.length, itertools.count(self.frm, self.step))