from data_flows.function import Function
from models.phone_number import PhoneNumber


class ActualActivationFlow:
    def __init__(self, source, target):
        self.source = source
        self.target = target

    def start(self):
        data = self.source.load()
        model = PhoneNumber()
        ingestion = Function(model=model)
        rdd_data = ingestion.start(data)
        print(rdd_data.collect())
        result_data = ActualActivationFlow.find_actual_activation_flow(rdd_data)
        self.target.save(data=result_data, coalesce=1)

    @staticmethod
    def find_actual_activation_flow(data):
        return data.map(lambda x: (x.phone_number, x))\
            .reduceByKey(lambda x, y: PhoneNumber.add(x, y))\
            .map(lambda x: x[1].find_actual_activation())\
            .map(lambda x: x.get_str())

2cb2a30b1421b5019b298d0b0e9d606206814009
<mask token>


class ActualActivationFlow:
    <mask token>
    <mask token>

    @staticmethod
    def find_actual_activation_flow(data):
        return data.map(lambda x: (x.phone_number, x)).reduceByKey(lambda x,
            y: PhoneNumber.add(x, y)).map(lambda x: x[1].
            find_actual_activation()).map(lambda x: x.get_str())

<mask token>


class ActualActivationFlow:

    def __init__(self, source, target):
        self.source = source
        self.target = target
    <mask token>

    @staticmethod
    def find_actual_activation_flow(data):
        return data.map(lambda x: (x.phone_number, x)).reduceByKey(lambda x,
            y: PhoneNumber.add(x, y)).map(lambda x: x[1].
            find_actual_activation()).map(lambda x: x.get_str())

<mask token>


class ActualActivationFlow:

    def __init__(self, source, target):
        self.source = source
        self.target = target

    def start(self):
        data = self.source.load()
        model = PhoneNumber()
        ingestion = Function(model=model)
        rdd_data = ingestion.start(data)
        print(rdd_data.collect())
        result_data = ActualActivationFlow.find_actual_activation_flow(rdd_data
            )
        self.target.save(data=result_data, coalesce=1)

    @staticmethod
    def find_actual_activation_flow(data):
        return data.map(lambda x: (x.phone_number, x)).reduceByKey(lambda x,
            y: PhoneNumber.add(x, y)).map(lambda x: x[1].
            find_actual_activation()).map(lambda x: x.get_str())

from data_flows.function import Function
from models.phone_number import PhoneNumber


class ActualActivationFlow:

    def __init__(self, source, target):
        self.source = source
        self.target = target

    def start(self):
        data = self.source.load()
        model = PhoneNumber()
        ingestion = Function(model=model)
        rdd_data = ingestion.start(data)
        print(rdd_data.collect())
        result_data = ActualActivationFlow.find_actual_activation_flow(rdd_data
            )
        self.target.save(data=result_data, coalesce=1)

    @staticmethod
    def find_actual_activation_flow(data):
        return data.map(lambda x: (x.phone_number, x)).reduceByKey(lambda x,
            y: PhoneNumber.add(x, y)).map(lambda x: x[1].
            find_actual_activation()).map(lambda x: x.get_str())

from data_flows.function import Function
from models.phone_number import PhoneNumber


class ActualActivationFlow:
    def __init__(self, source, target):
        self.source = source
        self.target = target

    def start(self):
        data = self.source.load()
        model = PhoneNumber()
        ingestion = Function(model=model)
        rdd_data = ingestion.start(data)
        print(rdd_data.collect())
        result_data = ActualActivationFlow.find_actual_activation_flow(rdd_data)
        self.target.save(data=result_data, coalesce=1)

    @staticmethod
    def find_actual_activation_flow(data):
        return data.map(lambda x: (x.phone_number, x))\
            .reduceByKey(lambda x, y: PhoneNumber.add(x, y))\
            .map(lambda x: x[1].find_actual_activation())\
            .map(lambda x: x.get_str())
