class MTCounter(MTValue): def __init__( self, val = 0 ): MTValue.__init__(self, 0) self._cond = Condition(self._mutex) self._val = 0 def next( self ): self._mutex.acquire() try: self._val += 1 self._cond.notifyAll() return self._val finally: self._mutex.release() def incr( self ): self._mutex.acquire() try: self._val += 1 self._cond.notifyAll() finally: self._mutex.release() # timeout in in sec, float def wait( self, count, timeOut = None ): self._mutex.acquire() try: while self._val < count: if not self._cond.wait(timeOut): return None # timed out return True finally: self._mutex.release()
def condition(self, nodeObj): print("Condition") c = Condition() if (nodeObj['_nodetype'] == 'BinaryOp'): print(nodeObj["left"]["_nodetype"] == "ID") if("left" in nodeObj): c.left = self.condition(nodeObj["left"]) if (nodeObj["left"]["_nodetype"] == "ID"): self.usedVariable.append(nodeObj["left"]["name"]) self.condition(nodeObj["left"]) if(nodeObj["op"] in self.nodeOperation): c.operator = nodeObj["op"] if(self.insideCondFor): self.usedVariable.append(nodeObj["op"]) self.incComplexite() if("right" in nodeObj): c.right = self.condition(nodeObj["right"]) if (nodeObj["right"]["_nodetype"] == "ID"): self.usedVariable.append(nodeObj["right"]["name"]) self.condition(nodeObj["right"]) return c elif(nodeObj['_nodetype'] == 'ID'): print(self.assignatedVariable) if (nodeObj['name'] not in self.assignatedVariable): return nodeObj['name'] return self.assignatedVariable[nodeObj['name']] elif(nodeObj['_nodetype'] == 'Constant'): return nodeObj['value'] return None
def edge_to_condition(self): condition = Condition(False) condition.set_first_object(self._from_node) condition.set_second_object(self._to_node) condition.set_key(self.get_key()) condition.set_value(self.get_value()) return condition
def __init__(self, **options): Condition.__init__(self, **options) self.setMinMax(options, 'Pt', -1.0) self.setMinMax(options, 'Eta', -1.0) self.setOption(options, 'cutPileup', False) self.setOption(options, 'invertPileup', False) self.setOption(options, 'pileupWP', -1) self.setOption(options, 'btagWP', -1.0) self.setMinMax(options, 'Btag', -1.0)
def __init__(self, name=None): self.name = name #Action name self.duration = 1 #How many turns it take self.condition = Condition() #action applicability condition self.actions = [] #List of actions self.arguments = Arguments()
def __init__(self, limit): ''' Constructor @param highFpsLimit: the range of fps allowed in percent if fps > 200 @param lowFpsLimit: the range of fps allowed in percent if fps < 200 ''' Condition.__init__(self) self._limit = limit self._currentTest = None
def process_line(line, env): """ Given a command line and the environment, processes the command and updates the environment. Inputs: line - line containing commands env - dictionary containing environment variables """ if ':=' in line: toks = [t.strip() for t in line.split(':=')] name = toks[0] command = toks[1] args = get_args(command) if command.startswith('inputfromfile'): env[name] = Table(args[0]) elif command.startswith('select'): c = Condition(args[1], [env[args[0]]], [args[0]]) env[name] = env[args[0]].select(c) elif command.startswith('project'): env[name] = env[args[0]].project(args[1:]) elif command.startswith('join'): c = Condition(args[2], [env[args[0]], env[args[1]]], [args[0], args[1]]) env[name] = env[args[0]].join(env[args[1]], args[0], args[1], c) elif command.startswith('concat'): env[name] = env[args[0]].concat(env[args[1]]) elif command.startswith('sort'): env[name] = env[args[0]].sort(args[1:]) elif command.startswith('sumgroup'): env[name] = env[args[0]].sumgroup(args[1], args[2:]) elif command.startswith('avggroup'): env[name] = env[args[0]].avggroup(args[1], args[2:]) elif command.startswith('countgroup'): env[name] = env[args[0]].countgroup(args[1], args[2:]) elif command.startswith('sum'): env[name] = env[args[0]].sum(args[1]) elif command.startswith('avg'): env[name] = env[args[0]].avg(args[1]) elif command.startswith('count'): env[name] = env[args[0]].count(args[1]) elif command.startswith('movsum'): env[name] = env[args[0]].movsum(args[1], int(args[2])) elif command.startswith('movavg'): env[name] = env[args[0]].movavg(args[1], int(args[2])) else: args = get_args(line) if line.startswith('Btree'): env[args[0]].btree(args[1]) elif line.startswith('Hash'): env[args[0]].hash(args[1]) elif line.startswith('outputtofile'): env[args[0]].write(args[1])
def populateListOfConditions(theFileName): with open(theFileName, 'r', encoding='mac_roman') as csvfile: fileReader = csv.reader(csvfile) next(fileReader) previousRowID = "" previousRowCondition = "" for row in fileReader: if row[CONDITION_COLUMN] == "" or row[ CONDITION_COLUMN] != previousRowID: listOfConditions[row[CONDITION_COLUMN]] = [] newCondition = Condition(row[CONDITION_COLUMN], row[SUBTYPE_COLUMN]) newField = Field(row[SUBTYPE_COLUMN], row[LINE_NUMBER_COLUMN], row[FIELD_COLUMN], row[PROGRESS_COLUMN]) newCondition.addFieldToCondition(newField) listOfConditions[row[CONDITION_COLUMN]].append(newCondition) elif row[CONDITION_COLUMN] == previousRowID: if row[SUBTYPE_COLUMN] == previousRowCondition: newField = Field(row[SUBTYPE_COLUMN], row[LINE_NUMBER_COLUMN], row[FIELD_COLUMN], row[PROGRESS_COLUMN]) conditionReference = listOfConditions[ row[CONDITION_COLUMN]] conditionReference[-1].addFieldToCondition(newField) elif row[SUBTYPE_COLUMN] != previousRowCondition: newCondition = Condition(row[CONDITION_COLUMN], row[SUBTYPE_COLUMN]) newField = Field(row[SUBTYPE_COLUMN], row[LINE_NUMBER_COLUMN], row[FIELD_COLUMN], row[PROGRESS_COLUMN]) newCondition.addFieldToCondition(newField) listOfConditions[row[CONDITION_COLUMN]].append( newCondition) previousRowID = row[CONDITION_COLUMN] previousRowCondition = row[SUBTYPE_COLUMN]
def __init__(self, **options): Condition.__init__(self, **options) self.setOption(options, 'muons', None) self.setOption(options, 'electrons', None) self.setMinMax(options, 'Pt', -1.0) self.setMinMax(options, 'Eta', -1.0) self.setOption(options, 'requireLooseId', False) self.setOption(options, 'invertLooseId', False) self.setOption(options, 'requireMediumId', False) self.setOption(options, 'invertMediumId', False) self.setOption(options, 'requireTightId', False) self.setOption(options, 'invertTightId', False) self.setMinMax(options, 'PfIso', -1.0) self.setMinMax(options, 'MiniIso', -1.0)
def talk(self, input_array): if not self._condition_only: return [], [] else: other_person = input_array[0] where = other_person.get_to_node_from_outgoing_edge_name( {"Lives": "N/A"}) condition = Condition(False) condition.set_first_object(self) condition.set_second_object(where) condition.set_key("Currently_In") condition.set_value("N/A") print[condition], [], []
def move_player(self, where): if not self._condition_only: self.get_outgoing_edges()[0].set_to_node(where) return [], [] else: lost_condition = self.get_outgoing_edges()[0].edge_to_condition() condition = Condition(False) condition.set_first_object(self) condition.set_second_object(where) condition.set_key(self.get_outgoing_edges()[0].get_key()) condition.set_value(self.get_outgoing_edges()[0].get_value()) return [], [condition], [lost_condition]
def check_condition(self, cardidate_state, right_cond, rule_index): is_ambiguous = 0 next_state = None next_cond = None for c in cardidate_state: #Condition.compatible(a,b) a = right_cond[rule_index] b = Condition(c.start, self.index, "==") cond_ = Condition.compatible(a, b) if cond_: is_ambiguous += 1 next_state = c next_cond = cond_ return is_ambiguous, next_state, next_cond
def condition_create(self, condition_string): table = "" operator = "" operators = ['>=', '<=', '<', '>', '='] for op in operators: if op in condition_string: table = condition_string.split(op) operator = op break val = table[1] parsed = StringIO(table[0]) l_parsed = list(shlex.shlex(parsed)) # print(l_parsed) items = list() operators_between_items = list() for parsed_item in l_parsed: if parsed_item == '?': continue if parsed_item != '+' and parsed_item != '−': if 'a' <= parsed_item <= 'z': items.append('?' + parsed_item) else: items.append(parsed_item) else: operators_between_items.append(parsed_item) return Condition(items, operators_between_items, operator, val)
class Action: """ class of Action """ def __init__(self, name=None): self.name = name #Action name self.duration = 1 #How many turns it take self.condition = Condition() #action applicability condition self.actions = [] #List of actions self.arguments = Arguments() #Arguments list of arguments def __call__(self): self.Perform() def Perform(self): """ Main Action function @return:Nome """ if self.condition: if not self.condition.Calculate(): return for action in self.actions: #pass arguments to next action action.arguments = self.arguments if action.condition: action.condition.arguments = self.arguments action()
def create_condition(cls, name): condition = Condition() cls.__conditions.append(condition) id = len(cls.__conditions) - 1 if name != None: cls.__condition_name_dict[name] = id return id
def shiftDevice(self, condition=Condition()): try: self._lock.acquire() available_device_len = len(self._deviceInfoList.available_device_list) if available_device_len <= 0: return None aimed_index = -1 if condition.sim: ''' XXX loadbalance ''' for i in range(len(self._deviceInfoList.available_device_list)): available_device = self._deviceInfoList.available_device_list[i] if available_device.sim_state == condition.sim: aimed_index = i break else: aimed_index = random.randint(0, available_device_len - 1) if aimed_index == -1: return None deviceInfo = self._deviceInfoList.available_device_list.pop(aimed_index) DeviceUtils.lockDevice(deviceInfo.serial) return deviceInfo finally: self._lock.release()
def getAction(self): self.action = self.createCondition(ROOT.JetCondition, self.minPt, self.maxPt, self.minEta, self.maxEta, self.cutPileup, self.invertPileup, self.pileupWP, self.btagWP, self.minBtag, self.maxBtag) return Condition.getAction(self)
def db_create(son): """ Creates a new Instance based of database SON data. Gets called by transform_outgoing of SONManipulator """ return PathElement(query=Query.find_by_id(son['query_id']), condition=Condition.from_dict(son['condition']), _id=son['_id'])
def attribute_to_comparator_condition(self, key): if key in self._attributes.keys(): condition = Condition(True, True, "=") condition.set_first_object(self) condition.set_key(key) condition.set_value(self._attributes[key]) return condition else: return None
def talk(self, input_array): if not self._condition_only: return [], [] else: other_person = input_array[0] where = other_person.get_to_node_from_outgoing_edge_name({"Lives" : "N/A"}) condition = Condition(False) condition.set_first_object(self) condition.set_second_object(where) condition.set_key("Currently_In") condition.set_value("N/A") print [condition], [], []
def add_edge(self, method_array): to_node = method_array[0] key = method_array[1] value = method_array[2] if not self._condition_only: new_edge = Edge({key: value}, self, to_node) self.add_edge_special(new_edge, to_node) return [], [new_edge] else: condition = Condition(False) condition.set_first_object(self) condition.set_second_object(to_node) condition.set_key(key) condition.set_value(value) return [], [condition], []
def move_player_to_node(self, who): if not self._condition_only: who = who[0] where = who.get_to_node_from_outgoing_edge_name({"Lives": "N/A"}) self.get_outgoing_edges()[0].set_to_node(where) return [], [] else: who = who[0] where = who.get_to_node_from_outgoing_edge_name({"Lives": "N/A"}) lost_condition = self.get_outgoing_edges()[0].edge_to_condition() condition = Condition(False) condition.set_first_object(self) condition.set_second_object(where) condition.set_key(self.get_outgoing_edges()[0].get_key()) condition.set_value(self.get_outgoing_edges()[0].get_value()) return [], [condition], [lost_condition]
def test_eval_test_default_rule(self): # Arrange example = Example.Example() example.init_values(["condition", "condition2", "class"], -1) rule = Rule.Rule() condition = Condition.Condition() condition.attribute_number = 0 condition.attribute_value = "condition" condition2 = Condition.Condition() condition2.attribute_number = 1 condition2.attribute_value = "condition2" list_of_con = [condition, condition2] # Act rule.add_existing_conditions(list_of_con) # Assert self.assertTrue(rule.meets_conditions(example))
def add_edge(self, method_array): to_node = method_array[0] key = method_array[1] value = method_array[2] if not self._condition_only: new_edge = Edge({key : value}, self, to_node) self.add_edge_special(new_edge, to_node) return [], [new_edge] else: condition = Condition(False) condition.set_first_object(self) condition.set_second_object(to_node) condition.set_key(key) condition.set_value(value) return [], [condition], []
def test_is_true_return_true(self): # Arrange example = Example.Example() example.init_values(["condition", "class"], -1) condition = Condition.Condition() condition.attribute_number = 0 condition.attribute_value = "condition" # Act result = condition.is_true(example) # Assert self.assertTrue(result)
class MTFlag(MTValue): def __init__( self, val = False, pred = bool ): MTValue.__init__(self, val) self._cond = Condition(self._mutex) self._pred = pred def set( self, val = True ): self._mutex.acquire() self._val = val if self._pred(val): self._cond.notifyAll() self._mutex.release() # timeout in in sec, float def wait( self, timeOut = None ): self._mutex.acquire() try: while not self._pred(self._val): if not self._cond.wait(timeOut): return None # timed out return self._val # it can be not boolean finally: self._mutex.release()
def getAction(self): if self.muons and not self.electrons: cutelec, cutmuon = False, True elif self.electrons and not self.muons: cutelec, cutmuon = True, False else: cutelec, cutmuon = True, True self.action = self.createCondition( ROOT.LeptonCondition, self.minPt, self.maxPt, self.minEta, self.maxEta, cutelec, cutmuon, self.requireLooseId, self.invertLooseId, self.requireMediumId, self.invertMediumId, self.requireTightId, self.invertTightId, self.minPfIso, self.maxPfIso, self.minMiniIso, self.maxMiniIso) return Condition.getAction(self)
def move_player_to_node(self, who): if not self._condition_only: who = who[0] where = who.get_to_node_from_outgoing_edge_name({"Lives" : "N/A"}) self.get_outgoing_edges()[0].set_to_node(where) return [], [] else: who = who[0] where = who.get_to_node_from_outgoing_edge_name({"Lives" : "N/A"}) lost_condition = self.get_outgoing_edges()[0].edge_to_condition() condition = Condition(False) condition.set_first_object(self) condition.set_second_object(where) condition.set_key(self.get_outgoing_edges()[0].get_key()) condition.set_value(self.get_outgoing_edges()[0].get_value()) return [], [condition], [lost_condition]
def __init__(self, name, apkpath, description, testcasepath, package, condition=Condition()): self.name = name self.commands = [] self.apkpath = apkpath self.prepares = [] self.description = description self.testcasepath = testcasepath self.package = package self.condition = condition self.testcaseResult = TestcaseResult()
def test_add_existing_conditions_one(self): # Arrange example = Example.Example() example.init_values(["condition", "class"], -1) rule = Rule.Rule() condition = Condition.Condition() condition.attribute_number = 0 condition.attribute_value = "condition" # Act rule.add_existing_conditions([condition]) # Assert self.assertTrue(rule.meets_conditions(example))
def gen_contact_conditions(n, grid_width, positions_of_ones): grid_area = pow(grid_width, 2) grid_vol = pow(grid_width, 3) offset = grid_vol * n #existing vars from X_ij conditions contact_conditions = list() # contact condition 1 contact_condition_1 = Condition(list(), True, grid_vol, 1) for x in positions_of_ones: contact_condition_1.add_clause([offset + 1, -1 * (x * grid_vol + 1)]) last_clause = [-1 * (offset + 1)] last_clause.extend(map(lambda x: (x * grid_vol) + 1, positions_of_ones)) contact_condition_1.add_clause(last_clause) contact_conditions.append(contact_condition_1) # contact condition 2 clauses = list() for j in range(1, grid_vol + 1): C_jr = offset + grid_vol + j C_jd = C_jr + grid_vol C_jb = C_jd + grid_vol T_j = C_jr - grid_vol T_jr = T_j + 1 T_jd = T_j + grid_width T_jb = T_j + grid_area if j % grid_width != 0: clauses.extend([[-1 * C_jr, T_j], [-1 * C_jr, T_jr], [C_jr, -1 * T_j, -1 * T_jr]]) else: clauses.extend([[-1 * C_jr]]) if j % grid_area <= grid_area - grid_width and j % grid_area > 0: clauses.extend([[-1 * C_jd, T_j], [-1 * C_jd, T_jd], [C_jd, -1 * T_j, -1 * T_jd]]) else: clauses.extend([[-1 * C_jd]]) if j <= (grid_width - 1) * grid_area: clauses.extend([[-1 * C_jb, T_j], [-1 * C_jb, T_jb], [C_jb, -1 * T_j, -1 * T_jb]]) else: clauses.extend([[-1 * C_jb]]) contact_condition_2 = Condition(clauses) contact_conditions.append(contact_condition_2) return contact_conditions
def gen_contact_conditions(n, grid_width, positions_of_ones): grid_size = pow(grid_width, 2) offset = grid_size * n #existing vars from X_ij conditions contact_conditions = list() # contact condition 1 contact_condition_1 = Condition(list(), True, grid_size, 1) for x in positions_of_ones: contact_condition_1.add_clause([offset + 1, (-1 * x * grid_size) - 1]) last_clause = [(-1 * offset) - 1] last_clause.extend(map(lambda x: (x * grid_size) + 1, positions_of_ones)) contact_condition_1.add_clause(last_clause) contact_conditions.append(contact_condition_1) # contact condition 2 clauses = list() for j in range(1, grid_size + 1): C_jr = offset + grid_size + j C_jd = C_jr + grid_size T_j = C_jr - grid_size T_jr = T_j + 1 T_jd = T_j + grid_width if j == grid_size: clauses.extend([[-1 * C_jr]]) clauses.extend([[-1 * C_jd]]) elif j >= grid_size - grid_width + 1: clauses.extend([[-1 * C_jr, T_j], [-1 * C_jr, T_jr], [C_jr, -1 * T_j, -1 * T_jr]]) clauses.extend([[-1 * C_jd]]) elif j % grid_width == 0: clauses.extend([[-1 * C_jr]]) clauses.extend([[-1 * C_jd, T_j], [-1 * C_jd, T_jd], [C_jd, -1 * T_j, -1 * T_jd]]) else: clauses.extend([[-1 * C_jr, T_j], [-1 * C_jr, T_jr], [C_jr, -1 * T_j, -1 * T_jr]]) clauses.extend([[-1 * C_jd, T_j], [-1 * C_jd, T_jd], [C_jd, -1 * T_j, -1 * T_jd]]) contact_condition_2 = Condition(clauses) contact_conditions.append(contact_condition_2) return contact_conditions
def parse(self, charts): self.start = None self.charts, fin = charts state = State(self.GFG.final, 0) last_index = len(self.charts) - 1 for s in self.charts[last_index].states: if s.is_completer() and s.rule.isType( "pro") and s.rule.ele.left == state.rule.ele: self.start = s self.index = last_index start_cond = Condition(0, len(self.charts) - 1, "==") if self.debug: print "START : " print "recur", self.start, self.index, " with condition [", start_cond, "]" return self.recur(self.start, start_cond)[0]
def search(self, abstract): """ This function searches through the abstract for conditions. :param abstract: The abstract in which the condition should be searched. :return: A list of the conditions found in the abstract. """ if abstract: conditions = [] for sent in sent_tokenize(abstract): if self.keyword in sent: score = TextManipulator.compare_to_model( sent, self.model) # returns similarity percentage (decimal) if score > self.cut_off: for condition in self.__extract_conditions(sent): conditions.append( Condition((score, condition, sent))) return conditions else: return None
def get_node_relations(self, relation_input, other_node, new_relation, reason, incoming): cause = reason + self._name if incoming: edges = self._incoming_edges else: edges = self._outgoing_edges Postconditions = [] Preconditions = [] #Update all the edges for edge in edges: attribute = edge.get_name() #If the other player liked or loved this character # they should hate the murderer if attribute.keys()[0] in relation_input: if incoming: from_node = edge.get_from_node() else: from_node = edge.get_to_node() if not (from_node == other_node): precondition = Condition(False) precondition.set_first_object(from_node) precondition.set_second_object(self) precondition.set_key(edge.get_key()) precondition.set_value(edge.get_value()) Preconditions.append(precondition) new_condition = Condition(False) new_condition.set_first_object(from_node) new_condition.set_second_object(other_node) new_condition.set_key(new_relation) new_condition.set_value(cause) Postconditions.append(new_condition) return Preconditions, Postconditions
def take_Item(self, input_array): if not self._condition_only: print "Receive or take an item" old_owner = input_array[0] item = input_array[1] own_reason = input_array[2] #Make the changes edge = Edge({'Owns' : own_reason}, self, item) #Set up our return arrays to_add = [edge] to_remove = item.remove_all_edges(True) #Add the new edges to their respective node self.add_outgoing_edge(edge) item.add_incoming_edge(edge) return to_remove, to_add else: print "Receive" old_owner = input_array[0] item = input_array[1] own_reason = input_array[2] pre_conditions = [] new_conditions = [] lost_conditions = [] precondition = Condition(False) precondition.set_first_object(self) where = old_owner.get_to_node_from_outgoing_edge_name({"Lives" : "N/A"}) precondition.set_second_object(where) precondition.set_key("Currently_In") precondition.set_value("N/A") pre_conditions.append(precondition) lost_conditions.extend(item.convert_all_edges_to_condition(True)) condition2 = Condition(False) condition2.set_first_object(self) condition2.set_second_object(item) condition2.set_key('Owns') condition2.set_value(own_reason) new_conditions.append(condition2) return pre_conditions, new_conditions, lost_conditions
def new_owner(self, input_array): if not self._condition_only: new_owner = input_array[0] status = input_array[1] own_reason = input_array[2] #Make the changes self._attributes['status'] = status edge = Edge({'Owns' : own_reason}, new_owner, self) #Set up our return arrays to_add = [edge] to_remove = self.remove_all_edges(True) #Add the new edges to their respective node new_owner.add_outgoing_edge(edge) self.add_incoming_edge(edge) return to_remove, to_add else: new_owner = input_array[0] status = input_array[1] own_reason = input_array[2] pre_conditions = [] new_conditions = [] lost_conditions = [] precondition = Condition(False) precondition.set_first_object(self) who = self.get_from_node_from_incoming_edge_name({"Owns" : "N/A"}) where = who.get_to_node_from_outgoing_edge_name({"Lives" : "N/A"}) precondition.set_second_object(where) precondition.set_key("Currently_In") precondition.set_value("N/A") pre_conditions.append(precondition) lost_conditions.append(self.attribute_to_condition('status')) lost_conditions.extend(self.convert_all_edges_to_condition(True)) condition = Condition(True) condition.set_first_object(self) condition.set_key('status') condition.set_value(status) new_conditions.append(condition) condition2 = Condition(False) condition2.set_first_object(new_owner) condition2.set_second_object(self) condition2.set_key('Owns') condition2.set_value(own_reason) new_conditions.append(condition2) return pre_conditions, new_conditions, lost_conditions
def killed_enemy(self, enemy): if not self._condition_only: enemy = enemy[0] if enemy.get_attributes()["number"] <= 1: enemy.get_attributes()["number"] = 0 enemy.get_attributes()["type"] = "Defeated_Enemy" else: enemy.get_attributes()["number"] -= 1 return [], [] else: enemy = enemy[0] pre_conditions = [] new_conditions = [] lost_conditions = [] precondition = Condition(True, True, ">") precondition.set_first_object(enemy) precondition.set_key("number") precondition.set_value(0) pre_conditions.append(precondition) # precondition2 = Condition(False) # precondition2.set_first_object(self) # where = enemy.get_to_node_from_outgoing_edge_name({"Lives" : "N/A"}) # precondition2.set_second_object(where) # precondition2.set_key("Currently_In") # precondition2.set_value("N/A") # pre_conditions.append(precondition2) if enemy.get_attributes()["number"] <= 1: lost_conditions.append(enemy.attribute_to_comparator_condition('number')) lost_conditions.append(enemy.attribute_to_condition('type')) condition = Condition(True, True, "=") condition.set_first_object(enemy) condition.set_key("number") condition.set_value(0) new_conditions.append(condition) condition2 = Condition(True) condition2.set_first_object(enemy) condition2.set_key("type") condition2.set_value("Defeated_Enemy") new_conditions.append(condition2) else: lost_conditions.append(enemy.attribute_to_comparator_condition('number')) condition = Condition(True, True, "=") condition.set_first_object(enemy) condition.set_key("number") condition.set_value(-1) #condition.set_value(enemy.get_attributes()["number"] - 1) new_conditions.append(condition) return pre_conditions, new_conditions, lost_conditions
def __init__(self): ''' Constructor ''' Condition.__init__(self)