///////////////////////// Public Ops ///////////////////
177142
boolean tryLock(long id, ItemState state, Transaction txn) {
        final CacheLine line = getLine(id);
        if (line == null)
            return false;
        synchronized (line) {
            if ((state == ItemState.OWNED & line.getState() == State.E)
                    | (state == ItemState.SHARED & !line.getState().isLessThan(State.S))) {
                lockLine(line, txn);
                return true;
            }
        }
        return false;
    }
710397
def dirty_ops(self, instance):
        ''' '''
        obj_value = instance._values[self._name]
        if not obj_value.set:
            return {}

        if not obj_value.dirty and self.__type.config_extra_fields != 'ignore':
            return {}

        ops = obj_value.value.get_dirty_ops()

        ret = {}
        for op, values in ops.items():
            ret[op] = {}
            for key, value in values.items():
                name = '%s.%s' % (self._name, key)
                ret[op][name] = value
        return ret
316789
protected <V> V execute (Operation<V> op)
        throws PersistenceException
    {
        return execute(op, true, true);
    }
1359234
public OperationFuture<List<Server>> addPublicIp(ServerFilter serverFilter,  CreatePublicIpConfig publicIpConfig) {
        return addPublicIp(Arrays.asList(getRefsFromFilter(serverFilter)), publicIpConfig);
    }
1073914
@Override
    public void handleOps(int ops) {
        if ((ops & SelectionKey.OP_ACCEPT) == 0 || closing) {
            return;
        }
        synchronized (channels) {
            if (connLimiter != null && !connLimiter.tryAcquire()) {
                return;
            }
            try {
                SocketChannel socketChannel = serverSocketChannel.accept();
                if (socketChannel == null) {
                    // "False alarm"
                    if (connLimiter != null) {
                        connLimiter.release();
                    }
                    return;
                }
                channels.add(new TcpChannelImpl(socketChannel));
            } catch (IOException e) {
                fire(new IOError(null, e));
            }
        }
    }
365436
public final void addOp(Operation op) {
    try {
      if (!authLatch.await(authWaitTime, TimeUnit.MILLISECONDS)) {
        FailureMode mode = connectionFactory.getFailureMode();
        if (mode == FailureMode.Redistribute || mode == FailureMode.Retry) {
          getLogger().debug("Redistributing Operation " + op + " because auth "
            + "latch taken longer than " + authWaitTime + " milliseconds to "
            + "complete on node " + getSocketAddress());
          connection.retryOperation(op);
        } else {
          op.cancel();
          getLogger().warn("Operation canceled because authentication "
            + "or reconnection and authentication has "
            + "taken more than " + authWaitTime + " milliseconds to "
            + "complete on node " + this);
          getLogger().debug("Canceled operation %s", op.toString());
        }
        return;
      }
      if (!inputQueue.offer(op, opQueueMaxBlockTime, TimeUnit.MILLISECONDS)) {
        throw new IllegalStateException("Timed out waiting to add " + op
            + "(max wait=" + opQueueMaxBlockTime + "ms)");
      }
    } catch (InterruptedException e) {
      // Restore the interrupted status
      Thread.currentThread().interrupt();
      throw new IllegalStateException("Interrupted while waiting to add " + op);
    }
  }
392561
def add_ops(op_classes):
    """"""
    def f(cls):
        for op_attr_name, op_class in op_classes.items():
            ops = getattr(cls, '{name}_ops'.format(name=op_attr_name))
            ops_map = getattr(cls, '{name}_op_nodes_map'.format(
                name=op_attr_name))
            for op in ops:
                op_node = ops_map[op]
                if op_node is not None:
                    made_op = _op_maker(op_class, op)
                    setattr(cls, 'visit_{node}'.format(node=op_node), made_op)
        return cls
    return f
596728
def t_op(self, s):
        '

        # Operators need to be further classified since the grammar requires this
        if s in ('<', '>', '==', '>=', '<=', '<>', '!='):
            self.add_token('COMP_OP', s)
        elif s in ('+=', '-=', '*=', '/=', '%=', '&=', '|=', '^=', '<<=', '>>=', '**=',
                   '//='):
            self.add_token('AUGASSIGN', s)
        elif s in self.UNOP2NAME.keys():
            self.add_token(self.UNOP2NAME[s], s)
        elif s in ('|', '^', '&', '<<', '>>', '**', '/', '%', '//'):
            # These are  *ONLY* binary operators. Operators which are exclusively or
            # can be unary operators were handled previously
            self.add_token('BINOP', s)
        elif s == '=':
            self.add_token('EQUAL', s)
        else:
            print("Internal error: Unknown operator %s" % s)
            raise SystemExit
72929
function fieldReorder(elem, field, val, pos) {
        try {
            $(exports).triggerHandler('fieldReorder', [elem, field, val, pos]);
        } catch (err) {
            console.error(err);
        }
        _currentOperation.ops.push({
            op: OP_FIELD_REORDER,
            arg: {
                _id: elem._id,
                f: field,
                e: val._id,
                i: pos
            }
        });
    }
615795
def canonical_ops(ops):
    ''' 
    '''
    new_ops = sorted(set(ops), key=lambda x: (x.entity, x.action))
    return new_ops
973313
function patch(object, ops) {
  ops = Array.isArray(ops) ? ops : [ops];
  object = ops.reduce(function (ob, op) {
    op = (0, _parse2['default'])(op, ob);
    return operators[op.op].call(ob, op);
  }, object);
  // Re-convert the returned object into an
  // immutable structure, in case the entire
  // object was replaced with a POJO
  return _immutable2['default'].fromJS(object);
}
657778
function batch(ops) {
  var commands = [], url;

  for (let i = 0; i < ops.length; i++) {
    let { key, value } = ops[i],
      { table, schema } = findSchemaAndTable(key),
      map = columnToValueMap('id', key);

    columnToValueMap('data', wrapJSONStringInObject(key, value), map);

    // add url column to map if putting a uri
    if (isUri(key)) {
      url = decode(key.split('/_uris/').pop());

      columnToValueMap('url', url, map);
    }

    commands.push(onConflictPut(map, schema, table).then(() => map.data));
  }

  return Promise.all(commands);
}
1112186
function getOperationResponseHeaders(operation) {
    var headers = [];

    if (operation) {
        _.each(operation.responses, function(response, responseCode) {
            // Convert responseCode to a numeric value for sorting ("default" comes last)
            responseCode = parseInt(responseCode) || 999;

            _.each(response.headers, function(header, name) {
                // We only care about headers that have a default value defined
                if (header.default !== undefined) {
                    headers.push({
                        order: responseCode,
                        name: name.toLowerCase(),
                        value: header.default
                    });
                }
            });
        });
    }

    return _.sortBy(headers, 'order');
}
456775
private void addOps(Map<Key, List<TableOperation>> operations, Table schemaTable, Row row)
    {
        Key key = ((TableImpl) schemaTable).createKey(row, false);

        TableOperation ops = tableAPI.getTableOperationFactory().createPut(row, Choice.NONE, true);

        if (operations.containsKey(key))
        {
            operations.get(key).add(ops);

        }
        else
        {
            List<TableOperation> operation = new ArrayList<TableOperation>();
            operation.add(ops);
            operations.put(key, operation);
        }
    }
342876
@Override
  @SuppressWarnings("deprecation")
  public <T extends CoreExecution> void performOperation(CoreAtomicOperation<T> operation) {
    if (operation instanceof AtomicOperation) {
      performOperation((AtomicOperation) operation);
    } else {
      super.performOperation(operation);
    }
  }
925580
def get_ops(self, ops):
        ''''''
        time = 0.
        for op, count in ops.items():
            time += self.get(op) * count
        return time
108538
function applyOperations(operations) {
  for(var i = 0; i < operations.length; i++) {
    var {_1: path, _2: action} = operations[i];
    if(action["$d_ctor"] == "Write") {
      fs.writeFileSync(path, action.args._2, "utf8");
    } else if(action["$d_ctor"] == "Create") {
      // TODO: Create the path if necessary
      fs.writeFileSync(path, action.args._1, "utf8");
    } else if(action["$d_ctor"] == "Rename") {
      if(path.startsWith("/")) path = path.substring(1);
      var newName = action.args._1;
      if(newName.startsWith("/")) newName = newName.substring(1);
      fs.renameSync(path, newName);
    } else if(action["$d_ctor"] == "Delete") {
      fs.unlinkSync(path);
    } else {
      console.log("unrecognized action:", action);
    }
  }
}