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
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.mouseReleaseEvent
def mouseReleaseEvent( self, event ): """ Overloads the base QGraphicsScene method to reset the selection \ signals and finish the connection. :param event <QMouseReleaseEvent> """ if event.button() == Qt.MidButton: self.setViewMode...
python
def mouseReleaseEvent( self, event ): """ Overloads the base QGraphicsScene method to reset the selection \ signals and finish the connection. :param event <QMouseReleaseEvent> """ if event.button() == Qt.MidButton: self.setViewMode...
[ "def", "mouseReleaseEvent", "(", "self", ",", "event", ")", ":", "if", "event", ".", "button", "(", ")", "==", "Qt", ".", "MidButton", ":", "self", ".", "setViewMode", "(", "False", ")", "event", ".", "accept", "(", ")", "return", "super", "(", "XNod...
Overloads the base QGraphicsScene method to reset the selection \ signals and finish the connection. :param event <QMouseReleaseEvent>
[ "Overloads", "the", "base", "QGraphicsScene", "method", "to", "reset", "the", "selection", "\\", "signals", "and", "finish", "the", "connection", ".", ":", "param", "event", "<QMouseReleaseEvent", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1069-L1097
train
Override this method to reset the selection blocked signals and finish the connection.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.nodeAt
def nodeAt( self, point ): """ Returns the node at the inputed positions. :return <XNode> """ items = self.items(point) for item in items: if ( isinstance(item, XNode) ): return item return None
python
def nodeAt( self, point ): """ Returns the node at the inputed positions. :return <XNode> """ items = self.items(point) for item in items: if ( isinstance(item, XNode) ): return item return None
[ "def", "nodeAt", "(", "self", ",", "point", ")", ":", "items", "=", "self", ".", "items", "(", "point", ")", "for", "item", "in", "items", ":", "if", "(", "isinstance", "(", "item", ",", "XNode", ")", ")", ":", "return", "item", "return", "None" ]
Returns the node at the inputed positions. :return <XNode>
[ "Returns", "the", "node", "at", "the", "inputed", "positions", ".", ":", "return", "<XNode", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1107-L1117
train
Returns the node at the inputed positions.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.rebuild
def rebuild( self ): """ Rebuilds the grid lines based on the current settings and \ scene width. This method is triggered automatically, and \ shouldn't need to be manually called. """ rect = self.sceneRect() x = rect.left() y = rect.top()...
python
def rebuild( self ): """ Rebuilds the grid lines based on the current settings and \ scene width. This method is triggered automatically, and \ shouldn't need to be manually called. """ rect = self.sceneRect() x = rect.left() y = rect.top()...
[ "def", "rebuild", "(", "self", ")", ":", "rect", "=", "self", ".", "sceneRect", "(", ")", "x", "=", "rect", ".", "left", "(", ")", "y", "=", "rect", ".", "top", "(", ")", "w", "=", "rect", ".", "width", "(", ")", "h", "=", "rect", ".", "hei...
Rebuilds the grid lines based on the current settings and \ scene width. This method is triggered automatically, and \ shouldn't need to be manually called.
[ "Rebuilds", "the", "grid", "lines", "based", "on", "the", "current", "settings", "and", "\\", "scene", "width", ".", "This", "method", "is", "triggered", "automatically", "and", "\\", "shouldn", "t", "need", "to", "be", "manually", "called", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1127-L1193
train
Rebuilds the grid lines based on the current settings and the scene width.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.removeItem
def removeItem( self, item ): """ Overloads the default QGraphicsScene method to handle cleanup and \ additional removal options for nodes. :param item <QGraphicsItem> :return <bool> """ # for nodes and connections, call the prepa...
python
def removeItem( self, item ): """ Overloads the default QGraphicsScene method to handle cleanup and \ additional removal options for nodes. :param item <QGraphicsItem> :return <bool> """ # for nodes and connections, call the prepa...
[ "def", "removeItem", "(", "self", ",", "item", ")", ":", "# for nodes and connections, call the prepareToRemove method before ", "# removing", "if", "(", "isinstance", "(", "item", ",", "XNode", ")", "or", "isinstance", "(", "item", ",", "XNodeConnection", ")", ")",...
Overloads the default QGraphicsScene method to handle cleanup and \ additional removal options for nodes. :param item <QGraphicsItem> :return <bool>
[ "Overloads", "the", "default", "QGraphicsScene", "method", "to", "handle", "cleanup", "and", "\\", "additional", "removal", "options", "for", "nodes", ".", ":", "param", "item", "<QGraphicsItem", ">", ":", "return", "<bool", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1195-L1225
train
Removes the item from the scene.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.removeItems
def removeItems(self, items): """ Removes all the inputed items from the scene at once. The \ list of items will be stored in an internal cache. When \ updating a node or connection's prepareToRemove method, \ any additional items that need to be removed as a result \ o...
python
def removeItems(self, items): """ Removes all the inputed items from the scene at once. The \ list of items will be stored in an internal cache. When \ updating a node or connection's prepareToRemove method, \ any additional items that need to be removed as a result \ o...
[ "def", "removeItems", "(", "self", ",", "items", ")", ":", "count", "=", "0", "self", ".", "_removalQueue", "=", "items", "blocked", "=", "self", ".", "signalsBlocked", "(", ")", "self", ".", "blockSignals", "(", "True", ")", "update", "=", "set", "(",...
Removes all the inputed items from the scene at once. The \ list of items will be stored in an internal cache. When \ updating a node or connection's prepareToRemove method, \ any additional items that need to be removed as a result \ of that object being removed, should use the \ ...
[ "Removes", "all", "the", "inputed", "items", "from", "the", "scene", "at", "once", ".", "The", "\\", "list", "of", "items", "will", "be", "stored", "in", "an", "internal", "cache", ".", "When", "\\", "updating", "a", "node", "or", "connection", "s", "p...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1227-L1266
train
Removes all the items from the scene at once.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.removeSelection
def removeSelection( self ): """ Removes the current selected items by calling the removeItems method. :sa removeItems :return <int> number removed """ results = self.removeItems( self.selectedItems() ) self.emitSelectionFinished() ...
python
def removeSelection( self ): """ Removes the current selected items by calling the removeItems method. :sa removeItems :return <int> number removed """ results = self.removeItems( self.selectedItems() ) self.emitSelectionFinished() ...
[ "def", "removeSelection", "(", "self", ")", ":", "results", "=", "self", ".", "removeItems", "(", "self", ".", "selectedItems", "(", ")", ")", "self", ".", "emitSelectionFinished", "(", ")", "return", "results" ]
Removes the current selected items by calling the removeItems method. :sa removeItems :return <int> number removed
[ "Removes", "the", "current", "selected", "items", "by", "calling", "the", "removeItems", "method", ".", ":", "sa", "removeItems", ":", "return", "<int", ">", "number", "removed" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1268-L1278
train
Removes the current selected items by calling removeItems.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.selectAll
def selectAll( self ): """ Selects all the items in the scene. """ currLayer = self._currentLayer for item in self.items(): layer = item.layer() if ( layer == currLayer or not layer ): item.setSelected(True)
python
def selectAll( self ): """ Selects all the items in the scene. """ currLayer = self._currentLayer for item in self.items(): layer = item.layer() if ( layer == currLayer or not layer ): item.setSelected(True)
[ "def", "selectAll", "(", "self", ")", ":", "currLayer", "=", "self", ".", "_currentLayer", "for", "item", "in", "self", ".", "items", "(", ")", ":", "layer", "=", "item", ".", "layer", "(", ")", "if", "(", "layer", "==", "currLayer", "or", "not", "...
Selects all the items in the scene.
[ "Selects", "all", "the", "items", "in", "the", "scene", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1280-L1288
train
Selects all the items in the scene.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.selectInvert
def selectInvert( self ): """ Inverts the currently selected items in the scene. """ currLayer = self._currentLayer for item in self.items(): layer = item.layer() if ( layer == currLayer or not layer ): item.setSelected(not item.isSelected(...
python
def selectInvert( self ): """ Inverts the currently selected items in the scene. """ currLayer = self._currentLayer for item in self.items(): layer = item.layer() if ( layer == currLayer or not layer ): item.setSelected(not item.isSelected(...
[ "def", "selectInvert", "(", "self", ")", ":", "currLayer", "=", "self", ".", "_currentLayer", "for", "item", "in", "self", ".", "items", "(", ")", ":", "layer", "=", "item", ".", "layer", "(", ")", "if", "(", "layer", "==", "currLayer", "or", "not", ...
Inverts the currently selected items in the scene.
[ "Inverts", "the", "currently", "selected", "items", "in", "the", "scene", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1290-L1298
train
Inverts the currently selected items in the scene.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.selectNone
def selectNone( self ): """ Deselects all the items in the scene. """ currLayer = self._currentLayer for item in self.items(): layer = item.layer() if ( layer == currLayer or not layer ): item.setSelected(False)
python
def selectNone( self ): """ Deselects all the items in the scene. """ currLayer = self._currentLayer for item in self.items(): layer = item.layer() if ( layer == currLayer or not layer ): item.setSelected(False)
[ "def", "selectNone", "(", "self", ")", ":", "currLayer", "=", "self", ".", "_currentLayer", "for", "item", "in", "self", ".", "items", "(", ")", ":", "layer", "=", "item", ".", "layer", "(", ")", "if", "(", "layer", "==", "currLayer", "or", "not", ...
Deselects all the items in the scene.
[ "Deselects", "all", "the", "items", "in", "the", "scene", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1300-L1308
train
Deselect all the items in the scene.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.selectedConnections
def selectedConnections( self ): """ Returns a list of the selected connections in a scene. :return <list> [ <XNodeConnection>, .. ] """ output = [] for item in self.selectedItems(): if ( isinstance(item, XNodeConnection) ): output...
python
def selectedConnections( self ): """ Returns a list of the selected connections in a scene. :return <list> [ <XNodeConnection>, .. ] """ output = [] for item in self.selectedItems(): if ( isinstance(item, XNodeConnection) ): output...
[ "def", "selectedConnections", "(", "self", ")", ":", "output", "=", "[", "]", "for", "item", "in", "self", ".", "selectedItems", "(", ")", ":", "if", "(", "isinstance", "(", "item", ",", "XNodeConnection", ")", ")", ":", "output", ".", "append", "(", ...
Returns a list of the selected connections in a scene. :return <list> [ <XNodeConnection>, .. ]
[ "Returns", "a", "list", "of", "the", "selected", "connections", "in", "a", "scene", ".", ":", "return", "<list", ">", "[", "<XNodeConnection", ">", "..", "]" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1310-L1320
train
Returns a list of the selected connections in a scene.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.selectedNodes
def selectedNodes( self ): """ Returns a list of the selected nodes in a scene. :return <list> [ <XNode>, .. ] """ output = [] for item in self.selectedItems(): if ( isinstance(item, XNode) ): output.append(item) return out...
python
def selectedNodes( self ): """ Returns a list of the selected nodes in a scene. :return <list> [ <XNode>, .. ] """ output = [] for item in self.selectedItems(): if ( isinstance(item, XNode) ): output.append(item) return out...
[ "def", "selectedNodes", "(", "self", ")", ":", "output", "=", "[", "]", "for", "item", "in", "self", ".", "selectedItems", "(", ")", ":", "if", "(", "isinstance", "(", "item", ",", "XNode", ")", ")", ":", "output", ".", "append", "(", "item", ")", ...
Returns a list of the selected nodes in a scene. :return <list> [ <XNode>, .. ]
[ "Returns", "a", "list", "of", "the", "selected", "nodes", "in", "a", "scene", ".", ":", "return", "<list", ">", "[", "<XNode", ">", "..", "]" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1322-L1332
train
Returns a list of the selected nodes in a scene.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.setAlternateGridColor
def setAlternateGridColor(self, color): """ Sets the alternate color for the smaller grid lines. :param color | <QColor> """ palette = self.palette() palette.setColor(palette.GridAlternateForeground, QColor(color))
python
def setAlternateGridColor(self, color): """ Sets the alternate color for the smaller grid lines. :param color | <QColor> """ palette = self.palette() palette.setColor(palette.GridAlternateForeground, QColor(color))
[ "def", "setAlternateGridColor", "(", "self", ",", "color", ")", ":", "palette", "=", "self", ".", "palette", "(", ")", "palette", ".", "setColor", "(", "palette", ".", "GridAlternateForeground", ",", "QColor", "(", "color", ")", ")" ]
Sets the alternate color for the smaller grid lines. :param color | <QColor>
[ "Sets", "the", "alternate", "color", "for", "the", "smaller", "grid", "lines", ".", ":", "param", "color", "|", "<QColor", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1343-L1350
train
Sets the alternate color for the smaller grid lines.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.setBackgroundBrush
def setBackgroundBrush(self, brush): """ Sets the background brush for this node scene. This will replace the default method as a convenience wrapper around the XNodePalette associated with this scene. :param color | <str> || <QColor> || <QBrush> """ ...
python
def setBackgroundBrush(self, brush): """ Sets the background brush for this node scene. This will replace the default method as a convenience wrapper around the XNodePalette associated with this scene. :param color | <str> || <QColor> || <QBrush> """ ...
[ "def", "setBackgroundBrush", "(", "self", ",", "brush", ")", ":", "if", "type", "(", "brush", ")", "==", "str", ":", "brush", "=", "QBrush", "(", "QColor", "(", "brush", ")", ")", "elif", "type", "(", "brush", ")", "==", "QColor", ":", "brush", "="...
Sets the background brush for this node scene. This will replace the default method as a convenience wrapper around the XNodePalette associated with this scene. :param color | <str> || <QColor> || <QBrush>
[ "Sets", "the", "background", "brush", "for", "this", "node", "scene", ".", "This", "will", "replace", "the", "default", "method", "as", "a", "convenience", "wrapper", "around", "the", "XNodePalette", "associated", "with", "this", "scene", ".", ":", "param", ...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1352-L1371
train
This will set the background brush for this node scene.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.setCenterLineColor
def setCenterLineColor(self, color): """ Sets the color for the center line. :return <QColor> """ palette = self.palette() palette.setColor(palette.GridCenterline, QColor(color))
python
def setCenterLineColor(self, color): """ Sets the color for the center line. :return <QColor> """ palette = self.palette() palette.setColor(palette.GridCenterline, QColor(color))
[ "def", "setCenterLineColor", "(", "self", ",", "color", ")", ":", "palette", "=", "self", ".", "palette", "(", ")", "palette", ".", "setColor", "(", "palette", ".", "GridCenterline", ",", "QColor", "(", "color", ")", ")" ]
Sets the color for the center line. :return <QColor>
[ "Sets", "the", "color", "for", "the", "center", "line", ".", ":", "return", "<QColor", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1373-L1380
train
Sets the color for the center line.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.setCurrentLayer
def setCurrentLayer(self, layer): """ Sets the current layer for this scene to the inputed layer. :param layer | <XNodeLayer> || None """ if self._currentLayer == layer: return False old = self._currentLayer self._currentLayer = ...
python
def setCurrentLayer(self, layer): """ Sets the current layer for this scene to the inputed layer. :param layer | <XNodeLayer> || None """ if self._currentLayer == layer: return False old = self._currentLayer self._currentLayer = ...
[ "def", "setCurrentLayer", "(", "self", ",", "layer", ")", ":", "if", "self", ".", "_currentLayer", "==", "layer", ":", "return", "False", "old", "=", "self", ".", "_currentLayer", "self", ".", "_currentLayer", "=", "layer", "if", "old", "is", "not", "Non...
Sets the current layer for this scene to the inputed layer. :param layer | <XNodeLayer> || None
[ "Sets", "the", "current", "layer", "for", "this", "scene", "to", "the", "inputed", "layer", ".", ":", "param", "layer", "|", "<XNodeLayer", ">", "||", "None" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1382-L1402
train
Sets the current layer for this scene to the inputed layer.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.setCurrentNode
def setCurrentNode(self, node): """ Sets the currently selected node in the scene. If \ multiple nodes are selected, then the last one selected \ will be considered the current one. :param node | <XNode> || None """ self.blockSignals(True) ...
python
def setCurrentNode(self, node): """ Sets the currently selected node in the scene. If \ multiple nodes are selected, then the last one selected \ will be considered the current one. :param node | <XNode> || None """ self.blockSignals(True) ...
[ "def", "setCurrentNode", "(", "self", ",", "node", ")", ":", "self", ".", "blockSignals", "(", "True", ")", "self", ".", "clearSelection", "(", ")", "if", "node", ":", "node", ".", "setSelected", "(", "True", ")", "self", ".", "blockSignals", "(", "Fal...
Sets the currently selected node in the scene. If \ multiple nodes are selected, then the last one selected \ will be considered the current one. :param node | <XNode> || None
[ "Sets", "the", "currently", "selected", "node", "in", "the", "scene", ".", "If", "\\", "multiple", "nodes", "are", "selected", "then", "the", "last", "one", "selected", "\\", "will", "be", "considered", "the", "current", "one", ".", ":", "param", "node", ...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1404-L1416
train
Sets the currently selected node in the scene.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.setModified
def setModified( self, state = True ): """ Flags the scene as being modified based on the inputed value. :param state <bool> """ if ( state == self._modified ): return self._modified = state self.emitModifiedStateChanged()
python
def setModified( self, state = True ): """ Flags the scene as being modified based on the inputed value. :param state <bool> """ if ( state == self._modified ): return self._modified = state self.emitModifiedStateChanged()
[ "def", "setModified", "(", "self", ",", "state", "=", "True", ")", ":", "if", "(", "state", "==", "self", ".", "_modified", ")", ":", "return", "self", ".", "_modified", "=", "state", "self", ".", "emitModifiedStateChanged", "(", ")" ]
Flags the scene as being modified based on the inputed value. :param state <bool>
[ "Flags", "the", "scene", "as", "being", "modified", "based", "on", "the", "inputed", "value", ".", ":", "param", "state", "<bool", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1436-L1446
train
Sets the state of the moderation of the current object.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.setGridColor
def setGridColor(self, color): """ Sets the color for the grid for this instance to the given color. :param color | <QColor> """ palette = self.palette() palette.setColor(palette.GridForeground, QColor(color))
python
def setGridColor(self, color): """ Sets the color for the grid for this instance to the given color. :param color | <QColor> """ palette = self.palette() palette.setColor(palette.GridForeground, QColor(color))
[ "def", "setGridColor", "(", "self", ",", "color", ")", ":", "palette", "=", "self", ".", "palette", "(", ")", "palette", ".", "setColor", "(", "palette", ".", "GridForeground", ",", "QColor", "(", "color", ")", ")" ]
Sets the color for the grid for this instance to the given color. :param color | <QColor>
[ "Sets", "the", "color", "for", "the", "grid", "for", "this", "instance", "to", "the", "given", "color", ".", ":", "param", "color", "|", "<QColor", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1495-L1502
train
Sets the color for the grid for this instance to the given color.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.setIsolationMode
def setIsolationMode( self, state ): """ Sets whether or not this widget is in isolation mode. When in isolation, only the selected node and its direct connections will be displayed. :param state | <bool> """ self._isolationMode = state sel...
python
def setIsolationMode( self, state ): """ Sets whether or not this widget is in isolation mode. When in isolation, only the selected node and its direct connections will be displayed. :param state | <bool> """ self._isolationMode = state sel...
[ "def", "setIsolationMode", "(", "self", ",", "state", ")", ":", "self", ".", "_isolationMode", "=", "state", "self", ".", "updateIsolated", "(", "force", "=", "True", ")", "self", ".", "update", "(", ")" ]
Sets whether or not this widget is in isolation mode. When in isolation, only the selected node and its direct connections will be displayed. :param state | <bool>
[ "Sets", "whether", "or", "not", "this", "widget", "is", "in", "isolation", "mode", ".", "When", "in", "isolation", "only", "the", "selected", "node", "and", "its", "direct", "connections", "will", "be", "displayed", ".", ":", "param", "state", "|", "<bool"...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1504-L1514
train
Sets whether or not this widget is in isolation mode.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.setMaxZoomAmount
def setMaxZoomAmount( self, amount ): """ Sets the maximum amount that a user can zoom into to. Default is 100. :param amount | <int> """ self._maxZoomAmount = amount view = self.mainView() if view: view.maxZoomAmountChanged.emit(amount)
python
def setMaxZoomAmount( self, amount ): """ Sets the maximum amount that a user can zoom into to. Default is 100. :param amount | <int> """ self._maxZoomAmount = amount view = self.mainView() if view: view.maxZoomAmountChanged.emit(amount)
[ "def", "setMaxZoomAmount", "(", "self", ",", "amount", ")", ":", "self", ".", "_maxZoomAmount", "=", "amount", "view", "=", "self", ".", "mainView", "(", ")", "if", "view", ":", "view", ".", "maxZoomAmountChanged", ".", "emit", "(", "amount", ")" ]
Sets the maximum amount that a user can zoom into to. Default is 100. :param amount | <int>
[ "Sets", "the", "maximum", "amount", "that", "a", "user", "can", "zoom", "into", "to", ".", "Default", "is", "100", ".", ":", "param", "amount", "|", "<int", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1516-L1525
train
Sets the maximum amount that a user can zoom into. Default is 100.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.setMinZoomAmount
def setMinZoomAmount( self, amount ): """ Sets the minimum amount that a user can zoom into to. Default is 100. :param amount | <int> """ self._minZoomAmount = amount view = self.mainView() if view: view.minZoomAmountChanged.emit(amount)
python
def setMinZoomAmount( self, amount ): """ Sets the minimum amount that a user can zoom into to. Default is 100. :param amount | <int> """ self._minZoomAmount = amount view = self.mainView() if view: view.minZoomAmountChanged.emit(amount)
[ "def", "setMinZoomAmount", "(", "self", ",", "amount", ")", ":", "self", ".", "_minZoomAmount", "=", "amount", "view", "=", "self", ".", "mainView", "(", ")", "if", "view", ":", "view", ".", "minZoomAmountChanged", ".", "emit", "(", "amount", ")" ]
Sets the minimum amount that a user can zoom into to. Default is 100. :param amount | <int>
[ "Sets", "the", "minimum", "amount", "that", "a", "user", "can", "zoom", "into", "to", ".", "Default", "is", "100", ".", ":", "param", "amount", "|", "<int", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1527-L1536
train
Sets the minimum amount that a user can zoom into. Default is 100.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.setSceneRect
def setSceneRect(self, *args): """ Overloads the base QGraphicsScene method to set the scene as \ dirty to trigger a rebuild on draw. :param *args | <QRectF> || <int> x, <int> y, <int> w, <int> h """ super(XNodeScene, self).setSceneRect(*args) self.s...
python
def setSceneRect(self, *args): """ Overloads the base QGraphicsScene method to set the scene as \ dirty to trigger a rebuild on draw. :param *args | <QRectF> || <int> x, <int> y, <int> w, <int> h """ super(XNodeScene, self).setSceneRect(*args) self.s...
[ "def", "setSceneRect", "(", "self", ",", "*", "args", ")", ":", "super", "(", "XNodeScene", ",", "self", ")", ".", "setSceneRect", "(", "*", "args", ")", "self", ".", "setDirty", "(", ")" ]
Overloads the base QGraphicsScene method to set the scene as \ dirty to trigger a rebuild on draw. :param *args | <QRectF> || <int> x, <int> y, <int> w, <int> h
[ "Overloads", "the", "base", "QGraphicsScene", "method", "to", "set", "the", "scene", "as", "\\", "dirty", "to", "trigger", "a", "rebuild", "on", "draw", ".", ":", "param", "*", "args", "|", "<QRectF", ">", "||", "<int", ">", "x", "<int", ">", "y", "<...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1546-L1554
train
Overloads the base QGraphicsScene method to set the scene as dirty
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.setViewMode
def setViewMode( self, state = True ): """ Starts the view mode for moving around the scene. """ if self._viewMode == state: return self._viewMode = state if state: self._mainView.setDragMode( self._mainView.ScrollHandDrag ) el...
python
def setViewMode( self, state = True ): """ Starts the view mode for moving around the scene. """ if self._viewMode == state: return self._viewMode = state if state: self._mainView.setDragMode( self._mainView.ScrollHandDrag ) el...
[ "def", "setViewMode", "(", "self", ",", "state", "=", "True", ")", ":", "if", "self", ".", "_viewMode", "==", "state", ":", "return", "self", ".", "_viewMode", "=", "state", "if", "state", ":", "self", ".", "_mainView", ".", "setDragMode", "(", "self",...
Starts the view mode for moving around the scene.
[ "Starts", "the", "view", "mode", "for", "moving", "around", "the", "scene", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1564-L1577
train
Sets the view mode for moving around the scene.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.setZoomAmount
def setZoomAmount(self, amount): """ Sets the zoom level for the current scene, updating all the \ views that it is connected to. :param amount <int> (100 based %) """ amount = max(self._minZoomAmount, amount) amount = min(self._maxZoomAmount, ...
python
def setZoomAmount(self, amount): """ Sets the zoom level for the current scene, updating all the \ views that it is connected to. :param amount <int> (100 based %) """ amount = max(self._minZoomAmount, amount) amount = min(self._maxZoomAmount, ...
[ "def", "setZoomAmount", "(", "self", ",", "amount", ")", ":", "amount", "=", "max", "(", "self", ".", "_minZoomAmount", ",", "amount", ")", "amount", "=", "min", "(", "self", ".", "_maxZoomAmount", ",", "amount", ")", "# only update when necessary", "if", ...
Sets the zoom level for the current scene, updating all the \ views that it is connected to. :param amount <int> (100 based %)
[ "Sets", "the", "zoom", "level", "for", "the", "current", "scene", "updating", "all", "the", "\\", "views", "that", "it", "is", "connected", "to", ".", ":", "param", "amount", "<int", ">", "(", "100", "based", "%", ")" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1579-L1602
train
Sets the zoom level for the current scene.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.startConnection
def startConnection( self, point, cls=None, output=True ): """ Starts creating a new connection from the given output point. \ If a connection class is not provided, then the \ defaultConnectionClass will be used. :param point <QPointF> ...
python
def startConnection( self, point, cls=None, output=True ): """ Starts creating a new connection from the given output point. \ If a connection class is not provided, then the \ defaultConnectionClass will be used. :param point <QPointF> ...
[ "def", "startConnection", "(", "self", ",", "point", ",", "cls", "=", "None", ",", "output", "=", "True", ")", ":", "# clear the last connection", "self", ".", "finishConnection", "(", "False", ")", "# create a new connection", "self", ".", "_activeConnection", ...
Starts creating a new connection from the given output point. \ If a connection class is not provided, then the \ defaultConnectionClass will be used. :param point <QPointF> cls subclass of <XNodeConnection> output ...
[ "Starts", "creating", "a", "new", "connection", "from", "the", "given", "output", "point", ".", "\\", "If", "a", "connection", "class", "is", "not", "provided", "then", "the", "\\", "defaultConnectionClass", "will", "be", "used", ".", ":", "param", "point", ...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1613-L1633
train
Starts creating a new connection from the given output point.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.uniqueNodeName
def uniqueNodeName( self, name ): """ Looks up the next available name for the inputed node name. :param name <str> """ nodenames = [] for node in self.items(): if ( isinstance(node, XNode) ): nodenames.append( node.objectNam...
python
def uniqueNodeName( self, name ): """ Looks up the next available name for the inputed node name. :param name <str> """ nodenames = [] for node in self.items(): if ( isinstance(node, XNode) ): nodenames.append( node.objectNam...
[ "def", "uniqueNodeName", "(", "self", ",", "name", ")", ":", "nodenames", "=", "[", "]", "for", "node", "in", "self", ".", "items", "(", ")", ":", "if", "(", "isinstance", "(", "node", ",", "XNode", ")", ")", ":", "nodenames", ".", "append", "(", ...
Looks up the next available name for the inputed node name. :param name <str>
[ "Looks", "up", "the", "next", "available", "name", "for", "the", "inputed", "node", "name", ".", ":", "param", "name", "<str", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1641-L1660
train
Returns the unique name for the inputed node name.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.updateIsolated
def updateIsolated( self, force = False ): """ Updates the visible state of nodes based on whether or not they are isolated. """ if ( not (self.isolationMode() or force) ): return # make sure all nodes are not being hidden because of isolation ...
python
def updateIsolated( self, force = False ): """ Updates the visible state of nodes based on whether or not they are isolated. """ if ( not (self.isolationMode() or force) ): return # make sure all nodes are not being hidden because of isolation ...
[ "def", "updateIsolated", "(", "self", ",", "force", "=", "False", ")", ":", "if", "(", "not", "(", "self", ".", "isolationMode", "(", ")", "or", "force", ")", ")", ":", "return", "# make sure all nodes are not being hidden because of isolation", "if", "(", "no...
Updates the visible state of nodes based on whether or not they are isolated.
[ "Updates", "the", "visible", "state", "of", "nodes", "based", "on", "whether", "or", "not", "they", "are", "isolated", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1662-L1689
train
Updates the visible state of nodes based on whether or not they are isolated.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.visibleNodes
def visibleNodes(self): """ Returns a list of the visible nodes in the scene. :return [<XNode>, ..] """ return filter(lambda x: isinstance(x, XNode) and x.isVisible(), self.items())
python
def visibleNodes(self): """ Returns a list of the visible nodes in the scene. :return [<XNode>, ..] """ return filter(lambda x: isinstance(x, XNode) and x.isVisible(), self.items())
[ "def", "visibleNodes", "(", "self", ")", ":", "return", "filter", "(", "lambda", "x", ":", "isinstance", "(", "x", ",", "XNode", ")", "and", "x", ".", "isVisible", "(", ")", ",", "self", ".", "items", "(", ")", ")" ]
Returns a list of the visible nodes in the scene. :return [<XNode>, ..]
[ "Returns", "a", "list", "of", "the", "visible", "nodes", "in", "the", "scene", ".", ":", "return", "[", "<XNode", ">", "..", "]" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1699-L1706
train
Returns a list of the visible nodes in the scene.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodescene.py
XNodeScene.wheelEvent
def wheelEvent( self, event ): """ Overloads the base QGraphicsScene wheelEvent method to \ use scrolling as a zooming mechanism, if the system \ is currently in the view mode. :param event <QWheelEvent> """ # check to see if the system is ...
python
def wheelEvent( self, event ): """ Overloads the base QGraphicsScene wheelEvent method to \ use scrolling as a zooming mechanism, if the system \ is currently in the view mode. :param event <QWheelEvent> """ # check to see if the system is ...
[ "def", "wheelEvent", "(", "self", ",", "event", ")", ":", "# check to see if the system is", "# currently in view mode", "if", "(", "self", ".", "inViewMode", "(", ")", ")", ":", "if", "(", "event", ".", "delta", "(", ")", "<", "0", ")", ":", "self", "."...
Overloads the base QGraphicsScene wheelEvent method to \ use scrolling as a zooming mechanism, if the system \ is currently in the view mode. :param event <QWheelEvent>
[ "Overloads", "the", "base", "QGraphicsScene", "wheelEvent", "method", "to", "\\", "use", "scrolling", "as", "a", "zooming", "mechanism", "if", "the", "system", "\\", "is", "currently", "in", "the", "view", "mode", ".", ":", "param", "event", "<QWheelEvent", ...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodescene.py#L1708-L1728
train
Overloads the base QGraphicsScene wheelEvent method to zoom in or out depending on the system state.
pmuller/versions
versions/constraints.py
merge
def merge(constraints): """Merge ``constraints``. It removes dupplicate, pruned and merged constraints. :param constraints: Current constraints. :type constraints: Iterable of :class:`.Constraint` objects. :rtype: :func:`list` of :class:`.Constraint` objects. :raises: :exc:`.ExclusiveConstrain...
python
def merge(constraints): """Merge ``constraints``. It removes dupplicate, pruned and merged constraints. :param constraints: Current constraints. :type constraints: Iterable of :class:`.Constraint` objects. :rtype: :func:`list` of :class:`.Constraint` objects. :raises: :exc:`.ExclusiveConstrain...
[ "def", "merge", "(", "constraints", ")", ":", "# Dictionary :class:`Operator`: set of :class:`Version`.", "operators", "=", "defaultdict", "(", "set", ")", "for", "constraint", "in", "constraints", ":", "operators", "[", "constraint", ".", "operator", "]", ".", "add...
Merge ``constraints``. It removes dupplicate, pruned and merged constraints. :param constraints: Current constraints. :type constraints: Iterable of :class:`.Constraint` objects. :rtype: :func:`list` of :class:`.Constraint` objects. :raises: :exc:`.ExclusiveConstraints`
[ "Merge", "constraints", "." ]
951bc3fd99b6a675190f11ee0752af1d7ff5b440
https://github.com/pmuller/versions/blob/951bc3fd99b6a675190f11ee0752af1d7ff5b440/versions/constraints.py#L109-L224
train
This function merges the current constraints.
pmuller/versions
versions/constraints.py
Constraints.match
def match(self, version): """Match ``version`` with this collection of constraints. :param version: Version to match against the constraint. :type version: :ref:`version expression <version-expressions>` or \ :class:`.Version` :rtype: ``True`` if ``version`` satisfies the constr...
python
def match(self, version): """Match ``version`` with this collection of constraints. :param version: Version to match against the constraint. :type version: :ref:`version expression <version-expressions>` or \ :class:`.Version` :rtype: ``True`` if ``version`` satisfies the constr...
[ "def", "match", "(", "self", ",", "version", ")", ":", "return", "all", "(", "constraint", ".", "match", "(", "version", ")", "for", "constraint", "in", "self", ".", "constraints", ")" ]
Match ``version`` with this collection of constraints. :param version: Version to match against the constraint. :type version: :ref:`version expression <version-expressions>` or \ :class:`.Version` :rtype: ``True`` if ``version`` satisfies the constraint, \ ``False`` if it doesn...
[ "Match", "version", "with", "this", "collection", "of", "constraints", "." ]
951bc3fd99b6a675190f11ee0752af1d7ff5b440
https://github.com/pmuller/versions/blob/951bc3fd99b6a675190f11ee0752af1d7ff5b440/versions/constraints.py#L46-L56
train
Match version with this collection of constraints.
pmuller/versions
versions/constraints.py
Constraints._merge
def _merge(self, constraint): """Wrapper for :func:`merge`. It merges `constraint` with current ones and returns the list of merged constraints. It does not modify the current object. :param constraint: The constraint(s) to merge with current constraints. :type: :class:...
python
def _merge(self, constraint): """Wrapper for :func:`merge`. It merges `constraint` with current ones and returns the list of merged constraints. It does not modify the current object. :param constraint: The constraint(s) to merge with current constraints. :type: :class:...
[ "def", "_merge", "(", "self", ",", "constraint", ")", ":", "if", "isinstance", "(", "constraint", ",", "basestring", ")", ":", "constraints", "=", "Constraints", ".", "parse", "(", "constraint", ")", ".", "constraints", "elif", "isinstance", "(", "constraint...
Wrapper for :func:`merge`. It merges `constraint` with current ones and returns the list of merged constraints. It does not modify the current object. :param constraint: The constraint(s) to merge with current constraints. :type: :class:`Constraint`, :class:`Constraints` or `st...
[ "Wrapper", "for", ":", "func", ":", "merge", "." ]
951bc3fd99b6a675190f11ee0752af1d7ff5b440
https://github.com/pmuller/versions/blob/951bc3fd99b6a675190f11ee0752af1d7ff5b440/versions/constraints.py#L68-L90
train
Wrapper for merge.
pmuller/versions
versions/constraints.py
Constraints.parse
def parse(cls, constraints_expression): """Parses a :ref:`constraints_expression <constraints-expressions>` and returns a :class:`Constraints` object. """ constraint_exprs = re.split(r'\s*,\s*', constraints_expression) return Constraints(merge(Constraint.parse(constraint_expr) ...
python
def parse(cls, constraints_expression): """Parses a :ref:`constraints_expression <constraints-expressions>` and returns a :class:`Constraints` object. """ constraint_exprs = re.split(r'\s*,\s*', constraints_expression) return Constraints(merge(Constraint.parse(constraint_expr) ...
[ "def", "parse", "(", "cls", ",", "constraints_expression", ")", ":", "constraint_exprs", "=", "re", ".", "split", "(", "r'\\s*,\\s*'", ",", "constraints_expression", ")", "return", "Constraints", "(", "merge", "(", "Constraint", ".", "parse", "(", "constraint_ex...
Parses a :ref:`constraints_expression <constraints-expressions>` and returns a :class:`Constraints` object.
[ "Parses", "a", ":", "ref", ":", "constraints_expression", "<constraints", "-", "expressions", ">", "and", "returns", "a", ":", "class", ":", "Constraints", "object", "." ]
951bc3fd99b6a675190f11ee0752af1d7ff5b440
https://github.com/pmuller/versions/blob/951bc3fd99b6a675190f11ee0752af1d7ff5b440/versions/constraints.py#L100-L106
train
Parses a : ref : constraints_expression <constraints - expressions > and returns a : class:`Constraints object.
bitesofcode/projexui
projexui/xexporter.py
XExporter.setFlag
def setFlag(self, flag, state=True): """ Sets whether or not the given flag is enabled or disabled. :param flag | <XExporter.Flags> """ has_flag = self.testFlag(flag) if has_flag and not state: self.setFlags(self.flags() ^ flag) ...
python
def setFlag(self, flag, state=True): """ Sets whether or not the given flag is enabled or disabled. :param flag | <XExporter.Flags> """ has_flag = self.testFlag(flag) if has_flag and not state: self.setFlags(self.flags() ^ flag) ...
[ "def", "setFlag", "(", "self", ",", "flag", ",", "state", "=", "True", ")", ":", "has_flag", "=", "self", ".", "testFlag", "(", "flag", ")", "if", "has_flag", "and", "not", "state", ":", "self", ".", "setFlags", "(", "self", ".", "flags", "(", ")",...
Sets whether or not the given flag is enabled or disabled. :param flag | <XExporter.Flags>
[ "Sets", "whether", "or", "not", "the", "given", "flag", "is", "enabled", "or", "disabled", ".", ":", "param", "flag", "|", "<XExporter", ".", "Flags", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/xexporter.py#L68-L78
train
Sets whether or not the given flag is enabled or disabled.
bitesofcode/projexui
projexui/xexporter.py
XExporter.plugins
def plugins(flags=None): """ Returns the plugins registered for the exporter. If the optional flags are set then only plugins with the inputed flags will be returned. :param flags | <XExporter.Flags> """ XExporter.init() p...
python
def plugins(flags=None): """ Returns the plugins registered for the exporter. If the optional flags are set then only plugins with the inputed flags will be returned. :param flags | <XExporter.Flags> """ XExporter.init() p...
[ "def", "plugins", "(", "flags", "=", "None", ")", ":", "XExporter", ".", "init", "(", ")", "plugs", "=", "XExporter", ".", "_plugins", "[", ":", "]", "if", "flags", "is", "not", "None", ":", "return", "filter", "(", "lambda", "x", ":", "x", ".", ...
Returns the plugins registered for the exporter. If the optional flags are set then only plugins with the inputed flags will be returned. :param flags | <XExporter.Flags>
[ "Returns", "the", "plugins", "registered", "for", "the", "exporter", ".", "If", "the", "optional", "flags", "are", "set", "then", "only", "plugins", "with", "the", "inputed", "flags", "will", "be", "returned", ".", ":", "param", "flags", "|", "<XExporter", ...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/xexporter.py#L104-L117
train
Returns the list of plugins registered for the exporter.
whiteclover/dbpy
db/__init__.py
setup
def setup(config, minconn=5, maxconn=10, adapter='mysql', key='default', slave=False): """Setup database :param config dict: is the db adapter config :param key string: the key to identify dabtabase :param adapter string: the dabtabase adapter current support mysql only :param minconn int: the mi...
python
def setup(config, minconn=5, maxconn=10, adapter='mysql', key='default', slave=False): """Setup database :param config dict: is the db adapter config :param key string: the key to identify dabtabase :param adapter string: the dabtabase adapter current support mysql only :param minconn int: the mi...
[ "def", "setup", "(", "config", ",", "minconn", "=", "5", ",", "maxconn", "=", "10", ",", "adapter", "=", "'mysql'", ",", "key", "=", "'default'", ",", "slave", "=", "False", ")", ":", "global", "__db", "if", "'.'", "in", "key", ":", "raise", "TypeE...
Setup database :param config dict: is the db adapter config :param key string: the key to identify dabtabase :param adapter string: the dabtabase adapter current support mysql only :param minconn int: the min connection for connection pool :param maxconn int: the max connection for connection pool ...
[ "Setup", "database" ]
3d9ce85f55cfb39cced22081e525f79581b26b3a
https://github.com/whiteclover/dbpy/blob/3d9ce85f55cfb39cced22081e525f79581b26b3a/db/__init__.py#L54-L91
train
Setup the database for the current n - grams.
whiteclover/dbpy
db/__init__.py
query
def query(sql, args=None, many=None, as_dict=False, key='default'): """The connection raw sql query, when select table, show table to fetch records, it is compatible the dbi execute method:: :param sql string: the sql stamtement like 'select * from %s' :param args list: Wen set None, will use d...
python
def query(sql, args=None, many=None, as_dict=False, key='default'): """The connection raw sql query, when select table, show table to fetch records, it is compatible the dbi execute method:: :param sql string: the sql stamtement like 'select * from %s' :param args list: Wen set None, will use d...
[ "def", "query", "(", "sql", ",", "args", "=", "None", ",", "many", "=", "None", ",", "as_dict", "=", "False", ",", "key", "=", "'default'", ")", ":", "database", "=", "choice", "(", "__db", "[", "key", "+", "'.slave'", "]", ")", "return", "database...
The connection raw sql query, when select table, show table to fetch records, it is compatible the dbi execute method:: :param sql string: the sql stamtement like 'select * from %s' :param args list: Wen set None, will use dbi execute(sql), else dbi execute(sql, args), the args keep the ori...
[ "The", "connection", "raw", "sql", "query", "when", "select", "table", "show", "table", "to", "fetch", "records", "it", "is", "compatible", "the", "dbi", "execute", "method", "::" ]
3d9ce85f55cfb39cced22081e525f79581b26b3a
https://github.com/whiteclover/dbpy/blob/3d9ce85f55cfb39cced22081e525f79581b26b3a/db/__init__.py#L94-L107
train
The raw sql query method
whiteclover/dbpy
db/__init__.py
execute
def execute(sql, args=None, key='default'): """It is used for update, delete records. :param sql string: the sql stamtement like 'select * from %s' :param args list: Wen set None, will use dbi execute(sql), else dbi execute(sql, args), the args keep the original rules, it shuld be tuple or lis...
python
def execute(sql, args=None, key='default'): """It is used for update, delete records. :param sql string: the sql stamtement like 'select * from %s' :param args list: Wen set None, will use dbi execute(sql), else dbi execute(sql, args), the args keep the original rules, it shuld be tuple or lis...
[ "def", "execute", "(", "sql", ",", "args", "=", "None", ",", "key", "=", "'default'", ")", ":", "database", "=", "__db", "[", "key", "]", "return", "database", ".", "execute", "(", "sql", ",", "args", ")" ]
It is used for update, delete records. :param sql string: the sql stamtement like 'select * from %s' :param args list: Wen set None, will use dbi execute(sql), else dbi execute(sql, args), the args keep the original rules, it shuld be tuple or list of list :param key: a key for your dabtabase ...
[ "It", "is", "used", "for", "update", "delete", "records", "." ]
3d9ce85f55cfb39cced22081e525f79581b26b3a
https://github.com/whiteclover/dbpy/blob/3d9ce85f55cfb39cced22081e525f79581b26b3a/db/__init__.py#L110-L124
train
This function is used for update delete records.
whiteclover/dbpy
db/__init__.py
select
def select(table, key='default'): """Select dialect :param key: a key for your dabtabase you wanna use """ database = choice(__db[key + '.slave']) return database.select(table)
python
def select(table, key='default'): """Select dialect :param key: a key for your dabtabase you wanna use """ database = choice(__db[key + '.slave']) return database.select(table)
[ "def", "select", "(", "table", ",", "key", "=", "'default'", ")", ":", "database", "=", "choice", "(", "__db", "[", "key", "+", "'.slave'", "]", ")", "return", "database", ".", "select", "(", "table", ")" ]
Select dialect :param key: a key for your dabtabase you wanna use
[ "Select", "dialect" ]
3d9ce85f55cfb39cced22081e525f79581b26b3a
https://github.com/whiteclover/dbpy/blob/3d9ce85f55cfb39cced22081e525f79581b26b3a/db/__init__.py#L136-L143
train
Select dialect for a table
whiteclover/dbpy
db/__init__.py
database
def database(key='default', slave=False): """datbase dialect :param key: a key for your dabtabase you wanna use :param slave boolean: If True the database can be read only, Defaults False. """ if slave: key += '.slave' return choice(__db[key]) return __db.get(key)
python
def database(key='default', slave=False): """datbase dialect :param key: a key for your dabtabase you wanna use :param slave boolean: If True the database can be read only, Defaults False. """ if slave: key += '.slave' return choice(__db[key]) return __db.get(key)
[ "def", "database", "(", "key", "=", "'default'", ",", "slave", "=", "False", ")", ":", "if", "slave", ":", "key", "+=", "'.slave'", "return", "choice", "(", "__db", "[", "key", "]", ")", "return", "__db", ".", "get", "(", "key", ")" ]
datbase dialect :param key: a key for your dabtabase you wanna use :param slave boolean: If True the database can be read only, Defaults False.
[ "datbase", "dialect" ]
3d9ce85f55cfb39cced22081e525f79581b26b3a
https://github.com/whiteclover/dbpy/blob/3d9ce85f55cfb39cced22081e525f79581b26b3a/db/__init__.py#L173-L182
train
get a random database entry
evansd/django-envsettings
envsettings/cache.py
CacheSettings.set_memcached_backend
def set_memcached_backend(self, config): """ Select the most suitable Memcached backend based on the config and on what's installed """ # This is the preferred backend as it is the fastest and most fully # featured, so we use this by default config['BACKEND'] = 'd...
python
def set_memcached_backend(self, config): """ Select the most suitable Memcached backend based on the config and on what's installed """ # This is the preferred backend as it is the fastest and most fully # featured, so we use this by default config['BACKEND'] = 'd...
[ "def", "set_memcached_backend", "(", "self", ",", "config", ")", ":", "# This is the preferred backend as it is the fastest and most fully", "# featured, so we use this by default", "config", "[", "'BACKEND'", "]", "=", "'django_pylibmc.memcached.PyLibMCCache'", "if", "is_importabl...
Select the most suitable Memcached backend based on the config and on what's installed
[ "Select", "the", "most", "suitable", "Memcached", "backend", "based", "on", "the", "config", "and", "on", "what", "s", "installed" ]
541932af261d5369f211f836a238dc020ee316e8
https://github.com/evansd/django-envsettings/blob/541932af261d5369f211f836a238dc020ee316e8/envsettings/cache.py#L63-L86
train
Set Memcached backend based on the config and .
bitesofcode/projexui
projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py
XOrbQueryEntryWidget.addEntry
def addEntry(self): """ This will either add a new widget or switch the joiner based on the state of the entry """ joiner = self.joiner() curr_joiner = self._containerWidget.currentJoiner() # update the joining option if it is modified if...
python
def addEntry(self): """ This will either add a new widget or switch the joiner based on the state of the entry """ joiner = self.joiner() curr_joiner = self._containerWidget.currentJoiner() # update the joining option if it is modified if...
[ "def", "addEntry", "(", "self", ")", ":", "joiner", "=", "self", ".", "joiner", "(", ")", "curr_joiner", "=", "self", ".", "_containerWidget", ".", "currentJoiner", "(", ")", "# update the joining option if it is modified\r", "if", "joiner", "!=", "curr_joiner", ...
This will either add a new widget or switch the joiner based on the state of the entry
[ "This", "will", "either", "add", "a", "new", "widget", "or", "switch", "the", "joiner", "based", "on", "the", "state", "of", "the", "entry" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py#L68-L85
train
Add a new entry to the list of entries.
bitesofcode/projexui
projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py
XOrbQueryEntryWidget.assignPlugin
def assignPlugin(self): """ Assigns an editor based on the current column for this schema. """ self.uiOperatorDDL.blockSignals(True) self.uiOperatorDDL.clear() plugin = self.currentPlugin() if plugin: flags = 0 if not sel...
python
def assignPlugin(self): """ Assigns an editor based on the current column for this schema. """ self.uiOperatorDDL.blockSignals(True) self.uiOperatorDDL.clear() plugin = self.currentPlugin() if plugin: flags = 0 if not sel...
[ "def", "assignPlugin", "(", "self", ")", ":", "self", ".", "uiOperatorDDL", ".", "blockSignals", "(", "True", ")", "self", ".", "uiOperatorDDL", ".", "clear", "(", ")", "plugin", "=", "self", ".", "currentPlugin", "(", ")", "if", "plugin", ":", "flags", ...
Assigns an editor based on the current column for this schema.
[ "Assigns", "an", "editor", "based", "on", "the", "current", "column", "for", "this", "schema", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py#L88-L104
train
Assigns an editor based on the current column for this schema.
bitesofcode/projexui
projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py
XOrbQueryEntryWidget.assignEditor
def assignEditor(self): """ Assigns the editor for this entry based on the plugin. """ plugin = self.currentPlugin() column = self.currentColumn() value = self.currentValue() if not plugin: self.setEditor(None) return ...
python
def assignEditor(self): """ Assigns the editor for this entry based on the plugin. """ plugin = self.currentPlugin() column = self.currentColumn() value = self.currentValue() if not plugin: self.setEditor(None) return ...
[ "def", "assignEditor", "(", "self", ")", ":", "plugin", "=", "self", ".", "currentPlugin", "(", ")", "column", "=", "self", ".", "currentColumn", "(", ")", "value", "=", "self", ".", "currentValue", "(", ")", "if", "not", "plugin", ":", "self", ".", ...
Assigns the editor for this entry based on the plugin.
[ "Assigns", "the", "editor", "for", "this", "entry", "based", "on", "the", "plugin", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py#L107-L124
train
Assigns the editor for this entry based on the plugin.
bitesofcode/projexui
projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py
XOrbQueryEntryWidget.query
def query(self): """ Returns the query instance for this widget. :return <orb.Query> || <orb.QueryCompound> """ queryWidget = self.queryWidget() # check to see if there is an active container for this widget container = queryWidget.c...
python
def query(self): """ Returns the query instance for this widget. :return <orb.Query> || <orb.QueryCompound> """ queryWidget = self.queryWidget() # check to see if there is an active container for this widget container = queryWidget.c...
[ "def", "query", "(", "self", ")", ":", "queryWidget", "=", "self", ".", "queryWidget", "(", ")", "# check to see if there is an active container for this widget\r", "container", "=", "queryWidget", ".", "containerFor", "(", "self", ")", "if", "container", ":", "retu...
Returns the query instance for this widget. :return <orb.Query> || <orb.QueryCompound>
[ "Returns", "the", "query", "instance", "for", "this", "widget", ".", ":", "return", "<orb", ".", "Query", ">", "||", "<orb", ".", "QueryCompound", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py#L175-L202
train
Returns the query instance for this widget.
bitesofcode/projexui
projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py
XOrbQueryEntryWidget.joiner
def joiner(self): """ Returns the joiner operator type for this entry widget. :return <QueryCompound.Op> """ act = self.uiJoinSBTN.currentAction() if not act: return None elif act.text() == 'AND': return QueryCompound...
python
def joiner(self): """ Returns the joiner operator type for this entry widget. :return <QueryCompound.Op> """ act = self.uiJoinSBTN.currentAction() if not act: return None elif act.text() == 'AND': return QueryCompound...
[ "def", "joiner", "(", "self", ")", ":", "act", "=", "self", ".", "uiJoinSBTN", ".", "currentAction", "(", ")", "if", "not", "act", ":", "return", "None", "elif", "act", ".", "text", "(", ")", "==", "'AND'", ":", "return", "QueryCompound", ".", "Op", ...
Returns the joiner operator type for this entry widget. :return <QueryCompound.Op>
[ "Returns", "the", "joiner", "operator", "type", "for", "this", "entry", "widget", ".", ":", "return", "<QueryCompound", ".", "Op", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py#L204-L215
train
Returns the joiner operator type for this entry widget.
bitesofcode/projexui
projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py
XOrbQueryEntryWidget.refreshButtons
def refreshButtons(self): """ Refreshes the buttons for building this sql query. """ last = self._last first = self._first joiner = self._containerWidget.currentJoiner() # the first button set can contain the toggle options if f...
python
def refreshButtons(self): """ Refreshes the buttons for building this sql query. """ last = self._last first = self._first joiner = self._containerWidget.currentJoiner() # the first button set can contain the toggle options if f...
[ "def", "refreshButtons", "(", "self", ")", ":", "last", "=", "self", ".", "_last", "first", "=", "self", ".", "_first", "joiner", "=", "self", ".", "_containerWidget", ".", "currentJoiner", "(", ")", "# the first button set can contain the toggle options\r", "if",...
Refreshes the buttons for building this sql query.
[ "Refreshes", "the", "buttons", "for", "building", "this", "sql", "query", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py#L223-L250
train
Refreshes the buttons for building this sql query.
bitesofcode/projexui
projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py
XOrbQueryEntryWidget.setEditor
def setEditor(self, editor): """ Sets the editor widget for this entry system. :param editor | <QWidget> || None """ widget = self.uiEditorAREA.takeWidget() if widget: widget.close() if editor is not None: ...
python
def setEditor(self, editor): """ Sets the editor widget for this entry system. :param editor | <QWidget> || None """ widget = self.uiEditorAREA.takeWidget() if widget: widget.close() if editor is not None: ...
[ "def", "setEditor", "(", "self", ",", "editor", ")", ":", "widget", "=", "self", ".", "uiEditorAREA", ".", "takeWidget", "(", ")", "if", "widget", ":", "widget", ".", "close", "(", ")", "if", "editor", "is", "not", "None", ":", "editor", ".", "setMin...
Sets the editor widget for this entry system. :param editor | <QWidget> || None
[ "Sets", "the", "editor", "widget", "for", "this", "entry", "system", ".", ":", "param", "editor", "|", "<QWidget", ">", "||", "None" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py#L268-L280
train
Sets the editor widget for this entry system.
bitesofcode/projexui
projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py
XOrbQueryEntryWidget.setQuery
def setQuery(self, query): """ Sets the query instance for this widget to the inputed query. :param query | <orb.Query> || <orb.QueryCompound> """ if not query.isNull() and hash(query) == hash(self._query): return self._query = ...
python
def setQuery(self, query): """ Sets the query instance for this widget to the inputed query. :param query | <orb.Query> || <orb.QueryCompound> """ if not query.isNull() and hash(query) == hash(self._query): return self._query = ...
[ "def", "setQuery", "(", "self", ",", "query", ")", ":", "if", "not", "query", ".", "isNull", "(", ")", "and", "hash", "(", "query", ")", "==", "hash", "(", "self", ".", "_query", ")", ":", "return", "self", ".", "_query", "=", "query", "if", "Que...
Sets the query instance for this widget to the inputed query. :param query | <orb.Query> || <orb.QueryCompound>
[ "Sets", "the", "query", "instance", "for", "this", "widget", "to", "the", "inputed", "query", ".", ":", "param", "query", "|", "<orb", ".", "Query", ">", "||", "<orb", ".", "QueryCompound", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py#L282-L323
train
Sets the query instance for this widget to the inputed query.
bitesofcode/projexui
projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py
XOrbQueryEntryWidget.setJoiner
def setJoiner(self, joiner): """ Sets the join operator type for this entry widget to the given value. :param joiner | <QueryCompound.Op> """ text = QueryCompound.Op[joiner].upper() if self._first: if self._last: ...
python
def setJoiner(self, joiner): """ Sets the join operator type for this entry widget to the given value. :param joiner | <QueryCompound.Op> """ text = QueryCompound.Op[joiner].upper() if self._first: if self._last: ...
[ "def", "setJoiner", "(", "self", ",", "joiner", ")", ":", "text", "=", "QueryCompound", ".", "Op", "[", "joiner", "]", ".", "upper", "(", ")", "if", "self", ".", "_first", ":", "if", "self", ".", "_last", ":", "self", ".", "uiJoinSBTN", ".", "setCu...
Sets the join operator type for this entry widget to the given value. :param joiner | <QueryCompound.Op>
[ "Sets", "the", "join", "operator", "type", "for", "this", "entry", "widget", "to", "the", "given", "value", ".", ":", "param", "joiner", "|", "<QueryCompound", ".", "Op", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py#L333-L348
train
Sets the joiner type for this entry widget to the given value.
bitesofcode/projexui
projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py
XOrbQueryEntryWidget.updateJoin
def updateJoin(self): """ Updates the joining method used by the system. """ text = self.uiJoinSBTN.currentAction().text() if text == 'AND': joiner = QueryCompound.Op.And else: joiner = QueryCompound.Op.Or self._container...
python
def updateJoin(self): """ Updates the joining method used by the system. """ text = self.uiJoinSBTN.currentAction().text() if text == 'AND': joiner = QueryCompound.Op.And else: joiner = QueryCompound.Op.Or self._container...
[ "def", "updateJoin", "(", "self", ")", ":", "text", "=", "self", ".", "uiJoinSBTN", ".", "currentAction", "(", ")", ".", "text", "(", ")", "if", "text", "==", "'AND'", ":", "joiner", "=", "QueryCompound", ".", "Op", ".", "And", "else", ":", "joiner",...
Updates the joining method used by the system.
[ "Updates", "the", "joining", "method", "used", "by", "the", "system", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbquerywidget/xorbqueryentrywidget.py#L350-L360
train
Updates the joining method used by the system.
lingpy/sinopy
src/sinopy/sinopy.py
is_chinese
def is_chinese(name): """ Check if a symbol is a Chinese character. Note ---- Taken from http://stackoverflow.com/questions/16441633/python-2-7-test-if-characters-in-a-string-are-all-chinese-characters """ if not name: return False for ch in name: ordch = ord(ch) ...
python
def is_chinese(name): """ Check if a symbol is a Chinese character. Note ---- Taken from http://stackoverflow.com/questions/16441633/python-2-7-test-if-characters-in-a-string-are-all-chinese-characters """ if not name: return False for ch in name: ordch = ord(ch) ...
[ "def", "is_chinese", "(", "name", ")", ":", "if", "not", "name", ":", "return", "False", "for", "ch", "in", "name", ":", "ordch", "=", "ord", "(", "ch", ")", "if", "not", "(", "0x3400", "<=", "ordch", "<=", "0x9fff", ")", "and", "not", "(", "0x20...
Check if a symbol is a Chinese character. Note ---- Taken from http://stackoverflow.com/questions/16441633/python-2-7-test-if-characters-in-a-string-are-all-chinese-characters
[ "Check", "if", "a", "symbol", "is", "a", "Chinese", "character", "." ]
59a47fcdfae3e0000ac6d2b3d7919bf875ec2056
https://github.com/lingpy/sinopy/blob/59a47fcdfae3e0000ac6d2b3d7919bf875ec2056/src/sinopy/sinopy.py#L10-L26
train
Check if a symbol is a Chinese character.
lingpy/sinopy
src/sinopy/sinopy.py
pinyin
def pinyin(char, variant='mandarin', sep=' ', out='tones'): """ Retrieve Pinyin of a character. """ if len(char) > 1: return sep.join([pinyin(c, variant=variant, sep=sep, out=out) for c in char]) if not is_chinese(char): return char if char in _cd.GBK: char = gbk2big5(...
python
def pinyin(char, variant='mandarin', sep=' ', out='tones'): """ Retrieve Pinyin of a character. """ if len(char) > 1: return sep.join([pinyin(c, variant=variant, sep=sep, out=out) for c in char]) if not is_chinese(char): return char if char in _cd.GBK: char = gbk2big5(...
[ "def", "pinyin", "(", "char", ",", "variant", "=", "'mandarin'", ",", "sep", "=", "' '", ",", "out", "=", "'tones'", ")", ":", "if", "len", "(", "char", ")", ">", "1", ":", "return", "sep", ".", "join", "(", "[", "pinyin", "(", "c", ",", "varia...
Retrieve Pinyin of a character.
[ "Retrieve", "Pinyin", "of", "a", "character", "." ]
59a47fcdfae3e0000ac6d2b3d7919bf875ec2056
https://github.com/lingpy/sinopy/blob/59a47fcdfae3e0000ac6d2b3d7919bf875ec2056/src/sinopy/sinopy.py#L29-L47
train
Retrieve Pinyin of a character.
lingpy/sinopy
src/sinopy/sinopy.py
character_from_structure
def character_from_structure(motivation): """Find a character for a given structure.""" assert len(motivation) == 3 _c = { "+": "⿰", "-": "⿱", '>': "⿱", "手": "扌", "人": "亻", "刀": "刂", "丝": "糹", "水": "氵", ...
python
def character_from_structure(motivation): """Find a character for a given structure.""" assert len(motivation) == 3 _c = { "+": "⿰", "-": "⿱", '>': "⿱", "手": "扌", "人": "亻", "刀": "刂", "丝": "糹", "水": "氵", ...
[ "def", "character_from_structure", "(", "motivation", ")", ":", "assert", "len", "(", "motivation", ")", "==", "3", "_c", "=", "{", "\"+\"", ":", "\"⿰\",", "", "\"-\"", ":", "\"⿱\",", "", "'>'", ":", "\"⿱\",", "", "\"手\": ", "\"", "\",", "", "\"人\": ",...
Find a character for a given structure.
[ "Find", "a", "character", "for", "a", "given", "structure", "." ]
59a47fcdfae3e0000ac6d2b3d7919bf875ec2056
https://github.com/lingpy/sinopy/blob/59a47fcdfae3e0000ac6d2b3d7919bf875ec2056/src/sinopy/sinopy.py#L50-L66
train
Find a character for a given structure.
lingpy/sinopy
src/sinopy/sinopy.py
parse_baxter
def parse_baxter(reading): """ Parse a Baxter string and render it with all its contents, namely initial, medial, final, and tone. """ initial = '' medial = '' final = '' tone = '' # determine environments inienv = True medienv = False finenv = False tonenv = Fa...
python
def parse_baxter(reading): """ Parse a Baxter string and render it with all its contents, namely initial, medial, final, and tone. """ initial = '' medial = '' final = '' tone = '' # determine environments inienv = True medienv = False finenv = False tonenv = Fa...
[ "def", "parse_baxter", "(", "reading", ")", ":", "initial", "=", "''", "medial", "=", "''", "final", "=", "''", "tone", "=", "''", "# determine environments", "inienv", "=", "True", "medienv", "=", "False", "finenv", "=", "False", "tonenv", "=", "False", ...
Parse a Baxter string and render it with all its contents, namely initial, medial, final, and tone.
[ "Parse", "a", "Baxter", "string", "and", "render", "it", "with", "all", "its", "contents", "namely", "initial", "medial", "final", "and", "tone", "." ]
59a47fcdfae3e0000ac6d2b3d7919bf875ec2056
https://github.com/lingpy/sinopy/blob/59a47fcdfae3e0000ac6d2b3d7919bf875ec2056/src/sinopy/sinopy.py#L69-L128
train
Parse a Baxter string and return all its contents medial final and tone.
lingpy/sinopy
src/sinopy/sinopy.py
chars2gloss
def chars2gloss(chars): """ Get the TLS basic gloss for a characters. """ out = [] chars = gbk2big5(chars) for char in chars: tmp = [] if char in _cd.TLS: for entry in _cd.TLS[char]: baxter = _cd.TLS[char][entry]['UNIHAN_GLOSS'] if baxt...
python
def chars2gloss(chars): """ Get the TLS basic gloss for a characters. """ out = [] chars = gbk2big5(chars) for char in chars: tmp = [] if char in _cd.TLS: for entry in _cd.TLS[char]: baxter = _cd.TLS[char][entry]['UNIHAN_GLOSS'] if baxt...
[ "def", "chars2gloss", "(", "chars", ")", ":", "out", "=", "[", "]", "chars", "=", "gbk2big5", "(", "chars", ")", "for", "char", "in", "chars", ":", "tmp", "=", "[", "]", "if", "char", "in", "_cd", ".", "TLS", ":", "for", "entry", "in", "_cd", "...
Get the TLS basic gloss for a characters.
[ "Get", "the", "TLS", "basic", "gloss", "for", "a", "characters", "." ]
59a47fcdfae3e0000ac6d2b3d7919bf875ec2056
https://github.com/lingpy/sinopy/blob/59a47fcdfae3e0000ac6d2b3d7919bf875ec2056/src/sinopy/sinopy.py#L150-L164
train
Return the TLS basic gloss for a list of characters.
lingpy/sinopy
src/sinopy/sinopy.py
sixtuple2baxter
def sixtuple2baxter(chars, debug=False, rhymebook=None): """ Convert the classicial six-tuple representation of MCH readings into IPA (or Baxter's ASCII system). This function is more or less implemented in MiddleChinese. """ if not rhymebook: rhymebook = _cd.GY if len(chars) != 6...
python
def sixtuple2baxter(chars, debug=False, rhymebook=None): """ Convert the classicial six-tuple representation of MCH readings into IPA (or Baxter's ASCII system). This function is more or less implemented in MiddleChinese. """ if not rhymebook: rhymebook = _cd.GY if len(chars) != 6...
[ "def", "sixtuple2baxter", "(", "chars", ",", "debug", "=", "False", ",", "rhymebook", "=", "None", ")", ":", "if", "not", "rhymebook", ":", "rhymebook", "=", "_cd", ".", "GY", "if", "len", "(", "chars", ")", "!=", "6", ":", "raise", "ValueError", "("...
Convert the classicial six-tuple representation of MCH readings into IPA (or Baxter's ASCII system). This function is more or less implemented in MiddleChinese.
[ "Convert", "the", "classicial", "six", "-", "tuple", "representation", "of", "MCH", "readings", "into", "IPA", "(", "or", "Baxter", "s", "ASCII", "system", ")", ".", "This", "function", "is", "more", "or", "less", "implemented", "in", "MiddleChinese", "." ]
59a47fcdfae3e0000ac6d2b3d7919bf875ec2056
https://github.com/lingpy/sinopy/blob/59a47fcdfae3e0000ac6d2b3d7919bf875ec2056/src/sinopy/sinopy.py#L167-L247
train
Convert a six - tuple representation of MCH readings into a Baxter - compatible list of IPA - encoded readings.
lingpy/sinopy
src/sinopy/sinopy.py
analyze_sequence
def analyze_sequence(ipa): """ Convert a normal ipa string into a prostring for Chinese dialects. """ # we need some very good strategy here, which should be lightwayt and easy # to re-implement in other languages (e.g. JS) # get sound-class rep of stirng first seqs = re.split('([₁₂₃₄₅₆₀¹²³...
python
def analyze_sequence(ipa): """ Convert a normal ipa string into a prostring for Chinese dialects. """ # we need some very good strategy here, which should be lightwayt and easy # to re-implement in other languages (e.g. JS) # get sound-class rep of stirng first seqs = re.split('([₁₂₃₄₅₆₀¹²³...
[ "def", "analyze_sequence", "(", "ipa", ")", ":", "# we need some very good strategy here, which should be lightwayt and easy", "# to re-implement in other languages (e.g. JS)", "# get sound-class rep of stirng first", "seqs", "=", "re", ".", "split", "(", "'([₁₂₃₄₅₆₀¹²³⁴⁵⁶⁰])+', ipa)",...
Convert a normal ipa string into a prostring for Chinese dialects.
[ "Convert", "a", "normal", "ipa", "string", "into", "a", "prostring", "for", "Chinese", "dialects", "." ]
59a47fcdfae3e0000ac6d2b3d7919bf875ec2056
https://github.com/lingpy/sinopy/blob/59a47fcdfae3e0000ac6d2b3d7919bf875ec2056/src/sinopy/sinopy.py#L258-L273
train
Convert a normal ipa string into a prostring for Chinese dialects.
lingpy/sinopy
src/sinopy/sinopy.py
fanqie2mch
def fanqie2mch(fanqie, debug=False): """ Convert a Fǎnqiè reading to it's MCH counterpart. Important: we need to identify the medials in the xia-syllable. We also need to make additional background-checks, since in the current form, the approach is not error-prone and does not what it is suppos...
python
def fanqie2mch(fanqie, debug=False): """ Convert a Fǎnqiè reading to it's MCH counterpart. Important: we need to identify the medials in the xia-syllable. We also need to make additional background-checks, since in the current form, the approach is not error-prone and does not what it is suppos...
[ "def", "fanqie2mch", "(", "fanqie", ",", "debug", "=", "False", ")", ":", "# check for gbk", "fanqie", "=", "gbk2big5", "(", "fanqie", ")", "# get normal vals", "shangxia", "=", "chars2baxter", "(", "fanqie", ")", "# check for good fixed solutions in our dictionary", ...
Convert a Fǎnqiè reading to it's MCH counterpart. Important: we need to identify the medials in the xia-syllable. We also need to make additional background-checks, since in the current form, the approach is not error-prone and does not what it is supposed to do!
[ "Convert", "a", "Fǎnqiè", "reading", "to", "it", "s", "MCH", "counterpart", ".", "Important", ":", "we", "need", "to", "identify", "the", "medials", "in", "the", "xia", "-", "syllable", ".", "We", "also", "need", "to", "make", "additional", "background", ...
59a47fcdfae3e0000ac6d2b3d7919bf875ec2056
https://github.com/lingpy/sinopy/blob/59a47fcdfae3e0000ac6d2b3d7919bf875ec2056/src/sinopy/sinopy.py#L276-L326
train
Convert a Fǎnqiè reading to it s MCH counterpart.
lingpy/sinopy
src/sinopy/sinopy.py
baxter2ipa
def baxter2ipa(mch, segmented=False): """ Very simple aber convient-enough conversion from baxter MCH to IPA MCH. this is also more or less already implemented in MiddleChinese """ out = mch if out[-1] in 'ptk': out += 'R' elif out[-1] not in 'XHP': out += 'P' f...
python
def baxter2ipa(mch, segmented=False): """ Very simple aber convient-enough conversion from baxter MCH to IPA MCH. this is also more or less already implemented in MiddleChinese """ out = mch if out[-1] in 'ptk': out += 'R' elif out[-1] not in 'XHP': out += 'P' f...
[ "def", "baxter2ipa", "(", "mch", ",", "segmented", "=", "False", ")", ":", "out", "=", "mch", "if", "out", "[", "-", "1", "]", "in", "'ptk'", ":", "out", "+=", "'R'", "elif", "out", "[", "-", "1", "]", "not", "in", "'XHP'", ":", "out", "+=", ...
Very simple aber convient-enough conversion from baxter MCH to IPA MCH. this is also more or less already implemented in MiddleChinese
[ "Very", "simple", "aber", "convient", "-", "enough", "conversion", "from", "baxter", "MCH", "to", "IPA", "MCH", ".", "this", "is", "also", "more", "or", "less", "already", "implemented", "in", "MiddleChinese" ]
59a47fcdfae3e0000ac6d2b3d7919bf875ec2056
https://github.com/lingpy/sinopy/blob/59a47fcdfae3e0000ac6d2b3d7919bf875ec2056/src/sinopy/sinopy.py#L329-L345
train
Convert Baxter MCH to IPA MCH.
lingpy/sinopy
src/sinopy/sinopy.py
gbk2big5
def gbk2big5(chars): """ Convert from gbk format to big5 representation of chars. """ out = '' for char in chars: if char in _cd.GBK: out += _cd.BIG5[_cd.GBK.index(char)] else: out += char return out
python
def gbk2big5(chars): """ Convert from gbk format to big5 representation of chars. """ out = '' for char in chars: if char in _cd.GBK: out += _cd.BIG5[_cd.GBK.index(char)] else: out += char return out
[ "def", "gbk2big5", "(", "chars", ")", ":", "out", "=", "''", "for", "char", "in", "chars", ":", "if", "char", "in", "_cd", ".", "GBK", ":", "out", "+=", "_cd", ".", "BIG5", "[", "_cd", ".", "GBK", ".", "index", "(", "char", ")", "]", "else", ...
Convert from gbk format to big5 representation of chars.
[ "Convert", "from", "gbk", "format", "to", "big5", "representation", "of", "chars", "." ]
59a47fcdfae3e0000ac6d2b3d7919bf875ec2056
https://github.com/lingpy/sinopy/blob/59a47fcdfae3e0000ac6d2b3d7919bf875ec2056/src/sinopy/sinopy.py#L348-L358
train
Convert from gbk format to big5 representation of chars.
lingpy/sinopy
src/sinopy/sinopy.py
big52gbk
def big52gbk(chars): """ Convert from long chars to short chars. """ out = '' for char in chars: if char in _cd.BIG5: out += _cd.GBK[_cd.BIG5.index(char)] else: out += char return out
python
def big52gbk(chars): """ Convert from long chars to short chars. """ out = '' for char in chars: if char in _cd.BIG5: out += _cd.GBK[_cd.BIG5.index(char)] else: out += char return out
[ "def", "big52gbk", "(", "chars", ")", ":", "out", "=", "''", "for", "char", "in", "chars", ":", "if", "char", "in", "_cd", ".", "BIG5", ":", "out", "+=", "_cd", ".", "GBK", "[", "_cd", ".", "BIG5", ".", "index", "(", "char", ")", "]", "else", ...
Convert from long chars to short chars.
[ "Convert", "from", "long", "chars", "to", "short", "chars", "." ]
59a47fcdfae3e0000ac6d2b3d7919bf875ec2056
https://github.com/lingpy/sinopy/blob/59a47fcdfae3e0000ac6d2b3d7919bf875ec2056/src/sinopy/sinopy.py#L361-L371
train
Convert from long chars to short chars.
lingpy/sinopy
src/sinopy/sinopy.py
parse_chinese_morphemes
def parse_chinese_morphemes(seq, context=False): """ Parse a Chinese syllable and return its basic structure. """ # get the tokens if isinstance(seq, list): tokens = [s for s in seq] else: tokens = lingpy.ipa2tokens(seq, merge_vowels=False) # get the sound classes ...
python
def parse_chinese_morphemes(seq, context=False): """ Parse a Chinese syllable and return its basic structure. """ # get the tokens if isinstance(seq, list): tokens = [s for s in seq] else: tokens = lingpy.ipa2tokens(seq, merge_vowels=False) # get the sound classes ...
[ "def", "parse_chinese_morphemes", "(", "seq", ",", "context", "=", "False", ")", ":", "# get the tokens", "if", "isinstance", "(", "seq", ",", "list", ")", ":", "tokens", "=", "[", "s", "for", "s", "in", "seq", "]", "else", ":", "tokens", "=", "lingpy"...
Parse a Chinese syllable and return its basic structure.
[ "Parse", "a", "Chinese", "syllable", "and", "return", "its", "basic", "structure", "." ]
59a47fcdfae3e0000ac6d2b3d7919bf875ec2056
https://github.com/lingpy/sinopy/blob/59a47fcdfae3e0000ac6d2b3d7919bf875ec2056/src/sinopy/sinopy.py#L402-L529
train
Parse a Chinese syllable and return its basic structure.
cts2/pyjxslt
pyjxslt-python/src/pyjxslt/XSLTGateway.py
Gateway.reconnect
def reconnect(self): """ (Re)establish the gateway connection @return: True if connection was established """ self._converters.clear() self._gateway = None self._xsltFactory = None try: # print("Starting Java gateway on port: %s" % self._gwPort) ...
python
def reconnect(self): """ (Re)establish the gateway connection @return: True if connection was established """ self._converters.clear() self._gateway = None self._xsltFactory = None try: # print("Starting Java gateway on port: %s" % self._gwPort) ...
[ "def", "reconnect", "(", "self", ")", ":", "self", ".", "_converters", ".", "clear", "(", ")", "self", ".", "_gateway", "=", "None", "self", ".", "_xsltFactory", "=", "None", "try", ":", "# print(\"Starting Java gateway on port: %s\" % self._gwPort)", "self", "....
(Re)establish the gateway connection @return: True if connection was established
[ "(", "Re", ")", "establish", "the", "gateway", "connection" ]
66cd9233186cf5000d32e3a5b572e0002a8361c4
https://github.com/cts2/pyjxslt/blob/66cd9233186cf5000d32e3a5b572e0002a8361c4/pyjxslt-python/src/pyjxslt/XSLTGateway.py#L56-L72
train
Re - establish the gateway connection
cts2/pyjxslt
pyjxslt-python/src/pyjxslt/XSLTGateway.py
Gateway.add_transform
def add_transform(self, key, xslt): """ Add or update a transform. @param key: Transform key to use when executing transformations @param xslt: Text or file name of an xslt transform """ self._remove_converter(key) self._xsltLibrary[key] = xslt self._add_convert...
python
def add_transform(self, key, xslt): """ Add or update a transform. @param key: Transform key to use when executing transformations @param xslt: Text or file name of an xslt transform """ self._remove_converter(key) self._xsltLibrary[key] = xslt self._add_convert...
[ "def", "add_transform", "(", "self", ",", "key", ",", "xslt", ")", ":", "self", ".", "_remove_converter", "(", "key", ")", "self", ".", "_xsltLibrary", "[", "key", "]", "=", "xslt", "self", ".", "_add_converter", "(", "key", ")" ]
Add or update a transform. @param key: Transform key to use when executing transformations @param xslt: Text or file name of an xslt transform
[ "Add", "or", "update", "a", "transform", "." ]
66cd9233186cf5000d32e3a5b572e0002a8361c4
https://github.com/cts2/pyjxslt/blob/66cd9233186cf5000d32e3a5b572e0002a8361c4/pyjxslt-python/src/pyjxslt/XSLTGateway.py#L92-L101
train
Add or update a transform.
cts2/pyjxslt
pyjxslt-python/src/pyjxslt/XSLTGateway.py
Gateway._refresh_converters
def _refresh_converters(self): """ Refresh all of the converters in the py4j library @return: True if all converters were succesfully updated """ self._converters.clear() return reduce(lambda a, b: a and b, [self._add_converter(k) for k in list(self._xsltLibrary.keys())], True)
python
def _refresh_converters(self): """ Refresh all of the converters in the py4j library @return: True if all converters were succesfully updated """ self._converters.clear() return reduce(lambda a, b: a and b, [self._add_converter(k) for k in list(self._xsltLibrary.keys())], True)
[ "def", "_refresh_converters", "(", "self", ")", ":", "self", ".", "_converters", ".", "clear", "(", ")", "return", "reduce", "(", "lambda", "a", ",", "b", ":", "a", "and", "b", ",", "[", "self", ".", "_add_converter", "(", "k", ")", "for", "k", "in...
Refresh all of the converters in the py4j library @return: True if all converters were succesfully updated
[ "Refresh", "all", "of", "the", "converters", "in", "the", "py4j", "library" ]
66cd9233186cf5000d32e3a5b572e0002a8361c4
https://github.com/cts2/pyjxslt/blob/66cd9233186cf5000d32e3a5b572e0002a8361c4/pyjxslt-python/src/pyjxslt/XSLTGateway.py#L110-L115
train
Refresh all of the converters in the py4j library
cts2/pyjxslt
pyjxslt-python/src/pyjxslt/XSLTGateway.py
Gateway.transform
def transform(self, key, xml, **kwargs): """ Transform the supplied XML using the transform identified by key @param key: name of the transform to apply @param xml: XML to transform @param kwargs: XSLT parameters @return: Transform output or None if transform failed ...
python
def transform(self, key, xml, **kwargs): """ Transform the supplied XML using the transform identified by key @param key: name of the transform to apply @param xml: XML to transform @param kwargs: XSLT parameters @return: Transform output or None if transform failed ...
[ "def", "transform", "(", "self", ",", "key", ",", "xml", ",", "*", "*", "kwargs", ")", ":", "if", "key", "in", "self", ".", "_xsltLibrary", "and", "self", ".", "gateway_connected", "(", ")", "and", "key", "in", "self", ".", "_converters", ":", "retur...
Transform the supplied XML using the transform identified by key @param key: name of the transform to apply @param xml: XML to transform @param kwargs: XSLT parameters @return: Transform output or None if transform failed
[ "Transform", "the", "supplied", "XML", "using", "the", "transform", "identified", "by", "key" ]
66cd9233186cf5000d32e3a5b572e0002a8361c4
https://github.com/cts2/pyjxslt/blob/66cd9233186cf5000d32e3a5b572e0002a8361c4/pyjxslt-python/src/pyjxslt/XSLTGateway.py#L139-L149
train
Transform the supplied XML using the specified key.
johnnoone/aioconsul
aioconsul/client/query_endpoint.py
QueryEndpoint.items
async def items(self, *, dc=None, watch=None, consistency=None): """Provides a listing of all prepared queries Parameters: dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. watch (Blocking): Do a blocking query ...
python
async def items(self, *, dc=None, watch=None, consistency=None): """Provides a listing of all prepared queries Parameters: dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. watch (Blocking): Do a blocking query ...
[ "async", "def", "items", "(", "self", ",", "*", ",", "dc", "=", "None", ",", "watch", "=", "None", ",", "consistency", "=", "None", ")", ":", "response", "=", "await", "self", ".", "_api", ".", "get", "(", "\"/v1/query\"", ",", "params", "=", "{", ...
Provides a listing of all prepared queries Parameters: dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. watch (Blocking): Do a blocking query consistency (Consistency): Force consistency Returns: ...
[ "Provides", "a", "listing", "of", "all", "prepared", "queries" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/query_endpoint.py#L15-L54
train
Provides a listing of all prepared queries in a given datacenter.
johnnoone/aioconsul
aioconsul/client/query_endpoint.py
QueryEndpoint.create
async def create(self, query, *, dc=None): """Creates a new prepared query Parameters: Query (Object): Query definition dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: Object: New query ...
python
async def create(self, query, *, dc=None): """Creates a new prepared query Parameters: Query (Object): Query definition dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: Object: New query ...
[ "async", "def", "create", "(", "self", ",", "query", ",", "*", ",", "dc", "=", "None", ")", ":", "if", "\"Token\"", "in", "query", ":", "# in case of a full token object...", "query", "[", "\"Token\"", "]", "=", "extract_attr", "(", "query", "[", "\"Token\...
Creates a new prepared query Parameters: Query (Object): Query definition dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: Object: New query ID The create operation expects a body that d...
[ "Creates", "a", "new", "prepared", "query" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/query_endpoint.py#L56-L180
train
Creates a new prepared query for the given query.
johnnoone/aioconsul
aioconsul/client/query_endpoint.py
QueryEndpoint.read
async def read(self, query, *, dc=None, watch=None, consistency=None): """Fetches existing prepared query Parameters: query (ObjectID): Query ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. watch (Blo...
python
async def read(self, query, *, dc=None, watch=None, consistency=None): """Fetches existing prepared query Parameters: query (ObjectID): Query ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. watch (Blo...
[ "async", "def", "read", "(", "self", ",", "query", ",", "*", ",", "dc", "=", "None", ",", "watch", "=", "None", ",", "consistency", "=", "None", ")", ":", "query_id", "=", "extract_attr", "(", "query", ",", "keys", "=", "[", "\"ID\"", "]", ")", "...
Fetches existing prepared query Parameters: query (ObjectID): Query ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. watch (Blocking): Do a blocking query consistency (Consistency): Force consisten...
[ "Fetches", "existing", "prepared", "query" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/query_endpoint.py#L182-L201
train
Fetches existing prepared query
johnnoone/aioconsul
aioconsul/client/query_endpoint.py
QueryEndpoint.update
async def update(self, query, *, dc=None): """Updates existing prepared query Parameters: Query (Object): Query definition dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: bool: ``True`` ...
python
async def update(self, query, *, dc=None): """Updates existing prepared query Parameters: Query (Object): Query definition dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: bool: ``True`` ...
[ "async", "def", "update", "(", "self", ",", "query", ",", "*", ",", "dc", "=", "None", ")", ":", "query_id", "=", "extract_attr", "(", "query", ",", "keys", "=", "[", "\"ID\"", "]", ")", "response", "=", "await", "self", ".", "_api", ".", "put", ...
Updates existing prepared query Parameters: Query (Object): Query definition dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: bool: ``True`` on success
[ "Updates", "existing", "prepared", "query" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/query_endpoint.py#L203-L216
train
Updates existing prepared query with new data.
johnnoone/aioconsul
aioconsul/client/query_endpoint.py
QueryEndpoint.delete
async def delete(self, query, *, dc=None): """Delete existing prepared query Parameters: query (ObjectID): Query ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Results: bool: ``True`` on succ...
python
async def delete(self, query, *, dc=None): """Delete existing prepared query Parameters: query (ObjectID): Query ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Results: bool: ``True`` on succ...
[ "async", "def", "delete", "(", "self", ",", "query", ",", "*", ",", "dc", "=", "None", ")", ":", "query_id", "=", "extract_attr", "(", "query", ",", "keys", "=", "[", "\"ID\"", "]", ")", "response", "=", "await", "self", ".", "_api", ".", "delete",...
Delete existing prepared query Parameters: query (ObjectID): Query ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Results: bool: ``True`` on success
[ "Delete", "existing", "prepared", "query" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/query_endpoint.py#L218-L231
train
Delete existing prepared query
johnnoone/aioconsul
aioconsul/client/query_endpoint.py
QueryEndpoint.execute
async def execute(self, query, *, dc=None, near=None, limit=None, consistency=None): """Executes a prepared query Parameters: query (ObjectID): Query ID dc (str): Specify datacenter that will be used. Defaults to the agent's local data...
python
async def execute(self, query, *, dc=None, near=None, limit=None, consistency=None): """Executes a prepared query Parameters: query (ObjectID): Query ID dc (str): Specify datacenter that will be used. Defaults to the agent's local data...
[ "async", "def", "execute", "(", "self", ",", "query", ",", "*", ",", "dc", "=", "None", ",", "near", "=", "None", ",", "limit", "=", "None", ",", "consistency", "=", "None", ")", ":", "query_id", "=", "extract_attr", "(", "query", ",", "keys", "=",...
Executes a prepared query Parameters: query (ObjectID): Query ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. near (str): Sort the resulting list in ascending order based on the estima...
[ "Executes", "a", "prepared", "query" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/query_endpoint.py#L233-L324
train
Executes a prepared query on the given ID and returns the result as a dict.
johnnoone/aioconsul
aioconsul/client/query_endpoint.py
QueryEndpoint.explain
async def explain(self, query, *, dc=None, consistency=None): """Fetches existing prepared query Parameters: query (ObjectID): Query ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. watch (Blocking): D...
python
async def explain(self, query, *, dc=None, consistency=None): """Fetches existing prepared query Parameters: query (ObjectID): Query ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. watch (Blocking): D...
[ "async", "def", "explain", "(", "self", ",", "query", ",", "*", ",", "dc", "=", "None", ",", "consistency", "=", "None", ")", ":", "query_id", "=", "extract_attr", "(", "query", ",", "keys", "=", "[", "\"ID\"", "]", ")", "path", "=", "\"/v1/query/%s/...
Fetches existing prepared query Parameters: query (ObjectID): Query ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. watch (Blocking): Do a blocking query consistency (Consistency): Force consisten...
[ "Fetches", "existing", "prepared", "query" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/query_endpoint.py#L326-L345
train
Fetches existing prepared query
bitesofcode/projexui
projexui/widgets/xorbtreewidget/xorbgroupitem.py
XOrbGroupItem.loadRecords
def loadRecords(self, records): """ Loads the inputed records as children to this item. :param records | [<orb.Table>, ..] || {<str> sub: <variant>, .. } """ self.setChildIndicatorPolicy(self.DontShowIndicatorWhenChildless) self._loaded = True ...
python
def loadRecords(self, records): """ Loads the inputed records as children to this item. :param records | [<orb.Table>, ..] || {<str> sub: <variant>, .. } """ self.setChildIndicatorPolicy(self.DontShowIndicatorWhenChildless) self._loaded = True ...
[ "def", "loadRecords", "(", "self", ",", "records", ")", ":", "self", ".", "setChildIndicatorPolicy", "(", "self", ".", "DontShowIndicatorWhenChildless", ")", "self", ".", "_loaded", "=", "True", "if", "records", "is", "None", ":", "return", "# load sub-groups if...
Loads the inputed records as children to this item. :param records | [<orb.Table>, ..] || {<str> sub: <variant>, .. }
[ "Loads", "the", "inputed", "records", "as", "children", "to", "this", "item", ".", ":", "param", "records", "|", "[", "<orb", ".", "Table", ">", "..", "]", "||", "{", "<str", ">", "sub", ":", "<variant", ">", "..", "}" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbgroupitem.py#L60-L115
train
Loads the inputed records as children to this item.
bitesofcode/projexui
projexui/widgets/xorbtreewidget/xorbgroupitem.py
XOrbGroupItem.load
def load(self): """ Loads the records from the query set linked with this item. """ if self._loaded: return rset = self.recordSet() QApplication.setOverrideCursor(Qt.WaitCursor) self.loadRecords(rset) QApplication.r...
python
def load(self): """ Loads the records from the query set linked with this item. """ if self._loaded: return rset = self.recordSet() QApplication.setOverrideCursor(Qt.WaitCursor) self.loadRecords(rset) QApplication.r...
[ "def", "load", "(", "self", ")", ":", "if", "self", ".", "_loaded", ":", "return", "rset", "=", "self", ".", "recordSet", "(", ")", "QApplication", ".", "setOverrideCursor", "(", "Qt", ".", "WaitCursor", ")", "self", ".", "loadRecords", "(", "rset", ")...
Loads the records from the query set linked with this item.
[ "Loads", "the", "records", "from", "the", "query", "set", "linked", "with", "this", "item", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbgroupitem.py#L117-L128
train
Loads the records from the query set linked with this item.
bitesofcode/projexui
projexui/widgets/xchart/renderers/xpierenderer.py
XPieRenderer.calculateDatasets
def calculateDatasets(self, scene, axes, datasets): """ Builds the datasets for this renderer. Each renderer will need to subclass and implemenent this method, otherwise, no data will be shown in the chart. :param scene | <XChartScene> ax...
python
def calculateDatasets(self, scene, axes, datasets): """ Builds the datasets for this renderer. Each renderer will need to subclass and implemenent this method, otherwise, no data will be shown in the chart. :param scene | <XChartScene> ax...
[ "def", "calculateDatasets", "(", "self", ",", "scene", ",", "axes", ",", "datasets", ")", ":", "items", "=", "self", ".", "calculateDatasetItems", "(", "scene", ",", "datasets", ")", "if", "not", "items", ":", "scene", ".", "clear", "(", ")", "return", ...
Builds the datasets for this renderer. Each renderer will need to subclass and implemenent this method, otherwise, no data will be shown in the chart. :param scene | <XChartScene> axes | [< datasets | [<XChartDataset>, ..]
[ "Builds", "the", "datasets", "for", "this", "renderer", ".", "Each", "renderer", "will", "need", "to", "subclass", "and", "implemenent", "this", "method", "otherwise", "no", "data", "will", "be", "shown", "in", "the", "chart", ".", ":", "param", "scene", "...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchart/renderers/xpierenderer.py#L39-L164
train
Calculates the datasets for this renderer.
bitesofcode/projexui
projexui/widgets/xchart/renderers/xpierenderer.py
XPieRenderer.drawItem
def drawItem(self, item, painter, option): """ Draws the inputed item as a bar graph. :param item | <XChartDatasetItem> painter | <QPainter> option | <QStyleOptionGraphicsItem> """ dataset = item.dataset() ...
python
def drawItem(self, item, painter, option): """ Draws the inputed item as a bar graph. :param item | <XChartDatasetItem> painter | <QPainter> option | <QStyleOptionGraphicsItem> """ dataset = item.dataset() ...
[ "def", "drawItem", "(", "self", ",", "item", ",", "painter", ",", "option", ")", ":", "dataset", "=", "item", ".", "dataset", "(", ")", "painter", ".", "save", "(", ")", "painter", ".", "setRenderHint", "(", "painter", ".", "Antialiasing", ")", "center...
Draws the inputed item as a bar graph. :param item | <XChartDatasetItem> painter | <QPainter> option | <QStyleOptionGraphicsItem>
[ "Draws", "the", "inputed", "item", "as", "a", "bar", "graph", ".", ":", "param", "item", "|", "<XChartDatasetItem", ">", "painter", "|", "<QPainter", ">", "option", "|", "<QStyleOptionGraphicsItem", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchart/renderers/xpierenderer.py#L166-L214
train
Draws the item as a bar graph.
intelsdi-x/snap-plugin-lib-py
snap_plugin/v1/plugin.py
_make_standalone_handler
def _make_standalone_handler(preamble): """Class factory used so that preamble can be passed to :py:class:`_StandaloneHandler` without use of static members""" class _StandaloneHandler(BaseHTTPRequestHandler, object): """HTTP Handler for standalone mode""" def do_GET(self): sel...
python
def _make_standalone_handler(preamble): """Class factory used so that preamble can be passed to :py:class:`_StandaloneHandler` without use of static members""" class _StandaloneHandler(BaseHTTPRequestHandler, object): """HTTP Handler for standalone mode""" def do_GET(self): sel...
[ "def", "_make_standalone_handler", "(", "preamble", ")", ":", "class", "_StandaloneHandler", "(", "BaseHTTPRequestHandler", ",", "object", ")", ":", "\"\"\"HTTP Handler for standalone mode\"\"\"", "def", "do_GET", "(", "self", ")", ":", "self", ".", "send_response", "...
Class factory used so that preamble can be passed to :py:class:`_StandaloneHandler` without use of static members
[ "Class", "factory", "used", "so", "that", "preamble", "can", "be", "passed", "to", ":", "py", ":", "class", ":", "_StandaloneHandler", "without", "use", "of", "static", "members" ]
8da5d00ac5f9d2b48a7239563ac7788209891ca4
https://github.com/intelsdi-x/snap-plugin-lib-py/blob/8da5d00ac5f9d2b48a7239563ac7788209891ca4/snap_plugin/v1/plugin.py#L63-L79
train
Create a handler for standalone mode.
intelsdi-x/snap-plugin-lib-py
snap_plugin/v1/plugin.py
_monitor
def _monitor(last_ping, stop_plugin, is_shutting_down, timeout=5): """Monitors health checks (pings) from the Snap framework. If the plugin doesn't receive 3 consecutive health checks from Snap the plugin will shutdown. The default timeout is set to 5 seconds. """ _timeout_count = 0 _last_chec...
python
def _monitor(last_ping, stop_plugin, is_shutting_down, timeout=5): """Monitors health checks (pings) from the Snap framework. If the plugin doesn't receive 3 consecutive health checks from Snap the plugin will shutdown. The default timeout is set to 5 seconds. """ _timeout_count = 0 _last_chec...
[ "def", "_monitor", "(", "last_ping", ",", "stop_plugin", ",", "is_shutting_down", ",", "timeout", "=", "5", ")", ":", "_timeout_count", "=", "0", "_last_check", "=", "time", ".", "time", "(", ")", "_sleep_interval", "=", "1", "# set _sleep_interval if less than ...
Monitors health checks (pings) from the Snap framework. If the plugin doesn't receive 3 consecutive health checks from Snap the plugin will shutdown. The default timeout is set to 5 seconds.
[ "Monitors", "health", "checks", "(", "pings", ")", "from", "the", "Snap", "framework", "." ]
8da5d00ac5f9d2b48a7239563ac7788209891ca4
https://github.com/intelsdi-x/snap-plugin-lib-py/blob/8da5d00ac5f9d2b48a7239563ac7788209891ca4/snap_plugin/v1/plugin.py#L755-L783
train
Monitor health checks from the plugin.
intelsdi-x/snap-plugin-lib-py
snap_plugin/v1/plugin.py
_tabulate
def _tabulate(rows, headers, spacing=5): """Prepare simple table with spacing based on content""" if len(rows) == 0: return "None\n" assert len(rows[0]) == len(headers) count = len(rows[0]) widths = [0 for _ in range(count)] rows = [headers] + rows for row in rows: for index...
python
def _tabulate(rows, headers, spacing=5): """Prepare simple table with spacing based on content""" if len(rows) == 0: return "None\n" assert len(rows[0]) == len(headers) count = len(rows[0]) widths = [0 for _ in range(count)] rows = [headers] + rows for row in rows: for index...
[ "def", "_tabulate", "(", "rows", ",", "headers", ",", "spacing", "=", "5", ")", ":", "if", "len", "(", "rows", ")", "==", "0", ":", "return", "\"None\\n\"", "assert", "len", "(", "rows", "[", "0", "]", ")", "==", "len", "(", "headers", ")", "coun...
Prepare simple table with spacing based on content
[ "Prepare", "simple", "table", "with", "spacing", "based", "on", "content" ]
8da5d00ac5f9d2b48a7239563ac7788209891ca4
https://github.com/intelsdi-x/snap-plugin-lib-py/blob/8da5d00ac5f9d2b48a7239563ac7788209891ca4/snap_plugin/v1/plugin.py#L786-L806
train
Prepare simple table with spacing based on content
intelsdi-x/snap-plugin-lib-py
snap_plugin/v1/plugin.py
_Flags.add_item
def add_item(self, item): """Add single command line flag Arguments: name (:obj:`str`): Name of flag used in command line flag_type (:py:class:`snap_plugin.v1.plugin.FlagType`): Indication if flag should store value or is simple bool flag description ...
python
def add_item(self, item): """Add single command line flag Arguments: name (:obj:`str`): Name of flag used in command line flag_type (:py:class:`snap_plugin.v1.plugin.FlagType`): Indication if flag should store value or is simple bool flag description ...
[ "def", "add_item", "(", "self", ",", "item", ")", ":", "if", "not", "(", "isinstance", "(", "item", ".", "name", ",", "basestring", ")", "and", "isinstance", "(", "item", ".", "description", ",", "basestring", ")", ")", ":", "raise", "TypeError", "(", ...
Add single command line flag Arguments: name (:obj:`str`): Name of flag used in command line flag_type (:py:class:`snap_plugin.v1.plugin.FlagType`): Indication if flag should store value or is simple bool flag description (:obj:`str`): Flag description used i...
[ "Add", "single", "command", "line", "flag" ]
8da5d00ac5f9d2b48a7239563ac7788209891ca4
https://github.com/intelsdi-x/snap-plugin-lib-py/blob/8da5d00ac5f9d2b48a7239563ac7788209891ca4/snap_plugin/v1/plugin.py#L107-L133
train
Adds single command line flag to internal flag list
intelsdi-x/snap-plugin-lib-py
snap_plugin/v1/plugin.py
_Flags.add_multiple
def add_multiple(self, flags): """Add multiple command line flags Arguments: flags (:obj:`list` of :obj:`tuple`): List of flags in tuples (name, flag_type, description, (optional) default) Raises: TypeError: Provided wrong arguments or arguments of wrong...
python
def add_multiple(self, flags): """Add multiple command line flags Arguments: flags (:obj:`list` of :obj:`tuple`): List of flags in tuples (name, flag_type, description, (optional) default) Raises: TypeError: Provided wrong arguments or arguments of wrong...
[ "def", "add_multiple", "(", "self", ",", "flags", ")", ":", "if", "not", "isinstance", "(", "flags", ",", "list", ")", ":", "raise", "TypeError", "(", "\"Expected list of flags, got object of type{}\"", ".", "format", "(", "type", "(", "flags", ")", ")", ")"...
Add multiple command line flags Arguments: flags (:obj:`list` of :obj:`tuple`): List of flags in tuples (name, flag_type, description, (optional) default) Raises: TypeError: Provided wrong arguments or arguments of wrong types, method will raise TypeError
[ "Add", "multiple", "command", "line", "flags" ]
8da5d00ac5f9d2b48a7239563ac7788209891ca4
https://github.com/intelsdi-x/snap-plugin-lib-py/blob/8da5d00ac5f9d2b48a7239563ac7788209891ca4/snap_plugin/v1/plugin.py#L138-L160
train
Adds multiple flags to the command line
bitesofcode/projexui
projexui/widgets/xcalendarwidget/xcalendarwidget.py
XCalendarWidget.dragEnterEvent
def dragEnterEvent( self, event ): """ Processes the drag drop event using the filter set by the \ setDragDropFilter :param event | <QDragEvent> """ filt = self.dragDropFilter() if ( not filt ): super(XCalendarWidget, self).dragE...
python
def dragEnterEvent( self, event ): """ Processes the drag drop event using the filter set by the \ setDragDropFilter :param event | <QDragEvent> """ filt = self.dragDropFilter() if ( not filt ): super(XCalendarWidget, self).dragE...
[ "def", "dragEnterEvent", "(", "self", ",", "event", ")", ":", "filt", "=", "self", ".", "dragDropFilter", "(", ")", "if", "(", "not", "filt", ")", ":", "super", "(", "XCalendarWidget", ",", "self", ")", ".", "dragEnterEvent", "(", "event", ")", "return...
Processes the drag drop event using the filter set by the \ setDragDropFilter :param event | <QDragEvent>
[ "Processes", "the", "drag", "drop", "event", "using", "the", "filter", "set", "by", "the", "\\", "setDragDropFilter", ":", "param", "event", "|", "<QDragEvent", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xcalendarwidget/xcalendarwidget.py#L93-L105
train
Processes the drag drop event using the filter set by the setDragDropFilter method.
bitesofcode/projexui
projexui/widgets/xcalendarwidget/xcalendarwidget.py
XCalendarWidget.dragMoveEvent
def dragMoveEvent( self, event ): """ Processes the drag drop event using the filter set by the \ setDragDropFilter :param event | <QDragEvent> """ filt = self.dragDropFilter() if ( not filt ): super(XCalendarWidget, self).dragMo...
python
def dragMoveEvent( self, event ): """ Processes the drag drop event using the filter set by the \ setDragDropFilter :param event | <QDragEvent> """ filt = self.dragDropFilter() if ( not filt ): super(XCalendarWidget, self).dragMo...
[ "def", "dragMoveEvent", "(", "self", ",", "event", ")", ":", "filt", "=", "self", ".", "dragDropFilter", "(", ")", "if", "(", "not", "filt", ")", ":", "super", "(", "XCalendarWidget", ",", "self", ")", ".", "dragMoveEvent", "(", "event", ")", "return",...
Processes the drag drop event using the filter set by the \ setDragDropFilter :param event | <QDragEvent>
[ "Processes", "the", "drag", "drop", "event", "using", "the", "filter", "set", "by", "the", "\\", "setDragDropFilter", ":", "param", "event", "|", "<QDragEvent", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xcalendarwidget/xcalendarwidget.py#L107-L119
train
Processes the drag drop event using the filter set by the setDragDropFilter method and returns the new event object.
bitesofcode/projexui
projexui/widgets/xcalendarwidget/xcalendarwidget.py
XCalendarWidget.dragDropFilter
def dragDropFilter( self ): """ Returns a drag and drop filter method. If set, the method should \ accept 2 arguments: a QWidget and a drag/drop event and process it. :usage |from projexui.qt.QtCore import QEvent | |class MyWi...
python
def dragDropFilter( self ): """ Returns a drag and drop filter method. If set, the method should \ accept 2 arguments: a QWidget and a drag/drop event and process it. :usage |from projexui.qt.QtCore import QEvent | |class MyWi...
[ "def", "dragDropFilter", "(", "self", ")", ":", "filt", "=", "None", "if", "(", "self", ".", "_dragDropFilterRef", ")", ":", "filt", "=", "self", ".", "_dragDropFilterRef", "(", ")", "if", "(", "not", "filt", ")", ":", "self", ".", "_dragDropFilterRef", ...
Returns a drag and drop filter method. If set, the method should \ accept 2 arguments: a QWidget and a drag/drop event and process it. :usage |from projexui.qt.QtCore import QEvent | |class MyWidget(QWidget): | def __init...
[ "Returns", "a", "drag", "and", "drop", "filter", "method", ".", "If", "set", "the", "method", "should", "\\", "accept", "2", "arguments", ":", "a", "QWidget", "and", "a", "drag", "/", "drop", "event", "and", "process", "it", ".", ":", "usage", "|from",...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xcalendarwidget/xcalendarwidget.py#L121-L151
train
Returns a drag and drop filter method.
bitesofcode/projexui
projexui/widgets/xcalendarwidget/xcalendarwidget.py
XCalendarWidget.dropEvent
def dropEvent( self, event ): """ Processes the drag drop event using the filter set by the \ setDragDropFilter :param event | <QDropEvent> """ filt = self.dragDropFilter() if ( not filt ): super(XCalendarWidget, self).dropEvent(...
python
def dropEvent( self, event ): """ Processes the drag drop event using the filter set by the \ setDragDropFilter :param event | <QDropEvent> """ filt = self.dragDropFilter() if ( not filt ): super(XCalendarWidget, self).dropEvent(...
[ "def", "dropEvent", "(", "self", ",", "event", ")", ":", "filt", "=", "self", ".", "dragDropFilter", "(", ")", "if", "(", "not", "filt", ")", ":", "super", "(", "XCalendarWidget", ",", "self", ")", ".", "dropEvent", "(", "event", ")", "return", "filt...
Processes the drag drop event using the filter set by the \ setDragDropFilter :param event | <QDropEvent>
[ "Processes", "the", "drag", "drop", "event", "using", "the", "filter", "set", "by", "the", "\\", "setDragDropFilter", ":", "param", "event", "|", "<QDropEvent", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xcalendarwidget/xcalendarwidget.py#L153-L165
train
Processes the drag drop event using the dragDropFilter set by the XCalendarWidget class.
bitesofcode/projexui
projexui/widgets/xcalendarwidget/xcalendarwidget.py
XCalendarWidget.gotoNext
def gotoNext( self ): """ Goes to the next date based on the current mode and date. """ scene = self.scene() date = scene.currentDate() # go forward a day if ( scene.currentMode() == scene.Mode.Day ): scene.setCurrentDate(date.addDay...
python
def gotoNext( self ): """ Goes to the next date based on the current mode and date. """ scene = self.scene() date = scene.currentDate() # go forward a day if ( scene.currentMode() == scene.Mode.Day ): scene.setCurrentDate(date.addDay...
[ "def", "gotoNext", "(", "self", ")", ":", "scene", "=", "self", ".", "scene", "(", ")", "date", "=", "scene", ".", "currentDate", "(", ")", "# go forward a day\r", "if", "(", "scene", ".", "currentMode", "(", ")", "==", "scene", ".", "Mode", ".", "Da...
Goes to the next date based on the current mode and date.
[ "Goes", "to", "the", "next", "date", "based", "on", "the", "current", "mode", "and", "date", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xcalendarwidget/xcalendarwidget.py#L168-L185
train
Goes to the next date based on the current mode and date.
bitesofcode/projexui
projexui/widgets/xcalendarwidget/xcalendarwidget.py
XCalendarWidget.mousePressEvent
def mousePressEvent( self, event ): """ Handles the mouse press event. :param event | <QMouseEvent> """ scene_point = self.mapToScene(event.pos()) date = self.scene().dateAt(scene_point) date_time = self.scene().dateTimeAt(scene_poin...
python
def mousePressEvent( self, event ): """ Handles the mouse press event. :param event | <QMouseEvent> """ scene_point = self.mapToScene(event.pos()) date = self.scene().dateAt(scene_point) date_time = self.scene().dateTimeAt(scene_poin...
[ "def", "mousePressEvent", "(", "self", ",", "event", ")", ":", "scene_point", "=", "self", ".", "mapToScene", "(", "event", ".", "pos", "(", ")", ")", "date", "=", "self", ".", "scene", "(", ")", ".", "dateAt", "(", "scene_point", ")", "date_time", "...
Handles the mouse press event. :param event | <QMouseEvent>
[ "Handles", "the", "mouse", "press", "event", ".", ":", "param", "event", "|", "<QMouseEvent", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xcalendarwidget/xcalendarwidget.py#L234-L259
train
Handles the mouse press event.
bitesofcode/projexui
projexui/widgets/xcalendarwidget/xcalendarwidget.py
XCalendarWidget.mouseDoubleClickEvent
def mouseDoubleClickEvent( self, event ): """ Handles the mouse double click event. :param event | <QMouseEvent> """ scene_point = self.mapToScene(event.pos()) date = self.scene().dateAt(scene_point) date_time = self.scene().dateTime...
python
def mouseDoubleClickEvent( self, event ): """ Handles the mouse double click event. :param event | <QMouseEvent> """ scene_point = self.mapToScene(event.pos()) date = self.scene().dateAt(scene_point) date_time = self.scene().dateTime...
[ "def", "mouseDoubleClickEvent", "(", "self", ",", "event", ")", ":", "scene_point", "=", "self", ".", "mapToScene", "(", "event", ".", "pos", "(", ")", ")", "date", "=", "self", ".", "scene", "(", ")", ".", "dateAt", "(", "scene_point", ")", "date_time...
Handles the mouse double click event. :param event | <QMouseEvent>
[ "Handles", "the", "mouse", "double", "click", "event", ".", ":", "param", "event", "|", "<QMouseEvent", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xcalendarwidget/xcalendarwidget.py#L261-L286
train
Handles the mouse double click event.
bitesofcode/projexui
projexui/widgets/xcalendarwidget/xcalendarwidget.py
XCalendarWidget.setCurrentMode
def setCurrentMode( self, mode ): """ Sets the current mode that this calendar will be displayed in. :param mode | <XCalendarWidget.Mode> """ self.scene().setCurrentMode(mode) self.scene().setSceneRect(0, 0, self.width() - 5, self.height() - 5) if ...
python
def setCurrentMode( self, mode ): """ Sets the current mode that this calendar will be displayed in. :param mode | <XCalendarWidget.Mode> """ self.scene().setCurrentMode(mode) self.scene().setSceneRect(0, 0, self.width() - 5, self.height() - 5) if ...
[ "def", "setCurrentMode", "(", "self", ",", "mode", ")", ":", "self", ".", "scene", "(", ")", ".", "setCurrentMode", "(", "mode", ")", "self", ".", "scene", "(", ")", ".", "setSceneRect", "(", "0", ",", "0", ",", "self", ".", "width", "(", ")", "-...
Sets the current mode that this calendar will be displayed in. :param mode | <XCalendarWidget.Mode>
[ "Sets", "the", "current", "mode", "that", "this", "calendar", "will", "be", "displayed", "in", ".", ":", "param", "mode", "|", "<XCalendarWidget", ".", "Mode", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xcalendarwidget/xcalendarwidget.py#L303-L312
train
Sets the current mode that this calendar will be displayed in.
bitesofcode/projexui
projexui/xdatatype.py
restoreDataSet
def restoreDataSet( settings, key, dataSet ): """ Restores the dataset settings to the inputed data set for the given key. :param settings | <QSettings> key | <str> dataSet | <projex.dataset.DataSet> """ for datakey in dataSet.keys(): vtype = u...
python
def restoreDataSet( settings, key, dataSet ): """ Restores the dataset settings to the inputed data set for the given key. :param settings | <QSettings> key | <str> dataSet | <projex.dataset.DataSet> """ for datakey in dataSet.keys(): vtype = u...
[ "def", "restoreDataSet", "(", "settings", ",", "key", ",", "dataSet", ")", ":", "for", "datakey", "in", "dataSet", ".", "keys", "(", ")", ":", "vtype", "=", "unwrapVariant", "(", "settings", ".", "value", "(", "'%s/%s/type'", "%", "(", "key", ",", "dat...
Restores the dataset settings to the inputed data set for the given key. :param settings | <QSettings> key | <str> dataSet | <projex.dataset.DataSet>
[ "Restores", "the", "dataset", "settings", "to", "the", "inputed", "data", "set", "for", "the", "given", "key", ".", ":", "param", "settings", "|", "<QSettings", ">", "key", "|", "<str", ">", "dataSet", "|", "<projex", ".", "dataset", ".", "DataSet", ">" ...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/xdatatype.py#L42-L68
train
Restores the dataset settings to the inputed data set for the given key.
bitesofcode/projexui
projexui/xdatatype.py
saveDataSet
def saveDataSet( settings, key, dataSet ): """ Records the dataset settings to the inputed data set for the given key. :param settings | <QSettings> key | <str> dataSet | <projex.dataset.DataSet> """ for datakey, value in dataSet.items(): datat...
python
def saveDataSet( settings, key, dataSet ): """ Records the dataset settings to the inputed data set for the given key. :param settings | <QSettings> key | <str> dataSet | <projex.dataset.DataSet> """ for datakey, value in dataSet.items(): datat...
[ "def", "saveDataSet", "(", "settings", ",", "key", ",", "dataSet", ")", ":", "for", "datakey", ",", "value", "in", "dataSet", ".", "items", "(", ")", ":", "datatype", "=", "type", "(", "value", ")", ".", "__name__", "if", "(", "datatype", "in", "_dat...
Records the dataset settings to the inputed data set for the given key. :param settings | <QSettings> key | <str> dataSet | <projex.dataset.DataSet>
[ "Records", "the", "dataset", "settings", "to", "the", "inputed", "data", "set", "for", "the", "given", "key", ".", ":", "param", "settings", "|", "<QSettings", ">", "key", "|", "<str", ">", "dataSet", "|", "<projex", ".", "dataset", ".", "DataSet", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/xdatatype.py#L70-L87
train
Saves the dataset settings for the given key to the inputed data set.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodewidget.py
XNodeWidget.centerOn
def centerOn(self, *args): """ Updates the center on method to ensure the viewport is updated. :param *args | <variant> """ super(XNodeWidget, self).centerOn(*args) for con in self.connections(): con.setPath(con.rebuild()) ...
python
def centerOn(self, *args): """ Updates the center on method to ensure the viewport is updated. :param *args | <variant> """ super(XNodeWidget, self).centerOn(*args) for con in self.connections(): con.setPath(con.rebuild()) ...
[ "def", "centerOn", "(", "self", ",", "*", "args", ")", ":", "super", "(", "XNodeWidget", ",", "self", ")", ".", "centerOn", "(", "*", "args", ")", "for", "con", "in", "self", ".", "connections", "(", ")", ":", "con", ".", "setPath", "(", "con", "...
Updates the center on method to ensure the viewport is updated. :param *args | <variant>
[ "Updates", "the", "center", "on", "method", "to", "ensure", "the", "viewport", "is", "updated", ".", ":", "param", "*", "args", "|", "<variant", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodewidget.py#L94-L104
train
Updates the center on method to ensure the viewport is updated.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodewidget.py
XNodeWidget.centerOnAnimated
def centerOnAnimated(self, centerOn, animate=0): """ Animates the centering options over a given number of seconds. :param centerOn | <QRectF> | <QPointF> | <XNode> animate | <float> | seconds """ if isinstance(centerOn, XNode): ...
python
def centerOnAnimated(self, centerOn, animate=0): """ Animates the centering options over a given number of seconds. :param centerOn | <QRectF> | <QPointF> | <XNode> animate | <float> | seconds """ if isinstance(centerOn, XNode): ...
[ "def", "centerOnAnimated", "(", "self", ",", "centerOn", ",", "animate", "=", "0", ")", ":", "if", "isinstance", "(", "centerOn", ",", "XNode", ")", ":", "center", "=", "centerOn", ".", "sceneRect", "(", ")", ".", "center", "(", ")", "elif", "isinstanc...
Animates the centering options over a given number of seconds. :param centerOn | <QRectF> | <QPointF> | <XNode> animate | <float> | seconds
[ "Animates", "the", "centering", "options", "over", "a", "given", "number", "of", "seconds", ".", ":", "param", "centerOn", "|", "<QRectF", ">", "|", "<QPointF", ">", "|", "<XNode", ">", "animate", "|", "<float", ">", "|", "seconds" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodewidget.py#L106-L127
train
Animate the centering options over a given number of seconds.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodewidget.py
XNodeWidget.centerOnItems
def centerOnItems(self, items = None): """ Centers on the given items, if no items are supplied, then all items will be centered on. :param items | [<QGraphicsItem>, ..] """ if not items: rect = self.scene().visibleItemsBoundingRect() ...
python
def centerOnItems(self, items = None): """ Centers on the given items, if no items are supplied, then all items will be centered on. :param items | [<QGraphicsItem>, ..] """ if not items: rect = self.scene().visibleItemsBoundingRect() ...
[ "def", "centerOnItems", "(", "self", ",", "items", "=", "None", ")", ":", "if", "not", "items", ":", "rect", "=", "self", ".", "scene", "(", ")", ".", "visibleItemsBoundingRect", "(", ")", "if", "not", "rect", ".", "width", "(", ")", ":", "rect", "...
Centers on the given items, if no items are supplied, then all items will be centered on. :param items | [<QGraphicsItem>, ..]
[ "Centers", "on", "the", "given", "items", "if", "no", "items", "are", "supplied", "then", "all", "items", "will", "be", "centered", "on", ".", ":", "param", "items", "|", "[", "<QGraphicsItem", ">", "..", "]" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodewidget.py#L129-L143
train
Centers on the given items.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodewidget.py
XNodeWidget.closeEvent
def closeEvent( self, event ): """ Cleans up the scene before closing. :param event | <QEvent> """ if ( self.cleanupOnClose() ): scene = self.scene() scene.cleanup() self.setScene(None) super(XNodeWidget, self).cl...
python
def closeEvent( self, event ): """ Cleans up the scene before closing. :param event | <QEvent> """ if ( self.cleanupOnClose() ): scene = self.scene() scene.cleanup() self.setScene(None) super(XNodeWidget, self).cl...
[ "def", "closeEvent", "(", "self", ",", "event", ")", ":", "if", "(", "self", ".", "cleanupOnClose", "(", ")", ")", ":", "scene", "=", "self", ".", "scene", "(", ")", "scene", ".", "cleanup", "(", ")", "self", ".", "setScene", "(", "None", ")", "s...
Cleans up the scene before closing. :param event | <QEvent>
[ "Cleans", "up", "the", "scene", "before", "closing", ".", ":", "param", "event", "|", "<QEvent", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodewidget.py#L162-L173
train
Cleans up the scene before closing.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodewidget.py
XNodeWidget.viewportRect
def viewportRect(self): """ Returns the QRectF that represents the visible viewport rect for the current view. :return <QRectF> """ w = self.width() h = self.height() vbar = self.verticalScrollBar() hbar = self.hori...
python
def viewportRect(self): """ Returns the QRectF that represents the visible viewport rect for the current view. :return <QRectF> """ w = self.width() h = self.height() vbar = self.verticalScrollBar() hbar = self.hori...
[ "def", "viewportRect", "(", "self", ")", ":", "w", "=", "self", ".", "width", "(", ")", "h", "=", "self", ".", "height", "(", ")", "vbar", "=", "self", ".", "verticalScrollBar", "(", ")", "hbar", "=", "self", ".", "horizontalScrollBar", "(", ")", "...
Returns the QRectF that represents the visible viewport rect for the current view. :return <QRectF>
[ "Returns", "the", "QRectF", "that", "represents", "the", "visible", "viewport", "rect", "for", "the", "current", "view", ".", ":", "return", "<QRectF", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodewidget.py#L252-L276
train
Returns the first visible viewport rect for the current view.
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodewidget.py
XNodeWidget.zoomExtents
def zoomExtents(self): """ Fits all the nodes in the view. """ rect = self.scene().visibleItemsBoundingRect() vrect = self.viewportRect() if rect.width(): changed = False scene_rect = self.scene().sceneRect() ...
python
def zoomExtents(self): """ Fits all the nodes in the view. """ rect = self.scene().visibleItemsBoundingRect() vrect = self.viewportRect() if rect.width(): changed = False scene_rect = self.scene().sceneRect() ...
[ "def", "zoomExtents", "(", "self", ")", ":", "rect", "=", "self", ".", "scene", "(", ")", ".", "visibleItemsBoundingRect", "(", ")", "vrect", "=", "self", ".", "viewportRect", "(", ")", "if", "rect", ".", "width", "(", ")", ":", "changed", "=", "Fals...
Fits all the nodes in the view.
[ "Fits", "all", "the", "nodes", "in", "the", "view", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodewidget.py#L287-L314
train
Fits all the nodes in the view.
faxir/faxir-python
faxir/api/numbers_api.py
NumbersApi.get_number
def get_number(self, number, **kwargs): # noqa: E501 """Get number information # noqa: E501 Get info of a single number # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.get_numb...
python
def get_number(self, number, **kwargs): # noqa: E501 """Get number information # noqa: E501 Get info of a single number # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.get_numb...
[ "def", "get_number", "(", "self", ",", "number", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async'", ")", ":", "return", "self", ".", "get_number_with_h...
Get number information # noqa: E501 Get info of a single number # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.get_number(number, async=True) >>> result = thread.get() ...
[ "Get", "number", "information", "#", "noqa", ":", "E501" ]
75ed2ea487a6be537342baea1077a02b0c8e70c1
https://github.com/faxir/faxir-python/blob/75ed2ea487a6be537342baea1077a02b0c8e70c1/faxir/api/numbers_api.py#L36-L56
train
Get a single number from the cache.