repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 3
values | summary stringlengths 4 350 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_widget.py | UndoInsertAt.reverseCommit | def reverseCommit(self):
"""
Reinsert the killed word.
"""
# Ensure that the cursor position is valid.
if not self.qteWidget.isSelectionPositionValid(self.selectionPos):
msg = ('Cannot undo "insert" operation because the selection'
'position is inva... | python | def reverseCommit(self):
"""
Reinsert the killed word.
"""
# Ensure that the cursor position is valid.
if not self.qteWidget.isSelectionPositionValid(self.selectionPos):
msg = ('Cannot undo "insert" operation because the selection'
'position is inva... | [
"def",
"reverseCommit",
"(",
"self",
")",
":",
"# Ensure that the cursor position is valid.",
"if",
"not",
"self",
".",
"qteWidget",
".",
"isSelectionPositionValid",
"(",
"self",
".",
"selectionPos",
")",
":",
"msg",
"=",
"(",
"'Cannot undo \"insert\" operation because ... | Reinsert the killed word. | [
"Reinsert",
"the",
"killed",
"word",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L270-L286 | train | Reinsert the killed word. |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_widget.py | UndoSetText.reverseCommit | def reverseCommit(self):
"""
Replace the current widget content with the original text.
Note that the original text has styling information available,
whereas the new text does not.
"""
self.baseClass.setText(self.oldText)
self.qteWidget.SCISetStylingEx(0, 0, self... | python | def reverseCommit(self):
"""
Replace the current widget content with the original text.
Note that the original text has styling information available,
whereas the new text does not.
"""
self.baseClass.setText(self.oldText)
self.qteWidget.SCISetStylingEx(0, 0, self... | [
"def",
"reverseCommit",
"(",
"self",
")",
":",
"self",
".",
"baseClass",
".",
"setText",
"(",
"self",
".",
"oldText",
")",
"self",
".",
"qteWidget",
".",
"SCISetStylingEx",
"(",
"0",
",",
"0",
",",
"self",
".",
"style",
")"
] | Replace the current widget content with the original text.
Note that the original text has styling information available,
whereas the new text does not. | [
"Replace",
"the",
"current",
"widget",
"content",
"with",
"the",
"original",
"text",
".",
"Note",
"that",
"the",
"original",
"text",
"has",
"styling",
"information",
"available",
"whereas",
"the",
"new",
"text",
"does",
"not",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L390-L397 | train | Revert the current text to the original text. |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_widget.py | UndoGenericQtmacsScintilla.placeCursor | def placeCursor(self, line, col):
"""
Try to place the cursor in ``line`` at ``col`` if possible,
otherwise place it at the end.
"""
num_lines, num_col = self.qteWidget.getNumLinesAndColumns()
# Place the cursor at the specified position if possible.
if line >= n... | python | def placeCursor(self, line, col):
"""
Try to place the cursor in ``line`` at ``col`` if possible,
otherwise place it at the end.
"""
num_lines, num_col = self.qteWidget.getNumLinesAndColumns()
# Place the cursor at the specified position if possible.
if line >= n... | [
"def",
"placeCursor",
"(",
"self",
",",
"line",
",",
"col",
")",
":",
"num_lines",
",",
"num_col",
"=",
"self",
".",
"qteWidget",
".",
"getNumLinesAndColumns",
"(",
")",
"# Place the cursor at the specified position if possible.",
"if",
"line",
">=",
"num_lines",
... | Try to place the cursor in ``line`` at ``col`` if possible,
otherwise place it at the end. | [
"Try",
"to",
"place",
"the",
"cursor",
"in",
"line",
"at",
"col",
"if",
"possible",
"otherwise",
"place",
"it",
"at",
"the",
"end",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L441-L456 | train | Try to place the cursor in line at col. If possible place it at the end. |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_widget.py | UndoGenericQtmacsScintilla.commit | def commit(self):
"""
Put the document into the new state.
"""
if self.textAfter is None:
# If this is the first 'commit' call then do not make
# any changes but store the current document state
# and its style.
line, col = self.qteWidget.g... | python | def commit(self):
"""
Put the document into the new state.
"""
if self.textAfter is None:
# If this is the first 'commit' call then do not make
# any changes but store the current document state
# and its style.
line, col = self.qteWidget.g... | [
"def",
"commit",
"(",
"self",
")",
":",
"if",
"self",
".",
"textAfter",
"is",
"None",
":",
"# If this is the first 'commit' call then do not make",
"# any changes but store the current document state",
"# and its style.",
"line",
",",
"col",
"=",
"self",
".",
"qteWidget",... | Put the document into the new state. | [
"Put",
"the",
"document",
"into",
"the",
"new",
"state",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L458-L474 | train | Commit the current state of the current state of the current class. |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_widget.py | UndoGenericQtmacsScintilla.reverseCommit | def reverseCommit(self):
"""
Put the document into the 'before' state.
"""
# Put the document into the 'before' state.
self.baseClass.setText(self.textBefore)
self.qteWidget.SCISetStylingEx(0, 0, self.styleBefore) | python | def reverseCommit(self):
"""
Put the document into the 'before' state.
"""
# Put the document into the 'before' state.
self.baseClass.setText(self.textBefore)
self.qteWidget.SCISetStylingEx(0, 0, self.styleBefore) | [
"def",
"reverseCommit",
"(",
"self",
")",
":",
"# Put the document into the 'before' state.",
"self",
".",
"baseClass",
".",
"setText",
"(",
"self",
".",
"textBefore",
")",
"self",
".",
"qteWidget",
".",
"SCISetStylingEx",
"(",
"0",
",",
"0",
",",
"self",
".",... | Put the document into the 'before' state. | [
"Put",
"the",
"document",
"into",
"the",
"before",
"state",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L476-L482 | train | Reverse the changes made to the base class. |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_widget.py | QtmacsScintilla.qteSetMark | def qteSetMark(self, markerID=0, line: int=None, col: int=None):
"""
Define/overwrite the line- and column index of marker ``markerID``.
The default marker has ``markerID=0`` by convention.
If ``line`` and/or ``col`` are not provided they are substituted
with the values of the ... | python | def qteSetMark(self, markerID=0, line: int=None, col: int=None):
"""
Define/overwrite the line- and column index of marker ``markerID``.
The default marker has ``markerID=0`` by convention.
If ``line`` and/or ``col`` are not provided they are substituted
with the values of the ... | [
"def",
"qteSetMark",
"(",
"self",
",",
"markerID",
"=",
"0",
",",
"line",
":",
"int",
"=",
"None",
",",
"col",
":",
"int",
"=",
"None",
")",
":",
"# Query the line- and column number unless provided.",
"if",
"(",
"line",
"is",
"None",
")",
"and",
"(",
"c... | Define/overwrite the line- and column index of marker ``markerID``.
The default marker has ``markerID=0`` by convention.
If ``line`` and/or ``col`` are not provided they are substituted
with the values of the current cursor position.
..note: ``line`` and ``col`` are not range checked.... | [
"Define",
"/",
"overwrite",
"the",
"line",
"-",
"and",
"column",
"index",
"of",
"marker",
"markerID",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L509-L551 | train | Set the line and column index of a specific marker. |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_widget.py | QtmacsScintilla.fromMimeData | def fromMimeData(self, data):
"""
Paste the clipboard data at the current cursor position.
This method also adds another undo-object to the undo-stack.
..note: This method forcefully interrupts the ``QsciInternal``
pasting mechnism by returning an empty MIME data elemen... | python | def fromMimeData(self, data):
"""
Paste the clipboard data at the current cursor position.
This method also adds another undo-object to the undo-stack.
..note: This method forcefully interrupts the ``QsciInternal``
pasting mechnism by returning an empty MIME data elemen... | [
"def",
"fromMimeData",
"(",
"self",
",",
"data",
")",
":",
"# Only insert the element if it is available in plain text.",
"if",
"data",
".",
"hasText",
"(",
")",
":",
"self",
".",
"insert",
"(",
"data",
".",
"text",
"(",
")",
")",
"# Tell the underlying QsciScinti... | Paste the clipboard data at the current cursor position.
This method also adds another undo-object to the undo-stack.
..note: This method forcefully interrupts the ``QsciInternal``
pasting mechnism by returning an empty MIME data element.
This is not an elegant implemen... | [
"Paste",
"the",
"clipboard",
"data",
"at",
"the",
"current",
"cursor",
"position",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L582-L600 | train | Creates an empty element from the given MIME data. |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_widget.py | QtmacsScintilla.isPositionValid | def isPositionValid(self, line: int, column: int):
"""
Return **True** if ``line`` and ``column`` denote a valid
position.
|Args|
* ``line`` (**int**): line number
* ``column`` (**int**): column in line ``line``
|Returns|
**bool**: **True** if ``line``... | python | def isPositionValid(self, line: int, column: int):
"""
Return **True** if ``line`` and ``column`` denote a valid
position.
|Args|
* ``line`` (**int**): line number
* ``column`` (**int**): column in line ``line``
|Returns|
**bool**: **True** if ``line``... | [
"def",
"isPositionValid",
"(",
"self",
",",
"line",
":",
"int",
",",
"column",
":",
"int",
")",
":",
"if",
"(",
"line",
"<",
"0",
")",
"or",
"(",
"column",
"<",
"0",
")",
":",
"return",
"False",
"last_line",
",",
"last_col",
"=",
"self",
".",
"ge... | Return **True** if ``line`` and ``column`` denote a valid
position.
|Args|
* ``line`` (**int**): line number
* ``column`` (**int**): column in line ``line``
|Returns|
**bool**: **True** if ``line`` and ``column`` specify a
valid point in the document, **Fals... | [
"Return",
"**",
"True",
"**",
"if",
"line",
"and",
"column",
"denote",
"a",
"valid",
"position",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L622-L651 | train | Return True if the given line and column denote a valid entry in the document. |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_widget.py | QtmacsScintilla.isSelectionPositionValid | def isSelectionPositionValid(self, selPos: tuple):
"""
Return **True** if the start- and end position denote valid
positions within the document.
|Args|
* ``selPos`` (**tuple**): tuple with four integers.
|Returns|
**bool**: **True** if the positions are valid... | python | def isSelectionPositionValid(self, selPos: tuple):
"""
Return **True** if the start- and end position denote valid
positions within the document.
|Args|
* ``selPos`` (**tuple**): tuple with four integers.
|Returns|
**bool**: **True** if the positions are valid... | [
"def",
"isSelectionPositionValid",
"(",
"self",
",",
"selPos",
":",
"tuple",
")",
":",
"if",
"selPos",
"is",
"None",
":",
"return",
"False",
"if",
"len",
"(",
"selPos",
")",
"!=",
"4",
":",
"return",
"False",
"check1",
"=",
"self",
".",
"isPositionValid"... | Return **True** if the start- and end position denote valid
positions within the document.
|Args|
* ``selPos`` (**tuple**): tuple with four integers.
|Returns|
**bool**: **True** if the positions are valid; **False** otherwise.
|Raises|
* **None** | [
"Return",
"**",
"True",
"**",
"if",
"the",
"start",
"-",
"and",
"end",
"position",
"denote",
"valid",
"positions",
"within",
"the",
"document",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L654-L680 | train | Returns True if the start - and end position denote valid
positions within the document. |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_widget.py | QtmacsScintilla.keyPressEvent | def keyPressEvent(self, keyEvent: QtGui.QKeyEvent):
"""
Undo safe wrapper for the native ``keyPressEvent`` method.
|Args|
* ``keyEvent`` (**QKeyEvent**): the key event to process.
|Returns|
**None**
|Raises|
* **QtmacsArgumentError** if at least one ... | python | def keyPressEvent(self, keyEvent: QtGui.QKeyEvent):
"""
Undo safe wrapper for the native ``keyPressEvent`` method.
|Args|
* ``keyEvent`` (**QKeyEvent**): the key event to process.
|Returns|
**None**
|Raises|
* **QtmacsArgumentError** if at least one ... | [
"def",
"keyPressEvent",
"(",
"self",
",",
"keyEvent",
":",
"QtGui",
".",
"QKeyEvent",
")",
":",
"undoObj",
"=",
"UndoInsert",
"(",
"self",
",",
"keyEvent",
".",
"text",
"(",
")",
")",
"self",
".",
"qteUndoStack",
".",
"push",
"(",
"undoObj",
")"
] | Undo safe wrapper for the native ``keyPressEvent`` method.
|Args|
* ``keyEvent`` (**QKeyEvent**): the key event to process.
|Returns|
**None**
|Raises|
* **QtmacsArgumentError** if at least one argument has an invalid type. | [
"Undo",
"safe",
"wrapper",
"for",
"the",
"native",
"keyPressEvent",
"method",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L695-L712 | train | Undo safe wrapper for the native keyPressEvent method. |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_widget.py | QtmacsScintilla.replaceSelectedText | def replaceSelectedText(self, text: str):
"""
Undo safe wrapper for the native ``replaceSelectedText`` method.
|Args|
* ``text`` (**str**): text to replace the current selection.
|Returns|
**None**
|Raises|
* **QtmacsArgumentError** if at least one a... | python | def replaceSelectedText(self, text: str):
"""
Undo safe wrapper for the native ``replaceSelectedText`` method.
|Args|
* ``text`` (**str**): text to replace the current selection.
|Returns|
**None**
|Raises|
* **QtmacsArgumentError** if at least one a... | [
"def",
"replaceSelectedText",
"(",
"self",
",",
"text",
":",
"str",
")",
":",
"undoObj",
"=",
"UndoReplaceSelectedText",
"(",
"self",
",",
"text",
")",
"self",
".",
"qteUndoStack",
".",
"push",
"(",
"undoObj",
")"
] | Undo safe wrapper for the native ``replaceSelectedText`` method.
|Args|
* ``text`` (**str**): text to replace the current selection.
|Returns|
**None**
|Raises|
* **QtmacsArgumentError** if at least one argument has an invalid type. | [
"Undo",
"safe",
"wrapper",
"for",
"the",
"native",
"replaceSelectedText",
"method",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L735-L752 | train | Undo safe wrapper for the native replaceSelectedText method. |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_widget.py | QtmacsScintilla.insert | def insert(self, text: str):
"""
Undo safe wrapper for the native ``insert`` method.
|Args|
* ``text`` (**str**): text to insert at the current position.
|Returns|
**None**
|Raises|
* **QtmacsArgumentError** if at least one argument has an invalid ty... | python | def insert(self, text: str):
"""
Undo safe wrapper for the native ``insert`` method.
|Args|
* ``text`` (**str**): text to insert at the current position.
|Returns|
**None**
|Raises|
* **QtmacsArgumentError** if at least one argument has an invalid ty... | [
"def",
"insert",
"(",
"self",
",",
"text",
":",
"str",
")",
":",
"undoObj",
"=",
"UndoInsert",
"(",
"self",
",",
"text",
")",
"self",
".",
"qteUndoStack",
".",
"push",
"(",
"undoObj",
")"
] | Undo safe wrapper for the native ``insert`` method.
|Args|
* ``text`` (**str**): text to insert at the current position.
|Returns|
**None**
|Raises|
* **QtmacsArgumentError** if at least one argument has an invalid type. | [
"Undo",
"safe",
"wrapper",
"for",
"the",
"native",
"insert",
"method",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L755-L772 | train | Insert a new entry in the current entry set. |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_widget.py | QtmacsScintilla.insertAt | def insertAt(self, text: str, line: int, col: int):
"""
Undo safe wrapper for the native ``insertAt`` method.
|Args|
* ``text`` (**str**): text to insert at the specified position.
* ``line`` (**int**): line number.
* ``col`` (**int**): column number.
|Returns|... | python | def insertAt(self, text: str, line: int, col: int):
"""
Undo safe wrapper for the native ``insertAt`` method.
|Args|
* ``text`` (**str**): text to insert at the specified position.
* ``line`` (**int**): line number.
* ``col`` (**int**): column number.
|Returns|... | [
"def",
"insertAt",
"(",
"self",
",",
"text",
":",
"str",
",",
"line",
":",
"int",
",",
"col",
":",
"int",
")",
":",
"undoObj",
"=",
"UndoInsertAt",
"(",
"self",
",",
"text",
",",
"line",
",",
"col",
")",
"self",
".",
"qteUndoStack",
".",
"push",
... | Undo safe wrapper for the native ``insertAt`` method.
|Args|
* ``text`` (**str**): text to insert at the specified position.
* ``line`` (**int**): line number.
* ``col`` (**int**): column number.
|Returns|
**None**
|Raises|
* **QtmacsArgumentError** ... | [
"Undo",
"safe",
"wrapper",
"for",
"the",
"native",
"insertAt",
"method",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L775-L794 | train | Wrapper for the native insertAt method. |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_widget.py | QtmacsScintilla.append | def append(self, text: str):
"""
Undo safe wrapper for the native ``append`` method.
|Args|
* ``text`` (**str**): text to insert at the specified position.
|Returns|
**None**
|Raises|
* **QtmacsArgumentError** if at least one argument has an invalid ... | python | def append(self, text: str):
"""
Undo safe wrapper for the native ``append`` method.
|Args|
* ``text`` (**str**): text to insert at the specified position.
|Returns|
**None**
|Raises|
* **QtmacsArgumentError** if at least one argument has an invalid ... | [
"def",
"append",
"(",
"self",
",",
"text",
":",
"str",
")",
":",
"pos",
"=",
"self",
".",
"getCursorPosition",
"(",
")",
"line",
",",
"col",
"=",
"self",
".",
"getNumLinesAndColumns",
"(",
")",
"undoObj",
"=",
"UndoInsertAt",
"(",
"self",
",",
"text",
... | Undo safe wrapper for the native ``append`` method.
|Args|
* ``text`` (**str**): text to insert at the specified position.
|Returns|
**None**
|Raises|
* **QtmacsArgumentError** if at least one argument has an invalid type. | [
"Undo",
"safe",
"wrapper",
"for",
"the",
"native",
"append",
"method",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L797-L817 | train | Wrapper for the native append method. |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_widget.py | QtmacsScintilla.setText | def setText(self, text: str):
"""
Undo safe wrapper for the native ``setText`` method.
|Args|
* ``text`` (**str**): text to insert at the specified position.
|Returns|
**None**
|Raises|
* **QtmacsArgumentError** if at least one argument has an invali... | python | def setText(self, text: str):
"""
Undo safe wrapper for the native ``setText`` method.
|Args|
* ``text`` (**str**): text to insert at the specified position.
|Returns|
**None**
|Raises|
* **QtmacsArgumentError** if at least one argument has an invali... | [
"def",
"setText",
"(",
"self",
",",
"text",
":",
"str",
")",
":",
"undoObj",
"=",
"UndoSetText",
"(",
"self",
",",
"text",
")",
"self",
".",
"qteUndoStack",
".",
"push",
"(",
"undoObj",
")"
] | Undo safe wrapper for the native ``setText`` method.
|Args|
* ``text`` (**str**): text to insert at the specified position.
|Returns|
**None**
|Raises|
* **QtmacsArgumentError** if at least one argument has an invalid type. | [
"Undo",
"safe",
"wrapper",
"for",
"the",
"native",
"setText",
"method",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L820-L837 | train | Set the text at the specified position. |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_widget.py | QtmacsScintilla.SCIGetStyledText | def SCIGetStyledText(self, selectionPos: tuple):
"""
Pythonic wrapper for the SCI_GETSTYLEDTEXT command.
For example, to get the raw text and styling bits
for the first five characters in the widget use::
text, style = SCIGetStyledText((0, 0, 0, 5))
print(text.d... | python | def SCIGetStyledText(self, selectionPos: tuple):
"""
Pythonic wrapper for the SCI_GETSTYLEDTEXT command.
For example, to get the raw text and styling bits
for the first five characters in the widget use::
text, style = SCIGetStyledText((0, 0, 0, 5))
print(text.d... | [
"def",
"SCIGetStyledText",
"(",
"self",
",",
"selectionPos",
":",
"tuple",
")",
":",
"# Sanity check.",
"if",
"not",
"self",
".",
"isSelectionPositionValid",
"(",
"selectionPos",
")",
":",
"return",
"None",
"# Convert the start- and end point of the selection into",
"# ... | Pythonic wrapper for the SCI_GETSTYLEDTEXT command.
For example, to get the raw text and styling bits
for the first five characters in the widget use::
text, style = SCIGetStyledText((0, 0, 0, 5))
print(text.decode('utf-8'))
|Args|
* ``selectionPos`` (**tuple*... | [
"Pythonic",
"wrapper",
"for",
"the",
"SCI_GETSTYLEDTEXT",
"command",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L840-L895 | train | Return the styled text of the current line and column. |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_widget.py | QtmacsScintilla.SCISetStyling | def SCISetStyling(self, line: int, col: int,
numChar: int, style: bytearray):
"""
Pythonic wrapper for the SCI_SETSTYLING command.
For example, the following code applies style #3
to the first five characters in the second line
of the widget:
S... | python | def SCISetStyling(self, line: int, col: int,
numChar: int, style: bytearray):
"""
Pythonic wrapper for the SCI_SETSTYLING command.
For example, the following code applies style #3
to the first five characters in the second line
of the widget:
S... | [
"def",
"SCISetStyling",
"(",
"self",
",",
"line",
":",
"int",
",",
"col",
":",
"int",
",",
"numChar",
":",
"int",
",",
"style",
":",
"bytearray",
")",
":",
"if",
"not",
"self",
".",
"isPositionValid",
"(",
"line",
",",
"col",
")",
":",
"return",
"p... | Pythonic wrapper for the SCI_SETSTYLING command.
For example, the following code applies style #3
to the first five characters in the second line
of the widget:
SCISetStyling((0, 1), 5, 3)
|Args|
* ``line`` (**int**): line number where to start styling.
* ... | [
"Pythonic",
"wrapper",
"for",
"the",
"SCI_SETSTYLING",
"command",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L898-L929 | train | This function is a wrapper for the SCI_SETSTYLING command. |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_widget.py | QtmacsScintilla.SCISetStylingEx | def SCISetStylingEx(self, line: int, col: int, style: bytearray):
"""
Pythonic wrapper for the SCI_SETSTYLINGEX command.
For example, the following code will fetch the styling for the first
five characters applies it verbatim to the next five characters.
text, style = SCIGe... | python | def SCISetStylingEx(self, line: int, col: int, style: bytearray):
"""
Pythonic wrapper for the SCI_SETSTYLINGEX command.
For example, the following code will fetch the styling for the first
five characters applies it verbatim to the next five characters.
text, style = SCIGe... | [
"def",
"SCISetStylingEx",
"(",
"self",
",",
"line",
":",
"int",
",",
"col",
":",
"int",
",",
"style",
":",
"bytearray",
")",
":",
"if",
"not",
"self",
".",
"isPositionValid",
"(",
"line",
",",
"col",
")",
":",
"return",
"pos",
"=",
"self",
".",
"po... | Pythonic wrapper for the SCI_SETSTYLINGEX command.
For example, the following code will fetch the styling for the first
five characters applies it verbatim to the next five characters.
text, style = SCIGetStyledText((0, 0, 0, 5))
SCISetStylingEx((0, 5), style)
|Args|
... | [
"Pythonic",
"wrapper",
"for",
"the",
"SCI_SETSTYLINGEX",
"command",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L932-L961 | train | This function is a wrapper for the SCI_SETSTYLINGEX command. It is used to set the styling of the current locale. |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_widget.py | QtmacsScintilla.qteSetLexer | def qteSetLexer(self, lexer):
"""
Specify the lexer to use.
The only difference between this method and the native
``setLexer`` method is that expects ``lexer`` to be class, not
an instance. Another feature is that this method knows which
``lexer`` class was installed la... | python | def qteSetLexer(self, lexer):
"""
Specify the lexer to use.
The only difference between this method and the native
``setLexer`` method is that expects ``lexer`` to be class, not
an instance. Another feature is that this method knows which
``lexer`` class was installed la... | [
"def",
"qteSetLexer",
"(",
"self",
",",
"lexer",
")",
":",
"if",
"(",
"lexer",
"is",
"not",
"None",
")",
"and",
"(",
"not",
"issubclass",
"(",
"lexer",
",",
"Qsci",
".",
"QsciLexer",
")",
")",
":",
"QtmacsOtherError",
"(",
"'lexer must be a class object an... | Specify the lexer to use.
The only difference between this method and the native
``setLexer`` method is that expects ``lexer`` to be class, not
an instance. Another feature is that this method knows which
``lexer`` class was installed last, and this information can
be retrieved ... | [
"Specify",
"the",
"lexer",
"to",
"use",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L963-L998 | train | Set the lexer class for the current locale. |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_widget.py | QtmacsScintilla.setMonospace | def setMonospace(self):
"""
Fix the fonts of the first 32 styles to a mono space one.
|Args|
* **None**
|Returns|
**None**
|Raises|
* **None**
"""
font = bytes('courier new', 'utf-8')
for ii in range(32):
self.Send... | python | def setMonospace(self):
"""
Fix the fonts of the first 32 styles to a mono space one.
|Args|
* **None**
|Returns|
**None**
|Raises|
* **None**
"""
font = bytes('courier new', 'utf-8')
for ii in range(32):
self.Send... | [
"def",
"setMonospace",
"(",
"self",
")",
":",
"font",
"=",
"bytes",
"(",
"'courier new'",
",",
"'utf-8'",
")",
"for",
"ii",
"in",
"range",
"(",
"32",
")",
":",
"self",
".",
"SendScintilla",
"(",
"self",
".",
"SCI_STYLESETFONT",
",",
"ii",
",",
"font",
... | Fix the fonts of the first 32 styles to a mono space one.
|Args|
* **None**
|Returns|
**None**
|Raises|
* **None** | [
"Fix",
"the",
"fonts",
"of",
"the",
"first",
"32",
"styles",
"to",
"a",
"mono",
"space",
"one",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L1022-L1040 | train | Fix the fonts of the first 32 styles to a mono space one. |
olitheolix/qtmacs | qtmacs/extensions/qtmacsscintilla_widget.py | QtmacsScintilla.setModified | def setModified(self, isModified: bool):
"""
Set the modified state to ``isModified``.
From a programmer's perspective this method does the same as
the native ``QsciScintilla`` method but also ensures that the
undo framework knows when the document state was changed.
|A... | python | def setModified(self, isModified: bool):
"""
Set the modified state to ``isModified``.
From a programmer's perspective this method does the same as
the native ``QsciScintilla`` method but also ensures that the
undo framework knows when the document state was changed.
|A... | [
"def",
"setModified",
"(",
"self",
",",
"isModified",
":",
"bool",
")",
":",
"if",
"not",
"isModified",
":",
"self",
".",
"qteUndoStack",
".",
"saveState",
"(",
")",
"super",
"(",
")",
".",
"setModified",
"(",
"isModified",
")"
] | Set the modified state to ``isModified``.
From a programmer's perspective this method does the same as
the native ``QsciScintilla`` method but also ensures that the
undo framework knows when the document state was changed.
|Args|
* ``isModified`` (**bool**): whether or not the... | [
"Set",
"the",
"modified",
"state",
"to",
"isModified",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L1043-L1066 | train | Set the modified state to isModified. |
vecnet/vecnet.openmalaria | vecnet/openmalaria/scenario/core.py | attribute | def attribute(func):
"""
Decorator used to declare that property is a tag attribute
"""
def inner(self):
name, attribute_type = func(self)
if not name:
name = func.__name__
try:
return attribute_type(self.et.attrib[name])
except KeyError:
... | python | def attribute(func):
"""
Decorator used to declare that property is a tag attribute
"""
def inner(self):
name, attribute_type = func(self)
if not name:
name = func.__name__
try:
return attribute_type(self.et.attrib[name])
except KeyError:
... | [
"def",
"attribute",
"(",
"func",
")",
":",
"def",
"inner",
"(",
"self",
")",
":",
"name",
",",
"attribute_type",
"=",
"func",
"(",
"self",
")",
"if",
"not",
"name",
":",
"name",
"=",
"func",
".",
"__name__",
"try",
":",
"return",
"attribute_type",
"(... | Decorator used to declare that property is a tag attribute | [
"Decorator",
"used",
"to",
"declare",
"that",
"property",
"is",
"a",
"tag",
"attribute"
] | 795bc9d1b81a6c664f14879edda7a7c41188e95a | https://github.com/vecnet/vecnet.openmalaria/blob/795bc9d1b81a6c664f14879edda7a7c41188e95a/vecnet/openmalaria/scenario/core.py#L14-L27 | train | Decorator used to declare that property is a tag attribute |
vecnet/vecnet.openmalaria | vecnet/openmalaria/scenario/core.py | section | def section(func):
"""
Decorator used to declare that the property is xml section
"""
def inner(self):
return func(self)(self.et.find(func.__name__))
return inner | python | def section(func):
"""
Decorator used to declare that the property is xml section
"""
def inner(self):
return func(self)(self.et.find(func.__name__))
return inner | [
"def",
"section",
"(",
"func",
")",
":",
"def",
"inner",
"(",
"self",
")",
":",
"return",
"func",
"(",
"self",
")",
"(",
"self",
".",
"et",
".",
"find",
"(",
"func",
".",
"__name__",
")",
")",
"return",
"inner"
] | Decorator used to declare that the property is xml section | [
"Decorator",
"used",
"to",
"declare",
"that",
"the",
"property",
"is",
"xml",
"section"
] | 795bc9d1b81a6c664f14879edda7a7c41188e95a | https://github.com/vecnet/vecnet.openmalaria/blob/795bc9d1b81a6c664f14879edda7a7c41188e95a/vecnet/openmalaria/scenario/core.py#L40-L46 | train | Decorator used to declare that the property is xml section |
vecnet/vecnet.openmalaria | vecnet/openmalaria/scenario/core.py | tag_value | def tag_value(func):
"""
Decorator used to declare that the property is attribute of embedded tag
"""
def inner(self):
tag, attrib, attrib_type = func(self)
tag_obj = self.et.find(tag)
if tag_obj is not None:
try:
return attrib_type(self.et.find(tag).... | python | def tag_value(func):
"""
Decorator used to declare that the property is attribute of embedded tag
"""
def inner(self):
tag, attrib, attrib_type = func(self)
tag_obj = self.et.find(tag)
if tag_obj is not None:
try:
return attrib_type(self.et.find(tag).... | [
"def",
"tag_value",
"(",
"func",
")",
":",
"def",
"inner",
"(",
"self",
")",
":",
"tag",
",",
"attrib",
",",
"attrib_type",
"=",
"func",
"(",
"self",
")",
"tag_obj",
"=",
"self",
".",
"et",
".",
"find",
"(",
"tag",
")",
"if",
"tag_obj",
"is",
"no... | Decorator used to declare that the property is attribute of embedded tag | [
"Decorator",
"used",
"to",
"declare",
"that",
"the",
"property",
"is",
"attribute",
"of",
"embedded",
"tag"
] | 795bc9d1b81a6c664f14879edda7a7c41188e95a | https://github.com/vecnet/vecnet.openmalaria/blob/795bc9d1b81a6c664f14879edda7a7c41188e95a/vecnet/openmalaria/scenario/core.py#L49-L63 | train | Decorator used to declare that the property is attribute of embedded tag
|
vecnet/vecnet.openmalaria | vecnet/openmalaria/scenario/core.py | tag_value_setter | def tag_value_setter(tag, attrib):
"""
Decorator used to declare that the setter function is an attribute of embedded tag
"""
def outer(func):
def inner(self, value):
tag_elem = self.et.find(tag)
if tag_elem is None:
et = ElementTree.fromstring("<{}></{}>... | python | def tag_value_setter(tag, attrib):
"""
Decorator used to declare that the setter function is an attribute of embedded tag
"""
def outer(func):
def inner(self, value):
tag_elem = self.et.find(tag)
if tag_elem is None:
et = ElementTree.fromstring("<{}></{}>... | [
"def",
"tag_value_setter",
"(",
"tag",
",",
"attrib",
")",
":",
"def",
"outer",
"(",
"func",
")",
":",
"def",
"inner",
"(",
"self",
",",
"value",
")",
":",
"tag_elem",
"=",
"self",
".",
"et",
".",
"find",
"(",
"tag",
")",
"if",
"tag_elem",
"is",
... | Decorator used to declare that the setter function is an attribute of embedded tag | [
"Decorator",
"used",
"to",
"declare",
"that",
"the",
"setter",
"function",
"is",
"an",
"attribute",
"of",
"embedded",
"tag"
] | 795bc9d1b81a6c664f14879edda7a7c41188e95a | https://github.com/vecnet/vecnet.openmalaria/blob/795bc9d1b81a6c664f14879edda7a7c41188e95a/vecnet/openmalaria/scenario/core.py#L66-L81 | train | Decorator used to declare that the setter function is an attribute of embedded tag
|
vecnet/vecnet.openmalaria | vecnet/openmalaria/scenario/core.py | Section.xml | def xml(self):
"""
:rtype: str
"""
if six.PY3:
data = ElementTree.tostring(self.et, encoding="unicode")
else:
data = ElementTree.tostring(self.et)
return data | python | def xml(self):
"""
:rtype: str
"""
if six.PY3:
data = ElementTree.tostring(self.et, encoding="unicode")
else:
data = ElementTree.tostring(self.et)
return data | [
"def",
"xml",
"(",
"self",
")",
":",
"if",
"six",
".",
"PY3",
":",
"data",
"=",
"ElementTree",
".",
"tostring",
"(",
"self",
".",
"et",
",",
"encoding",
"=",
"\"unicode\"",
")",
"else",
":",
"data",
"=",
"ElementTree",
".",
"tostring",
"(",
"self",
... | :rtype: str | [
":",
"rtype",
":",
"str"
] | 795bc9d1b81a6c664f14879edda7a7c41188e95a | https://github.com/vecnet/vecnet.openmalaria/blob/795bc9d1b81a6c664f14879edda7a7c41188e95a/vecnet/openmalaria/scenario/core.py#L92-L100 | train | returns the xml representation of the current object |
projectshift/shift-schema | shiftschema/validators/abstract_validator.py | AbstractValidator.run | def run(self, value, model=None, context=None):
"""
Run validation
Wraps concrete implementation to ensure custom validators return
proper type of result.
:param value: a value to validate
:param model: parent model of the property
:pa... | python | def run(self, value, model=None, context=None):
"""
Run validation
Wraps concrete implementation to ensure custom validators return
proper type of result.
:param value: a value to validate
:param model: parent model of the property
:pa... | [
"def",
"run",
"(",
"self",
",",
"value",
",",
"model",
"=",
"None",
",",
"context",
"=",
"None",
")",
":",
"res",
"=",
"self",
".",
"validate",
"(",
"value",
",",
"model",
",",
"context",
")",
"if",
"not",
"isinstance",
"(",
"res",
",",
"Error",
... | Run validation
Wraps concrete implementation to ensure custom validators return
proper type of result.
:param value: a value to validate
:param model: parent model of the property
:param context: parent model or custom context
:ret... | [
"Run",
"validation",
"Wraps",
"concrete",
"implementation",
"to",
"ensure",
"custom",
"validators",
"return",
"proper",
"type",
"of",
"result",
"."
] | 07787b540d3369bb37217ffbfbe629118edaf0eb | https://github.com/projectshift/shift-schema/blob/07787b540d3369bb37217ffbfbe629118edaf0eb/shiftschema/validators/abstract_validator.py#L29-L49 | train | Run validation
|
alextricity25/dwell_in_you_richly | diyr/sinks/base.py | BaseSinkClass._collect_data | def _collect_data(self):
"""
Returns a list of all the data gathered from the engine
iterable.
"""
all_data = []
for line in self.engine.run_engine():
logging.debug("Adding {} to all_data".format(line))
all_data.append(line.copy())
logg... | python | def _collect_data(self):
"""
Returns a list of all the data gathered from the engine
iterable.
"""
all_data = []
for line in self.engine.run_engine():
logging.debug("Adding {} to all_data".format(line))
all_data.append(line.copy())
logg... | [
"def",
"_collect_data",
"(",
"self",
")",
":",
"all_data",
"=",
"[",
"]",
"for",
"line",
"in",
"self",
".",
"engine",
".",
"run_engine",
"(",
")",
":",
"logging",
".",
"debug",
"(",
"\"Adding {} to all_data\"",
".",
"format",
"(",
"line",
")",
")",
"al... | Returns a list of all the data gathered from the engine
iterable. | [
"Returns",
"a",
"list",
"of",
"all",
"the",
"data",
"gathered",
"from",
"the",
"engine",
"iterable",
"."
] | e705e1bc4fc0b8d2aa25680dfc432762b361c783 | https://github.com/alextricity25/dwell_in_you_richly/blob/e705e1bc4fc0b8d2aa25680dfc432762b361c783/diyr/sinks/base.py#L23-L34 | train | Returns a list of all the data gathered from the engine
iterable. |
pmacosta/pexdoc | pexdoc/pinspect.py | _get_module_name_from_fname | def _get_module_name_from_fname(fname):
"""Get module name from module file name."""
fname = fname.replace(".pyc", ".py")
for mobj in sys.modules.values():
if (
hasattr(mobj, "__file__")
and mobj.__file__
and (mobj.__file__.replace(".pyc", ".py") == fname)
... | python | def _get_module_name_from_fname(fname):
"""Get module name from module file name."""
fname = fname.replace(".pyc", ".py")
for mobj in sys.modules.values():
if (
hasattr(mobj, "__file__")
and mobj.__file__
and (mobj.__file__.replace(".pyc", ".py") == fname)
... | [
"def",
"_get_module_name_from_fname",
"(",
"fname",
")",
":",
"fname",
"=",
"fname",
".",
"replace",
"(",
"\".pyc\"",
",",
"\".py\"",
")",
"for",
"mobj",
"in",
"sys",
".",
"modules",
".",
"values",
"(",
")",
":",
"if",
"(",
"hasattr",
"(",
"mobj",
",",... | Get module name from module file name. | [
"Get",
"module",
"name",
"from",
"module",
"file",
"name",
"."
] | 201ac243e5781347feb75896a4231429fe6da4b1 | https://github.com/pmacosta/pexdoc/blob/201ac243e5781347feb75896a4231429fe6da4b1/pexdoc/pinspect.py#L40-L51 | train | Get module name from module file name. |
pmacosta/pexdoc | pexdoc/pinspect.py | get_function_args | def get_function_args(func, no_self=False, no_varargs=False):
"""
Return tuple of the function argument names in the order of the function signature.
:param func: Function
:type func: function object
:param no_self: Flag that indicates whether the function argument *self*,
if ... | python | def get_function_args(func, no_self=False, no_varargs=False):
"""
Return tuple of the function argument names in the order of the function signature.
:param func: Function
:type func: function object
:param no_self: Flag that indicates whether the function argument *self*,
if ... | [
"def",
"get_function_args",
"(",
"func",
",",
"no_self",
"=",
"False",
",",
"no_varargs",
"=",
"False",
")",
":",
"par_dict",
"=",
"signature",
"(",
"func",
")",
".",
"parameters",
"# Mark positional and/or keyword arguments (if any)",
"pos",
"=",
"lambda",
"x",
... | Return tuple of the function argument names in the order of the function signature.
:param func: Function
:type func: function object
:param no_self: Flag that indicates whether the function argument *self*,
if present, is included in the output (False) or not (True)
:type no_sel... | [
"Return",
"tuple",
"of",
"the",
"function",
"argument",
"names",
"in",
"the",
"order",
"of",
"the",
"function",
"signature",
"."
] | 201ac243e5781347feb75896a4231429fe6da4b1 | https://github.com/pmacosta/pexdoc/blob/201ac243e5781347feb75896a4231429fe6da4b1/pexdoc/pinspect.py#L66-L126 | train | Get the arguments of a function. |
pmacosta/pexdoc | pexdoc/pinspect.py | get_module_name | def get_module_name(module_obj):
r"""
Retrieve the module name from a module object.
:param module_obj: Module object
:type module_obj: object
:rtype: string
:raises:
* RuntimeError (Argument \`module_obj\` is not valid)
* RuntimeError (Module object \`*[module_name]*\` could not ... | python | def get_module_name(module_obj):
r"""
Retrieve the module name from a module object.
:param module_obj: Module object
:type module_obj: object
:rtype: string
:raises:
* RuntimeError (Argument \`module_obj\` is not valid)
* RuntimeError (Module object \`*[module_name]*\` could not ... | [
"def",
"get_module_name",
"(",
"module_obj",
")",
":",
"if",
"not",
"is_object_module",
"(",
"module_obj",
")",
":",
"raise",
"RuntimeError",
"(",
"\"Argument `module_obj` is not valid\"",
")",
"name",
"=",
"module_obj",
".",
"__name__",
"msg",
"=",
"\"Module object... | r"""
Retrieve the module name from a module object.
:param module_obj: Module object
:type module_obj: object
:rtype: string
:raises:
* RuntimeError (Argument \`module_obj\` is not valid)
* RuntimeError (Module object \`*[module_name]*\` could not be found in
loaded modules)
... | [
"r",
"Retrieve",
"the",
"module",
"name",
"from",
"a",
"module",
"object",
"."
] | 201ac243e5781347feb75896a4231429fe6da4b1 | https://github.com/pmacosta/pexdoc/blob/201ac243e5781347feb75896a4231429fe6da4b1/pexdoc/pinspect.py#L129-L156 | train | r Returns the module name from a module object. |
pmacosta/pexdoc | pexdoc/pinspect.py | private_props | def private_props(obj):
"""
Yield private properties of an object.
A private property is defined as one that has a single underscore
(:code:`_`) before its name
:param obj: Object
:type obj: object
:returns: iterator
"""
# Get private properties but NOT magic methods
props = ... | python | def private_props(obj):
"""
Yield private properties of an object.
A private property is defined as one that has a single underscore
(:code:`_`) before its name
:param obj: Object
:type obj: object
:returns: iterator
"""
# Get private properties but NOT magic methods
props = ... | [
"def",
"private_props",
"(",
"obj",
")",
":",
"# Get private properties but NOT magic methods",
"props",
"=",
"[",
"item",
"for",
"item",
"in",
"dir",
"(",
"obj",
")",
"]",
"priv_props",
"=",
"[",
"_PRIVATE_PROP_REGEXP",
".",
"match",
"(",
"item",
")",
"for",
... | Yield private properties of an object.
A private property is defined as one that has a single underscore
(:code:`_`) before its name
:param obj: Object
:type obj: object
:returns: iterator | [
"Yield",
"private",
"properties",
"of",
"an",
"object",
"."
] | 201ac243e5781347feb75896a4231429fe6da4b1 | https://github.com/pmacosta/pexdoc/blob/201ac243e5781347feb75896a4231429fe6da4b1/pexdoc/pinspect.py#L183-L201 | train | Yield private properties of an object. |
pmacosta/pexdoc | pexdoc/pinspect.py | Callables._check_intersection | def _check_intersection(self, other):
"""Check that intersection of two objects has the same information."""
# pylint: disable=C0123
props = ["_callables_db", "_reverse_callables_db", "_modules_dict"]
for prop in props:
self_dict = getattr(self, prop)
other_dict =... | python | def _check_intersection(self, other):
"""Check that intersection of two objects has the same information."""
# pylint: disable=C0123
props = ["_callables_db", "_reverse_callables_db", "_modules_dict"]
for prop in props:
self_dict = getattr(self, prop)
other_dict =... | [
"def",
"_check_intersection",
"(",
"self",
",",
"other",
")",
":",
"# pylint: disable=C0123",
"props",
"=",
"[",
"\"_callables_db\"",
",",
"\"_reverse_callables_db\"",
",",
"\"_modules_dict\"",
"]",
"for",
"prop",
"in",
"props",
":",
"self_dict",
"=",
"getattr",
"... | Check that intersection of two objects has the same information. | [
"Check",
"that",
"intersection",
"of",
"two",
"objects",
"has",
"the",
"same",
"information",
"."
] | 201ac243e5781347feb75896a4231429fe6da4b1 | https://github.com/pmacosta/pexdoc/blob/201ac243e5781347feb75896a4231429fe6da4b1/pexdoc/pinspect.py#L484-L506 | train | Check that intersection of two objects has the same information. |
pmacosta/pexdoc | pexdoc/pinspect.py | Callables.get_callable_from_line | def get_callable_from_line(self, module_file, lineno):
"""Get the callable that the line number belongs to."""
module_name = _get_module_name_from_fname(module_file)
if module_name not in self._modules_dict:
self.trace([module_file])
ret = None
# Sort callables by sta... | python | def get_callable_from_line(self, module_file, lineno):
"""Get the callable that the line number belongs to."""
module_name = _get_module_name_from_fname(module_file)
if module_name not in self._modules_dict:
self.trace([module_file])
ret = None
# Sort callables by sta... | [
"def",
"get_callable_from_line",
"(",
"self",
",",
"module_file",
",",
"lineno",
")",
":",
"module_name",
"=",
"_get_module_name_from_fname",
"(",
"module_file",
")",
"if",
"module_name",
"not",
"in",
"self",
".",
"_modules_dict",
":",
"self",
".",
"trace",
"(",... | Get the callable that the line number belongs to. | [
"Get",
"the",
"callable",
"that",
"the",
"line",
"number",
"belongs",
"to",
"."
] | 201ac243e5781347feb75896a4231429fe6da4b1 | https://github.com/pmacosta/pexdoc/blob/201ac243e5781347feb75896a4231429fe6da4b1/pexdoc/pinspect.py#L512-L525 | train | Get the callable that the line number belongs to. |
pmacosta/pexdoc | pexdoc/pinspect.py | Callables.load | def load(self, callables_fname):
r"""
Load traced modules information from a `JSON <http://www.json.org/>`_ file.
The loaded module information is merged with any existing module information
:param callables_fname: File name
:type callables_fname: :ref:`FileNameExists`
... | python | def load(self, callables_fname):
r"""
Load traced modules information from a `JSON <http://www.json.org/>`_ file.
The loaded module information is merged with any existing module information
:param callables_fname: File name
:type callables_fname: :ref:`FileNameExists`
... | [
"def",
"load",
"(",
"self",
",",
"callables_fname",
")",
":",
"# Validate file name",
"_validate_fname",
"(",
"callables_fname",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"callables_fname",
")",
":",
"raise",
"OSError",
"(",
"\"File {0} could not ... | r"""
Load traced modules information from a `JSON <http://www.json.org/>`_ file.
The loaded module information is merged with any existing module information
:param callables_fname: File name
:type callables_fname: :ref:`FileNameExists`
:raises:
* OSError (File *[fna... | [
"r",
"Load",
"traced",
"modules",
"information",
"from",
"a",
"JSON",
"<http",
":",
"//",
"www",
".",
"json",
".",
"org",
"/",
">",
"_",
"file",
"."
] | 201ac243e5781347feb75896a4231429fe6da4b1 | https://github.com/pmacosta/pexdoc/blob/201ac243e5781347feb75896a4231429fe6da4b1/pexdoc/pinspect.py#L531-L576 | train | r Loads traced modules information from a JSON file. |
pmacosta/pexdoc | pexdoc/pinspect.py | Callables.refresh | def refresh(self):
"""Re-traces modules modified since the time they were traced."""
self.trace(list(self._fnames.keys()), _refresh=True) | python | def refresh(self):
"""Re-traces modules modified since the time they were traced."""
self.trace(list(self._fnames.keys()), _refresh=True) | [
"def",
"refresh",
"(",
"self",
")",
":",
"self",
".",
"trace",
"(",
"list",
"(",
"self",
".",
"_fnames",
".",
"keys",
"(",
")",
")",
",",
"_refresh",
"=",
"True",
")"
] | Re-traces modules modified since the time they were traced. | [
"Re",
"-",
"traces",
"modules",
"modified",
"since",
"the",
"time",
"they",
"were",
"traced",
"."
] | 201ac243e5781347feb75896a4231429fe6da4b1 | https://github.com/pmacosta/pexdoc/blob/201ac243e5781347feb75896a4231429fe6da4b1/pexdoc/pinspect.py#L578-L580 | train | Re - traces modules modified since the time they were traced. |
pmacosta/pexdoc | pexdoc/pinspect.py | Callables.save | def save(self, callables_fname):
r"""
Save traced modules information to a `JSON`_ file.
If the file exists it is overwritten
:param callables_fname: File name
:type callables_fname: :ref:`FileName`
:raises: RuntimeError (Argument \\`fname\\` is not valid)
"""... | python | def save(self, callables_fname):
r"""
Save traced modules information to a `JSON`_ file.
If the file exists it is overwritten
:param callables_fname: File name
:type callables_fname: :ref:`FileName`
:raises: RuntimeError (Argument \\`fname\\` is not valid)
"""... | [
"def",
"save",
"(",
"self",
",",
"callables_fname",
")",
":",
"# Validate file name",
"_validate_fname",
"(",
"callables_fname",
")",
"# JSON keys have to be strings but the reverse callables dictionary",
"# keys are tuples, where the first item is a file name and the",
"# second item ... | r"""
Save traced modules information to a `JSON`_ file.
If the file exists it is overwritten
:param callables_fname: File name
:type callables_fname: :ref:`FileName`
:raises: RuntimeError (Argument \\`fname\\` is not valid) | [
"r",
"Save",
"traced",
"modules",
"information",
"to",
"a",
"JSON",
"_",
"file",
"."
] | 201ac243e5781347feb75896a4231429fe6da4b1 | https://github.com/pmacosta/pexdoc/blob/201ac243e5781347feb75896a4231429fe6da4b1/pexdoc/pinspect.py#L582-L609 | train | r Save traced modules information to a JSON file. |
pmacosta/pexdoc | pexdoc/pinspect.py | Callables.trace | def trace(self, fnames, _refresh=False):
r"""
Generate a list of module callables and gets their attributes.
Callables are functions, classes, methods and class properties; their
attributes are callable type, file name, and lines span
:param fnames: File names of the modules to... | python | def trace(self, fnames, _refresh=False):
r"""
Generate a list of module callables and gets their attributes.
Callables are functions, classes, methods and class properties; their
attributes are callable type, file name, and lines span
:param fnames: File names of the modules to... | [
"def",
"trace",
"(",
"self",
",",
"fnames",
",",
"_refresh",
"=",
"False",
")",
":",
"# pylint: disable=R0101",
"if",
"fnames",
"and",
"(",
"not",
"isinstance",
"(",
"fnames",
",",
"list",
")",
")",
":",
"raise",
"RuntimeError",
"(",
"\"Argument `fnames` is ... | r"""
Generate a list of module callables and gets their attributes.
Callables are functions, classes, methods and class properties; their
attributes are callable type, file name, and lines span
:param fnames: File names of the modules to trace
:type fnames: list
:rais... | [
"r",
"Generate",
"a",
"list",
"of",
"module",
"callables",
"and",
"gets",
"their",
"attributes",
"."
] | 201ac243e5781347feb75896a4231429fe6da4b1 | https://github.com/pmacosta/pexdoc/blob/201ac243e5781347feb75896a4231429fe6da4b1/pexdoc/pinspect.py#L611-L695 | train | r Generate a list of module callables and gets their attributes. |
pmacosta/pexdoc | pexdoc/pinspect.py | _AstTreeScanner._close_callable | def _close_callable(self, node, force=False):
"""Record last line number of callable."""
# Only nodes that have a line number can be considered for closing
# callables. Similarly, only nodes with lines greater than the one
# already processed can be considered for closing callables
... | python | def _close_callable(self, node, force=False):
"""Record last line number of callable."""
# Only nodes that have a line number can be considered for closing
# callables. Similarly, only nodes with lines greater than the one
# already processed can be considered for closing callables
... | [
"def",
"_close_callable",
"(",
"self",
",",
"node",
",",
"force",
"=",
"False",
")",
":",
"# Only nodes that have a line number can be considered for closing",
"# callables. Similarly, only nodes with lines greater than the one",
"# already processed can be considered for closing callabl... | Record last line number of callable. | [
"Record",
"last",
"line",
"number",
"of",
"callable",
"."
] | 201ac243e5781347feb75896a4231429fe6da4b1 | https://github.com/pmacosta/pexdoc/blob/201ac243e5781347feb75896a4231429fe6da4b1/pexdoc/pinspect.py#L791-L903 | train | Close a callable. |
pmacosta/pexdoc | pexdoc/pinspect.py | _AstTreeScanner._get_indent | def _get_indent(self, node):
"""Get node indentation level."""
lineno = node.lineno
if lineno > len(self._lines):
return -1
wsindent = self._wsregexp.match(self._lines[lineno - 1])
return len(wsindent.group(1)) | python | def _get_indent(self, node):
"""Get node indentation level."""
lineno = node.lineno
if lineno > len(self._lines):
return -1
wsindent = self._wsregexp.match(self._lines[lineno - 1])
return len(wsindent.group(1)) | [
"def",
"_get_indent",
"(",
"self",
",",
"node",
")",
":",
"lineno",
"=",
"node",
".",
"lineno",
"if",
"lineno",
">",
"len",
"(",
"self",
".",
"_lines",
")",
":",
"return",
"-",
"1",
"wsindent",
"=",
"self",
".",
"_wsregexp",
".",
"match",
"(",
"sel... | Get node indentation level. | [
"Get",
"node",
"indentation",
"level",
"."
] | 201ac243e5781347feb75896a4231429fe6da4b1 | https://github.com/pmacosta/pexdoc/blob/201ac243e5781347feb75896a4231429fe6da4b1/pexdoc/pinspect.py#L905-L911 | train | Get indentation level. |
pmacosta/pexdoc | pexdoc/pinspect.py | _AstTreeScanner._in_class | def _in_class(self, node):
"""Find if callable is function or method."""
# Move left one indentation level and check if that callable is a class
indent = self._get_indent(node)
for indent_dict in reversed(self._indent_stack): # pragma: no branch
if (indent_dict["level"] < in... | python | def _in_class(self, node):
"""Find if callable is function or method."""
# Move left one indentation level and check if that callable is a class
indent = self._get_indent(node)
for indent_dict in reversed(self._indent_stack): # pragma: no branch
if (indent_dict["level"] < in... | [
"def",
"_in_class",
"(",
"self",
",",
"node",
")",
":",
"# Move left one indentation level and check if that callable is a class",
"indent",
"=",
"self",
".",
"_get_indent",
"(",
"node",
")",
"for",
"indent_dict",
"in",
"reversed",
"(",
"self",
".",
"_indent_stack",
... | Find if callable is function or method. | [
"Find",
"if",
"callable",
"is",
"function",
"or",
"method",
"."
] | 201ac243e5781347feb75896a4231429fe6da4b1 | https://github.com/pmacosta/pexdoc/blob/201ac243e5781347feb75896a4231429fe6da4b1/pexdoc/pinspect.py#L913-L919 | train | Find if callable is function or method. |
pmacosta/pexdoc | pexdoc/pinspect.py | _AstTreeScanner._pop_indent_stack | def _pop_indent_stack(self, node, node_type=None, action=None):
"""Get callable full name."""
indent = self._get_indent(node)
indent_stack = copy.deepcopy(self._indent_stack)
# Find enclosing scope
while (len(indent_stack) > 1) and (
(
(indent <= inden... | python | def _pop_indent_stack(self, node, node_type=None, action=None):
"""Get callable full name."""
indent = self._get_indent(node)
indent_stack = copy.deepcopy(self._indent_stack)
# Find enclosing scope
while (len(indent_stack) > 1) and (
(
(indent <= inden... | [
"def",
"_pop_indent_stack",
"(",
"self",
",",
"node",
",",
"node_type",
"=",
"None",
",",
"action",
"=",
"None",
")",
":",
"indent",
"=",
"self",
".",
"_get_indent",
"(",
"node",
")",
"indent_stack",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
".",
"_in... | Get callable full name. | [
"Get",
"callable",
"full",
"name",
"."
] | 201ac243e5781347feb75896a4231429fe6da4b1 | https://github.com/pmacosta/pexdoc/blob/201ac243e5781347feb75896a4231429fe6da4b1/pexdoc/pinspect.py#L921-L965 | train | Get callable full name. |
pmacosta/pexdoc | pexdoc/pinspect.py | _AstTreeScanner.generic_visit | def generic_visit(self, node):
"""Implement generic node."""
# [[[cog
# cog.out("print(pcolor('Enter generic visitor', 'magenta'))")
# ]]]
# [[[end]]]
# A generic visitor that potentially closes callables is needed to
# close enclosed callables that are not at the... | python | def generic_visit(self, node):
"""Implement generic node."""
# [[[cog
# cog.out("print(pcolor('Enter generic visitor', 'magenta'))")
# ]]]
# [[[end]]]
# A generic visitor that potentially closes callables is needed to
# close enclosed callables that are not at the... | [
"def",
"generic_visit",
"(",
"self",
",",
"node",
")",
":",
"# [[[cog",
"# cog.out(\"print(pcolor('Enter generic visitor', 'magenta'))\")",
"# ]]]",
"# [[[end]]]",
"# A generic visitor that potentially closes callables is needed to",
"# close enclosed callables that are not at the end of t... | Implement generic node. | [
"Implement",
"generic",
"node",
"."
] | 201ac243e5781347feb75896a4231429fe6da4b1 | https://github.com/pmacosta/pexdoc/blob/201ac243e5781347feb75896a4231429fe6da4b1/pexdoc/pinspect.py#L967-L979 | train | Implement generic node. |
pmacosta/pexdoc | pexdoc/pinspect.py | _AstTreeScanner.visit_Assign | def visit_Assign(self, node):
"""
Implement assignment walker.
Parse class properties defined via the property() function
"""
# [[[cog
# cog.out("print(pcolor('Enter assign visitor', 'magenta'))")
# ]]]
# [[[end]]]
# ###
# Class-level assi... | python | def visit_Assign(self, node):
"""
Implement assignment walker.
Parse class properties defined via the property() function
"""
# [[[cog
# cog.out("print(pcolor('Enter assign visitor', 'magenta'))")
# ]]]
# [[[end]]]
# ###
# Class-level assi... | [
"def",
"visit_Assign",
"(",
"self",
",",
"node",
")",
":",
"# [[[cog",
"# cog.out(\"print(pcolor('Enter assign visitor', 'magenta'))\")",
"# ]]]",
"# [[[end]]]",
"# ###",
"# Class-level assignment may also be a class attribute that is not",
"# a managed attribute, record it anyway, no ha... | Implement assignment walker.
Parse class properties defined via the property() function | [
"Implement",
"assignment",
"walker",
"."
] | 201ac243e5781347feb75896a4231429fe6da4b1 | https://github.com/pmacosta/pexdoc/blob/201ac243e5781347feb75896a4231429fe6da4b1/pexdoc/pinspect.py#L989-L1029 | train | Implement assignment walker. |
pmacosta/pexdoc | pexdoc/pinspect.py | _AstTreeScanner.visit_ClassDef | def visit_ClassDef(self, node):
"""Implement class walker."""
# [[[cog
# cog.out("print(pcolor('Enter class visitor', 'magenta'))")
# ]]]
# [[[end]]]
# Get class information (name, line number, etc.)
element_full_name = self._pop_indent_stack(node, "class")
... | python | def visit_ClassDef(self, node):
"""Implement class walker."""
# [[[cog
# cog.out("print(pcolor('Enter class visitor', 'magenta'))")
# ]]]
# [[[end]]]
# Get class information (name, line number, etc.)
element_full_name = self._pop_indent_stack(node, "class")
... | [
"def",
"visit_ClassDef",
"(",
"self",
",",
"node",
")",
":",
"# [[[cog",
"# cog.out(\"print(pcolor('Enter class visitor', 'magenta'))\")",
"# ]]]",
"# [[[end]]]",
"# Get class information (name, line number, etc.)",
"element_full_name",
"=",
"self",
".",
"_pop_indent_stack",
"(",... | Implement class walker. | [
"Implement",
"class",
"walker",
"."
] | 201ac243e5781347feb75896a4231429fe6da4b1 | https://github.com/pmacosta/pexdoc/blob/201ac243e5781347feb75896a4231429fe6da4b1/pexdoc/pinspect.py#L1031-L1064 | train | Implement class walker. |
pmacosta/pexdoc | pexdoc/pinspect.py | _AstTreeScanner.visit_FunctionDef | def visit_FunctionDef(self, node):
"""Implement function/method walker."""
# [[[cog
# cog.out("print(pcolor('Enter function visitor', 'magenta'))")
# ]]]
# [[[end]]]
in_class = self._in_class(node)
decorator_list = [
dobj.id if hasattr(dobj, "id") else... | python | def visit_FunctionDef(self, node):
"""Implement function/method walker."""
# [[[cog
# cog.out("print(pcolor('Enter function visitor', 'magenta'))")
# ]]]
# [[[end]]]
in_class = self._in_class(node)
decorator_list = [
dobj.id if hasattr(dobj, "id") else... | [
"def",
"visit_FunctionDef",
"(",
"self",
",",
"node",
")",
":",
"# [[[cog",
"# cog.out(\"print(pcolor('Enter function visitor', 'magenta'))\")",
"# ]]]",
"# [[[end]]]",
"in_class",
"=",
"self",
".",
"_in_class",
"(",
"node",
")",
"decorator_list",
"=",
"[",
"dobj",
".... | Implement function/method walker. | [
"Implement",
"function",
"/",
"method",
"walker",
"."
] | 201ac243e5781347feb75896a4231429fe6da4b1 | https://github.com/pmacosta/pexdoc/blob/201ac243e5781347feb75896a4231429fe6da4b1/pexdoc/pinspect.py#L1066-L1119 | train | Implement function or method walker. |
rbeagrie/wrapit | wrapit/api.py | run | def run(task_creators, args, task_selectors=[]):
"""run doit using task_creators
@param task_creators: module or dict containing task creators
"""
if args.reset_dep:
sys.exit(DoitMain(WrapitLoader(args, task_creators)).run(['reset-dep']))
else:
sys.exit(DoitMain(WrapitLoader(args, t... | python | def run(task_creators, args, task_selectors=[]):
"""run doit using task_creators
@param task_creators: module or dict containing task creators
"""
if args.reset_dep:
sys.exit(DoitMain(WrapitLoader(args, task_creators)).run(['reset-dep']))
else:
sys.exit(DoitMain(WrapitLoader(args, t... | [
"def",
"run",
"(",
"task_creators",
",",
"args",
",",
"task_selectors",
"=",
"[",
"]",
")",
":",
"if",
"args",
".",
"reset_dep",
":",
"sys",
".",
"exit",
"(",
"DoitMain",
"(",
"WrapitLoader",
"(",
"args",
",",
"task_creators",
")",
")",
".",
"run",
"... | run doit using task_creators
@param task_creators: module or dict containing task creators | [
"run",
"doit",
"using",
"task_creators"
] | ee01c20cca0a9e51c62fb73c894227e36d9abaaa | https://github.com/rbeagrie/wrapit/blob/ee01c20cca0a9e51c62fb73c894227e36d9abaaa/wrapit/api.py#L7-L15 | train | run doit using task_creators
|
a1ezzz/wasp-general | wasp_general/task/registry.py | WTaskRegistryStorage.add | def add(self, task_cls):
""" Add task to this storage. Depends on :attr:`.WTaskRegistryStorage.__multiple_tasks_per_tag__`
tasks with the same __registry_tag__ can be treated as error.
:param task_cls: task to add
:return: None
"""
registry_tag = task_cls.__registry_tag__
if registry_tag not in self.__r... | python | def add(self, task_cls):
""" Add task to this storage. Depends on :attr:`.WTaskRegistryStorage.__multiple_tasks_per_tag__`
tasks with the same __registry_tag__ can be treated as error.
:param task_cls: task to add
:return: None
"""
registry_tag = task_cls.__registry_tag__
if registry_tag not in self.__r... | [
"def",
"add",
"(",
"self",
",",
"task_cls",
")",
":",
"registry_tag",
"=",
"task_cls",
".",
"__registry_tag__",
"if",
"registry_tag",
"not",
"in",
"self",
".",
"__registry",
".",
"keys",
"(",
")",
":",
"self",
".",
"__registry",
"[",
"registry_tag",
"]",
... | Add task to this storage. Depends on :attr:`.WTaskRegistryStorage.__multiple_tasks_per_tag__`
tasks with the same __registry_tag__ can be treated as error.
:param task_cls: task to add
:return: None | [
"Add",
"task",
"to",
"this",
"storage",
".",
"Depends",
"on",
":",
"attr",
":",
".",
"WTaskRegistryStorage",
".",
"__multiple_tasks_per_tag__",
"tasks",
"with",
"the",
"same",
"__registry_tag__",
"can",
"be",
"treated",
"as",
"error",
"."
] | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/task/registry.py#L162-L176 | train | Adds a task to this storage. |
a1ezzz/wasp-general | wasp_general/task/registry.py | WTaskRegistryStorage.remove | def remove(self, task_cls):
""" Remove task from the storage. If task class are stored multiple times
(if :attr:`.WTaskRegistryStorage.__multiple_tasks_per_tag__` is True) - removes all of them.
:param task_cls: task to remove
:return: None
"""
registry_tag = task_cls.__registry_tag__
if registry_tag in ... | python | def remove(self, task_cls):
""" Remove task from the storage. If task class are stored multiple times
(if :attr:`.WTaskRegistryStorage.__multiple_tasks_per_tag__` is True) - removes all of them.
:param task_cls: task to remove
:return: None
"""
registry_tag = task_cls.__registry_tag__
if registry_tag in ... | [
"def",
"remove",
"(",
"self",
",",
"task_cls",
")",
":",
"registry_tag",
"=",
"task_cls",
".",
"__registry_tag__",
"if",
"registry_tag",
"in",
"self",
".",
"__registry",
".",
"keys",
"(",
")",
":",
"self",
".",
"__registry",
"[",
"registry_tag",
"]",
"=",
... | Remove task from the storage. If task class are stored multiple times
(if :attr:`.WTaskRegistryStorage.__multiple_tasks_per_tag__` is True) - removes all of them.
:param task_cls: task to remove
:return: None | [
"Remove",
"task",
"from",
"the",
"storage",
".",
"If",
"task",
"class",
"are",
"stored",
"multiple",
"times",
"(",
"if",
":",
"attr",
":",
".",
"WTaskRegistryStorage",
".",
"__multiple_tasks_per_tag__",
"is",
"True",
")",
"-",
"removes",
"all",
"of",
"them",... | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/task/registry.py#L180-L192 | train | Removes a task from the storage. |
a1ezzz/wasp-general | wasp_general/task/registry.py | WTaskRegistryStorage.tasks_by_tag | def tasks_by_tag(self, registry_tag):
""" Get tasks from registry by its tag
:param registry_tag: any hash-able object
:return: Return task (if :attr:`.WTaskRegistryStorage.__multiple_tasks_per_tag__` is not True) or \
list of tasks
"""
if registry_tag not in self.__registry.keys():
return None
tasks ... | python | def tasks_by_tag(self, registry_tag):
""" Get tasks from registry by its tag
:param registry_tag: any hash-able object
:return: Return task (if :attr:`.WTaskRegistryStorage.__multiple_tasks_per_tag__` is not True) or \
list of tasks
"""
if registry_tag not in self.__registry.keys():
return None
tasks ... | [
"def",
"tasks_by_tag",
"(",
"self",
",",
"registry_tag",
")",
":",
"if",
"registry_tag",
"not",
"in",
"self",
".",
"__registry",
".",
"keys",
"(",
")",
":",
"return",
"None",
"tasks",
"=",
"self",
".",
"__registry",
"[",
"registry_tag",
"]",
"return",
"t... | Get tasks from registry by its tag
:param registry_tag: any hash-able object
:return: Return task (if :attr:`.WTaskRegistryStorage.__multiple_tasks_per_tag__` is not True) or \
list of tasks | [
"Get",
"tasks",
"from",
"registry",
"by",
"its",
"tag"
] | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/task/registry.py#L201-L211 | train | Get tasks from registry by its tag |
a1ezzz/wasp-general | wasp_general/task/registry.py | WTaskRegistryStorage.tasks | def tasks(self, task_cls=None):
""" :meth:`.WTaskRegistryBase.tasks` implementation
"""
result = []
for tasks in self.__registry.values():
result.extend(tasks)
if task_cls is not None:
result = filter(lambda x: issubclass(x, task_cls), result)
return tuple(result) | python | def tasks(self, task_cls=None):
""" :meth:`.WTaskRegistryBase.tasks` implementation
"""
result = []
for tasks in self.__registry.values():
result.extend(tasks)
if task_cls is not None:
result = filter(lambda x: issubclass(x, task_cls), result)
return tuple(result) | [
"def",
"tasks",
"(",
"self",
",",
"task_cls",
"=",
"None",
")",
":",
"result",
"=",
"[",
"]",
"for",
"tasks",
"in",
"self",
".",
"__registry",
".",
"values",
"(",
")",
":",
"result",
".",
"extend",
"(",
"tasks",
")",
"if",
"task_cls",
"is",
"not",
... | :meth:`.WTaskRegistryBase.tasks` implementation | [
":",
"meth",
":",
".",
"WTaskRegistryBase",
".",
"tasks",
"implementation"
] | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/task/registry.py#L214-L223 | train | method for retrieving all tasks in the registry |
a1ezzz/wasp-general | wasp_general/task/registry.py | WTaskRegistryStorage.count | def count(self):
""" Registered task count
:return: int
"""
result = 0
for tasks in self.__registry.values():
result += len(tasks)
return result | python | def count(self):
""" Registered task count
:return: int
"""
result = 0
for tasks in self.__registry.values():
result += len(tasks)
return result | [
"def",
"count",
"(",
"self",
")",
":",
"result",
"=",
"0",
"for",
"tasks",
"in",
"self",
".",
"__registry",
".",
"values",
"(",
")",
":",
"result",
"+=",
"len",
"(",
"tasks",
")",
"return",
"result"
] | Registered task count
:return: int | [
"Registered",
"task",
"count"
] | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/task/registry.py#L230-L238 | train | Count the number of tasks registered in the registry. |
a1ezzz/wasp-general | wasp_general/task/registry.py | WTaskRegistry.registry_storage | def registry_storage(cls):
""" Get registry storage
:return: WTaskRegistryBase
"""
if cls.__registry_storage__ is None:
raise ValueError('__registry_storage__ must be defined')
if isinstance(cls.__registry_storage__, WTaskRegistryBase) is False:
raise TypeError("Property '__registry_storage__' is inval... | python | def registry_storage(cls):
""" Get registry storage
:return: WTaskRegistryBase
"""
if cls.__registry_storage__ is None:
raise ValueError('__registry_storage__ must be defined')
if isinstance(cls.__registry_storage__, WTaskRegistryBase) is False:
raise TypeError("Property '__registry_storage__' is inval... | [
"def",
"registry_storage",
"(",
"cls",
")",
":",
"if",
"cls",
".",
"__registry_storage__",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'__registry_storage__ must be defined'",
")",
"if",
"isinstance",
"(",
"cls",
".",
"__registry_storage__",
",",
"WTaskRegistryB... | Get registry storage
:return: WTaskRegistryBase | [
"Get",
"registry",
"storage"
] | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/task/registry.py#L255-L265 | train | Get registry storage
: return: WTaskRegistryBase
|
a1ezzz/wasp-general | wasp_general/task/registry.py | WTaskRegistry.add | def add(cls, task_cls):
""" Add task class to storage
:param task_cls: task to add
:return: None
"""
if task_cls.__registry_tag__ is None and cls.__skip_none_registry_tag__ is True:
return
cls.registry_storage().add(task_cls) | python | def add(cls, task_cls):
""" Add task class to storage
:param task_cls: task to add
:return: None
"""
if task_cls.__registry_tag__ is None and cls.__skip_none_registry_tag__ is True:
return
cls.registry_storage().add(task_cls) | [
"def",
"add",
"(",
"cls",
",",
"task_cls",
")",
":",
"if",
"task_cls",
".",
"__registry_tag__",
"is",
"None",
"and",
"cls",
".",
"__skip_none_registry_tag__",
"is",
"True",
":",
"return",
"cls",
".",
"registry_storage",
"(",
")",
".",
"add",
"(",
"task_cls... | Add task class to storage
:param task_cls: task to add
:return: None | [
"Add",
"task",
"class",
"to",
"storage"
] | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/task/registry.py#L270-L280 | train | Add task class to storage |
pmacosta/pexdoc | docs/support/exh_example.py | my_func | def my_func(name):
"""Sample function."""
# Add exception
exobj = addex(TypeError, "Argument `name` is not valid")
# Conditionally raise exception
exobj(not isinstance(name, str))
print("My name is {0}".format(name)) | python | def my_func(name):
"""Sample function."""
# Add exception
exobj = addex(TypeError, "Argument `name` is not valid")
# Conditionally raise exception
exobj(not isinstance(name, str))
print("My name is {0}".format(name)) | [
"def",
"my_func",
"(",
"name",
")",
":",
"# Add exception",
"exobj",
"=",
"addex",
"(",
"TypeError",
",",
"\"Argument `name` is not valid\"",
")",
"# Conditionally raise exception",
"exobj",
"(",
"not",
"isinstance",
"(",
"name",
",",
"str",
")",
")",
"print",
"... | Sample function. | [
"Sample",
"function",
"."
] | 201ac243e5781347feb75896a4231429fe6da4b1 | https://github.com/pmacosta/pexdoc/blob/201ac243e5781347feb75896a4231429fe6da4b1/docs/support/exh_example.py#L10-L16 | train | Sample function. |
projectshift/shift-schema | shiftschema/validators/email.py | Email.validate | def validate(self, value, model=None, context=None):
"""
Validate
Perform value validation and return result
:param value: value to check
:param model: parent model being validated
:param context: object or None, validation context
:re... | python | def validate(self, value, model=None, context=None):
"""
Validate
Perform value validation and return result
:param value: value to check
:param model: parent model being validated
:param context: object or None, validation context
:re... | [
"def",
"validate",
"(",
"self",
",",
"value",
",",
"model",
"=",
"None",
",",
"context",
"=",
"None",
")",
":",
"regex",
"=",
"self",
".",
"regex",
"(",
")",
"match",
"=",
"regex",
".",
"match",
"(",
"value",
")",
"if",
"not",
"match",
":",
"retu... | Validate
Perform value validation and return result
:param value: value to check
:param model: parent model being validated
:param context: object or None, validation context
:return: shiftschema.results.SimpleResult | [
"Validate",
"Perform",
"value",
"validation",
"and",
"return",
"result"
] | 07787b540d3369bb37217ffbfbe629118edaf0eb | https://github.com/projectshift/shift-schema/blob/07787b540d3369bb37217ffbfbe629118edaf0eb/shiftschema/validators/email.py#L26-L43 | train | Validates the value for the key - value pair and returns a SimpleResult object. |
projectshift/shift-schema | shiftschema/validators/email.py | Email.regex | def regex(self):
"""
RFC822 Email Address Regex
Originally written by Cal Henderson
c.f. http://iamcal.com/publish/articles/php/parsing_email/
Translated to Python by Tim Fletcher with changes suggested by Dan Kubb
http://tfletcher.com/lib/rfc822.py
Licensed under... | python | def regex(self):
"""
RFC822 Email Address Regex
Originally written by Cal Henderson
c.f. http://iamcal.com/publish/articles/php/parsing_email/
Translated to Python by Tim Fletcher with changes suggested by Dan Kubb
http://tfletcher.com/lib/rfc822.py
Licensed under... | [
"def",
"regex",
"(",
"self",
")",
":",
"qtext",
"=",
"'[^\\\\x0d\\\\x22\\\\x5c\\\\x80-\\\\xff]'",
"dtext",
"=",
"'[^\\\\x0d\\\\x5b-\\\\x5d\\\\x80-\\\\xff]'",
"atom",
"=",
"'[^\\\\x00-\\\\x20\\\\x22\\\\x28\\\\x29\\\\x2c\\\\x2e\\\\x3a-\\\\x3c\\\\x3e\\\\x40'",
"atom",
"+=",
"'\\\\x5b-... | RFC822 Email Address Regex
Originally written by Cal Henderson
c.f. http://iamcal.com/publish/articles/php/parsing_email/
Translated to Python by Tim Fletcher with changes suggested by Dan Kubb
http://tfletcher.com/lib/rfc822.py
Licensed under a Creative Commons Attribution-Share... | [
"RFC822",
"Email",
"Address",
"Regex",
"Originally",
"written",
"by",
"Cal",
"Henderson",
"c",
".",
"f",
".",
"http",
":",
"//",
"iamcal",
".",
"com",
"/",
"publish",
"/",
"articles",
"/",
"php",
"/",
"parsing_email",
"/",
"Translated",
"to",
"Python",
"... | 07787b540d3369bb37217ffbfbe629118edaf0eb | https://github.com/projectshift/shift-schema/blob/07787b540d3369bb37217ffbfbe629118edaf0eb/shiftschema/validators/email.py#L45-L74 | train | RFC822 Email Address Regex |
a1ezzz/wasp-general | wasp_general/command/command.py | WCommand.match | def match(self, *command_tokens, **command_env):
""" :meth:`.WCommandProto.match` implementation
"""
command = self.command()
if len(command_tokens) >= len(command):
return command_tokens[:len(command)] == command
return False | python | def match(self, *command_tokens, **command_env):
""" :meth:`.WCommandProto.match` implementation
"""
command = self.command()
if len(command_tokens) >= len(command):
return command_tokens[:len(command)] == command
return False | [
"def",
"match",
"(",
"self",
",",
"*",
"command_tokens",
",",
"*",
"*",
"command_env",
")",
":",
"command",
"=",
"self",
".",
"command",
"(",
")",
"if",
"len",
"(",
"command_tokens",
")",
">=",
"len",
"(",
"command",
")",
":",
"return",
"command_tokens... | :meth:`.WCommandProto.match` implementation | [
":",
"meth",
":",
".",
"WCommandProto",
".",
"match",
"implementation"
] | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/command/command.py#L107-L113 | train | Implementation of WCommandProto. match method. |
a1ezzz/wasp-general | wasp_general/command/command.py | WCommand.exec | def exec(self, *command_tokens, **command_env):
""" :meth:`.WCommandProto.exec` implementation
(throws RuntimeError if tokens are invalid, and calls :meth:`.WCommand._exec` method)
"""
if self.match(*command_tokens, **command_env) is False:
raise RuntimeError('Command mismatch: %s' % self.join_tokens(*comma... | python | def exec(self, *command_tokens, **command_env):
""" :meth:`.WCommandProto.exec` implementation
(throws RuntimeError if tokens are invalid, and calls :meth:`.WCommand._exec` method)
"""
if self.match(*command_tokens, **command_env) is False:
raise RuntimeError('Command mismatch: %s' % self.join_tokens(*comma... | [
"def",
"exec",
"(",
"self",
",",
"*",
"command_tokens",
",",
"*",
"*",
"command_env",
")",
":",
"if",
"self",
".",
"match",
"(",
"*",
"command_tokens",
",",
"*",
"*",
"command_env",
")",
"is",
"False",
":",
"raise",
"RuntimeError",
"(",
"'Command mismatc... | :meth:`.WCommandProto.exec` implementation
(throws RuntimeError if tokens are invalid, and calls :meth:`.WCommand._exec` method) | [
":",
"meth",
":",
".",
"WCommandProto",
".",
"exec",
"implementation"
] | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/command/command.py#L127-L135 | train | Execute a command. |
a1ezzz/wasp-general | wasp_general/command/command.py | WCommandSelector.select | def select(self, *command_tokens, **command_env):
""" Select suitable command, that matches the given tokens. Each new command to check is fetched with
this object iterator (:meth:`.WCommandSelector.__iter__`)
:param command_tokens: command
:param command_env: command environment
:return: WCommandProto
"""... | python | def select(self, *command_tokens, **command_env):
""" Select suitable command, that matches the given tokens. Each new command to check is fetched with
this object iterator (:meth:`.WCommandSelector.__iter__`)
:param command_tokens: command
:param command_env: command environment
:return: WCommandProto
"""... | [
"def",
"select",
"(",
"self",
",",
"*",
"command_tokens",
",",
"*",
"*",
"command_env",
")",
":",
"for",
"command_obj",
"in",
"self",
":",
"if",
"command_obj",
".",
"match",
"(",
"*",
"command_tokens",
",",
"*",
"*",
"command_env",
")",
":",
"return",
... | Select suitable command, that matches the given tokens. Each new command to check is fetched with
this object iterator (:meth:`.WCommandSelector.__iter__`)
:param command_tokens: command
:param command_env: command environment
:return: WCommandProto | [
"Select",
"suitable",
"command",
"that",
"matches",
"the",
"given",
"tokens",
".",
"Each",
"new",
"command",
"to",
"check",
"is",
"fetched",
"with",
"this",
"object",
"iterator",
"(",
":",
"meth",
":",
".",
"WCommandSelector",
".",
"__iter__",
")"
] | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/command/command.py#L157-L167 | train | Select suitable command that matches the given tokens. |
a1ezzz/wasp-general | wasp_general/command/command.py | WCommandPrioritizedSelector.add_prioritized | def add_prioritized(self, command_obj, priority):
""" Add command with the specified priority
:param command_obj: command to add
:param priority: command priority
:return: None
"""
if priority not in self.__priorities.keys():
self.__priorities[priority] = []
self.__priorities[priority].append(command... | python | def add_prioritized(self, command_obj, priority):
""" Add command with the specified priority
:param command_obj: command to add
:param priority: command priority
:return: None
"""
if priority not in self.__priorities.keys():
self.__priorities[priority] = []
self.__priorities[priority].append(command... | [
"def",
"add_prioritized",
"(",
"self",
",",
"command_obj",
",",
"priority",
")",
":",
"if",
"priority",
"not",
"in",
"self",
".",
"__priorities",
".",
"keys",
"(",
")",
":",
"self",
".",
"__priorities",
"[",
"priority",
"]",
"=",
"[",
"]",
"self",
".",... | Add command with the specified priority
:param command_obj: command to add
:param priority: command priority
:return: None | [
"Add",
"command",
"with",
"the",
"specified",
"priority"
] | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/command/command.py#L205-L215 | train | Adds a command with the specified priority to the list of commands that are currently being executed. |
a1ezzz/wasp-general | wasp_general/command/command.py | WCommandSet.exec | def exec(self, command_str, **command_env):
""" Execute the given command (command will be split into tokens, every space that is a part of a token
must be quoted)
:param command_str: command to execute
:param command_env: command environment
:return: WCommandResultProto
"""
env = self.__vars.copy()
en... | python | def exec(self, command_str, **command_env):
""" Execute the given command (command will be split into tokens, every space that is a part of a token
must be quoted)
:param command_str: command to execute
:param command_env: command environment
:return: WCommandResultProto
"""
env = self.__vars.copy()
en... | [
"def",
"exec",
"(",
"self",
",",
"command_str",
",",
"*",
"*",
"command_env",
")",
":",
"env",
"=",
"self",
".",
"__vars",
".",
"copy",
"(",
")",
"env",
".",
"update",
"(",
"command_env",
")",
"command_tokens",
"=",
"WCommandProto",
".",
"split_command",... | Execute the given command (command will be split into tokens, every space that is a part of a token
must be quoted)
:param command_str: command to execute
:param command_env: command environment
:return: WCommandResultProto | [
"Execute",
"the",
"given",
"command",
"(",
"command",
"will",
"be",
"split",
"into",
"tokens",
"every",
"space",
"that",
"is",
"a",
"part",
"of",
"a",
"token",
"must",
"be",
"quoted",
")"
] | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/command/command.py#L299-L317 | train | Execute the given command |
a1ezzz/wasp-general | wasp_general/command/command.py | WCommandSet.__track_vars | def __track_vars(self, command_result):
""" Check if there are any tracked variable inside the result. And keep them for future use.
:param command_result: command result tot check
:return:
"""
command_env = command_result.environment()
for var_name in self.tracked_vars():
if var_name in command_env.ke... | python | def __track_vars(self, command_result):
""" Check if there are any tracked variable inside the result. And keep them for future use.
:param command_result: command result tot check
:return:
"""
command_env = command_result.environment()
for var_name in self.tracked_vars():
if var_name in command_env.ke... | [
"def",
"__track_vars",
"(",
"self",
",",
"command_result",
")",
":",
"command_env",
"=",
"command_result",
".",
"environment",
"(",
")",
"for",
"var_name",
"in",
"self",
".",
"tracked_vars",
"(",
")",
":",
"if",
"var_name",
"in",
"command_env",
".",
"keys",
... | Check if there are any tracked variable inside the result. And keep them for future use.
:param command_result: command result tot check
:return: | [
"Check",
"if",
"there",
"are",
"any",
"tracked",
"variable",
"inside",
"the",
"result",
".",
"And",
"keep",
"them",
"for",
"future",
"use",
"."
] | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/command/command.py#L320-L330 | train | Check if there are any tracked variable inside the result and keep them for future use. |
a1ezzz/wasp-general | wasp_general/command/command.py | WCommandAlias.match | def match(self, *command_tokens, **command_env):
""" :meth:`.WCommandProto.match` implementation
"""
mutated_command_tokens = self.mutate_command_tokens(*command_tokens)
if mutated_command_tokens is None:
return False
return self.selector().select(*mutated_command_tokens, **command_env) is not None | python | def match(self, *command_tokens, **command_env):
""" :meth:`.WCommandProto.match` implementation
"""
mutated_command_tokens = self.mutate_command_tokens(*command_tokens)
if mutated_command_tokens is None:
return False
return self.selector().select(*mutated_command_tokens, **command_env) is not None | [
"def",
"match",
"(",
"self",
",",
"*",
"command_tokens",
",",
"*",
"*",
"command_env",
")",
":",
"mutated_command_tokens",
"=",
"self",
".",
"mutate_command_tokens",
"(",
"*",
"command_tokens",
")",
"if",
"mutated_command_tokens",
"is",
"None",
":",
"return",
... | :meth:`.WCommandProto.match` implementation | [
":",
"meth",
":",
".",
"WCommandProto",
".",
"match",
"implementation"
] | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/command/command.py#L364-L370 | train | implementation
return True if the command_tokens match the command_env |
a1ezzz/wasp-general | wasp_general/command/command.py | WCommandAlias.exec | def exec(self, *command_tokens, **command_env):
""" :meth:`.WCommandProto.exec` implementation
"""
mutated_command_tokens = self.mutate_command_tokens(*command_tokens)
if mutated_command_tokens is not None:
command = self.selector().select(*mutated_command_tokens, **command_env)
if command is not None:
... | python | def exec(self, *command_tokens, **command_env):
""" :meth:`.WCommandProto.exec` implementation
"""
mutated_command_tokens = self.mutate_command_tokens(*command_tokens)
if mutated_command_tokens is not None:
command = self.selector().select(*mutated_command_tokens, **command_env)
if command is not None:
... | [
"def",
"exec",
"(",
"self",
",",
"*",
"command_tokens",
",",
"*",
"*",
"command_env",
")",
":",
"mutated_command_tokens",
"=",
"self",
".",
"mutate_command_tokens",
"(",
"*",
"command_tokens",
")",
"if",
"mutated_command_tokens",
"is",
"not",
"None",
":",
"com... | :meth:`.WCommandProto.exec` implementation | [
":",
"meth",
":",
".",
"WCommandProto",
".",
"exec",
"implementation"
] | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/command/command.py#L373-L382 | train | Implementation
. exec method |
a1ezzz/wasp-general | wasp_general/network/clients/proto.py | WNetworkClientCapabilities.capability | def capability(cap, *wrap_exceptions):
""" Return a decorator, that registers function as capability. Also, all specified exceptions are
caught and instead of them the :class:`.WClientCapabilityError` exception is raised
:param cap: target function capability (may be a str or :class:`.WNetworkClientCapabilities`... | python | def capability(cap, *wrap_exceptions):
""" Return a decorator, that registers function as capability. Also, all specified exceptions are
caught and instead of them the :class:`.WClientCapabilityError` exception is raised
:param cap: target function capability (may be a str or :class:`.WNetworkClientCapabilities`... | [
"def",
"capability",
"(",
"cap",
",",
"*",
"wrap_exceptions",
")",
":",
"if",
"isinstance",
"(",
"cap",
",",
"WNetworkClientCapabilities",
")",
"is",
"True",
":",
"cap",
"=",
"cap",
".",
"value",
"elif",
"isinstance",
"(",
"cap",
",",
"str",
")",
"is",
... | Return a decorator, that registers function as capability. Also, all specified exceptions are
caught and instead of them the :class:`.WClientCapabilityError` exception is raised
:param cap: target function capability (may be a str or :class:`.WNetworkClientCapabilities` class )
:param wrap_exceptions: exceptions... | [
"Return",
"a",
"decorator",
"that",
"registers",
"function",
"as",
"capability",
".",
"Also",
"all",
"specified",
"exceptions",
"are",
"caught",
"and",
"instead",
"of",
"them",
"the",
":",
"class",
":",
".",
"WClientCapabilityError",
"exception",
"is",
"raised"
... | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/network/clients/proto.py#L63-L91 | train | Return a decorator that registers function as capability. |
a1ezzz/wasp-general | wasp_general/network/clients/proto.py | WNetworkClientProto.capability | def capability(self, cap_name):
""" Overrides original :meth:`.WCapabilitiesHolder.capability` method to support
:class:`.WNetworkClientCapabilities` as a capability value
"""
if isinstance(cap_name, WNetworkClientCapabilities) is True:
cap_name = cap_name.value
return WCapabilitiesHolder.capability(self, ... | python | def capability(self, cap_name):
""" Overrides original :meth:`.WCapabilitiesHolder.capability` method to support
:class:`.WNetworkClientCapabilities` as a capability value
"""
if isinstance(cap_name, WNetworkClientCapabilities) is True:
cap_name = cap_name.value
return WCapabilitiesHolder.capability(self, ... | [
"def",
"capability",
"(",
"self",
",",
"cap_name",
")",
":",
"if",
"isinstance",
"(",
"cap_name",
",",
"WNetworkClientCapabilities",
")",
"is",
"True",
":",
"cap_name",
"=",
"cap_name",
".",
"value",
"return",
"WCapabilitiesHolder",
".",
"capability",
"(",
"se... | Overrides original :meth:`.WCapabilitiesHolder.capability` method to support
:class:`.WNetworkClientCapabilities` as a capability value | [
"Overrides",
"original",
":",
"meth",
":",
".",
"WCapabilitiesHolder",
".",
"capability",
"method",
"to",
"support",
":",
"class",
":",
".",
"WNetworkClientCapabilities",
"as",
"a",
"capability",
"value"
] | 1029839d33eb663f8dec76c1c46754d53c1de4a9 | https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/network/clients/proto.py#L133-L139 | train | Overrides original WCapabilitiesHolder. capability method to support
Capabilities as a capability value |
olitheolix/qtmacs | qtmacs/qtmacsmain_macros.py | RecordKeysequenceCore.qteStartRecordingHook | def qteStartRecordingHook(self, msgObj):
"""
Commence macro recording.
Macros are recorded by connecting to the 'keypressed' signal
it emits.
If the recording has already commenced, or if this method was
called during a macro replay, then return immediately.
"""... | python | def qteStartRecordingHook(self, msgObj):
"""
Commence macro recording.
Macros are recorded by connecting to the 'keypressed' signal
it emits.
If the recording has already commenced, or if this method was
called during a macro replay, then return immediately.
"""... | [
"def",
"qteStartRecordingHook",
"(",
"self",
",",
"msgObj",
")",
":",
"if",
"self",
".",
"qteRecording",
":",
"self",
".",
"qteMain",
".",
"qteStatus",
"(",
"'Macro recording already enabled'",
")",
"return",
"# Update status flag.",
"self",
".",
"qteRecording",
"... | Commence macro recording.
Macros are recorded by connecting to the 'keypressed' signal
it emits.
If the recording has already commenced, or if this method was
called during a macro replay, then return immediately. | [
"Commence",
"macro",
"recording",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain_macros.py#L254-L277 | train | Start the macro recording. |
olitheolix/qtmacs | qtmacs/qtmacsmain_macros.py | RecordKeysequenceCore.qteStopRecordingHook | def qteStopRecordingHook(self, msgObj):
"""
Stop macro recording.
The signals from the event handler are disconnected and the
event handler policy set to default.
"""
# Update status flag and disconnect all signals.
if self.qteRecording:
self.qteRecor... | python | def qteStopRecordingHook(self, msgObj):
"""
Stop macro recording.
The signals from the event handler are disconnected and the
event handler policy set to default.
"""
# Update status flag and disconnect all signals.
if self.qteRecording:
self.qteRecor... | [
"def",
"qteStopRecordingHook",
"(",
"self",
",",
"msgObj",
")",
":",
"# Update status flag and disconnect all signals.",
"if",
"self",
".",
"qteRecording",
":",
"self",
".",
"qteRecording",
"=",
"False",
"self",
".",
"qteMain",
".",
"qteStatus",
"(",
"'Macro recordi... | Stop macro recording.
The signals from the event handler are disconnected and the
event handler policy set to default. | [
"Stop",
"macro",
"recording",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain_macros.py#L279-L291 | train | Stop macro recording. |
olitheolix/qtmacs | qtmacs/qtmacsmain_macros.py | RecordKeysequenceCore.qteReplayKeysequenceHook | def qteReplayKeysequenceHook(self, msgObj):
"""
Replay the macro sequence.
"""
# Quit if there is nothing to replay.
if self.recorded_keysequence.toString() == '':
return
# Stop the recording before the replay, if necessary.
if self.qteRecording:
... | python | def qteReplayKeysequenceHook(self, msgObj):
"""
Replay the macro sequence.
"""
# Quit if there is nothing to replay.
if self.recorded_keysequence.toString() == '':
return
# Stop the recording before the replay, if necessary.
if self.qteRecording:
... | [
"def",
"qteReplayKeysequenceHook",
"(",
"self",
",",
"msgObj",
")",
":",
"# Quit if there is nothing to replay.",
"if",
"self",
".",
"recorded_keysequence",
".",
"toString",
"(",
")",
"==",
"''",
":",
"return",
"# Stop the recording before the replay, if necessary.",
"if"... | Replay the macro sequence. | [
"Replay",
"the",
"macro",
"sequence",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain_macros.py#L293-L307 | train | Replay the macro sequence. |
olitheolix/qtmacs | qtmacs/qtmacsmain_macros.py | RecordKeysequenceCore.qteKeyPress | def qteKeyPress(self, msgObj):
"""
Record the key presses reported by the key handler.
"""
# Unpack the data structure.
(srcObj, keysequence, macroName) = msgObj.data
# Append the last QKeyEvent object to the so far recorded
# sequence. Note that both ``keysequen... | python | def qteKeyPress(self, msgObj):
"""
Record the key presses reported by the key handler.
"""
# Unpack the data structure.
(srcObj, keysequence, macroName) = msgObj.data
# Append the last QKeyEvent object to the so far recorded
# sequence. Note that both ``keysequen... | [
"def",
"qteKeyPress",
"(",
"self",
",",
"msgObj",
")",
":",
"# Unpack the data structure.",
"(",
"srcObj",
",",
"keysequence",
",",
"macroName",
")",
"=",
"msgObj",
".",
"data",
"# Append the last QKeyEvent object to the so far recorded",
"# sequence. Note that both ``keyse... | Record the key presses reported by the key handler. | [
"Record",
"the",
"key",
"presses",
"reported",
"by",
"the",
"key",
"handler",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain_macros.py#L309-L321 | train | Record the key presses reported by the key handler. |
olitheolix/qtmacs | qtmacs/qtmacsmain_macros.py | RepeatMacro.qteKeyPress | def qteKeyPress(self, msgObj):
"""
Record the key presses reported by the key handler.
"""
# Unpack the data structure.
(srcObj, keysequence, macroName) = msgObj.data
key = keysequence.toQKeyEventList()[-1]
# If the current key did not complete a macro ignore it.... | python | def qteKeyPress(self, msgObj):
"""
Record the key presses reported by the key handler.
"""
# Unpack the data structure.
(srcObj, keysequence, macroName) = msgObj.data
key = keysequence.toQKeyEventList()[-1]
# If the current key did not complete a macro ignore it.... | [
"def",
"qteKeyPress",
"(",
"self",
",",
"msgObj",
")",
":",
"# Unpack the data structure.",
"(",
"srcObj",
",",
"keysequence",
",",
"macroName",
")",
"=",
"msgObj",
".",
"data",
"key",
"=",
"keysequence",
".",
"toQKeyEventList",
"(",
")",
"[",
"-",
"1",
"]... | Record the key presses reported by the key handler. | [
"Record",
"the",
"key",
"presses",
"reported",
"by",
"the",
"key",
"handler",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain_macros.py#L387-L417 | train | Record the key presses reported by the key handler. |
olitheolix/qtmacs | qtmacs/qtmacsmain_macros.py | MacroProxyDemo.qteKeyPress | def qteKeyPress(self, msgObj):
"""
Record the key presses.
"""
# Unpack the data structure.
(srcObj, keysequence, macroName) = msgObj.data
# Return immediately if the key sequence does not specify a
# macro (yet).
if macroName is None:
return
... | python | def qteKeyPress(self, msgObj):
"""
Record the key presses.
"""
# Unpack the data structure.
(srcObj, keysequence, macroName) = msgObj.data
# Return immediately if the key sequence does not specify a
# macro (yet).
if macroName is None:
return
... | [
"def",
"qteKeyPress",
"(",
"self",
",",
"msgObj",
")",
":",
"# Unpack the data structure.",
"(",
"srcObj",
",",
"keysequence",
",",
"macroName",
")",
"=",
"msgObj",
".",
"data",
"# Return immediately if the key sequence does not specify a",
"# macro (yet).",
"if",
"macr... | Record the key presses. | [
"Record",
"the",
"key",
"presses",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain_macros.py#L460-L481 | train | Record the key presses. |
olitheolix/qtmacs | qtmacs/qtmacsmain_macros.py | MacroProxyDemo.abort | def abort(self, msgObj):
"""
Disconnect all signals and turn macro processing in the event
handler back on.
"""
self.qteMain.qtesigKeyparsed.disconnect(self.qteKeyPress)
self.qteMain.qtesigAbort.disconnect(self.abort)
self.qteActive = False
self.qteMain.qt... | python | def abort(self, msgObj):
"""
Disconnect all signals and turn macro processing in the event
handler back on.
"""
self.qteMain.qtesigKeyparsed.disconnect(self.qteKeyPress)
self.qteMain.qtesigAbort.disconnect(self.abort)
self.qteActive = False
self.qteMain.qt... | [
"def",
"abort",
"(",
"self",
",",
"msgObj",
")",
":",
"self",
".",
"qteMain",
".",
"qtesigKeyparsed",
".",
"disconnect",
"(",
"self",
".",
"qteKeyPress",
")",
"self",
".",
"qteMain",
".",
"qtesigAbort",
".",
"disconnect",
"(",
"self",
".",
"abort",
")",
... | Disconnect all signals and turn macro processing in the event
handler back on. | [
"Disconnect",
"all",
"signals",
"and",
"turn",
"macro",
"processing",
"in",
"the",
"event",
"handler",
"back",
"on",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/qtmacsmain_macros.py#L483-L491 | train | Disconnect all signals and turn macro processing in the event
handler back on. |
AASHE/python-membersuite-api-client | membersuite_api_client/utils.py | get_new_client | def get_new_client(request_session=False):
"""Return a new ConciergeClient, pulling secrets from the environment.
"""
from .client import ConciergeClient
client = ConciergeClient(access_key=os.environ["MS_ACCESS_KEY"],
secret_key=os.environ["MS_SECRET_KEY"],
... | python | def get_new_client(request_session=False):
"""Return a new ConciergeClient, pulling secrets from the environment.
"""
from .client import ConciergeClient
client = ConciergeClient(access_key=os.environ["MS_ACCESS_KEY"],
secret_key=os.environ["MS_SECRET_KEY"],
... | [
"def",
"get_new_client",
"(",
"request_session",
"=",
"False",
")",
":",
"from",
".",
"client",
"import",
"ConciergeClient",
"client",
"=",
"ConciergeClient",
"(",
"access_key",
"=",
"os",
".",
"environ",
"[",
"\"MS_ACCESS_KEY\"",
"]",
",",
"secret_key",
"=",
... | Return a new ConciergeClient, pulling secrets from the environment. | [
"Return",
"a",
"new",
"ConciergeClient",
"pulling",
"secrets",
"from",
"the",
"environment",
"."
] | 221f5ed8bc7d4424237a4669c5af9edc11819ee9 | https://github.com/AASHE/python-membersuite-api-client/blob/221f5ed8bc7d4424237a4669c5af9edc11819ee9/membersuite_api_client/utils.py#L44-L54 | train | Return a new ConciergeClient with the secrets from the environment. |
AASHE/python-membersuite-api-client | membersuite_api_client/utils.py | submit_msql_object_query | def submit_msql_object_query(object_query, client=None):
"""Submit `object_query` to MemberSuite, returning
.models.MemberSuiteObjects.
So this is a converter from MSQL to .models.MemberSuiteObjects.
Returns query results as a list of MemberSuiteObjects.
"""
client = client or get_new_client(... | python | def submit_msql_object_query(object_query, client=None):
"""Submit `object_query` to MemberSuite, returning
.models.MemberSuiteObjects.
So this is a converter from MSQL to .models.MemberSuiteObjects.
Returns query results as a list of MemberSuiteObjects.
"""
client = client or get_new_client(... | [
"def",
"submit_msql_object_query",
"(",
"object_query",
",",
"client",
"=",
"None",
")",
":",
"client",
"=",
"client",
"or",
"get_new_client",
"(",
")",
"if",
"not",
"client",
".",
"session_id",
":",
"client",
".",
"request_session",
"(",
")",
"result",
"=",... | Submit `object_query` to MemberSuite, returning
.models.MemberSuiteObjects.
So this is a converter from MSQL to .models.MemberSuiteObjects.
Returns query results as a list of MemberSuiteObjects. | [
"Submit",
"object_query",
"to",
"MemberSuite",
"returning",
".",
"models",
".",
"MemberSuiteObjects",
"."
] | 221f5ed8bc7d4424237a4669c5af9edc11819ee9 | https://github.com/AASHE/python-membersuite-api-client/blob/221f5ed8bc7d4424237a4669c5af9edc11819ee9/membersuite_api_client/utils.py#L57-L99 | train | Submit an object query to MemberSuite returning a list of MemberSuiteObjects. |
AASHE/python-membersuite-api-client | membersuite_api_client/utils.py | value_for_key | def value_for_key(membersuite_object_data, key):
"""Return the value for `key` of membersuite_object_data.
"""
key_value_dicts = {
d['Key']: d['Value'] for d
in membersuite_object_data["Fields"]["KeyValueOfstringanyType"]}
return key_value_dicts[key] | python | def value_for_key(membersuite_object_data, key):
"""Return the value for `key` of membersuite_object_data.
"""
key_value_dicts = {
d['Key']: d['Value'] for d
in membersuite_object_data["Fields"]["KeyValueOfstringanyType"]}
return key_value_dicts[key] | [
"def",
"value_for_key",
"(",
"membersuite_object_data",
",",
"key",
")",
":",
"key_value_dicts",
"=",
"{",
"d",
"[",
"'Key'",
"]",
":",
"d",
"[",
"'Value'",
"]",
"for",
"d",
"in",
"membersuite_object_data",
"[",
"\"Fields\"",
"]",
"[",
"\"KeyValueOfstringanyTy... | Return the value for `key` of membersuite_object_data. | [
"Return",
"the",
"value",
"for",
"key",
"of",
"membersuite_object_data",
"."
] | 221f5ed8bc7d4424237a4669c5af9edc11819ee9 | https://github.com/AASHE/python-membersuite-api-client/blob/221f5ed8bc7d4424237a4669c5af9edc11819ee9/membersuite_api_client/utils.py#L102-L108 | train | Return the value for key of membersuite_object_data. |
OpenGov/og-python-utils | ogutils/checks.py | booleanize | def booleanize(truthy):
'''
Smartly converts argument to true or false. Strings and variants of
'true' and 'false' convert to appropriate types, along with normal
bool() like conversions.
'''
if truthy is None:
return False
elif isinstance(truthy, basestring):
if tru... | python | def booleanize(truthy):
'''
Smartly converts argument to true or false. Strings and variants of
'true' and 'false' convert to appropriate types, along with normal
bool() like conversions.
'''
if truthy is None:
return False
elif isinstance(truthy, basestring):
if tru... | [
"def",
"booleanize",
"(",
"truthy",
")",
":",
"if",
"truthy",
"is",
"None",
":",
"return",
"False",
"elif",
"isinstance",
"(",
"truthy",
",",
"basestring",
")",
":",
"if",
"truthy",
":",
"try",
":",
"return",
"bool",
"(",
"distutils",
".",
"util",
".",... | Smartly converts argument to true or false. Strings and variants of
'true' and 'false' convert to appropriate types, along with normal
bool() like conversions. | [
"Smartly",
"converts",
"argument",
"to",
"true",
"or",
"false",
".",
"Strings",
"and",
"variants",
"of",
"true",
"and",
"false",
"convert",
"to",
"appropriate",
"types",
"along",
"with",
"normal",
"bool",
"()",
"like",
"conversions",
"."
] | 00f44927383dd1bd6348f47302c4453d56963479 | https://github.com/OpenGov/og-python-utils/blob/00f44927383dd1bd6348f47302c4453d56963479/ogutils/checks.py#L4-L23 | train | Smartly converts argument to true or false. Strings and variants of
true and false convert to appropriate types along with normal
bool like conversions. |
OpenGov/og-python-utils | ogutils/loggers/flask.py | build_flask_like_logger | def build_flask_like_logger(
logger_name='logger',
log_level=None,
log_dir=None,
console_enabled=True,
max_log_size=5*1024*1024,
max_backup_logs=5,
host=None):
'''
Generates a logger that outputs messages in the same format as default Flask applications.
'''
old_lo... | python | def build_flask_like_logger(
logger_name='logger',
log_level=None,
log_dir=None,
console_enabled=True,
max_log_size=5*1024*1024,
max_backup_logs=5,
host=None):
'''
Generates a logger that outputs messages in the same format as default Flask applications.
'''
old_lo... | [
"def",
"build_flask_like_logger",
"(",
"logger_name",
"=",
"'logger'",
",",
"log_level",
"=",
"None",
",",
"log_dir",
"=",
"None",
",",
"console_enabled",
"=",
"True",
",",
"max_log_size",
"=",
"5",
"*",
"1024",
"*",
"1024",
",",
"max_backup_logs",
"=",
"5",... | Generates a logger that outputs messages in the same format as default Flask applications. | [
"Generates",
"a",
"logger",
"that",
"outputs",
"messages",
"in",
"the",
"same",
"format",
"as",
"default",
"Flask",
"applications",
"."
] | 00f44927383dd1bd6348f47302c4453d56963479 | https://github.com/OpenGov/og-python-utils/blob/00f44927383dd1bd6348f47302c4453d56963479/ogutils/loggers/flask.py#L100-L121 | train | Creates a new logger that outputs messages in the same format as default Flask applications. |
OpenGov/og-python-utils | ogutils/loggers/flask.py | OrderedFormatsFormatter.usesTime | def usesTime(self, fmt=None):
'''
Check if the format uses the creation time of the record.
'''
if fmt is None:
fmt = self._fmt
if not isinstance(fmt, basestring):
fmt = fmt[0]
return fmt.find('%(asctime)') >= 0 | python | def usesTime(self, fmt=None):
'''
Check if the format uses the creation time of the record.
'''
if fmt is None:
fmt = self._fmt
if not isinstance(fmt, basestring):
fmt = fmt[0]
return fmt.find('%(asctime)') >= 0 | [
"def",
"usesTime",
"(",
"self",
",",
"fmt",
"=",
"None",
")",
":",
"if",
"fmt",
"is",
"None",
":",
"fmt",
"=",
"self",
".",
"_fmt",
"if",
"not",
"isinstance",
"(",
"fmt",
",",
"basestring",
")",
":",
"fmt",
"=",
"fmt",
"[",
"0",
"]",
"return",
... | Check if the format uses the creation time of the record. | [
"Check",
"if",
"the",
"format",
"uses",
"the",
"creation",
"time",
"of",
"the",
"record",
"."
] | 00f44927383dd1bd6348f47302c4453d56963479 | https://github.com/OpenGov/og-python-utils/blob/00f44927383dd1bd6348f47302c4453d56963479/ogutils/loggers/flask.py#L20-L28 | train | Check if the format uses the creation time of the record. |
olitheolix/qtmacs | qtmacs/auxiliary.py | qteIsQtmacsWidget | def qteIsQtmacsWidget(widgetObj):
"""
Determine if a widget is part of Qtmacs widget hierarchy.
A widget belongs to the Qtmacs hierarchy if it, or one of its
parents, has a "_qteAdmin" attribute (added via ``qteAddWidget``).
Since every applet has this attribute is guaranteed that the
function ... | python | def qteIsQtmacsWidget(widgetObj):
"""
Determine if a widget is part of Qtmacs widget hierarchy.
A widget belongs to the Qtmacs hierarchy if it, or one of its
parents, has a "_qteAdmin" attribute (added via ``qteAddWidget``).
Since every applet has this attribute is guaranteed that the
function ... | [
"def",
"qteIsQtmacsWidget",
"(",
"widgetObj",
")",
":",
"if",
"widgetObj",
"is",
"None",
":",
"return",
"False",
"if",
"hasattr",
"(",
"widgetObj",
",",
"'_qteAdmin'",
")",
":",
"return",
"True",
"# Keep track of the already visited objects to avoid infinite loops.",
... | Determine if a widget is part of Qtmacs widget hierarchy.
A widget belongs to the Qtmacs hierarchy if it, or one of its
parents, has a "_qteAdmin" attribute (added via ``qteAddWidget``).
Since every applet has this attribute is guaranteed that the
function returns **True** if the widget is embedded ins... | [
"Determine",
"if",
"a",
"widget",
"is",
"part",
"of",
"Qtmacs",
"widget",
"hierarchy",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/auxiliary.py#L1057-L1101 | train | Return True if a widget is part of Qtmacs widget hierarchy. |
olitheolix/qtmacs | qtmacs/auxiliary.py | qteGetAppletFromWidget | def qteGetAppletFromWidget(widgetObj):
"""
Return the parent applet of ``widgetObj``.
|Args|
* ``widgetObj`` (**QWidget**): widget (if any) for which the
containing applet is requested.
|Returns|
* **QtmacsApplet**: the applet containing ``widgetObj`` or **None**.
|Raises|
* ... | python | def qteGetAppletFromWidget(widgetObj):
"""
Return the parent applet of ``widgetObj``.
|Args|
* ``widgetObj`` (**QWidget**): widget (if any) for which the
containing applet is requested.
|Returns|
* **QtmacsApplet**: the applet containing ``widgetObj`` or **None**.
|Raises|
* ... | [
"def",
"qteGetAppletFromWidget",
"(",
"widgetObj",
")",
":",
"if",
"widgetObj",
"is",
"None",
":",
"return",
"None",
"if",
"hasattr",
"(",
"widgetObj",
",",
"'_qteAdmin'",
")",
":",
"return",
"widgetObj",
".",
"_qteAdmin",
".",
"qteApplet",
"# Keep track of the ... | Return the parent applet of ``widgetObj``.
|Args|
* ``widgetObj`` (**QWidget**): widget (if any) for which the
containing applet is requested.
|Returns|
* **QtmacsApplet**: the applet containing ``widgetObj`` or **None**.
|Raises|
* **None** | [
"Return",
"the",
"parent",
"applet",
"of",
"widgetObj",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/auxiliary.py#L1104-L1142 | train | Return applet that contains widgetObj. |
olitheolix/qtmacs | qtmacs/auxiliary.py | QtmacsMessage.setHookName | def setHookName(self, name: str):
"""
Specify that the message will be delivered with the hook ``name``.
"""
self.isHook = True
self.messengerName = name | python | def setHookName(self, name: str):
"""
Specify that the message will be delivered with the hook ``name``.
"""
self.isHook = True
self.messengerName = name | [
"def",
"setHookName",
"(",
"self",
",",
"name",
":",
"str",
")",
":",
"self",
".",
"isHook",
"=",
"True",
"self",
".",
"messengerName",
"=",
"name"
] | Specify that the message will be delivered with the hook ``name``. | [
"Specify",
"that",
"the",
"message",
"will",
"be",
"delivered",
"with",
"the",
"hook",
"name",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/auxiliary.py#L86-L91 | train | Sets the name of the message that will be delivered with the hook name. |
olitheolix/qtmacs | qtmacs/auxiliary.py | QtmacsMessage.setSignalName | def setSignalName(self, name: str):
"""
Specify that the message will be delivered with the signal ``name``.
"""
self.isHook = False
self.messengerName = name | python | def setSignalName(self, name: str):
"""
Specify that the message will be delivered with the signal ``name``.
"""
self.isHook = False
self.messengerName = name | [
"def",
"setSignalName",
"(",
"self",
",",
"name",
":",
"str",
")",
":",
"self",
".",
"isHook",
"=",
"False",
"self",
".",
"messengerName",
"=",
"name"
] | Specify that the message will be delivered with the signal ``name``. | [
"Specify",
"that",
"the",
"message",
"will",
"be",
"delivered",
"with",
"the",
"signal",
"name",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/auxiliary.py#L94-L99 | train | Sets the name of the messenger that will be delivered with the signal name. |
olitheolix/qtmacs | qtmacs/auxiliary.py | QtmacsAdminStructure.qteSetKeyFilterPolicy | def qteSetKeyFilterPolicy(self, receiveBefore: bool=False,
useQtmacs: bool=None,
receiveAfter: bool=False):
"""
Set the policy on how Qtmacs filters keyboard events for a
particular widgets.
The options can be arbitrarily combi... | python | def qteSetKeyFilterPolicy(self, receiveBefore: bool=False,
useQtmacs: bool=None,
receiveAfter: bool=False):
"""
Set the policy on how Qtmacs filters keyboard events for a
particular widgets.
The options can be arbitrarily combi... | [
"def",
"qteSetKeyFilterPolicy",
"(",
"self",
",",
"receiveBefore",
":",
"bool",
"=",
"False",
",",
"useQtmacs",
":",
"bool",
"=",
"None",
",",
"receiveAfter",
":",
"bool",
"=",
"False",
")",
":",
"# Store key filter policy flags.",
"self",
".",
"filterKeyEvents"... | Set the policy on how Qtmacs filters keyboard events for a
particular widgets.
The options can be arbitrarily combined, eg. ::
widget.qteSetKeyFilterPolicy(True, True, False)
will first pass the event to the applet's ``keyPressEvent``
method and afterwards pass the same ev... | [
"Set",
"the",
"policy",
"on",
"how",
"Qtmacs",
"filters",
"keyboard",
"events",
"for",
"a",
"particular",
"widgets",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/auxiliary.py#L229-L287 | train | Set the policy on how Qtmacs filters keyboard events for a particular widget. |
olitheolix/qtmacs | qtmacs/auxiliary.py | QtmacsKeysequence.list2key | def list2key(self, keyList):
"""
Convert a list of (``QtModifier``, ``QtCore.Qt.Key_*``) tuples
into a key sequence.
If no error is raised, then the list was accepted.
|Args|
* ``keyList`` (**list**): eg. (QtCore.Qt.ControlModifier,
QtCore.Qt.Key_F).
... | python | def list2key(self, keyList):
"""
Convert a list of (``QtModifier``, ``QtCore.Qt.Key_*``) tuples
into a key sequence.
If no error is raised, then the list was accepted.
|Args|
* ``keyList`` (**list**): eg. (QtCore.Qt.ControlModifier,
QtCore.Qt.Key_F).
... | [
"def",
"list2key",
"(",
"self",
",",
"keyList",
")",
":",
"for",
"keyCombo",
"in",
"keyList",
":",
"if",
"not",
"(",
"isinstance",
"(",
"keyCombo",
",",
"list",
")",
"or",
"isinstance",
"(",
"keyCombo",
",",
"tuple",
")",
")",
":",
"msg",
"=",
"(",
... | Convert a list of (``QtModifier``, ``QtCore.Qt.Key_*``) tuples
into a key sequence.
If no error is raised, then the list was accepted.
|Args|
* ``keyList`` (**list**): eg. (QtCore.Qt.ControlModifier,
QtCore.Qt.Key_F).
|Returns|
**None**
|Raises|
... | [
"Convert",
"a",
"list",
"of",
"(",
"QtModifier",
"QtCore",
".",
"Qt",
".",
"Key_",
"*",
")",
"tuples",
"into",
"a",
"key",
"sequence",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/auxiliary.py#L464-L520 | train | Convert a list of native key sequences into a key sequence. |
olitheolix/qtmacs | qtmacs/auxiliary.py | QtmacsKeysequence.str2key | def str2key(self, keyString):
"""
Parse a human readable key sequence.
If no error is raised, then ``keyString`` could be
successfully converted into a valid key sequence and is
henceforth represented by this object.
|Args|
* ``keyString`` (**QtmacsKeysequence*... | python | def str2key(self, keyString):
"""
Parse a human readable key sequence.
If no error is raised, then ``keyString`` could be
successfully converted into a valid key sequence and is
henceforth represented by this object.
|Args|
* ``keyString`` (**QtmacsKeysequence*... | [
"def",
"str2key",
"(",
"self",
",",
"keyString",
")",
":",
"# Ensure the string is non-empty.",
"if",
"keyString",
"==",
"''",
":",
"raise",
"QtmacsKeysequenceError",
"(",
"'Cannot parse empty string'",
")",
"tmp",
"=",
"str",
"(",
"keyString",
")",
"tmp",
"=",
... | Parse a human readable key sequence.
If no error is raised, then ``keyString`` could be
successfully converted into a valid key sequence and is
henceforth represented by this object.
|Args|
* ``keyString`` (**QtmacsKeysequence**): eg. "<ctrl>+f"
|Returns|
**N... | [
"Parse",
"a",
"human",
"readable",
"key",
"sequence",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/auxiliary.py#L522-L691 | train | Parse a human readable key sequence into a list of key combinations. |
olitheolix/qtmacs | qtmacs/auxiliary.py | QtmacsKeysequence.appendQKeyEvent | def appendQKeyEvent(self, keyEvent: QtGui.QKeyEvent):
"""
Append another key to the key sequence represented by this object.
|Args|
* ``keyEvent`` (**QKeyEvent**): the key to add.
|Returns|
**None**
|Raises|
* **QtmacsArgumentError** if at least one ... | python | def appendQKeyEvent(self, keyEvent: QtGui.QKeyEvent):
"""
Append another key to the key sequence represented by this object.
|Args|
* ``keyEvent`` (**QKeyEvent**): the key to add.
|Returns|
**None**
|Raises|
* **QtmacsArgumentError** if at least one ... | [
"def",
"appendQKeyEvent",
"(",
"self",
",",
"keyEvent",
":",
"QtGui",
".",
"QKeyEvent",
")",
":",
"# Store the QKeyEvent.",
"self",
".",
"keylistKeyEvent",
".",
"append",
"(",
"keyEvent",
")",
"# Convenience shortcuts.",
"mod",
"=",
"keyEvent",
".",
"modifiers",
... | Append another key to the key sequence represented by this object.
|Args|
* ``keyEvent`` (**QKeyEvent**): the key to add.
|Returns|
**None**
|Raises|
* **QtmacsArgumentError** if at least one argument has an invalid type. | [
"Append",
"another",
"key",
"to",
"the",
"key",
"sequence",
"represented",
"by",
"this",
"object",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/auxiliary.py#L694-L721 | train | Append another key to the key sequence represented by this object. |
olitheolix/qtmacs | qtmacs/auxiliary.py | QtmacsKeysequence.toString | def toString(self):
"""
Return the key sequence as a human readable string, eg. "<ctrl>+x".
Note that this list is suitable as an argument to
QtmacsKeysequence, which would create another object
representing the same key sequence. If a key could not be
converted then it ... | python | def toString(self):
"""
Return the key sequence as a human readable string, eg. "<ctrl>+x".
Note that this list is suitable as an argument to
QtmacsKeysequence, which would create another object
representing the same key sequence. If a key could not be
converted then it ... | [
"def",
"toString",
"(",
"self",
")",
":",
"# Initialise the final output string.",
"retVal",
"=",
"''",
"for",
"mod",
",",
"key",
"in",
"self",
".",
"keylistQtConstants",
":",
"out",
"=",
"''",
"# Check for any modifiers except <shift> and add the",
"# corresponding str... | Return the key sequence as a human readable string, eg. "<ctrl>+x".
Note that this list is suitable as an argument to
QtmacsKeysequence, which would create another object
representing the same key sequence. If a key could not be
converted then it will be displayed as '<Unknown>'. If thi... | [
"Return",
"the",
"key",
"sequence",
"as",
"a",
"human",
"readable",
"string",
"eg",
".",
"<ctrl",
">",
"+",
"x",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/auxiliary.py#L782-L855 | train | Return the key sequence as a human readable string eg. "<Ctrl > + x or <Alt > + f or <GroupSwitch > + x. |
olitheolix/qtmacs | qtmacs/auxiliary.py | QtmacsKeymap.qteInsertKey | def qteInsertKey(self, keysequence: QtmacsKeysequence, macroName: str):
"""
Insert a new key into the key map and associate it with a
macro.
If the key sequence is already associated with a macro then it
will be overwritten.
|Args|
* ``keysequence`` (**QtmacsKe... | python | def qteInsertKey(self, keysequence: QtmacsKeysequence, macroName: str):
"""
Insert a new key into the key map and associate it with a
macro.
If the key sequence is already associated with a macro then it
will be overwritten.
|Args|
* ``keysequence`` (**QtmacsKe... | [
"def",
"qteInsertKey",
"(",
"self",
",",
"keysequence",
":",
"QtmacsKeysequence",
",",
"macroName",
":",
"str",
")",
":",
"# Get a dedicated reference to self to facilitate traversing",
"# through the key map.",
"keyMap",
"=",
"self",
"# Get the key sequence as a list of tuples... | Insert a new key into the key map and associate it with a
macro.
If the key sequence is already associated with a macro then it
will be overwritten.
|Args|
* ``keysequence`` (**QtmacsKeysequence**): associate a macro with
a key sequence in this key map.
* ``m... | [
"Insert",
"a",
"new",
"key",
"into",
"the",
"key",
"map",
"and",
"associate",
"it",
"with",
"a",
"macro",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/auxiliary.py#L873-L922 | train | Insert a new key into the key - map. |
olitheolix/qtmacs | qtmacs/auxiliary.py | QtmacsKeymap.qteRemoveKey | def qteRemoveKey(self, keysequence: QtmacsKeysequence):
"""
Remove ``keysequence`` from this key map.
|Args|
* ``keysequence`` (**QtmacsKeysequence**): key sequence to
remove from this key map.
|Returns|
**None**
|Raises|
* **QtmacsArgument... | python | def qteRemoveKey(self, keysequence: QtmacsKeysequence):
"""
Remove ``keysequence`` from this key map.
|Args|
* ``keysequence`` (**QtmacsKeysequence**): key sequence to
remove from this key map.
|Returns|
**None**
|Raises|
* **QtmacsArgument... | [
"def",
"qteRemoveKey",
"(",
"self",
",",
"keysequence",
":",
"QtmacsKeysequence",
")",
":",
"# Get a dedicated reference to self to facilitate traversing",
"# through the key map.",
"keyMap",
"=",
"self",
"# Keep a reference to the root element in the key map.",
"keyMapRef",
"=",
... | Remove ``keysequence`` from this key map.
|Args|
* ``keysequence`` (**QtmacsKeysequence**): key sequence to
remove from this key map.
|Returns|
**None**
|Raises|
* **QtmacsArgumentError** if at least one argument has an invalid type. | [
"Remove",
"keysequence",
"from",
"this",
"key",
"map",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/auxiliary.py#L925-L999 | train | Remove a key from the key - map. |
olitheolix/qtmacs | qtmacs/auxiliary.py | QtmacsKeymap.match | def match(self, keysequence: QtmacsKeysequence):
"""
Look up the key sequence in key map.
If ``keysequence`` leads to a macro in the key map represented
by this object then the method returns ``(macroName,
True)``. If it does not lead to a macro but is nonetheless
valid ... | python | def match(self, keysequence: QtmacsKeysequence):
"""
Look up the key sequence in key map.
If ``keysequence`` leads to a macro in the key map represented
by this object then the method returns ``(macroName,
True)``. If it does not lead to a macro but is nonetheless
valid ... | [
"def",
"match",
"(",
"self",
",",
"keysequence",
":",
"QtmacsKeysequence",
")",
":",
"try",
":",
"# Look up the ``keysequence`` in the current key map (ie.",
"# this very object which inherits from ``dict``). If",
"# ``keysequence`` does not lead to a valid macro then",
"# return **Non... | Look up the key sequence in key map.
If ``keysequence`` leads to a macro in the key map represented
by this object then the method returns ``(macroName,
True)``. If it does not lead to a macro but is nonetheless
valid (ie. the sequence is still incomplete), then it returns
``(No... | [
"Look",
"up",
"the",
"key",
"sequence",
"in",
"key",
"map",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/auxiliary.py#L1002-L1050 | train | Returns a tuple of the key sequence and whether the key sequence entered in this key map corresponds to the key sequence. |
olitheolix/qtmacs | qtmacs/auxiliary.py | QtmacsModeBar._qteGetLabelInstance | def _qteGetLabelInstance(self):
"""
Return an instance of a ``QLabel`` with the correct color scheme.
|Args|
* **None**
|Returns|
* **QLabel**
|Raises|
* **None**
"""
# Create a label with the proper colour appearance.
layout ... | python | def _qteGetLabelInstance(self):
"""
Return an instance of a ``QLabel`` with the correct color scheme.
|Args|
* **None**
|Returns|
* **QLabel**
|Raises|
* **None**
"""
# Create a label with the proper colour appearance.
layout ... | [
"def",
"_qteGetLabelInstance",
"(",
"self",
")",
":",
"# Create a label with the proper colour appearance.",
"layout",
"=",
"self",
".",
"layout",
"(",
")",
"label",
"=",
"QtGui",
".",
"QLabel",
"(",
"self",
")",
"style",
"=",
"'QLabel { background-color : white; colo... | Return an instance of a ``QLabel`` with the correct color scheme.
|Args|
* **None**
|Returns|
* **QLabel**
|Raises|
* **None** | [
"Return",
"an",
"instance",
"of",
"a",
"QLabel",
"with",
"the",
"correct",
"color",
"scheme",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/auxiliary.py#L1190-L1211 | train | Return an instance of a QLabel with the correct colour scheme. |
olitheolix/qtmacs | qtmacs/auxiliary.py | QtmacsModeBar._qteUpdateLabelWidths | def _qteUpdateLabelWidths(self):
"""
Ensure all but the last ``QLabel`` are only as wide as necessary.
The width of the last label is manually set to a large value to
ensure that it stretches as much as possible. The height of all
widgets is also set appropriately. The method al... | python | def _qteUpdateLabelWidths(self):
"""
Ensure all but the last ``QLabel`` are only as wide as necessary.
The width of the last label is manually set to a large value to
ensure that it stretches as much as possible. The height of all
widgets is also set appropriately. The method al... | [
"def",
"_qteUpdateLabelWidths",
"(",
"self",
")",
":",
"layout",
"=",
"self",
".",
"layout",
"(",
")",
"# Remove all labels from the list and add them again in the",
"# new order.",
"for",
"ii",
"in",
"range",
"(",
"layout",
".",
"count",
"(",
")",
")",
":",
"la... | Ensure all but the last ``QLabel`` are only as wide as necessary.
The width of the last label is manually set to a large value to
ensure that it stretches as much as possible. The height of all
widgets is also set appropriately. The method also takes care
or rearranging the widgets in t... | [
"Ensure",
"all",
"but",
"the",
"last",
"QLabel",
"are",
"only",
"as",
"wide",
"as",
"necessary",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/auxiliary.py#L1213-L1253 | train | Update the width of all the widgets in the list of items in the QT_MODE_LIST. |
olitheolix/qtmacs | qtmacs/auxiliary.py | QtmacsModeBar.qteGetMode | def qteGetMode(self, mode: str):
"""
Return a tuple containing the ``mode``, its value, and
its associated ``QLabel`` instance.
|Args|
* ``mode`` (**str**): size and position of new window.
|Returns|
* (**str**, **object**, **QLabel**: (mode, value, label).
... | python | def qteGetMode(self, mode: str):
"""
Return a tuple containing the ``mode``, its value, and
its associated ``QLabel`` instance.
|Args|
* ``mode`` (**str**): size and position of new window.
|Returns|
* (**str**, **object**, **QLabel**: (mode, value, label).
... | [
"def",
"qteGetMode",
"(",
"self",
",",
"mode",
":",
"str",
")",
":",
"for",
"item",
"in",
"self",
".",
"_qteModeList",
":",
"if",
"item",
"[",
"0",
"]",
"==",
"mode",
":",
"return",
"item",
"return",
"None"
] | Return a tuple containing the ``mode``, its value, and
its associated ``QLabel`` instance.
|Args|
* ``mode`` (**str**): size and position of new window.
|Returns|
* (**str**, **object**, **QLabel**: (mode, value, label).
|Raises|
* **QtmacsArgumentError** if... | [
"Return",
"a",
"tuple",
"containing",
"the",
"mode",
"its",
"value",
"and",
"its",
"associated",
"QLabel",
"instance",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/auxiliary.py#L1256-L1276 | train | Return the mode value and the associated QLabel instance. |
olitheolix/qtmacs | qtmacs/auxiliary.py | QtmacsModeBar.qteAddMode | def qteAddMode(self, mode: str, value):
"""
Append label for ``mode`` and display ``value`` on it.
|Args|
* ``mode`` (**str**): mode of mode.
* ``value`` (**object**): value of mode.
|Returns|
* **None**
|Raises|
* **QtmacsArgumentError** if ... | python | def qteAddMode(self, mode: str, value):
"""
Append label for ``mode`` and display ``value`` on it.
|Args|
* ``mode`` (**str**): mode of mode.
* ``value`` (**object**): value of mode.
|Returns|
* **None**
|Raises|
* **QtmacsArgumentError** if ... | [
"def",
"qteAddMode",
"(",
"self",
",",
"mode",
":",
"str",
",",
"value",
")",
":",
"# Add the label to the layout and the local mode list.",
"label",
"=",
"self",
".",
"_qteGetLabelInstance",
"(",
")",
"label",
".",
"setText",
"(",
"value",
")",
"self",
".",
"... | Append label for ``mode`` and display ``value`` on it.
|Args|
* ``mode`` (**str**): mode of mode.
* ``value`` (**object**): value of mode.
|Returns|
* **None**
|Raises|
* **QtmacsArgumentError** if at least one argument has an invalid type. | [
"Append",
"label",
"for",
"mode",
"and",
"display",
"value",
"on",
"it",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/auxiliary.py#L1279-L1300 | train | Add a mode to the local mode list. |
olitheolix/qtmacs | qtmacs/auxiliary.py | QtmacsModeBar.qteChangeModeValue | def qteChangeModeValue(self, mode: str, value):
"""
Change the value of ``mode`` to ``value``.
If ``mode`` does not exist then nothing happens and the method
returns **False**, otherwise **True**.
|Args|
* ``mode`` (**str**): mode of mode.
* ``value`` (**object... | python | def qteChangeModeValue(self, mode: str, value):
"""
Change the value of ``mode`` to ``value``.
If ``mode`` does not exist then nothing happens and the method
returns **False**, otherwise **True**.
|Args|
* ``mode`` (**str**): mode of mode.
* ``value`` (**object... | [
"def",
"qteChangeModeValue",
"(",
"self",
",",
"mode",
":",
"str",
",",
"value",
")",
":",
"# Search through the list for ``mode``.",
"for",
"idx",
",",
"item",
"in",
"enumerate",
"(",
"self",
".",
"_qteModeList",
")",
":",
"if",
"item",
"[",
"0",
"]",
"==... | Change the value of ``mode`` to ``value``.
If ``mode`` does not exist then nothing happens and the method
returns **False**, otherwise **True**.
|Args|
* ``mode`` (**str**): mode of mode.
* ``value`` (**object**): value of mode.
|Returns|
* **bool**: **True**... | [
"Change",
"the",
"value",
"of",
"mode",
"to",
"value",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/auxiliary.py#L1303-L1336 | train | Change the value of the mode of the current data record. |
olitheolix/qtmacs | qtmacs/auxiliary.py | QtmacsModeBar.qteInsertMode | def qteInsertMode(self, pos: int, mode: str, value):
"""
Insert ``mode`` at position ``pos``.
If ``pos`` is negative then this is equivalent to ``pos=0``. If it
is larger than the number of modes in the list then it is appended
as the last element.
|Args|
* ``p... | python | def qteInsertMode(self, pos: int, mode: str, value):
"""
Insert ``mode`` at position ``pos``.
If ``pos`` is negative then this is equivalent to ``pos=0``. If it
is larger than the number of modes in the list then it is appended
as the last element.
|Args|
* ``p... | [
"def",
"qteInsertMode",
"(",
"self",
",",
"pos",
":",
"int",
",",
"mode",
":",
"str",
",",
"value",
")",
":",
"# Add the label to the list.",
"label",
"=",
"self",
".",
"_qteGetLabelInstance",
"(",
")",
"label",
".",
"setText",
"(",
"value",
")",
"self",
... | Insert ``mode`` at position ``pos``.
If ``pos`` is negative then this is equivalent to ``pos=0``. If it
is larger than the number of modes in the list then it is appended
as the last element.
|Args|
* ``pos`` (**int**): insertion point.
* ``mode`` (**str**): name of mo... | [
"Insert",
"mode",
"at",
"position",
"pos",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/auxiliary.py#L1339-L1365 | train | Insert a mode at the given position. |
olitheolix/qtmacs | qtmacs/auxiliary.py | QtmacsModeBar.qteRemoveMode | def qteRemoveMode(self, mode: str):
"""
Remove ``mode`` and associated label.
If ``mode`` does not exist then nothing happens and the method
returns **False**, otherwise **True**.
|Args|
* ``pos`` (**QRect**): size and position of new window.
* ``windowID`` (**... | python | def qteRemoveMode(self, mode: str):
"""
Remove ``mode`` and associated label.
If ``mode`` does not exist then nothing happens and the method
returns **False**, otherwise **True**.
|Args|
* ``pos`` (**QRect**): size and position of new window.
* ``windowID`` (**... | [
"def",
"qteRemoveMode",
"(",
"self",
",",
"mode",
":",
"str",
")",
":",
"# Search through the list for ``mode``.",
"for",
"idx",
",",
"item",
"in",
"enumerate",
"(",
"self",
".",
"_qteModeList",
")",
":",
"if",
"item",
"[",
"0",
"]",
"==",
"mode",
":",
"... | Remove ``mode`` and associated label.
If ``mode`` does not exist then nothing happens and the method
returns **False**, otherwise **True**.
|Args|
* ``pos`` (**QRect**): size and position of new window.
* ``windowID`` (**str**): unique window ID.
|Returns|
* ... | [
"Remove",
"mode",
"and",
"associated",
"label",
"."
] | 36253b082b82590f183fe154b053eb3a1e741be2 | https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/auxiliary.py#L1368-L1398 | train | Remove the mode and associated label. |
contains-io/typet | typet/validation.py | _BoundedMeta._get_bases | def _get_bases(type_):
# type: (type) -> Tuple[type, type]
"""Get the base and meta classes to use in creating a subclass.
Args:
type_: The type to subclass.
Returns:
A tuple containing two values: a base class, and a metaclass.
"""
try:
... | python | def _get_bases(type_):
# type: (type) -> Tuple[type, type]
"""Get the base and meta classes to use in creating a subclass.
Args:
type_: The type to subclass.
Returns:
A tuple containing two values: a base class, and a metaclass.
"""
try:
... | [
"def",
"_get_bases",
"(",
"type_",
")",
":",
"# type: (type) -> Tuple[type, type]",
"try",
":",
"class",
"_",
"(",
"type_",
")",
":",
"# type: ignore",
"\"\"\"Check if type_ is subclassable.\"\"\"",
"BaseClass",
"=",
"type_",
"except",
"TypeError",
":",
"BaseClass",
"... | Get the base and meta classes to use in creating a subclass.
Args:
type_: The type to subclass.
Returns:
A tuple containing two values: a base class, and a metaclass. | [
"Get",
"the",
"base",
"and",
"meta",
"classes",
"to",
"use",
"in",
"creating",
"a",
"subclass",
"."
] | ad5087c567af84db299eca186776e1cee228e442 | https://github.com/contains-io/typet/blob/ad5087c567af84db299eca186776e1cee228e442/typet/validation.py#L158-L180 | train | Returns the base and metaclasses to use in creating a subclass of the given type. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.