示例#1
0
    def p_randomly(params, step, sL, s):
        """
        Randomly picks a Participant from the network and asks him if he wants
        to create a Proposal.
        """
        funding_pool = s["funding_pool"]
        network = s["network"]

        participants = get_participants(network)
        i, participant = random.sample(participants, 1)[0]

        wants_to_create_proposal = participant.create_proposal(calc_total_funds_requested(
            network), calc_median_affinity(network), funding_pool)

        return {"new_proposal": wants_to_create_proposal, "proposed_by_participant": i}
示例#2
0
    def p_randomly(params, step, sL, s, **kwargs):
        """
        Randomly picks a Participant from the network and asks him if he wants
        to create a Proposal.
        """
        funding_pool = s["funding_pool"]
        network = s["network"]
        choice_func = params["choice_func"]

        participants = get_participants(network)
        participants_dict = dict(participants)
        i = choice_func(list(participants_dict))
        participant = participants_dict[i]

        wants_to_create_proposal = participant.create_proposal(calc_total_funds_requested(
            network), calc_median_affinity(network), funding_pool)

        return {"new_proposal": wants_to_create_proposal, "proposed_by_participant": i}
 def test_calc_median_affinity_network_with_no_support_edges(self):
     with self.assertRaises(Exception):
         calc_median_affinity(self.network)