returns the data item the mouse is over/ the cursor is closest to, or null if none is found
550962
function findNearbyItem(mouseX, mouseY, seriesFilter, radius, computeDistance) {
            var maxDistance = radius,
                smallestDistance = maxDistance * maxDistance + 1,
                item = null,
                dx, dy, dist,
                i, j, ps;

            for (i = series.length - 1; i >= 0; --i) {
                if (!seriesFilter(i)) continue;

                var s = series[i];
                if (!s.datapoints) return;
                var x, y,
                    axisx = s.xaxis,
                    axisy = s.yaxis,
                    points = s.datapoints.points,
                    mx = axisx.c2p(mouseX), // precompute some stuff to make the loop faster
                    my = axisy.c2p(mouseY),
                    maxx = maxDistance / axisx.scale,
                    maxy = maxDistance / axisy.scale;

                ps = s.datapoints.pointsize;
                // with inverse transforms, we can't use the maxx/maxy
                // optimization, sadly
                if (axisx.options.inverseTransform) {
                    maxx = Number.MAX_VALUE;
                }

                if (axisy.options.inverseTransform) {
                    maxy = Number.MAX_VALUE;
                }

                for (j = 0; j < points.length; j += ps) {
                    x = points[j];
                    y = points[j + 1];
                    if (x == null) {
                        continue;
                    }

                    if (x - mx > maxx || x - mx < -maxx ||
                        y - my > maxy || y - my < -maxy) {
                        continue;
                    }

                    // We have to calculate distances in pixels, not in
                    // data units, because the scales of the axes may be different
                    dx = Math.abs(axisx.p2c(x) - mouseX);
                    dy = Math.abs(axisy.p2c(y) - mouseY);
                    dist = computeDistance ? computeDistance(dx, dy) : dx * dx + dy * dy;

                    // use <= to ensure last point takes precedence
                    // (last generally means on top of)
                    if (dist < smallestDistance) {
                        smallestDistance = dist;
                        item = [i, j / ps];
                    }
                }
            }

            if (item) {
                i = item[0];
                j = item[1];
                ps = series[i].datapoints.pointsize;

                return {
                    datapoint: series[i].datapoints.points.slice(j * ps, (j + 1) * ps),
                    dataIndex: j,
                    series: series[i],
                    seriesIndex: i
                };
            }

            return null;
        }
1267239
function getCursorPosition(event) {
  let cursorX;
  let cursorY;
  let rect = htmlElement.getBoundingClientRect();
  if (event.touches !== undefined) {
    cursorX = event.touches[0].clientX;
    cursorY = event.touches[0].clientY;
  } else {
    cursorX = event.clientX;
    cursorY = event.clientY;
  }
  return {
    x: cursorX - rect.left,
    y: cursorY - rect.top,
  };
}
839105
def on_change_zijd_mouse_cursor(self, event):
        
        if not array(self.CART_rot).any():
            return
        pos = event.GetPosition()
        width, height = self.canvas1.get_width_height()
        pos[1] = height - pos[1]
        xpick_data, ypick_data = pos
        xdata_org = list(self.CART_rot[:, 0]) + list(self.CART_rot[:, 0])
        ydata_org = list(-1*self.CART_rot[:, 1]) + list(-1*self.CART_rot[:, 2])
        data_corrected = self.zijplot.transData.transform(
            vstack([xdata_org, ydata_org]).T)
        xdata, ydata = data_corrected.T
        xdata = list(map(float, xdata))
        ydata = list(map(float, ydata))
        e = 4e0

        if self.zijderveld_setting == "Zoom":
            self.canvas1.SetCursor(wx.Cursor(wx.CURSOR_CROSS))
        else:
            self.canvas1.SetCursor(wx.Cursor(wx.CURSOR_ARROW))
        for i, (x, y) in enumerate(zip(xdata, ydata)):
            if 0 < sqrt((x-xpick_data)**2. + (y-ypick_data)**2.) < e:
                self.canvas1.SetCursor(wx.Cursor(wx.CURSOR_HAND))
                break
        event.Skip()
104017
public Object getData() 
    {
        try {
            Object objValue = super.getData();    // Get the actual key data.
            if (objValue == null)
                objValue = m_strNullValue;
            if (objValue == null)
                return null;
            if (objValue.getClass() == m_fieldKey.getDataClass())
                m_fieldKey.setData(objValue);
            else
                m_fieldKey.setString(objValue.toString());
            if (m_record.getTable().seek(null) == true)  // I use get, so the index matches the index of JComboBox
                return m_fieldData.getData();
        } catch (Exception ex)  {
            ex.printStackTrace();
        }
        return null;
    }
214136
def get_item_data(self, session, item, byte_range=None):
        

        # Parse byte range
        if byte_range is not None:
            begin, end = parse_byte_range(byte_range, max_byte=item.file_size)
        else:
            begin, end = 0, item.file_size

        # Open the file
        fp = open(item.file_name, "rb+")

        if not begin:
            return fp, item.file_type, item.file_size
        elif begin and not end:
            fp.seek(begin)
            return fp, item.file_type, item.file_size
        elif begin and end:
            fp.seek(begin)

            data = fp.read(end - begin)
            result = cStringIO.StringIO(data)

            return result, item.file_type, item.file_size
697001
def word_under_mouse_cursor(self):
        
        editor = self._editor
        text_cursor = editor.cursorForPosition(editor._last_mouse_pos)
        text_cursor = self.word_under_cursor(True, text_cursor)
        return text_cursor
303930
function getClickDataset(path) {
            var el;
            for (var i = 0; i < path.length; i++) {
                el = path[i];
                if (el.dataset.nctr !== undefined) {
                    return el.dataset;
                }
            }
            return null;
        }
1094404
def get_cursor_position(self):
        """"""
        # TODO would this be cleaner as a parameter?
        in_stream = self.in_stream

        query_cursor_position = u"\x1b[6n"
        self.write(query_cursor_position)

        def retrying_read():
            while True:
                try:
                    c = in_stream.read(1)
                    if c == '':
                        raise ValueError("Stream should be blocking - should't"
                                         " return ''. Returned %r so far",
                                         (resp,))
                    return c
                except IOError:
                    raise ValueError(
                        'cursor get pos response read interrupted'
                    )
                    # find out if this ever really happens - if so, continue

        resp = ''
        while True:
            c = retrying_read()
            resp += c
            m = re.search('(?P<extra>.*)'
                          '(?P<CSI>\x1b\[|\x9b)'
                          '(?P<row>\\d+);(?P<column>\\d+)R', resp, re.DOTALL)
            if m:
                row = int(m.groupdict()['row'])
                col = int(m.groupdict()['column'])
                extra = m.groupdict()['extra']
                if extra:
                    if self.extra_bytes_callback:
                        self.extra_bytes_callback(
                            extra.encode(in_stream.encoding)
                        )
                    else:
                        raise ValueError(("Bytes preceding cursor position "
                                          "query response thrown out:\n%r\n"
                                          "Pass an extra_bytes_callback to "
                                          "CursorAwareWindow to prevent this")
                                         % (extra,))
                return (row - 1, col - 1)
1168029
@Override
   public CursorPosition getCursor()
   {
      if (settings.isAnsiConsole() && Config.isOSPOSIXCompatible())
      {
         try
         {
            StringBuilder col = new StringBuilder(4);
            StringBuilder row = new StringBuilder(4);
            out().print(ANSI.CURSOR_ROW);
            out().flush();
            boolean gotSep = false;
            // read the position
            int[] input = read();

            for (int i = 2; i < input.length - 1; i++)
            {
               if (input[i] == 59) // we got a ';' which is the separator
                  gotSep = true;
               else
               {
                  if (gotSep)
                     col.append((char) input[i]);
                  else
                     row.append((char) input[i]);
               }
            }
            return new CursorPosition(Integer.parseInt(row.toString()),
                     Integer.parseInt(col.toString()));
         }
         catch (Exception e)
         {
            if (settings.isLogging())
               logger.log(Level.SEVERE,
                        "Failed to find current row with ansi code: ", e);
            return new CursorPosition(-1, -1);
         }
      }
      return new CursorPosition(-1, -1);
   }
860579
public function getEndCursor()
    {
        if(isset($this->obj_last_response->batch) && isset($this->obj_last_response->batch->endCursor)) {
            return $this->obj_last_response->batch->endCursor;
        }
        return null;
    }
942866
def cursor_for_object_in_connection(data, _object):
    '''
    
    '''
    if _object not in data:
        return None

    offset = data.index(_object)
    return offset_to_cursor(offset)
1305796
function getFocusedTabId() {
    var focusedTab = ctrl.tabs[ctrl.focusIndex];
    if (!focusedTab || !focusedTab.id) {
      return null;
    }
    return 'tab-item-' + focusedTab.id;
  }
826183
def data_item(self) -> DataItem:
        
        display_panel = self.__display_panel
        if not display_panel:
            return None
        data_item = display_panel.data_item
        return DataItem(data_item) if data_item else None
1007138
def cursor(self, as_dict=False):
        """"""
        self.ensure_connect()
        ctype = self.real_ctype(as_dict)
        return self._connect.cursor(ctype)
821475
@Nullable
  private XTextViewCursor getViewCursor(XComponentContext xContext) {
    try {
      XComponent xCurrentComponent = OfficeTools.getCurrentComponent(xContext);
      if (xCurrentComponent == null) {
        return null;
      }
      XModel xModel = UnoRuntime.queryInterface(XModel.class, xCurrentComponent);
      if (xModel == null) {
        return null;
      }
      XController xController = xModel.getCurrentController();
      if (xController == null) {
        return null;
      }
      XTextViewCursorSupplier xViewCursorSupplier =
          UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xController);
      if (xViewCursorSupplier == null) {
        return null;
      }
      return xViewCursorSupplier.getViewCursor();
    } catch (Throwable t) {
      MessageHandler.printException(t);     // all Exceptions thrown by UnoRuntime.queryInterface are caught
      return null;           // Return null as method failed
    }
  }
52062
def get_cursor_position(event)
      if (event.page_x && event.page_y)
        x = event.page_x
        y = event.page_y
      else
        doc = Opal.Document[0]
        x = event[:clientX] + doc.scrollLeft +
              doc.documentElement.scrollLeft
        y = event[:clientY] + doc.body.scrollTop +
              doc.documentElement.scrollTop
      end
      x -= `#{@canvas.canvas}.offsetLeft`
      y -= `#{@canvas.canvas}.offsetTop`
      Coordinates.new(x: x, y: y)
    end
742937
def items(self):
        
        if not self.cursor.rowcount:
            return []

        self.cursor.scroll(0, 'absolute')
        return self.cursor.fetchall()