How to use the poap.strategy.Proposal function in POAP

To help you get started, we’ve selected a few POAP examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dbindel / POAP / poap / strategy.py View on Github external
def propose_eval(self, *args):
        "Generate an eval proposal with a callback to on_reply."
        proposal = Proposal('eval', *args)
        proposal.add_callback(self.on_reply)
        return proposal
github dbindel / POAP / poap / strategy.py View on Github external
def propose_action(self):
        if self.target:
            logger.info("Monkey attack! {0}".format(self.target.params))
            proposal = Proposal('kill', self.target)
            self.target = None
        else:
            proposal = self.strategy.propose_action()
        return proposal
github dbindel / POAP / poap / strategy.py View on Github external
def propose_terminate(self):
        "Generate a terminate proposal with a callback to on_terminate."
        proposal = Proposal('terminate')
        proposal.add_callback(self.on_terminate_reply)
        return proposal
github dbindel / POAP / poap / strategy.py View on Github external
def propose_action(self):
        "Propose termination once the eval counter is high enough."
        if self.counter >= self.max_counter:
            logger.debug("MaxEvalStrategy: request termination")
            return Proposal('terminate')
        else:
            return None
github dbindel / POAP / poap / strategy.py View on Github external
def propose_kill(self, r):
        "Generate a kill proposal with a callback to on_reply_kill."
        proposal = Proposal('kill', r)
        proposal.add_callback(self.on_kill_reply)
        return proposal