repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
titusjan/argos | argos/config/configtreemodel.py | ConfigTreeModel.insertTopLevelGroup | def insertTopLevelGroup(self, groupName, position=None):
""" Inserts a top level group tree item.
Used to group all config nodes of (for instance) the current inspector,
Returns the newly created CTI
"""
groupCti = GroupCti(groupName)
return self._invisibleRootIte... | python | def insertTopLevelGroup(self, groupName, position=None):
""" Inserts a top level group tree item.
Used to group all config nodes of (for instance) the current inspector,
Returns the newly created CTI
"""
groupCti = GroupCti(groupName)
return self._invisibleRootIte... | [
"def",
"insertTopLevelGroup",
"(",
"self",
",",
"groupName",
",",
"position",
"=",
"None",
")",
":",
"groupCti",
"=",
"GroupCti",
"(",
"groupName",
")",
"return",
"self",
".",
"_invisibleRootItem",
".",
"insertChild",
"(",
"groupCti",
",",
"position",
"=",
"... | Inserts a top level group tree item.
Used to group all config nodes of (for instance) the current inspector,
Returns the newly created CTI | [
"Inserts",
"a",
"top",
"level",
"group",
"tree",
"item",
".",
"Used",
"to",
"group",
"all",
"config",
"nodes",
"of",
"(",
"for",
"instance",
")",
"the",
"current",
"inspector",
"Returns",
"the",
"newly",
"created",
"CTI"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/config/configtreemodel.py#L86-L92 |
titusjan/argos | argos/config/configtreemodel.py | ConfigTreeModel.itemData | def itemData(self, treeItem, column, role=Qt.DisplayRole):
""" Returns the data stored under the given role for the item.
"""
if role == Qt.DisplayRole:
if column == self.COL_NODE_NAME:
return treeItem.nodeName
elif column == self.COL_NODE_PATH:
... | python | def itemData(self, treeItem, column, role=Qt.DisplayRole):
""" Returns the data stored under the given role for the item.
"""
if role == Qt.DisplayRole:
if column == self.COL_NODE_NAME:
return treeItem.nodeName
elif column == self.COL_NODE_PATH:
... | [
"def",
"itemData",
"(",
"self",
",",
"treeItem",
",",
"column",
",",
"role",
"=",
"Qt",
".",
"DisplayRole",
")",
":",
"if",
"role",
"==",
"Qt",
".",
"DisplayRole",
":",
"if",
"column",
"==",
"self",
".",
"COL_NODE_NAME",
":",
"return",
"treeItem",
".",... | Returns the data stored under the given role for the item. | [
"Returns",
"the",
"data",
"stored",
"under",
"the",
"given",
"role",
"for",
"the",
"item",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/config/configtreemodel.py#L95-L142 |
titusjan/argos | argos/config/configtreemodel.py | ConfigTreeModel.setItemData | def setItemData(self, treeItem, column, value, role=Qt.EditRole):
""" Sets the role data for the item at index to value.
"""
if role == Qt.CheckStateRole:
if column != self.COL_VALUE:
return False
else:
logger.debug("Setting check state (co... | python | def setItemData(self, treeItem, column, value, role=Qt.EditRole):
""" Sets the role data for the item at index to value.
"""
if role == Qt.CheckStateRole:
if column != self.COL_VALUE:
return False
else:
logger.debug("Setting check state (co... | [
"def",
"setItemData",
"(",
"self",
",",
"treeItem",
",",
"column",
",",
"value",
",",
"role",
"=",
"Qt",
".",
"EditRole",
")",
":",
"if",
"role",
"==",
"Qt",
".",
"CheckStateRole",
":",
"if",
"column",
"!=",
"self",
".",
"COL_VALUE",
":",
"return",
"... | Sets the role data for the item at index to value. | [
"Sets",
"the",
"role",
"data",
"for",
"the",
"item",
"at",
"index",
"to",
"value",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/config/configtreemodel.py#L145-L164 |
titusjan/argos | argos/config/configtreemodel.py | ConfigTreeModel.setExpanded | def setExpanded(self, index, expanded):
""" Expands the model item specified by the index.
Overridden from QTreeView to make it persistent (between inspector changes).
"""
if index.isValid():
item = self.getItem(index)
item.expanded = expanded | python | def setExpanded(self, index, expanded):
""" Expands the model item specified by the index.
Overridden from QTreeView to make it persistent (between inspector changes).
"""
if index.isValid():
item = self.getItem(index)
item.expanded = expanded | [
"def",
"setExpanded",
"(",
"self",
",",
"index",
",",
"expanded",
")",
":",
"if",
"index",
".",
"isValid",
"(",
")",
":",
"item",
"=",
"self",
".",
"getItem",
"(",
"index",
")",
"item",
".",
"expanded",
"=",
"expanded"
] | Expands the model item specified by the index.
Overridden from QTreeView to make it persistent (between inspector changes). | [
"Expands",
"the",
"model",
"item",
"specified",
"by",
"the",
"index",
".",
"Overridden",
"from",
"QTreeView",
"to",
"make",
"it",
"persistent",
"(",
"between",
"inspector",
"changes",
")",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/config/configtreemodel.py#L167-L173 |
titusjan/argos | argos/config/configtreemodel.py | ConfigTreeModel.indexTupleFromItem | def indexTupleFromItem(self, treeItem): # TODO: move to BaseTreeItem?
""" Return (first column model index, last column model index) tuple for a configTreeItem
"""
if not treeItem:
return (QtCore.QModelIndex(), QtCore.QModelIndex())
if not treeItem.parentItem: # TODO: only n... | python | def indexTupleFromItem(self, treeItem): # TODO: move to BaseTreeItem?
""" Return (first column model index, last column model index) tuple for a configTreeItem
"""
if not treeItem:
return (QtCore.QModelIndex(), QtCore.QModelIndex())
if not treeItem.parentItem: # TODO: only n... | [
"def",
"indexTupleFromItem",
"(",
"self",
",",
"treeItem",
")",
":",
"# TODO: move to BaseTreeItem?",
"if",
"not",
"treeItem",
":",
"return",
"(",
"QtCore",
".",
"QModelIndex",
"(",
")",
",",
"QtCore",
".",
"QModelIndex",
"(",
")",
")",
"if",
"not",
"treeIte... | Return (first column model index, last column model index) tuple for a configTreeItem | [
"Return",
"(",
"first",
"column",
"model",
"index",
"last",
"column",
"model",
"index",
")",
"tuple",
"for",
"a",
"configTreeItem"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/config/configtreemodel.py#L191-L205 |
titusjan/argos | argos/config/configtreemodel.py | ConfigTreeModel.emitDataChanged | def emitDataChanged(self, treeItem): # TODO: move to BaseTreeItem?
""" Emits the data changed for the model indices (all columns) for this treeItem
"""
indexLeft, indexRight = self.indexTupleFromItem(treeItem)
checkItem = self.getItem(indexLeft)
assert checkItem is treeItem, "{}... | python | def emitDataChanged(self, treeItem): # TODO: move to BaseTreeItem?
""" Emits the data changed for the model indices (all columns) for this treeItem
"""
indexLeft, indexRight = self.indexTupleFromItem(treeItem)
checkItem = self.getItem(indexLeft)
assert checkItem is treeItem, "{}... | [
"def",
"emitDataChanged",
"(",
"self",
",",
"treeItem",
")",
":",
"# TODO: move to BaseTreeItem?",
"indexLeft",
",",
"indexRight",
"=",
"self",
".",
"indexTupleFromItem",
"(",
"treeItem",
")",
"checkItem",
"=",
"self",
".",
"getItem",
"(",
"indexLeft",
")",
"ass... | Emits the data changed for the model indices (all columns) for this treeItem | [
"Emits",
"the",
"data",
"changed",
"for",
"the",
"model",
"indices",
"(",
"all",
"columns",
")",
"for",
"this",
"treeItem"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/config/configtreemodel.py#L208-L214 |
titusjan/argos | argos/config/configtreemodel.py | ConfigTreeModel.setRefreshBlocked | def setRefreshBlocked(self, blocked):
""" Set to True to indicate that set the configuration should not be updated.
This setting is part of the model so that is shared by all CTIs.
Returns the old value.
"""
wasBlocked = self._refreshBlocked
logger.debug("Setting ... | python | def setRefreshBlocked(self, blocked):
""" Set to True to indicate that set the configuration should not be updated.
This setting is part of the model so that is shared by all CTIs.
Returns the old value.
"""
wasBlocked = self._refreshBlocked
logger.debug("Setting ... | [
"def",
"setRefreshBlocked",
"(",
"self",
",",
"blocked",
")",
":",
"wasBlocked",
"=",
"self",
".",
"_refreshBlocked",
"logger",
".",
"debug",
"(",
"\"Setting refreshBlocked from {} to {}\"",
".",
"format",
"(",
"wasBlocked",
",",
"blocked",
")",
")",
"self",
"."... | Set to True to indicate that set the configuration should not be updated.
This setting is part of the model so that is shared by all CTIs.
Returns the old value. | [
"Set",
"to",
"True",
"to",
"indicate",
"that",
"set",
"the",
"configuration",
"should",
"not",
"be",
"updated",
".",
"This",
"setting",
"is",
"part",
"of",
"the",
"model",
"so",
"that",
"is",
"shared",
"by",
"all",
"CTIs",
".",
"Returns",
"the",
"old",
... | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/config/configtreemodel.py#L224-L232 |
titusjan/argos | argos/repo/rtiplugins/numpyio.py | NumpyBinaryFileRti._openResources | def _openResources(self):
""" Uses numpy.load to open the underlying file
"""
arr = np.load(self._fileName, allow_pickle=ALLOW_PICKLE)
check_is_an_array(arr)
self._array = arr | python | def _openResources(self):
""" Uses numpy.load to open the underlying file
"""
arr = np.load(self._fileName, allow_pickle=ALLOW_PICKLE)
check_is_an_array(arr)
self._array = arr | [
"def",
"_openResources",
"(",
"self",
")",
":",
"arr",
"=",
"np",
".",
"load",
"(",
"self",
".",
"_fileName",
",",
"allow_pickle",
"=",
"ALLOW_PICKLE",
")",
"check_is_an_array",
"(",
"arr",
")",
"self",
".",
"_array",
"=",
"arr"
] | Uses numpy.load to open the underlying file | [
"Uses",
"numpy",
".",
"load",
"to",
"open",
"the",
"underlying",
"file"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/repo/rtiplugins/numpyio.py#L113-L118 |
titusjan/argos | argos/repo/rtiplugins/numpyio.py | NumpyCompressedFileRti._openResources | def _openResources(self):
""" Uses numpy.load to open the underlying file
"""
dct = np.load(self._fileName, allow_pickle=ALLOW_PICKLE)
check_class(dct, NpzFile)
self._dictionary = dct | python | def _openResources(self):
""" Uses numpy.load to open the underlying file
"""
dct = np.load(self._fileName, allow_pickle=ALLOW_PICKLE)
check_class(dct, NpzFile)
self._dictionary = dct | [
"def",
"_openResources",
"(",
"self",
")",
":",
"dct",
"=",
"np",
".",
"load",
"(",
"self",
".",
"_fileName",
",",
"allow_pickle",
"=",
"ALLOW_PICKLE",
")",
"check_class",
"(",
"dct",
",",
"NpzFile",
")",
"self",
".",
"_dictionary",
"=",
"dct"
] | Uses numpy.load to open the underlying file | [
"Uses",
"numpy",
".",
"load",
"to",
"open",
"the",
"underlying",
"file"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/repo/rtiplugins/numpyio.py#L154-L159 |
titusjan/argos | argos/config/boolcti.py | BoolCti.data | def data(self, data):
""" Sets the data of this item.
Does type conversion to ensure data is always of the correct type.
"""
# Descendants should convert the data to the desired type here
self._data = self._enforceDataType(data)
#logger.debug("BoolCti.setData: {} for... | python | def data(self, data):
""" Sets the data of this item.
Does type conversion to ensure data is always of the correct type.
"""
# Descendants should convert the data to the desired type here
self._data = self._enforceDataType(data)
#logger.debug("BoolCti.setData: {} for... | [
"def",
"data",
"(",
"self",
",",
"data",
")",
":",
"# Descendants should convert the data to the desired type here",
"self",
".",
"_data",
"=",
"self",
".",
"_enforceDataType",
"(",
"data",
")",
"#logger.debug(\"BoolCti.setData: {} for {}\".format(data, self))",
"enabled",
... | Sets the data of this item.
Does type conversion to ensure data is always of the correct type. | [
"Sets",
"the",
"data",
"of",
"this",
"item",
".",
"Does",
"type",
"conversion",
"to",
"ensure",
"data",
"is",
"always",
"of",
"the",
"correct",
"type",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/config/boolcti.py#L69-L79 |
titusjan/argos | argos/config/boolcti.py | BoolCti.insertChild | def insertChild(self, childItem, position=None):
""" Inserts a child item to the current item.
Overridden from BaseTreeItem.
"""
childItem = super(BoolCti, self).insertChild(childItem, position=None)
enableChildren = self.enabled and self.data != self.childrenDisabledValue
... | python | def insertChild(self, childItem, position=None):
""" Inserts a child item to the current item.
Overridden from BaseTreeItem.
"""
childItem = super(BoolCti, self).insertChild(childItem, position=None)
enableChildren = self.enabled and self.data != self.childrenDisabledValue
... | [
"def",
"insertChild",
"(",
"self",
",",
"childItem",
",",
"position",
"=",
"None",
")",
":",
"childItem",
"=",
"super",
"(",
"BoolCti",
",",
"self",
")",
".",
"insertChild",
"(",
"childItem",
",",
"position",
"=",
"None",
")",
"enableChildren",
"=",
"sel... | Inserts a child item to the current item.
Overridden from BaseTreeItem. | [
"Inserts",
"a",
"child",
"item",
"to",
"the",
"current",
"item",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/config/boolcti.py#L89-L100 |
titusjan/argos | argos/config/boolcti.py | BoolCti.checkState | def checkState(self):
""" Returns Qt.Checked or Qt.Unchecked.
"""
if self.data is True:
return Qt.Checked
elif self.data is False:
return Qt.Unchecked
else:
raise ValueError("Unexpected data: {!r}".format(self.data)) | python | def checkState(self):
""" Returns Qt.Checked or Qt.Unchecked.
"""
if self.data is True:
return Qt.Checked
elif self.data is False:
return Qt.Unchecked
else:
raise ValueError("Unexpected data: {!r}".format(self.data)) | [
"def",
"checkState",
"(",
"self",
")",
":",
"if",
"self",
".",
"data",
"is",
"True",
":",
"return",
"Qt",
".",
"Checked",
"elif",
"self",
".",
"data",
"is",
"False",
":",
"return",
"Qt",
".",
"Unchecked",
"else",
":",
"raise",
"ValueError",
"(",
"\"U... | Returns Qt.Checked or Qt.Unchecked. | [
"Returns",
"Qt",
".",
"Checked",
"or",
"Qt",
".",
"Unchecked",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/config/boolcti.py#L112-L120 |
titusjan/argos | argos/config/boolcti.py | BoolCti.checkState | def checkState(self, checkState):
""" Sets the data to given a Qt.CheckState (Qt.Checked or Qt.Unchecked).
"""
if checkState == Qt.Checked:
logger.debug("BoolCti.checkState setting to True")
self.data = True
elif checkState == Qt.Unchecked:
logger.debu... | python | def checkState(self, checkState):
""" Sets the data to given a Qt.CheckState (Qt.Checked or Qt.Unchecked).
"""
if checkState == Qt.Checked:
logger.debug("BoolCti.checkState setting to True")
self.data = True
elif checkState == Qt.Unchecked:
logger.debu... | [
"def",
"checkState",
"(",
"self",
",",
"checkState",
")",
":",
"if",
"checkState",
"==",
"Qt",
".",
"Checked",
":",
"logger",
".",
"debug",
"(",
"\"BoolCti.checkState setting to True\"",
")",
"self",
".",
"data",
"=",
"True",
"elif",
"checkState",
"==",
"Qt"... | Sets the data to given a Qt.CheckState (Qt.Checked or Qt.Unchecked). | [
"Sets",
"the",
"data",
"to",
"given",
"a",
"Qt",
".",
"CheckState",
"(",
"Qt",
".",
"Checked",
"or",
"Qt",
".",
"Unchecked",
")",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/config/boolcti.py#L124-L134 |
titusjan/argos | argos/config/boolcti.py | BoolCti.enableBranch | def enableBranch(self, enabled):
""" Sets the enabled member to True or False for a node and all it's children
"""
self.enabled = enabled
# Disabled children and further descendants
enabled = enabled and self.data != self.childrenDisabledValue
for child in self.childIte... | python | def enableBranch(self, enabled):
""" Sets the enabled member to True or False for a node and all it's children
"""
self.enabled = enabled
# Disabled children and further descendants
enabled = enabled and self.data != self.childrenDisabledValue
for child in self.childIte... | [
"def",
"enableBranch",
"(",
"self",
",",
"enabled",
")",
":",
"self",
".",
"enabled",
"=",
"enabled",
"# Disabled children and further descendants",
"enabled",
"=",
"enabled",
"and",
"self",
".",
"data",
"!=",
"self",
".",
"childrenDisabledValue",
"for",
"child",
... | Sets the enabled member to True or False for a node and all it's children | [
"Sets",
"the",
"enabled",
"member",
"to",
"True",
"or",
"False",
"for",
"a",
"node",
"and",
"all",
"it",
"s",
"children"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/config/boolcti.py#L137-L146 |
titusjan/argos | argos/config/boolcti.py | BoolGroupCti.checkState | def checkState(self):
""" Returns Qt.Checked or Qt.Unchecked if all children are checked or unchecked, else
returns Qt.PartiallyChecked
"""
#commonData = self.childItems[0].data if self.childItems else Qt.PartiallyChecked
commonData = None
for child in self.childItem... | python | def checkState(self):
""" Returns Qt.Checked or Qt.Unchecked if all children are checked or unchecked, else
returns Qt.PartiallyChecked
"""
#commonData = self.childItems[0].data if self.childItems else Qt.PartiallyChecked
commonData = None
for child in self.childItem... | [
"def",
"checkState",
"(",
"self",
")",
":",
"#commonData = self.childItems[0].data if self.childItems else Qt.PartiallyChecked",
"commonData",
"=",
"None",
"for",
"child",
"in",
"self",
".",
"childItems",
":",
"if",
"isinstance",
"(",
"child",
",",
"BoolCti",
")",
":"... | Returns Qt.Checked or Qt.Unchecked if all children are checked or unchecked, else
returns Qt.PartiallyChecked | [
"Returns",
"Qt",
".",
"Checked",
"or",
"Qt",
".",
"Unchecked",
"if",
"all",
"children",
"are",
"checked",
"or",
"unchecked",
"else",
"returns",
"Qt",
".",
"PartiallyChecked"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/config/boolcti.py#L195-L213 |
titusjan/argos | argos/config/boolcti.py | BoolGroupCti.checkState | def checkState(self, checkState):
""" Sets the data to given a Qt.CheckState (Qt.Checked or Qt.Unchecked).
"""
logger.debug("checkState setter: {}".format(checkState))
if checkState == Qt.Checked:
commonData = True
elif checkState == Qt.Unchecked:
commonDa... | python | def checkState(self, checkState):
""" Sets the data to given a Qt.CheckState (Qt.Checked or Qt.Unchecked).
"""
logger.debug("checkState setter: {}".format(checkState))
if checkState == Qt.Checked:
commonData = True
elif checkState == Qt.Unchecked:
commonDa... | [
"def",
"checkState",
"(",
"self",
",",
"checkState",
")",
":",
"logger",
".",
"debug",
"(",
"\"checkState setter: {}\"",
".",
"format",
"(",
"checkState",
")",
")",
"if",
"checkState",
"==",
"Qt",
".",
"Checked",
":",
"commonData",
"=",
"True",
"elif",
"ch... | Sets the data to given a Qt.CheckState (Qt.Checked or Qt.Unchecked). | [
"Sets",
"the",
"data",
"to",
"given",
"a",
"Qt",
".",
"CheckState",
"(",
"Qt",
".",
"Checked",
"or",
"Qt",
".",
"Unchecked",
")",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/config/boolcti.py#L217-L234 |
titusjan/argos | argos/repo/baserti.py | BaseRti.createFromFileName | def createFromFileName(cls, fileName):
""" Creates a BaseRti (or descendant), given a file name.
"""
# See https://julien.danjou.info/blog/2013/guide-python-static-class-abstract-methods
#logger.debug("Trying to create object of class: {!r}".format(cls))
basename = os.path.basena... | python | def createFromFileName(cls, fileName):
""" Creates a BaseRti (or descendant), given a file name.
"""
# See https://julien.danjou.info/blog/2013/guide-python-static-class-abstract-methods
#logger.debug("Trying to create object of class: {!r}".format(cls))
basename = os.path.basena... | [
"def",
"createFromFileName",
"(",
"cls",
",",
"fileName",
")",
":",
"# See https://julien.danjou.info/blog/2013/guide-python-static-class-abstract-methods",
"#logger.debug(\"Trying to create object of class: {!r}\".format(cls))",
"basename",
"=",
"os",
".",
"path",
".",
"basename",
... | Creates a BaseRti (or descendant), given a file name. | [
"Creates",
"a",
"BaseRti",
"(",
"or",
"descendant",
")",
"given",
"a",
"file",
"name",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/repo/baserti.py#L60-L66 |
titusjan/argos | argos/repo/baserti.py | BaseRti.open | def open(self):
""" Opens underlying resources and sets isOpen flag.
It calls _openResources. Descendants should usually override the latter
function instead of this one.
"""
self.clearException()
try:
if self._isOpen:
logger.warn("Reso... | python | def open(self):
""" Opens underlying resources and sets isOpen flag.
It calls _openResources. Descendants should usually override the latter
function instead of this one.
"""
self.clearException()
try:
if self._isOpen:
logger.warn("Reso... | [
"def",
"open",
"(",
"self",
")",
":",
"self",
".",
"clearException",
"(",
")",
"try",
":",
"if",
"self",
".",
"_isOpen",
":",
"logger",
".",
"warn",
"(",
"\"Resources already open. Closing them first before opening.\"",
")",
"self",
".",
"_closeResources",
"(",
... | Opens underlying resources and sets isOpen flag.
It calls _openResources. Descendants should usually override the latter
function instead of this one. | [
"Opens",
"underlying",
"resources",
"and",
"sets",
"isOpen",
"flag",
".",
"It",
"calls",
"_openResources",
".",
"Descendants",
"should",
"usually",
"override",
"the",
"latter",
"function",
"instead",
"of",
"this",
"one",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/repo/baserti.py#L92-L118 |
titusjan/argos | argos/repo/baserti.py | BaseRti.close | def close(self):
""" Closes underlying resources and un-sets the isOpen flag.
Any exception that occurs is caught and put in the exception property.
This method calls _closeResources, which does the actual resource cleanup. Descendants
should typically override the latter ins... | python | def close(self):
""" Closes underlying resources and un-sets the isOpen flag.
Any exception that occurs is caught and put in the exception property.
This method calls _closeResources, which does the actual resource cleanup. Descendants
should typically override the latter ins... | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"clearException",
"(",
")",
"try",
":",
"if",
"self",
".",
"_isOpen",
":",
"logger",
".",
"debug",
"(",
"\"Closing {}\"",
".",
"format",
"(",
"self",
")",
")",
"self",
".",
"_closeResources",
"(",
"... | Closes underlying resources and un-sets the isOpen flag.
Any exception that occurs is caught and put in the exception property.
This method calls _closeResources, which does the actual resource cleanup. Descendants
should typically override the latter instead of this one. | [
"Closes",
"underlying",
"resources",
"and",
"un",
"-",
"sets",
"the",
"isOpen",
"flag",
".",
"Any",
"exception",
"that",
"occurs",
"is",
"caught",
"and",
"put",
"in",
"the",
"exception",
"property",
".",
"This",
"method",
"calls",
"_closeResources",
"which",
... | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/repo/baserti.py#L129-L153 |
titusjan/argos | argos/repo/baserti.py | BaseRti._checkFileExists | def _checkFileExists(self):
""" Verifies that the underlying file exists and sets the _exception attribute if not
Returns True if the file exists.
If self._fileName is None, nothing is checked and True is returned.
"""
if self._fileName and not os.path.exists(self._fileNa... | python | def _checkFileExists(self):
""" Verifies that the underlying file exists and sets the _exception attribute if not
Returns True if the file exists.
If self._fileName is None, nothing is checked and True is returned.
"""
if self._fileName and not os.path.exists(self._fileNa... | [
"def",
"_checkFileExists",
"(",
"self",
")",
":",
"if",
"self",
".",
"_fileName",
"and",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"_fileName",
")",
":",
"msg",
"=",
"\"File not found: {}\"",
".",
"format",
"(",
"self",
".",
"_fileName",... | Verifies that the underlying file exists and sets the _exception attribute if not
Returns True if the file exists.
If self._fileName is None, nothing is checked and True is returned. | [
"Verifies",
"that",
"the",
"underlying",
"file",
"exists",
"and",
"sets",
"the",
"_exception",
"attribute",
"if",
"not",
"Returns",
"True",
"if",
"the",
"file",
"exists",
".",
"If",
"self",
".",
"_fileName",
"is",
"None",
"nothing",
"is",
"checked",
"and",
... | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/repo/baserti.py#L164-L175 |
titusjan/argos | argos/repo/baserti.py | BaseRti.fetchChildren | def fetchChildren(self):
""" Creates child items and returns them.
Opens the tree item first if it's not yet open.
"""
assert self._canFetchChildren, "canFetchChildren must be True"
try:
self.clearException()
if not self.isOpen:
self.o... | python | def fetchChildren(self):
""" Creates child items and returns them.
Opens the tree item first if it's not yet open.
"""
assert self._canFetchChildren, "canFetchChildren must be True"
try:
self.clearException()
if not self.isOpen:
self.o... | [
"def",
"fetchChildren",
"(",
"self",
")",
":",
"assert",
"self",
".",
"_canFetchChildren",
",",
"\"canFetchChildren must be True\"",
"try",
":",
"self",
".",
"clearException",
"(",
")",
"if",
"not",
"self",
".",
"isOpen",
":",
"self",
".",
"open",
"(",
")",
... | Creates child items and returns them.
Opens the tree item first if it's not yet open. | [
"Creates",
"child",
"items",
"and",
"returns",
"them",
".",
"Opens",
"the",
"tree",
"item",
"first",
"if",
"it",
"s",
"not",
"yet",
"open",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/repo/baserti.py#L196-L226 |
titusjan/argos | argos/repo/baserti.py | BaseRti.decoration | def decoration(self):
""" The displayed icon.
Shows open icon when node was visited (children are fetched). This allows users
for instance to collapse a directory node but still see that it was visited, which
may be useful if there is a huge list of directories.
"""
... | python | def decoration(self):
""" The displayed icon.
Shows open icon when node was visited (children are fetched). This allows users
for instance to collapse a directory node but still see that it was visited, which
may be useful if there is a huge list of directories.
"""
... | [
"def",
"decoration",
"(",
"self",
")",
":",
"rtiIconFactory",
"=",
"RtiIconFactory",
".",
"singleton",
"(",
")",
"if",
"self",
".",
"_exception",
":",
"return",
"rtiIconFactory",
".",
"getIcon",
"(",
"rtiIconFactory",
".",
"ERROR",
",",
"isOpen",
"=",
"False... | The displayed icon.
Shows open icon when node was visited (children are fetched). This allows users
for instance to collapse a directory node but still see that it was visited, which
may be useful if there is a huge list of directories. | [
"The",
"displayed",
"icon",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/repo/baserti.py#L261-L275 |
titusjan/argos | argos/repo/detailplugins/dim.py | DimensionsPane._drawContents | def _drawContents(self, currentRti=None):
""" Draws the attributes of the currentRTI
"""
table = self.table
table.setUpdatesEnabled(False)
sizeAlignment = Qt.AlignRight | Qt.AlignVCenter
try:
table.clearContents()
verticalHeader = table.verticalH... | python | def _drawContents(self, currentRti=None):
""" Draws the attributes of the currentRTI
"""
table = self.table
table.setUpdatesEnabled(False)
sizeAlignment = Qt.AlignRight | Qt.AlignVCenter
try:
table.clearContents()
verticalHeader = table.verticalH... | [
"def",
"_drawContents",
"(",
"self",
",",
"currentRti",
"=",
"None",
")",
":",
"table",
"=",
"self",
".",
"table",
"table",
".",
"setUpdatesEnabled",
"(",
"False",
")",
"sizeAlignment",
"=",
"Qt",
".",
"AlignRight",
"|",
"Qt",
".",
"AlignVCenter",
"try",
... | Draws the attributes of the currentRTI | [
"Draws",
"the",
"attributes",
"of",
"the",
"currentRTI"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/repo/detailplugins/dim.py#L54-L91 |
titusjan/argos | argos/qt/scientificspinbox.py | format_float | def format_float(value): # not used
"""Modified form of the 'g' format specifier.
"""
string = "{:g}".format(value).replace("e+", "e")
string = re.sub("e(-?)0*(\d+)", r"e\1\2", string)
return string | python | def format_float(value): # not used
"""Modified form of the 'g' format specifier.
"""
string = "{:g}".format(value).replace("e+", "e")
string = re.sub("e(-?)0*(\d+)", r"e\1\2", string)
return string | [
"def",
"format_float",
"(",
"value",
")",
":",
"# not used",
"string",
"=",
"\"{:g}\"",
".",
"format",
"(",
"value",
")",
".",
"replace",
"(",
"\"e+\"",
",",
"\"e\"",
")",
"string",
"=",
"re",
".",
"sub",
"(",
"\"e(-?)0*(\\d+)\"",
",",
"r\"e\\1\\2\"",
",... | Modified form of the 'g' format specifier. | [
"Modified",
"form",
"of",
"the",
"g",
"format",
"specifier",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/scientificspinbox.py#L21-L26 |
titusjan/argos | argos/qt/scientificspinbox.py | ScientificDoubleSpinBox.smallStepsPerLargeStep | def smallStepsPerLargeStep(self, smallStepsPerLargeStep):
""" Sets the number of small steps that go in a large one.
"""
self._smallStepsPerLargeStep = smallStepsPerLargeStep
self._smallStepFactor = np.power(self.largeStepFactor, 1.0 / smallStepsPerLargeStep) | python | def smallStepsPerLargeStep(self, smallStepsPerLargeStep):
""" Sets the number of small steps that go in a large one.
"""
self._smallStepsPerLargeStep = smallStepsPerLargeStep
self._smallStepFactor = np.power(self.largeStepFactor, 1.0 / smallStepsPerLargeStep) | [
"def",
"smallStepsPerLargeStep",
"(",
"self",
",",
"smallStepsPerLargeStep",
")",
":",
"self",
".",
"_smallStepsPerLargeStep",
"=",
"smallStepsPerLargeStep",
"self",
".",
"_smallStepFactor",
"=",
"np",
".",
"power",
"(",
"self",
".",
"largeStepFactor",
",",
"1.0",
... | Sets the number of small steps that go in a large one. | [
"Sets",
"the",
"number",
"of",
"small",
"steps",
"that",
"go",
"in",
"a",
"large",
"one",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/scientificspinbox.py#L137-L142 |
titusjan/argos | argos/qt/scientificspinbox.py | ScientificDoubleSpinBox.stepBy | def stepBy(self, steps):
""" Function that is called whenever the user triggers a step. The steps parameter
indicates how many steps were taken, e.g. Pressing Qt::Key_Down will trigger a call to
stepBy(-1), whereas pressing Qt::Key_Prior will trigger a call to stepBy(10).
"""
... | python | def stepBy(self, steps):
""" Function that is called whenever the user triggers a step. The steps parameter
indicates how many steps were taken, e.g. Pressing Qt::Key_Down will trigger a call to
stepBy(-1), whereas pressing Qt::Key_Prior will trigger a call to stepBy(10).
"""
... | [
"def",
"stepBy",
"(",
"self",
",",
"steps",
")",
":",
"oldValue",
"=",
"self",
".",
"value",
"(",
")",
"if",
"oldValue",
"==",
"0",
":",
"newValue",
"=",
"steps",
"elif",
"steps",
"==",
"1",
":",
"newValue",
"=",
"self",
".",
"value",
"(",
")",
"... | Function that is called whenever the user triggers a step. The steps parameter
indicates how many steps were taken, e.g. Pressing Qt::Key_Down will trigger a call to
stepBy(-1), whereas pressing Qt::Key_Prior will trigger a call to stepBy(10). | [
"Function",
"that",
"is",
"called",
"whenever",
"the",
"user",
"triggers",
"a",
"step",
".",
"The",
"steps",
"parameter",
"indicates",
"how",
"many",
"steps",
"were",
"taken",
"e",
".",
"g",
".",
"Pressing",
"Qt",
"::",
"Key_Down",
"will",
"trigger",
"a",
... | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/scientificspinbox.py#L145-L179 |
titusjan/argos | argos/utils/moduleinfo.py | ImportedModuleInfo.tryImportModule | def tryImportModule(self, name):
""" Imports the module and sets version information
If the module cannot be imported, the version is set to empty values.
"""
self._name = name
try:
import importlib
self._module = importlib.import_module(name)
... | python | def tryImportModule(self, name):
""" Imports the module and sets version information
If the module cannot be imported, the version is set to empty values.
"""
self._name = name
try:
import importlib
self._module = importlib.import_module(name)
... | [
"def",
"tryImportModule",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"_name",
"=",
"name",
"try",
":",
"import",
"importlib",
"self",
".",
"_module",
"=",
"importlib",
".",
"import_module",
"(",
"name",
")",
"except",
"ImportError",
":",
"self",
".... | Imports the module and sets version information
If the module cannot be imported, the version is set to empty values. | [
"Imports",
"the",
"module",
"and",
"sets",
"version",
"information",
"If",
"the",
"module",
"cannot",
"be",
"imported",
"the",
"version",
"is",
"set",
"to",
"empty",
"values",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/utils/moduleinfo.py#L136-L152 |
titusjan/argos | argos/inspector/pgplugins/__init__.py | setPgConfigOptions | def setPgConfigOptions(**kwargs):
""" Sets the PyQtGraph config options and emits a log message
"""
for key, value in kwargs.items():
logger.debug("Setting PyQtGraph config option: {} = {}".format(key, value))
pg.setConfigOptions(**kwargs) | python | def setPgConfigOptions(**kwargs):
""" Sets the PyQtGraph config options and emits a log message
"""
for key, value in kwargs.items():
logger.debug("Setting PyQtGraph config option: {} = {}".format(key, value))
pg.setConfigOptions(**kwargs) | [
"def",
"setPgConfigOptions",
"(",
"*",
"*",
"kwargs",
")",
":",
"for",
"key",
",",
"value",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"logger",
".",
"debug",
"(",
"\"Setting PyQtGraph config option: {} = {}\"",
".",
"format",
"(",
"key",
",",
"value",
"... | Sets the PyQtGraph config options and emits a log message | [
"Sets",
"the",
"PyQtGraph",
"config",
"options",
"and",
"emits",
"a",
"log",
"message"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/inspector/pgplugins/__init__.py#L35-L41 |
titusjan/argos | argos/qt/treeitems.py | BaseTreeItem.model | def model(self):
""" Returns the ConfigTreeModel this item belongs to.
If the model is None (not set), it will use and cache the parent's model.
Therefore make sure that an ancestor node has a reference to the model! Typically by
setting the model property of the invisible ro... | python | def model(self):
""" Returns the ConfigTreeModel this item belongs to.
If the model is None (not set), it will use and cache the parent's model.
Therefore make sure that an ancestor node has a reference to the model! Typically by
setting the model property of the invisible ro... | [
"def",
"model",
"(",
"self",
")",
":",
"if",
"self",
".",
"_model",
"is",
"None",
"and",
"self",
".",
"parentItem",
"is",
"not",
"None",
":",
"self",
".",
"_model",
"=",
"self",
".",
"parentItem",
".",
"model",
"return",
"self",
".",
"_model"
] | Returns the ConfigTreeModel this item belongs to.
If the model is None (not set), it will use and cache the parent's model.
Therefore make sure that an ancestor node has a reference to the model! Typically by
setting the model property of the invisible root item in the model construc... | [
"Returns",
"the",
"ConfigTreeModel",
"this",
"item",
"belongs",
"to",
".",
"If",
"the",
"model",
"is",
"None",
"(",
"not",
"set",
")",
"it",
"will",
"use",
"and",
"cache",
"the",
"parent",
"s",
"model",
".",
"Therefore",
"make",
"sure",
"that",
"an",
"... | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treeitems.py#L47-L55 |
titusjan/argos | argos/qt/treeitems.py | BaseTreeItem.nodeName | def nodeName(self, nodeName):
""" The node name. Is used to construct the nodePath"""
assert '/' not in nodeName, "nodeName may not contain slashes"
self._nodeName = nodeName
self._recursiveSetNodePath(self._constructNodePath()) | python | def nodeName(self, nodeName):
""" The node name. Is used to construct the nodePath"""
assert '/' not in nodeName, "nodeName may not contain slashes"
self._nodeName = nodeName
self._recursiveSetNodePath(self._constructNodePath()) | [
"def",
"nodeName",
"(",
"self",
",",
"nodeName",
")",
":",
"assert",
"'/'",
"not",
"in",
"nodeName",
",",
"\"nodeName may not contain slashes\"",
"self",
".",
"_nodeName",
"=",
"nodeName",
"self",
".",
"_recursiveSetNodePath",
"(",
"self",
".",
"_constructNodePath... | The node name. Is used to construct the nodePath | [
"The",
"node",
"name",
".",
"Is",
"used",
"to",
"construct",
"the",
"nodePath"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treeitems.py#L119-L123 |
titusjan/argos | argos/qt/treeitems.py | BaseTreeItem._recursiveSetNodePath | def _recursiveSetNodePath(self, nodePath):
""" Sets the nodePath property and updates it for all children.
"""
self._nodePath = nodePath
for childItem in self.childItems:
childItem._recursiveSetNodePath(nodePath + '/' + childItem.nodeName) | python | def _recursiveSetNodePath(self, nodePath):
""" Sets the nodePath property and updates it for all children.
"""
self._nodePath = nodePath
for childItem in self.childItems:
childItem._recursiveSetNodePath(nodePath + '/' + childItem.nodeName) | [
"def",
"_recursiveSetNodePath",
"(",
"self",
",",
"nodePath",
")",
":",
"self",
".",
"_nodePath",
"=",
"nodePath",
"for",
"childItem",
"in",
"self",
".",
"childItems",
":",
"childItem",
".",
"_recursiveSetNodePath",
"(",
"nodePath",
"+",
"'/'",
"+",
"childItem... | Sets the nodePath property and updates it for all children. | [
"Sets",
"the",
"nodePath",
"property",
"and",
"updates",
"it",
"for",
"all",
"children",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treeitems.py#L137-L142 |
titusjan/argos | argos/qt/treeitems.py | BaseTreeItem.parentItem | def parentItem(self, value):
""" The parent item """
self._parentItem = value
self._recursiveSetNodePath(self._constructNodePath()) | python | def parentItem(self, value):
""" The parent item """
self._parentItem = value
self._recursiveSetNodePath(self._constructNodePath()) | [
"def",
"parentItem",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_parentItem",
"=",
"value",
"self",
".",
"_recursiveSetNodePath",
"(",
"self",
".",
"_constructNodePath",
"(",
")",
")"
] | The parent item | [
"The",
"parent",
"item"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treeitems.py#L150-L153 |
titusjan/argos | argos/qt/treeitems.py | BaseTreeItem.childByNodeName | def childByNodeName(self, nodeName):
""" Gets first (direct) child that has the nodeName.
"""
assert '/' not in nodeName, "nodeName can not contain slashes"
for child in self.childItems:
if child.nodeName == nodeName:
return child
raise IndexError("No... | python | def childByNodeName(self, nodeName):
""" Gets first (direct) child that has the nodeName.
"""
assert '/' not in nodeName, "nodeName can not contain slashes"
for child in self.childItems:
if child.nodeName == nodeName:
return child
raise IndexError("No... | [
"def",
"childByNodeName",
"(",
"self",
",",
"nodeName",
")",
":",
"assert",
"'/'",
"not",
"in",
"nodeName",
",",
"\"nodeName can not contain slashes\"",
"for",
"child",
"in",
"self",
".",
"childItems",
":",
"if",
"child",
".",
"nodeName",
"==",
"nodeName",
":"... | Gets first (direct) child that has the nodeName. | [
"Gets",
"first",
"(",
"direct",
")",
"child",
"that",
"has",
"the",
"nodeName",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treeitems.py#L179-L187 |
titusjan/argos | argos/qt/treeitems.py | BaseTreeItem.findByNodePath | def findByNodePath(self, nodePath):
""" Recursively searches for the child having the nodePath. Starts at self.
"""
def _auxGetByPath(parts, item):
"Aux function that does the actual recursive search"
#logger.debug("_auxGetByPath item={}, parts={}".format(item, parts))
... | python | def findByNodePath(self, nodePath):
""" Recursively searches for the child having the nodePath. Starts at self.
"""
def _auxGetByPath(parts, item):
"Aux function that does the actual recursive search"
#logger.debug("_auxGetByPath item={}, parts={}".format(item, parts))
... | [
"def",
"findByNodePath",
"(",
"self",
",",
"nodePath",
")",
":",
"def",
"_auxGetByPath",
"(",
"parts",
",",
"item",
")",
":",
"\"Aux function that does the actual recursive search\"",
"#logger.debug(\"_auxGetByPath item={}, parts={}\".format(item, parts))",
"if",
"len",
"(",
... | Recursively searches for the child having the nodePath. Starts at self. | [
"Recursively",
"searches",
"for",
"the",
"child",
"having",
"the",
"nodePath",
".",
"Starts",
"at",
"self",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treeitems.py#L190-L216 |
titusjan/argos | argos/qt/treeitems.py | BaseTreeItem.insertChild | def insertChild(self, childItem, position=None):
""" Inserts a child item to the current item.
The childItem must not yet have a parent (it will be set by this function).
IMPORTANT: this does not let the model know that items have been added.
Use BaseTreeModel.insertItem ins... | python | def insertChild(self, childItem, position=None):
""" Inserts a child item to the current item.
The childItem must not yet have a parent (it will be set by this function).
IMPORTANT: this does not let the model know that items have been added.
Use BaseTreeModel.insertItem ins... | [
"def",
"insertChild",
"(",
"self",
",",
"childItem",
",",
"position",
"=",
"None",
")",
":",
"if",
"position",
"is",
"None",
":",
"position",
"=",
"self",
".",
"nChildren",
"(",
")",
"assert",
"childItem",
".",
"parentItem",
"is",
"None",
",",
"\"childIt... | Inserts a child item to the current item.
The childItem must not yet have a parent (it will be set by this function).
IMPORTANT: this does not let the model know that items have been added.
Use BaseTreeModel.insertItem instead.
param childItem: a BaseTreeItem that will ... | [
"Inserts",
"a",
"child",
"item",
"to",
"the",
"current",
"item",
".",
"The",
"childItem",
"must",
"not",
"yet",
"have",
"a",
"parent",
"(",
"it",
"will",
"be",
"set",
"by",
"this",
"function",
")",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treeitems.py#L228-L250 |
titusjan/argos | argos/qt/treeitems.py | BaseTreeItem.removeChild | def removeChild(self, position):
""" Removes the child at the position 'position'
Calls the child item finalize to close its resources before removing it.
"""
assert 0 <= position <= len(self.childItems), \
"position should be 0 < {} <= {}".format(position, len(self.child... | python | def removeChild(self, position):
""" Removes the child at the position 'position'
Calls the child item finalize to close its resources before removing it.
"""
assert 0 <= position <= len(self.childItems), \
"position should be 0 < {} <= {}".format(position, len(self.child... | [
"def",
"removeChild",
"(",
"self",
",",
"position",
")",
":",
"assert",
"0",
"<=",
"position",
"<=",
"len",
"(",
"self",
".",
"childItems",
")",
",",
"\"position should be 0 < {} <= {}\"",
".",
"format",
"(",
"position",
",",
"len",
"(",
"self",
".",
"chil... | Removes the child at the position 'position'
Calls the child item finalize to close its resources before removing it. | [
"Removes",
"the",
"child",
"at",
"the",
"position",
"position",
"Calls",
"the",
"child",
"item",
"finalize",
"to",
"close",
"its",
"resources",
"before",
"removing",
"it",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treeitems.py#L253-L261 |
titusjan/argos | argos/qt/treeitems.py | BaseTreeItem.logBranch | def logBranch(self, indent=0, level=logging.DEBUG):
""" Logs the item and all descendants, one line per child
"""
if 0:
print(indent * " " + str(self))
else:
logger.log(level, indent * " " + str(self))
for childItems in self.childItems:
c... | python | def logBranch(self, indent=0, level=logging.DEBUG):
""" Logs the item and all descendants, one line per child
"""
if 0:
print(indent * " " + str(self))
else:
logger.log(level, indent * " " + str(self))
for childItems in self.childItems:
c... | [
"def",
"logBranch",
"(",
"self",
",",
"indent",
"=",
"0",
",",
"level",
"=",
"logging",
".",
"DEBUG",
")",
":",
"if",
"0",
":",
"print",
"(",
"indent",
"*",
"\" \"",
"+",
"str",
"(",
"self",
")",
")",
"else",
":",
"logger",
".",
"log",
"(",
... | Logs the item and all descendants, one line per child | [
"Logs",
"the",
"item",
"and",
"all",
"descendants",
"one",
"line",
"per",
"child"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treeitems.py#L273-L281 |
titusjan/argos | argos/qt/treeitems.py | AbstractLazyLoadTreeItem.fetchChildren | def fetchChildren(self):
""" Fetches children.
The actual work is done by _fetchAllChildren. Descendant classes should typically
override that method instead of this one.
"""
assert self._canFetchChildren, "canFetchChildren must be True"
try:
childIte... | python | def fetchChildren(self):
""" Fetches children.
The actual work is done by _fetchAllChildren. Descendant classes should typically
override that method instead of this one.
"""
assert self._canFetchChildren, "canFetchChildren must be True"
try:
childIte... | [
"def",
"fetchChildren",
"(",
"self",
")",
":",
"assert",
"self",
".",
"_canFetchChildren",
",",
"\"canFetchChildren must be True\"",
"try",
":",
"childItems",
"=",
"self",
".",
"_fetchAllChildren",
"(",
")",
"finally",
":",
"self",
".",
"_canFetchChildren",
"=",
... | Fetches children.
The actual work is done by _fetchAllChildren. Descendant classes should typically
override that method instead of this one. | [
"Fetches",
"children",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treeitems.py#L309-L321 |
titusjan/argos | argos/inspector/registry.py | InspectorRegItem.create | def create(self, collector, tryImport=True):
""" Creates an inspector of the registered and passes the collector to the constructor.
Tries to import the class if tryImport is True.
Raises ImportError if the class could not be imported.
"""
cls = self.getClass(tryImport=tr... | python | def create(self, collector, tryImport=True):
""" Creates an inspector of the registered and passes the collector to the constructor.
Tries to import the class if tryImport is True.
Raises ImportError if the class could not be imported.
"""
cls = self.getClass(tryImport=tr... | [
"def",
"create",
"(",
"self",
",",
"collector",
",",
"tryImport",
"=",
"True",
")",
":",
"cls",
"=",
"self",
".",
"getClass",
"(",
"tryImport",
"=",
"tryImport",
")",
"if",
"not",
"self",
".",
"successfullyImported",
":",
"raise",
"ImportError",
"(",
"\"... | Creates an inspector of the registered and passes the collector to the constructor.
Tries to import the class if tryImport is True.
Raises ImportError if the class could not be imported. | [
"Creates",
"an",
"inspector",
"of",
"the",
"registered",
"and",
"passes",
"the",
"collector",
"to",
"the",
"constructor",
".",
"Tries",
"to",
"import",
"the",
"class",
"if",
"tryImport",
"is",
"True",
".",
"Raises",
"ImportError",
"if",
"the",
"class",
"coul... | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/inspector/registry.py#L55-L63 |
titusjan/argos | argos/inspector/registry.py | InspectorRegistry.registerInspector | def registerInspector(self, fullName, fullClassName, pythonPath=''):
""" Registers an Inspector class.
"""
regInspector = InspectorRegItem(fullName, fullClassName, pythonPath=pythonPath)
self.registerItem(regInspector) | python | def registerInspector(self, fullName, fullClassName, pythonPath=''):
""" Registers an Inspector class.
"""
regInspector = InspectorRegItem(fullName, fullClassName, pythonPath=pythonPath)
self.registerItem(regInspector) | [
"def",
"registerInspector",
"(",
"self",
",",
"fullName",
",",
"fullClassName",
",",
"pythonPath",
"=",
"''",
")",
":",
"regInspector",
"=",
"InspectorRegItem",
"(",
"fullName",
",",
"fullClassName",
",",
"pythonPath",
"=",
"pythonPath",
")",
"self",
".",
"reg... | Registers an Inspector class. | [
"Registers",
"an",
"Inspector",
"class",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/inspector/registry.py#L77-L81 |
titusjan/argos | argos/inspector/registry.py | InspectorRegistry.getDefaultItems | def getDefaultItems(self):
""" Returns a list with the default plugins in the inspector registry.
"""
plugins = [
InspectorRegItem(DEFAULT_INSPECTOR,
'argos.inspector.qtplugins.table.TableInspector'),
InspectorRegItem('Qt/Text',
... | python | def getDefaultItems(self):
""" Returns a list with the default plugins in the inspector registry.
"""
plugins = [
InspectorRegItem(DEFAULT_INSPECTOR,
'argos.inspector.qtplugins.table.TableInspector'),
InspectorRegItem('Qt/Text',
... | [
"def",
"getDefaultItems",
"(",
"self",
")",
":",
"plugins",
"=",
"[",
"InspectorRegItem",
"(",
"DEFAULT_INSPECTOR",
",",
"'argos.inspector.qtplugins.table.TableInspector'",
")",
",",
"InspectorRegItem",
"(",
"'Qt/Text'",
",",
"'argos.inspector.qtplugins.text.TextInspector'",
... | Returns a list with the default plugins in the inspector registry. | [
"Returns",
"a",
"list",
"with",
"the",
"default",
"plugins",
"in",
"the",
"inspector",
"registry",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/inspector/registry.py#L84-L100 |
titusjan/argos | argos/inspector/debug.py | DebugInspector._createConfig | def _createConfig(self):
""" Creates a config tree item (CTI) hierarchy containing default children.
"""
rootItem = MainGroupCti('debug inspector')
if DEBUGGING:
# Some test config items.
import numpy as np
from argos.config.untypedcti import UntypedC... | python | def _createConfig(self):
""" Creates a config tree item (CTI) hierarchy containing default children.
"""
rootItem = MainGroupCti('debug inspector')
if DEBUGGING:
# Some test config items.
import numpy as np
from argos.config.untypedcti import UntypedC... | [
"def",
"_createConfig",
"(",
"self",
")",
":",
"rootItem",
"=",
"MainGroupCti",
"(",
"'debug inspector'",
")",
"if",
"DEBUGGING",
":",
"# Some test config items.",
"import",
"numpy",
"as",
"np",
"from",
"argos",
".",
"config",
".",
"untypedcti",
"import",
"Untyp... | Creates a config tree item (CTI) hierarchy containing default children. | [
"Creates",
"a",
"config",
"tree",
"item",
"(",
"CTI",
")",
"hierarchy",
"containing",
"default",
"children",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/inspector/debug.py#L52-L95 |
titusjan/argos | argos/inspector/debug.py | DebugInspector._drawContents | def _drawContents(self, reason=None, initiator=None):
""" Draws the table contents from the sliced array of the collected repo tree item.
The reason and initiator parameters are ignored.
See AbstractInspector.updateContents for their description.
"""
logger.debug("DebugI... | python | def _drawContents(self, reason=None, initiator=None):
""" Draws the table contents from the sliced array of the collected repo tree item.
The reason and initiator parameters are ignored.
See AbstractInspector.updateContents for their description.
"""
logger.debug("DebugI... | [
"def",
"_drawContents",
"(",
"self",
",",
"reason",
"=",
"None",
",",
"initiator",
"=",
"None",
")",
":",
"logger",
".",
"debug",
"(",
"\"DebugInspector._drawContents: {}\"",
".",
"format",
"(",
"self",
")",
")",
"slicedArray",
"=",
"self",
".",
"collector",... | Draws the table contents from the sliced array of the collected repo tree item.
The reason and initiator parameters are ignored.
See AbstractInspector.updateContents for their description. | [
"Draws",
"the",
"table",
"contents",
"from",
"the",
"sliced",
"array",
"of",
"the",
"collected",
"repo",
"tree",
"item",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/inspector/debug.py#L98-L119 |
titusjan/argos | argos/qt/treemodels.py | BaseTreeModel.data | def data(self, index, role=Qt.DisplayRole):
""" Returns the data stored under the given role for the item referred to by the index.
Calls self.itemData for valid items. Descendants should typically override itemData
instead of this function.
"""
try:
if index... | python | def data(self, index, role=Qt.DisplayRole):
""" Returns the data stored under the given role for the item referred to by the index.
Calls self.itemData for valid items. Descendants should typically override itemData
instead of this function.
"""
try:
if index... | [
"def",
"data",
"(",
"self",
",",
"index",
",",
"role",
"=",
"Qt",
".",
"DisplayRole",
")",
":",
"try",
":",
"if",
"index",
".",
"isValid",
"(",
")",
":",
"item",
"=",
"self",
".",
"getItem",
"(",
"index",
",",
"altItem",
"=",
"self",
".",
"invisi... | Returns the data stored under the given role for the item referred to by the index.
Calls self.itemData for valid items. Descendants should typically override itemData
instead of this function. | [
"Returns",
"the",
"data",
"stored",
"under",
"the",
"given",
"role",
"for",
"the",
"item",
"referred",
"to",
"by",
"the",
"index",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treemodels.py#L82-L102 |
titusjan/argos | argos/qt/treemodels.py | BaseTreeModel.itemData | def itemData(self, item, column, role=Qt.DisplayRole):
""" Returns the data stored under the given role for the item. O
The column parameter may be used to differentiate behavior per column.
The default implementation does nothing. Descendants should typically override this
... | python | def itemData(self, item, column, role=Qt.DisplayRole):
""" Returns the data stored under the given role for the item. O
The column parameter may be used to differentiate behavior per column.
The default implementation does nothing. Descendants should typically override this
... | [
"def",
"itemData",
"(",
"self",
",",
"item",
",",
"column",
",",
"role",
"=",
"Qt",
".",
"DisplayRole",
")",
":",
"if",
"role",
"==",
"Qt",
".",
"DecorationRole",
":",
"if",
"column",
"==",
"self",
".",
"COL_DECORATION",
":",
"return",
"item",
".",
"... | Returns the data stored under the given role for the item. O
The column parameter may be used to differentiate behavior per column.
The default implementation does nothing. Descendants should typically override this
function instead of data()
Note: If you do not have a ... | [
"Returns",
"the",
"data",
"stored",
"under",
"the",
"given",
"role",
"for",
"the",
"item",
".",
"O",
"The",
"column",
"parameter",
"may",
"be",
"used",
"to",
"differentiate",
"behavior",
"per",
"column",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treemodels.py#L105-L131 |
titusjan/argos | argos/qt/treemodels.py | BaseTreeModel.index | def index(self, row, column, parentIndex=QtCore.QModelIndex()):
""" Returns the index of the item in the model specified by the given row, column and parent
index.
Since each item contains information for an entire row of data, we create a model index
to uniquely identify it... | python | def index(self, row, column, parentIndex=QtCore.QModelIndex()):
""" Returns the index of the item in the model specified by the given row, column and parent
index.
Since each item contains information for an entire row of data, we create a model index
to uniquely identify it... | [
"def",
"index",
"(",
"self",
",",
"row",
",",
"column",
",",
"parentIndex",
"=",
"QtCore",
".",
"QModelIndex",
"(",
")",
")",
":",
"# logger.debug(\" called index({}, {}, {}) {}\"",
"# .format(parentIndex.row(), parentIndex.column(), parentIndex.isVa... | Returns the index of the item in the model specified by the given row, column and parent
index.
Since each item contains information for an entire row of data, we create a model index
to uniquely identify it by calling createIndex() it with the row and column numbers and
... | [
"Returns",
"the",
"index",
"of",
"the",
"item",
"in",
"the",
"model",
"specified",
"by",
"the",
"given",
"row",
"column",
"and",
"parent",
"index",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treemodels.py#L159-L193 |
titusjan/argos | argos/qt/treemodels.py | BaseTreeModel.parent | def parent(self, index):
""" Returns the parent of the model item with the given index. If the item has no parent,
an invalid QModelIndex is returned.
A common convention used in models that expose tree data structures is that only items
in the first column have children. Fo... | python | def parent(self, index):
""" Returns the parent of the model item with the given index. If the item has no parent,
an invalid QModelIndex is returned.
A common convention used in models that expose tree data structures is that only items
in the first column have children. Fo... | [
"def",
"parent",
"(",
"self",
",",
"index",
")",
":",
"if",
"not",
"index",
".",
"isValid",
"(",
")",
":",
"return",
"QtCore",
".",
"QModelIndex",
"(",
")",
"childItem",
"=",
"self",
".",
"getItem",
"(",
"index",
",",
"altItem",
"=",
"self",
".",
"... | Returns the parent of the model item with the given index. If the item has no parent,
an invalid QModelIndex is returned.
A common convention used in models that expose tree data structures is that only items
in the first column have children. For that case, when reimplementing this... | [
"Returns",
"the",
"parent",
"of",
"the",
"model",
"item",
"with",
"the",
"given",
"index",
".",
"If",
"the",
"item",
"has",
"no",
"parent",
"an",
"invalid",
"QModelIndex",
"is",
"returned",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treemodels.py#L196-L217 |
titusjan/argos | argos/qt/treemodels.py | BaseTreeModel.rowCount | def rowCount(self, parentIndex=QtCore.QModelIndex()):
""" Returns the number of rows under the given parent. When the parent is valid it means
that rowCount is returning the number of children of parent.
Note: When implementing a table based model, rowCount() should return 0 when the pa... | python | def rowCount(self, parentIndex=QtCore.QModelIndex()):
""" Returns the number of rows under the given parent. When the parent is valid it means
that rowCount is returning the number of children of parent.
Note: When implementing a table based model, rowCount() should return 0 when the pa... | [
"def",
"rowCount",
"(",
"self",
",",
"parentIndex",
"=",
"QtCore",
".",
"QModelIndex",
"(",
")",
")",
":",
"parentItem",
"=",
"self",
".",
"getItem",
"(",
"parentIndex",
",",
"altItem",
"=",
"self",
".",
"invisibleRootItem",
")",
"return",
"parentItem",
".... | Returns the number of rows under the given parent. When the parent is valid it means
that rowCount is returning the number of children of parent.
Note: When implementing a table based model, rowCount() should return 0 when the parent
is valid. | [
"Returns",
"the",
"number",
"of",
"rows",
"under",
"the",
"given",
"parent",
".",
"When",
"the",
"parent",
"is",
"valid",
"it",
"means",
"that",
"rowCount",
"is",
"returning",
"the",
"number",
"of",
"children",
"of",
"parent",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treemodels.py#L220-L228 |
titusjan/argos | argos/qt/treemodels.py | BaseTreeModel.hasChildren | def hasChildren(self, parentIndex=QtCore.QModelIndex()):
""" Returns true if parent has any children; otherwise returns false.
Use rowCount() on the parent to find out the number of children.
"""
parentItem = self.getItem(parentIndex, altItem=self.invisibleRootItem)
return pa... | python | def hasChildren(self, parentIndex=QtCore.QModelIndex()):
""" Returns true if parent has any children; otherwise returns false.
Use rowCount() on the parent to find out the number of children.
"""
parentItem = self.getItem(parentIndex, altItem=self.invisibleRootItem)
return pa... | [
"def",
"hasChildren",
"(",
"self",
",",
"parentIndex",
"=",
"QtCore",
".",
"QModelIndex",
"(",
")",
")",
":",
"parentItem",
"=",
"self",
".",
"getItem",
"(",
"parentIndex",
",",
"altItem",
"=",
"self",
".",
"invisibleRootItem",
")",
"return",
"parentItem",
... | Returns true if parent has any children; otherwise returns false.
Use rowCount() on the parent to find out the number of children. | [
"Returns",
"true",
"if",
"parent",
"has",
"any",
"children",
";",
"otherwise",
"returns",
"false",
".",
"Use",
"rowCount",
"()",
"on",
"the",
"parent",
"to",
"find",
"out",
"the",
"number",
"of",
"children",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treemodels.py#L231-L236 |
titusjan/argos | argos/qt/treemodels.py | BaseTreeModel.setData | def setData(self, index, value, role=Qt.EditRole):
""" Sets the role data for the item at index to value.
Returns true if successful; otherwise returns false.
The dataChanged and sigItemChanged signals will be emitted if the data was successfully
set.
Descendant... | python | def setData(self, index, value, role=Qt.EditRole):
""" Sets the role data for the item at index to value.
Returns true if successful; otherwise returns false.
The dataChanged and sigItemChanged signals will be emitted if the data was successfully
set.
Descendant... | [
"def",
"setData",
"(",
"self",
",",
"index",
",",
"value",
",",
"role",
"=",
"Qt",
".",
"EditRole",
")",
":",
"if",
"role",
"!=",
"Qt",
".",
"CheckStateRole",
"and",
"role",
"!=",
"Qt",
".",
"EditRole",
":",
"return",
"False",
"treeItem",
"=",
"self"... | Sets the role data for the item at index to value.
Returns true if successful; otherwise returns false.
The dataChanged and sigItemChanged signals will be emitted if the data was successfully
set.
Descendants should typically override setItemData function instead of set... | [
"Sets",
"the",
"role",
"data",
"for",
"the",
"item",
"at",
"index",
"to",
"value",
".",
"Returns",
"true",
"if",
"successful",
";",
"otherwise",
"returns",
"false",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treemodels.py#L239-L271 |
titusjan/argos | argos/qt/treemodels.py | BaseTreeModel.getItem | def getItem(self, index, altItem=None):
""" Returns the TreeItem for the given index. Returns the altItem if the index is invalid.
"""
if index.isValid():
item = index.internalPointer()
if item:
return item
#return altItem if altItem is not None e... | python | def getItem(self, index, altItem=None):
""" Returns the TreeItem for the given index. Returns the altItem if the index is invalid.
"""
if index.isValid():
item = index.internalPointer()
if item:
return item
#return altItem if altItem is not None e... | [
"def",
"getItem",
"(",
"self",
",",
"index",
",",
"altItem",
"=",
"None",
")",
":",
"if",
"index",
".",
"isValid",
"(",
")",
":",
"item",
"=",
"index",
".",
"internalPointer",
"(",
")",
"if",
"item",
":",
"return",
"item",
"#return altItem if altItem is ... | Returns the TreeItem for the given index. Returns the altItem if the index is invalid. | [
"Returns",
"the",
"TreeItem",
"for",
"the",
"given",
"index",
".",
"Returns",
"the",
"altItem",
"if",
"the",
"index",
"is",
"invalid",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treemodels.py#L305-L314 |
titusjan/argos | argos/qt/treemodels.py | BaseTreeModel.insertItem | def insertItem(self, childItem, position=None, parentIndex=None):
""" Inserts a childItem before row 'position' under the parent index.
If position is None the child will be appended as the last child of the parent.
Returns the index of the new inserted child.
"""
if par... | python | def insertItem(self, childItem, position=None, parentIndex=None):
""" Inserts a childItem before row 'position' under the parent index.
If position is None the child will be appended as the last child of the parent.
Returns the index of the new inserted child.
"""
if par... | [
"def",
"insertItem",
"(",
"self",
",",
"childItem",
",",
"position",
"=",
"None",
",",
"parentIndex",
"=",
"None",
")",
":",
"if",
"parentIndex",
"is",
"None",
":",
"parentIndex",
"=",
"QtCore",
".",
"QModelIndex",
"(",
")",
"parentItem",
"=",
"self",
".... | Inserts a childItem before row 'position' under the parent index.
If position is None the child will be appended as the last child of the parent.
Returns the index of the new inserted child. | [
"Inserts",
"a",
"childItem",
"before",
"row",
"position",
"under",
"the",
"parent",
"index",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treemodels.py#L317-L343 |
titusjan/argos | argos/qt/treemodels.py | BaseTreeModel.removeAllChildrenAtIndex | def removeAllChildrenAtIndex(self, parentIndex):
""" Removes all children of the item at the parentIndex.
The children's finalize method is called before removing them to give them a
chance to close their resources
"""
if not parentIndex.isValid():
logger.debu... | python | def removeAllChildrenAtIndex(self, parentIndex):
""" Removes all children of the item at the parentIndex.
The children's finalize method is called before removing them to give them a
chance to close their resources
"""
if not parentIndex.isValid():
logger.debu... | [
"def",
"removeAllChildrenAtIndex",
"(",
"self",
",",
"parentIndex",
")",
":",
"if",
"not",
"parentIndex",
".",
"isValid",
"(",
")",
":",
"logger",
".",
"debug",
"(",
"\"No valid item selected for deletion (ignored).\"",
")",
"return",
"parentItem",
"=",
"self",
".... | Removes all children of the item at the parentIndex.
The children's finalize method is called before removing them to give them a
chance to close their resources | [
"Removes",
"all",
"children",
"of",
"the",
"item",
"at",
"the",
"parentIndex",
".",
"The",
"children",
"s",
"finalize",
"method",
"is",
"called",
"before",
"removing",
"them",
"to",
"give",
"them",
"a",
"chance",
"to",
"close",
"their",
"resources"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treemodels.py#L346-L370 |
titusjan/argos | argos/qt/treemodels.py | BaseTreeModel.deleteItemAtIndex | def deleteItemAtIndex(self, itemIndex):
""" Removes the item at the itemIndex.
The item's finalize method is called before removing so it can close its resources.
"""
if not itemIndex.isValid():
logger.debug("No valid item selected for deletion (ignored).")
re... | python | def deleteItemAtIndex(self, itemIndex):
""" Removes the item at the itemIndex.
The item's finalize method is called before removing so it can close its resources.
"""
if not itemIndex.isValid():
logger.debug("No valid item selected for deletion (ignored).")
re... | [
"def",
"deleteItemAtIndex",
"(",
"self",
",",
"itemIndex",
")",
":",
"if",
"not",
"itemIndex",
".",
"isValid",
"(",
")",
":",
"logger",
".",
"debug",
"(",
"\"No valid item selected for deletion (ignored).\"",
")",
"return",
"item",
"=",
"self",
".",
"getItem",
... | Removes the item at the itemIndex.
The item's finalize method is called before removing so it can close its resources. | [
"Removes",
"the",
"item",
"at",
"the",
"itemIndex",
".",
"The",
"item",
"s",
"finalize",
"method",
"is",
"called",
"before",
"removing",
"so",
"it",
"can",
"close",
"its",
"resources",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treemodels.py#L373-L393 |
titusjan/argos | argos/qt/treemodels.py | BaseTreeModel.replaceItemAtIndex | def replaceItemAtIndex(self, newItem, oldItemIndex):
""" Removes the item at the itemIndex and insert a new item instead.
"""
oldItem = self.getItem(oldItemIndex)
childNumber = oldItem.childNumber()
parentIndex = oldItemIndex.parent()
self.deleteItemAtIndex(oldItemIndex)
... | python | def replaceItemAtIndex(self, newItem, oldItemIndex):
""" Removes the item at the itemIndex and insert a new item instead.
"""
oldItem = self.getItem(oldItemIndex)
childNumber = oldItem.childNumber()
parentIndex = oldItemIndex.parent()
self.deleteItemAtIndex(oldItemIndex)
... | [
"def",
"replaceItemAtIndex",
"(",
"self",
",",
"newItem",
",",
"oldItemIndex",
")",
":",
"oldItem",
"=",
"self",
".",
"getItem",
"(",
"oldItemIndex",
")",
"childNumber",
"=",
"oldItem",
".",
"childNumber",
"(",
")",
"parentIndex",
"=",
"oldItemIndex",
".",
"... | Removes the item at the itemIndex and insert a new item instead. | [
"Removes",
"the",
"item",
"at",
"the",
"itemIndex",
"and",
"insert",
"a",
"new",
"item",
"instead",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treemodels.py#L396-L404 |
titusjan/argos | argos/qt/treemodels.py | BaseTreeModel.findTopLevelItemIndex | def findTopLevelItemIndex(self, childIndex):
""" Traverses the tree upwards from childItem until its top level ancestor item is found.
Top level items are items that are direct children of the (invisible) root item.
This function therefore raises an exception when called with the root it... | python | def findTopLevelItemIndex(self, childIndex):
""" Traverses the tree upwards from childItem until its top level ancestor item is found.
Top level items are items that are direct children of the (invisible) root item.
This function therefore raises an exception when called with the root it... | [
"def",
"findTopLevelItemIndex",
"(",
"self",
",",
"childIndex",
")",
":",
"if",
"self",
".",
"isTopLevelIndex",
"(",
"childIndex",
")",
":",
"return",
"childIndex",
"else",
":",
"return",
"self",
".",
"findTopLevelItemIndex",
"(",
"childIndex",
".",
"parent",
... | Traverses the tree upwards from childItem until its top level ancestor item is found.
Top level items are items that are direct children of the (invisible) root item.
This function therefore raises an exception when called with the root item. | [
"Traverses",
"the",
"tree",
"upwards",
"from",
"childItem",
"until",
"its",
"top",
"level",
"ancestor",
"item",
"is",
"found",
".",
"Top",
"level",
"items",
"are",
"items",
"that",
"are",
"direct",
"children",
"of",
"the",
"(",
"invisible",
")",
"root",
"i... | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treemodels.py#L431-L439 |
titusjan/argos | argos/qt/treemodels.py | BaseTreeModel.findItemAndIndexPath | def findItemAndIndexPath(self, path, startIndex=None):
""" Searches all the model recursively (starting at startIndex) for an item where
item.nodePath == path.
Returns list of (item, itemIndex) tuples from the start index to that node.
Raises IndexError if the item cannot be... | python | def findItemAndIndexPath(self, path, startIndex=None):
""" Searches all the model recursively (starting at startIndex) for an item where
item.nodePath == path.
Returns list of (item, itemIndex) tuples from the start index to that node.
Raises IndexError if the item cannot be... | [
"def",
"findItemAndIndexPath",
"(",
"self",
",",
"path",
",",
"startIndex",
"=",
"None",
")",
":",
"def",
"_getIndexAndItemByName",
"(",
"nodeName",
",",
"parentItem",
",",
"parentIndex",
")",
":",
"\"\"\" Searches the parent for a direct child having the nodeName.\n ... | Searches all the model recursively (starting at startIndex) for an item where
item.nodePath == path.
Returns list of (item, itemIndex) tuples from the start index to that node.
Raises IndexError if the item cannot be found.
If startIndex is None, or path starts with a s... | [
"Searches",
"all",
"the",
"model",
"recursively",
"(",
"starting",
"at",
"startIndex",
")",
"for",
"an",
"item",
"where",
"item",
".",
"nodePath",
"==",
"path",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treemodels.py#L442-L496 |
titusjan/argos | argos/qt/treemodels.py | BaseTreeModel.logItems | def logItems(self, level=logging.DEBUG):
""" rootItem
"""
rootItem = self.rootItem()
if rootItem is None:
logger.debug("No items in: {}".format(self))
else:
rootItem.logBranch(level=level) | python | def logItems(self, level=logging.DEBUG):
""" rootItem
"""
rootItem = self.rootItem()
if rootItem is None:
logger.debug("No items in: {}".format(self))
else:
rootItem.logBranch(level=level) | [
"def",
"logItems",
"(",
"self",
",",
"level",
"=",
"logging",
".",
"DEBUG",
")",
":",
"rootItem",
"=",
"self",
".",
"rootItem",
"(",
")",
"if",
"rootItem",
"is",
"None",
":",
"logger",
".",
"debug",
"(",
"\"No items in: {}\"",
".",
"format",
"(",
"self... | rootItem | [
"rootItem"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/treemodels.py#L508-L515 |
titusjan/argos | argos/qt/togglecolumn.py | ToggleColumnMixIn.addHeaderContextMenu | def addHeaderContextMenu(self, checked = None, checkable = None, enabled = None):
""" Adds the context menu from using header information
checked can be a header_name -> boolean dictionary. If given, headers
with the key name will get the checked value from the dictionary.
T... | python | def addHeaderContextMenu(self, checked = None, checkable = None, enabled = None):
""" Adds the context menu from using header information
checked can be a header_name -> boolean dictionary. If given, headers
with the key name will get the checked value from the dictionary.
T... | [
"def",
"addHeaderContextMenu",
"(",
"self",
",",
"checked",
"=",
"None",
",",
"checkable",
"=",
"None",
",",
"enabled",
"=",
"None",
")",
":",
"checked",
"=",
"checked",
"if",
"checked",
"is",
"not",
"None",
"else",
"{",
"}",
"checkable",
"=",
"checkable... | Adds the context menu from using header information
checked can be a header_name -> boolean dictionary. If given, headers
with the key name will get the checked value from the dictionary.
The corresponding column will be hidden if checked is False.
checkable can be a he... | [
"Adds",
"the",
"context",
"menu",
"from",
"using",
"header",
"information"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/togglecolumn.py#L41-L79 |
titusjan/argos | argos/qt/togglecolumn.py | ToggleColumnMixIn.__makeShowColumnFunction | def __makeShowColumnFunction(self, column_idx):
""" Creates a function that shows or hides a column."""
show_column = lambda checked: self.setColumnHidden(column_idx, not checked)
return show_column | python | def __makeShowColumnFunction(self, column_idx):
""" Creates a function that shows or hides a column."""
show_column = lambda checked: self.setColumnHidden(column_idx, not checked)
return show_column | [
"def",
"__makeShowColumnFunction",
"(",
"self",
",",
"column_idx",
")",
":",
"show_column",
"=",
"lambda",
"checked",
":",
"self",
".",
"setColumnHidden",
"(",
"column_idx",
",",
"not",
"checked",
")",
"return",
"show_column"
] | Creates a function that shows or hides a column. | [
"Creates",
"a",
"function",
"that",
"shows",
"or",
"hides",
"a",
"column",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/togglecolumn.py#L88-L91 |
titusjan/argos | argos/qt/togglecolumn.py | ToggleColumnMixIn.readViewSettings | def readViewSettings(self, key, settings=None):
""" Reads the persistent program settings
:param key: key where the setting will be read from
:param settings: optional QSettings object which can have a group already opened.
:returns: True if the header state was restored, ot... | python | def readViewSettings(self, key, settings=None):
""" Reads the persistent program settings
:param key: key where the setting will be read from
:param settings: optional QSettings object which can have a group already opened.
:returns: True if the header state was restored, ot... | [
"def",
"readViewSettings",
"(",
"self",
",",
"key",
",",
"settings",
"=",
"None",
")",
":",
"#logger.debug(\"Reading view settings for: {}\".format(key))",
"if",
"settings",
"is",
"None",
":",
"settings",
"=",
"QtCore",
".",
"QSettings",
"(",
")",
"horizontal_header... | Reads the persistent program settings
:param key: key where the setting will be read from
:param settings: optional QSettings object which can have a group already opened.
:returns: True if the header state was restored, otherwise returns False | [
"Reads",
"the",
"persistent",
"program",
"settings"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/togglecolumn.py#L94-L113 |
titusjan/argos | argos/qt/togglecolumn.py | ToggleColumnMixIn.saveProfile | def saveProfile(self, key, settings=None):
""" Writes the view settings to the persistent store
:param key: key where the setting will be read from
:param settings: optional QSettings object which can have a group already opened.
"""
#logger.debug("Writing view settings f... | python | def saveProfile(self, key, settings=None):
""" Writes the view settings to the persistent store
:param key: key where the setting will be read from
:param settings: optional QSettings object which can have a group already opened.
"""
#logger.debug("Writing view settings f... | [
"def",
"saveProfile",
"(",
"self",
",",
"key",
",",
"settings",
"=",
"None",
")",
":",
"#logger.debug(\"Writing view settings for: {}\".format(key))",
"if",
"settings",
"is",
"None",
":",
"settings",
"=",
"QtCore",
".",
"QSettings",
"(",
")",
"settings",
".",
"s... | Writes the view settings to the persistent store
:param key: key where the setting will be read from
:param settings: optional QSettings object which can have a group already opened. | [
"Writes",
"the",
"view",
"settings",
"to",
"the",
"persistent",
"store",
":",
"param",
"key",
":",
"key",
"where",
"the",
"setting",
"will",
"be",
"read",
"from",
":",
"param",
"settings",
":",
"optional",
"QSettings",
"object",
"which",
"can",
"have",
"a"... | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/togglecolumn.py#L115-L123 |
titusjan/argos | argos/qt/registry.py | ClassRegItem.descriptionHtml | def descriptionHtml(self):
""" HTML help describing the class. For use in the detail editor.
"""
if self.cls is None:
return None
elif hasattr(self.cls, 'descriptionHtml'):
return self.cls.descriptionHtml()
else:
return '' | python | def descriptionHtml(self):
""" HTML help describing the class. For use in the detail editor.
"""
if self.cls is None:
return None
elif hasattr(self.cls, 'descriptionHtml'):
return self.cls.descriptionHtml()
else:
return '' | [
"def",
"descriptionHtml",
"(",
"self",
")",
":",
"if",
"self",
".",
"cls",
"is",
"None",
":",
"return",
"None",
"elif",
"hasattr",
"(",
"self",
".",
"cls",
",",
"'descriptionHtml'",
")",
":",
"return",
"self",
".",
"cls",
".",
"descriptionHtml",
"(",
"... | HTML help describing the class. For use in the detail editor. | [
"HTML",
"help",
"describing",
"the",
"class",
".",
"For",
"use",
"in",
"the",
"detail",
"editor",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/registry.py#L152-L160 |
titusjan/argos | argos/qt/registry.py | ClassRegItem.tryImportClass | def tryImportClass(self):
""" Tries to import the registered class.
Will set the exception property if and error occurred.
"""
logger.info("Importing: {}".format(self.fullClassName))
self._triedImport = True
self._exception = None
self._cls = None
try:... | python | def tryImportClass(self):
""" Tries to import the registered class.
Will set the exception property if and error occurred.
"""
logger.info("Importing: {}".format(self.fullClassName))
self._triedImport = True
self._exception = None
self._cls = None
try:... | [
"def",
"tryImportClass",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"\"Importing: {}\"",
".",
"format",
"(",
"self",
".",
"fullClassName",
")",
")",
"self",
".",
"_triedImport",
"=",
"True",
"self",
".",
"_exception",
"=",
"None",
"self",
".",
"_... | Tries to import the registered class.
Will set the exception property if and error occurred. | [
"Tries",
"to",
"import",
"the",
"registered",
"class",
".",
"Will",
"set",
"the",
"exception",
"property",
"if",
"and",
"error",
"occurred",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/registry.py#L187-L205 |
titusjan/argos | argos/qt/registry.py | ClassRegItem.getClass | def getClass(self, tryImport=True):
""" Gets the underlying class. Tries to import if tryImport is True (the default).
Returns None if the import has failed (the exception property will contain the reason)
"""
if not self.triedImport and tryImport:
self.tryImportClass()
... | python | def getClass(self, tryImport=True):
""" Gets the underlying class. Tries to import if tryImport is True (the default).
Returns None if the import has failed (the exception property will contain the reason)
"""
if not self.triedImport and tryImport:
self.tryImportClass()
... | [
"def",
"getClass",
"(",
"self",
",",
"tryImport",
"=",
"True",
")",
":",
"if",
"not",
"self",
".",
"triedImport",
"and",
"tryImport",
":",
"self",
".",
"tryImportClass",
"(",
")",
"return",
"self",
".",
"_cls"
] | Gets the underlying class. Tries to import if tryImport is True (the default).
Returns None if the import has failed (the exception property will contain the reason) | [
"Gets",
"the",
"underlying",
"class",
".",
"Tries",
"to",
"import",
"if",
"tryImport",
"is",
"True",
"(",
"the",
"default",
")",
".",
"Returns",
"None",
"if",
"the",
"import",
"has",
"failed",
"(",
"the",
"exception",
"property",
"will",
"contain",
"the",
... | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/registry.py#L208-L215 |
titusjan/argos | argos/qt/registry.py | ClassRegistry.registerItem | def registerItem(self, regItem):
""" Adds a ClassRegItem object to the registry.
"""
check_class(regItem, ClassRegItem)
if regItem.identifier in self._index:
oldRegItem = self._index[regItem.identifier]
logger.warn("Class key {!r} already registered as {}. Removin... | python | def registerItem(self, regItem):
""" Adds a ClassRegItem object to the registry.
"""
check_class(regItem, ClassRegItem)
if regItem.identifier in self._index:
oldRegItem = self._index[regItem.identifier]
logger.warn("Class key {!r} already registered as {}. Removin... | [
"def",
"registerItem",
"(",
"self",
",",
"regItem",
")",
":",
"check_class",
"(",
"regItem",
",",
"ClassRegItem",
")",
"if",
"regItem",
".",
"identifier",
"in",
"self",
".",
"_index",
":",
"oldRegItem",
"=",
"self",
".",
"_index",
"[",
"regItem",
".",
"i... | Adds a ClassRegItem object to the registry. | [
"Adds",
"a",
"ClassRegItem",
"object",
"to",
"the",
"registry",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/registry.py#L281-L293 |
titusjan/argos | argos/qt/registry.py | ClassRegistry.removeItem | def removeItem(self, regItem):
""" Removes a ClassRegItem object to the registry.
Will raise a KeyError if the regItem is not registered.
"""
check_class(regItem, ClassRegItem)
logger.info("Removing {!r} containing {}".format(regItem.identifier, regItem.fullClassName))
... | python | def removeItem(self, regItem):
""" Removes a ClassRegItem object to the registry.
Will raise a KeyError if the regItem is not registered.
"""
check_class(regItem, ClassRegItem)
logger.info("Removing {!r} containing {}".format(regItem.identifier, regItem.fullClassName))
... | [
"def",
"removeItem",
"(",
"self",
",",
"regItem",
")",
":",
"check_class",
"(",
"regItem",
",",
"ClassRegItem",
")",
"logger",
".",
"info",
"(",
"\"Removing {!r} containing {}\"",
".",
"format",
"(",
"regItem",
".",
"identifier",
",",
"regItem",
".",
"fullClas... | Removes a ClassRegItem object to the registry.
Will raise a KeyError if the regItem is not registered. | [
"Removes",
"a",
"ClassRegItem",
"object",
"to",
"the",
"registry",
".",
"Will",
"raise",
"a",
"KeyError",
"if",
"the",
"regItem",
"is",
"not",
"registered",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/registry.py#L296-L305 |
titusjan/argos | argos/qt/registry.py | ClassRegistry.loadOrInitSettings | def loadOrInitSettings(self, groupName=None):
""" Reads the registry items from the persistent settings store, falls back on the
default plugins if there are no settings in the store for this registry.
"""
groupName = groupName if groupName else self.settingsGroupName
setting... | python | def loadOrInitSettings(self, groupName=None):
""" Reads the registry items from the persistent settings store, falls back on the
default plugins if there are no settings in the store for this registry.
"""
groupName = groupName if groupName else self.settingsGroupName
setting... | [
"def",
"loadOrInitSettings",
"(",
"self",
",",
"groupName",
"=",
"None",
")",
":",
"groupName",
"=",
"groupName",
"if",
"groupName",
"else",
"self",
".",
"settingsGroupName",
"settings",
"=",
"QtCore",
".",
"QSettings",
"(",
")",
"#for key in sorted(settings.allKe... | Reads the registry items from the persistent settings store, falls back on the
default plugins if there are no settings in the store for this registry. | [
"Reads",
"the",
"registry",
"items",
"from",
"the",
"persistent",
"settings",
"store",
"falls",
"back",
"on",
"the",
"default",
"plugins",
"if",
"there",
"are",
"no",
"settings",
"in",
"the",
"store",
"for",
"this",
"registry",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/registry.py#L308-L326 |
titusjan/argos | argos/qt/registry.py | ClassRegistry.loadSettings | def loadSettings(self, groupName=None):
""" Reads the registry items from the persistent settings store.
"""
groupName = groupName if groupName else self.settingsGroupName
settings = QtCore.QSettings()
logger.info("Reading {!r} from: {}".format(groupName, settings.fileName()))
... | python | def loadSettings(self, groupName=None):
""" Reads the registry items from the persistent settings store.
"""
groupName = groupName if groupName else self.settingsGroupName
settings = QtCore.QSettings()
logger.info("Reading {!r} from: {}".format(groupName, settings.fileName()))
... | [
"def",
"loadSettings",
"(",
"self",
",",
"groupName",
"=",
"None",
")",
":",
"groupName",
"=",
"groupName",
"if",
"groupName",
"else",
"self",
".",
"settingsGroupName",
"settings",
"=",
"QtCore",
".",
"QSettings",
"(",
")",
"logger",
".",
"info",
"(",
"\"R... | Reads the registry items from the persistent settings store. | [
"Reads",
"the",
"registry",
"items",
"from",
"the",
"persistent",
"settings",
"store",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/registry.py#L329-L345 |
titusjan/argos | argos/qt/registry.py | ClassRegistry.saveSettings | def saveSettings(self, groupName=None):
""" Writes the registry items into the persistent settings store.
"""
groupName = groupName if groupName else self.settingsGroupName
settings = QtCore.QSettings()
logger.info("Saving {} to: {}".format(groupName, settings.fileName()))
... | python | def saveSettings(self, groupName=None):
""" Writes the registry items into the persistent settings store.
"""
groupName = groupName if groupName else self.settingsGroupName
settings = QtCore.QSettings()
logger.info("Saving {} to: {}".format(groupName, settings.fileName()))
... | [
"def",
"saveSettings",
"(",
"self",
",",
"groupName",
"=",
"None",
")",
":",
"groupName",
"=",
"groupName",
"if",
"groupName",
"else",
"self",
".",
"settingsGroupName",
"settings",
"=",
"QtCore",
".",
"QSettings",
"(",
")",
"logger",
".",
"info",
"(",
"\"S... | Writes the registry items into the persistent settings store. | [
"Writes",
"the",
"registry",
"items",
"into",
"the",
"persistent",
"settings",
"store",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/registry.py#L348-L363 |
titusjan/argos | argos/qt/registry.py | ClassRegistry.deleteSettings | def deleteSettings(self, groupName=None):
""" Deletes registry items from the persistent store.
"""
groupName = groupName if groupName else self.settingsGroupName
settings = QtCore.QSettings()
logger.info("Deleting {} from: {}".format(groupName, settings.fileName()))
remo... | python | def deleteSettings(self, groupName=None):
""" Deletes registry items from the persistent store.
"""
groupName = groupName if groupName else self.settingsGroupName
settings = QtCore.QSettings()
logger.info("Deleting {} from: {}".format(groupName, settings.fileName()))
remo... | [
"def",
"deleteSettings",
"(",
"self",
",",
"groupName",
"=",
"None",
")",
":",
"groupName",
"=",
"groupName",
"if",
"groupName",
"else",
"self",
".",
"settingsGroupName",
"settings",
"=",
"QtCore",
".",
"QSettings",
"(",
")",
"logger",
".",
"info",
"(",
"\... | Deletes registry items from the persistent store. | [
"Deletes",
"registry",
"items",
"from",
"the",
"persistent",
"store",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/qt/registry.py#L366-L372 |
titusjan/argos | argos/repo/detailpanes.py | DetailBasePane.dockVisibilityChanged | def dockVisibilityChanged(self, visible):
""" Slot to be called when the dock widget that this pane contains become (in)visible.
Is used to (dis)connect the pane from its repo tree view and so prevent unnecessary
and potentially costly updates when the pane is hidden.
"""
... | python | def dockVisibilityChanged(self, visible):
""" Slot to be called when the dock widget that this pane contains become (in)visible.
Is used to (dis)connect the pane from its repo tree view and so prevent unnecessary
and potentially costly updates when the pane is hidden.
"""
... | [
"def",
"dockVisibilityChanged",
"(",
"self",
",",
"visible",
")",
":",
"logger",
".",
"debug",
"(",
"\"dockVisibilityChanged of {!r}: visible={}\"",
".",
"format",
"(",
"self",
",",
"visible",
")",
")",
"if",
"visible",
":",
"self",
".",
"_repoTreeView",
".",
... | Slot to be called when the dock widget that this pane contains become (in)visible.
Is used to (dis)connect the pane from its repo tree view and so prevent unnecessary
and potentially costly updates when the pane is hidden. | [
"Slot",
"to",
"be",
"called",
"when",
"the",
"dock",
"widget",
"that",
"this",
"pane",
"contains",
"become",
"(",
"in",
")",
"visible",
".",
"Is",
"used",
"to",
"(",
"dis",
")",
"connect",
"the",
"pane",
"from",
"its",
"repo",
"tree",
"view",
"and",
... | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/repo/detailpanes.py#L85-L106 |
titusjan/argos | argos/repo/detailpanes.py | DetailBasePane.repoItemChanged | def repoItemChanged(self, rti):
""" Updates the content when the current repo tree item changes.
The rti parameter can be None when no RTI is selected in the repository tree.
"""
check_class(rti, (BaseRti, int), allow_none=True)
assert type(rti) != int, "rti: {}".format(rti)
... | python | def repoItemChanged(self, rti):
""" Updates the content when the current repo tree item changes.
The rti parameter can be None when no RTI is selected in the repository tree.
"""
check_class(rti, (BaseRti, int), allow_none=True)
assert type(rti) != int, "rti: {}".format(rti)
... | [
"def",
"repoItemChanged",
"(",
"self",
",",
"rti",
")",
":",
"check_class",
"(",
"rti",
",",
"(",
"BaseRti",
",",
"int",
")",
",",
"allow_none",
"=",
"True",
")",
"assert",
"type",
"(",
"rti",
")",
"!=",
"int",
",",
"\"rti: {}\"",
".",
"format",
"(",... | Updates the content when the current repo tree item changes.
The rti parameter can be None when no RTI is selected in the repository tree. | [
"Updates",
"the",
"content",
"when",
"the",
"current",
"repo",
"tree",
"item",
"changes",
".",
"The",
"rti",
"parameter",
"can",
"be",
"None",
"when",
"no",
"RTI",
"is",
"selected",
"in",
"the",
"repository",
"tree",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/repo/detailpanes.py#L109-L123 |
titusjan/argos | argos/inspector/selectionpane.py | addInspectorActionsToMenu | def addInspectorActionsToMenu(inspectorMenu, execInspectorDialogAction, inspectorActionGroup):
""" Adds menu items to the inpsectorMenu for the given set-inspector actions.
:param inspectorMenu: inspector menu that will be modified
:param execInspectorDialogAction: the "Browse Inspectors..." action... | python | def addInspectorActionsToMenu(inspectorMenu, execInspectorDialogAction, inspectorActionGroup):
""" Adds menu items to the inpsectorMenu for the given set-inspector actions.
:param inspectorMenu: inspector menu that will be modified
:param execInspectorDialogAction: the "Browse Inspectors..." action... | [
"def",
"addInspectorActionsToMenu",
"(",
"inspectorMenu",
",",
"execInspectorDialogAction",
",",
"inspectorActionGroup",
")",
":",
"inspectorMenu",
".",
"addAction",
"(",
"execInspectorDialogAction",
")",
"inspectorMenu",
".",
"addSeparator",
"(",
")",
"for",
"action",
... | Adds menu items to the inpsectorMenu for the given set-inspector actions.
:param inspectorMenu: inspector menu that will be modified
:param execInspectorDialogAction: the "Browse Inspectors..." actions
:param inspectorActionGroup: action group with actions for selecting a new inspector
... | [
"Adds",
"menu",
"items",
"to",
"the",
"inpsectorMenu",
"for",
"the",
"given",
"set",
"-",
"inspector",
"actions",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/inspector/selectionpane.py#L31-L45 |
titusjan/argos | argos/inspector/selectionpane.py | InspectorSelectionPane.updateFromInspectorRegItem | def updateFromInspectorRegItem(self, inspectorRegItem):
""" Updates the label from the full name of the InspectorRegItem
"""
library, name = inspectorRegItem.splitName()
label = "{} ({})".format(name, library) if library else name
#self.label.setText(label)
self.menuButto... | python | def updateFromInspectorRegItem(self, inspectorRegItem):
""" Updates the label from the full name of the InspectorRegItem
"""
library, name = inspectorRegItem.splitName()
label = "{} ({})".format(name, library) if library else name
#self.label.setText(label)
self.menuButto... | [
"def",
"updateFromInspectorRegItem",
"(",
"self",
",",
"inspectorRegItem",
")",
":",
"library",
",",
"name",
"=",
"inspectorRegItem",
".",
"splitName",
"(",
")",
"label",
"=",
"\"{} ({})\"",
".",
"format",
"(",
"name",
",",
"library",
")",
"if",
"library",
"... | Updates the label from the full name of the InspectorRegItem | [
"Updates",
"the",
"label",
"from",
"the",
"full",
"name",
"of",
"the",
"InspectorRegItem"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/inspector/selectionpane.py#L74-L80 |
titusjan/argos | argos/config/stringcti.py | StringCti.createEditor | def createEditor(self, delegate, parent, option):
""" Creates a StringCtiEditor.
For the parameters see the AbstractCti constructor documentation.
"""
return StringCtiEditor(self, delegate, parent=parent) | python | def createEditor(self, delegate, parent, option):
""" Creates a StringCtiEditor.
For the parameters see the AbstractCti constructor documentation.
"""
return StringCtiEditor(self, delegate, parent=parent) | [
"def",
"createEditor",
"(",
"self",
",",
"delegate",
",",
"parent",
",",
"option",
")",
":",
"return",
"StringCtiEditor",
"(",
"self",
",",
"delegate",
",",
"parent",
"=",
"parent",
")"
] | Creates a StringCtiEditor.
For the parameters see the AbstractCti constructor documentation. | [
"Creates",
"a",
"StringCtiEditor",
".",
"For",
"the",
"parameters",
"see",
"the",
"AbstractCti",
"constructor",
"documentation",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/config/stringcti.py#L54-L58 |
titusjan/argos | argos/inspector/pgplugins/pghistlutitem.py | HistogramLUTItem.setHistogramRange | def setHistogramRange(self, mn, mx, padding=0.1):
"""Set the Y range on the histogram plot. This disables auto-scaling."""
self.vb.enableAutoRange(self.vb.YAxis, False)
self.vb.setYRange(mn, mx, padding) | python | def setHistogramRange(self, mn, mx, padding=0.1):
"""Set the Y range on the histogram plot. This disables auto-scaling."""
self.vb.enableAutoRange(self.vb.YAxis, False)
self.vb.setYRange(mn, mx, padding) | [
"def",
"setHistogramRange",
"(",
"self",
",",
"mn",
",",
"mx",
",",
"padding",
"=",
"0.1",
")",
":",
"self",
".",
"vb",
".",
"enableAutoRange",
"(",
"self",
".",
"vb",
".",
"YAxis",
",",
"False",
")",
"self",
".",
"vb",
".",
"setYRange",
"(",
"mn",... | Set the Y range on the histogram plot. This disables auto-scaling. | [
"Set",
"the",
"Y",
"range",
"on",
"the",
"histogram",
"plot",
".",
"This",
"disables",
"auto",
"-",
"scaling",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/inspector/pgplugins/pghistlutitem.py#L113-L116 |
titusjan/argos | argos/inspector/pgplugins/pghistlutitem.py | HistogramLUTItem.setImageItem | def setImageItem(self, img):
"""Set an ImageItem to have its levels and LUT automatically controlled
by this HistogramLUTItem.
"""
self.imageItem = weakref.ref(img)
img.sigImageChanged.connect(self.imageChanged)
img.setLookupTable(self.getLookupTable) ## send function po... | python | def setImageItem(self, img):
"""Set an ImageItem to have its levels and LUT automatically controlled
by this HistogramLUTItem.
"""
self.imageItem = weakref.ref(img)
img.sigImageChanged.connect(self.imageChanged)
img.setLookupTable(self.getLookupTable) ## send function po... | [
"def",
"setImageItem",
"(",
"self",
",",
"img",
")",
":",
"self",
".",
"imageItem",
"=",
"weakref",
".",
"ref",
"(",
"img",
")",
"img",
".",
"sigImageChanged",
".",
"connect",
"(",
"self",
".",
"imageChanged",
")",
"img",
".",
"setLookupTable",
"(",
"s... | Set an ImageItem to have its levels and LUT automatically controlled
by this HistogramLUTItem. | [
"Set",
"an",
"ImageItem",
"to",
"have",
"its",
"levels",
"and",
"LUT",
"automatically",
"controlled",
"by",
"this",
"HistogramLUTItem",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/inspector/pgplugins/pghistlutitem.py#L141-L150 |
titusjan/argos | argos/inspector/pgplugins/pghistlutitem.py | HistogramLUTItem.getLookupTable | def getLookupTable(self, img=None, n=None, alpha=None):
"""Return a lookup table from the color gradient defined by this
HistogramLUTItem.
"""
if n is None:
if img.dtype == np.uint8:
n = 256
else:
n = 512
if self.lut is None... | python | def getLookupTable(self, img=None, n=None, alpha=None):
"""Return a lookup table from the color gradient defined by this
HistogramLUTItem.
"""
if n is None:
if img.dtype == np.uint8:
n = 256
else:
n = 512
if self.lut is None... | [
"def",
"getLookupTable",
"(",
"self",
",",
"img",
"=",
"None",
",",
"n",
"=",
"None",
",",
"alpha",
"=",
"None",
")",
":",
"if",
"n",
"is",
"None",
":",
"if",
"img",
".",
"dtype",
"==",
"np",
".",
"uint8",
":",
"n",
"=",
"256",
"else",
":",
"... | Return a lookup table from the color gradient defined by this
HistogramLUTItem. | [
"Return",
"a",
"lookup",
"table",
"from",
"the",
"color",
"gradient",
"defined",
"by",
"this",
"HistogramLUTItem",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/inspector/pgplugins/pghistlutitem.py#L168-L179 |
titusjan/argos | argos/inspector/pgplugins/lineplot1d.py | PgLinePlot1dCti.setAutoRangeOn | def setAutoRangeOn(self, axisNumber):
""" Sets the auto-range of the axis on.
:param axisNumber: 0 (X-axis), 1 (Y-axis), 2, (Both X and Y axes).
"""
setXYAxesAutoRangeOn(self, self.xAxisRangeCti, self.yAxisRangeCti, axisNumber) | python | def setAutoRangeOn(self, axisNumber):
""" Sets the auto-range of the axis on.
:param axisNumber: 0 (X-axis), 1 (Y-axis), 2, (Both X and Y axes).
"""
setXYAxesAutoRangeOn(self, self.xAxisRangeCti, self.yAxisRangeCti, axisNumber) | [
"def",
"setAutoRangeOn",
"(",
"self",
",",
"axisNumber",
")",
":",
"setXYAxesAutoRangeOn",
"(",
"self",
",",
"self",
".",
"xAxisRangeCti",
",",
"self",
".",
"yAxisRangeCti",
",",
"axisNumber",
")"
] | Sets the auto-range of the axis on.
:param axisNumber: 0 (X-axis), 1 (Y-axis), 2, (Both X and Y axes). | [
"Sets",
"the",
"auto",
"-",
"range",
"of",
"the",
"axis",
"on",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/inspector/pgplugins/lineplot1d.py#L106-L111 |
titusjan/argos | argos/inspector/pgplugins/lineplot1d.py | PgLinePlot1d.finalize | def finalize(self):
""" Is called before destruction. Can be used to clean-up resources
"""
logger.debug("Finalizing: {}".format(self))
self.plotItem.scene().sigMouseMoved.disconnect(self.mouseMoved)
self.plotItem.close()
self.graphicsLayoutWidget.close() | python | def finalize(self):
""" Is called before destruction. Can be used to clean-up resources
"""
logger.debug("Finalizing: {}".format(self))
self.plotItem.scene().sigMouseMoved.disconnect(self.mouseMoved)
self.plotItem.close()
self.graphicsLayoutWidget.close() | [
"def",
"finalize",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Finalizing: {}\"",
".",
"format",
"(",
"self",
")",
")",
"self",
".",
"plotItem",
".",
"scene",
"(",
")",
".",
"sigMouseMoved",
".",
"disconnect",
"(",
"self",
".",
"mouseMoved",
... | Is called before destruction. Can be used to clean-up resources | [
"Is",
"called",
"before",
"destruction",
".",
"Can",
"be",
"used",
"to",
"clean",
"-",
"up",
"resources"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/inspector/pgplugins/lineplot1d.py#L153-L159 |
titusjan/argos | argos/inspector/pgplugins/lineplot1d.py | PgLinePlot1d._clearContents | def _clearContents(self):
""" Clears the the inspector widget when no valid input is available.
"""
self.titleLabel.setText('')
self.plotItem.clear()
self.plotItem.setLabel('left', '')
self.plotItem.setLabel('bottom', '') | python | def _clearContents(self):
""" Clears the the inspector widget when no valid input is available.
"""
self.titleLabel.setText('')
self.plotItem.clear()
self.plotItem.setLabel('left', '')
self.plotItem.setLabel('bottom', '') | [
"def",
"_clearContents",
"(",
"self",
")",
":",
"self",
".",
"titleLabel",
".",
"setText",
"(",
"''",
")",
"self",
".",
"plotItem",
".",
"clear",
"(",
")",
"self",
".",
"plotItem",
".",
"setLabel",
"(",
"'left'",
",",
"''",
")",
"self",
".",
"plotIte... | Clears the the inspector widget when no valid input is available. | [
"Clears",
"the",
"the",
"inspector",
"widget",
"when",
"no",
"valid",
"input",
"is",
"available",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/inspector/pgplugins/lineplot1d.py#L176-L182 |
titusjan/argos | argos/inspector/pgplugins/lineplot1d.py | PgLinePlot1d._drawContents | def _drawContents(self, reason=None, initiator=None):
""" Draws the plot contents from the sliced array of the collected repo tree item.
The reason parameter is used to determine if the axes will be reset (the initiator
parameter is ignored). See AbstractInspector.updateContents for the... | python | def _drawContents(self, reason=None, initiator=None):
""" Draws the plot contents from the sliced array of the collected repo tree item.
The reason parameter is used to determine if the axes will be reset (the initiator
parameter is ignored). See AbstractInspector.updateContents for the... | [
"def",
"_drawContents",
"(",
"self",
",",
"reason",
"=",
"None",
",",
"initiator",
"=",
"None",
")",
":",
"self",
".",
"slicedArray",
"=",
"self",
".",
"collector",
".",
"getSlicedArray",
"(",
")",
"if",
"not",
"self",
".",
"_hasValidData",
"(",
")",
"... | Draws the plot contents from the sliced array of the collected repo tree item.
The reason parameter is used to determine if the axes will be reset (the initiator
parameter is ignored). See AbstractInspector.updateContents for their description. | [
"Draws",
"the",
"plot",
"contents",
"from",
"the",
"sliced",
"array",
"of",
"the",
"collected",
"repo",
"tree",
"item",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/inspector/pgplugins/lineplot1d.py#L185-L239 |
titusjan/argos | argos/inspector/pgplugins/lineplot1d.py | PgLinePlot1d.mouseMoved | def mouseMoved(self, viewPos):
""" Updates the probe text with the values under the cursor.
Draws a vertical line and a symbol at the position of the probe.
"""
try:
check_class(viewPos, QtCore.QPointF)
self.crossLineVerShadow.setVisible(False)
sel... | python | def mouseMoved(self, viewPos):
""" Updates the probe text with the values under the cursor.
Draws a vertical line and a symbol at the position of the probe.
"""
try:
check_class(viewPos, QtCore.QPointF)
self.crossLineVerShadow.setVisible(False)
sel... | [
"def",
"mouseMoved",
"(",
"self",
",",
"viewPos",
")",
":",
"try",
":",
"check_class",
"(",
"viewPos",
",",
"QtCore",
".",
"QPointF",
")",
"self",
".",
"crossLineVerShadow",
".",
"setVisible",
"(",
"False",
")",
"self",
".",
"crossLineVertical",
".",
"setV... | Updates the probe text with the values under the cursor.
Draws a vertical line and a symbol at the position of the probe. | [
"Updates",
"the",
"probe",
"text",
"with",
"the",
"values",
"under",
"the",
"cursor",
".",
"Draws",
"a",
"vertical",
"line",
"and",
"a",
"symbol",
"at",
"the",
"position",
"of",
"the",
"probe",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/inspector/pgplugins/lineplot1d.py#L243-L283 |
titusjan/argos | argos/utils/cls.py | environment_var_to_bool | def environment_var_to_bool(env_var):
""" Converts an environment variable to a boolean
Returns False if the environment variable is False, 0 or a case-insenstive string "false"
or "0".
"""
# Try to see if env_var can be converted to an int
try:
env_var = int(env_var)
excep... | python | def environment_var_to_bool(env_var):
""" Converts an environment variable to a boolean
Returns False if the environment variable is False, 0 or a case-insenstive string "false"
or "0".
"""
# Try to see if env_var can be converted to an int
try:
env_var = int(env_var)
excep... | [
"def",
"environment_var_to_bool",
"(",
"env_var",
")",
":",
"# Try to see if env_var can be converted to an int",
"try",
":",
"env_var",
"=",
"int",
"(",
"env_var",
")",
"except",
"ValueError",
":",
"pass",
"if",
"isinstance",
"(",
"env_var",
",",
"numbers",
".",
... | Converts an environment variable to a boolean
Returns False if the environment variable is False, 0 or a case-insenstive string "false"
or "0". | [
"Converts",
"an",
"environment",
"variable",
"to",
"a",
"boolean"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/utils/cls.py#L84-L106 |
titusjan/argos | argos/utils/cls.py | fill_values_to_nan | def fill_values_to_nan(masked_array):
""" Replaces the fill_values of the masked array by NaNs
If the array is None or it does not contain floating point values, it cannot contain NaNs.
In that case the original array is returned.
"""
if masked_array is not None and masked_array.dtype.kind ... | python | def fill_values_to_nan(masked_array):
""" Replaces the fill_values of the masked array by NaNs
If the array is None or it does not contain floating point values, it cannot contain NaNs.
In that case the original array is returned.
"""
if masked_array is not None and masked_array.dtype.kind ... | [
"def",
"fill_values_to_nan",
"(",
"masked_array",
")",
":",
"if",
"masked_array",
"is",
"not",
"None",
"and",
"masked_array",
".",
"dtype",
".",
"kind",
"==",
"'f'",
":",
"check_class",
"(",
"masked_array",
",",
"ma",
".",
"masked_array",
")",
"logger",
".",... | Replaces the fill_values of the masked array by NaNs
If the array is None or it does not contain floating point values, it cannot contain NaNs.
In that case the original array is returned. | [
"Replaces",
"the",
"fill_values",
"of",
"the",
"masked",
"array",
"by",
"NaNs"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/utils/cls.py#L109-L121 |
titusjan/argos | argos/utils/cls.py | setting_str_to_bool | def setting_str_to_bool(s):
""" Converts 'true' to True and 'false' to False if s is a string
"""
if isinstance(s, six.string_types):
s = s.lower()
if s == 'true':
return True
elif s == 'false':
return False
else:
return ValueError('Invalid... | python | def setting_str_to_bool(s):
""" Converts 'true' to True and 'false' to False if s is a string
"""
if isinstance(s, six.string_types):
s = s.lower()
if s == 'true':
return True
elif s == 'false':
return False
else:
return ValueError('Invalid... | [
"def",
"setting_str_to_bool",
"(",
"s",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"six",
".",
"string_types",
")",
":",
"s",
"=",
"s",
".",
"lower",
"(",
")",
"if",
"s",
"==",
"'true'",
":",
"return",
"True",
"elif",
"s",
"==",
"'false'",
":",
... | Converts 'true' to True and 'false' to False if s is a string | [
"Converts",
"true",
"to",
"True",
"and",
"false",
"to",
"False",
"if",
"s",
"is",
"a",
"string"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/utils/cls.py#L127-L139 |
titusjan/argos | argos/utils/cls.py | to_string | def to_string(var, masked=None, decode_bytes='utf-8', maskFormat='', strFormat='{}',
intFormat='{}', numFormat=DEFAULT_NUM_FORMAT, noneFormat='{!r}', otherFormat='{}'):
""" Converts var to a python string or unicode string so Qt widgets can display them.
If var consists of bytes, the decode_b... | python | def to_string(var, masked=None, decode_bytes='utf-8', maskFormat='', strFormat='{}',
intFormat='{}', numFormat=DEFAULT_NUM_FORMAT, noneFormat='{!r}', otherFormat='{}'):
""" Converts var to a python string or unicode string so Qt widgets can display them.
If var consists of bytes, the decode_b... | [
"def",
"to_string",
"(",
"var",
",",
"masked",
"=",
"None",
",",
"decode_bytes",
"=",
"'utf-8'",
",",
"maskFormat",
"=",
"''",
",",
"strFormat",
"=",
"'{}'",
",",
"intFormat",
"=",
"'{}'",
",",
"numFormat",
"=",
"DEFAULT_NUM_FORMAT",
",",
"noneFormat",
"="... | Converts var to a python string or unicode string so Qt widgets can display them.
If var consists of bytes, the decode_bytes is used to decode the bytes.
If var consists of a numpy.str_, the result will be converted to a regular Python string.
This is necessary to display the string in Qt widg... | [
"Converts",
"var",
"to",
"a",
"python",
"string",
"or",
"unicode",
"string",
"so",
"Qt",
"widgets",
"can",
"display",
"them",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/utils/cls.py#L151-L220 |
titusjan/argos | argos/utils/cls.py | is_a_string | def is_a_string(var, allow_none=False):
""" Returns True if var is a string (ascii or unicode)
Result py-2 py-3
----------------- ----- -----
b'bytes literal' True False
'string literal' True True
u'unicode literal' True True
Also returns True i... | python | def is_a_string(var, allow_none=False):
""" Returns True if var is a string (ascii or unicode)
Result py-2 py-3
----------------- ----- -----
b'bytes literal' True False
'string literal' True True
u'unicode literal' True True
Also returns True i... | [
"def",
"is_a_string",
"(",
"var",
",",
"allow_none",
"=",
"False",
")",
":",
"return",
"isinstance",
"(",
"var",
",",
"six",
".",
"string_types",
")",
"or",
"(",
"var",
"is",
"None",
"and",
"allow_none",
")"
] | Returns True if var is a string (ascii or unicode)
Result py-2 py-3
----------------- ----- -----
b'bytes literal' True False
'string literal' True True
u'unicode literal' True True
Also returns True if the var is a numpy string (numpy.string_, nump... | [
"Returns",
"True",
"if",
"var",
"is",
"a",
"string",
"(",
"ascii",
"or",
"unicode",
")"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/utils/cls.py#L223-L234 |
titusjan/argos | argos/utils/cls.py | check_is_a_string | def check_is_a_string(var, allow_none=False):
""" Calls is_a_string and raises a type error if the check fails.
"""
if not is_a_string(var, allow_none=allow_none):
raise TypeError("var must be a string, however type(var) is {}"
.format(type(var))) | python | def check_is_a_string(var, allow_none=False):
""" Calls is_a_string and raises a type error if the check fails.
"""
if not is_a_string(var, allow_none=allow_none):
raise TypeError("var must be a string, however type(var) is {}"
.format(type(var))) | [
"def",
"check_is_a_string",
"(",
"var",
",",
"allow_none",
"=",
"False",
")",
":",
"if",
"not",
"is_a_string",
"(",
"var",
",",
"allow_none",
"=",
"allow_none",
")",
":",
"raise",
"TypeError",
"(",
"\"var must be a string, however type(var) is {}\"",
".",
"format"... | Calls is_a_string and raises a type error if the check fails. | [
"Calls",
"is_a_string",
"and",
"raises",
"a",
"type",
"error",
"if",
"the",
"check",
"fails",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/utils/cls.py#L237-L242 |
titusjan/argos | argos/utils/cls.py | is_text | def is_text(var, allow_none=False):
""" Returns True if var is a unicode text
Result py-2 py-3
----------------- ----- -----
b'bytes literal' False False
'string literal' False True
u'unicode literal' True True
Also works with the corresponding nu... | python | def is_text(var, allow_none=False):
""" Returns True if var is a unicode text
Result py-2 py-3
----------------- ----- -----
b'bytes literal' False False
'string literal' False True
u'unicode literal' True True
Also works with the corresponding nu... | [
"def",
"is_text",
"(",
"var",
",",
"allow_none",
"=",
"False",
")",
":",
"return",
"isinstance",
"(",
"var",
",",
"six",
".",
"text_type",
")",
"or",
"(",
"var",
"is",
"None",
"and",
"allow_none",
")"
] | Returns True if var is a unicode text
Result py-2 py-3
----------------- ----- -----
b'bytes literal' False False
'string literal' False True
u'unicode literal' True True
Also works with the corresponding numpy types. | [
"Returns",
"True",
"if",
"var",
"is",
"a",
"unicode",
"text"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/utils/cls.py#L245-L256 |
titusjan/argos | argos/utils/cls.py | is_binary | def is_binary(var, allow_none=False):
""" Returns True if var is a binary (bytes) objects
Result py-2 py-3
----------------- ----- -----
b'bytes literal' True True
'string literal' True False
u'unicode literal' False False
Also works with the cor... | python | def is_binary(var, allow_none=False):
""" Returns True if var is a binary (bytes) objects
Result py-2 py-3
----------------- ----- -----
b'bytes literal' True True
'string literal' True False
u'unicode literal' False False
Also works with the cor... | [
"def",
"is_binary",
"(",
"var",
",",
"allow_none",
"=",
"False",
")",
":",
"return",
"isinstance",
"(",
"var",
",",
"six",
".",
"binary_type",
")",
"or",
"(",
"var",
"is",
"None",
"and",
"allow_none",
")"
] | Returns True if var is a binary (bytes) objects
Result py-2 py-3
----------------- ----- -----
b'bytes literal' True True
'string literal' True False
u'unicode literal' False False
Also works with the corresponding numpy types. | [
"Returns",
"True",
"if",
"var",
"is",
"a",
"binary",
"(",
"bytes",
")",
"objects"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/utils/cls.py#L267-L278 |
titusjan/argos | argos/utils/cls.py | is_a_sequence | def is_a_sequence(var, allow_none=False):
""" Returns True if var is a list or a tuple (but not a string!)
"""
return isinstance(var, (list, tuple)) or (var is None and allow_none) | python | def is_a_sequence(var, allow_none=False):
""" Returns True if var is a list or a tuple (but not a string!)
"""
return isinstance(var, (list, tuple)) or (var is None and allow_none) | [
"def",
"is_a_sequence",
"(",
"var",
",",
"allow_none",
"=",
"False",
")",
":",
"return",
"isinstance",
"(",
"var",
",",
"(",
"list",
",",
"tuple",
")",
")",
"or",
"(",
"var",
"is",
"None",
"and",
"allow_none",
")"
] | Returns True if var is a list or a tuple (but not a string!) | [
"Returns",
"True",
"if",
"var",
"is",
"a",
"list",
"or",
"a",
"tuple",
"(",
"but",
"not",
"a",
"string!",
")"
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/utils/cls.py#L302-L305 |
titusjan/argos | argos/utils/cls.py | check_is_a_sequence | def check_is_a_sequence(var, allow_none=False):
""" Calls is_a_sequence and raises a type error if the check fails.
"""
if not is_a_sequence(var, allow_none=allow_none):
raise TypeError("var must be a list or tuple, however type(var) is {}"
.format(type(var))) | python | def check_is_a_sequence(var, allow_none=False):
""" Calls is_a_sequence and raises a type error if the check fails.
"""
if not is_a_sequence(var, allow_none=allow_none):
raise TypeError("var must be a list or tuple, however type(var) is {}"
.format(type(var))) | [
"def",
"check_is_a_sequence",
"(",
"var",
",",
"allow_none",
"=",
"False",
")",
":",
"if",
"not",
"is_a_sequence",
"(",
"var",
",",
"allow_none",
"=",
"allow_none",
")",
":",
"raise",
"TypeError",
"(",
"\"var must be a list or tuple, however type(var) is {}\"",
".",... | Calls is_a_sequence and raises a type error if the check fails. | [
"Calls",
"is_a_sequence",
"and",
"raises",
"a",
"type",
"error",
"if",
"the",
"check",
"fails",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/utils/cls.py#L308-L313 |
titusjan/argos | argos/utils/cls.py | check_is_a_mapping | def check_is_a_mapping(var, allow_none=False):
""" Calls is_a_mapping and raises a type error if the check fails.
"""
if not is_a_mapping(var, allow_none=allow_none):
raise TypeError("var must be a dict, however type(var) is {}"
.format(type(var))) | python | def check_is_a_mapping(var, allow_none=False):
""" Calls is_a_mapping and raises a type error if the check fails.
"""
if not is_a_mapping(var, allow_none=allow_none):
raise TypeError("var must be a dict, however type(var) is {}"
.format(type(var))) | [
"def",
"check_is_a_mapping",
"(",
"var",
",",
"allow_none",
"=",
"False",
")",
":",
"if",
"not",
"is_a_mapping",
"(",
"var",
",",
"allow_none",
"=",
"allow_none",
")",
":",
"raise",
"TypeError",
"(",
"\"var must be a dict, however type(var) is {}\"",
".",
"format"... | Calls is_a_mapping and raises a type error if the check fails. | [
"Calls",
"is_a_mapping",
"and",
"raises",
"a",
"type",
"error",
"if",
"the",
"check",
"fails",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/utils/cls.py#L322-L327 |
titusjan/argos | argos/utils/cls.py | is_an_array | def is_an_array(var, allow_none=False):
""" Returns True if var is a numpy array.
"""
return isinstance(var, np.ndarray) or (var is None and allow_none) | python | def is_an_array(var, allow_none=False):
""" Returns True if var is a numpy array.
"""
return isinstance(var, np.ndarray) or (var is None and allow_none) | [
"def",
"is_an_array",
"(",
"var",
",",
"allow_none",
"=",
"False",
")",
":",
"return",
"isinstance",
"(",
"var",
",",
"np",
".",
"ndarray",
")",
"or",
"(",
"var",
"is",
"None",
"and",
"allow_none",
")"
] | Returns True if var is a numpy array. | [
"Returns",
"True",
"if",
"var",
"is",
"a",
"numpy",
"array",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/utils/cls.py#L330-L333 |
titusjan/argos | argos/utils/cls.py | check_is_an_array | def check_is_an_array(var, allow_none=False):
""" Calls is_an_array and raises a type error if the check fails.
"""
if not is_an_array(var, allow_none=allow_none):
raise TypeError("var must be a NumPy array, however type(var) is {}"
.format(type(var))) | python | def check_is_an_array(var, allow_none=False):
""" Calls is_an_array and raises a type error if the check fails.
"""
if not is_an_array(var, allow_none=allow_none):
raise TypeError("var must be a NumPy array, however type(var) is {}"
.format(type(var))) | [
"def",
"check_is_an_array",
"(",
"var",
",",
"allow_none",
"=",
"False",
")",
":",
"if",
"not",
"is_an_array",
"(",
"var",
",",
"allow_none",
"=",
"allow_none",
")",
":",
"raise",
"TypeError",
"(",
"\"var must be a NumPy array, however type(var) is {}\"",
".",
"fo... | Calls is_an_array and raises a type error if the check fails. | [
"Calls",
"is_an_array",
"and",
"raises",
"a",
"type",
"error",
"if",
"the",
"check",
"fails",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/utils/cls.py#L336-L341 |
titusjan/argos | argos/utils/cls.py | array_has_real_numbers | def array_has_real_numbers(array):
""" Uses the dtype kind of the numpy array to determine if it represents real numbers.
That is, the array kind should be one of: i u f
Possible dtype.kind values.
b boolean
i signed integer
u unsigned integer
f ... | python | def array_has_real_numbers(array):
""" Uses the dtype kind of the numpy array to determine if it represents real numbers.
That is, the array kind should be one of: i u f
Possible dtype.kind values.
b boolean
i signed integer
u unsigned integer
f ... | [
"def",
"array_has_real_numbers",
"(",
"array",
")",
":",
"kind",
"=",
"array",
".",
"dtype",
".",
"kind",
"assert",
"kind",
"in",
"'biufcmMOSUV'",
",",
"\"Unexpected array kind: {}\"",
".",
"format",
"(",
"kind",
")",
"return",
"kind",
"in",
"'iuf'"
] | Uses the dtype kind of the numpy array to determine if it represents real numbers.
That is, the array kind should be one of: i u f
Possible dtype.kind values.
b boolean
i signed integer
u unsigned integer
f floating-point
c complex float... | [
"Uses",
"the",
"dtype",
"kind",
"of",
"the",
"numpy",
"array",
"to",
"determine",
"if",
"it",
"represents",
"real",
"numbers",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/utils/cls.py#L350-L370 |
titusjan/argos | argos/utils/cls.py | check_class | def check_class(obj, target_class, allow_none = False):
""" Checks that the obj is a (sub)type of target_class.
Raises a TypeError if this is not the case.
:param obj: object whos type is to be checked
:type obj: any type
:param target_class: target type/class
:type target_... | python | def check_class(obj, target_class, allow_none = False):
""" Checks that the obj is a (sub)type of target_class.
Raises a TypeError if this is not the case.
:param obj: object whos type is to be checked
:type obj: any type
:param target_class: target type/class
:type target_... | [
"def",
"check_class",
"(",
"obj",
",",
"target_class",
",",
"allow_none",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"obj",
",",
"target_class",
")",
":",
"if",
"not",
"(",
"allow_none",
"and",
"obj",
"is",
"None",
")",
":",
"raise",
"Type... | Checks that the obj is a (sub)type of target_class.
Raises a TypeError if this is not the case.
:param obj: object whos type is to be checked
:type obj: any type
:param target_class: target type/class
:type target_class: any class or type
:param allow_none: if true obj ... | [
"Checks",
"that",
"the",
"obj",
"is",
"a",
"(",
"sub",
")",
"type",
"of",
"target_class",
".",
"Raises",
"a",
"TypeError",
"if",
"this",
"is",
"not",
"the",
"case",
"."
] | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/utils/cls.py#L373-L387 |
titusjan/argos | argos/utils/cls.py | import_symbol | def import_symbol(full_symbol_name):
""" Imports a symbol (e.g. class, variable, etc) from a dot separated name.
Can be used to create a class whose type is only known at run-time.
The full_symbol_name must contain packages and module,
e.g.: 'argos.plugins.rti.ncdf.NcdfFileRti'
If ... | python | def import_symbol(full_symbol_name):
""" Imports a symbol (e.g. class, variable, etc) from a dot separated name.
Can be used to create a class whose type is only known at run-time.
The full_symbol_name must contain packages and module,
e.g.: 'argos.plugins.rti.ncdf.NcdfFileRti'
If ... | [
"def",
"import_symbol",
"(",
"full_symbol_name",
")",
":",
"parts",
"=",
"full_symbol_name",
".",
"rsplit",
"(",
"'.'",
",",
"1",
")",
"if",
"len",
"(",
"parts",
")",
"==",
"2",
":",
"module_name",
",",
"symbol_name",
"=",
"parts",
"module_name",
"=",
"s... | Imports a symbol (e.g. class, variable, etc) from a dot separated name.
Can be used to create a class whose type is only known at run-time.
The full_symbol_name must contain packages and module,
e.g.: 'argos.plugins.rti.ncdf.NcdfFileRti'
If the module doesn't exist an ImportError is ra... | [
"Imports",
"a",
"symbol",
"(",
"e",
".",
"g",
".",
"class",
"variable",
"etc",
")",
"from",
"a",
"dot",
"separated",
"name",
".",
"Can",
"be",
"used",
"to",
"create",
"a",
"class",
"whose",
"type",
"is",
"only",
"known",
"at",
"run",
"-",
"time",
"... | train | https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/utils/cls.py#L419-L445 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.