repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
kytos/python-openflow
pyof/foundation/network_types.py
IPv4._update_checksum
def _update_checksum(self): """Update the packet checksum to enable integrity check.""" source_list = [int(octet) for octet in self.source.split(".")] destination_list = [int(octet) for octet in self.destination.split(".")] source_upper = (source_list[0] << 8)...
python
def _update_checksum(self): """Update the packet checksum to enable integrity check.""" source_list = [int(octet) for octet in self.source.split(".")] destination_list = [int(octet) for octet in self.destination.split(".")] source_upper = (source_list[0] << 8)...
[ "def", "_update_checksum", "(", "self", ")", ":", "source_list", "=", "[", "int", "(", "octet", ")", "for", "octet", "in", "self", ".", "source", ".", "split", "(", "\".\"", ")", "]", "destination_list", "=", "[", "int", "(", "octet", ")", "for", "oc...
Update the packet checksum to enable integrity check.
[ "Update", "the", "packet", "checksum", "to", "enable", "integrity", "check", "." ]
train
https://github.com/kytos/python-openflow/blob/4f2d0d08ab28e102ed88fe57a4ee17729f1e1bb7/pyof/foundation/network_types.py#L534-L553
kytos/python-openflow
pyof/foundation/network_types.py
IPv4.pack
def pack(self, value=None): """Pack the struct in a binary representation. Merge some fields to ensure correct packing. Returns: bytes: Binary representation of this instance. """ # Set the correct IHL based on options size if self.options: self...
python
def pack(self, value=None): """Pack the struct in a binary representation. Merge some fields to ensure correct packing. Returns: bytes: Binary representation of this instance. """ # Set the correct IHL based on options size if self.options: self...
[ "def", "pack", "(", "self", ",", "value", "=", "None", ")", ":", "# Set the correct IHL based on options size", "if", "self", ".", "options", ":", "self", ".", "ihl", "+=", "int", "(", "len", "(", "self", ".", "options", ")", "/", "4", ")", "# Set the co...
Pack the struct in a binary representation. Merge some fields to ensure correct packing. Returns: bytes: Binary representation of this instance.
[ "Pack", "the", "struct", "in", "a", "binary", "representation", "." ]
train
https://github.com/kytos/python-openflow/blob/4f2d0d08ab28e102ed88fe57a4ee17729f1e1bb7/pyof/foundation/network_types.py#L555-L578
kytos/python-openflow
pyof/foundation/network_types.py
IPv4.unpack
def unpack(self, buff, offset=0): """Unpack a binary struct into this object's attributes. Return the values instead of the lib's basic types. Args: buff (bytes): Binary buffer. offset (int): Where to begin unpacking. Raises: :exc:`~.exceptions.Unpa...
python
def unpack(self, buff, offset=0): """Unpack a binary struct into this object's attributes. Return the values instead of the lib's basic types. Args: buff (bytes): Binary buffer. offset (int): Where to begin unpacking. Raises: :exc:`~.exceptions.Unpa...
[ "def", "unpack", "(", "self", ",", "buff", ",", "offset", "=", "0", ")", ":", "super", "(", ")", ".", "unpack", "(", "buff", ",", "offset", ")", "self", ".", "version", "=", "self", ".", "_version_ihl", ".", "value", ">>", "4", "self", ".", "ihl"...
Unpack a binary struct into this object's attributes. Return the values instead of the lib's basic types. Args: buff (bytes): Binary buffer. offset (int): Where to begin unpacking. Raises: :exc:`~.exceptions.UnpackException`: If unpack fails.
[ "Unpack", "a", "binary", "struct", "into", "this", "object", "s", "attributes", "." ]
train
https://github.com/kytos/python-openflow/blob/4f2d0d08ab28e102ed88fe57a4ee17729f1e1bb7/pyof/foundation/network_types.py#L580-L615
kytos/python-openflow
pyof/foundation/network_types.py
TLVWithSubType.value
def value(self): """Return sub type and sub value as binary data. Returns: :class:`~pyof.foundation.basic_types.BinaryData`: BinaryData calculated. """ binary = UBInt8(self.sub_type).pack() + self.sub_value.pack() return BinaryData(binary)
python
def value(self): """Return sub type and sub value as binary data. Returns: :class:`~pyof.foundation.basic_types.BinaryData`: BinaryData calculated. """ binary = UBInt8(self.sub_type).pack() + self.sub_value.pack() return BinaryData(binary)
[ "def", "value", "(", "self", ")", ":", "binary", "=", "UBInt8", "(", "self", ".", "sub_type", ")", ".", "pack", "(", ")", "+", "self", ".", "sub_value", ".", "pack", "(", ")", "return", "BinaryData", "(", "binary", ")" ]
Return sub type and sub value as binary data. Returns: :class:`~pyof.foundation.basic_types.BinaryData`: BinaryData calculated.
[ "Return", "sub", "type", "and", "sub", "value", "as", "binary", "data", "." ]
train
https://github.com/kytos/python-openflow/blob/4f2d0d08ab28e102ed88fe57a4ee17729f1e1bb7/pyof/foundation/network_types.py#L640-L649
kytos/python-openflow
pyof/foundation/network_types.py
TLVWithSubType.unpack
def unpack(self, buff, offset=0): """Unpack a binary message into this object's attributes. Unpack the binary value *buff* and update this object attributes based on the results. Args: buff (bytes): Binary data package to be unpacked. offset (int): Where to begi...
python
def unpack(self, buff, offset=0): """Unpack a binary message into this object's attributes. Unpack the binary value *buff* and update this object attributes based on the results. Args: buff (bytes): Binary data package to be unpacked. offset (int): Where to begi...
[ "def", "unpack", "(", "self", ",", "buff", ",", "offset", "=", "0", ")", ":", "header", "=", "UBInt16", "(", ")", "header", ".", "unpack", "(", "buff", "[", "offset", ":", "offset", "+", "2", "]", ")", "self", ".", "tlv_type", "=", "header", ".",...
Unpack a binary message into this object's attributes. Unpack the binary value *buff* and update this object attributes based on the results. Args: buff (bytes): Binary data package to be unpacked. offset (int): Where to begin unpacking. Raises: Exc...
[ "Unpack", "a", "binary", "message", "into", "this", "object", "s", "attributes", "." ]
train
https://github.com/kytos/python-openflow/blob/4f2d0d08ab28e102ed88fe57a4ee17729f1e1bb7/pyof/foundation/network_types.py#L651-L673
kytos/python-openflow
pyof/utils.py
validate_packet
def validate_packet(packet): """Check if packet is valid OF packet. Raises: UnpackException: If the packet is invalid. """ if not isinstance(packet, bytes): raise UnpackException('invalid packet') packet_length = len(packet) if packet_length < 8 or packet_length > 2**16: ...
python
def validate_packet(packet): """Check if packet is valid OF packet. Raises: UnpackException: If the packet is invalid. """ if not isinstance(packet, bytes): raise UnpackException('invalid packet') packet_length = len(packet) if packet_length < 8 or packet_length > 2**16: ...
[ "def", "validate_packet", "(", "packet", ")", ":", "if", "not", "isinstance", "(", "packet", ",", "bytes", ")", ":", "raise", "UnpackException", "(", "'invalid packet'", ")", "packet_length", "=", "len", "(", "packet", ")", "if", "packet_length", "<", "8", ...
Check if packet is valid OF packet. Raises: UnpackException: If the packet is invalid.
[ "Check", "if", "packet", "is", "valid", "OF", "packet", "." ]
train
https://github.com/kytos/python-openflow/blob/4f2d0d08ab28e102ed88fe57a4ee17729f1e1bb7/pyof/utils.py#L15-L35
kytos/python-openflow
pyof/utils.py
unpack
def unpack(packet): """Unpack the OpenFlow Packet and returns a message. Args: packet: buffer with the openflow packet. Returns: GenericMessage: Message unpacked based on openflow packet. Raises: UnpackException: if the packet can't be unpacked. """ validate_packet(pa...
python
def unpack(packet): """Unpack the OpenFlow Packet and returns a message. Args: packet: buffer with the openflow packet. Returns: GenericMessage: Message unpacked based on openflow packet. Raises: UnpackException: if the packet can't be unpacked. """ validate_packet(pa...
[ "def", "unpack", "(", "packet", ")", ":", "validate_packet", "(", "packet", ")", "version", "=", "packet", "[", "0", "]", "try", ":", "pyof_lib", "=", "PYOF_VERSION_LIBS", "[", "version", "]", "except", "KeyError", ":", "raise", "UnpackException", "(", "'V...
Unpack the OpenFlow Packet and returns a message. Args: packet: buffer with the openflow packet. Returns: GenericMessage: Message unpacked based on openflow packet. Raises: UnpackException: if the packet can't be unpacked.
[ "Unpack", "the", "OpenFlow", "Packet", "and", "returns", "a", "message", "." ]
train
https://github.com/kytos/python-openflow/blob/4f2d0d08ab28e102ed88fe57a4ee17729f1e1bb7/pyof/utils.py#L38-L63
kytos/python-openflow
pyof/v0x04/asynchronous/error_msg.py
ErrorType.get_class
def get_class(self): """Return a Code class based on current ErrorType value. Returns: enum.IntEnum: class referenced by current error type. """ classes = {'OFPET_HELLO_FAILED': HelloFailedCode, 'OFPET_BAD_REQUEST': BadRequestCode, 'OFP...
python
def get_class(self): """Return a Code class based on current ErrorType value. Returns: enum.IntEnum: class referenced by current error type. """ classes = {'OFPET_HELLO_FAILED': HelloFailedCode, 'OFPET_BAD_REQUEST': BadRequestCode, 'OFP...
[ "def", "get_class", "(", "self", ")", ":", "classes", "=", "{", "'OFPET_HELLO_FAILED'", ":", "HelloFailedCode", ",", "'OFPET_BAD_REQUEST'", ":", "BadRequestCode", ",", "'OFPET_BAD_ACTION'", ":", "BadActionCode", ",", "'OFPET_BAD_INSTRUCTION'", ":", "BadInstructionCode",...
Return a Code class based on current ErrorType value. Returns: enum.IntEnum: class referenced by current error type.
[ "Return", "a", "Code", "class", "based", "on", "current", "ErrorType", "value", "." ]
train
https://github.com/kytos/python-openflow/blob/4f2d0d08ab28e102ed88fe57a4ee17729f1e1bb7/pyof/v0x04/asynchronous/error_msg.py#L211-L232
kytos/python-openflow
pyof/v0x04/asynchronous/error_msg.py
ErrorMsg.unpack
def unpack(self, buff, offset=0): """Unpack binary data into python object.""" super().unpack(buff, offset) code_class = ErrorType(self.error_type).get_class() self.code = code_class(self.code)
python
def unpack(self, buff, offset=0): """Unpack binary data into python object.""" super().unpack(buff, offset) code_class = ErrorType(self.error_type).get_class() self.code = code_class(self.code)
[ "def", "unpack", "(", "self", ",", "buff", ",", "offset", "=", "0", ")", ":", "super", "(", ")", ".", "unpack", "(", "buff", ",", "offset", ")", "code_class", "=", "ErrorType", "(", "self", ".", "error_type", ")", ".", "get_class", "(", ")", "self"...
Unpack binary data into python object.
[ "Unpack", "binary", "data", "into", "python", "object", "." ]
train
https://github.com/kytos/python-openflow/blob/4f2d0d08ab28e102ed88fe57a4ee17729f1e1bb7/pyof/v0x04/asynchronous/error_msg.py#L474-L478
kytos/python-openflow
pyof/v0x01/asynchronous/error_msg.py
ErrorType.get_class
def get_class(self): """Return a Code class based on current ErrorType value. Returns: enum.IntEnum: class referenced by current error type. """ classes = {'OFPET_HELLO_FAILED': HelloFailedCode, 'OFPET_BAD_REQUEST': BadRequestCode, 'OFP...
python
def get_class(self): """Return a Code class based on current ErrorType value. Returns: enum.IntEnum: class referenced by current error type. """ classes = {'OFPET_HELLO_FAILED': HelloFailedCode, 'OFPET_BAD_REQUEST': BadRequestCode, 'OFP...
[ "def", "get_class", "(", "self", ")", ":", "classes", "=", "{", "'OFPET_HELLO_FAILED'", ":", "HelloFailedCode", ",", "'OFPET_BAD_REQUEST'", ":", "BadRequestCode", ",", "'OFPET_BAD_ACTION'", ":", "BadActionCode", ",", "'OFPET_FLOW_MOD_FAILED'", ":", "FlowModFailedCode", ...
Return a Code class based on current ErrorType value. Returns: enum.IntEnum: class referenced by current error type.
[ "Return", "a", "Code", "class", "based", "on", "current", "ErrorType", "value", "." ]
train
https://github.com/kytos/python-openflow/blob/4f2d0d08ab28e102ed88fe57a4ee17729f1e1bb7/pyof/v0x01/asynchronous/error_msg.py#L39-L52
kytos/python-openflow
pyof/v0x01/asynchronous/error_msg.py
ErrorMsg.pack
def pack(self, value=None): """Pack the value as a binary representation. :attr:`data` is packed before the calling :meth:`.GenericMessage.pack`. After that, :attr:`data`'s value is restored. Returns: bytes: The binary representation. Raises: :exc:`~.ex...
python
def pack(self, value=None): """Pack the value as a binary representation. :attr:`data` is packed before the calling :meth:`.GenericMessage.pack`. After that, :attr:`data`'s value is restored. Returns: bytes: The binary representation. Raises: :exc:`~.ex...
[ "def", "pack", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "None", ":", "data_backup", "=", "None", "if", "self", ".", "data", "is", "not", "None", "and", "not", "isinstance", "(", "self", ".", "data", ",", "bytes", ")", ...
Pack the value as a binary representation. :attr:`data` is packed before the calling :meth:`.GenericMessage.pack`. After that, :attr:`data`'s value is restored. Returns: bytes: The binary representation. Raises: :exc:`~.exceptions.PackException`: If pack fails.
[ "Pack", "the", "value", "as", "a", "binary", "representation", "." ]
train
https://github.com/kytos/python-openflow/blob/4f2d0d08ab28e102ed88fe57a4ee17729f1e1bb7/pyof/v0x01/asynchronous/error_msg.py#L204-L231
andreikop/qutepart
qutepart/bookmarks.py
Bookmarks._createAction
def _createAction(self, widget, iconFileName, text, shortcut, slot): """Create QAction with given parameters and add to the widget """ icon = qutepart.getIcon(iconFileName) action = QAction(icon, text, widget) action.setShortcut(QKeySequence(shortcut)) action.setShortcutC...
python
def _createAction(self, widget, iconFileName, text, shortcut, slot): """Create QAction with given parameters and add to the widget """ icon = qutepart.getIcon(iconFileName) action = QAction(icon, text, widget) action.setShortcut(QKeySequence(shortcut)) action.setShortcutC...
[ "def", "_createAction", "(", "self", ",", "widget", ",", "iconFileName", ",", "text", ",", "shortcut", ",", "slot", ")", ":", "icon", "=", "qutepart", ".", "getIcon", "(", "iconFileName", ")", "action", "=", "QAction", "(", "icon", ",", "text", ",", "w...
Create QAction with given parameters and add to the widget
[ "Create", "QAction", "with", "given", "parameters", "and", "add", "to", "the", "widget" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/bookmarks.py#L25-L36
andreikop/qutepart
qutepart/bookmarks.py
Bookmarks.clear
def clear(self, startBlock, endBlock): """Clear bookmarks on block range including start and end """ for block in qutepart.iterateBlocksFrom(startBlock): self._setBlockMarked(block, False) if block == endBlock: break
python
def clear(self, startBlock, endBlock): """Clear bookmarks on block range including start and end """ for block in qutepart.iterateBlocksFrom(startBlock): self._setBlockMarked(block, False) if block == endBlock: break
[ "def", "clear", "(", "self", ",", "startBlock", ",", "endBlock", ")", ":", "for", "block", "in", "qutepart", ".", "iterateBlocksFrom", "(", "startBlock", ")", ":", "self", ".", "_setBlockMarked", "(", "block", ",", "False", ")", "if", "block", "==", "end...
Clear bookmarks on block range including start and end
[ "Clear", "bookmarks", "on", "block", "range", "including", "start", "and", "end" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/bookmarks.py#L46-L52
andreikop/qutepart
qutepart/bookmarks.py
Bookmarks._onPrevBookmark
def _onPrevBookmark(self): """Previous Bookmark action triggered. Move cursor """ for block in qutepart.iterateBlocksBackFrom(self._qpart.textCursor().block().previous()): if self.isBlockMarked(block): self._qpart.setTextCursor(QTextCursor(block)) retu...
python
def _onPrevBookmark(self): """Previous Bookmark action triggered. Move cursor """ for block in qutepart.iterateBlocksBackFrom(self._qpart.textCursor().block().previous()): if self.isBlockMarked(block): self._qpart.setTextCursor(QTextCursor(block)) retu...
[ "def", "_onPrevBookmark", "(", "self", ")", ":", "for", "block", "in", "qutepart", ".", "iterateBlocksBackFrom", "(", "self", ".", "_qpart", ".", "textCursor", "(", ")", ".", "block", "(", ")", ".", "previous", "(", ")", ")", ":", "if", "self", ".", ...
Previous Bookmark action triggered. Move cursor
[ "Previous", "Bookmark", "action", "triggered", ".", "Move", "cursor" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/bookmarks.py#L73-L79
andreikop/qutepart
qutepart/bookmarks.py
Bookmarks._onNextBookmark
def _onNextBookmark(self): """Previous Bookmark action triggered. Move cursor """ for block in qutepart.iterateBlocksFrom(self._qpart.textCursor().block().next()): if self.isBlockMarked(block): self._qpart.setTextCursor(QTextCursor(block)) return
python
def _onNextBookmark(self): """Previous Bookmark action triggered. Move cursor """ for block in qutepart.iterateBlocksFrom(self._qpart.textCursor().block().next()): if self.isBlockMarked(block): self._qpart.setTextCursor(QTextCursor(block)) return
[ "def", "_onNextBookmark", "(", "self", ")", ":", "for", "block", "in", "qutepart", ".", "iterateBlocksFrom", "(", "self", ".", "_qpart", ".", "textCursor", "(", ")", ".", "block", "(", ")", ".", "next", "(", ")", ")", ":", "if", "self", ".", "isBlock...
Previous Bookmark action triggered. Move cursor
[ "Previous", "Bookmark", "action", "triggered", ".", "Move", "cursor" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/bookmarks.py#L81-L87
andreikop/qutepart
qutepart/brackethlighter.py
BracketHighlighter._iterateDocumentCharsForward
def _iterateDocumentCharsForward(self, block, startColumnIndex): """Traverse document forward. Yield (block, columnIndex, char) Raise _TimeoutException if time is over """ # Chars in the start line endTime = time.time() + self._MAX_SEARCH_TIME_SEC for columnIndex, char in...
python
def _iterateDocumentCharsForward(self, block, startColumnIndex): """Traverse document forward. Yield (block, columnIndex, char) Raise _TimeoutException if time is over """ # Chars in the start line endTime = time.time() + self._MAX_SEARCH_TIME_SEC for columnIndex, char in...
[ "def", "_iterateDocumentCharsForward", "(", "self", ",", "block", ",", "startColumnIndex", ")", ":", "# Chars in the start line", "endTime", "=", "time", ".", "time", "(", ")", "+", "self", ".", "_MAX_SEARCH_TIME_SEC", "for", "columnIndex", ",", "char", "in", "l...
Traverse document forward. Yield (block, columnIndex, char) Raise _TimeoutException if time is over
[ "Traverse", "document", "forward", ".", "Yield", "(", "block", "columnIndex", "char", ")", "Raise", "_TimeoutException", "if", "time", "is", "over" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/brackethlighter.py#L35-L53
andreikop/qutepart
qutepart/brackethlighter.py
BracketHighlighter._iterateDocumentCharsBackward
def _iterateDocumentCharsBackward(self, block, startColumnIndex): """Traverse document forward. Yield (block, columnIndex, char) Raise _TimeoutException if time is over """ # Chars in the start line endTime = time.time() + self._MAX_SEARCH_TIME_SEC for columnIndex, char i...
python
def _iterateDocumentCharsBackward(self, block, startColumnIndex): """Traverse document forward. Yield (block, columnIndex, char) Raise _TimeoutException if time is over """ # Chars in the start line endTime = time.time() + self._MAX_SEARCH_TIME_SEC for columnIndex, char i...
[ "def", "_iterateDocumentCharsBackward", "(", "self", ",", "block", ",", "startColumnIndex", ")", ":", "# Chars in the start line", "endTime", "=", "time", ".", "time", "(", ")", "+", "self", ".", "_MAX_SEARCH_TIME_SEC", "for", "columnIndex", ",", "char", "in", "...
Traverse document forward. Yield (block, columnIndex, char) Raise _TimeoutException if time is over
[ "Traverse", "document", "forward", ".", "Yield", "(", "block", "columnIndex", "char", ")", "Raise", "_TimeoutException", "if", "time", "is", "over" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/brackethlighter.py#L55-L73
andreikop/qutepart
qutepart/brackethlighter.py
BracketHighlighter._findMatchingBracket
def _findMatchingBracket(self, bracket, qpart, block, columnIndex): """Find matching bracket for the bracket. Return (block, columnIndex) or (None, None) Raise _TimeoutException, if time is over """ if bracket in self._START_BRACKETS: charsGenerator = self._iterateDoc...
python
def _findMatchingBracket(self, bracket, qpart, block, columnIndex): """Find matching bracket for the bracket. Return (block, columnIndex) or (None, None) Raise _TimeoutException, if time is over """ if bracket in self._START_BRACKETS: charsGenerator = self._iterateDoc...
[ "def", "_findMatchingBracket", "(", "self", ",", "bracket", ",", "qpart", ",", "block", ",", "columnIndex", ")", ":", "if", "bracket", "in", "self", ".", "_START_BRACKETS", ":", "charsGenerator", "=", "self", ".", "_iterateDocumentCharsForward", "(", "block", ...
Find matching bracket for the bracket. Return (block, columnIndex) or (None, None) Raise _TimeoutException, if time is over
[ "Find", "matching", "bracket", "for", "the", "bracket", ".", "Return", "(", "block", "columnIndex", ")", "or", "(", "None", "None", ")", "Raise", "_TimeoutException", "if", "time", "is", "over" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/brackethlighter.py#L75-L96
andreikop/qutepart
qutepart/brackethlighter.py
BracketHighlighter._makeMatchSelection
def _makeMatchSelection(self, block, columnIndex, matched): """Make matched or unmatched QTextEdit.ExtraSelection """ selection = QTextEdit.ExtraSelection() if matched: bgColor = Qt.green else: bgColor = Qt.red selection.format.setBackground(bgCo...
python
def _makeMatchSelection(self, block, columnIndex, matched): """Make matched or unmatched QTextEdit.ExtraSelection """ selection = QTextEdit.ExtraSelection() if matched: bgColor = Qt.green else: bgColor = Qt.red selection.format.setBackground(bgCo...
[ "def", "_makeMatchSelection", "(", "self", ",", "block", ",", "columnIndex", ",", "matched", ")", ":", "selection", "=", "QTextEdit", ".", "ExtraSelection", "(", ")", "if", "matched", ":", "bgColor", "=", "Qt", ".", "green", "else", ":", "bgColor", "=", ...
Make matched or unmatched QTextEdit.ExtraSelection
[ "Make", "matched", "or", "unmatched", "QTextEdit", ".", "ExtraSelection" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/brackethlighter.py#L98-L113
andreikop/qutepart
qutepart/brackethlighter.py
BracketHighlighter._highlightBracket
def _highlightBracket(self, bracket, qpart, block, columnIndex): """Highlight bracket and matching bracket Return tuple of QTextEdit.ExtraSelection's """ try: matchedBlock, matchedColumnIndex = self._findMatchingBracket(bracket, qpart, block, columnIndex) except _Time...
python
def _highlightBracket(self, bracket, qpart, block, columnIndex): """Highlight bracket and matching bracket Return tuple of QTextEdit.ExtraSelection's """ try: matchedBlock, matchedColumnIndex = self._findMatchingBracket(bracket, qpart, block, columnIndex) except _Time...
[ "def", "_highlightBracket", "(", "self", ",", "bracket", ",", "qpart", ",", "block", ",", "columnIndex", ")", ":", "try", ":", "matchedBlock", ",", "matchedColumnIndex", "=", "self", ".", "_findMatchingBracket", "(", "bracket", ",", "qpart", ",", "block", ",...
Highlight bracket and matching bracket Return tuple of QTextEdit.ExtraSelection's
[ "Highlight", "bracket", "and", "matching", "bracket", "Return", "tuple", "of", "QTextEdit", ".", "ExtraSelection", "s" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/brackethlighter.py#L115-L130
andreikop/qutepart
qutepart/brackethlighter.py
BracketHighlighter.extraSelections
def extraSelections(self, qpart, block, columnIndex): """List of QTextEdit.ExtraSelection's, which highlighte brackets """ blockText = block.text() if columnIndex < len(blockText) and \ blockText[columnIndex] in self._ALL_BRACKETS and \ qpart.isCode(block, colu...
python
def extraSelections(self, qpart, block, columnIndex): """List of QTextEdit.ExtraSelection's, which highlighte brackets """ blockText = block.text() if columnIndex < len(blockText) and \ blockText[columnIndex] in self._ALL_BRACKETS and \ qpart.isCode(block, colu...
[ "def", "extraSelections", "(", "self", ",", "qpart", ",", "block", ",", "columnIndex", ")", ":", "blockText", "=", "block", ".", "text", "(", ")", "if", "columnIndex", "<", "len", "(", "blockText", ")", "and", "blockText", "[", "columnIndex", "]", "in", ...
List of QTextEdit.ExtraSelection's, which highlighte brackets
[ "List", "of", "QTextEdit", ".", "ExtraSelection", "s", "which", "highlighte", "brackets" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/brackethlighter.py#L132-L147
andreikop/qutepart
qutepart/syntaxhlighter.py
_cmpFormatRanges
def _cmpFormatRanges(a, b): """PyQt does not define proper comparison for QTextLayout.FormatRange Define it to check correctly, if formats has changed. It is important for the performance """ if a.format == b.format and \ a.start == b.start and \ a.length == b.length: return 0 ...
python
def _cmpFormatRanges(a, b): """PyQt does not define proper comparison for QTextLayout.FormatRange Define it to check correctly, if formats has changed. It is important for the performance """ if a.format == b.format and \ a.start == b.start and \ a.length == b.length: return 0 ...
[ "def", "_cmpFormatRanges", "(", "a", ",", "b", ")", ":", "if", "a", ".", "format", "==", "b", ".", "format", "and", "a", ".", "start", "==", "b", ".", "start", "and", "a", ".", "length", "==", "b", ".", "length", ":", "return", "0", "else", ":"...
PyQt does not define proper comparison for QTextLayout.FormatRange Define it to check correctly, if formats has changed. It is important for the performance
[ "PyQt", "does", "not", "define", "proper", "comparison", "for", "QTextLayout", ".", "FormatRange", "Define", "it", "to", "check", "correctly", "if", "formats", "has", "changed", ".", "It", "is", "important", "for", "the", "performance" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntaxhlighter.py#L14-L24
andreikop/qutepart
qutepart/syntaxhlighter.py
SyntaxHighlighter.isCode
def isCode(self, block, column): """Check if character at column is a a code """ dataObject = block.userData() data = dataObject.data if dataObject is not None else None return self._syntax.isCode(data, column)
python
def isCode(self, block, column): """Check if character at column is a a code """ dataObject = block.userData() data = dataObject.data if dataObject is not None else None return self._syntax.isCode(data, column)
[ "def", "isCode", "(", "self", ",", "block", ",", "column", ")", ":", "dataObject", "=", "block", ".", "userData", "(", ")", "data", "=", "dataObject", ".", "data", "if", "dataObject", "is", "not", "None", "else", "None", "return", "self", ".", "_syntax...
Check if character at column is a a code
[ "Check", "if", "character", "at", "column", "is", "a", "a", "code" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntaxhlighter.py#L143-L148
andreikop/qutepart
qutepart/syntaxhlighter.py
SyntaxHighlighter.isComment
def isComment(self, block, column): """Check if character at column is a comment """ dataObject = block.userData() data = dataObject.data if dataObject is not None else None return self._syntax.isComment(data, column)
python
def isComment(self, block, column): """Check if character at column is a comment """ dataObject = block.userData() data = dataObject.data if dataObject is not None else None return self._syntax.isComment(data, column)
[ "def", "isComment", "(", "self", ",", "block", ",", "column", ")", ":", "dataObject", "=", "block", ".", "userData", "(", ")", "data", "=", "dataObject", ".", "data", "if", "dataObject", "is", "not", "None", "else", "None", "return", "self", ".", "_syn...
Check if character at column is a comment
[ "Check", "if", "character", "at", "column", "is", "a", "comment" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntaxhlighter.py#L150-L155
andreikop/qutepart
qutepart/syntaxhlighter.py
SyntaxHighlighter.isBlockComment
def isBlockComment(self, block, column): """Check if character at column is a block comment """ dataObject = block.userData() data = dataObject.data if dataObject is not None else None return self._syntax.isBlockComment(data, column)
python
def isBlockComment(self, block, column): """Check if character at column is a block comment """ dataObject = block.userData() data = dataObject.data if dataObject is not None else None return self._syntax.isBlockComment(data, column)
[ "def", "isBlockComment", "(", "self", ",", "block", ",", "column", ")", ":", "dataObject", "=", "block", ".", "userData", "(", ")", "data", "=", "dataObject", ".", "data", "if", "dataObject", "is", "not", "None", "else", "None", "return", "self", ".", ...
Check if character at column is a block comment
[ "Check", "if", "character", "at", "column", "is", "a", "block", "comment" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntaxhlighter.py#L157-L162
andreikop/qutepart
qutepart/syntaxhlighter.py
SyntaxHighlighter.isHereDoc
def isHereDoc(self, block, column): """Check if character at column is a here document """ dataObject = block.userData() data = dataObject.data if dataObject is not None else None return self._syntax.isHereDoc(data, column)
python
def isHereDoc(self, block, column): """Check if character at column is a here document """ dataObject = block.userData() data = dataObject.data if dataObject is not None else None return self._syntax.isHereDoc(data, column)
[ "def", "isHereDoc", "(", "self", ",", "block", ",", "column", ")", ":", "dataObject", "=", "block", ".", "userData", "(", ")", "data", "=", "dataObject", ".", "data", "if", "dataObject", "is", "not", "None", "else", "None", "return", "self", ".", "_syn...
Check if character at column is a here document
[ "Check", "if", "character", "at", "column", "is", "a", "here", "document" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntaxhlighter.py#L164-L169
andreikop/qutepart
qutepart/syntaxhlighter.py
SyntaxHighlighter._highlighBlocks
def _highlighBlocks(self, fromBlock, atLeastUntilBlock, timeout): endTime = time.time() + timeout block = fromBlock lineData = self._lineData(block.previous()) while block.isValid() and block != atLeastUntilBlock: if time.time() >= endTime: # time is over, schedule parsing...
python
def _highlighBlocks(self, fromBlock, atLeastUntilBlock, timeout): endTime = time.time() + timeout block = fromBlock lineData = self._lineData(block.previous()) while block.isValid() and block != atLeastUntilBlock: if time.time() >= endTime: # time is over, schedule parsing...
[ "def", "_highlighBlocks", "(", "self", ",", "fromBlock", ",", "atLeastUntilBlock", ",", "timeout", ")", ":", "endTime", "=", "time", ".", "time", "(", ")", "+", "timeout", "block", "=", "fromBlock", "lineData", "=", "self", ".", "_lineData", "(", "block", ...
Emit sizeChanged when highlighting finished, because document size might change. See andreikop/enki issue #191
[ "Emit", "sizeChanged", "when", "highlighting", "finished", "because", "document", "size", "might", "change", ".", "See", "andreikop", "/", "enki", "issue", "#191" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntaxhlighter.py#L219-L278
andreikop/qutepart
qutepart/indenter/lisp.py
IndentAlgLisp.computeSmartIndent
def computeSmartIndent(self, block, ch): """special rules: ;;; -> indent 0 ;; -> align with next line, if possible ; -> usually on the same line as code -> ignore """ if re.search(r'^\s*;;;', block.text()): return '' elif...
python
def computeSmartIndent(self, block, ch): """special rules: ;;; -> indent 0 ;; -> align with next line, if possible ; -> usually on the same line as code -> ignore """ if re.search(r'^\s*;;;', block.text()): return '' elif...
[ "def", "computeSmartIndent", "(", "self", ",", "block", ",", "ch", ")", ":", "if", "re", ".", "search", "(", "r'^\\s*;;;'", ",", "block", ".", "text", "(", ")", ")", ":", "return", "''", "elif", "re", ".", "search", "(", "r'^\\s*;;'", ",", "block", ...
special rules: ;;; -> indent 0 ;; -> align with next line, if possible ; -> usually on the same line as code -> ignore
[ "special", "rules", ":", ";;;", "-", ">", "indent", "0", ";;", "-", ">", "align", "with", "next", "line", "if", "possible", ";", "-", ">", "usually", "on", "the", "same", "line", "as", "code", "-", ">", "ignore" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/lisp.py#L8-L26
andreikop/qutepart
qutepart/lines.py
Lines._atomicModification
def _atomicModification(func): """Decorator Make document modification atomic """ def wrapper(*args, **kwargs): self = args[0] with self._qpart: func(*args, **kwargs) return wrapper
python
def _atomicModification(func): """Decorator Make document modification atomic """ def wrapper(*args, **kwargs): self = args[0] with self._qpart: func(*args, **kwargs) return wrapper
[ "def", "_atomicModification", "(", "func", ")", ":", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", "=", "args", "[", "0", "]", "with", "self", ".", "_qpart", ":", "func", "(", "*", "args", ",", "*", "*", "kwargs",...
Decorator Make document modification atomic
[ "Decorator", "Make", "document", "modification", "atomic" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/lines.py#L21-L29
andreikop/qutepart
qutepart/lines.py
Lines._checkAndConvertIndex
def _checkAndConvertIndex(self, index): """Check integer index, convert from less than zero notation """ if index < 0: index = len(self) + index if index < 0 or index >= self._doc.blockCount(): raise IndexError('Invalid block index', index) return index
python
def _checkAndConvertIndex(self, index): """Check integer index, convert from less than zero notation """ if index < 0: index = len(self) + index if index < 0 or index >= self._doc.blockCount(): raise IndexError('Invalid block index', index) return index
[ "def", "_checkAndConvertIndex", "(", "self", ",", "index", ")", ":", "if", "index", "<", "0", ":", "index", "=", "len", "(", "self", ")", "+", "index", "if", "index", "<", "0", "or", "index", ">=", "self", ".", "_doc", ".", "blockCount", "(", ")", ...
Check integer index, convert from less than zero notation
[ "Check", "integer", "index", "convert", "from", "less", "than", "zero", "notation" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/lines.py#L47-L54
andreikop/qutepart
qutepart/lines.py
Lines.append
def append(self, text): """Append line to the end """ cursor = QTextCursor(self._doc) cursor.movePosition(QTextCursor.End) cursor.insertBlock() cursor.insertText(text)
python
def append(self, text): """Append line to the end """ cursor = QTextCursor(self._doc) cursor.movePosition(QTextCursor.End) cursor.insertBlock() cursor.insertText(text)
[ "def", "append", "(", "self", ",", "text", ")", ":", "cursor", "=", "QTextCursor", "(", "self", ".", "_doc", ")", "cursor", ".", "movePosition", "(", "QTextCursor", ".", "End", ")", "cursor", ".", "insertBlock", "(", ")", "cursor", ".", "insertText", "...
Append line to the end
[ "Append", "line", "to", "the", "end" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/lines.py#L153-L159
andreikop/qutepart
qutepart/lines.py
Lines.insert
def insert(self, index, text): """Insert line to the document """ if index < 0 or index > self._doc.blockCount(): raise IndexError('Invalid block index', index) if index == 0: # first cursor = QTextCursor(self._doc.firstBlock()) cursor.insertText(tex...
python
def insert(self, index, text): """Insert line to the document """ if index < 0 or index > self._doc.blockCount(): raise IndexError('Invalid block index', index) if index == 0: # first cursor = QTextCursor(self._doc.firstBlock()) cursor.insertText(tex...
[ "def", "insert", "(", "self", ",", "index", ",", "text", ")", ":", "if", "index", "<", "0", "or", "index", ">", "self", ".", "_doc", ".", "blockCount", "(", ")", ":", "raise", "IndexError", "(", "'Invalid block index'", ",", "index", ")", "if", "inde...
Insert line to the document
[ "Insert", "line", "to", "the", "document" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/lines.py#L162-L178
andreikop/qutepart
qutepart/indenter/xmlindent.py
IndentAlgXml.computeSmartIndent
def computeSmartIndent(self, block, char): """Compute indent for the block """ lineText = block.text() prevLineText = self._prevNonEmptyBlock(block).text() alignOnly = char == '' if alignOnly: # XML might be all in one line, in which case we want to break th...
python
def computeSmartIndent(self, block, char): """Compute indent for the block """ lineText = block.text() prevLineText = self._prevNonEmptyBlock(block).text() alignOnly = char == '' if alignOnly: # XML might be all in one line, in which case we want to break th...
[ "def", "computeSmartIndent", "(", "self", ",", "block", ",", "char", ")", ":", "lineText", "=", "block", ".", "text", "(", ")", "prevLineText", "=", "self", ".", "_prevNonEmptyBlock", "(", "block", ")", ".", "text", "(", ")", "alignOnly", "=", "char", ...
Compute indent for the block
[ "Compute", "indent", "for", "the", "block" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/xmlindent.py#L10-L55
andreikop/qutepart
qutepart/indenter/ruby.py
IndentAlgRuby._prevNonCommentBlock
def _prevNonCommentBlock(self, block): """Return the closest non-empty line, ignoring comments (result <= line). Return -1 if the document """ block = self._prevNonEmptyBlock(block) while block.isValid() and self._isCommentBlock(block): block = self._prevNonEmptyBlock...
python
def _prevNonCommentBlock(self, block): """Return the closest non-empty line, ignoring comments (result <= line). Return -1 if the document """ block = self._prevNonEmptyBlock(block) while block.isValid() and self._isCommentBlock(block): block = self._prevNonEmptyBlock...
[ "def", "_prevNonCommentBlock", "(", "self", ",", "block", ")", ":", "block", "=", "self", ".", "_prevNonEmptyBlock", "(", "block", ")", "while", "block", ".", "isValid", "(", ")", "and", "self", ".", "_isCommentBlock", "(", "block", ")", ":", "block", "=...
Return the closest non-empty line, ignoring comments (result <= line). Return -1 if the document
[ "Return", "the", "closest", "non", "-", "empty", "line", "ignoring", "comments", "(", "result", "<", "=", "line", ")", ".", "Return", "-", "1", "if", "the", "document" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/ruby.py#L77-L84
andreikop/qutepart
qutepart/indenter/ruby.py
IndentAlgRuby._isLastCodeColumn
def _isLastCodeColumn(self, block, column): """Return true if the given column is at least equal to the column that contains the last non-whitespace character at the given line, or if the rest of the line is a comment. """ return column >= self._lastColumn(block) or \ ...
python
def _isLastCodeColumn(self, block, column): """Return true if the given column is at least equal to the column that contains the last non-whitespace character at the given line, or if the rest of the line is a comment. """ return column >= self._lastColumn(block) or \ ...
[ "def", "_isLastCodeColumn", "(", "self", ",", "block", ",", "column", ")", ":", "return", "column", ">=", "self", ".", "_lastColumn", "(", "block", ")", "or", "self", ".", "_isComment", "(", "block", ",", "self", ".", "_nextNonSpaceColumn", "(", "block", ...
Return true if the given column is at least equal to the column that contains the last non-whitespace character at the given line, or if the rest of the line is a comment.
[ "Return", "true", "if", "the", "given", "column", "is", "at", "least", "equal", "to", "the", "column", "that", "contains", "the", "last", "non", "-", "whitespace", "character", "at", "the", "given", "line", "or", "if", "the", "rest", "of", "the", "line",...
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/ruby.py#L90-L96
andreikop/qutepart
qutepart/indenter/ruby.py
IndentAlgRuby.lastAnchor
def lastAnchor(self, block, column): """Find the last open bracket before the current line. Return (block, column, char) or (None, None, None) """ currentPos = -1 currentBlock = None currentColumn = None currentChar = None for char in '({[': tr...
python
def lastAnchor(self, block, column): """Find the last open bracket before the current line. Return (block, column, char) or (None, None, None) """ currentPos = -1 currentBlock = None currentColumn = None currentChar = None for char in '({[': tr...
[ "def", "lastAnchor", "(", "self", ",", "block", ",", "column", ")", ":", "currentPos", "=", "-", "1", "currentBlock", "=", "None", "currentColumn", "=", "None", "currentChar", "=", "None", "for", "char", "in", "'({['", ":", "try", ":", "foundBlock", ",",...
Find the last open bracket before the current line. Return (block, column, char) or (None, None, None)
[ "Find", "the", "last", "open", "bracket", "before", "the", "current", "line", ".", "Return", "(", "block", "column", "char", ")", "or", "(", "None", "None", "None", ")" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/ruby.py#L119-L140
andreikop/qutepart
qutepart/indenter/ruby.py
IndentAlgRuby.findStmtStart
def findStmtStart(self, block): """Return the first line that is not preceded by a "continuing" line. Return currBlock if currBlock <= 0 """ prevBlock = self._prevNonCommentBlock(block) while prevBlock.isValid() and \ (((prevBlock == block.previous()) and self._isBl...
python
def findStmtStart(self, block): """Return the first line that is not preceded by a "continuing" line. Return currBlock if currBlock <= 0 """ prevBlock = self._prevNonCommentBlock(block) while prevBlock.isValid() and \ (((prevBlock == block.previous()) and self._isBl...
[ "def", "findStmtStart", "(", "self", ",", "block", ")", ":", "prevBlock", "=", "self", ".", "_prevNonCommentBlock", "(", "block", ")", "while", "prevBlock", ".", "isValid", "(", ")", "and", "(", "(", "(", "prevBlock", "==", "block", ".", "previous", "(",...
Return the first line that is not preceded by a "continuing" line. Return currBlock if currBlock <= 0
[ "Return", "the", "first", "line", "that", "is", "not", "preceded", "by", "a", "continuing", "line", ".", "Return", "currBlock", "if", "currBlock", "<", "=", "0" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/ruby.py#L153-L163
andreikop/qutepart
qutepart/indenter/ruby.py
IndentAlgRuby._isValidTrigger
def _isValidTrigger(block, ch): """check if the trigger characters are in the right context, otherwise running the indenter might be annoying to the user """ if ch == "" or ch == "\n": return True # Explicit align or new line match = rxUnindent.match(block.text()) ...
python
def _isValidTrigger(block, ch): """check if the trigger characters are in the right context, otherwise running the indenter might be annoying to the user """ if ch == "" or ch == "\n": return True # Explicit align or new line match = rxUnindent.match(block.text()) ...
[ "def", "_isValidTrigger", "(", "block", ",", "ch", ")", ":", "if", "ch", "==", "\"\"", "or", "ch", "==", "\"\\n\"", ":", "return", "True", "# Explicit align or new line", "match", "=", "rxUnindent", ".", "match", "(", "block", ".", "text", "(", ")", ")",...
check if the trigger characters are in the right context, otherwise running the indenter might be annoying to the user
[ "check", "if", "the", "trigger", "characters", "are", "in", "the", "right", "context", "otherwise", "running", "the", "indenter", "might", "be", "annoying", "to", "the", "user" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/ruby.py#L166-L175
andreikop/qutepart
qutepart/indenter/ruby.py
IndentAlgRuby.findPrevStmt
def findPrevStmt(self, block): """Returns a tuple that contains the first and last line of the previous statement before line. """ stmtEnd = self._prevNonCommentBlock(block) stmtStart = self.findStmtStart(stmtEnd) return Statement(self._qpart, stmtStart, stmtEnd)
python
def findPrevStmt(self, block): """Returns a tuple that contains the first and last line of the previous statement before line. """ stmtEnd = self._prevNonCommentBlock(block) stmtStart = self.findStmtStart(stmtEnd) return Statement(self._qpart, stmtStart, stmtEnd)
[ "def", "findPrevStmt", "(", "self", ",", "block", ")", ":", "stmtEnd", "=", "self", ".", "_prevNonCommentBlock", "(", "block", ")", "stmtStart", "=", "self", ".", "findStmtStart", "(", "stmtEnd", ")", "return", "Statement", "(", "self", ".", "_qpart", ",",...
Returns a tuple that contains the first and last line of the previous statement before line.
[ "Returns", "a", "tuple", "that", "contains", "the", "first", "and", "last", "line", "of", "the", "previous", "statement", "before", "line", "." ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/ruby.py#L177-L183
andreikop/qutepart
qutepart/indenter/ruby.py
IndentAlgRuby.computeSmartIndent
def computeSmartIndent(self, block, ch): """indent gets three arguments: line, indentWidth in spaces, typed character indent """ if not self._isValidTrigger(block, ch): return None prevStmt = self.findPrevStmt(block) if not prevStmt.endBlock.isValid(): ...
python
def computeSmartIndent(self, block, ch): """indent gets three arguments: line, indentWidth in spaces, typed character indent """ if not self._isValidTrigger(block, ch): return None prevStmt = self.findPrevStmt(block) if not prevStmt.endBlock.isValid(): ...
[ "def", "computeSmartIndent", "(", "self", ",", "block", ",", "ch", ")", ":", "if", "not", "self", ".", "_isValidTrigger", "(", "block", ",", "ch", ")", ":", "return", "None", "prevStmt", "=", "self", ".", "findPrevStmt", "(", "block", ")", "if", "not",...
indent gets three arguments: line, indentWidth in spaces, typed character indent
[ "indent", "gets", "three", "arguments", ":", "line", "indentWidth", "in", "spaces", "typed", "character", "indent" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/ruby.py#L213-L288
andreikop/qutepart
qutepart/htmldelegate.py
HTMLDelegate.paint
def paint(self, painter, option, index): """QStyledItemDelegate.paint implementation """ option.state &= ~QStyle.State_HasFocus # never draw focus rect options = QStyleOptionViewItem(option) self.initStyleOption(options,index) style = QApplication.style() if options.wi...
python
def paint(self, painter, option, index): """QStyledItemDelegate.paint implementation """ option.state &= ~QStyle.State_HasFocus # never draw focus rect options = QStyleOptionViewItem(option) self.initStyleOption(options,index) style = QApplication.style() if options.wi...
[ "def", "paint", "(", "self", ",", "painter", ",", "option", ",", "index", ")", ":", "option", ".", "state", "&=", "~", "QStyle", ".", "State_HasFocus", "# never draw focus rect", "options", "=", "QStyleOptionViewItem", "(", "option", ")", "self", ".", "initS...
QStyledItemDelegate.paint implementation
[ "QStyledItemDelegate", ".", "paint", "implementation" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/htmldelegate.py#L36-L71
andreikop/qutepart
qutepart/rectangularselection.py
RectangularSelection.isDeleteKeyEvent
def isDeleteKeyEvent(self, keyEvent): """Check if key event should be handled as Delete command""" return self._start is not None and \ (keyEvent.matches(QKeySequence.Delete) or \ (keyEvent.key() == Qt.Key_Backspace and keyEvent.modifiers() == Qt.NoModifier))
python
def isDeleteKeyEvent(self, keyEvent): """Check if key event should be handled as Delete command""" return self._start is not None and \ (keyEvent.matches(QKeySequence.Delete) or \ (keyEvent.key() == Qt.Key_Backspace and keyEvent.modifiers() == Qt.NoModifier))
[ "def", "isDeleteKeyEvent", "(", "self", ",", "keyEvent", ")", ":", "return", "self", ".", "_start", "is", "not", "None", "and", "(", "keyEvent", ".", "matches", "(", "QKeySequence", ".", "Delete", ")", "or", "(", "keyEvent", ".", "key", "(", ")", "==",...
Check if key event should be handled as Delete command
[ "Check", "if", "key", "event", "should", "be", "handled", "as", "Delete", "command" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/rectangularselection.py#L35-L39
andreikop/qutepart
qutepart/rectangularselection.py
RectangularSelection.delete
def delete(self): """Del or Backspace pressed. Delete selection""" with self._qpart: for cursor in self.cursors(): if cursor.hasSelection(): cursor.deleteChar()
python
def delete(self): """Del or Backspace pressed. Delete selection""" with self._qpart: for cursor in self.cursors(): if cursor.hasSelection(): cursor.deleteChar()
[ "def", "delete", "(", "self", ")", ":", "with", "self", ".", "_qpart", ":", "for", "cursor", "in", "self", ".", "cursors", "(", ")", ":", "if", "cursor", ".", "hasSelection", "(", ")", ":", "cursor", ".", "deleteChar", "(", ")" ]
Del or Backspace pressed. Delete selection
[ "Del", "or", "Backspace", "pressed", ".", "Delete", "selection" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/rectangularselection.py#L41-L46
andreikop/qutepart
qutepart/rectangularselection.py
RectangularSelection.isExpandKeyEvent
def isExpandKeyEvent(self, keyEvent): """Check if key event should expand rectangular selection""" return keyEvent.modifiers() & Qt.ShiftModifier and \ keyEvent.modifiers() & Qt.AltModifier and \ keyEvent.key() in (Qt.Key_Left, Qt.Key_Right, Qt.Key_Down, Qt.Key_Up, ...
python
def isExpandKeyEvent(self, keyEvent): """Check if key event should expand rectangular selection""" return keyEvent.modifiers() & Qt.ShiftModifier and \ keyEvent.modifiers() & Qt.AltModifier and \ keyEvent.key() in (Qt.Key_Left, Qt.Key_Right, Qt.Key_Down, Qt.Key_Up, ...
[ "def", "isExpandKeyEvent", "(", "self", ",", "keyEvent", ")", ":", "return", "keyEvent", ".", "modifiers", "(", ")", "&", "Qt", ".", "ShiftModifier", "and", "keyEvent", ".", "modifiers", "(", ")", "&", "Qt", ".", "AltModifier", "and", "keyEvent", ".", "k...
Check if key event should expand rectangular selection
[ "Check", "if", "key", "event", "should", "expand", "rectangular", "selection" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/rectangularselection.py#L48-L53
andreikop/qutepart
qutepart/rectangularselection.py
RectangularSelection.onExpandKeyEvent
def onExpandKeyEvent(self, keyEvent): """One of expand selection key events""" if self._start is None: currentBlockText = self._qpart.textCursor().block().text() line = self._qpart.cursorPosition[0] visibleColumn = self._realToVisibleColumn(currentBlockText, self._qpa...
python
def onExpandKeyEvent(self, keyEvent): """One of expand selection key events""" if self._start is None: currentBlockText = self._qpart.textCursor().block().text() line = self._qpart.cursorPosition[0] visibleColumn = self._realToVisibleColumn(currentBlockText, self._qpa...
[ "def", "onExpandKeyEvent", "(", "self", ",", "keyEvent", ")", ":", "if", "self", ".", "_start", "is", "None", ":", "currentBlockText", "=", "self", ".", "_qpart", ".", "textCursor", "(", ")", ".", "block", "(", ")", ".", "text", "(", ")", "line", "="...
One of expand selection key events
[ "One", "of", "expand", "selection", "key", "events" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/rectangularselection.py#L55-L74
andreikop/qutepart
qutepart/rectangularselection.py
RectangularSelection._realToVisibleColumn
def _realToVisibleColumn(self, text, realColumn): """If \t is used, real position of symbol in block and visible position differs This function converts real to visible """ generator = self._visibleCharPositionGenerator(text) for i in range(realColumn): val = next(gen...
python
def _realToVisibleColumn(self, text, realColumn): """If \t is used, real position of symbol in block and visible position differs This function converts real to visible """ generator = self._visibleCharPositionGenerator(text) for i in range(realColumn): val = next(gen...
[ "def", "_realToVisibleColumn", "(", "self", ",", "text", ",", "realColumn", ")", ":", "generator", "=", "self", ".", "_visibleCharPositionGenerator", "(", "text", ")", "for", "i", "in", "range", "(", "realColumn", ")", ":", "val", "=", "next", "(", "genera...
If \t is used, real position of symbol in block and visible position differs This function converts real to visible
[ "If", "\\", "t", "is", "used", "real", "position", "of", "symbol", "in", "block", "and", "visible", "position", "differs", "This", "function", "converts", "real", "to", "visible" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/rectangularselection.py#L90-L98
andreikop/qutepart
qutepart/rectangularselection.py
RectangularSelection._visibleToRealColumn
def _visibleToRealColumn(self, text, visiblePos): """If \t is used, real position of symbol in block and visible position differs This function converts visible to real. Bigger value is returned, if visiblePos is in the middle of \t, None if text is too short """ if visiblePos ==...
python
def _visibleToRealColumn(self, text, visiblePos): """If \t is used, real position of symbol in block and visible position differs This function converts visible to real. Bigger value is returned, if visiblePos is in the middle of \t, None if text is too short """ if visiblePos ==...
[ "def", "_visibleToRealColumn", "(", "self", ",", "text", ",", "visiblePos", ")", ":", "if", "visiblePos", "==", "0", ":", "return", "0", "elif", "not", "'\\t'", "in", "text", ":", "return", "visiblePos", "else", ":", "currentIndex", "=", "1", "for", "cur...
If \t is used, real position of symbol in block and visible position differs This function converts visible to real. Bigger value is returned, if visiblePos is in the middle of \t, None if text is too short
[ "If", "\\", "t", "is", "used", "real", "position", "of", "symbol", "in", "block", "and", "visible", "position", "differs", "This", "function", "converts", "visible", "to", "real", ".", "Bigger", "value", "is", "returned", "if", "visiblePos", "is", "in", "t...
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/rectangularselection.py#L100-L116
andreikop/qutepart
qutepart/rectangularselection.py
RectangularSelection.cursors
def cursors(self): """Cursors for rectangular selection. 1 cursor for every line """ cursors = [] if self._start is not None: startLine, startVisibleCol = self._start currentLine, currentCol = self._qpart.cursorPosition if abs(startLine - curre...
python
def cursors(self): """Cursors for rectangular selection. 1 cursor for every line """ cursors = [] if self._start is not None: startLine, startVisibleCol = self._start currentLine, currentCol = self._qpart.cursorPosition if abs(startLine - curre...
[ "def", "cursors", "(", "self", ")", ":", "cursors", "=", "[", "]", "if", "self", ".", "_start", "is", "not", "None", ":", "startLine", ",", "startVisibleCol", "=", "self", ".", "_start", "currentLine", ",", "currentCol", "=", "self", ".", "_qpart", "."...
Cursors for rectangular selection. 1 cursor for every line
[ "Cursors", "for", "rectangular", "selection", ".", "1", "cursor", "for", "every", "line" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/rectangularselection.py#L118-L152
andreikop/qutepart
qutepart/rectangularselection.py
RectangularSelection.selections
def selections(self): """Build list of extra selections for rectangular selection""" selections = [] cursors = self.cursors() if cursors: background = self._qpart.palette().color(QPalette.Highlight) foreground = self._qpart.palette().color(QPalette.HighlightedText...
python
def selections(self): """Build list of extra selections for rectangular selection""" selections = [] cursors = self.cursors() if cursors: background = self._qpart.palette().color(QPalette.Highlight) foreground = self._qpart.palette().color(QPalette.HighlightedText...
[ "def", "selections", "(", "self", ")", ":", "selections", "=", "[", "]", "cursors", "=", "self", ".", "cursors", "(", ")", "if", "cursors", ":", "background", "=", "self", ".", "_qpart", ".", "palette", "(", ")", ".", "color", "(", "QPalette", ".", ...
Build list of extra selections for rectangular selection
[ "Build", "list", "of", "extra", "selections", "for", "rectangular", "selection" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/rectangularselection.py#L154-L169
andreikop/qutepart
qutepart/rectangularselection.py
RectangularSelection.copy
def copy(self): """Copy to the clipboard""" data = QMimeData() text = '\n'.join([cursor.selectedText() \ for cursor in self.cursors()]) data.setText(text) data.setData(self.MIME_TYPE, text.encode('utf8')) QApplication.clipboard().setMimeData(da...
python
def copy(self): """Copy to the clipboard""" data = QMimeData() text = '\n'.join([cursor.selectedText() \ for cursor in self.cursors()]) data.setText(text) data.setData(self.MIME_TYPE, text.encode('utf8')) QApplication.clipboard().setMimeData(da...
[ "def", "copy", "(", "self", ")", ":", "data", "=", "QMimeData", "(", ")", "text", "=", "'\\n'", ".", "join", "(", "[", "cursor", ".", "selectedText", "(", ")", "for", "cursor", "in", "self", ".", "cursors", "(", ")", "]", ")", "data", ".", "setTe...
Copy to the clipboard
[ "Copy", "to", "the", "clipboard" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/rectangularselection.py#L175-L182
andreikop/qutepart
qutepart/rectangularselection.py
RectangularSelection.cut
def cut(self): """Cut action. Copy and delete """ cursorPos = self._qpart.cursorPosition topLeft = (min(self._start[0], cursorPos[0]), min(self._start[1], cursorPos[1])) self.copy() self.delete() """Move cursor to top-left corner of the selecti...
python
def cut(self): """Cut action. Copy and delete """ cursorPos = self._qpart.cursorPosition topLeft = (min(self._start[0], cursorPos[0]), min(self._start[1], cursorPos[1])) self.copy() self.delete() """Move cursor to top-left corner of the selecti...
[ "def", "cut", "(", "self", ")", ":", "cursorPos", "=", "self", ".", "_qpart", ".", "cursorPosition", "topLeft", "=", "(", "min", "(", "self", ".", "_start", "[", "0", "]", ",", "cursorPos", "[", "0", "]", ")", ",", "min", "(", "self", ".", "_star...
Cut action. Copy and delete
[ "Cut", "action", ".", "Copy", "and", "delete" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/rectangularselection.py#L184-L195
andreikop/qutepart
qutepart/rectangularselection.py
RectangularSelection._indentUpTo
def _indentUpTo(self, text, width): """Add space to text, so text width will be at least width. Return text, which must be added """ visibleTextWidth = self._realToVisibleColumn(text, len(text)) diff = width - visibleTextWidth if diff <= 0: return '' e...
python
def _indentUpTo(self, text, width): """Add space to text, so text width will be at least width. Return text, which must be added """ visibleTextWidth = self._realToVisibleColumn(text, len(text)) diff = width - visibleTextWidth if diff <= 0: return '' e...
[ "def", "_indentUpTo", "(", "self", ",", "text", ",", "width", ")", ":", "visibleTextWidth", "=", "self", ".", "_realToVisibleColumn", "(", "text", ",", "len", "(", "text", ")", ")", "diff", "=", "width", "-", "visibleTextWidth", "if", "diff", "<=", "0", ...
Add space to text, so text width will be at least width. Return text, which must be added
[ "Add", "space", "to", "text", "so", "text", "width", "will", "be", "at", "least", "width", ".", "Return", "text", "which", "must", "be", "added" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/rectangularselection.py#L197-L210
andreikop/qutepart
qutepart/rectangularselection.py
RectangularSelection.paste
def paste(self, mimeData): """Paste recrangular selection. Add space at the beginning of line, if necessary """ if self.isActive(): self.delete() elif self._qpart.textCursor().hasSelection(): self._qpart.textCursor().deleteChar() text = bytes(mime...
python
def paste(self, mimeData): """Paste recrangular selection. Add space at the beginning of line, if necessary """ if self.isActive(): self.delete() elif self._qpart.textCursor().hasSelection(): self._qpart.textCursor().deleteChar() text = bytes(mime...
[ "def", "paste", "(", "self", ",", "mimeData", ")", ":", "if", "self", ".", "isActive", "(", ")", ":", "self", ".", "delete", "(", ")", "elif", "self", ".", "_qpart", ".", "textCursor", "(", ")", ".", "hasSelection", "(", ")", ":", "self", ".", "_...
Paste recrangular selection. Add space at the beginning of line, if necessary
[ "Paste", "recrangular", "selection", ".", "Add", "space", "at", "the", "beginning", "of", "line", "if", "necessary" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/rectangularselection.py#L212-L236
andreikop/qutepart
qutepart/margins.py
MarginBase.__allocateBits
def __allocateBits(self): """Allocates the bit range depending on the required bit count """ if self._bit_count < 0: raise Exception( "A margin cannot request negative number of bits" ) if self._bit_count == 0: return # Build a list of occupied ranges ...
python
def __allocateBits(self): """Allocates the bit range depending on the required bit count """ if self._bit_count < 0: raise Exception( "A margin cannot request negative number of bits" ) if self._bit_count == 0: return # Build a list of occupied ranges ...
[ "def", "__allocateBits", "(", "self", ")", ":", "if", "self", ".", "_bit_count", "<", "0", ":", "raise", "Exception", "(", "\"A margin cannot request negative number of bits\"", ")", "if", "self", ".", "_bit_count", "==", "0", ":", "return", "# Build a list of occ...
Allocates the bit range depending on the required bit count
[ "Allocates", "the", "bit", "range", "depending", "on", "the", "required", "bit", "count" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/margins.py#L32-L65
andreikop/qutepart
qutepart/margins.py
MarginBase.__updateRequest
def __updateRequest(self, rect, dy): """Repaint line number area if necessary """ if dy: self.scroll(0, dy) elif self._countCache[0] != self._qpart.blockCount() or \ self._countCache[1] != self._qpart.textCursor().block().lineCount(): # if block heig...
python
def __updateRequest(self, rect, dy): """Repaint line number area if necessary """ if dy: self.scroll(0, dy) elif self._countCache[0] != self._qpart.blockCount() or \ self._countCache[1] != self._qpart.textCursor().block().lineCount(): # if block heig...
[ "def", "__updateRequest", "(", "self", ",", "rect", ",", "dy", ")", ":", "if", "dy", ":", "self", ".", "scroll", "(", "0", ",", "dy", ")", "elif", "self", ".", "_countCache", "[", "0", "]", "!=", "self", ".", "_qpart", ".", "blockCount", "(", ")"...
Repaint line number area if necessary
[ "Repaint", "line", "number", "area", "if", "necessary" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/margins.py#L67-L82
andreikop/qutepart
qutepart/margins.py
MarginBase.setBlockValue
def setBlockValue(self, block, value): """Sets the required value to the block without damaging the other bits """ if self._bit_count == 0: raise Exception( "The margin '" + self._name + "' did not allocate any bits for the values") if value < 0: ...
python
def setBlockValue(self, block, value): """Sets the required value to the block without damaging the other bits """ if self._bit_count == 0: raise Exception( "The margin '" + self._name + "' did not allocate any bits for the values") if value < 0: ...
[ "def", "setBlockValue", "(", "self", ",", "block", ",", "value", ")", ":", "if", "self", ".", "_bit_count", "==", "0", ":", "raise", "Exception", "(", "\"The margin '\"", "+", "self", ".", "_name", "+", "\"' did not allocate any bits for the values\"", ")", "i...
Sets the required value to the block without damaging the other bits
[ "Sets", "the", "required", "value", "to", "the", "block", "without", "damaging", "the", "other", "bits" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/margins.py#L95-L117
andreikop/qutepart
qutepart/margins.py
MarginBase.getBlockValue
def getBlockValue(self, block): """Provides the previously set block value respecting the bits range. 0 value and not marked block are treated the same way and 0 is provided. """ if self._bit_count == 0: raise Exception( "The margin '" + self._name + ...
python
def getBlockValue(self, block): """Provides the previously set block value respecting the bits range. 0 value and not marked block are treated the same way and 0 is provided. """ if self._bit_count == 0: raise Exception( "The margin '" + self._name + ...
[ "def", "getBlockValue", "(", "self", ",", "block", ")", ":", "if", "self", ".", "_bit_count", "==", "0", ":", "raise", "Exception", "(", "\"The margin '\"", "+", "self", ".", "_name", "+", "\"' did not allocate any bits for the values\"", ")", "val", "=", "blo...
Provides the previously set block value respecting the bits range. 0 value and not marked block are treated the same way and 0 is provided.
[ "Provides", "the", "previously", "set", "block", "value", "respecting", "the", "bits", "range", ".", "0", "value", "and", "not", "marked", "block", "are", "treated", "the", "same", "way", "and", "0", "is", "provided", "." ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/margins.py#L119-L137
andreikop/qutepart
qutepart/margins.py
MarginBase.hide
def hide(self): """Override the QWidget::hide() method to properly recalculate the editor viewport. """ if not self.isHidden(): QWidget.hide(self) self._qpart.updateViewport()
python
def hide(self): """Override the QWidget::hide() method to properly recalculate the editor viewport. """ if not self.isHidden(): QWidget.hide(self) self._qpart.updateViewport()
[ "def", "hide", "(", "self", ")", ":", "if", "not", "self", ".", "isHidden", "(", ")", ":", "QWidget", ".", "hide", "(", "self", ")", "self", ".", "_qpart", ".", "updateViewport", "(", ")" ]
Override the QWidget::hide() method to properly recalculate the editor viewport.
[ "Override", "the", "QWidget", "::", "hide", "()", "method", "to", "properly", "recalculate", "the", "editor", "viewport", "." ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/margins.py#L139-L145
andreikop/qutepart
qutepart/margins.py
MarginBase.show
def show(self): """Override the QWidget::show() method to properly recalculate the editor viewport. """ if self.isHidden(): QWidget.show(self) self._qpart.updateViewport()
python
def show(self): """Override the QWidget::show() method to properly recalculate the editor viewport. """ if self.isHidden(): QWidget.show(self) self._qpart.updateViewport()
[ "def", "show", "(", "self", ")", ":", "if", "self", ".", "isHidden", "(", ")", ":", "QWidget", ".", "show", "(", "self", ")", "self", ".", "_qpart", ".", "updateViewport", "(", ")" ]
Override the QWidget::show() method to properly recalculate the editor viewport.
[ "Override", "the", "QWidget", "::", "show", "()", "method", "to", "properly", "recalculate", "the", "editor", "viewport", "." ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/margins.py#L147-L153
andreikop/qutepart
qutepart/margins.py
MarginBase.setVisible
def setVisible(self, val): """Override the QWidget::setVisible(bool) method to properly recalculate the editor viewport. """ if val != self.isVisible(): if val: QWidget.setVisible(self, True) else: QWidget.setVisible(self, False)...
python
def setVisible(self, val): """Override the QWidget::setVisible(bool) method to properly recalculate the editor viewport. """ if val != self.isVisible(): if val: QWidget.setVisible(self, True) else: QWidget.setVisible(self, False)...
[ "def", "setVisible", "(", "self", ",", "val", ")", ":", "if", "val", "!=", "self", ".", "isVisible", "(", ")", ":", "if", "val", ":", "QWidget", ".", "setVisible", "(", "self", ",", "True", ")", "else", ":", "QWidget", ".", "setVisible", "(", "self...
Override the QWidget::setVisible(bool) method to properly recalculate the editor viewport.
[ "Override", "the", "QWidget", "::", "setVisible", "(", "bool", ")", "method", "to", "properly", "recalculate", "the", "editor", "viewport", "." ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/margins.py#L155-L164
andreikop/qutepart
qutepart/margins.py
MarginBase.clear
def clear(self): """Convenience method to reset all the block values to 0 """ if self._bit_count == 0: return block = self._qpart.document().begin() while block.isValid(): if self.getBlockValue(block): self.setBlockValue(block, 0) ...
python
def clear(self): """Convenience method to reset all the block values to 0 """ if self._bit_count == 0: return block = self._qpart.document().begin() while block.isValid(): if self.getBlockValue(block): self.setBlockValue(block, 0) ...
[ "def", "clear", "(", "self", ")", ":", "if", "self", ".", "_bit_count", "==", "0", ":", "return", "block", "=", "self", ".", "_qpart", ".", "document", "(", ")", ".", "begin", "(", ")", "while", "block", ".", "isValid", "(", ")", ":", "if", "self...
Convenience method to reset all the block values to 0
[ "Convenience", "method", "to", "reset", "all", "the", "block", "values", "to", "0" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/margins.py#L175-L185
andreikop/qutepart
qutepart/syntax/__init__.py
Syntax._getTextType
def _getTextType(self, lineData, column): """Get text type (letter) """ if lineData is None: return ' ' # default is code textTypeMap = lineData[1] if column >= len(textTypeMap): # probably, not actual data, not updated yet return ' ' return te...
python
def _getTextType(self, lineData, column): """Get text type (letter) """ if lineData is None: return ' ' # default is code textTypeMap = lineData[1] if column >= len(textTypeMap): # probably, not actual data, not updated yet return ' ' return te...
[ "def", "_getTextType", "(", "self", ",", "lineData", ",", "column", ")", ":", "if", "lineData", "is", "None", ":", "return", "' '", "# default is code", "textTypeMap", "=", "lineData", "[", "1", "]", "if", "column", ">=", "len", "(", "textTypeMap", ")", ...
Get text type (letter)
[ "Get", "text", "type", "(", "letter", ")" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntax/__init__.py#L117-L127
andreikop/qutepart
qutepart/syntax/__init__.py
SyntaxManager._getSyntaxByXmlFileName
def _getSyntaxByXmlFileName(self, xmlFileName): """Get syntax by its xml file name """ import qutepart.syntax.loader # delayed import for avoid cross-imports problem with self._loadedSyntaxesLock: if not xmlFileName in self._loadedSyntaxes: xmlFilePath = os....
python
def _getSyntaxByXmlFileName(self, xmlFileName): """Get syntax by its xml file name """ import qutepart.syntax.loader # delayed import for avoid cross-imports problem with self._loadedSyntaxesLock: if not xmlFileName in self._loadedSyntaxes: xmlFilePath = os....
[ "def", "_getSyntaxByXmlFileName", "(", "self", ",", "xmlFileName", ")", ":", "import", "qutepart", ".", "syntax", ".", "loader", "# delayed import for avoid cross-imports problem", "with", "self", ".", "_loadedSyntaxesLock", ":", "if", "not", "xmlFileName", "in", "sel...
Get syntax by its xml file name
[ "Get", "syntax", "by", "its", "xml", "file", "name" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntax/__init__.py#L170-L182
andreikop/qutepart
qutepart/syntax/__init__.py
SyntaxManager._getSyntaxByLanguageName
def _getSyntaxByLanguageName(self, syntaxName): """Get syntax by its name. Name is defined in the xml file """ xmlFileName = self._syntaxNameToXmlFileName[syntaxName] return self._getSyntaxByXmlFileName(xmlFileName)
python
def _getSyntaxByLanguageName(self, syntaxName): """Get syntax by its name. Name is defined in the xml file """ xmlFileName = self._syntaxNameToXmlFileName[syntaxName] return self._getSyntaxByXmlFileName(xmlFileName)
[ "def", "_getSyntaxByLanguageName", "(", "self", ",", "syntaxName", ")", ":", "xmlFileName", "=", "self", ".", "_syntaxNameToXmlFileName", "[", "syntaxName", "]", "return", "self", ".", "_getSyntaxByXmlFileName", "(", "xmlFileName", ")" ]
Get syntax by its name. Name is defined in the xml file
[ "Get", "syntax", "by", "its", "name", ".", "Name", "is", "defined", "in", "the", "xml", "file" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntax/__init__.py#L184-L188
andreikop/qutepart
qutepart/syntax/__init__.py
SyntaxManager._getSyntaxBySourceFileName
def _getSyntaxBySourceFileName(self, name): """Get syntax by source name of file, which is going to be highlighted """ for regExp, xmlFileName in self._extensionToXmlFileName.items(): if regExp.match(name): return self._getSyntaxByXmlFileName(xmlFileName) else...
python
def _getSyntaxBySourceFileName(self, name): """Get syntax by source name of file, which is going to be highlighted """ for regExp, xmlFileName in self._extensionToXmlFileName.items(): if regExp.match(name): return self._getSyntaxByXmlFileName(xmlFileName) else...
[ "def", "_getSyntaxBySourceFileName", "(", "self", ",", "name", ")", ":", "for", "regExp", ",", "xmlFileName", "in", "self", ".", "_extensionToXmlFileName", ".", "items", "(", ")", ":", "if", "regExp", ".", "match", "(", "name", ")", ":", "return", "self", ...
Get syntax by source name of file, which is going to be highlighted
[ "Get", "syntax", "by", "source", "name", "of", "file", "which", "is", "going", "to", "be", "highlighted" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntax/__init__.py#L190-L197
andreikop/qutepart
qutepart/syntax/__init__.py
SyntaxManager._getSyntaxByMimeType
def _getSyntaxByMimeType(self, mimeType): """Get syntax by first line of the file """ xmlFileName = self._mimeTypeToXmlFileName[mimeType] return self._getSyntaxByXmlFileName(xmlFileName)
python
def _getSyntaxByMimeType(self, mimeType): """Get syntax by first line of the file """ xmlFileName = self._mimeTypeToXmlFileName[mimeType] return self._getSyntaxByXmlFileName(xmlFileName)
[ "def", "_getSyntaxByMimeType", "(", "self", ",", "mimeType", ")", ":", "xmlFileName", "=", "self", ".", "_mimeTypeToXmlFileName", "[", "mimeType", "]", "return", "self", ".", "_getSyntaxByXmlFileName", "(", "xmlFileName", ")" ]
Get syntax by first line of the file
[ "Get", "syntax", "by", "first", "line", "of", "the", "file" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntax/__init__.py#L199-L203
andreikop/qutepart
qutepart/syntax/__init__.py
SyntaxManager._getSyntaxByFirstLine
def _getSyntaxByFirstLine(self, firstLine): """Get syntax by first line of the file """ for pattern, xmlFileName in self._firstLineToXmlFileName.items(): if fnmatch.fnmatch(firstLine, pattern): return self._getSyntaxByXmlFileName(xmlFileName) else: ...
python
def _getSyntaxByFirstLine(self, firstLine): """Get syntax by first line of the file """ for pattern, xmlFileName in self._firstLineToXmlFileName.items(): if fnmatch.fnmatch(firstLine, pattern): return self._getSyntaxByXmlFileName(xmlFileName) else: ...
[ "def", "_getSyntaxByFirstLine", "(", "self", ",", "firstLine", ")", ":", "for", "pattern", ",", "xmlFileName", "in", "self", ".", "_firstLineToXmlFileName", ".", "items", "(", ")", ":", "if", "fnmatch", ".", "fnmatch", "(", "firstLine", ",", "pattern", ")", ...
Get syntax by first line of the file
[ "Get", "syntax", "by", "first", "line", "of", "the", "file" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntax/__init__.py#L205-L212
andreikop/qutepart
qutepart/syntax/__init__.py
SyntaxManager.getSyntax
def getSyntax(self, xmlFileName=None, mimeType=None, languageName=None, sourceFilePath=None, firstLine=None): """Get syntax by one of parameters: * xmlFileName * mimeType * languageName ...
python
def getSyntax(self, xmlFileName=None, mimeType=None, languageName=None, sourceFilePath=None, firstLine=None): """Get syntax by one of parameters: * xmlFileName * mimeType * languageName ...
[ "def", "getSyntax", "(", "self", ",", "xmlFileName", "=", "None", ",", "mimeType", "=", "None", ",", "languageName", "=", "None", ",", "sourceFilePath", "=", "None", ",", "firstLine", "=", "None", ")", ":", "syntax", "=", "None", "if", "syntax", "is", ...
Get syntax by one of parameters: * xmlFileName * mimeType * languageName * sourceFilePath First parameter in the list has biggest priority
[ "Get", "syntax", "by", "one", "of", "parameters", ":", "*", "xmlFileName", "*", "mimeType", "*", "languageName", "*", "sourceFilePath", "First", "parameter", "in", "the", "list", "has", "biggest", "priority" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntax/__init__.py#L214-L260
andreikop/qutepart
qutepart/syntax/parser.py
ContextStack.pop
def pop(self, count): """Returns new context stack, which doesn't contain few levels """ if len(self._contexts) - 1 < count: _logger.error("#pop value is too big %d", len(self._contexts)) if len(self._contexts) > 1: return ContextStack(self._contexts[:1], ...
python
def pop(self, count): """Returns new context stack, which doesn't contain few levels """ if len(self._contexts) - 1 < count: _logger.error("#pop value is too big %d", len(self._contexts)) if len(self._contexts) > 1: return ContextStack(self._contexts[:1], ...
[ "def", "pop", "(", "self", ",", "count", ")", ":", "if", "len", "(", "self", ".", "_contexts", ")", "-", "1", "<", "count", ":", "_logger", ".", "error", "(", "\"#pop value is too big %d\"", ",", "len", "(", "self", ".", "_contexts", ")", ")", "if", ...
Returns new context stack, which doesn't contain few levels
[ "Returns", "new", "context", "stack", "which", "doesn", "t", "contain", "few", "levels" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntax/parser.py#L32-L42
andreikop/qutepart
qutepart/syntax/parser.py
ContextStack.append
def append(self, context, data): """Returns new context, which contains current stack and new frame """ return ContextStack(self._contexts + [context], self._data + [data])
python
def append(self, context, data): """Returns new context, which contains current stack and new frame """ return ContextStack(self._contexts + [context], self._data + [data])
[ "def", "append", "(", "self", ",", "context", ",", "data", ")", ":", "return", "ContextStack", "(", "self", ".", "_contexts", "+", "[", "context", "]", ",", "self", ".", "_data", "+", "[", "data", "]", ")" ]
Returns new context, which contains current stack and new frame
[ "Returns", "new", "context", "which", "contains", "current", "stack", "and", "new", "frame" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntax/parser.py#L44-L47
andreikop/qutepart
qutepart/syntax/parser.py
ContextSwitcher.getNextContextStack
def getNextContextStack(self, contextStack, data=None): """Apply modification to the contextStack. This method never modifies input parameter list """ if self._popsCount: contextStack = contextStack.pop(self._popsCount) if self._contextToSwitch is not None: ...
python
def getNextContextStack(self, contextStack, data=None): """Apply modification to the contextStack. This method never modifies input parameter list """ if self._popsCount: contextStack = contextStack.pop(self._popsCount) if self._contextToSwitch is not None: ...
[ "def", "getNextContextStack", "(", "self", ",", "contextStack", ",", "data", "=", "None", ")", ":", "if", "self", ".", "_popsCount", ":", "contextStack", "=", "contextStack", ".", "pop", "(", "self", ".", "_popsCount", ")", "if", "self", ".", "_contextToSw...
Apply modification to the contextStack. This method never modifies input parameter list
[ "Apply", "modification", "to", "the", "contextStack", ".", "This", "method", "never", "modifies", "input", "parameter", "list" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntax/parser.py#L72-L84
andreikop/qutepart
qutepart/syntax/parser.py
AbstractRule.tryMatch
def tryMatch(self, textToMatchObject): """Try to find themselves in the text. Returns (contextStack, count, matchedRule) or (contextStack, None, None) if doesn't match """ # Skip if column doesn't match if self.column != -1 and \ self.column != textToMatchObject.curren...
python
def tryMatch(self, textToMatchObject): """Try to find themselves in the text. Returns (contextStack, count, matchedRule) or (contextStack, None, None) if doesn't match """ # Skip if column doesn't match if self.column != -1 and \ self.column != textToMatchObject.curren...
[ "def", "tryMatch", "(", "self", ",", "textToMatchObject", ")", ":", "# Skip if column doesn't match", "if", "self", ".", "column", "!=", "-", "1", "and", "self", ".", "column", "!=", "textToMatchObject", ".", "currentColumnIndex", ":", "return", "None", "if", ...
Try to find themselves in the text. Returns (contextStack, count, matchedRule) or (contextStack, None, None) if doesn't match
[ "Try", "to", "find", "themselves", "in", "the", "text", ".", "Returns", "(", "contextStack", "count", "matchedRule", ")", "or", "(", "contextStack", "None", "None", ")", "if", "doesn", "t", "match" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntax/parser.py#L186-L199
andreikop/qutepart
qutepart/syntax/parser.py
StringDetect._makeDynamicSubsctitutions
def _makeDynamicSubsctitutions(string, contextData): """For dynamic rules, replace %d patterns with actual strings Python function, which is used by C extension. """ def _replaceFunc(escapeMatchObject): stringIndex = escapeMatchObject.group(0)[1] index = int(strin...
python
def _makeDynamicSubsctitutions(string, contextData): """For dynamic rules, replace %d patterns with actual strings Python function, which is used by C extension. """ def _replaceFunc(escapeMatchObject): stringIndex = escapeMatchObject.group(0)[1] index = int(strin...
[ "def", "_makeDynamicSubsctitutions", "(", "string", ",", "contextData", ")", ":", "def", "_replaceFunc", "(", "escapeMatchObject", ")", ":", "stringIndex", "=", "escapeMatchObject", ".", "group", "(", "0", ")", "[", "1", "]", "index", "=", "int", "(", "strin...
For dynamic rules, replace %d patterns with actual strings Python function, which is used by C extension.
[ "For", "dynamic", "rules", "replace", "%d", "patterns", "with", "actual", "strings", "Python", "function", "which", "is", "used", "by", "C", "extension", "." ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntax/parser.py#L304-L316
andreikop/qutepart
qutepart/syntax/parser.py
RegExpr._tryMatch
def _tryMatch(self, textToMatchObject): """Tries to parse text. If matched - saves data for dynamic context """ # Special case. if pattern starts with \b, we have to check it manually, # because string is passed to .match(..) without beginning if self.wordStart and \ (...
python
def _tryMatch(self, textToMatchObject): """Tries to parse text. If matched - saves data for dynamic context """ # Special case. if pattern starts with \b, we have to check it manually, # because string is passed to .match(..) without beginning if self.wordStart and \ (...
[ "def", "_tryMatch", "(", "self", ",", "textToMatchObject", ")", ":", "# Special case. if pattern starts with \\b, we have to check it manually,", "# because string is passed to .match(..) without beginning", "if", "self", ".", "wordStart", "and", "(", "not", "textToMatchObject", ...
Tries to parse text. If matched - saves data for dynamic context
[ "Tries", "to", "parse", "text", ".", "If", "matched", "-", "saves", "data", "for", "dynamic", "context" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntax/parser.py#L400-L428
andreikop/qutepart
qutepart/syntax/parser.py
RegExpr._compileRegExp
def _compileRegExp(string, insensitive, minimal): """Compile regular expression. Python function, used by C code NOTE minimal flag is not supported here, but supported on PCRE """ flags = 0 if insensitive: flags = re.IGNORECASE string = string.replac...
python
def _compileRegExp(string, insensitive, minimal): """Compile regular expression. Python function, used by C code NOTE minimal flag is not supported here, but supported on PCRE """ flags = 0 if insensitive: flags = re.IGNORECASE string = string.replac...
[ "def", "_compileRegExp", "(", "string", ",", "insensitive", ",", "minimal", ")", ":", "flags", "=", "0", "if", "insensitive", ":", "flags", "=", "re", ".", "IGNORECASE", "string", "=", "string", ".", "replace", "(", "'[_[:alnum:]]'", ",", "'[\\\\w\\\\d]'", ...
Compile regular expression. Python function, used by C code NOTE minimal flag is not supported here, but supported on PCRE
[ "Compile", "regular", "expression", ".", "Python", "function", "used", "by", "C", "code" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntax/parser.py#L447-L465
andreikop/qutepart
qutepart/syntax/parser.py
RegExpr._matchPattern
def _matchPattern(regExp, string): """Try to match pattern. Returns tuple (whole match, groups) or (None, None) Python function, used by C code """ match = regExp.match(string) if match is not None and match.group(0): return match.group(0), (match.group(0), ) ...
python
def _matchPattern(regExp, string): """Try to match pattern. Returns tuple (whole match, groups) or (None, None) Python function, used by C code """ match = regExp.match(string) if match is not None and match.group(0): return match.group(0), (match.group(0), ) ...
[ "def", "_matchPattern", "(", "regExp", ",", "string", ")", ":", "match", "=", "regExp", ".", "match", "(", "string", ")", "if", "match", "is", "not", "None", "and", "match", ".", "group", "(", "0", ")", ":", "return", "match", ".", "group", "(", "0...
Try to match pattern. Returns tuple (whole match, groups) or (None, None) Python function, used by C code
[ "Try", "to", "match", "pattern", ".", "Returns", "tuple", "(", "whole", "match", "groups", ")", "or", "(", "None", "None", ")", "Python", "function", "used", "by", "C", "code" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntax/parser.py#L468-L477
andreikop/qutepart
qutepart/syntax/parser.py
AbstractNumberRule._tryMatch
def _tryMatch(self, textToMatchObject): """Try to find themselves in the text. Returns (count, matchedRule) or (None, None) if doesn't match """ # andreikop: This check is not described in kate docs, and I haven't found it in the code if not textToMatchObject.isWordStart: ...
python
def _tryMatch(self, textToMatchObject): """Try to find themselves in the text. Returns (count, matchedRule) or (None, None) if doesn't match """ # andreikop: This check is not described in kate docs, and I haven't found it in the code if not textToMatchObject.isWordStart: ...
[ "def", "_tryMatch", "(", "self", ",", "textToMatchObject", ")", ":", "# andreikop: This check is not described in kate docs, and I haven't found it in the code", "if", "not", "textToMatchObject", ".", "isWordStart", ":", "return", "None", "index", "=", "self", ".", "_tryMat...
Try to find themselves in the text. Returns (count, matchedRule) or (None, None) if doesn't match
[ "Try", "to", "find", "themselves", "in", "the", "text", ".", "Returns", "(", "count", "matchedRule", ")", "or", "(", "None", "None", ")", "if", "doesn", "t", "match" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntax/parser.py#L491-L516
andreikop/qutepart
qutepart/syntax/parser.py
AbstractNumberRule._countDigits
def _countDigits(self, text): """Count digits at start of text """ index = 0 while index < len(text): if not text[index].isdigit(): break index += 1 return index
python
def _countDigits(self, text): """Count digits at start of text """ index = 0 while index < len(text): if not text[index].isdigit(): break index += 1 return index
[ "def", "_countDigits", "(", "self", ",", "text", ")", ":", "index", "=", "0", "while", "index", "<", "len", "(", "text", ")", ":", "if", "not", "text", "[", "index", "]", ".", "isdigit", "(", ")", ":", "break", "index", "+=", "1", "return", "inde...
Count digits at start of text
[ "Count", "digits", "at", "start", "of", "text" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntax/parser.py#L518-L526
andreikop/qutepart
qutepart/syntax/parser.py
IncludeRules._tryMatch
def _tryMatch(self, textToMatchObject): """Try to find themselves in the text. Returns (count, matchedRule) or (None, None) if doesn't match """ for rule in self.context.rules: ruleTryMatchResult = rule.tryMatch(textToMatchObject) if ruleTryMatchResult is not None...
python
def _tryMatch(self, textToMatchObject): """Try to find themselves in the text. Returns (count, matchedRule) or (None, None) if doesn't match """ for rule in self.context.rules: ruleTryMatchResult = rule.tryMatch(textToMatchObject) if ruleTryMatchResult is not None...
[ "def", "_tryMatch", "(", "self", ",", "textToMatchObject", ")", ":", "for", "rule", "in", "self", ".", "context", ".", "rules", ":", "ruleTryMatchResult", "=", "rule", ".", "tryMatch", "(", "textToMatchObject", ")", "if", "ruleTryMatchResult", "is", "not", "...
Try to find themselves in the text. Returns (count, matchedRule) or (None, None) if doesn't match
[ "Try", "to", "find", "themselves", "in", "the", "text", ".", "Returns", "(", "count", "matchedRule", ")", "or", "(", "None", "None", ")", "if", "doesn", "t", "match" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntax/parser.py#L742-L756
andreikop/qutepart
qutepart/syntax/parser.py
Context.parseBlock
def parseBlock(self, contextStack, currentColumnIndex, text): """Parse block Exits, when reached end of the text, or when context is switched Returns (length, newContextStack, highlightedSegments, lineContinue) """ startColumnIndex = currentColumnIndex countOfNotMatchedSy...
python
def parseBlock(self, contextStack, currentColumnIndex, text): """Parse block Exits, when reached end of the text, or when context is switched Returns (length, newContextStack, highlightedSegments, lineContinue) """ startColumnIndex = currentColumnIndex countOfNotMatchedSy...
[ "def", "parseBlock", "(", "self", ",", "contextStack", ",", "currentColumnIndex", ",", "text", ")", ":", "startColumnIndex", "=", "currentColumnIndex", "countOfNotMatchedSymbols", "=", "0", "highlightedSegments", "=", "[", "]", "textTypeMap", "=", "[", "]", "ruleT...
Parse block Exits, when reached end of the text, or when context is switched Returns (length, newContextStack, highlightedSegments, lineContinue)
[ "Parse", "block", "Exits", "when", "reached", "end", "of", "the", "text", "or", "when", "context", "is", "switched", "Returns", "(", "length", "newContextStack", "highlightedSegments", "lineContinue", ")" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntax/parser.py#L831-L897
andreikop/qutepart
qutepart/syntax/parser.py
Parser.highlightBlock
def highlightBlock(self, text, prevContextStack): """Parse block and return ParseBlockFullResult return (lineData, highlightedSegments) where lineData is (contextStack, textTypeMap) where textTypeMap is a string of textType characters """ if prevContextStack is not...
python
def highlightBlock(self, text, prevContextStack): """Parse block and return ParseBlockFullResult return (lineData, highlightedSegments) where lineData is (contextStack, textTypeMap) where textTypeMap is a string of textType characters """ if prevContextStack is not...
[ "def", "highlightBlock", "(", "self", ",", "text", ",", "prevContextStack", ")", ":", "if", "prevContextStack", "is", "not", "None", ":", "contextStack", "=", "prevContextStack", "else", ":", "contextStack", "=", "self", ".", "_defaultContextStack", "highlightedSe...
Parse block and return ParseBlockFullResult return (lineData, highlightedSegments) where lineData is (contextStack, textTypeMap) where textTypeMap is a string of textType characters
[ "Parse", "block", "and", "return", "ParseBlockFullResult" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/syntax/parser.py#L948-L991
andreikop/qutepart
qutepart/indenter/cstyle.py
IndentAlgCStyle.findTextBackward
def findTextBackward(self, block, column, needle): """Search for a needle and return (block, column) Raise ValueError, if not found """ if column is not None: index = block.text()[:column].rfind(needle) else: index = block.text().rfind(needle) if ...
python
def findTextBackward(self, block, column, needle): """Search for a needle and return (block, column) Raise ValueError, if not found """ if column is not None: index = block.text()[:column].rfind(needle) else: index = block.text().rfind(needle) if ...
[ "def", "findTextBackward", "(", "self", ",", "block", ",", "column", ",", "needle", ")", ":", "if", "column", "is", "not", "None", ":", "index", "=", "block", ".", "text", "(", ")", "[", ":", "column", "]", ".", "rfind", "(", "needle", ")", "else",...
Search for a needle and return (block, column) Raise ValueError, if not found
[ "Search", "for", "a", "needle", "and", "return", "(", "block", "column", ")", "Raise", "ValueError", "if", "not", "found" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/cstyle.py#L47-L64
andreikop/qutepart
qutepart/indenter/cstyle.py
IndentAlgCStyle.findLeftBrace
def findLeftBrace(self, block, column): """Search for a corresponding '{' and return its indentation If not found return None """ block, column = self.findBracketBackward(block, column, '{') # raise ValueError if not found try: block, column = self.tryParenthesisBef...
python
def findLeftBrace(self, block, column): """Search for a corresponding '{' and return its indentation If not found return None """ block, column = self.findBracketBackward(block, column, '{') # raise ValueError if not found try: block, column = self.tryParenthesisBef...
[ "def", "findLeftBrace", "(", "self", ",", "block", ",", "column", ")", ":", "block", ",", "column", "=", "self", ".", "findBracketBackward", "(", "block", ",", "column", ",", "'{'", ")", "# raise ValueError if not found", "try", ":", "block", ",", "column", ...
Search for a corresponding '{' and return its indentation If not found return None
[ "Search", "for", "a", "corresponding", "{", "and", "return", "its", "indentation", "If", "not", "found", "return", "None" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/cstyle.py#L66-L76
andreikop/qutepart
qutepart/indenter/cstyle.py
IndentAlgCStyle.tryParenthesisBeforeBrace
def tryParenthesisBeforeBrace(self, block, column): """ Character at (block, column) has to be a '{'. Now try to find the right line for indentation for constructs like: if (a == b and c == d) { <- check for ')', and find '(', then return its indentation Returns input par...
python
def tryParenthesisBeforeBrace(self, block, column): """ Character at (block, column) has to be a '{'. Now try to find the right line for indentation for constructs like: if (a == b and c == d) { <- check for ')', and find '(', then return its indentation Returns input par...
[ "def", "tryParenthesisBeforeBrace", "(", "self", ",", "block", ",", "column", ")", ":", "text", "=", "block", ".", "text", "(", ")", "[", ":", "column", "-", "1", "]", ".", "rstrip", "(", ")", "if", "not", "text", ".", "endswith", "(", "')'", ")", ...
Character at (block, column) has to be a '{'. Now try to find the right line for indentation for constructs like: if (a == b and c == d) { <- check for ')', and find '(', then return its indentation Returns input params, if no success, otherwise block and column of '('
[ "Character", "at", "(", "block", "column", ")", "has", "to", "be", "a", "{", ".", "Now", "try", "to", "find", "the", "right", "line", "for", "indentation", "for", "constructs", "like", ":", "if", "(", "a", "==", "b", "and", "c", "==", "d", ")", "...
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/cstyle.py#L78-L88
andreikop/qutepart
qutepart/indenter/cstyle.py
IndentAlgCStyle.trySwitchStatement
def trySwitchStatement(self, block): """Check for default and case keywords and assume we are in a switch statement. Try to find a previous default, case or switch and return its indentation or None if not found. """ if not re.match(r'^\s*(default\s*|case\b.*):', block.text()): ...
python
def trySwitchStatement(self, block): """Check for default and case keywords and assume we are in a switch statement. Try to find a previous default, case or switch and return its indentation or None if not found. """ if not re.match(r'^\s*(default\s*|case\b.*):', block.text()): ...
[ "def", "trySwitchStatement", "(", "self", ",", "block", ")", ":", "if", "not", "re", ".", "match", "(", "r'^\\s*(default\\s*|case\\b.*):'", ",", "block", ".", "text", "(", ")", ")", ":", "return", "None", "for", "block", "in", "self", ".", "iterateBlocksBa...
Check for default and case keywords and assume we are in a switch statement. Try to find a previous default, case or switch and return its indentation or None if not found.
[ "Check", "for", "default", "and", "case", "keywords", "and", "assume", "we", "are", "in", "a", "switch", "statement", ".", "Try", "to", "find", "a", "previous", "default", "case", "or", "switch", "and", "return", "its", "indentation", "or", "None", "if", ...
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/cstyle.py#L90-L109
andreikop/qutepart
qutepart/indenter/cstyle.py
IndentAlgCStyle.tryAccessModifiers
def tryAccessModifiers(self, block): """Check for private, protected, public, signals etc... and assume we are in a class definition. Try to find a previous private/protected/private... or class and return its indentation or null if not found. """ if CFG_ACCESS_MODIFIERS < 0: ...
python
def tryAccessModifiers(self, block): """Check for private, protected, public, signals etc... and assume we are in a class definition. Try to find a previous private/protected/private... or class and return its indentation or null if not found. """ if CFG_ACCESS_MODIFIERS < 0: ...
[ "def", "tryAccessModifiers", "(", "self", ",", "block", ")", ":", "if", "CFG_ACCESS_MODIFIERS", "<", "0", ":", "return", "None", "if", "not", "re", ".", "match", "(", "r'^\\s*((public|protected|private)\\s*(slots|Q_SLOTS)?|(signals|Q_SIGNALS)\\s*):\\s*$'", ",", "block",...
Check for private, protected, public, signals etc... and assume we are in a class definition. Try to find a previous private/protected/private... or class and return its indentation or null if not found.
[ "Check", "for", "private", "protected", "public", "signals", "etc", "...", "and", "assume", "we", "are", "in", "a", "class", "definition", ".", "Try", "to", "find", "a", "previous", "private", "/", "protected", "/", "private", "...", "or", "class", "and", ...
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/cstyle.py#L111-L133
andreikop/qutepart
qutepart/indenter/cstyle.py
IndentAlgCStyle.tryCComment
def tryCComment(self, block): """C comment checking. If the previous line begins with a "/*" or a "* ", then return its leading white spaces + ' *' + the white spaces after the * return: filler string or null, if not in a C comment """ indentation = None prevNonEmptyBloc...
python
def tryCComment(self, block): """C comment checking. If the previous line begins with a "/*" or a "* ", then return its leading white spaces + ' *' + the white spaces after the * return: filler string or null, if not in a C comment """ indentation = None prevNonEmptyBloc...
[ "def", "tryCComment", "(", "self", ",", "block", ")", ":", "indentation", "=", "None", "prevNonEmptyBlock", "=", "self", ".", "_prevNonEmptyBlock", "(", "block", ")", "if", "not", "prevNonEmptyBlock", ".", "isValid", "(", ")", ":", "return", "None", "prevNon...
C comment checking. If the previous line begins with a "/*" or a "* ", then return its leading white spaces + ' *' + the white spaces after the * return: filler string or null, if not in a C comment
[ "C", "comment", "checking", ".", "If", "the", "previous", "line", "begins", "with", "a", "/", "*", "or", "a", "*", "then", "return", "its", "leading", "white", "spaces", "+", "*", "+", "the", "white", "spaces", "after", "the", "*", "return", ":", "fi...
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/cstyle.py#L135-L194
andreikop/qutepart
qutepart/indenter/cstyle.py
IndentAlgCStyle.tryCppComment
def tryCppComment(self, block): """C++ comment checking. when we want to insert slashes: #, #/, #! #/<, #!< and ##... return: filler string or null, if not in a star comment NOTE: otherwise comments get skipped generally and we use the last code-line """ if not block.prev...
python
def tryCppComment(self, block): """C++ comment checking. when we want to insert slashes: #, #/, #! #/<, #!< and ##... return: filler string or null, if not in a star comment NOTE: otherwise comments get skipped generally and we use the last code-line """ if not block.prev...
[ "def", "tryCppComment", "(", "self", ",", "block", ")", ":", "if", "not", "block", ".", "previous", "(", ")", ".", "isValid", "(", ")", "or", "not", "CFG_AUTO_INSERT_SLACHES", ":", "return", "None", "prevLineText", "=", "block", ".", "previous", "(", ")"...
C++ comment checking. when we want to insert slashes: #, #/, #! #/<, #!< and ##... return: filler string or null, if not in a star comment NOTE: otherwise comments get skipped generally and we use the last code-line
[ "C", "++", "comment", "checking", ".", "when", "we", "want", "to", "insert", "slashes", ":", "#", "#", "/", "#!", "#", "/", "<", "#!<", "and", "##", "...", "return", ":", "filler", "string", "or", "null", "if", "not", "in", "a", "star", "comment", ...
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/cstyle.py#L196-L238
andreikop/qutepart
qutepart/indenter/cstyle.py
IndentAlgCStyle.tryCKeywords
def tryCKeywords(self, block, isBrace): """ Check for if, else, while, do, switch, private, public, protected, signals, default, case etc... keywords, as we want to indent then. If is non-null/True, then indentation is not increased. Note: The code is written to be called *afte...
python
def tryCKeywords(self, block, isBrace): """ Check for if, else, while, do, switch, private, public, protected, signals, default, case etc... keywords, as we want to indent then. If is non-null/True, then indentation is not increased. Note: The code is written to be called *afte...
[ "def", "tryCKeywords", "(", "self", ",", "block", ",", "isBrace", ")", ":", "currentBlock", "=", "self", ".", "_prevNonEmptyBlock", "(", "block", ")", "if", "not", "currentBlock", ".", "isValid", "(", ")", ":", "return", "None", "# if line ends with ')', find ...
Check for if, else, while, do, switch, private, public, protected, signals, default, case etc... keywords, as we want to indent then. If is non-null/True, then indentation is not increased. Note: The code is written to be called *after* tryCComment and tryCppComment!
[ "Check", "for", "if", "else", "while", "do", "switch", "private", "public", "protected", "signals", "default", "case", "etc", "...", "keywords", "as", "we", "want", "to", "indent", "then", ".", "If", "is", "non", "-", "null", "/", "True", "then", "indent...
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/cstyle.py#L269-L327
andreikop/qutepart
qutepart/indenter/cstyle.py
IndentAlgCStyle.tryCondition
def tryCondition(self, block): """ Search for if, do, while, for, ... as we want to indent then. Return null, if nothing useful found. Note: The code is written to be called *after* tryCComment and tryCppComment! """ currentBlock = self._prevNonEmptyBlock(block) if not cu...
python
def tryCondition(self, block): """ Search for if, do, while, for, ... as we want to indent then. Return null, if nothing useful found. Note: The code is written to be called *after* tryCComment and tryCppComment! """ currentBlock = self._prevNonEmptyBlock(block) if not cu...
[ "def", "tryCondition", "(", "self", ",", "block", ")", ":", "currentBlock", "=", "self", ".", "_prevNonEmptyBlock", "(", "block", ")", "if", "not", "currentBlock", ".", "isValid", "(", ")", ":", "return", "None", "# found non-empty line", "currentText", "=", ...
Search for if, do, while, for, ... as we want to indent then. Return null, if nothing useful found. Note: The code is written to be called *after* tryCComment and tryCppComment!
[ "Search", "for", "if", "do", "while", "for", "...", "as", "we", "want", "to", "indent", "then", ".", "Return", "null", "if", "nothing", "useful", "found", ".", "Note", ":", "The", "code", "is", "written", "to", "be", "called", "*", "after", "*", "try...
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/cstyle.py#L329-L361
andreikop/qutepart
qutepart/indenter/cstyle.py
IndentAlgCStyle.tryStatement
def tryStatement(self, block): """ If the non-empty line ends with ); or ',', then search for '(' and return its indentation; also try to ignore trailing comments. """ currentBlock = self._prevNonEmptyBlock(block) if not currentBlock.isValid(): return None i...
python
def tryStatement(self, block): """ If the non-empty line ends with ); or ',', then search for '(' and return its indentation; also try to ignore trailing comments. """ currentBlock = self._prevNonEmptyBlock(block) if not currentBlock.isValid(): return None i...
[ "def", "tryStatement", "(", "self", ",", "block", ")", ":", "currentBlock", "=", "self", ".", "_prevNonEmptyBlock", "(", "block", ")", "if", "not", "currentBlock", ".", "isValid", "(", ")", ":", "return", "None", "indentation", "=", "None", "currentBlockText...
If the non-empty line ends with ); or ',', then search for '(' and return its indentation; also try to ignore trailing comments.
[ "If", "the", "non", "-", "empty", "line", "ends", "with", ")", ";", "or", "then", "search", "for", "(", "and", "return", "its", "indentation", ";", "also", "try", "to", "ignore", "trailing", "comments", "." ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/cstyle.py#L363-L469
andreikop/qutepart
qutepart/indenter/cstyle.py
IndentAlgCStyle.tryMatchedAnchor
def tryMatchedAnchor(self, block, autoIndent): """ find out whether we pressed return in something like {} or () or [] and indent properly: {} becomes: { | } """ oposite = { ')': '(', '}': '{', ']': '[...
python
def tryMatchedAnchor(self, block, autoIndent): """ find out whether we pressed return in something like {} or () or [] and indent properly: {} becomes: { | } """ oposite = { ')': '(', '}': '{', ']': '[...
[ "def", "tryMatchedAnchor", "(", "self", ",", "block", ",", "autoIndent", ")", ":", "oposite", "=", "{", "')'", ":", "'('", ",", "'}'", ":", "'{'", ",", "']'", ":", "'['", "}", "char", "=", "self", ".", "_firstNonSpaceChar", "(", "block", ")", "if", ...
find out whether we pressed return in something like {} or () or [] and indent properly: {} becomes: { | }
[ "find", "out", "whether", "we", "pressed", "return", "in", "something", "like", "{}", "or", "()", "or", "[]", "and", "indent", "properly", ":", "{}", "becomes", ":", "{", "|", "}" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/cstyle.py#L471-L538
andreikop/qutepart
qutepart/indenter/cstyle.py
IndentAlgCStyle.indentLine
def indentLine(self, block, autoIndent): """ Indent line. Return filler or null. """ indent = None if indent is None: indent = self.tryMatchedAnchor(block, autoIndent) if indent is None: indent = self.tryCComment(block) if indent is None an...
python
def indentLine(self, block, autoIndent): """ Indent line. Return filler or null. """ indent = None if indent is None: indent = self.tryMatchedAnchor(block, autoIndent) if indent is None: indent = self.tryCComment(block) if indent is None an...
[ "def", "indentLine", "(", "self", ",", "block", ",", "autoIndent", ")", ":", "indent", "=", "None", "if", "indent", "is", "None", ":", "indent", "=", "self", ".", "tryMatchedAnchor", "(", "block", ",", "autoIndent", ")", "if", "indent", "is", "None", "...
Indent line. Return filler or null.
[ "Indent", "line", ".", "Return", "filler", "or", "null", "." ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/cstyle.py#L540-L568
andreikop/qutepart
qutepart/indenter/scheme.py
IndentAlgScheme._findExpressionEnd
def _findExpressionEnd(self, block): """Find end of the last expression """ while block.isValid(): column = self._lastColumn(block) if column > 0: return block, column block = block.previous() raise UserWarning()
python
def _findExpressionEnd(self, block): """Find end of the last expression """ while block.isValid(): column = self._lastColumn(block) if column > 0: return block, column block = block.previous() raise UserWarning()
[ "def", "_findExpressionEnd", "(", "self", ",", "block", ")", ":", "while", "block", ".", "isValid", "(", ")", ":", "column", "=", "self", ".", "_lastColumn", "(", "block", ")", "if", "column", ">", "0", ":", "return", "block", ",", "column", "block", ...
Find end of the last expression
[ "Find", "end", "of", "the", "last", "expression" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/scheme.py#L15-L23
andreikop/qutepart
qutepart/indenter/scheme.py
IndentAlgScheme._lastWord
def _lastWord(self, text): """Move backward to the start of the word at the end of a string. Return the word """ for index, char in enumerate(text[::-1]): if char.isspace() or \ char in ('(', ')'): return text[len(text) - index :] else: ...
python
def _lastWord(self, text): """Move backward to the start of the word at the end of a string. Return the word """ for index, char in enumerate(text[::-1]): if char.isspace() or \ char in ('(', ')'): return text[len(text) - index :] else: ...
[ "def", "_lastWord", "(", "self", ",", "text", ")", ":", "for", "index", ",", "char", "in", "enumerate", "(", "text", "[", ":", ":", "-", "1", "]", ")", ":", "if", "char", ".", "isspace", "(", ")", "or", "char", "in", "(", "'('", ",", "')'", "...
Move backward to the start of the word at the end of a string. Return the word
[ "Move", "backward", "to", "the", "start", "of", "the", "word", "at", "the", "end", "of", "a", "string", ".", "Return", "the", "word" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/scheme.py#L25-L34
andreikop/qutepart
qutepart/indenter/scheme.py
IndentAlgScheme._findExpressionStart
def _findExpressionStart(self, block): """Find start of not finished expression Raise UserWarning, if not found """ # raise expession on next level, if not found expEndBlock, expEndColumn = self._findExpressionEnd(block) text = expEndBlock.text()[:expEndColumn + 1] ...
python
def _findExpressionStart(self, block): """Find start of not finished expression Raise UserWarning, if not found """ # raise expession on next level, if not found expEndBlock, expEndColumn = self._findExpressionEnd(block) text = expEndBlock.text()[:expEndColumn + 1] ...
[ "def", "_findExpressionStart", "(", "self", ",", "block", ")", ":", "# raise expession on next level, if not found", "expEndBlock", ",", "expEndColumn", "=", "self", ".", "_findExpressionEnd", "(", "block", ")", "text", "=", "expEndBlock", ".", "text", "(", ")", "...
Find start of not finished expression Raise UserWarning, if not found
[ "Find", "start", "of", "not", "finished", "expression", "Raise", "UserWarning", "if", "not", "found" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/scheme.py#L36-L51
andreikop/qutepart
qutepart/indenter/scheme.py
IndentAlgScheme.computeSmartIndent
def computeSmartIndent(self, block, char): """Compute indent for the block """ try: foundBlock, foundColumn = self._findExpressionStart(block.previous()) except UserWarning: return '' expression = foundBlock.text()[foundColumn:].rstrip() beforeExpr...
python
def computeSmartIndent(self, block, char): """Compute indent for the block """ try: foundBlock, foundColumn = self._findExpressionStart(block.previous()) except UserWarning: return '' expression = foundBlock.text()[foundColumn:].rstrip() beforeExpr...
[ "def", "computeSmartIndent", "(", "self", ",", "block", ",", "char", ")", ":", "try", ":", "foundBlock", ",", "foundColumn", "=", "self", ".", "_findExpressionStart", "(", "block", ".", "previous", "(", ")", ")", "except", "UserWarning", ":", "return", "''...
Compute indent for the block
[ "Compute", "indent", "for", "the", "block" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/scheme.py#L53-L70
andreikop/qutepart
qutepart/indenter/__init__.py
_getSmartIndenter
def _getSmartIndenter(indenterName, qpart, indenter): """Get indenter by name. Available indenters are none, normal, cstyle, haskell, lilypond, lisp, python, ruby, xml Indenter name is not case sensitive Raise KeyError if not found indentText is indentation, which shall be used. i.e. '\t' for tabs, ...
python
def _getSmartIndenter(indenterName, qpart, indenter): """Get indenter by name. Available indenters are none, normal, cstyle, haskell, lilypond, lisp, python, ruby, xml Indenter name is not case sensitive Raise KeyError if not found indentText is indentation, which shall be used. i.e. '\t' for tabs, ...
[ "def", "_getSmartIndenter", "(", "indenterName", ",", "qpart", ",", "indenter", ")", ":", "indenterName", "=", "indenterName", ".", "lower", "(", ")", "if", "indenterName", "in", "(", "'haskell'", ",", "'lilypond'", ")", ":", "# not supported yet", "logger", "...
Get indenter by name. Available indenters are none, normal, cstyle, haskell, lilypond, lisp, python, ruby, xml Indenter name is not case sensitive Raise KeyError if not found indentText is indentation, which shall be used. i.e. '\t' for tabs, ' ' for 4 space symbols
[ "Get", "indenter", "by", "name", ".", "Available", "indenters", "are", "none", "normal", "cstyle", "haskell", "lilypond", "lisp", "python", "ruby", "xml", "Indenter", "name", "is", "not", "case", "sensitive", "Raise", "KeyError", "if", "not", "found", "indentT...
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/__init__.py#L13-L48
andreikop/qutepart
qutepart/indenter/__init__.py
Indenter.autoIndentBlock
def autoIndentBlock(self, block, char='\n'): """Indent block after Enter pressed or trigger character typed """ currentText = block.text() spaceAtStartLen = len(currentText) - len(currentText.lstrip()) currentIndent = currentText[:spaceAtStartLen] indent = self._smartInde...
python
def autoIndentBlock(self, block, char='\n'): """Indent block after Enter pressed or trigger character typed """ currentText = block.text() spaceAtStartLen = len(currentText) - len(currentText.lstrip()) currentIndent = currentText[:spaceAtStartLen] indent = self._smartInde...
[ "def", "autoIndentBlock", "(", "self", ",", "block", ",", "char", "=", "'\\n'", ")", ":", "currentText", "=", "block", ".", "text", "(", ")", "spaceAtStartLen", "=", "len", "(", "currentText", ")", "-", "len", "(", "currentText", ".", "lstrip", "(", ")...
Indent block after Enter pressed or trigger character typed
[ "Indent", "block", "after", "Enter", "pressed", "or", "trigger", "character", "typed" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/__init__.py#L85-L93
andreikop/qutepart
qutepart/indenter/__init__.py
Indenter.onChangeSelectedBlocksIndent
def onChangeSelectedBlocksIndent(self, increase, withSpace=False): """Tab or Space pressed and few blocks are selected, or Shift+Tab pressed Insert or remove text from the beginning of blocks """ def blockIndentation(block): text = block.text() return text[:len(te...
python
def onChangeSelectedBlocksIndent(self, increase, withSpace=False): """Tab or Space pressed and few blocks are selected, or Shift+Tab pressed Insert or remove text from the beginning of blocks """ def blockIndentation(block): text = block.text() return text[:len(te...
[ "def", "onChangeSelectedBlocksIndent", "(", "self", ",", "increase", ",", "withSpace", "=", "False", ")", ":", "def", "blockIndentation", "(", "block", ")", ":", "text", "=", "block", ".", "text", "(", ")", "return", "text", "[", ":", "len", "(", "text",...
Tab or Space pressed and few blocks are selected, or Shift+Tab pressed Insert or remove text from the beginning of blocks
[ "Tab", "or", "Space", "pressed", "and", "few", "blocks", "are", "selected", "or", "Shift", "+", "Tab", "pressed", "Insert", "or", "remove", "text", "from", "the", "beginning", "of", "blocks" ]
train
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/__init__.py#L95-L161