code
string
signature
string
docstring
string
loss_without_docstring
float64
loss_with_docstring
float64
factor
float64
oldLanguage = self.language() self.clearSyntax() syntax = self._globalSyntaxManager.getSyntax(xmlFileName=xmlFileName, mimeType=mimeType, languageName=language, sourceFilePath=sourceFilePath, firstLine=firstLine) if syntax is not None: self._highlighter = SyntaxHighlighter(syntax, self) self._indenter.setSyntax(syntax) keywords = {kw for kwList in syntax.parser.lists.values() for kw in kwList} self._completer.setKeywords(keywords) newLanguage = self.language() if oldLanguage != newLanguage: self.languageChanged.emit(newLanguage) return syntax is not None
def detectSyntax(self, xmlFileName=None, mimeType=None, language=None, sourceFilePath=None, firstLine=None)
Get syntax by next parameters (fill as many, as known): * name of XML file with syntax definition * MIME type of source file * Programming language name * Source file path * First line of source file First parameter in the list has the hightest priority. Old syntax is always cleared, even if failed to detect new. Method returns ``True``, if syntax is detected, and ``False`` otherwise
3.629087
3.673511
0.987907
if self._highlighter is not None: self._highlighter.terminate() self._highlighter = None self.languageChanged.emit(None)
def clearSyntax(self)
Clear syntax. Disables syntax highlighting This method might take long time, if document is big. Don't call it if you don't have to (i.e. in destructor)
5.457486
4.582905
1.190835
if not isinstance(wordSet, set): raise TypeError('"wordSet" is not a set: %s' % type(wordSet)) self._completer.setCustomCompletions(wordSet)
def setCustomCompletions(self, wordSet)
Add a set of custom completions to the editors completions. This set is managed independently of the set of keywords and words from the current document, and can thus be changed at any time.
3.183765
3.265436
0.974989
if isinstance(blockOrBlockNumber, QTextBlock): block = blockOrBlockNumber else: block = self.document().findBlockByNumber(blockOrBlockNumber) return self._highlighter is None or \ self._highlighter.isCode(block, column)
def isCode(self, blockOrBlockNumber, column)
Check if text at given position is a code. If language is not known, or text is not parsed yet, ``True`` is returned
2.88623
2.988765
0.965693
return self._highlighter is not None and \ self._highlighter.isComment(self.document().findBlockByNumber(line), column)
def isComment(self, line, column)
Check if text at given position is a comment. Including block comments and here documents. If language is not known, or text is not parsed yet, ``False`` is returned
6.192134
6.714666
0.92218
return self._highlighter is not None and \ self._highlighter.isBlockComment(self.document().findBlockByNumber(line), column)
def isBlockComment(self, line, column)
Check if text at given position is a block comment. If language is not known, or text is not parsed yet, ``False`` is returned
6.286933
6.624235
0.949081
return self._highlighter is not None and \ self._highlighter.isHereDoc(self.document().findBlockByNumber(line), column)
def isHereDoc(self, line, column)
Check if text at given position is a here document. If language is not known, or text is not parsed yet, ``False`` is returned
5.888632
6.254631
0.941484
def _makeQtExtraSelection(startAbsolutePosition, length): selection = QTextEdit.ExtraSelection() cursor = QTextCursor(self.document()) cursor.setPosition(startAbsolutePosition) cursor.setPosition(startAbsolutePosition + length, QTextCursor.KeepAnchor) selection.cursor = cursor selection.format = self._userExtraSelectionFormat return selection self._userExtraSelections = [_makeQtExtraSelection(*item) for item in selections] self._updateExtraSelections()
def setExtraSelections(self, selections)
Set list of extra selections. Selections are list of tuples ``(startAbsolutePosition, length)``. Extra selections are reset on any text modification. This is reimplemented method of QPlainTextEdit, it has different signature. Do not use QPlainTextEdit method
3.313182
2.622069
1.263576
block = self.document().findBlockByNumber(line) if not block.isValid(): raise IndexError("Invalid line index %d" % line) if column >= block.length(): raise IndexError("Invalid column index %d" % column) return block.position() + column
def mapToAbsPosition(self, line, column)
Convert line and column number to absolute position
2.969029
2.915185
1.01847
block = self.document().findBlock(absPosition) if not block.isValid(): raise IndexError("Invalid absolute position %d" % absPosition) return (block.blockNumber(), absPosition - block.position())
def mapToLineCol(self, absPosition)
Convert absolute position to ``(line, column)``
4.17762
3.875449
1.077971
if self._lineLengthEdge is not None: cr = self.contentsRect() # contents margin usually gives 1 # cursor rectangle left edge for the very first character usually # gives 4 x = self.fontMetrics().width('9' * self._lineLengthEdge) + \ self._totalMarginWidth + \ self.contentsMargins().left() + \ self.__cursorRect(self.firstVisibleBlock(), 0, offset=0).left() self._solidEdgeLine.setGeometry(QRect(x, cr.top(), 1, cr.bottom()))
def _setSolidEdgeGeometry(self)
Sets the solid edge line geometry if needed
10.333801
9.87307
1.046665
cursor = self.textCursor() atStartOfLine = cursor.positionInBlock() == 0 with self: cursor.insertBlock() if not atStartOfLine: # if whole line is moved down - just leave it as is self._indenter.autoIndentBlock(cursor.block()) self.ensureCursorVisible()
def _insertNewBlock(self)
Enter pressed. Insert properly indented block
7.126596
6.212397
1.147157
painter = QPainter(self.viewport()) def drawWhiteSpace(block, column, char): leftCursorRect = self.__cursorRect(block, column, 0) rightCursorRect = self.__cursorRect(block, column + 1, 0) if leftCursorRect.top() == rightCursorRect.top(): # if on the same visual line middleHeight = (leftCursorRect.top() + leftCursorRect.bottom()) / 2 if char == ' ': painter.setPen(Qt.transparent) painter.setBrush(QBrush(Qt.gray)) xPos = (leftCursorRect.x() + rightCursorRect.x()) / 2 painter.drawRect(QRect(xPos, middleHeight, 2, 2)) else: painter.setPen(QColor(Qt.gray).lighter(factor=120)) painter.drawLine(leftCursorRect.x() + 3, middleHeight, rightCursorRect.x() - 3, middleHeight) def effectiveEdgePos(text): if self._lineLengthEdge is None: return -1 tabExtraWidth = self.indentWidth - 1 fullWidth = len(text) + (text.count('\t') * tabExtraWidth) if fullWidth <= self._lineLengthEdge: return -1 currentWidth = 0 for pos, char in enumerate(text): if char == '\t': # Qt indents up to indentation level, so visible \t width depends on position currentWidth += (self.indentWidth - (currentWidth % self.indentWidth)) else: currentWidth += 1 if currentWidth > self._lineLengthEdge: return pos else: # line too narrow, probably visible \t width is small return -1 def drawEdgeLine(block, edgePos): painter.setPen(QPen(QBrush(self._lineLengthEdgeColor), 0)) rect = self.__cursorRect(block, edgePos, 0) painter.drawLine(rect.topLeft(), rect.bottomLeft()) def drawIndentMarker(block, column): painter.setPen(QColor(Qt.blue).lighter()) rect = self.__cursorRect(block, column, offset=0) painter.drawLine(rect.topLeft(), rect.bottomLeft()) indentWidthChars = len(self._indenter.text()) cursorPos = self.cursorPosition for block in iterateBlocksFrom(self.firstVisibleBlock()): blockGeometry = self.blockBoundingGeometry(block).translated(self.contentOffset()) if blockGeometry.top() > paintEventRect.bottom(): break if block.isVisible() and blockGeometry.toRect().intersects(paintEventRect): # Draw indent markers, if good indentation is not drawn if self._drawIndentations: text = block.text() if not self.drawAnyWhitespace: column = indentWidthChars while text.startswith(self._indenter.text()) and \ len(text) > indentWidthChars and \ text[indentWidthChars].isspace(): if column != self._lineLengthEdge and \ (block.blockNumber(), column) != cursorPos: # looks ugly, if both drawn drawIndentMarker(block, column) text = text[indentWidthChars:] column += indentWidthChars # Draw edge, but not over a cursor if not self._drawSolidEdge: edgePos = effectiveEdgePos(block.text()) if edgePos != -1 and edgePos != cursorPos[1]: drawEdgeLine(block, edgePos) if self.drawAnyWhitespace or \ self.drawIncorrectIndentation: text = block.text() for column, draw in enumerate(self._chooseVisibleWhitespace(text)): if draw: drawWhiteSpace(block, column, text[column])
def _drawIndentMarkersAndEdge(self, paintEventRect)
Draw indentation markers
3.714774
3.701236
1.003658
if self._currentLineColor is None: return [] def makeSelection(cursor): selection = QTextEdit.ExtraSelection() selection.format.setBackground(self._currentLineColor) selection.format.setProperty(QTextFormat.FullWidthSelection, True) cursor.clearSelection() selection.cursor = cursor return selection rectangularSelectionCursors = self._rectangularSelection.cursors() if rectangularSelectionCursors: return [makeSelection(cursor) \ for cursor in rectangularSelectionCursors] else: return [makeSelection(self.textCursor())]
def _currentLineExtraSelections(self)
QTextEdit.ExtraSelection, which highlightes current line
2.688553
2.477339
1.085258
cursorColumnIndex = self.textCursor().positionInBlock() bracketSelections = self._bracketHighlighter.extraSelections(self, self.textCursor().block(), cursorColumnIndex) selections = self._currentLineExtraSelections() + \ self._rectangularSelection.selections() + \ bracketSelections + \ self._userExtraSelections self._nonVimExtraSelections = selections if self._vim is None: allSelections = selections else: allSelections = selections + self._vim.extraSelections() QPlainTextEdit.setExtraSelections(self, allSelections)
def _updateExtraSelections(self)
Highlight current line
5.357857
4.878032
1.098364
value = self.verticalScrollBar().value() if down: value += 1 else: value -= 1 self.verticalScrollBar().setValue(value)
def _onShortcutScroll(self, down)
Ctrl+Up/Down pressed, scroll viewport
2.693849
2.622128
1.027352
cursor = self.textCursor() cursor.movePosition(QTextCursor.Down if down else QTextCursor.Up, QTextCursor.KeepAnchor) self.setTextCursor(cursor) self._onShortcutScroll(down)
def _onShortcutSelectAndScroll(self, down)
Ctrl+Shift+Up/Down pressed. Select line and scroll viewport
2.566487
2.776532
0.92435
# Gather info for cursor state and movement. cursor = self.textCursor() text = cursor.block().text() indent = len(text) - len(text.lstrip()) anchor = QTextCursor.KeepAnchor if select else QTextCursor.MoveAnchor # Determine current state and move based on that. if cursor.positionInBlock() == indent: # We're at the beginning of the indent. Go to the beginning of the # block. cursor.movePosition(QTextCursor.StartOfBlock, anchor) elif cursor.atBlockStart(): # We're at the beginning of the block. Go to the beginning of the # indent. setPositionInBlock(cursor, indent, anchor) else: # Neither of the above. There's no way I can find to directly # determine if we're at the beginning of a line. So, try moving and # see if the cursor location changes. pos = cursor.positionInBlock() cursor.movePosition(QTextCursor.StartOfLine, anchor) # If we didn't move, we were already at the beginning of the line. # So, move to the indent. if pos == cursor.positionInBlock(): setPositionInBlock(cursor, indent, anchor) # If we did move, check to see if the indent was closer to the # cursor than the beginning of the indent. If so, move to the # indent. elif cursor.positionInBlock() < indent: setPositionInBlock(cursor, indent, anchor) self.setTextCursor(cursor)
def _onShortcutHome(self, select)
Home pressed. Run a state machine: 1. Not at the line beginning. Move to the beginning of the line or the beginning of the indent, whichever is closest to the current cursor position. 2. At the line beginning. Move to the beginning of the indent. 3. At the beginning of the indent. Go to the beginning of the block. 4. At the beginning of the block. Go to the beginning of the indent.
3.075007
2.801015
1.097819
startBlock = self.document().findBlockByNumber(startBlockNumber) endBlock = self.document().findBlockByNumber(endBlockNumber) cursor = QTextCursor(startBlock) cursor.setPosition(endBlock.position(), QTextCursor.KeepAnchor) cursor.movePosition(QTextCursor.EndOfBlock, QTextCursor.KeepAnchor) self.setTextCursor(cursor)
def _selectLines(self, startBlockNumber, endBlockNumber)
Select whole lines
1.896423
1.743174
1.087914
cursor = self.textCursor() return self.document().findBlock(cursor.selectionStart()), \ self.document().findBlock(cursor.selectionEnd())
def _selectedBlocks(self)
Return selected blocks and tuple (startBlock, endBlock)
3.812952
3.215119
1.185944
startBlock, endBlock = self._selectedBlocks() return startBlock.blockNumber(), endBlock.blockNumber()
def _selectedBlockNumbers(self)
Return selected block numbers and tuple (startBlockNumber, endBlockNumber)
5.037044
3.709885
1.357736
startBlock, endBlock = self._selectedBlocks() startBlockNumber = startBlock.blockNumber() endBlockNumber = endBlock.blockNumber() def _moveBlock(block, newNumber): text = block.text() with self: del self.lines[block.blockNumber()] self.lines.insert(newNumber, text) if down: # move next block up blockToMove = endBlock.next() if not blockToMove.isValid(): return # if operaiton is UnDone, marks are located incorrectly markMargin = self.getMargin("mark_area") if markMargin: markMargin.clearBookmarks(startBlock, endBlock.next()) _moveBlock(blockToMove, startBlockNumber) self._selectLines(startBlockNumber + 1, endBlockNumber + 1) else: # move previous block down blockToMove = startBlock.previous() if not blockToMove.isValid(): return # if operaiton is UnDone, marks are located incorrectly markMargin = self.getMargin("mark_area") if markMargin: markMargin.clearBookmarks(startBlock, endBlock) _moveBlock(blockToMove, endBlockNumber) self._selectLines(startBlockNumber - 1, endBlockNumber - 1) if markMargin: markMargin.update()
def _onShortcutMoveLine(self, down)
Move line up or down Actually, not a selected text, but next or previous block is moved TODO keep bookmarks when moving
3.070878
2.877436
1.067227
lines = self.lines[self._selectedLinesSlice()] text = self._eol.join(lines) QApplication.clipboard().setText(text)
def _onShortcutCopyLine(self)
Copy selected lines to the clipboard
8.514236
6.922356
1.229962
lines = self.lines[self._selectedLinesSlice()] text = QApplication.clipboard().text() if text: with self: if self.textCursor().hasSelection(): startBlockNumber, endBlockNumber = self._selectedBlockNumbers() del self.lines[self._selectedLinesSlice()] self.lines.insert(startBlockNumber, text) else: line, col = self.cursorPosition if col > 0: line = line + 1 self.lines.insert(line, text)
def _onShortcutPasteLine(self)
Paste lines from the clipboard
4.098747
4.021772
1.01914
lines = self.lines[self._selectedLinesSlice()] self._onShortcutCopyLine() self._onShortcutDeleteLine()
def _onShortcutCutLine(self)
Cut selected lines to the clipboard
11.687612
10.118857
1.155033
cursor = self.textCursor() if cursor.hasSelection(): # duplicate selection text = cursor.selectedText() selectionStart, selectionEnd = cursor.selectionStart(), cursor.selectionEnd() cursor.setPosition(selectionEnd) cursor.insertText(text) # restore selection cursor.setPosition(selectionStart) cursor.setPosition(selectionEnd, QTextCursor.KeepAnchor) self.setTextCursor(cursor) else: line = cursor.blockNumber() self.lines.insert(line + 1, self.lines[line]) self.ensureCursorVisible() self._updateExtraSelections()
def _onShortcutDuplicateLine(self)
Duplicate selected text or current line
2.550721
2.473892
1.031056
dialog = QPrintDialog(self) if dialog.exec_() == QDialog.Accepted: printer = dialog.printer() self.print_(printer)
def _onShortcutPrint(self)
Ctrl+P handler. Show dialog, print file
3.148804
3.052951
1.031397
if index is None: self._margins.append(margin) else: self._margins.insert(index, margin) if margin.isVisible(): self.updateViewport()
def addMargin(self, margin, index=None)
Adds a new margin. index: index in the list of margins. Default: to the end of the list
3.372427
3.196506
1.055035
for margin in self._margins: if margin.getName() == name: return margin return None
def getMargin(self, name)
Provides the requested margin. Returns a reference to the margin if found and None otherwise
3.280549
3.488645
0.940351
for index, margin in enumerate(self._margins): if margin.getName() == name: visible = margin.isVisible() margin.clear() margin.deleteLater() del self._margins[index] if visible: self.updateViewport() return True return False
def delMargin(self, name)
Deletes a margin. Returns True if the margin was deleted and False otherwise.
3.298713
3.206976
1.028605
painter = QPainter(self) painter.fillRect(event.rect(), self.palette().color(QPalette.Window)) painter.setPen(Qt.black) block = self._qpart.firstVisibleBlock() blockNumber = block.blockNumber() top = int(self._qpart.blockBoundingGeometry(block).translated(self._qpart.contentOffset()).top()) bottom = top + int(self._qpart.blockBoundingRect(block).height()) singleBlockHeight = self._qpart.cursorRect().height() boundingRect = self._qpart.blockBoundingRect(block) availableWidth = self.__width - self._RIGHT_MARGIN - self._LEFT_MARGIN availableHeight = self._qpart.fontMetrics().height() while block.isValid() and top <= event.rect().bottom(): if block.isVisible() and bottom >= event.rect().top(): number = str(blockNumber + 1) painter.drawText(self._LEFT_MARGIN, top, availableWidth, availableHeight, Qt.AlignRight, number) if boundingRect.height() >= singleBlockHeight * 2: # wrapped block painter.fillRect(1, top + singleBlockHeight, self.__width - 2, boundingRect.height() - singleBlockHeight - 2, Qt.darkGreen) block = block.next() boundingRect = self._qpart.blockBoundingRect(block) top = bottom bottom = top + int(boundingRect.height()) blockNumber += 1
def paintEvent(self, event)
QWidget.paintEvent() implementation
2.453297
2.435385
1.007355
painter = QPainter(self) painter.fillRect(event.rect(), self.palette().color(QPalette.Window)) block = self._qpart.firstVisibleBlock() blockBoundingGeometry = self._qpart.blockBoundingGeometry(block).translated(self._qpart.contentOffset()) top = blockBoundingGeometry.top() bottom = top + blockBoundingGeometry.height() for block in qutepart.iterateBlocksFrom(block): height = self._qpart.blockBoundingGeometry(block).height() if top > event.rect().bottom(): break if block.isVisible() and \ bottom >= event.rect().top(): if block.blockNumber() in self._qpart.lintMarks: msgType, msgText = self._qpart.lintMarks[block.blockNumber()] pixMap = self._lintPixmaps[msgType] yPos = top + ((height - pixMap.height()) / 2) # centered painter.drawPixmap(0, yPos, pixMap) if self.isBlockMarked(block): yPos = top + ((height - self._bookmarkPixmap.height()) / 2) # centered painter.drawPixmap(0, yPos, self._bookmarkPixmap) top += height
def paintEvent(self, event)
QWidget.paintEvent() implementation Draw markers
3.138094
3.146711
0.997261
if method in self._scheduledMethods: self._scheduledMethods.remove(method) if not self._scheduledMethods: self._timer.stop()
def cancel(self, method)
Cancel scheduled method Safe method, may be called with not-scheduled method
3.794783
3.428002
1.106996
self._typedText = wordBeforeCursor self.words = self._makeListOfCompletions(wordBeforeCursor, wholeWord) commonStart = self._commonWordStart(self.words) self.canCompleteText = commonStart[len(wordBeforeCursor):] self.layoutChanged.emit()
def setData(self, wordBeforeCursor, wholeWord)
Set model information
6.949787
7.344636
0.94624
if role == Qt.DisplayRole and \ index.row() < len(self.words): text = self.words[index.row()] typed = text[:len(self._typedText)] canComplete = text[len(self._typedText):len(self._typedText) + len(self.canCompleteText)] rest = text[len(self._typedText) + len(self.canCompleteText):] if canComplete: # NOTE foreground colors are hardcoded, but I can't set background color of selected item (Qt bug?) # might look bad on some color themes return '<html>' \ '%s' \ '<font color="#e80000">%s</font>' \ '%s' \ '</html>' % (typed, canComplete, rest) else: return typed + rest else: return None
def data(self, index, role)
QAbstractItemModel method implementation
4.516609
4.471099
1.010179
if not words: return '' length = 0 firstWord = words[0] otherWords = words[1:] for index, char in enumerate(firstWord): if not all([word[index] == char for word in otherWords]): break length = index + 1 return firstWord[:length]
def _commonWordStart(self, words)
Get common start of all words. i.e. for ['blablaxxx', 'blablayyy', 'blazzz'] common start is 'bla'
2.911633
2.748143
1.059491
onlySuitable = [word for word in self._wordSet \ if word.startswith(wordBeforeCursor) and \ word != wholeWord] return sorted(onlySuitable)
def _makeListOfCompletions(self, wordBeforeCursor, wholeWord)
Make list of completions, which shall be shown
7.200116
7.78134
0.925305
self._closeIfNotUpdatedTimer.stop() self._qpart.removeEventFilter(self) self._qpart.cursorPositionChanged.disconnect(self._onCursorPositionChanged) QListView.close(self)
def close(self)
Explicitly called destructor. Removes widget from the qpart
10.792776
7.560085
1.4276
width = max([self.fontMetrics().width(word) \ for word in self.model().words]) width = width * 1.4 # FIXME bad hack. invent better formula width += 30 # margin # drawn with scrollbar without +2. I don't know why rowCount = min(self.model().rowCount(), self._MAX_VISIBLE_ROWS) height = self.sizeHintForRow(0) * (rowCount + 0.5) # + 0.5 row margin return QSize(width, height)
def sizeHint(self)
QWidget.sizeHint implementation Automatically resizes the widget according to rows count FIXME very bad algorithm. Remove all this margins, if you can
8.328135
7.735249
1.076647
strangeAdjustment = 2 # I don't know why. Probably, won't work on other systems and versions return self.fontMetrics().width(self.model().typedText()) + strangeAdjustment
def _horizontalShift(self)
List should be plased such way, that typed text in the list is under typed text in the editor
30.127243
20.828745
1.446426
WIDGET_BORDER_MARGIN = 5 SCROLLBAR_WIDTH = 30 # just a guess sizeHint = self.sizeHint() width = sizeHint.width() height = sizeHint.height() cursorRect = self._qpart.cursorRect() parentSize = self.parentWidget().size() spaceBelow = parentSize.height() - cursorRect.bottom() - WIDGET_BORDER_MARGIN spaceAbove = cursorRect.top() - WIDGET_BORDER_MARGIN if height <= spaceBelow or \ spaceBelow > spaceAbove: yPos = cursorRect.bottom() if height > spaceBelow and \ spaceBelow > self.minimumHeight(): height = spaceBelow width = width + SCROLLBAR_WIDTH else: if height > spaceAbove and \ spaceAbove > self.minimumHeight(): height = spaceAbove width = width + SCROLLBAR_WIDTH yPos = max(3, cursorRect.top() - height) xPos = cursorRect.right() - self._horizontalShift() if xPos + width + WIDGET_BORDER_MARGIN > parentSize.width(): xPos = max(3, parentSize.width() - WIDGET_BORDER_MARGIN - width) self.setGeometry(xPos, yPos, width, height) self._closeIfNotUpdatedTimer.stop()
def updateGeometry(self)
Move widget to point under cursor
3.035851
2.923258
1.038516
if event.type() == QEvent.KeyPress and event.modifiers() == Qt.NoModifier: if event.key() == Qt.Key_Escape: self.closeMe.emit() return True elif event.key() == Qt.Key_Down: if self._selectedIndex + 1 < self.model().rowCount(): self._selectItem(self._selectedIndex + 1) return True elif event.key() == Qt.Key_Up: if self._selectedIndex - 1 >= 0: self._selectItem(self._selectedIndex - 1) return True elif event.key() in (Qt.Key_Enter, Qt.Key_Return): if self._selectedIndex != -1: self.itemSelected.emit(self._selectedIndex) return True elif event.key() == Qt.Key_Tab: self.tabPressed.emit() return True elif event.type() == QEvent.FocusOut: self.closeMe.emit() return False
def eventFilter(self, object, event)
Catch events from qpart Move selection, select item, or close themselves
1.763304
1.704503
1.034497
self._selectedIndex = index self.setCurrentIndex(self.model().createIndex(index, 0))
def _selectItem(self, index)
Select item in the list
5.214647
5.424874
0.961248
self._wordSet = set(self._keywords) | set(self._customCompletions) start = time.time() for line in self._qpart.lines: for match in _wordRegExp.findall(line): self._wordSet.add(match) if time.time() - start > self._WORD_SET_UPDATE_MAX_TIME_SEC: break
def _updateWordSet(self)
Make a set of words, which shall be completed, from text
6.104363
5.747046
1.062174
if self._qpart.completionEnabled and self._wordSet is not None: wordBeforeCursor = self._wordBeforeCursor() wholeWord = wordBeforeCursor + self._wordAfterCursor() forceShow = requestedByUser or self._completionOpenedManually if wordBeforeCursor: if len(wordBeforeCursor) >= self._qpart.completionThreshold or forceShow: if self._widget is None: model = _CompletionModel(self._wordSet) model.setData(wordBeforeCursor, wholeWord) if self._shouldShowModel(model, forceShow): self._createWidget(model) return True else: self._widget.model().setData(wordBeforeCursor, wholeWord) if self._shouldShowModel(self._widget.model(), forceShow): self._widget.updateGeometry() return True self._closeCompletion() return False
def invokeCompletionIfAvailable(self, requestedByUser=False)
Invoke completion, if available. Called after text has been typed in qpart Returns True, if invoked
4.670805
4.48867
1.040577
if self._widget is not None: self._widget.close() self._widget = None self._completionOpenedManually = False
def _closeCompletion(self)
Close completion, if visible. Delete widget
5.794669
5.521083
1.049553
cursor = self._qpart.textCursor() textBeforeCursor = cursor.block().text()[:cursor.positionInBlock()] match = _wordAtEndRegExp.search(textBeforeCursor) if match: return match.group(0) else: return ''
def _wordBeforeCursor(self)
Get word, which is located before cursor
4.245955
4.213581
1.007683
cursor = self._qpart.textCursor() textAfterCursor = cursor.block().text()[cursor.positionInBlock():] match = _wordAtStartRegExp.search(textAfterCursor) if match: return match.group(0) else: return ''
def _wordAfterCursor(self)
Get word, which is located before cursor
4.42645
4.379838
1.010643
model = self._widget.model() selectedWord = model.words[index] textToInsert = selectedWord[len(model.typedText()):] self._qpart.textCursor().insertText(textToInsert) self._closeCompletion()
def _onCompletionListItemSelected(self, index)
Item selected. Insert completion to editor
9.117686
8.069824
1.129849
canCompleteText = self._widget.model().canCompleteText if canCompleteText: self._qpart.textCursor().insertText(canCompleteText) self.invokeCompletionIfAvailable()
def _onCompletionListTabPressed(self)
Tab pressed on completion list Insert completable text, if available
11.687205
9.093888
1.285171
obj = klass(*choices, **kwargs) for subset in subsets: obj.add_subset(*subset) return obj
def create_choice(klass, choices, subsets, kwargs)
Create an instance of a ``Choices`` object. Parameters ---------- klass : type The class to use to recreate the object. choices : list(tuple) A list of choices as expected by the ``__init__`` method of ``klass``. subsets : list(tuple) A tuple with an entry for each subset to create. Each entry is a list with two entries: - the name of the subsets - a list of the constants to use for this subset kwargs : dict Extra parameters expected on the ``__init__`` method of ``klass``. Returns ------- Choices A new instance of ``Choices`` (or other class defined in ``klass``).
3.499528
4.962606
0.705179
# Check that each new constant is unique. constants = [c[0] for c in choices] constants_doubles = [c for c in constants if constants.count(c) > 1] if constants_doubles: raise ValueError("You cannot declare two constants with the same constant name. " "Problematic constants: %s " % list(set(constants_doubles))) # Check that none of the new constants already exists. bad_constants = set(constants).intersection(self.constants) if bad_constants: raise ValueError("You cannot add existing constants. " "Existing constants: %s." % list(bad_constants)) # Check that none of the constant is an existing attributes bad_constants = [c for c in constants if hasattr(self, c)] if bad_constants: raise ValueError("You cannot add constants that already exists as attributes. " "Existing attributes: %s." % list(bad_constants)) # Check that each new value is unique. values = [c[1] for c in choices] values_doubles = [c for c in values if values.count(c) > 1] if values_doubles: raise ValueError("You cannot declare two choices with the same name." "Problematic values: %s " % list(set(values_doubles))) # Check that none of the new values already exists. try: bad_values = set(values).intersection(self.values) except TypeError: raise ValueError("One value cannot be used in: %s" % list(values)) else: if bad_values: raise ValueError("You cannot add existing values. " "Existing values: %s." % list(bad_values)) # We can now add each choice. for choice_tuple in choices: # Convert the choice tuple in a ``ChoiceEntry`` instance if it's not already done. # It allows to share choice entries between a ``Choices`` instance and its subsets. choice_entry = choice_tuple if not isinstance(choice_entry, self.ChoiceEntryClass): choice_entry = self.ChoiceEntryClass(choice_entry) # Append to the main list the choice as expected by django: (value, display name). self.append(choice_entry.choice) # And the ``ChoiceEntry`` instance to our own internal list. self.entries.append(choice_entry) # Make the value accessible via an attribute (the constant being its name). setattr(self, choice_entry.constant, choice_entry.value) # Fill dicts to access the ``ChoiceEntry`` instance by its constant, value or display.. self.constants[choice_entry.constant] = choice_entry self.values[choice_entry.value] = choice_entry self.displays[choice_entry.display] = choice_entry return constants
def _convert_choices(self, choices)
Validate each choices Parameters ---------- choices : list of tuples The list of choices to be added Returns ------- list The list of the added constants
2.998991
2.955688
1.014651
# It the ``_mutable`` flag is falsy, which is the case for subsets, we refuse to add # new choices. if not self._mutable: raise RuntimeError("This ``Choices`` instance cannot be updated.") # Check for an optional subset name as the first argument (so the first entry of *choices). subset_name = None if choices and isinstance(choices[0], six.string_types) and choices[0] != _NO_SUBSET_NAME_: subset_name = choices[0] choices = choices[1:] # Check for an optional subset name in the named arguments. if kwargs.get('name', None): if subset_name: raise ValueError("The name of the subset cannot be defined as the first " "argument and also as a named argument") subset_name = kwargs['name'] constants = self._convert_choices(choices) # If we have a subset name, create a new subset with all the given constants. if subset_name: self.add_subset(subset_name, constants)
def add_choices(self, *choices, **kwargs)
Add some choices to the current ``Choices`` instance. The given choices will be added to the existing choices. If a ``name`` attribute is passed, a new subset will be created with all the given choices. Note that it's not possible to add new choices to a subset. Parameters ---------- *choices : list of tuples It's the list of tuples to add to the ``Choices`` instance, each tuple having three entries: the constant name, the value, the display name. A dict could be added as a 4th entry in the tuple to allow setting arbitrary arguments to the final ``ChoiceEntry`` created for this choice tuple. If the first entry of ``*choices`` is a string, then it will be used as a name for a new subset that will contain all the given choices. **kwargs : dict name : string Instead of using the first entry of the ``*choices`` to pass a name of a subset to create, you can pass it via the ``name`` named argument. Example ------- >>> MY_CHOICES = Choices() >>> MY_CHOICES.add_choices(('ZERO', 0, 'zero')) >>> MY_CHOICES [('ZERO', 0, 'zero')] >>> MY_CHOICES.add_choices('SMALL', ('ONE', 1, 'one'), ('TWO', 2, 'two')) >>> MY_CHOICES [('ZERO', 0, 'zero'), ('ONE', 1, 'one'), ('TWO', 2, 'two')] >>> MY_CHOICES.SMALL [('ONE', 1, 'one'), ('TWO', 2, 'two')] >>> MY_CHOICES.add_choices(('THREE', 3, 'three'), ('FOUR', 4, 'four'), name='BIG') >>> MY_CHOICES [('ZERO', 0, 'zero'), ('ONE', 1, 'one'), ('TWO', 2, 'two'), ('THREE', 3, 'three'), ('FOUR', 4, 'four')] >>> MY_CHOICES.BIG [('THREE', 3, 'three'), ('FOUR', 4, 'four')] Raises ------ RuntimeError When the ``Choices`` instance is marked as not mutable, which is the case for subsets. ValueError * if the subset name is defined as first argument and as named argument. * if some constants have the same name or the same value. * if at least one constant or value already exists in the instance.
4.900656
3.64425
1.344764
# Ensure that all passed constants exists as such in the list of available constants. bad_constants = set(constants).difference(self.constants) if bad_constants: raise ValueError("All constants in subsets should be in parent choice. " "Missing constants: %s." % list(bad_constants)) # Keep only entries we asked for. choice_entries = [self.constants[c] for c in constants] # Create a new ``Choices`` instance with the limited set of entries, and pass the other # configuration attributes to share the same behavior as the current ``Choices``. # Also we set ``mutable`` to False to disable the possibility to add new choices to the # subset. subset = self.__class__( *choice_entries, **{ 'dict_class': self.dict_class, 'mutable': False, } ) return subset
def extract_subset(self, *constants)
Create a subset of entries This subset is a new ``Choices`` instance, with only the wanted constants from the main ``Choices`` (each "choice entry" in the subset is shared from the main ``Choices``) Parameters ---------- *constants: list The constants names of this ``Choices`` object to make available in the subset. Returns ------- Choices The newly created subset, which is a ``Choices`` object Example ------- >>> STATES = Choices( ... ('ONLINE', 1, 'Online'), ... ('DRAFT', 2, 'Draft'), ... ('OFFLINE', 3, 'Offline'), ... ) >>> STATES [('ONLINE', 1, 'Online'), ('DRAFT', 2, 'Draft'), ('OFFLINE', 3, 'Offline')] >>> subset = STATES.extract_subset('DRAFT', 'OFFLINE') >>> subset [('DRAFT', 2, 'Draft'), ('OFFLINE', 3, 'Offline')] >>> subset.DRAFT 2 >>> subset.for_constant('DRAFT') is STATES.for_constant('DRAFT') True >>> subset.ONLINE Traceback (most recent call last): ... AttributeError: 'Choices' object has no attribute 'ONLINE' Raises ------ ValueError If a constant is not defined as a constant in the ``Choices`` instance.
6.328253
5.710585
1.108162
# Ensure that the name is not already used as an attribute. if hasattr(self, name): raise ValueError("Cannot use '%s' as a subset name. " "It's already an attribute." % name) subset = self.extract_subset(*constants) # Make the subset accessible via an attribute. setattr(self, name, subset) self.subsets.append(name)
def add_subset(self, name, constants)
Add a subset of entries under a defined name. This allow to defined a "sub choice" if a django field need to not have the whole choice available. The sub-choice is a new ``Choices`` instance, with only the wanted the constant from the main ``Choices`` (each "choice entry" in the subset is shared from the main ``Choices``) The sub-choice is accessible from the main ``Choices`` by an attribute having the given name. Parameters ---------- name : string Name of the attribute that will old the new ``Choices`` instance. constants: list or tuple List of the constants name of this ``Choices`` object to make available in the subset. Returns ------- Choices The newly created subset, which is a ``Choices`` object Example ------- >>> STATES = Choices( ... ('ONLINE', 1, 'Online'), ... ('DRAFT', 2, 'Draft'), ... ('OFFLINE', 3, 'Offline'), ... ) >>> STATES [('ONLINE', 1, 'Online'), ('DRAFT', 2, 'Draft'), ('OFFLINE', 3, 'Offline')] >>> STATES.add_subset('NOT_ONLINE', ('DRAFT', 'OFFLINE',)) >>> STATES.NOT_ONLINE [('DRAFT', 2, 'Draft'), ('OFFLINE', 3, 'Offline')] >>> STATES.NOT_ONLINE.DRAFT 2 >>> STATES.NOT_ONLINE.for_constant('DRAFT') is STATES.for_constant('DRAFT') True >>> STATES.NOT_ONLINE.ONLINE Traceback (most recent call last): ... AttributeError: 'Choices' object has no attribute 'ONLINE' Raises ------ ValueError * If ``name`` is already an attribute of the ``Choices`` instance. * If a constant is not defined as a constant in the ``Choices`` instance.
4.151319
4.567803
0.908822
final_choices = [] for choice in choices: if isinstance(choice, ChoiceEntry): final_choices.append(choice) continue original_choice = choice choice = list(choice) length = len(choice) assert 2 <= length <= 4, 'Invalid number of entries in %s' % (original_choice,) final_choice = [] # do we have attributes? if length > 2 and isinstance(choice[-1], Mapping): final_choice.append(choice.pop()) elif length == 4: attributes = choice.pop() assert attributes is None or isinstance(attributes, Mapping), 'Last argument must be a dict-like object in %s' % (original_choice,) if attributes: final_choice.append(attributes) # the constant final_choice.insert(0, choice.pop(0)) # the db value final_choice.insert(1, choice.pop(0)) if len(choice): # we were given a display value final_choice.insert(2, choice.pop(0)) else: # no display value, we compute it from the constant final_choice.insert(2, self.display_transform(final_choice[0])) final_choices.append(final_choice) return super(AutoDisplayChoices, self)._convert_choices(final_choices)
def _convert_choices(self, choices)
Auto create display values then call super method
3.222495
3.043071
1.058962
return super(AutoChoices, self).add_choices(_NO_SUBSET_NAME_, *choices, **kwargs)
def add_choices(self, *choices, **kwargs)
Disallow super method to thing the first argument is a subset name
15.089664
7.224697
2.088622
final_choices = [] for choice in choices: if isinstance(choice, ChoiceEntry): final_choices.append(choice) continue original_choice = choice if isinstance(choice, six.string_types): if choice == _NO_SUBSET_NAME_: continue choice = [choice, ] else: choice = list(choice) length = len(choice) assert 1 <= length <= 4, 'Invalid number of entries in %s' % (original_choice,) final_choice = [] # do we have attributes? if length > 1 and isinstance(choice[-1], Mapping): final_choice.append(choice.pop()) elif length == 4: attributes = choice.pop() assert attributes is None or isinstance(attributes, Mapping), 'Last argument must be a dict-like object in %s' % (original_choice,) if attributes: final_choice.append(attributes) # the constant final_choice.insert(0, choice.pop(0)) if len(choice): # we were given a db value final_choice.insert(1, choice.pop(0)) if len(choice): # we were given a display value final_choice.insert(2, choice.pop(0)) else: # set None to compute it later final_choice.insert(1, None) if final_choice[1] is None: # no db value, we compute it from the constant final_choice[1] = self.value_transform(final_choice[0]) final_choices.append(final_choice) return super(AutoChoices, self)._convert_choices(final_choices)
def _convert_choices(self, choices)
Auto create db values then call super method
3.186932
3.095739
1.029457
# ``is_required`` is already checked in ``validate``. if value is None: return None # Validate the type. if not isinstance(value, six.string_types): raise forms.ValidationError( "Invalid value type (should be a string).", code='invalid-choice-type', ) # Get the constant from the choices object, raising if it doesn't exist. try: final = getattr(self.choices, value) except AttributeError: available = '[%s]' % ', '.join(self.choices.constants) raise forms.ValidationError( "Invalid value (not in available choices. Available ones are: %s" % available, code='non-existing-choice', ) return final
def to_python(self, value)
Convert the constant to the real choice value.
4.510393
4.127856
1.092672
klass = creator_type.get_class_for_value(value) return klass(value, choice_entry)
def create_choice_attribute(creator_type, value, choice_entry)
Create an instance of a subclass of ChoiceAttributeMixin for the given value. Parameters ---------- creator_type : type ``ChoiceAttributeMixin`` or a subclass, from which we'll call the ``get_class_for_value`` class-method. value : ? The value for which we want to create an instance of a new subclass of ``creator_type``. choice_entry: ChoiceEntry The ``ChoiceEntry`` instance that hold the current value, used to access its constant, value and display name. Returns ------- ChoiceAttributeMixin An instance of a subclass of ``creator_type`` for the given value
4.794537
3.878596
1.236153
type_ = value.__class__ # Check if the type is already a ``ChoiceAttribute`` if issubclass(type_, ChoiceAttributeMixin): # In this case we can return this type return type_ # Create a new class only if it wasn't already created for this type. if type_ not in cls._classes_by_type: # Compute the name of the class with the name of the type. class_name = str('%sChoiceAttribute' % type_.__name__.capitalize()) # Create a new class and save it in the cache. cls._classes_by_type[type_] = type(class_name, (cls, type_), { 'creator_type': cls, }) # Return the class from the cache based on the type. return cls._classes_by_type[type_]
def get_class_for_value(cls, value)
Class method to construct a class based on this mixin and the type of the given value. Parameters ---------- value: ? The value from which to extract the type to create the new class. Notes ----- The create classes are cached (in ``cls.__classes_by_type``) to avoid recreating already created classes.
3.657437
3.510047
1.041991
if value is None: raise ValueError('Using `None` in a `Choices` object is not supported. You may ' 'use an empty string.') return create_choice_attribute(self.ChoiceAttributeMixin, value, self)
def _get_choice_attribute(self, value)
Get a choice attribute for the given value. Parameters ---------- value: ? The value for which we want a choice attribute. Returns ------- An instance of a class based on ``ChoiceAttributeMixin`` for the given value. Raises ------ ValueError If the value is None, as we cannot really subclass NoneType.
10.392642
8.713517
1.192703
return "/".join(map(lambda x: str(x).rstrip('/'), args)).rstrip('/')
def urljoin(*args)
Joins given arguments into a url. Trailing but not leading slashes are stripped for each argument.
4.566891
4.781653
0.955086
if self.__server_version is None: from yagocd.resources.info import InfoManager self.__server_version = InfoManager(self).version return self.__server_version
def server_version(self)
Special method for getting server version. Because of different behaviour on different versions of server, we have to pass different headers to the endpoints. This method requests the version from server and caches it in internal variable, so other resources could use it. :return: server version parsed from `about` page.
5.079861
5.851909
0.868069
if 'pipeline_name' in self.data and self.data.pipeline_name: return self.data.get('pipeline_name') elif self.stage.pipeline is not None: return self.stage.pipeline.data.name else: return self.stage.data.pipeline_name
def pipeline_name(self)
Get pipeline name of current job instance. Because instantiating job instance could be performed in different ways and those return different results, we have to check where from to get name of the pipeline. :return: pipeline name.
3.217331
3.493898
0.920843
if 'pipeline_counter' in self.data and self.data.pipeline_counter: return self.data.get('pipeline_counter') elif self.stage.pipeline is not None: return self.stage.pipeline.data.counter else: return self.stage.data.pipeline_counter
def pipeline_counter(self)
Get pipeline counter of current job instance. Because instantiating job instance could be performed in different ways and those return different results, we have to check where from to get counter of the pipeline. :return: pipeline counter.
3.597045
3.781458
0.951232
if 'stage_name' in self.data and self.data.stage_name: return self.data.get('stage_name') else: return self.stage.data.name
def stage_name(self)
Get stage name of current job instance. Because instantiating job instance could be performed in different ways and those return different results, we have to check where from to get name of the stage. :return: stage name.
3.862342
4.561086
0.846803
if 'stage_counter' in self.data and self.data.stage_counter: return self.data.get('stage_counter') else: return self.stage.data.counter
def stage_counter(self)
Get stage counter of current job instance. Because instantiating job instance could be performed in different ways and those return different results, we have to check where from to get counter of the stage. :return: stage counter.
4.244793
4.646871
0.913474
return ArtifactManager( session=self._session, pipeline_name=self.pipeline_name, pipeline_counter=self.pipeline_counter, stage_name=self.stage_name, stage_counter=self.stage_counter, job_name=self.data.name )
def artifacts(self)
Property for accessing artifact manager of the current job. :return: instance of :class:`yagocd.resources.artifact.ArtifactManager` :rtype: yagocd.resources.artifact.ArtifactManager
3.664969
2.771247
1.322498
return PropertyManager( session=self._session, pipeline_name=self.pipeline_name, pipeline_counter=self.pipeline_counter, stage_name=self.stage_name, stage_counter=self.stage_counter, job_name=self.data.name )
def properties(self)
Property for accessing property (doh!) manager of the current job. :return: instance of :class:`yagocd.resources.property.PropertyManager` :rtype: yagocd.resources.property.PropertyManager
3.984694
2.901807
1.373177
return "{server_url}/go/pipelines/{pipeline_name}/{pipeline_counter}/{stage_name}/{stage_counter}".format( server_url=self._session.server_url, pipeline_name=self.pipeline_name, pipeline_counter=self.pipeline_counter, stage_name=self.data.name, stage_counter=self.data.counter, )
def url(self)
Returns url for accessing stage instance.
2.561491
2.272299
1.127269
if 'pipeline_name' in self.data: return self.data.get('pipeline_name') elif self.pipeline is not None: return self.pipeline.data.name
def pipeline_name(self)
Get pipeline name of current stage instance. Because instantiating stage instance could be performed in different ways and those return different results, we have to check where from to get name of the pipeline. :return: pipeline name.
3.651136
4.25811
0.857455
if 'pipeline_counter' in self.data: return self.data.get('pipeline_counter') elif self.pipeline is not None: return self.pipeline.data.counter
def pipeline_counter(self)
Get pipeline counter of current stage instance. Because instantiating stage instance could be performed in different ways and those return different results, we have to check where from to get counter of the pipeline. :return: pipeline counter.
4.012915
4.506748
0.890424
return self._manager.cancel(pipeline_name=self.pipeline_name, stage_name=self.stage_name)
def cancel(self)
Cancel an active stage of a specified stage. :return: a text confirmation.
6.541142
6.379074
1.025406
jobs = list() for data in self.data.jobs: jobs.append(JobInstance(session=self._session, data=data, stage=self)) return jobs
def jobs(self)
Method for getting jobs from stage instance. :return: arrays of jobs. :rtype: list of yagocd.resources.job.JobInstance
7.17397
6.157939
1.164995
for job in self.jobs(): if job.data.name == name: return job
def job(self, name)
Method for searching specific job by it's name. :param name: name of the job to search. :return: found job or None. :rtype: yagocd.resources.job.JobInstance
4.739584
7.79186
0.608274
if self._agent_manager is None: self._agent_manager = AgentManager(session=self._session) return self._agent_manager
def agents(self)
Property for accessing :class:`AgentManager` instance, which is used to manage agents. :rtype: yagocd.resources.agent.AgentManager
3.697615
3.096071
1.194293
if self._artifact_manager is None: self._artifact_manager = ArtifactManager(session=self._session) return self._artifact_manager
def artifacts(self)
Property for accessing :class:`ArtifactManager` instance, which is used to manage artifacts. :rtype: yagocd.resources.artifact.ArtifactManager
3.69911
3.286468
1.125558
if self._configuration_manager is None: self._configuration_manager = ConfigurationManager(session=self._session) return self._configuration_manager
def configurations(self)
Property for accessing :class:`ConfigurationManager` instance, which is used to manage configurations. :rtype: yagocd.resources.configuration.ConfigurationManager
3.740427
3.049715
1.226484
if self._encryption_manager is None: self._encryption_manager = EncryptionManager(session=self._session) return self._encryption_manager
def encryption(self)
Property for accessing :class:`EncryptionManager` instance, which is used to manage encryption. :rtype: yagocd.resources.encryption.EncryptionManager
3.93597
3.002995
1.310681
if self._elastic_agent_profile_manager is None: self._elastic_agent_profile_manager = ElasticAgentProfileManager(session=self._session) return self._elastic_agent_profile_manager
def elastic_profiles(self)
Property for accessing :class:`ElasticAgentProfileManager` instance, which is used to manage elastic agent profiles. :rtype: yagocd.resources.elastic_profile.ElasticAgentProfileManager
3.364995
2.190591
1.536112
if self._environment_manager is None: self._environment_manager = EnvironmentManager(session=self._session) return self._environment_manager
def environments(self)
Property for accessing :class:`EnvironmentManager` instance, which is used to manage environments. :rtype: yagocd.resources.environment.EnvironmentManager
3.633003
3.0769
1.180735
if self._feed_manager is None: self._feed_manager = FeedManager(session=self._session) return self._feed_manager
def feeds(self)
Property for accessing :class:`FeedManager` instance, which is used to manage feeds. :rtype: yagocd.resources.feed.FeedManager
3.622502
3.271515
1.107286
if self._job_manager is None: self._job_manager = JobManager(session=self._session) return self._job_manager
def jobs(self)
Property for accessing :class:`JobManager` instance, which is used to manage feeds. :rtype: yagocd.resources.job.JobManager
3.654425
3.167886
1.153585
if self._info_manager is None: self._info_manager = InfoManager(session=self._session) return self._info_manager
def info(self)
Property for accessing :class:`InfoManager` instance, which is used to general server info. :rtype: yagocd.resources.info.InfoManager
4.181982
2.965729
1.410103
if self._notification_filter_manager is None: self._notification_filter_manager = NotificationFilterManager(session=self._session) return self._notification_filter_manager
def notification_filters(self)
Property for accessing :class:`NotificationFilterManager` instance, which is used to manage notification filters. :rtype: yagocd.resources.notification_filter.NotificationFilterManager
3.159317
2.544426
1.241662
if self._material_manager is None: self._material_manager = MaterialManager(session=self._session) return self._material_manager
def materials(self)
Property for accessing :class:`MaterialManager` instance, which is used to manage materials. :rtype: yagocd.resources.material.MaterialManager
3.812524
3.261377
1.168992
if self._package_manager is None: self._package_manager = PackageManager(session=self._session) return self._package_manager
def packages(self)
Property for accessing :class:`PackageManager` instance, which is used to manage packages. :rtype: yagocd.resources.package.PackageManager
3.645224
3.160309
1.153439
if self._package_repository_manager is None: self._package_repository_manager = PackageRepositoryManager(session=self._session) return self._package_repository_manager
def package_repositories(self)
Property for accessing :class:`PackageRepositoryManager` instance, which is used to manage package repos. :rtype: yagocd.resources.package_repository.PackageRepositoryManager
2.995689
2.513201
1.191981
if self._pipeline_manager is None: self._pipeline_manager = PipelineManager(session=self._session) return self._pipeline_manager
def pipelines(self)
Property for accessing :class:`PipelineManager` instance, which is used to manage pipelines. :rtype: yagocd.resources.pipeline.PipelineManager
3.460208
3.170172
1.091489
if self._pipeline_config_manager is None: self._pipeline_config_manager = PipelineConfigManager(session=self._session) return self._pipeline_config_manager
def pipeline_configs(self)
Property for accessing :class:`PipelineConfigManager` instance, which is used to manage pipeline configurations. :rtype: yagocd.resources.pipeline_config.PipelineConfigManager
2.969402
2.456105
1.208988
if self._plugin_info_manager is None: self._plugin_info_manager = PluginInfoManager(session=self._session) return self._plugin_info_manager
def plugin_info(self)
Property for accessing :class:`PluginInfoManager` instance, which is used to manage pipeline configurations. :rtype: yagocd.resources.plugin_info.PluginInfoManager
3.35456
2.503794
1.339791
if self._property_manager is None: self._property_manager = PropertyManager(session=self._session) return self._property_manager
def properties(self)
Property for accessing :class:`PropertyManager` instance, which is used to manage properties of the jobs. :rtype: yagocd.resources.property.PropertyManager
3.758473
3.21436
1.169276
if self._scm_manager is None: self._scm_manager = SCMManager(session=self._session) return self._scm_manager
def scms(self)
Property for accessing :class:`SCMManager` instance, which is used to manage pluggable SCM materials. :rtype: yagocd.resources.scm.SCMManager
3.983602
2.871418
1.387329
if self._stage_manager is None: self._stage_manager = StageManager(session=self._session) return self._stage_manager
def stages(self)
Property for accessing :class:`StageManager` instance, which is used to manage stages. :rtype: yagocd.resources.stage.StageManager
4.065351
3.235643
1.256427
if self._template_manager is None: self._template_manager = TemplateManager(session=self._session) return self._template_manager
def templates(self)
Property for accessing :class:`TemplateManager` instance, which is used to manage templates. :rtype: yagocd.resources.template.TemplateManager
3.87351
3.212279
1.205845
if self._user_manager is None: self._user_manager = UserManager(session=self._session) return self._user_manager
def users(self)
Property for accessing :class:`UserManager` instance, which is used to manage users. :rtype: yagocd.resources.user.UserManager
3.474716
3.056426
1.136856
if self._version_manager is None: self._version_manager = VersionManager(session=self._session) return self._version_manager
def versions(self)
Property for accessing :class:`VersionManager` instance, which is used to get server info. :rtype: yagocd.resources.version.VersionManager
3.854218
2.999877
1.284792
return self.get_url(server_url=self._session.server_url, pipeline_name=self.data.name)
def url(self)
Returns url for accessing pipeline entity.
11.110255
6.420768
1.730362
return PipelineConfigManager(session=self._session, pipeline_name=self.data.name)
def config(self)
Property for accessing pipeline configuration. :rtype: yagocd.resources.pipeline_config.PipelineConfigManager
16.774422
7.953529
2.109054