Limits position p to stay inside containing state
        :param p: Position to limit
        :param se_pos: Bottom/Right boundary
        :param nw_pos: Top/Left boundary
        :return:
164359
def limit_pos(p, se_pos, nw_pos):
        
        if p > se_pos:
            _update(p, se_pos)
        elif p < nw_pos:
            _update(p, nw_pos)
469139
def move(self, pos):
        """"""

        try:
            payload = {"address":self.address, "user": self.user, "pwd": self.pswd, "pos": map_position(pos)}
            resp = requests.get(
                    "http://{address}/decoder_control.cgi?command={pos}&user={user}&pwd={pwd}".format(**payload)
            )
        except KeyError:
            raise CamException("Position must be within 1 to 16.")
        if resp.status_code != 200:
            raise CamException("Unauthorized. Wrong user or password.")
        return "ok"
320618
def _set_position(self, value):
        
        pX, pY = self.position
        x, y = value
        dX = x - pX
        dY = y - pY
        self.moveBy((dX, dY))
129083
function updatePos( pos, prop, val ) {
					floatSpace.setStyle( prop, pixelate( val ) );
					floatSpace.setStyle( 'position', pos );
				}
744545
public void setPosition(Long pos) {
        Interval interval = getInterval();
        if (interval != null) {
            resetInterval(pos, interval.getStartGranularity());
        } else {
            resetInterval(pos, null);
        }
    }
458026
function posToLine(pos, src) {
    if (pos >= src.length) {
        pos = src.length - 1;
    }

    if (pos <= -1) {
        return -1;
    }

    let line = 1;
    for (let i = 0; i < pos; i++) {
        if (src[i] === "\n") {
            ++line;
        }
    }

    return line;
}
770438
def __set_position(self):
        

        rectangle = hasattr(self.parent(), "viewport") and self.parent().viewport().rect() or self.parent().rect()
        if not rectangle:
            return

        self.adjustSize()

        if self.__anchor == 0:
            point_x = rectangle.width() / 2 - self.width() / 2
            point_y = self.__vertical_padding
        elif self.__anchor == 1:
            point_x = rectangle.width() - self.width() - self.__horizontal_padding
            point_y = self.__vertical_padding
        elif self.__anchor == 2:
            point_x = rectangle.width() - self.width() - self.__horizontal_padding
            point_y = rectangle.height() / 2 - self.height() / 2
        elif self.__anchor == 3:
            point_x = rectangle.width() - self.width() - self.__horizontal_padding
            point_y = rectangle.height() - self.height() - self.__vertical_padding
        elif self.__anchor == 4:
            point_x = rectangle.width() / 2 - self.width() / 2
            point_y = rectangle.height() - self.height() - self.__vertical_padding
        elif self.__anchor == 5:
            point_x = self.__horizontal_padding
            point_y = rectangle.height() - self.height() - self.__vertical_padding
        elif self.__anchor == 6:
            point_x = self.__horizontal_padding
            point_y = rectangle.height() / 2 - self.height() / 2
        elif self.__anchor == 7:
            point_x = self.__horizontal_padding
            point_y = self.__vertical_padding
        elif self.__anchor == 8:
            point_x = rectangle.width() / 2 - self.width() / 2
            point_y = rectangle.height() / 2 - self.height() / 2

        self.setGeometry(point_x + self.__horizontal_offset, point_y +
                                                             self.__vertical_offset, self.width(), self.height())
151654
def _bounded(p1, p2, line, pos, line_no, lines):
    """"""
    substrings = []
    start_line_no = line_no
    end = pos
    while not line.startswith(p2, end):
        if line[end] == '\\':
            end += 2
        else:
            end += 1
        if end >= len(line):
            substrings.append(line[pos:])
            try:
                line_no, line = next(lines)
            except StopIteration:
                pattern = 'docstring' if p1 == '"""' else 'block comment'
                raise TdlParsingError('Unterminated {}'.format(pattern),
                                      line_number=start_line_no)
            pos = end = 0
    substrings.append(line[pos:end])
    end += len(p2)
    return ''.join(substrings), start_line_no, line_no, line, end
431684
private boolean separatorDown(Rectangular pos)
    {
        if (pos.getY2() < getTopology().getTopologyHeight()-1)
        {
            Rectangular spos = getTopology().toPixelPositionAbsolute(new Rectangular(pos.getX1(), pos.getY2(), pos.getX2(), pos.getY2()));
            Rectangular epos = getTopology().toPixelPositionAbsolute(new Rectangular(pos.getX1(), pos.getY2() + 1, pos.getX2(), pos.getY2() + 1));
            return seps.isSeparatorAt(spos.midX(), spos.getY2()) ||
                   seps.isSeparatorAt(epos.midX(), epos.getY1());
        }
        else
            return true;
    }
228054
def at_index(self, pos, predicate=None, index=None):
        
        return filter_index(self._index_dict[pos], predicate, index)
685509
public void setAreaPosition(boolean relative, CmsPositionBean pos) {

        if (pos == null) {
            return;
        }
        m_state = State.SELECTED;
        showSelect(true);
        m_currentSelection = new CmsPositionBean();
        m_firstX = pos.getLeft();
        m_firstY = pos.getTop();
        if (!relative) {
            m_firstX -= getElement().getAbsoluteLeft();
            m_firstY -= getElement().getAbsoluteTop();
        }
        //        setSelectPosition(m_firstX, m_firstY, 0, 0);
        setSelectPosition(m_firstX, m_firstY, pos.getHeight(), pos.getWidth());
    }
279634
def sphere_pos(self, x):
        """"""
        # return np.random.rand(1)[0]**0 * sum(x**2) + 1 * np.random.rand(1)[0]
        c = 0.0
        if x[0] < c:
            return np.nan
        return -c**2 + sum((x + 0)**2)
772834
def positionedcrop(self,x,y,sheet_coord_system):
        
        cf_row,cf_col = sheet_coord_system.sheet2matrixidx(x,y)
        bounds_x,bounds_y=self.compute_bounds(sheet_coord_system).centroid()

        b_row,b_col=sheet_coord_system.sheet2matrixidx(bounds_x,bounds_y)

        row_offset = cf_row-b_row
        col_offset = cf_col-b_col
        self.translate(row_offset,col_offset)
647153
public void setPos(Object p) {
        Object[] a = (Object[]) p;
        buf = (char[]) a[0];
        int[] v = (int[]) a[1];
        pos.setIndex(v[0]);
        bufPos = v[1];
    }
838984
def scenePos( self ):
        
        pos     = self.pos()
        pitem   = self.parentItem()
        
        while (pitem):
            pos     = pitem.pos() + pos
            pitem   = pitem.parentItem()
        
        return pos
841629
function(pos, pointer) {
    var mode = this.options.selection.mode,
        selection = this.selection.selection;

    if(mode.indexOf('x') == -1) {
      pos.x = (pos == selection.first) ? 0 : this.plotWidth;         
    }else{
      pos.x = boundX(pointer.relX, this);
    }

    if (mode.indexOf('y') == -1) {
      pos.y = (pos == selection.first) ? 0 : this.plotHeight - 1;
    }else{
      pos.y = boundY(pointer.relY, this);
    }
  }
1017380
private void setSelectPosition(int posX, int posY, int height, int width) {

        int useWidth = Window.getClientWidth();
        int bodyWidth = RootPanel.getBodyElement().getClientWidth() + RootPanel.getBodyElement().getOffsetLeft();
        if (bodyWidth > useWidth) {
            useWidth = bodyWidth;
        }
        int useHeight = Window.getClientHeight();
        int bodyHeight = RootPanel.getBodyElement().getClientHeight() + RootPanel.getBodyElement().getOffsetTop();
        if (bodyHeight > useHeight) {
            useHeight = bodyHeight;
        }

        m_overlayLeftStyle.setWidth(posX - m_offset, Unit.PX);
        m_overlayLeftStyle.setHeight(useHeight, Unit.PX);

        m_borderLeftStyle.setHeight(height + (4 * m_offset), Unit.PX);
        m_borderLeftStyle.setTop(posY - (2 * m_offset), Unit.PX);
        m_borderLeftStyle.setLeft(posX - (2 * m_offset), Unit.PX);

        m_overlayTopStyle.setLeft(posX - m_offset, Unit.PX);
        m_overlayTopStyle.setWidth(width + (2 * m_offset), Unit.PX);
        m_overlayTopStyle.setHeight(posY - m_offset, Unit.PX);

        m_borderTopStyle.setLeft(posX - m_offset, Unit.PX);
        m_borderTopStyle.setTop(posY - (2 * m_offset), Unit.PX);
        if (m_hasButtonBar) {
            m_borderTopStyle.setWidth(width + (2 * m_offset) + BUTTON_BAR_WIDTH, Unit.PX);
        } else {
            m_borderTopStyle.setWidth(width + (2 * m_offset), Unit.PX);
        }

        m_overlayBottomStyle.setLeft(posX - m_offset, Unit.PX);
        m_overlayBottomStyle.setWidth(width + m_offset + m_offset, Unit.PX);
        m_overlayBottomStyle.setHeight(useHeight - posY - height - m_offset, Unit.PX);
        m_overlayBottomStyle.setTop(posY + height + m_offset, Unit.PX);

        m_borderBottomStyle.setLeft(posX - m_offset, Unit.PX);
        m_borderBottomStyle.setTop((posY + height) + m_offset, Unit.PX);
        if (m_hasButtonBar) {
            m_borderBottomStyle.setWidth(width + (2 * m_offset) + BUTTON_BAR_WIDTH, Unit.PX);
        } else {
            m_borderBottomStyle.setWidth(width + (2 * m_offset), Unit.PX);
        }

        m_overlayRightStyle.setLeft(posX + width + m_offset, Unit.PX);
        m_overlayRightStyle.setWidth(useWidth - posX - width - m_offset, Unit.PX);
        m_overlayRightStyle.setHeight(useHeight, Unit.PX);

        m_borderRightStyle.setHeight(height + (4 * m_offset), Unit.PX);
        m_borderRightStyle.setTop(posY - (2 * m_offset), Unit.PX);
        if (m_hasButtonBar) {
            m_borderRightStyle.setLeft(posX + width + m_offset + BUTTON_BAR_WIDTH, Unit.PX);
        } else {
            m_borderRightStyle.setLeft(posX + width + m_offset, Unit.PX);
        }

        m_buttonBar.getStyle().setTop(posY - m_offset, Unit.PX);
        m_buttonBar.getStyle().setHeight(height + (2 * m_offset), Unit.PX);
        m_buttonBar.getStyle().setLeft(posX + width + m_offset + 1, Unit.PX);
    }