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,
... | 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 prior... | 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)
... | 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) + \
... | 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.ensureC... | 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 vi... | 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)
c... | 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(),
cursor... | 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.
... | 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 ... | 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, QTex... | 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()]
... | 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.lin... | 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)
... | 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.updateVi... | 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._... | 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.to... | 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._ty... | 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... | 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().rowC... | 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.h... | 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():
... | 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:
... | 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:
... | 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... | 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. "
... | 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 entr... | 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
... | 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 c... | 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 ... | 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 a... | 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... | 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 <= len... | 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_NA... | 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).",
... | 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 inst... | 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... | 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``) ... | 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
------
Va... | 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.
:retu... | 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,
... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.