override Sheet.checkCursor
764249
def checkCursor(self):
        ''
        if self.cursorBox:
            if self.cursorBox.h < self.canvasCharHeight:
                self.cursorBox.h = self.canvasCharHeight*3/4
            if self.cursorBox.w < self.canvasCharWidth:
                self.cursorBox.w = self.canvasCharWidth*3/4

        return False
729187
def cursor():
    """"""
    try:
        cur = conn.cursor()
        yield cur
    except (db.Error, Exception) as e:
        cur.close()
        if conn:
            conn.rollback()
        print(e.message)
        raise
    else:
        conn.commit()
        cur.close()
904174
def _override_options(options, **overrides):
    """"""
    for opt, val in overrides.items():
        passed_value = getattr(options, opt, _Default())
        if opt in ('ignore', 'select') and passed_value:
            value = process_value(opt, passed_value.value)
            value += process_value(opt, val)
            setattr(options, opt, value)
        elif isinstance(passed_value, _Default):
            setattr(options, opt, process_value(opt, val))
873312
def extend_selection_to_complete_lines(self):
        """"""
        cursor = self.textCursor()
        start_pos, end_pos = cursor.selectionStart(), cursor.selectionEnd()
        cursor.setPosition(start_pos)
        cursor.setPosition(end_pos, QTextCursor.KeepAnchor)
        if cursor.atBlockStart():
            cursor.movePosition(QTextCursor.PreviousBlock,
                                QTextCursor.KeepAnchor)
            cursor.movePosition(QTextCursor.EndOfBlock,
                                QTextCursor.KeepAnchor)
        self.setTextCursor(cursor)
705993
def resetSelection(self):
        
        cursor = self.textCursor()
        cursor.setPosition(cursor.position())
        self.setTextCursor(cursor)
311574
def check(codeString, filename, reporter=modReporter.Default, settings_path=None, **setting_overrides):
    """"""

    if not settings_path and filename:
        settings_path = os.path.dirname(os.path.abspath(filename))
    settings_path = settings_path or os.getcwd()

    active_settings = settings.from_path(settings_path).copy()
    for key, value in itemsview(setting_overrides):
        access_key = key.replace('not_', '').lower()
        if type(active_settings.get(access_key)) in (list, tuple):
            if key.startswith('not_'):
                active_settings[access_key] = list(set(active_settings[access_key]).difference(value))
            else:
                active_settings[access_key] = list(set(active_settings[access_key]).union(value))
        else:
            active_settings[key] = value
    active_settings.update(setting_overrides)

    if _should_skip(filename, active_settings.get('skip', [])):
        if active_settings.get('directly_being_checked', None) == 1:
            reporter.flake(FileSkipped(filename))
            return 1
        elif active_settings.get('verbose', False):
            ignore = active_settings.get('ignore_frosted_errors', [])
            if(not "W200" in ignore and not "W201" in ignore):
                reporter.flake(FileSkipped(filename, None, verbose=active_settings.get('verbose')))
        return 0

    # First, compile into an AST and handle syntax errors.
    try:
        tree = compile(codeString, filename, "exec", _ast.PyCF_ONLY_AST)
    except SyntaxError:
        value = sys.exc_info()[1]
        msg = value.args[0]

        (lineno, offset, text) = value.lineno, value.offset, value.text

        # If there's an encoding problem with the file, the text is None.
        if text is None:
            # Avoid using msg, since for the only known case, it contains a
            # bogus message that claims the encoding the file declared was
            # unknown.
            reporter.unexpected_error(filename, 'problem decoding source')
        else:
            reporter.flake(PythonSyntaxError(filename, msg, lineno, offset, text,
                                             verbose=active_settings.get('verbose')))
        return 1
    except Exception:
        reporter.unexpected_error(filename, 'problem decoding source')
        return 1
    # Okay, it's syntactically valid.  Now check it.
    w = checker.Checker(tree, filename, None, ignore_lines=_noqa_lines(codeString), **active_settings)
    w.messages.sort(key=lambda m: m.lineno)
    for warning in w.messages:
        reporter.flake(warning)
    return len(w.messages)
535746
def cursor_fine(self,
                    table_name,
                    start_id_obj,
                    end_id_obj,
                    iteration,
                    start_timeperiod,
                    end_timeperiod):
        
        raise NotImplementedError('method cursor_fine must be implemented by {0}'.format(self.__class__.__name__))
1273770
async def addTrigger(self, condition, query, info):
        '''
        
        '''
        iden = self.cell.triggers.add(self.user.iden, condition, query, info=info)
        return iden
1216288
def nextColRegex(sheet, colregex):
    ''
    pivot = sheet.cursorVisibleColIndex
    for i in itertools.chain(range(pivot+1, len(sheet.visibleCols)), range(0, pivot+1)):
        c = sheet.visibleCols[i]
        if re.search(colregex, c.name, regex_flags()):
            return i

    fail('no column name matches /%s/' % colregex)
1245714
def checkCursor(self):
        ''
        # keep cursor within actual available rowset
        if self.nRows == 0 or self.cursorRowIndex <= 0:
            self.cursorRowIndex = 0
        elif self.cursorRowIndex >= self.nRows:
            self.cursorRowIndex = self.nRows-1

        if self.cursorVisibleColIndex <= 0:
            self.cursorVisibleColIndex = 0
        elif self.cursorVisibleColIndex >= self.nVisibleCols:
            self.cursorVisibleColIndex = self.nVisibleCols-1

        if self.topRowIndex <= 0:
            self.topRowIndex = 0
        elif self.topRowIndex > self.nRows-1:
            self.topRowIndex = self.nRows-1

        # (x,y) is relative cell within screen viewport
        x = self.cursorVisibleColIndex - self.leftVisibleColIndex
        y = self.cursorRowIndex - self.topRowIndex + 1  # header

        # check bounds, scroll if necessary
        if y < 1:
            self.topRowIndex = self.cursorRowIndex
        elif y > self.nVisibleRows:
            self.topRowIndex = self.cursorRowIndex-self.nVisibleRows+1

        if x <= 0:
            self.leftVisibleColIndex = self.cursorVisibleColIndex
        else:
            while True:
                if self.leftVisibleColIndex == self.cursorVisibleColIndex:  # not much more we can do
                    break
                self.calcColLayout()
                mincolidx, maxcolidx = min(self.visibleColLayout.keys()), max(self.visibleColLayout.keys())
                if self.cursorVisibleColIndex < mincolidx:
                    self.leftVisibleColIndex -= max((self.cursorVisibleColIndex - mincolid)//2, 1)
                    continue
                elif self.cursorVisibleColIndex > maxcolidx:
                    self.leftVisibleColIndex += max((maxcolidx - self.cursorVisibleColIndex)//2, 1)
                    continue

                cur_x, cur_w = self.visibleColLayout[self.cursorVisibleColIndex]
                if cur_x+cur_w < self.vd.windowWidth:  # current columns fit entirely on screen
                    break
                self.leftVisibleColIndex += 1
448267
function filterStylesheetsWithSameHref(sheets) {
	let hrefs = [];
	return sheets.filter(sheet => {
		if (!sheet.href) {
			// include sheets without `href`
			return true;
		}
		// if `href` is present, ensure they are not duplicates
		if (hrefs.includes(sheet.href)) {
			return false;
		}
		hrefs.push(sheet.href);
		return true;
	});
}
1359365
def cursor_up(self, count=1):
        
        original_column = self.preferred_column or self.document.cursor_position_col
        self.cursor_position += self.document.get_cursor_up_position(
            count=count, preferred_column=original_column)

        # Remember the original column for the next up/down movement.
        self.preferred_column = original_column
888302
function (sheet, selector, rule) {
            var index;
            if (sheet.insertRule) {
                return sheet.insertRule(selector + '{' + rule + '}', sheet.cssRules.length);
            } else {
                index = sheet.addRule(selector, rule, sheet.rules.length);
                if (index < 0) {
                    index = sheet.rules.length - 1;
                }
                return index;
            }
        }
73047
def _cursor(self, *args, **kwargs):
        """"""
        # The args and kwargs are not part of the standard,
        # but some database modules seem to use these.
        transaction = self._transaction
        if not transaction:
            self._ping_check(2)
        try:
            if self._maxusage:
                if self._usage >= self._maxusage:
                    # the connection was used too often
                    raise self._failure
            cursor = self._con.cursor(*args, **kwargs)  # try to get a cursor
        except self._failures as error:  # error in getting cursor
            try:  # try to reopen the connection
                con = self._create()
            except Exception:
                pass
            else:
                try:  # and try one more time to get a cursor
                    cursor = con.cursor(*args, **kwargs)
                except Exception:
                    pass
                else:
                    self._close()
                    self._store(con)
                    if transaction:
                        raise error  # re-raise the original error again
                    return cursor
                try:
                    con.close()
                except Exception:
                    pass
            if transaction:
                self._transaction = False
            raise error  # re-raise the original error again
        return cursor
395617
protected void encodeColOptions(final FacesContext context, final Sheet sheet, final WidgetBuilder wb)
                throws IOException {
        final JavascriptVarBuilder vb = new JavascriptVarBuilder(null, false);
        for (final SheetColumn column : sheet.getColumns()) {
            if (!column.isRendered()) {
                continue;
            }

            final JavascriptVarBuilder options = new JavascriptVarBuilder(null, true);
            options.appendProperty("type", column.getColType(), true);
            options.appendProperty("copyable", "true", false);
            final Integer width = column.getColWidth();
            String calculatedWidth = null;
            if (width != null) {
                calculatedWidth = width.toString();
            }
            // HT doesn't have a hidden property so make column small as possible will leave
            // it in the DOM, if 0 then Handsontable removes it entirely
            if (!column.isVisible()) {
                calculatedWidth = "0.1";
            }
            if (calculatedWidth != null) {
                options.appendProperty("width", calculatedWidth, false);
            }
            if (column.isReadOnly()) {
                options.appendProperty("readOnly", "true", false);
            }
            options.appendProperty("wordWrap", column.isWordWrap().toString(), false);

            // validate can be a function, regex, or string
            final String validateFunction = column.getOnvalidate();
            if (validateFunction != null) {
                boolean quoted = false;
                switch (validateFunction) {
                    case "autocomplete":
                    case "date":
                    case "numeric":
                    case "time":
                        quoted = true;
                        break;

                    default:
                        // its a function or regex!
                        quoted = false;
                        break;
                }
                options.appendProperty("validator", validateFunction, quoted);
            }

            switch (column.getColType()) {
                case "password":
                    final Integer passwordLength = column.getPasswordHashLength();
                    if (passwordLength != null) {
                        options.appendProperty("hashLength", passwordLength.toString(), false);
                    }
                    final String passwordSymbol = column.getPasswordHashSymbol();
                    if (passwordSymbol != null) {
                        options.appendProperty("hashSymbol", passwordSymbol, true);
                    }
                    break;
                case "numeric":
                    final JavascriptVarBuilder numeric = new JavascriptVarBuilder(null, true);
                    final String pattern = column.getNumericPattern();
                    if (pattern != null) {
                        numeric.appendProperty("pattern", pattern, true);
                    }
                    final String culture = column.getNumericLocale();
                    if (culture != null) {
                        numeric.appendProperty("culture", culture, true);
                    }
                    options.appendProperty("numericFormat", numeric.closeVar().toString(), false);
                    break;
                case "date":
                    options.appendProperty("dateFormat", column.getDateFormat(), true);
                    options.appendProperty("correctFormat", "true", false);
                    final String dateConfig = column.getDatePickerConfig();
                    if (dateConfig != null) {
                        options.appendProperty("datePickerConfig", dateConfig, false);
                    }
                    break;
                case "time":
                    options.appendProperty("timeFormat", column.getTimeFormat(), true);
                    options.appendProperty("correctFormat", "true", false);
                    break;
                case "dropdown":
                    encodeSelectItems(column, options);
                    break;
                case "autocomplete":
                    options.appendProperty("strict", column.isAutoCompleteStrict().toString(), false);
                    options.appendProperty("allowInvalid", column.isAutoCompleteAllowInvalid().toString(), false);
                    options.appendProperty("trimDropdown", column.isAutoCompleteTrimDropdown().toString(), false);
                    final Integer visibleRows = column.getAutoCompleteVisibleRows();
                    if (visibleRows != null) {
                        options.appendProperty("visibleRows", visibleRows.toString(), false);
                    }
                    encodeSelectItems(column, options);
                    break;
                default:
                    break;
            }

            vb.appendArrayValue(options.closeVar().toString(), false);
        }
        wb.nativeAttr("columns", vb.closeVar().toString());
    }
440992
public static void setupExplicitListConstaint(final Sheet sheet, final String[] constraints,
            final Point startPosition, final Point endPosition) {

        ArgUtils.notNull(sheet, "sheet");
        ArgUtils.notEmpty(constraints, "constraints");
        ArgUtils.notNull(startPosition, "startPosition");
        ArgUtils.notNull(endPosition, "endPosition");

        final DataValidationHelper helper = sheet.getDataValidationHelper();
        final DataValidationConstraint constraint = helper.createExplicitListConstraint(constraints);
        setupConstaint(sheet, constraint, startPosition, endPosition);

    }
158425
def check(self, options=None):
        """"""
        self.check_values(options)
        self.check_attributes(options)
        self.check_values(options)
        return self