Move a line or column to a given direction (d)
17815
def __moveLineOrCol(self, line, d):
        
        nl = [c for c in line if c != 0]
        if d == Board.UP or d == Board.LEFT:
            return nl + [0] * (self.__size - len(nl))
        return [0] * (self.__size - len(nl)) + nl
197597
def move_to(self, id_):
        """"""
        if self.items:
            try:
                self.current_item = self.items[id_]
            except (StopIteration, IndexError, NoSuchItem):
                raise NoSuchItem
            for f in self._hooks["select"]:
                f(self, id_)
        return self
142713
def diagonalColumnRow(d, i)
      {
        'column' => (d.to_i < 0 ? i : d.to_i + i).to_i,
        'row' => (d.to_i < 0 ? d.to_i.abs + i : i).to_i
      }
    end
114921
private QueryParameters.Direction convertToDirection(int columnType) {
        QueryParameters.Direction result = null;

        if (columnType == DatabaseMetaData.procedureColumnIn) {
            result = QueryParameters.Direction.IN;
        } else if (columnType == DatabaseMetaData.procedureColumnInOut) {
            result = QueryParameters.Direction.INOUT;
        } else if (columnType == DatabaseMetaData.procedureColumnOut) {
            result = QueryParameters.Direction.OUT;
        } else if (columnType == DatabaseMetaData.procedureColumnReturn) {
            result = QueryParameters.Direction.RETURN;
        } else if (columnType == DatabaseMetaData.procedureColumnResult) {
            result = QueryParameters.Direction.RETURN;
        } else {
            throw new IllegalArgumentException("Incorrect column type: " + columnType);
        }

        return result;
    }
851825
def to_string(direction):
    '''

    '''
    if direction == UP:
        return UP
    elif direction == DOWN:
        return DOWN
    elif direction == LEFT:
        return LEFT
    elif direction == RIGHT:
        return RIGHT
    else:
        raise InvalidDirectionError(type_string)
1269405
function position() {
    var start = { line: lineno, column: column };
    return function(node){
      node.position = new Position(start);
      whitespace();
      return node;
    };
  }
921779
def update_line(self, t, x, y, **kw):
        
        self.panel.update_line(t, x, y, **kw)
338392
function updatePosition(str) {
    var lines = str.match(/\n/g);
    if (lines) lineno += lines.length;
    var i = str.lastIndexOf('\n');
    column = ~i ? str.length - i : column + str.length;
  }
305145
def ship_move(ship, x, y, speed):
    """"""
    click.echo('Moving ship %s to %s,%s with speed %s' % (ship, x, y, speed))
603770
def _line_opt(self):
        """"""
        direction = self.search_direction.direction
        if self.constraints is not None:
            try:
                direction = self.constraints.project(self.x, direction)
            except ConstraintError:
                self._screen("CONSTRAINT PROJECT FAILED", newline=True)
                return False
        direction_norm = np.linalg.norm(direction)
        if direction_norm == 0:
            return False
        self.line.configure(self.x, direction/direction_norm)

        success, wolfe, qopt, fopt = \
            self.line_search(self.line, self.initial_step_size, self.epsilon)
        if success:
            self.step = qopt*self.line.axis
            self.initial_step_size = np.linalg.norm(self.step)
            self.x = self.x + self.step
            self.f = fopt
            if wolfe:
                self._screen("W")
            else:
                self._screen(" ")
                self.search_direction.reset()
            return True
        else:
            if self.debug_line:
                import matplotlib.pyplot as pt
                import datetime
                pt.clf()
                qs = np.arange(0.0, 100.1)*(5*self.initial_step_size/100.0)
                fs = np.array([self.line(q) for q in qs])
                pt.plot(qs, fs)
                pt.xlim(qs[0], qs[-1])
                fdelta = fs.max() - fs.min()
                if fdelta == 0.0:
                    fdelta = fs.mean()
                fmargin = fdelta*0.1
                pt.ylim(fs.min() - fmargin, fs.max() + fmargin)
                pt.title('fdelta = %.2e   fmean = %.2e' % (fdelta, fs.mean()))
                pt.xlabel('Line coordinate, q')
                pt.ylabel('Function value, f')
                pt.savefig('line_failed_%s.png' % (datetime.datetime.now().isoformat()))
            self._reset_state()
            return False
696305
def get_position(self, row, col):
        """"""
        result = col
        self.log.debug('%s %s', row, col)
        lines = self.editor.getlines()[:row - 1]
        result += sum([len(l) + 1 for l in lines])
        self.log.debug(result)
        return result
1297302
function moveSelection(
    opts: Options,
    change: Change,
    x: number,
    y: number
): Change {
    const { value } = change;
    const { startKey } = value;
    const pos = TablePosition.create(opts, value.document, startKey);

    if (!pos.isInCell()) {
        throw new Error('moveSelection can only be applied from within a cell');
    }

    const { table } = pos;
    const row = table.nodes.get(y);
    const cell = row.nodes.get(x);

    return change.collapseToStartOf(cell);
}
579760
def linecol_to_pos(text, line, col):
    
    nth_newline_offset = 0
    for i in range(line - 1):
        new_offset = text.find("\n", nth_newline_offset)
        if new_offset < 0:
            raise ValueError("Text does not have {0} lines."
                             .format(line))
        nth_newline_offset = new_offset + 1
    offset = nth_newline_offset + col
    if offset > len(text):
        raise ValueError("Line {0} column {1} is not within the text"
                         .format(line, col))
    return offset
118361
def moveToPoint(self, xxx_todo_changeme):
        
        (x,y) = xxx_todo_changeme
        self.set_x(float(self.get_x()) + float(x))
        self.set_y(float(self.get_y()) + float(y))
246785
function(currentDirection){
            var directions = ['up', 'right', 'down', 'left'],
                currentDirIndex = directions.indexOf(currentDirection),
                newDirIndex;
            // if currentDirection is not valid or is the last in the array use the first direction in the array
            if(currentDirIndex === -1 || currentDirIndex === directions.length - 1){
                newDirIndex = 0;
            } else {
                newDirIndex = currentDirIndex + 1;
            }
            return directions[newDirIndex];
        }
1330562
def line_and_column(text, position):
    """"""
    position_counter = 0
    for idx_line, line in enumerate(text.splitlines(True)):
        if (position_counter + len(line.rstrip())) >= position:
            return (idx_line, position - position_counter)
        else:
            position_counter += len(line)
1250659
def do_move_to(self, element, decl, pseudo):
        """"""
        target = serialize(decl.value).strip()
        step = self.state[self.state['current_step']]
        elem = self.current_target().tree

        #  Find if the current node already has a move, and remove it.
        actions = step['actions']
        for pos, action in enumerate(reversed(actions)):
            if action[0] == 'move' and action[1] == elem:
                target_index = - pos - 1
                actions[target_index:] = actions[target_index+1:]
                break

        _, valstep = self.lookup('pending', target)
        if not valstep:
            step['pending'][target] = [('move', elem)]
        else:
            self.state[valstep]['pending'][target].append(('move', elem))