How to use the condition.AbstractCondition function in condition

To help you get started, we’ve selected a few condition 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 jhu-lcsr / costar_plan / costar_task_plan / python / costar_task_plan / abstract / simple_conditions.py View on Github external
from condition import AbstractCondition

class FalseCondition(AbstractCondition):
    def __call__(self,*args,**kwargs):
        return False

class TrueCondition(AbstractCondition):
    def __call__(self,*args,**kwargs):
        return True

class TimeCondition(AbstractCondition):
    '''
    TimeCondition: true until some amount of time has elapsed.
    '''
    def __init__(self,time):
        super(TimeCondition,self).__init__()
        self.time = time
    def __call__(self, world, state, actor=None, prev_state=None):
        return state.t <= self.time
    def name(self):
        return "time_condition(%d)"%self.time

class AndCondition(AbstractCondition):
github jhu-lcsr / costar_plan / costar_task_plan / python / costar_task_plan / abstract / simple_conditions.py View on Github external
def __init__(self,*args):
        self.conditions = args
        for c in self.conditions:
            assert isinstance(c, AbstractCondition)
github jhu-lcsr / costar_plan / costar_task_plan / python / costar_task_plan / abstract / simple_conditions.py View on Github external
def __call__(self,*args,**kwargs):
        return True

class TimeCondition(AbstractCondition):
    '''
    TimeCondition: true until some amount of time has elapsed.
    '''
    def __init__(self,time):
        super(TimeCondition,self).__init__()
        self.time = time
    def __call__(self, world, state, actor=None, prev_state=None):
        return state.t <= self.time
    def name(self):
        return "time_condition(%d)"%self.time

class AndCondition(AbstractCondition):
    def __init__(self,*args):
        self.conditions = args
        for c in self.conditions:
            assert isinstance(c, AbstractCondition)

    def __call__(self, world, state, actor=None, prev_state=None):
        for condition in self.conditions:
            if not condition(world, state, actor, prev_state):
                return False
        else:
            return True

class OrCondition(AbstractCondition):
    def __init__(self,*args):
        self.conditions = args
        for c in self.conditions:
github jhu-lcsr / costar_plan / costar_task_plan / python / costar_task_plan / abstract / simple_conditions.py View on Github external
from condition import AbstractCondition

class FalseCondition(AbstractCondition):
    def __call__(self,*args,**kwargs):
        return False

class TrueCondition(AbstractCondition):
    def __call__(self,*args,**kwargs):
        return True

class TimeCondition(AbstractCondition):
    '''
    TimeCondition: true until some amount of time has elapsed.
    '''
    def __init__(self,time):
        super(TimeCondition,self).__init__()
        self.time = time
    def __call__(self, world, state, actor=None, prev_state=None):
        return state.t <= self.time
    def name(self):
        return "time_condition(%d)"%self.time

class AndCondition(AbstractCondition):
    def __init__(self,*args):
        self.conditions = args
        for c in self.conditions:
            assert isinstance(c, AbstractCondition)
github jhu-lcsr / costar_plan / costar_task_plan / python / costar_task_plan / abstract / simple_conditions.py View on Github external
from condition import AbstractCondition

class FalseCondition(AbstractCondition):
    def __call__(self,*args,**kwargs):
        return False

class TrueCondition(AbstractCondition):
    def __call__(self,*args,**kwargs):
        return True

class TimeCondition(AbstractCondition):
    '''
    TimeCondition: true until some amount of time has elapsed.
    '''
    def __init__(self,time):
        super(TimeCondition,self).__init__()
        self.time = time
    def __call__(self, world, state, actor=None, prev_state=None):
        return state.t <= self.time
github jhu-lcsr / costar_plan / costar_task_plan / python / costar_task_plan / abstract / simple_conditions.py View on Github external
return "time_condition(%d)"%self.time

class AndCondition(AbstractCondition):
    def __init__(self,*args):
        self.conditions = args
        for c in self.conditions:
            assert isinstance(c, AbstractCondition)

    def __call__(self, world, state, actor=None, prev_state=None):
        for condition in self.conditions:
            if not condition(world, state, actor, prev_state):
                return False
        else:
            return True

class OrCondition(AbstractCondition):
    def __init__(self,*args):
        self.conditions = args
        for c in self.conditions:
            assert isinstance(c, AbstractCondition)

    def __call__(self, world, state, actor=None, prev_state=None):
        for condition in self.conditions:
            if condition(world, state, actor, prev_state):
                return True
        else:
            return False

condition

A user friendly way to construct conditions for pandas dataframe query and sql

MIT
Latest version published 4 years ago

Package Health Score

33 / 100
Full package analysis