Given a list of checked operations, find the ones that collide.
        Return a dict structured as history_id_key --> [history_id]
19023
def find_collisions( self, checked_ops ):
        

        collisions = {}
        for op in checked_ops:
            if BlockstackDB.nameop_is_collided( op ):
                BlockstackDB.nameop_put_collision( collisions, op )

        return collisions
1150755
def check_name_collision( self, name, block_id, checked_ops ):
        

        return self.check_collision( "name", name, block_id, checked_ops, OPCODE_NAME_STATE_CREATIONS )
133931
def history(self):
        ''' 
        '''
        url= 'https://coincheck.com/api/exchange/orders/transactions'
        headers = make_header(url,access_key=self.access_key,secret_key=self.secret_key)
        r = requests.get(url,headers=headers)
        return json.loads(r.text)
469014
def _complete_history(self, cmd, args, text):
        """"""
        if args:
            return
        return [ x for x in { 'clear', 'clearall' } \
                if x.startswith(text) ]
1042618
def cache_affected_objects_review_history(portal):
    
    logger.info("Caching review_history ...")
    query = dict(portal_type=NEW_SENAITE_WORKFLOW_BINDINGS)
    brains = api.search(query, UID_CATALOG)
    total = len(brains)
    for num, brain in enumerate(brains):
        if num % 100 == 0:
            logger.info("Caching review_history: {}/{}"
                        .format(num, total))
        review_history = get_review_history_for(brain)
        review_history_cache[api.get_uid(brain)] = review_history
1284839
def namedb_get_history( cur, history_id, offset=None, count=None, reverse=False ):
    
    # get history in increasing order by block_id and then vtxindex
    history_rows = namedb_get_history_rows( cur, history_id, offset=offset, count=count, reverse=reverse )
    return namedb_history_extract( history_rows )
647215
def query_all_collisions(collision_object):
        
        global collidable_objects
        colliding = []
        for obj in collidable_objects:
            #Make sure we don't check ourself against ourself.
            if obj is not collision_object:
                if collision_object.is_colliding(obj):
                    #A collision has been detected. Add the object that we are colliding with.
                    colliding.append(obj)

        return colliding
960135
def _get_history_id(self, connection, agent_id, instance_id):
        '''
        
        '''
        cache_key = (agent_id, instance_id, )
        if cache_key in self._history_id_cache:
            history_id = self._history_id_cache[cache_key]
            return history_id
        else:
            command = text_helper.format_block("""
            SELECT id FROM histories WHERE agent_id = ? AND instance_id = ?
            """)
            cursor = connection.cursor()
            cursor.execute(command, (agent_id, instance_id, ))
            res = cursor.fetchall()
            if res:
                history_id = res[0][0]
                self._history_id_cache[cache_key] = history_id
                return history_id
            else:
                command = 'INSERT INTO histories VALUES (NULL, ?, ?)'
                cursor.execute(command, (agent_id, instance_id, ))
                history_id = cursor.lastrowid
                self._history_id_cache[cache_key] = history_id
                return history_id
509179
private HistoryEntry processIndex(List<HistoryEntry> history) {
    log.debug("I received entry: "+index);
    HistoryEntry selectedEntry = null;
    if(index != null && index > 0) {
      for(HistoryEntry entry : history) {
        if(entry.getIndex() == index) {
          if(!entry.isRevertible()) {
            System.err.println("Selected index ["+index+"] is not revertible.");
            index = null;
          } else {
            selectedEntry = entry;
          }
          break;
        }
      }
      if(index == null) {
        selectedEntry = null;
      } else if(selectedEntry == null) {
        System.err.println("Invalid entry!");
        index = null;
      }
    } else if(index != null && index < 0) {
      for(HistoryEntry entry : history) {
        if(entry.isRevertible()) {
          if(index++ == 0) {
            selectedEntry = entry;
            index = entry.getIndex();
            break;
          }
        }
      }
      if(selectedEntry == null) {
        System.err.println("Invalid entry!");
        index = null;
      }
    } else {
      index = null;
      System.err.println("Invalid entry!");
    }
    return selectedEntry;
  }
391203
def get_purged_review_history_for(brain_or_object):
    
    history = review_history_cache.get(api.get_uid(brain_or_object), [])

    # Boil out those actions not supported by object's current workflow
    available_actions = get_workflow_actions_for(brain_or_object)
    history = filter(lambda action: action["action"] in available_actions
                                    or action["action"] is None, history)

    # Boil out those states not supported by object's current workflow
    available_states = get_workflow_states_for(brain_or_object)
    history = filter(lambda act: act["review_state"] in available_states,
                     history)

    # If no meaning history found, create a default one for initial state
    if not history:
        history = create_initial_review_history(brain_or_object)
    return history
1255682
def state_preorder(collision_checker):
    
    def wrap( check ):
        def wrapped_check( state_engine, nameop, block_id, checked_ops ):
            rc = check( state_engine, nameop, block_id, checked_ops )
            if rc:
                # verify no duplicates 
                history_id_key = "preorder_hash"
                rc = state_check_collisions( state_engine, nameop, history_id_key, block_id, checked_ops, collision_checker )
                if rc:
                    log.debug("COLLISION on %s '%s'" % (history_id_key, nameop[history_id_key]))
                    rc = False 
                else:
                    # no collision
                    rc = True

                # sanity check---we need to have the appropriate metadata for this operation
                invariant_tags = state_preorder_invariant_tags()
                for tag in invariant_tags:
                    assert tag in nameop, "BUG: missing invariant tag '%s'" % tag

                # sanity check---all required consensus fields must be present
                for required_field in CONSENSUS_FIELDS_REQUIRED:
                    assert required_field in nameop, 'BUG: missing required consensus field {}'.format(required_field)

            return rc
        return wrapped_check
    return wrap
568048
def function_history():
    
    ret = []
    frm = inspect.currentframe()
    for i in range(100):
        try:
            if frm.f_code.co_name != 'run_code':  # this is pycharm debugger
                                                  # inserting middleware
                ret.append(frm.f_code.co_name)
            frm = frm.f_back
        except Exception as e:
            break
    return ret
442926
def ReadClientCrashInfoHistory(self, client_id, cursor=None):
    """"""
    cursor.execute(
        "SELECT UNIX_TIMESTAMP(timestamp), crash_info "
        "FROM client_crash_history WHERE "
        "client_crash_history.client_id = %s "
        "ORDER BY timestamp DESC", [db_utils.ClientIDToInt(client_id)])
    ret = []
    for timestamp, crash_info in cursor.fetchall():
      ci = rdf_client.ClientCrash.FromSerializedString(crash_info)
      ci.timestamp = mysql_utils.TimestampToRDFDatetime(timestamp)
      ret.append(ci)
    return ret
1016780
def operations_happening_at_same_time_as(
        self, scheduled_operation: ScheduledOperation
    ) -> List[ScheduledOperation]:
        
        overlaps = self.query(
            time=scheduled_operation.time,
            duration=scheduled_operation.duration)
        return [e for e in overlaps if e != scheduled_operation]
968385
def get_checked_features(self):
        
        feature_types = []
        if self.roads_flag.isChecked():
            feature_types.append('roads')
        if self.buildings_flag.isChecked():
            feature_types.append('buildings')
        if self.building_points_flag.isChecked():
            feature_types.append('building-points')
        if self.flood_prone_flag.isChecked():
            feature_types.append('flood-prone')
        if self.evacuation_centers_flag.isChecked():
            feature_types.append('evacuation-centers')
        if self.boundary_flag.isChecked():
            level = self.admin_level_comboBox.currentIndex() + 1
            feature_types.append('boundary-%s' % level)
        return feature_types
664445
def history(self):
        
        history = OrderedDict()
        for cycle in self:
            d = cycle.last_iteration
            for k, v in d.items():
                if k in history:
                    history[k].append(v)
                else:
                    history[k] = [v]

        # Convert to numpy arrays.
        for k, v in history.items():
            history[k] = np.array(v)

        return history
1099272
def get_prev_status_from_history(instance, status=None):
    
    target = status or api.get_workflow_status_of(instance)
    history = getReviewHistory(instance, reverse=True)
    history = map(lambda event: event["review_state"], history)
    if target not in history or history.index(target) == len(history)-1:
        return None
    return history[history.index(target)+1]