Returns if the symbols pair is complete on current editor line.

    :param editor: Document editor.
    :type editor: QWidget
    :param symbol: Symbol to check.
    :type symbol: unicode
    :return: Is symbols pair complete.
    :rtype: bool
334277
def is_symbols_pair_complete(editor, symbol):
    

    symbols_pairs = get_editor_capability(editor, "symbols_pairs")
    if not symbols_pairs:
        return

    cursor = editor.textCursor()
    cursor.movePosition(QTextCursor.StartOfLine, QTextCursor.MoveAnchor)
    cursor.movePosition(QTextCursor.EndOfLine, QTextCursor.KeepAnchor)
    selected_text = foundations.strings.to_string(cursor.selectedText())
    if symbol == symbols_pairs[symbol]:
        return selected_text.count(symbol) % 2 == 0
    else:
        return selected_text.count(symbol) == selected_text.count(symbols_pairs[symbol])
663781
def full_symbol(self):
        """"""
        if self._full_symbol is None:
            self._full_symbol = self._symbol_extract(cache.RE_FULL_CURSOR, brackets=True)

        return self._full_symbol
113292
def perform_completion(editor):
    

    completion_prefix = editor.get_partial_word_under_cursor()
    if not completion_prefix:
        return

    words = editor.get_words()
    completion_prefix in words and words.remove(completion_prefix)
    editor.completer.update_model(words)
    editor.completer.setCompletionPrefix(completion_prefix)
    if editor.completer.completionCount() == 1:
        completion = editor.completer.completionModel().data(
            editor.completer.completionModel().index(0, 0)).toString()
        cursor = editor.textCursor()
        cursor.insertText(completion[len(completion_prefix):])
        editor.setTextCursor(cursor)
    else:
        popup = editor.completer.popup()
        popup.setCurrentIndex(editor.completer.completionModel().index(0, 0))

        completer_rectangle = editor.cursorRect()
        hasattr(editor, "margin_area_LinesNumbers_widget") and completer_rectangle.moveTo(
            completer_rectangle.topLeft().x() + editor.margin_area_LinesNumbers_widget.get_width(),
            completer_rectangle.topLeft().y())
        completer_rectangle.setWidth(editor.completer.popup().sizeHintForColumn(0) +
                                     editor.completer.popup().verticalScrollBar().sizeHint().width())
        editor.completer.complete(completer_rectangle)
    return True
944431
protected boolean editorErrorMatches(final EditorError perror) {
    return perror != null && perror.getEditor() != null
        && (equals(perror.getEditor()) || perror.getEditor().equals(asEditor()));
  }
420983
def complete_options(node)

      return [:keyword] + [:prefix_op] if tokens.empty?

      #prefix operator
      return [:keyword] if last_token_is(PREFIX_OPERATORS)

      # left hand
      if is_left_hand(node)
        if (tokens.size == 1 || last_token_is(PREFIX_OPERATORS + LOGICAL_INFIX_OPERATORS) ||
            last_token_is(PREFIX_OPERATORS + LOGICAL_INFIX_OPERATORS, 2))
          options = [:keyword]
          options += [:prefix_op]  unless last_token_is(PREFIX_OPERATORS)
        else
          options = [:logical_op]
        end
        return options
      end

      if is_right_hand
        # right hand
        return [:value]
      else
        # comparison operator completer
        return [:infix_op]
      end
    end
1068730
public boolean isLineOfCode(final String line) {
        if (line.length() < getIndicatorAreaPos() + 1) {
            return false;
        }

        /* Remove white space lines */
        if (line.trim().length() == 0) {
            return false;
        }

        /* Remove comments and special lines */
        if (isComment(line)) {
            return false;
        }

        /*
         * If there is a single token on this line, make sure it is not a
         * compiler directive.
         */
        String[] tokens = line.trim().split("[\\s\\.]+");
        if (tokens.length == 1
                && COMPILER_DIRECTIVES.contains(tokens[0].toUpperCase(Locale
                        .getDefault()))) {
            return false;
        }

        return true;
    }
145144
private String utfIncludeCheck(String line, Boolean addatsign)
	{
		String checked = "";
		boolean start = false;

		for (int i = 0; i < line.length(); i++)
		{
			if (isOneByte(line.substring(i, i + 1)))
			{
				if (start)
				{
					start = false;
					checked += (addatsign ? useJPNFont ? fontEnd
							+ LST_ESCAPE_END : "" : fontEnd)
							+ line.substring(i, i + 1);
				} else
				{
					checked += line.substring(i, i + 1);
				}
			} else
			{
				if (!start)
				{
					checked += (addatsign ? useJPNFont ? LST_ESCAPE_BEGIN : ""
							: "")
							+ (useJPNFont ? docFont : "")
							+ line.substring(i, i + 1);
					start = true;
				} else
				{
					checked += line.substring(i, i + 1);
				}
			}
		}
		if (start)
		{
			checked += addatsign ? useJPNFont ? fontEnd + LST_ESCAPE_END : ""
					: fontEnd;
		}
		return checked;
	}
492983
def is_SYMBOL(token, *symbols):
    
    from symbols.symbol_ import Symbol
    assert all(isinstance(x, Symbol) for x in symbols)
    for sym in symbols:
        if sym.token != token:
            return False

    return True
887306
def check_with_pep8(source_code, filename=None):
    """"""
    try:
        args = get_checker_executable('pycodestyle')
        results = check(args, source_code, filename=filename, options=['-r'])
    except Exception:
        # Never return None to avoid lock in spyder/widgets/editor.py
        # See Issue 1547
        results = []
        if DEBUG_EDITOR:
            traceback.print_exc()  # Print exception in internal console
    return results
1311032
def indentation_pre_event_input_accelerators(editor, event):
    

    process_event = True
    if not hasattr(editor, "indent"):
        return process_event

    if event.key() == Qt.Key_Tab:
        process_event = editor.indent() and False
    elif event.key() == Qt.Key_Backtab:
        process_event = editor.unindent() and False
    return process_event
1351872
def do_symbols_matching(self):
        
        self._clear_decorations()
        current_block = self.editor.textCursor().block()
        data = get_block_symbol_data(self.editor, current_block)
        pos = self.editor.textCursor().block().position()
        for symbol in [PAREN, SQUARE, BRACE]:
            self._match(symbol, data, pos)
683552
def match_select(self, ignored_symbols=None):
        
        def filter_matching(ignored_symbols, matching):
            """
            Removes any ignored symbol from the match dict.
            """
            if ignored_symbols is not None:
                for symbol in matching.keys():
                    if symbol in ignored_symbols:
                        matching.pop(symbol)
            return matching

        def find_opening_symbol(cursor, matching):
            """
            Find the position ot the opening symbol
            :param cursor: Current text cursor
            :param matching: symbol matches map
            """
            start_pos = None
            opening_char = None
            closed = {k: 0 for k in matching.values()
                      if k not in ['"', "'"]}
            # go left
            stop = False
            while not stop and not cursor.atStart():
                cursor.clearSelection()
                cursor.movePosition(cursor.Left, cursor.KeepAnchor)
                char = cursor.selectedText()
                if char in closed.keys():
                    closed[char] += 1
                elif char in matching.keys():
                    opposite = matching[char]
                    if opposite in closed.keys() and closed[opposite]:
                        closed[opposite] -= 1
                        continue
                    else:
                        # found opening quote or parenthesis
                        start_pos = cursor.position() + 1
                        stop = True
                        opening_char = char
            return opening_char, start_pos

        def find_closing_symbol(cursor, matching, opening_char, original_pos):
            """
            Finds the position of the closing symbol

            :param cursor: current text cursor
            :param matching: symbold matching dict
            :param opening_char: the opening character
            :param original_pos: position of the opening character.
            """
            end_pos = None
            cursor.setPosition(original_pos)
            rev_matching = {v: k for k, v in matching.items()}
            opened = {k: 0 for k in rev_matching.values()
                      if k not in ['"', "'"]}
            stop = False
            while not stop and not cursor.atEnd():
                cursor.clearSelection()
                cursor.movePosition(cursor.Right, cursor.KeepAnchor)
                char = cursor.selectedText()
                if char in opened.keys():
                    opened[char] += 1
                elif char in rev_matching.keys():
                    opposite = rev_matching[char]
                    if opposite in opened.keys() and opened[opposite]:
                        opened[opposite] -= 1
                        continue
                    elif matching[opening_char] == char:
                        # found opening quote or parenthesis
                        end_pos = cursor.position() - 1
                        stop = True
            return end_pos

        matching = {'(': ')', '{': '}', '[': ']', '"': '"', "'": "'"}
        filter_matching(ignored_symbols, matching)
        cursor = self._editor.textCursor()
        original_pos = cursor.position()
        end_pos = None
        opening_char, start_pos = find_opening_symbol(cursor, matching)
        if opening_char:
            end_pos = find_closing_symbol(
                cursor, matching, opening_char, original_pos)
        if start_pos and end_pos:
            cursor.setPosition(start_pos)
            cursor.movePosition(cursor.Right, cursor.KeepAnchor,
                                end_pos - start_pos)
            self._editor.setTextCursor(cursor)
            return True
        else:
            return False
54050
def complete(self):
        """"""
        if self._possible is None:
            self._possible = []
            for possible in self.names:
                c = Completion(self.context, self.names[possible], len(self.context.symbol))
                self._possible.append(c)

        return self._possible
1181084
def unindent(self):
        

        cursor = self.textCursor()
        if not cursor.hasSelection():
            cursor.movePosition(QTextCursor.StartOfBlock)
            line = foundations.strings.to_string(self.document().findBlockByNumber(cursor.blockNumber()).text())
            indent_marker = re.match(r"({0})".format(self.__indent_marker), line)
            if indent_marker:
                foundations.common.repeat(cursor.deleteChar, len(indent_marker.group(1)))
        else:
            block = self.document().findBlock(cursor.selectionStart())
            while True:
                block_cursor = self.textCursor()
                block_cursor.setPosition(block.position())
                indent_marker = re.match(r"({0})".format(self.__indent_marker), block.text())
                if indent_marker:
                    foundations.common.repeat(block_cursor.deleteChar, len(indent_marker.group(1)))
                if block.contains(cursor.selectionEnd()):
                    break
                block = block.next()
        return True
321083
function(editor) {
			var info = editorUtils.outputInfo(editor);
			var caretPos = editor.getCaretPos();
			var nl = '\n';
			var pad = '\t';
			
			if (~xmlSyntaxes.indexOf(info.syntax)) {
				// let's see if we're breaking newly created tag
				var tag = htmlMatcher.tag(info.content, caretPos);
				if (tag && !tag.innerRange.length()) {
					editor.replaceContent(nl + pad + utils.getCaretPlaceholder() + nl, caretPos);
					return true;
				}
			} else if (info.syntax == 'css') {
				/** @type String */
				var content = info.content;
				if (caretPos && content.charAt(caretPos - 1) == '{') {
					var append = prefs.get('css.closeBraceIndentation');
					
					var hasCloseBrace = content.charAt(caretPos) == '}';
					if (!hasCloseBrace) {
						// do we really need special formatting here?
						// check if this is really a newly created rule,
						// look ahead for a closing brace
						for (var i = caretPos, il = content.length, ch; i < il; i++) {
							ch = content.charAt(i);
							if (ch == '{') {
								// ok, this is a new rule without closing brace
								break;
							}
							
							if (ch == '}') {
								// not a new rule, just add indentation
								append = '';
								hasCloseBrace = true;
								break;
							}
						}
					}
					
					if (!hasCloseBrace) {
						append += '}';
					}
					
					// defining rule set
					var insValue = nl + pad + utils.getCaretPlaceholder() + append;
					editor.replaceContent(insValue, caretPos);
					return true;
				}
			}
				
			return false;
		}
949101
def _complete_word(self, symbol, attribute):
        """"""
        #The cursor is after a %(,\s and the user is looking for a list
        #of possibilities that is a bit smarter that regular AC.
        if self.context.el_call in ["sub", "fun", "assign", "arith"]:
            if symbol == "":
                #The only possibilities are local vars, global vars or functions
                #presented in that order of likelihood. 
                return self._complete_values()
            else:
                #It is also possible that subroutines are being called, but that
                #the full name hasn't been entered yet.
                return self._complete_values(symbol)
        else:
            return self.context.module.completions(symbol, attribute, True)
109430
def _check_symbols(self, symbols):
        """"""
        if len(symbols) != self.size:
            raise TypeError("The number of symbols in the graph does not "
                "match the length of the atomic numbers array.")
        for symbol in symbols:
            if not isinstance(symbol, str):
                raise TypeError("All symbols must be strings.")