_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q5700
cli
train
def cli(inargs=None): """ Commandline interface for receiving stem files """ parser = argparse.ArgumentParser() parser.add_argument( '--version', '-V', action='version', version='%%(prog)s %s' % __version__ ) parser.add_argument( 'filename', metavar...
python
{ "resource": "" }
q5701
check_available_aac_encoders
train
def check_available_aac_encoders(): """Returns the available AAC encoders Returns ---------- codecs : list(str) List of available encoder codecs """ cmd = [ 'ffmpeg', '-v', 'error', '-codecs' ] output = sp.check_output(cmd) aac_codecs = [ x ...
python
{ "resource": "" }
q5702
write_stems
train
def write_stems( audio, filename, rate=44100, bitrate=256000, codec=None, ffmpeg_params=None ): """Write stems from numpy Tensor Parameters ---------- audio : array_like The tensor of Matrix of stems. The data shape is formatted as :code:`stems x channels x sampl...
python
{ "resource": "" }
q5703
read_info
train
def read_info( filename ): """Extracts FFMPEG info and returns info as JSON Returns ------- info : Dict JSON info dict """ cmd = [ 'ffprobe', filename, '-v', 'error', '-print_format', 'json', '-show_format', '-show_streams', ] out = ...
python
{ "resource": "" }
q5704
read_stems
train
def read_stems( filename, out_type=np.float_, stem_id=None, start=0, duration=None, info=None ): """Read STEMS format into numpy Tensor Parameters ---------- filename : str Filename of STEMS format. Typically `filename.stem.mp4`. out_type : type Output type. ...
python
{ "resource": "" }
q5705
PandasIndexRti.nDims
train
def nDims(self): """ The number of dimensions of the index. Will always be 1. """ result = self._index.ndim assert result == 1, "Expected index to be 1D, got: {}D".format(result) return result
python
{ "resource": "" }
q5706
AbstractPandasNDFrameRti._createIndexRti
train
def _createIndexRti(self, index, nodeName): """ Auxiliary method that creates a PandasIndexRti. """ return PandasIndexRti(index=index, nodeName=nodeName, fileName=self.fileName, iconColor=self._iconColor)
python
{ "resource": "" }
q5707
PandasSeriesRti._fetchAllChildren
train
def _fetchAllChildren(self): """ Fetches the index if the showIndex member is True Descendants can override this function to add the subdevicions. """ assert self.isSliceable, "No underlying pandas object: self._ndFrame is None" childItems = [] if self._standAlone: ...
python
{ "resource": "" }
q5708
OpenInspectorDialog.setCurrentInspectorRegItem
train
def setCurrentInspectorRegItem(self, regItem): """ Sets the current inspector given an InspectorRegItem """ check_class(regItem, InspectorRegItem, allow_none=True) self.inspectorTab.setCurrentRegItem(regItem)
python
{ "resource": "" }
q5709
log_dictionary
train
def log_dictionary(dictionary, msg='', logger=None, level='debug', item_prefix=' '): """ Writes a log message with key and value for each item in the dictionary. :param dictionary: the dictionary to be logged :type dictionary: dict :param name: An optional message that is logged before the...
python
{ "resource": "" }
q5710
string_to_identifier
train
def string_to_identifier(s, white_space_becomes='_'): """ Takes a string and makes it suitable for use as an identifier Translates to lower case Replaces white space by the white_space_becomes character (default=underscore). Removes and punctuation. """ import re s = s.lower() ...
python
{ "resource": "" }
q5711
RtiIconFactory.loadIcon
train
def loadIcon(self, fileName, color=None): """ Reads SVG from a file name and creates an QIcon from it. Optionally replaces the color. Caches the created icons. :param fileName: absolute path to an icon file. If False/empty/None, None returned, which yields no icon. ...
python
{ "resource": "" }
q5712
RtiIconFactory.createIconFromSvg
train
def createIconFromSvg(self, svg, color=None, colorsToBeReplaced=None): """ Creates a QIcon given an SVG string. Optionally replaces the colors in colorsToBeReplaced by color. :param svg: string containing Scalable Vector Graphics XML :param color: '#RRGGBB' string (e.g. '#F...
python
{ "resource": "" }
q5713
RegistryTableProxyModel.lessThan
train
def lessThan(self, leftIndex, rightIndex): """ Returns true if the value of the item referred to by the given index left is less than the value of the item referred to by the given index right, otherwise returns false. """ leftData = self.sourceModel().data(leftIndex, RegistryTable...
python
{ "resource": "" }
q5714
RegistryTableProxyModel.itemFromIndex
train
def itemFromIndex(self, index): """ Gets the item given the model index """ sourceIndex = self.mapToSource(index) return self.sourceModel().itemFromIndex(sourceIndex)
python
{ "resource": "" }
q5715
RegistryTableView.setCurrentRegItem
train
def setCurrentRegItem(self, regItem): """ Sets the current registry item. """ rowIndex = self.model().indexFromItem(regItem) if not rowIndex.isValid(): logger.warn("Can't select {!r} in table".format(regItem)) self.setCurrentIndex(rowIndex)
python
{ "resource": "" }
q5716
persistentRegisterInspector
train
def persistentRegisterInspector(fullName, fullClassName, pythonPath=''): """ Registers an inspector Loads or inits the inspector registry, register the inspector and saves the settings. Important: instantiate a Qt application first to use the correct settings file/winreg. """ registry = Ins...
python
{ "resource": "" }
q5717
printInspectors
train
def printInspectors(): """ Prints a list of inspectors """ # Imported here so this module can be imported without Qt being installed. from argos.application import ArgosApplication argosApp = ArgosApplication() argosApp.loadOrInitRegistries() for regItem in argosApp.inspectorRegistry.items:...
python
{ "resource": "" }
q5718
ArgosTreeView.setModel
train
def setModel(self, model): """ Sets the model. Checks that the model is a """ check_class(model, BaseTreeModel) super(ArgosTreeView, self).setModel(model)
python
{ "resource": "" }
q5719
ArgosTreeView.expandBranch
train
def expandBranch(self, index=None, expanded=True): """ Expands or collapses the node at the index and all it's descendants. If expanded is True the nodes will be expanded, if False they will be collapsed. If parentIndex is None, the invisible root will be used (i.e. the complete forest...
python
{ "resource": "" }
q5720
Collector.blockChildrenSignals
train
def blockChildrenSignals(self, block): """ If block equals True, the signals of the combo boxes and spin boxes are blocked Returns the old blocking state. """ logger.debug("Blocking collector signals") for spinBox in self._spinBoxes: spinBox.blockSignals(block) ...
python
{ "resource": "" }
q5721
Collector._setColumnCountForContents
train
def _setColumnCountForContents(self): """ Sets the column count given the current axes and selected RTI. Returns the newly set column count. """ numRtiDims = self.rti.nDims if self.rti and self.rti.isSliceable else 0 colCount = self.COL_FIRST_COMBO + max(numRtiDims, len(self...
python
{ "resource": "" }
q5722
Collector.clear
train
def clear(self): """ Removes all VisItems """ model = self.tree.model() # Don't use model.clear(). it will delete the column sizes model.removeRows(0, 1) model.setRowCount(1) self._setColumnCountForContents()
python
{ "resource": "" }
q5723
Collector.clearAndSetComboBoxes
train
def clearAndSetComboBoxes(self, axesNames): """ Removes all comboboxes. """ logger.debug("Collector clearAndSetComboBoxes: {}".format(axesNames)) check_is_a_sequence(axesNames) row = 0 self._deleteComboBoxes(row) self.clear() self._setAxesNames(axesNames) ...
python
{ "resource": "" }
q5724
Collector._setAxesNames
train
def _setAxesNames(self, axisNames): """ Sets the axesnames, combobox lables and updates the headers. Removes old values first. The comboLables is the axes name + '-axis' """ for col, _ in enumerate(self._fullAxisNames, self.COL_FIRST_COMBO): self._setHeaderLabel(col, '') ...
python
{ "resource": "" }
q5725
Collector._setHeaderLabel
train
def _setHeaderLabel(self, col, text): """ Sets the header of column col to text. Will increase the number of columns if col is larger than the current number. """ model = self.tree.model() item = model.horizontalHeaderItem(col) if item: item.setText(text) ...
python
{ "resource": "" }
q5726
Collector.setRti
train
def setRti(self, rti): """ Updates the current VisItem from the contents of the repo tree item. Is a slot but the signal is usually connected to the Collector, which then calls this function directly. """ check_class(rti, BaseRti) #assert rti.isSliceable, "RTI mu...
python
{ "resource": "" }
q5727
Collector._updateWidgets
train
def _updateWidgets(self): """ Updates the combo and spin boxes given the new rti or axes. Emits the sigContentsChanged signal. """ row = 0 model = self.tree.model() # Create path label nodePath = '' if self.rti is None else self.rti.nodePath pathItem ...
python
{ "resource": "" }
q5728
Collector._createComboBoxes
train
def _createComboBoxes(self, row): """ Creates a combo box for each of the fullAxisNames """ tree = self.tree model = self.tree.model() self._setColumnCountForContents() for col, _ in enumerate(self._axisNames, self.COL_FIRST_COMBO): logger.debug("Adding combo...
python
{ "resource": "" }
q5729
Collector._deleteComboBoxes
train
def _deleteComboBoxes(self, row): """ Deletes all comboboxes of a row """ tree = self.tree model = self.tree.model() for col in range(self.COL_FIRST_COMBO, self.maxCombos): logger.debug("Removing combobox at: ({}, {})".format(row, col)) tree.setIndexWidge...
python
{ "resource": "" }
q5730
Collector._populateComboBoxes
train
def _populateComboBoxes(self, row): """ Populates the combo boxes with values of the repo tree item """ logger.debug("_populateComboBoxes") for comboBox in self._comboBoxes: comboBox.clear() if not self.rtiIsSliceable: # Add an empty item to the combo box...
python
{ "resource": "" }
q5731
Collector._dimensionSelectedInComboBox
train
def _dimensionSelectedInComboBox(self, dimNr): """ Returns True if the dimension is selected in one of the combo boxes. """ for combobox in self._comboBoxes: if self._comboBoxDimensionIndex(combobox) == dimNr: return True return False
python
{ "resource": "" }
q5732
Collector._createSpinBoxes
train
def _createSpinBoxes(self, row): """ Creates a spinBox for each dimension that is not selected in a combo box. """ assert len(self._spinBoxes) == 0, "Spinbox list not empty. Call _deleteSpinBoxes first" if not self.rtiIsSliceable: return logger.debug("_createSpinBox...
python
{ "resource": "" }
q5733
Collector._deleteSpinBoxes
train
def _deleteSpinBoxes(self, row): """ Removes all spinboxes """ tree = self.tree model = self.tree.model() for col, spinBox in enumerate(self._spinBoxes, self.COL_FIRST_COMBO + self.maxCombos): spinBox.valueChanged[int].disconnect(self._spinboxValueChanged) ...
python
{ "resource": "" }
q5734
Collector._comboBoxActivated
train
def _comboBoxActivated(self, index, comboBox=None): """ Is called when a combo box value was changed by the user. Updates the spin boxes and sets other combo boxes having the same index to the fake dimension of length 1. """ if comboBox is None: comboBox = se...
python
{ "resource": "" }
q5735
Collector._spinboxValueChanged
train
def _spinboxValueChanged(self, index, spinBox=None): """ Is called when a spin box value was changed. Updates the spin boxes and sets other combo boxes having the same index to the fake dimension of length 1. """ if spinBox is None: spinBox = self.sender() ...
python
{ "resource": "" }
q5736
Collector.getSlicedArray
train
def getSlicedArray(self, copy=True): """ Slice the rti using a tuple of slices made from the values of the combo and spin boxes. :param copy: If True (the default), a copy is made so that inspectors cannot accidentally modify the underlying of the RTIs. You can set copy=False as a ...
python
{ "resource": "" }
q5737
Collector._updateRtiInfo
train
def _updateRtiInfo(self): """ Updates the _rtiInfo property when a new RTI is set or the comboboxes value change. """ logger.debug("Updating self._rtiInfo") # Info about the dependent dimension rti = self.rti if rti is None: info = {'slices': '', ...
python
{ "resource": "" }
q5738
FieldRti._subArrayShape
train
def _subArrayShape(self): """ Returns the shape of the sub-array. An empty tuple is returned for regular fields, which have no sub array. """ fieldName = self.nodeName fieldDtype = self._array.dtype.fields[fieldName][0] return fieldDtype.shape
python
{ "resource": "" }
q5739
FieldRti.missingDataValue
train
def missingDataValue(self): """ Returns the value to indicate missing data. """ value = getMissingDataValue(self._array) fieldNames = self._array.dtype.names # If the missing value attibute is a list with the same length as the number of fields, # return the missing val...
python
{ "resource": "" }
q5740
SyntheticArrayRti._openResources
train
def _openResources(self): """ Evaluates the function to result an array """ arr = self._fun() check_is_an_array(arr) self._array = arr
python
{ "resource": "" }
q5741
SequenceRti._fetchAllChildren
train
def _fetchAllChildren(self): """ Adds a child item for each column """ childItems = [] for nr, elem in enumerate(self._sequence): childItem = _createFromObject(elem, "elem-{}".format(nr), self.fileName) childItem._iconColor = self.iconColor childItems....
python
{ "resource": "" }
q5742
MappingRti._fetchAllChildren
train
def _fetchAllChildren(self): """ Adds a child item for each item """ childItems = [] logger.debug("{!r} _fetchAllChildren {!r}".format(self, self.fileName)) if self.hasChildren(): for key, value in sorted(self._dictionary.items()): # TODO: pass the at...
python
{ "resource": "" }
q5743
IntCti.createEditor
train
def createEditor(self, delegate, parent, option): """ Creates a IntCtiEditor. For the parameters see the AbstractCti constructor documentation. """ return IntCtiEditor(self, delegate, parent=parent)
python
{ "resource": "" }
q5744
MainWindow.__setupViews
train
def __setupViews(self): """ Creates the UI widgets. """ self._collector = Collector(self.windowNumber) self.configWidget = ConfigWidget(self._configTreeModel) self.repoWidget = RepoWidget(self.argosApplication.repo, self.collector) # self._configTreeModel.insertItem(self....
python
{ "resource": "" }
q5745
MainWindow.__createInspectorActionGroup
train
def __createInspectorActionGroup(self, parent): """ Creates an action group with 'set inspector' actions for all installed inspector. """ actionGroup = QtWidgets.QActionGroup(parent) actionGroup.setExclusive(True) sortedItems = sorted(self.argosApplication.inspectorRegistry.item...
python
{ "resource": "" }
q5746
MainWindow.__setupDockWidgets
train
def __setupDockWidgets(self): """ Sets up the dock widgets. Must be called after the menu is setup. """ #self.dockWidget(self.currentInspectorPane, "Current Inspector", Qt.LeftDockWidgetArea) self.inspectorSelectionPane = InspectorSelectionPane(self.execInspectorDialogAction, ...
python
{ "resource": "" }
q5747
MainWindow.repopulateWinowMenu
train
def repopulateWinowMenu(self, actionGroup): """ Clear the window menu and fills it with the actions of the actionGroup """ for action in self.windowMenu.actions(): self.windowMenu.removeAction(action) for action in actionGroup.actions(): self.windowMenu.addAction...
python
{ "resource": "" }
q5748
MainWindow.showContextMenu
train
def showContextMenu(self, pos): """ Shows the context menu at position pos. """ contextMenu = QtWidgets.QMenu() addInspectorActionsToMenu(contextMenu, self.execInspectorDialogAction, self.inspectorActionGroup) contextMenu.exec_(self.mapToGlobal(p...
python
{ "resource": "" }
q5749
MainWindow.dockWidget
train
def dockWidget(self, widget, title, area): """ Adds a widget as a docked widget. Returns the added dockWidget """ assert widget.parent() is None, "Widget already has a parent" dockWidget = QtWidgets.QDockWidget(title, parent=self) dockWidget.setObjectName("dock_" + s...
python
{ "resource": "" }
q5750
MainWindow.dockDetailPane
train
def dockDetailPane(self, detailPane, title=None, area=None): """ Creates a dockWidget and add the detailPane with a default title. By default the detail widget is added to the Qt.LeftDockWidgetArea. """ title = detailPane.classLabel() if title is None else title area = Qt.Lef...
python
{ "resource": "" }
q5751
MainWindow.updateWindowTitle
train
def updateWindowTitle(self): """ Updates the window title frm the window number, inspector, etc Also updates the Window Menu """ self.setWindowTitle("{} #{} | {}-{}".format(self.inspectorName, self.windowNumber, PROJECT_NAME, self.a...
python
{ "resource": "" }
q5752
MainWindow.execInspectorDialog
train
def execInspectorDialog(self): """ Opens the inspector dialog box to let the user change the current inspector. """ dialog = OpenInspectorDialog(self.argosApplication.inspectorRegistry, parent=self) dialog.setCurrentInspectorRegItem(self.inspectorRegItem) dialog.exec_() i...
python
{ "resource": "" }
q5753
MainWindow.getInspectorActionById
train
def getInspectorActionById(self, identifier): """ Sets the inspector and draw the contents Triggers the corresponding action so that it is checked in the menus. """ for action in self.inspectorActionGroup.actions(): if action.data() == identifier: return a...
python
{ "resource": "" }
q5754
MainWindow.setAndDrawInspectorById
train
def setAndDrawInspectorById(self, identifier): """ Sets the inspector and draw the contents. Does NOT trigger any actions, so the check marks in the menus are not updated. To achieve this, the user must update the actions by hand (or call getInspectorActionById(identifier).t...
python
{ "resource": "" }
q5755
MainWindow.setInspectorById
train
def setInspectorById(self, identifier): """ Sets the central inspector widget given a inspector ID. If identifier is None, the inspector will be unset. Otherwise it will lookup the inspector class in the registry. It will raise a KeyError if the ID is not found there. It wi...
python
{ "resource": "" }
q5756
MainWindow.execPluginsDialog
train
def execPluginsDialog(self): """ Shows the plugins dialog with the registered plugins """ pluginsDialog = PluginsDialog(parent=self, inspectorRegistry=self.argosApplication.inspectorRegistry, rtiRegistry=self.argosApplication.rtiReg...
python
{ "resource": "" }
q5757
MainWindow.configContentsChanged
train
def configContentsChanged(self, configTreeItem): """ Slot is called when an item has been changed by setData of the ConfigTreeModel. Will draw the window contents. """ logger.debug("configContentsChanged: {}".format(configTreeItem)) self.drawInspectorContents(reason=UpdateRea...
python
{ "resource": "" }
q5758
MainWindow.drawInspectorContents
train
def drawInspectorContents(self, reason, origin=None): """ Draws all contents of this window's inspector. The reason and origin parameters are passed on to the inspector's updateContents method. :param reason: string describing the reason for the redraw. Should preferably...
python
{ "resource": "" }
q5759
MainWindow.openFiles
train
def openFiles(self, fileNames=None, rtiRegItem=None, caption=None, fileMode=None): """ Lets the user select on or more files and opens it. :param fileNames: If None an open-file dialog allows the user to select files, otherwise the files are opened directly. :param rtiRe...
python
{ "resource": "" }
q5760
MainWindow.trySelectRtiByPath
train
def trySelectRtiByPath(self, path): """ Selects a repository tree item given a path, expanding nodes if along the way if needed. Returns (item, index) if the path was selected successfully, else a warning is logged and (None, None) is returned. """ try: lastI...
python
{ "resource": "" }
q5761
MainWindow.saveProfile
train
def saveProfile(self, settings=None): """ Writes the view settings to the persistent store """ self._updateNonDefaultsForInspector(self.inspectorRegItem, self.inspector) if settings is None: settings = QtCore.QSettings() logger.debug("Writing settings to: {}".format(...
python
{ "resource": "" }
q5762
MainWindow.cloneWindow
train
def cloneWindow(self): """ Opens a new window with the same inspector as the current window. """ # Save current window settings. settings = QtCore.QSettings() settings.beginGroup(self.argosApplication.windowGroupName(self.windowNumber)) try: self.saveProfile(s...
python
{ "resource": "" }
q5763
MainWindow.activateAndRaise
train
def activateAndRaise(self): """ Activates and raises the window. """ logger.debug("Activate and raising window: {}".format(self.windowNumber)) self.activateWindow() self.raise_()
python
{ "resource": "" }
q5764
MainWindow.event
train
def event(self, ev): """ Detects the WindowActivate event. Pass all event through to the super class. """ if ev.type() == QtCore.QEvent.WindowActivate: logger.debug("Window activated: {}".format(self.windowNumber)) self.activateWindowAction.setChecked(True) retur...
python
{ "resource": "" }
q5765
MainWindow.closeEvent
train
def closeEvent(self, event): """ Called when closing this window. """ logger.debug("closeEvent") self.argosApplication.saveSettingsIfNeeded() self.finalize() self.argosApplication.removeMainWindow(self) event.accept() logger.debug("closeEvent accepted")
python
{ "resource": "" }
q5766
MainWindow.about
train
def about(self): """ Shows the about message window. """ aboutDialog = AboutDialog(parent=self) aboutDialog.show() aboutDialog.addDependencyInfo()
python
{ "resource": "" }
q5767
ArgosApplication.profileGroupName
train
def profileGroupName(self, profile=None): """ Returns the name of the QSetting group for the profile. Converts to lower case and removes whitespace, interpunction, etc. Prepends _debug_ if the debugging flag is set :param profile: profile name. If None the current profile is...
python
{ "resource": "" }
q5768
ArgosApplication.windowGroupName
train
def windowGroupName(self, windowNumber, profile=None): """ Returns the name of the QSetting group for this window in the this profile. :param windowNumber: int :param profile: profile name. If None the current profile is used. """ return "{}/window-{:02d}".format(self.pr...
python
{ "resource": "" }
q5769
ArgosApplication.deleteProfile
train
def deleteProfile(self, profile): """ Removes a profile from the persistent settings """ profGroupName = self.profileGroupName(profile) logger.debug("Resetting profile settings: {}".format(profGroupName)) settings = QtCore.QSettings() settings.remove(profGroupName)
python
{ "resource": "" }
q5770
ArgosApplication.deleteAllProfiles
train
def deleteAllProfiles(self): """ Returns a list of all profiles """ settings = QtCore.QSettings() for profGroupName in QtCore.QSettings().childGroups(): settings.remove(profGroupName)
python
{ "resource": "" }
q5771
ArgosApplication.loadProfile
train
def loadProfile(self, profile, inspectorFullName=None): """ Reads the persistent program settings for the current profile. If inspectorFullName is given, a window with this inspector will be created if it wasn't already created in the profile. All windows with this inspector will be rai...
python
{ "resource": "" }
q5772
ArgosApplication.saveProfile
train
def saveProfile(self): """ Writes the current profile settings to the persistent store """ if not self.profile: logger.warning("No profile defined (no settings saved)") return settings = QtCore.QSettings() logger.debug("Writing settings to: {}".format(set...
python
{ "resource": "" }
q5773
ArgosApplication.saveSettings
train
def saveSettings(self): """ Saves the persistent settings. Only saves the profile. """ try: self.saveProfile() except Exception as ex: # Continue, even if saving the settings fails. logger.warn(ex) if DEBUGGING: raise ...
python
{ "resource": "" }
q5774
ArgosApplication.loadFiles
train
def loadFiles(self, fileNames, rtiClass=None): """ Loads files into the repository as repo tree items of class rtiClass. Auto-detects using the extensions when rtiClass is None """ for fileName in fileNames: self.repo.loadFile(fileName, rtiClass=rtiClass)
python
{ "resource": "" }
q5775
ArgosApplication.addNewMainWindow
train
def addNewMainWindow(self, settings=None, inspectorFullName=None): """ Creates and shows a new MainWindow. If inspectorFullName is set, it will set the identifier from that name. If the inspector identifier is not found in the registry, a KeyError is raised. """ mainWind...
python
{ "resource": "" }
q5776
ArgosApplication.removeMainWindow
train
def removeMainWindow(self, mainWindow): """ Removes the mainWindow from the list of windows. Saves the settings """ logger.debug("removeMainWindow called") self.windowActionGroup.removeAction(mainWindow.activateWindowAction) self.repopulateAllWindowMenus() self.mainWind...
python
{ "resource": "" }
q5777
ArgosApplication.raiseAllWindows
train
def raiseAllWindows(self): """ Raises all application windows. """ logger.debug("raiseAllWindows called") for mainWindow in self.mainWindows: logger.debug("Raising {}".format(mainWindow._instanceNr)) mainWindow.raise_()
python
{ "resource": "" }
q5778
ArgosApplication.execute
train
def execute(self): """ Executes all main windows by starting the Qt main application """ logger.info("Starting Argos event loop...") exitCode = self.qApplication.exec_() logger.info("Argos event loop finished with exit code: {}".format(exitCode)) return exitCode
python
{ "resource": "" }
q5779
PillowFileRti._openResources
train
def _openResources(self): """ Uses open the underlying file """ with Image.open(self._fileName) as image: self._array = np.asarray(image) self._bands = image.getbands() # Fill attributes. For now assume that the info item are not overridden by # ...
python
{ "resource": "" }
q5780
PillowFileRti._fetchAllChildren
train
def _fetchAllChildren(self): """ Adds the bands as separate fields so they can be inspected easily. """ bands = self._bands if len(bands) != self._array.shape[-1]: logger.warn("No bands added, bands != last_dim_lenght ({} !: {})" .format(len(bands), se...
python
{ "resource": "" }
q5781
labelTextWidth
train
def labelTextWidth(label): """ Returns the width of label text of the label in pixels. IMPORTANT: does not work when the labels are styled using style sheets. Unfortunately it is possible to retrieve the settings (e.g. padding) that were set by the style sheet without parsing the style she...
python
{ "resource": "" }
q5782
AbstractCti.resetToDefault
train
def resetToDefault(self, resetChildren=True): """ Resets the data to the default data. By default the children will be reset as well """ self.data = self.defaultData if resetChildren: for child in self.childItems: child.resetToDefault(resetChildren=True)
python
{ "resource": "" }
q5783
AbstractCti._nodeGetNonDefaultsDict
train
def _nodeGetNonDefaultsDict(self): """ Retrieves this nodes` values as a dictionary to be used for persistence. A dictionary with the data value will be returned if the data is not equal to the defaultData, the node is enabled and the node is editable. Otherwise and empty dic...
python
{ "resource": "" }
q5784
AbstractCti.getNonDefaultsDict
train
def getNonDefaultsDict(self): """ Recursively retrieves values as a dictionary to be used for persistence. Does not save defaultData and other properties, only stores values if they differ from the defaultData. If the CTI and none of its children differ from their default, a ...
python
{ "resource": "" }
q5785
AbstractCti.setValuesFromDict
train
def setValuesFromDict(self, dct): """ Recursively sets values from a dictionary created by getNonDefaultsDict. Does not raise exceptions (logs warnings instead) so that we can remove/rename node names in future Argos versions (or remove them) without breaking the application. ...
python
{ "resource": "" }
q5786
AbstractCtiEditor.removeSubEditor
train
def removeSubEditor(self, subEditor): """ Removes the subEditor from the layout and removes the event filter. """ if subEditor is self.focusProxy(): self.setFocusProxy(None) subEditor.removeEventFilter(self) self._subEditors.remove(subEditor) self.hBoxLayout....
python
{ "resource": "" }
q5787
AbstractCtiEditor.eventFilter
train
def eventFilter(self, watchedObject, event): """ Calls commitAndClose when the tab and back-tab are pressed. This is necessary because, normally the event filter of QStyledItemDelegate does this for us. However, that event filter works on this object, not on the sub editor. """ ...
python
{ "resource": "" }
q5788
AbstractCtiEditor.commitAndClose
train
def commitAndClose(self): """ Commits the data of the sub editor and instructs the delegate to close this ctiEditor. The delegate will emit the closeEditor signal which is connected to the closeEditor method of the ConfigTreeView class. This, in turn will, call the finalize method of ...
python
{ "resource": "" }
q5789
AbstractCtiEditor.resetEditorValue
train
def resetEditorValue(self, checked=False): """ Resets the editor to the default value. Also resets the children. """ # Block all signals to prevent duplicate inspector updates. # No need to restore, the editors will be deleted after the reset. for subEditor in self._subEditors: ...
python
{ "resource": "" }
q5790
MessageDisplay.setError
train
def setError(self, msg=None, title=None): """ Shows and error message """ if msg is not None: self.messageLabel.setText(msg) if title is not None: self.titleLabel.setText(title)
python
{ "resource": "" }
q5791
makeReplacementField
train
def makeReplacementField(formatSpec, altFormatSpec='', testValue=None): """ Prepends a colon and wraps the formatSpec in curly braces to yield a replacement field. The format specification is part of a replacement field, which can be used in new-style string formatting. See: https://doc...
python
{ "resource": "" }
q5792
TableInspectorCti._refreshNodeFromTarget
train
def _refreshNodeFromTarget(self): """ Refreshes the TableInspectorCti from the TableInspector target it monitors. Disables auto-sizing of the header sizes for very large headers (> 10000 elements). Otherwise the resizing may take to long and the program will hang. """ ta...
python
{ "resource": "" }
q5793
TableInspectorModel.updateState
train
def updateState(self, slicedArray, rtiInfo, separateFields): """ Sets the slicedArray and rtiInfo and other members. This will reset the model. Will be called from the tableInspector._drawContents. """ self.beginResetModel() try: # The sliced array can be a maske...
python
{ "resource": "" }
q5794
TableInspectorModel.data
train
def data(self, index, role = Qt.DisplayRole): """ Returns the data at an index for a certain role """ try: if role == Qt.DisplayRole: return to_string(self._cellValue(index), masked=self._cellMask(index), decode_bytes=self.encoding, ma...
python
{ "resource": "" }
q5795
TableInspectorModel.rowCount
train
def rowCount(self, parent=None): """ The number of rows of the sliced array. The 'parent' parameter can be a QModelIndex. It is ignored since the number of rows does not depend on the parent. """ if self._separateFieldOrientation == Qt.Vertical: return self._n...
python
{ "resource": "" }
q5796
TableInspectorModel.columnCount
train
def columnCount(self, parent=None): """ The number of columns of the sliced array. The 'parent' parameter can be a QModelIndex. It is ignored since the number of columns does not depend on the parent. """ if self._separateFieldOrientation == Qt.Horizontal: ret...
python
{ "resource": "" }
q5797
viewBoxAxisRange
train
def viewBoxAxisRange(viewBox, axisNumber): """ Calculates the range of an axis of a viewBox. """ rect = viewBox.childrenBoundingRect() # taken from viewBox.autoRange() if rect is not None: if axisNumber == X_AXIS: return rect.left(), rect.right() elif axisNumber == Y_AXIS: ...
python
{ "resource": "" }
q5798
defaultAutoRangeMethods
train
def defaultAutoRangeMethods(inspector, intialItems=None): """ Creates an ordered dict with default autorange methods for an inspector. :param inspector: the range methods will work on (the sliced array) of this inspector. :param intialItems: will be passed on to the OrderedDict constructor. ""...
python
{ "resource": "" }
q5799
setXYAxesAutoRangeOn
train
def setXYAxesAutoRangeOn(commonCti, xAxisRangeCti, yAxisRangeCti, axisNumber): """ Turns on the auto range of an X and Y axis simultaneously. It sets the autoRangeCti.data of the xAxisRangeCti and yAxisRangeCti to True. After that, it emits the sigItemChanged signal of the commonCti. Can be...
python
{ "resource": "" }