repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 3
values | summary stringlengths 4 350 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
bitesofcode/projexui | projexui/widgets/xratingslider.py | XRatingSlider.setPixmapSize | def setPixmapSize( self, size ):
"""
Sets the pixmap size to the inputed value.
:param size | <QSize>
"""
self._pixmapSize = size
self.setMinimumHeight(size.height())
self.adjustMinimumWidth() | python | def setPixmapSize( self, size ):
"""
Sets the pixmap size to the inputed value.
:param size | <QSize>
"""
self._pixmapSize = size
self.setMinimumHeight(size.height())
self.adjustMinimumWidth() | [
"def",
"setPixmapSize",
"(",
"self",
",",
"size",
")",
":",
"self",
".",
"_pixmapSize",
"=",
"size",
"self",
".",
"setMinimumHeight",
"(",
"size",
".",
"height",
"(",
")",
")",
"self",
".",
"adjustMinimumWidth",
"(",
")"
] | Sets the pixmap size to the inputed value.
:param size | <QSize> | [
"Sets",
"the",
"pixmap",
"size",
"to",
"the",
"inputed",
"value",
".",
":",
"param",
"size",
"|",
"<QSize",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xratingslider.py#L141-L149 | train | Sets the pixmap size. |
bitesofcode/projexui | projexui/widgets/xratingslider.py | XRatingSlider.valueAt | def valueAt( self, pos ):
"""
Returns the value for the slider at the inputed position.
:param pos | <int>
:return <int>
"""
if ( self.orientation() == Qt.Horizontal ):
perc = (self.width() - 4 - pos) / float(self.width())
... | python | def valueAt( self, pos ):
"""
Returns the value for the slider at the inputed position.
:param pos | <int>
:return <int>
"""
if ( self.orientation() == Qt.Horizontal ):
perc = (self.width() - 4 - pos) / float(self.width())
... | [
"def",
"valueAt",
"(",
"self",
",",
"pos",
")",
":",
"if",
"(",
"self",
".",
"orientation",
"(",
")",
"==",
"Qt",
".",
"Horizontal",
")",
":",
"perc",
"=",
"(",
"self",
".",
"width",
"(",
")",
"-",
"4",
"-",
"pos",
")",
"/",
"float",
"(",
"se... | Returns the value for the slider at the inputed position.
:param pos | <int>
:return <int> | [
"Returns",
"the",
"value",
"for",
"the",
"slider",
"at",
"the",
"inputed",
"position",
".",
":",
"param",
"pos",
"|",
"<int",
">",
":",
"return",
"<int",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xratingslider.py#L151-L167 | train | Returns the value of the slider at the inputed position. |
talkincode/txradius | txradius/openvpn/client_disconnect.py | cli | def cli(conf):
""" OpenVPN client_disconnect method
"""
config = init_config(conf)
nas_id = config.get('DEFAULT', 'nas_id')
secret = config.get('DEFAULT', 'radius_secret')
nas_addr = config.get('DEFAULT', 'nas_addr')
radius_addr = config.get('DEFAULT', 'radius_addr')
radius_acct_port = c... | python | def cli(conf):
""" OpenVPN client_disconnect method
"""
config = init_config(conf)
nas_id = config.get('DEFAULT', 'nas_id')
secret = config.get('DEFAULT', 'radius_secret')
nas_addr = config.get('DEFAULT', 'nas_addr')
radius_addr = config.get('DEFAULT', 'radius_addr')
radius_acct_port = c... | [
"def",
"cli",
"(",
"conf",
")",
":",
"config",
"=",
"init_config",
"(",
"conf",
")",
"nas_id",
"=",
"config",
".",
"get",
"(",
"'DEFAULT'",
",",
"'nas_id'",
")",
"secret",
"=",
"config",
".",
"get",
"(",
"'DEFAULT'",
",",
"'radius_secret'",
")",
"nas_a... | OpenVPN client_disconnect method | [
"OpenVPN",
"client_disconnect",
"method"
] | b86fdbc9be41183680b82b07d3a8e8ea10926e01 | https://github.com/talkincode/txradius/blob/b86fdbc9be41183680b82b07d3a8e8ea10926e01/txradius/openvpn/client_disconnect.py#L19-L73 | train | OpenVPN client_disconnect method |
bitesofcode/projexui | projexui/widgets/xviewwidget/xviewwidget.py | XViewWidget.canClose | def canClose(self):
"""
Checks to see if the view widget can close by checking all of its \
sub-views to make sure they're ok to close.
:return <bool>
"""
for view in self.findChildren(XView):
if not view.canClose():
return False
... | python | def canClose(self):
"""
Checks to see if the view widget can close by checking all of its \
sub-views to make sure they're ok to close.
:return <bool>
"""
for view in self.findChildren(XView):
if not view.canClose():
return False
... | [
"def",
"canClose",
"(",
"self",
")",
":",
"for",
"view",
"in",
"self",
".",
"findChildren",
"(",
"XView",
")",
":",
"if",
"not",
"view",
".",
"canClose",
"(",
")",
":",
"return",
"False",
"return",
"True"
] | Checks to see if the view widget can close by checking all of its \
sub-views to make sure they're ok to close.
:return <bool> | [
"Checks",
"to",
"see",
"if",
"the",
"view",
"widget",
"can",
"close",
"by",
"checking",
"all",
"of",
"its",
"\\",
"sub",
"-",
"views",
"to",
"make",
"sure",
"they",
"re",
"ok",
"to",
"close",
".",
":",
"return",
"<bool",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L65-L75 | train | Checks to see if the view widget can be closed by checking all of its sub - views to make sure they are ok to close. |
bitesofcode/projexui | projexui/widgets/xviewwidget/xviewwidget.py | XViewWidget.createMenu | def createMenu(self, parent):
"""
Creates a new menu for the inputed parent item.
:param parent | <QMenu>
"""
menu = QtGui.QMenu(parent)
menu.setTitle('&View')
act = menu.addAction('&Lock/Unlock Layout')
act.setIcon(QtGui.QIcon(projexui.reso... | python | def createMenu(self, parent):
"""
Creates a new menu for the inputed parent item.
:param parent | <QMenu>
"""
menu = QtGui.QMenu(parent)
menu.setTitle('&View')
act = menu.addAction('&Lock/Unlock Layout')
act.setIcon(QtGui.QIcon(projexui.reso... | [
"def",
"createMenu",
"(",
"self",
",",
"parent",
")",
":",
"menu",
"=",
"QtGui",
".",
"QMenu",
"(",
"parent",
")",
"menu",
".",
"setTitle",
"(",
"'&View'",
")",
"act",
"=",
"menu",
".",
"addAction",
"(",
"'&Lock/Unlock Layout'",
")",
"act",
".",
"setIc... | Creates a new menu for the inputed parent item.
:param parent | <QMenu> | [
"Creates",
"a",
"new",
"menu",
"for",
"the",
"inputed",
"parent",
"item",
".",
":",
"param",
"parent",
"|",
"<QMenu",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L101-L129 | train | Creates a new menu for the inputed parent item. |
bitesofcode/projexui | projexui/widgets/xviewwidget/xviewwidget.py | XViewWidget.currentPanel | def currentPanel(self):
"""
Returns the currently active panel based on whether or not it has \
focus.
:return <XViewPanel> || None
"""
focus_widget = QtGui.QApplication.instance().focusWidget()
focus_panel = projexui.ancestor(focus_widget, XViewPane... | python | def currentPanel(self):
"""
Returns the currently active panel based on whether or not it has \
focus.
:return <XViewPanel> || None
"""
focus_widget = QtGui.QApplication.instance().focusWidget()
focus_panel = projexui.ancestor(focus_widget, XViewPane... | [
"def",
"currentPanel",
"(",
"self",
")",
":",
"focus_widget",
"=",
"QtGui",
".",
"QApplication",
".",
"instance",
"(",
")",
".",
"focusWidget",
"(",
")",
"focus_panel",
"=",
"projexui",
".",
"ancestor",
"(",
"focus_widget",
",",
"XViewPanel",
")",
"panels",
... | Returns the currently active panel based on whether or not it has \
focus.
:return <XViewPanel> || None | [
"Returns",
"the",
"currently",
"active",
"panel",
"based",
"on",
"whether",
"or",
"not",
"it",
"has",
"\\",
"focus",
".",
":",
"return",
"<XViewPanel",
">",
"||",
"None"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L131-L147 | train | Returns the currently active panel based on whether or not the current panel is the focus. |
bitesofcode/projexui | projexui/widgets/xviewwidget/xviewwidget.py | XViewWidget.exportProfile | def exportProfile(self, filename=''):
"""
Exports the current profile to a file.
:param filename | <str>
"""
if not (filename and isinstance(filename, basestring)):
filename = QtGui.QFileDialog.getSaveFileName(self,
... | python | def exportProfile(self, filename=''):
"""
Exports the current profile to a file.
:param filename | <str>
"""
if not (filename and isinstance(filename, basestring)):
filename = QtGui.QFileDialog.getSaveFileName(self,
... | [
"def",
"exportProfile",
"(",
"self",
",",
"filename",
"=",
"''",
")",
":",
"if",
"not",
"(",
"filename",
"and",
"isinstance",
"(",
"filename",
",",
"basestring",
")",
")",
":",
"filename",
"=",
"QtGui",
".",
"QFileDialog",
".",
"getSaveFileName",
"(",
"s... | Exports the current profile to a file.
:param filename | <str> | [
"Exports",
"the",
"current",
"profile",
"to",
"a",
"file",
".",
":",
"param",
"filename",
"|",
"<str",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L179-L202 | train | Exports the current profile to a file. |
bitesofcode/projexui | projexui/widgets/xviewwidget/xviewwidget.py | XViewWidget.findViewType | def findViewType(self, viewTypeName):
"""
Looks up the view type based on the inputed view type name.
:param viewTypeName | <str>
"""
for viewType in self._viewTypes:
if ( viewType.viewTypeName() == viewTypeName ):
return viewType
... | python | def findViewType(self, viewTypeName):
"""
Looks up the view type based on the inputed view type name.
:param viewTypeName | <str>
"""
for viewType in self._viewTypes:
if ( viewType.viewTypeName() == viewTypeName ):
return viewType
... | [
"def",
"findViewType",
"(",
"self",
",",
"viewTypeName",
")",
":",
"for",
"viewType",
"in",
"self",
".",
"_viewTypes",
":",
"if",
"(",
"viewType",
".",
"viewTypeName",
"(",
")",
"==",
"viewTypeName",
")",
":",
"return",
"viewType",
"return",
"None"
] | Looks up the view type based on the inputed view type name.
:param viewTypeName | <str> | [
"Looks",
"up",
"the",
"view",
"type",
"based",
"on",
"the",
"inputed",
"view",
"type",
"name",
".",
":",
"param",
"viewTypeName",
"|",
"<str",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L204-L213 | train | Returns the view type object for the given view type name. |
bitesofcode/projexui | projexui/widgets/xviewwidget/xviewwidget.py | XViewWidget.importProfile | def importProfile(self, filename=''):
"""
Exports the current profile to a file.
:param filename | <str>
"""
if not (filename and isinstance(filename, basestring)):
filename = QtGui.QFileDialog.getOpenFileName(self,
... | python | def importProfile(self, filename=''):
"""
Exports the current profile to a file.
:param filename | <str>
"""
if not (filename and isinstance(filename, basestring)):
filename = QtGui.QFileDialog.getOpenFileName(self,
... | [
"def",
"importProfile",
"(",
"self",
",",
"filename",
"=",
"''",
")",
":",
"if",
"not",
"(",
"filename",
"and",
"isinstance",
"(",
"filename",
",",
"basestring",
")",
")",
":",
"filename",
"=",
"QtGui",
".",
"QFileDialog",
".",
"getOpenFileName",
"(",
"s... | Exports the current profile to a file.
:param filename | <str> | [
"Exports",
"the",
"current",
"profile",
"to",
"a",
"file",
".",
":",
"param",
"filename",
"|",
"<str",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L215-L241 | train | Imports the current profile to a file. |
bitesofcode/projexui | projexui/widgets/xviewwidget/xviewwidget.py | XViewWidget.panels | def panels(self):
"""
Returns a lis of the panels that are assigned to this view widget.
:return [<XViewPanel>, ..]
"""
return [panel for panel in self.findChildren(XViewPanel) if panel.viewWidget() == self] | python | def panels(self):
"""
Returns a lis of the panels that are assigned to this view widget.
:return [<XViewPanel>, ..]
"""
return [panel for panel in self.findChildren(XViewPanel) if panel.viewWidget() == self] | [
"def",
"panels",
"(",
"self",
")",
":",
"return",
"[",
"panel",
"for",
"panel",
"in",
"self",
".",
"findChildren",
"(",
"XViewPanel",
")",
"if",
"panel",
".",
"viewWidget",
"(",
")",
"==",
"self",
"]"
] | Returns a lis of the panels that are assigned to this view widget.
:return [<XViewPanel>, ..] | [
"Returns",
"a",
"lis",
"of",
"the",
"panels",
"that",
"are",
"assigned",
"to",
"this",
"view",
"widget",
".",
":",
"return",
"[",
"<XViewPanel",
">",
"..",
"]"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L263-L269 | train | Returns a list of all panels that are assigned to this view widget. |
bitesofcode/projexui | projexui/widgets/xviewwidget/xviewwidget.py | XViewWidget.registerViewType | def registerViewType(self, cls, window=None):
"""
Registers the inputed widget class as a potential view class. If the \
optional window argument is supplied, then the registerToWindow method \
will be called for the class.
:param cls | <subclass of XView>
... | python | def registerViewType(self, cls, window=None):
"""
Registers the inputed widget class as a potential view class. If the \
optional window argument is supplied, then the registerToWindow method \
will be called for the class.
:param cls | <subclass of XView>
... | [
"def",
"registerViewType",
"(",
"self",
",",
"cls",
",",
"window",
"=",
"None",
")",
":",
"if",
"(",
"not",
"cls",
"in",
"self",
".",
"_viewTypes",
")",
":",
"self",
".",
"_viewTypes",
".",
"append",
"(",
"cls",
")",
"if",
"(",
"window",
")",
":",
... | Registers the inputed widget class as a potential view class. If the \
optional window argument is supplied, then the registerToWindow method \
will be called for the class.
:param cls | <subclass of XView>
window | <QMainWindow> || <QDialog> || No... | [
"Registers",
"the",
"inputed",
"widget",
"class",
"as",
"a",
"potential",
"view",
"class",
".",
"If",
"the",
"\\",
"optional",
"window",
"argument",
"is",
"supplied",
"then",
"the",
"registerToWindow",
"method",
"\\",
"will",
"be",
"called",
"for",
"the",
"c... | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L271-L284 | train | Registers the given widget class as a potential view class. |
bitesofcode/projexui | projexui/widgets/xviewwidget/xviewwidget.py | XViewWidget.restoreSettings | def restoreSettings(self, settings):
"""
Restores the current structure of the view widget from the inputed \
settings instance.
:param settings | <QSettings>
"""
key = self.objectName()
value = unwrapVariant(settings.value('%s/profile' % key))... | python | def restoreSettings(self, settings):
"""
Restores the current structure of the view widget from the inputed \
settings instance.
:param settings | <QSettings>
"""
key = self.objectName()
value = unwrapVariant(settings.value('%s/profile' % key))... | [
"def",
"restoreSettings",
"(",
"self",
",",
"settings",
")",
":",
"key",
"=",
"self",
".",
"objectName",
"(",
")",
"value",
"=",
"unwrapVariant",
"(",
"settings",
".",
"value",
"(",
"'%s/profile'",
"%",
"key",
")",
")",
"if",
"not",
"value",
":",
"self... | Restores the current structure of the view widget from the inputed \
settings instance.
:param settings | <QSettings> | [
"Restores",
"the",
"current",
"structure",
"of",
"the",
"view",
"widget",
"from",
"the",
"inputed",
"\\",
"settings",
"instance",
".",
":",
"param",
"settings",
"|",
"<QSettings",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L295-L321 | train | Restores the current structure of the view widget from the inputed \ QSettings instance. |
bitesofcode/projexui | projexui/widgets/xviewwidget/xviewwidget.py | XViewWidget.reset | def reset(self, force=False):
"""
Clears out all the views and panels and resets the widget to a blank \
parent.
:return <bool>
"""
answer = QtGui.QMessageBox.Yes
opts = QtGui.QMessageBox.Yes | QtGui.QMessageBox.No
if not force:
... | python | def reset(self, force=False):
"""
Clears out all the views and panels and resets the widget to a blank \
parent.
:return <bool>
"""
answer = QtGui.QMessageBox.Yes
opts = QtGui.QMessageBox.Yes | QtGui.QMessageBox.No
if not force:
... | [
"def",
"reset",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"answer",
"=",
"QtGui",
".",
"QMessageBox",
".",
"Yes",
"opts",
"=",
"QtGui",
".",
"QMessageBox",
".",
"Yes",
"|",
"QtGui",
".",
"QMessageBox",
".",
"No",
"if",
"not",
"force",
":",
... | Clears out all the views and panels and resets the widget to a blank \
parent.
:return <bool> | [
"Clears",
"out",
"all",
"the",
"views",
"and",
"panels",
"and",
"resets",
"the",
"widget",
"to",
"a",
"blank",
"\\",
"parent",
".",
":",
"return",
"<bool",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L323-L366 | train | Resets the system and the widget to a blank version of the system. |
bitesofcode/projexui | projexui/widgets/xviewwidget/xviewwidget.py | XViewWidget.saveSettings | def saveSettings(self, settings):
"""
Records the current structure of the view widget to the inputed \
settings instance.
:param settings | <QSettings>
"""
# record the profile
profile = self.saveProfile()
key = self.objectName()
... | python | def saveSettings(self, settings):
"""
Records the current structure of the view widget to the inputed \
settings instance.
:param settings | <QSettings>
"""
# record the profile
profile = self.saveProfile()
key = self.objectName()
... | [
"def",
"saveSettings",
"(",
"self",
",",
"settings",
")",
":",
"# record the profile",
"profile",
"=",
"self",
".",
"saveProfile",
"(",
")",
"key",
"=",
"self",
".",
"objectName",
"(",
")",
"settings",
".",
"setValue",
"(",
"'%s/profile'",
"%",
"key",
",",... | Records the current structure of the view widget to the inputed \
settings instance.
:param settings | <QSettings> | [
"Records",
"the",
"current",
"structure",
"of",
"the",
"view",
"widget",
"to",
"the",
"inputed",
"\\",
"settings",
"instance",
".",
":",
"param",
"settings",
"|",
"<QSettings",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L379-L394 | train | Saves the current structure of the view widget to the inputed \ QSettings instance. |
bitesofcode/projexui | projexui/widgets/xviewwidget/xviewwidget.py | XViewWidget.setLocked | def setLocked(self, state):
"""
Sets the locked state for this view widget. When locked, a user no \
longer has control over editing views and layouts. A view panel with \
a single entry will hide its tab bar, and if it has multiple views, it \
will simply hide the editing butt... | python | def setLocked(self, state):
"""
Sets the locked state for this view widget. When locked, a user no \
longer has control over editing views and layouts. A view panel with \
a single entry will hide its tab bar, and if it has multiple views, it \
will simply hide the editing butt... | [
"def",
"setLocked",
"(",
"self",
",",
"state",
")",
":",
"changed",
"=",
"state",
"!=",
"self",
".",
"_locked",
"self",
".",
"_locked",
"=",
"state",
"for",
"panel",
"in",
"self",
".",
"panels",
"(",
")",
":",
"panel",
".",
"setLocked",
"(",
"state",... | Sets the locked state for this view widget. When locked, a user no \
longer has control over editing views and layouts. A view panel with \
a single entry will hide its tab bar, and if it has multiple views, it \
will simply hide the editing buttons.
:param state | <bool> | [
"Sets",
"the",
"locked",
"state",
"for",
"this",
"view",
"widget",
".",
"When",
"locked",
"a",
"user",
"no",
"\\",
"longer",
"has",
"control",
"over",
"editing",
"views",
"and",
"layouts",
".",
"A",
"view",
"panel",
"with",
"\\",
"a",
"single",
"entry",
... | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L433-L449 | train | Sets the locked state for this view widget. |
bitesofcode/projexui | projexui/widgets/xviewwidget/xviewwidget.py | XViewWidget.setViewTypes | def setViewTypes(self, viewTypes, window=None):
"""
Sets the view types that can be used for this widget. If the optional \
window member is supplied, then the registerToWindow method will be \
called for each view.
:param viewTypes | [<sublcass of XView>, ..]
... | python | def setViewTypes(self, viewTypes, window=None):
"""
Sets the view types that can be used for this widget. If the optional \
window member is supplied, then the registerToWindow method will be \
called for each view.
:param viewTypes | [<sublcass of XView>, ..]
... | [
"def",
"setViewTypes",
"(",
"self",
",",
"viewTypes",
",",
"window",
"=",
"None",
")",
":",
"if",
"window",
":",
"for",
"viewType",
"in",
"self",
".",
"_viewTypes",
":",
"viewType",
".",
"unregisterFromWindow",
"(",
"window",
")",
"self",
".",
"_viewTypes"... | Sets the view types that can be used for this widget. If the optional \
window member is supplied, then the registerToWindow method will be \
called for each view.
:param viewTypes | [<sublcass of XView>, ..]
window | <QMainWindow> || <QDialog> || None | [
"Sets",
"the",
"view",
"types",
"that",
"can",
"be",
"used",
"for",
"this",
"widget",
".",
"If",
"the",
"optional",
"\\",
"window",
"member",
"is",
"supplied",
"then",
"the",
"registerToWindow",
"method",
"will",
"be",
"\\",
"called",
"for",
"each",
"view"... | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L451-L470 | train | Sets the view types that can be used for this widget. |
bitesofcode/projexui | projexui/widgets/xviewwidget/xviewwidget.py | XViewWidget.showMenu | def showMenu(self, point=None):
"""
Displays the menu for this view widget.
:param point | <QPoint>
"""
menu = self.createMenu(self)
menu.exec_(QtGui.QCursor.pos())
menu.deleteLater() | python | def showMenu(self, point=None):
"""
Displays the menu for this view widget.
:param point | <QPoint>
"""
menu = self.createMenu(self)
menu.exec_(QtGui.QCursor.pos())
menu.deleteLater() | [
"def",
"showMenu",
"(",
"self",
",",
"point",
"=",
"None",
")",
":",
"menu",
"=",
"self",
".",
"createMenu",
"(",
"self",
")",
"menu",
".",
"exec_",
"(",
"QtGui",
".",
"QCursor",
".",
"pos",
"(",
")",
")",
"menu",
".",
"deleteLater",
"(",
")"
] | Displays the menu for this view widget.
:param point | <QPoint> | [
"Displays",
"the",
"menu",
"for",
"this",
"view",
"widget",
".",
":",
"param",
"point",
"|",
"<QPoint",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L472-L480 | train | Shows the menu for this view widget. |
bitesofcode/projexui | projexui/widgets/xviewwidget/xviewwidget.py | XViewWidget.showPanelMenu | def showPanelMenu(self, panel, point=None):
"""
Creates the panel menu for this view widget. If no point is supplied,\
then the current cursor position will be used.
:param panel | <XViewPanel>
point | <QPoint> || None
"""
if not sel... | python | def showPanelMenu(self, panel, point=None):
"""
Creates the panel menu for this view widget. If no point is supplied,\
then the current cursor position will be used.
:param panel | <XViewPanel>
point | <QPoint> || None
"""
if not sel... | [
"def",
"showPanelMenu",
"(",
"self",
",",
"panel",
",",
"point",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"_panelMenu",
":",
"self",
".",
"_panelMenu",
"=",
"XViewPanelMenu",
"(",
"self",
")",
"if",
"point",
"is",
"None",
":",
"point",
"=",
"... | Creates the panel menu for this view widget. If no point is supplied,\
then the current cursor position will be used.
:param panel | <XViewPanel>
point | <QPoint> || None | [
"Creates",
"the",
"panel",
"menu",
"for",
"this",
"view",
"widget",
".",
"If",
"no",
"point",
"is",
"supplied",
"\\",
"then",
"the",
"current",
"cursor",
"position",
"will",
"be",
"used",
".",
":",
"param",
"panel",
"|",
"<XViewPanel",
">",
"point",
"|",... | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L482-L497 | train | Show the panel menu for this view widget. |
bitesofcode/projexui | projexui/widgets/xviewwidget/xviewwidget.py | XViewWidget.showPluginMenu | def showPluginMenu(self, panel, point=None):
"""
Creates the interface menu for this view widget. If no point is \
supplied, then the current cursor position will be used.
:param panel | <XViewPanel>
point | <QPoint> || None
"""
if not s... | python | def showPluginMenu(self, panel, point=None):
"""
Creates the interface menu for this view widget. If no point is \
supplied, then the current cursor position will be used.
:param panel | <XViewPanel>
point | <QPoint> || None
"""
if not s... | [
"def",
"showPluginMenu",
"(",
"self",
",",
"panel",
",",
"point",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"_pluginMenu",
":",
"self",
".",
"_pluginMenu",
"=",
"XViewPluginMenu",
"(",
"self",
")",
"if",
"point",
"is",
"None",
":",
"point",
"=",... | Creates the interface menu for this view widget. If no point is \
supplied, then the current cursor position will be used.
:param panel | <XViewPanel>
point | <QPoint> || None | [
"Creates",
"the",
"interface",
"menu",
"for",
"this",
"view",
"widget",
".",
"If",
"no",
"point",
"is",
"\\",
"supplied",
"then",
"the",
"current",
"cursor",
"position",
"will",
"be",
"used",
".",
":",
"param",
"panel",
"|",
"<XViewPanel",
">",
"point",
... | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L499-L514 | train | Shows the plugin menu for this view widget. |
bitesofcode/projexui | projexui/widgets/xviewwidget/xviewwidget.py | XViewWidget.showTabMenu | def showTabMenu(self, panel, point=None):
"""
Creates the panel menu for this view widget. If no point is supplied,\
then the current cursor position will be used.
:param panel | <XViewPanel>
point | <QPoint> || None
"""
if not self.... | python | def showTabMenu(self, panel, point=None):
"""
Creates the panel menu for this view widget. If no point is supplied,\
then the current cursor position will be used.
:param panel | <XViewPanel>
point | <QPoint> || None
"""
if not self.... | [
"def",
"showTabMenu",
"(",
"self",
",",
"panel",
",",
"point",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"_tabMenu",
":",
"self",
".",
"_tabMenu",
"=",
"XViewTabMenu",
"(",
"self",
")",
"if",
"point",
"is",
"None",
":",
"point",
"=",
"QtGui",
... | Creates the panel menu for this view widget. If no point is supplied,\
then the current cursor position will be used.
:param panel | <XViewPanel>
point | <QPoint> || None | [
"Creates",
"the",
"panel",
"menu",
"for",
"this",
"view",
"widget",
".",
"If",
"no",
"point",
"is",
"supplied",
"\\",
"then",
"the",
"current",
"cursor",
"position",
"will",
"be",
"used",
".",
":",
"param",
"panel",
"|",
"<XViewPanel",
">",
"point",
"|",... | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L516-L531 | train | Show the tab menu for this view widget. |
bitesofcode/projexui | projexui/widgets/xviewwidget/xviewwidget.py | XViewWidget.updateCurrentView | def updateCurrentView(self, oldWidget, newWidget):
"""
Updates the current view widget.
:param oldWidget | <QtGui.QWidget>
newWidget | <QtGui.QWidget>
"""
view = projexui.ancestor(newWidget, XView)
if view is not None:
view.se... | python | def updateCurrentView(self, oldWidget, newWidget):
"""
Updates the current view widget.
:param oldWidget | <QtGui.QWidget>
newWidget | <QtGui.QWidget>
"""
view = projexui.ancestor(newWidget, XView)
if view is not None:
view.se... | [
"def",
"updateCurrentView",
"(",
"self",
",",
"oldWidget",
",",
"newWidget",
")",
":",
"view",
"=",
"projexui",
".",
"ancestor",
"(",
"newWidget",
",",
"XView",
")",
"if",
"view",
"is",
"not",
"None",
":",
"view",
".",
"setCurrent",
"(",
")"
] | Updates the current view widget.
:param oldWidget | <QtGui.QWidget>
newWidget | <QtGui.QWidget> | [
"Updates",
"the",
"current",
"view",
"widget",
".",
":",
"param",
"oldWidget",
"|",
"<QtGui",
".",
"QWidget",
">",
"newWidget",
"|",
"<QtGui",
".",
"QWidget",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L539-L548 | train | Updates the current view widget. |
bitesofcode/projexui | projexui/widgets/xviewwidget/xviewwidget.py | XViewWidget.unregisterViewType | def unregisterViewType(self, cls, window=None):
"""
Unregisters the view at the given name. If the window option is \
supplied then the unregisterFromWindow method will be called for the \
inputed class.
:param cls | <subclass of XView>
... | python | def unregisterViewType(self, cls, window=None):
"""
Unregisters the view at the given name. If the window option is \
supplied then the unregisterFromWindow method will be called for the \
inputed class.
:param cls | <subclass of XView>
... | [
"def",
"unregisterViewType",
"(",
"self",
",",
"cls",
",",
"window",
"=",
"None",
")",
":",
"if",
"(",
"cls",
"in",
"self",
".",
"_viewTypes",
")",
":",
"self",
".",
"_viewTypes",
".",
"remove",
"(",
"cls",
")",
"if",
"(",
"window",
")",
":",
"cls"... | Unregisters the view at the given name. If the window option is \
supplied then the unregisterFromWindow method will be called for the \
inputed class.
:param cls | <subclass of XView>
window | <QMainWindow> || <QDialog> || None
... | [
"Unregisters",
"the",
"view",
"at",
"the",
"given",
"name",
".",
"If",
"the",
"window",
"option",
"is",
"\\",
"supplied",
"then",
"the",
"unregisterFromWindow",
"method",
"will",
"be",
"called",
"for",
"the",
"\\",
"inputed",
"class",
".",
":",
"param",
"c... | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L550-L568 | train | Unregisters the view type with the given name. |
bitesofcode/projexui | projexui/widgets/xviewwidget/xviewwidget.py | XViewWidget.viewAt | def viewAt(self, point):
"""
Looks up the view at the inputed point.
:param point | <QtCore.QPoint>
:return <projexui.widgets.xviewwidget.XView> || None
"""
widget = self.childAt(point)
if widget:
return projexui.ancestor(widget, XView)
... | python | def viewAt(self, point):
"""
Looks up the view at the inputed point.
:param point | <QtCore.QPoint>
:return <projexui.widgets.xviewwidget.XView> || None
"""
widget = self.childAt(point)
if widget:
return projexui.ancestor(widget, XView)
... | [
"def",
"viewAt",
"(",
"self",
",",
"point",
")",
":",
"widget",
"=",
"self",
".",
"childAt",
"(",
"point",
")",
"if",
"widget",
":",
"return",
"projexui",
".",
"ancestor",
"(",
"widget",
",",
"XView",
")",
"else",
":",
"return",
"None"
] | Looks up the view at the inputed point.
:param point | <QtCore.QPoint>
:return <projexui.widgets.xviewwidget.XView> || None | [
"Looks",
"up",
"the",
"view",
"at",
"the",
"inputed",
"point",
"."
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L578-L590 | train | Look up the view at the inputed point. |
bitesofcode/projexui | projexui/widgets/xviewwidget/xviewwidget.py | XViewWidget.viewType | def viewType(self, name):
"""
Looks up the view class based on the inputd name.
:param name | <str>
:return <subclass of XView> || None
"""
for view in self._viewTypes:
if view.viewName() == name:
return view
... | python | def viewType(self, name):
"""
Looks up the view class based on the inputd name.
:param name | <str>
:return <subclass of XView> || None
"""
for view in self._viewTypes:
if view.viewName() == name:
return view
... | [
"def",
"viewType",
"(",
"self",
",",
"name",
")",
":",
"for",
"view",
"in",
"self",
".",
"_viewTypes",
":",
"if",
"view",
".",
"viewName",
"(",
")",
"==",
"name",
":",
"return",
"view",
"return",
"None"
] | Looks up the view class based on the inputd name.
:param name | <str>
:return <subclass of XView> || None | [
"Looks",
"up",
"the",
"view",
"class",
"based",
"on",
"the",
"inputd",
"name",
".",
":",
"param",
"name",
"|",
"<str",
">",
":",
"return",
"<subclass",
"of",
"XView",
">",
"||",
"None"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewwidget.py#L592-L603 | train | Returns the view class based on the inputd name. |
mojaie/chorus | chorus/draw/drawer2d.py | draw | def draw(canvas, mol):
"""Draw molecule structure image.
Args:
canvas: draw.drawable.Drawable
mol: model.graphmol.Compound
"""
mol.require("ScaleAndCenter")
mlb = mol.size2d[2]
if not mol.atom_count():
return
bond_type_fn = {
1: {
0: single_bond,
... | python | def draw(canvas, mol):
"""Draw molecule structure image.
Args:
canvas: draw.drawable.Drawable
mol: model.graphmol.Compound
"""
mol.require("ScaleAndCenter")
mlb = mol.size2d[2]
if not mol.atom_count():
return
bond_type_fn = {
1: {
0: single_bond,
... | [
"def",
"draw",
"(",
"canvas",
",",
"mol",
")",
":",
"mol",
".",
"require",
"(",
"\"ScaleAndCenter\"",
")",
"mlb",
"=",
"mol",
".",
"size2d",
"[",
"2",
"]",
"if",
"not",
"mol",
".",
"atom_count",
"(",
")",
":",
"return",
"bond_type_fn",
"=",
"{",
"1... | Draw molecule structure image.
Args:
canvas: draw.drawable.Drawable
mol: model.graphmol.Compound | [
"Draw",
"molecule",
"structure",
"image",
"."
] | fc7fe23a0272554c67671645ab07830b315eeb1b | https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/draw/drawer2d.py#L17-L93 | train | Draw the atom structure image. |
mojaie/chorus | chorus/smilessupplier.py | smiles_to_compound | def smiles_to_compound(smiles, assign_descriptors=True):
"""Convert SMILES text to compound object
Raises:
ValueError: SMILES with unsupported format
"""
it = iter(smiles)
mol = molecule()
try:
for token in it:
mol(token)
result, _ = mol(None)
except ... | python | def smiles_to_compound(smiles, assign_descriptors=True):
"""Convert SMILES text to compound object
Raises:
ValueError: SMILES with unsupported format
"""
it = iter(smiles)
mol = molecule()
try:
for token in it:
mol(token)
result, _ = mol(None)
except ... | [
"def",
"smiles_to_compound",
"(",
"smiles",
",",
"assign_descriptors",
"=",
"True",
")",
":",
"it",
"=",
"iter",
"(",
"smiles",
")",
"mol",
"=",
"molecule",
"(",
")",
"try",
":",
"for",
"token",
"in",
"it",
":",
"mol",
"(",
"token",
")",
"result",
",... | Convert SMILES text to compound object
Raises:
ValueError: SMILES with unsupported format | [
"Convert",
"SMILES",
"text",
"to",
"compound",
"object"
] | fc7fe23a0272554c67671645ab07830b315eeb1b | https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/smilessupplier.py#L316-L334 | train | Convert a SMILES text to a compound object |
moble/spinsfast | python/__init__.py | ind_lm | def ind_lm(index, lmax):
"""Convert single index to corresponding (ell, m) pair"""
import numpy as np
lm = np.empty(2, dtype=np.float64)
_ind_lm(index, lmax, lm)
return lm | python | def ind_lm(index, lmax):
"""Convert single index to corresponding (ell, m) pair"""
import numpy as np
lm = np.empty(2, dtype=np.float64)
_ind_lm(index, lmax, lm)
return lm | [
"def",
"ind_lm",
"(",
"index",
",",
"lmax",
")",
":",
"import",
"numpy",
"as",
"np",
"lm",
"=",
"np",
".",
"empty",
"(",
"2",
",",
"dtype",
"=",
"np",
".",
"float64",
")",
"_ind_lm",
"(",
"index",
",",
"lmax",
",",
"lm",
")",
"return",
"lm"
] | Convert single index to corresponding (ell, m) pair | [
"Convert",
"single",
"index",
"to",
"corresponding",
"(",
"ell",
"m",
")",
"pair"
] | 02480a3f712eb88eff5faa1d4afcbdfb0c25b865 | https://github.com/moble/spinsfast/blob/02480a3f712eb88eff5faa1d4afcbdfb0c25b865/python/__init__.py#L27-L32 | train | Convert single index to corresponding ( ell m ) pair |
moble/spinsfast | python/__init__.py | salm2map | def salm2map(salm, s, lmax, Ntheta, Nphi):
"""Convert mode weights of spin-weighted function to values on a grid
Parameters
----------
salm : array_like, complex, shape (..., (lmax+1)**2)
Input array representing mode weights of the spin-weighted function. This array may be
multi-dimen... | python | def salm2map(salm, s, lmax, Ntheta, Nphi):
"""Convert mode weights of spin-weighted function to values on a grid
Parameters
----------
salm : array_like, complex, shape (..., (lmax+1)**2)
Input array representing mode weights of the spin-weighted function. This array may be
multi-dimen... | [
"def",
"salm2map",
"(",
"salm",
",",
"s",
",",
"lmax",
",",
"Ntheta",
",",
"Nphi",
")",
":",
"if",
"Ntheta",
"<",
"2",
"or",
"Nphi",
"<",
"1",
":",
"raise",
"ValueError",
"(",
"\"Input values of Ntheta={0} and Nphi={1} \"",
".",
"format",
"(",
"Ntheta",
... | Convert mode weights of spin-weighted function to values on a grid
Parameters
----------
salm : array_like, complex, shape (..., (lmax+1)**2)
Input array representing mode weights of the spin-weighted function. This array may be
multi-dimensional, where initial dimensions may represent dif... | [
"Convert",
"mode",
"weights",
"of",
"spin",
"-",
"weighted",
"function",
"to",
"values",
"on",
"a",
"grid"
] | 02480a3f712eb88eff5faa1d4afcbdfb0c25b865 | https://github.com/moble/spinsfast/blob/02480a3f712eb88eff5faa1d4afcbdfb0c25b865/python/__init__.py#L40-L133 | train | Convert mode weights of spin - weighted function on a grid of points. |
moble/spinsfast | python/__init__.py | map2salm | def map2salm(map, s, lmax):
"""Convert values of spin-weighted function on a grid to mode weights
Parameters
----------
map : array_like, complex, shape (..., Ntheta, Nphi)
Values of the spin-weighted function on grid points of the sphere. This array may have more
than two dimensions, ... | python | def map2salm(map, s, lmax):
"""Convert values of spin-weighted function on a grid to mode weights
Parameters
----------
map : array_like, complex, shape (..., Ntheta, Nphi)
Values of the spin-weighted function on grid points of the sphere. This array may have more
than two dimensions, ... | [
"def",
"map2salm",
"(",
"map",
",",
"s",
",",
"lmax",
")",
":",
"import",
"numpy",
"as",
"np",
"map",
"=",
"np",
".",
"ascontiguousarray",
"(",
"map",
",",
"dtype",
"=",
"np",
".",
"complex128",
")",
"salm",
"=",
"np",
".",
"empty",
"(",
"map",
"... | Convert values of spin-weighted function on a grid to mode weights
Parameters
----------
map : array_like, complex, shape (..., Ntheta, Nphi)
Values of the spin-weighted function on grid points of the sphere. This array may have more
than two dimensions, where initial dimensions may repres... | [
"Convert",
"values",
"of",
"spin",
"-",
"weighted",
"function",
"on",
"a",
"grid",
"to",
"mode",
"weights"
] | 02480a3f712eb88eff5faa1d4afcbdfb0c25b865 | https://github.com/moble/spinsfast/blob/02480a3f712eb88eff5faa1d4afcbdfb0c25b865/python/__init__.py#L136-L216 | train | Convert values of spin - weighted function on a grid point to mode weights on a sphere. |
moble/spinsfast | python/__init__.py | f_extend_MW | def f_extend_MW(map, s):
"""Extend map of function to cover sphere "twice" up to theta=2pi
This introduces new points when Nphi is odd, and duplicates values when Nphi is even, making it
easier to perform certain transformation operations.
This is mostly an internal function, included here for backwar... | python | def f_extend_MW(map, s):
"""Extend map of function to cover sphere "twice" up to theta=2pi
This introduces new points when Nphi is odd, and duplicates values when Nphi is even, making it
easier to perform certain transformation operations.
This is mostly an internal function, included here for backwar... | [
"def",
"f_extend_MW",
"(",
"map",
",",
"s",
")",
":",
"import",
"numpy",
"as",
"np",
"map",
"=",
"np",
".",
"ascontiguousarray",
"(",
"map",
",",
"dtype",
"=",
"np",
".",
"complex128",
")",
"extended_map",
"=",
"np",
".",
"empty",
"(",
"(",
"2",
"*... | Extend map of function to cover sphere "twice" up to theta=2pi
This introduces new points when Nphi is odd, and duplicates values when Nphi is even, making it
easier to perform certain transformation operations.
This is mostly an internal function, included here for backwards compatibility. See map2salm
... | [
"Extend",
"map",
"of",
"function",
"to",
"cover",
"sphere",
"twice",
"up",
"to",
"theta",
"=",
"2pi"
] | 02480a3f712eb88eff5faa1d4afcbdfb0c25b865 | https://github.com/moble/spinsfast/blob/02480a3f712eb88eff5faa1d4afcbdfb0c25b865/python/__init__.py#L219-L233 | train | Extend map of function to cover sphere twice up to theta = 2pi |
moble/spinsfast | python/__init__.py | f_extend_old | def f_extend_old(map, s):
"""Extend map of function to cover sphere "twice" up to theta=2pi
This introduces new points when Nphi is odd, and duplicates values when Nphi is even, making it
easier to perform certain transformation operations.
This is mostly an internal function, included here for backwa... | python | def f_extend_old(map, s):
"""Extend map of function to cover sphere "twice" up to theta=2pi
This introduces new points when Nphi is odd, and duplicates values when Nphi is even, making it
easier to perform certain transformation operations.
This is mostly an internal function, included here for backwa... | [
"def",
"f_extend_old",
"(",
"map",
",",
"s",
")",
":",
"import",
"numpy",
"as",
"np",
"map",
"=",
"np",
".",
"ascontiguousarray",
"(",
"map",
",",
"dtype",
"=",
"np",
".",
"complex128",
")",
"extended_map",
"=",
"np",
".",
"empty",
"(",
"(",
"2",
"... | Extend map of function to cover sphere "twice" up to theta=2pi
This introduces new points when Nphi is odd, and duplicates values when Nphi is even, making it
easier to perform certain transformation operations.
This is mostly an internal function, included here for backwards compatibility. See map2salm
... | [
"Extend",
"map",
"of",
"function",
"to",
"cover",
"sphere",
"twice",
"up",
"to",
"theta",
"=",
"2pi"
] | 02480a3f712eb88eff5faa1d4afcbdfb0c25b865 | https://github.com/moble/spinsfast/blob/02480a3f712eb88eff5faa1d4afcbdfb0c25b865/python/__init__.py#L236-L250 | train | Extend map of function to cover sphere twice up to theta = 2pi |
moble/spinsfast | python/__init__.py | Imm | def Imm(extended_map, s, lmax):
"""Take the fft of the theta extended map, then zero pad and reorganize it
This is mostly an internal function, included here for backwards compatibility. See map2salm
and salm2map for more useful functions.
"""
import numpy as np
extended_map = np.ascontiguous... | python | def Imm(extended_map, s, lmax):
"""Take the fft of the theta extended map, then zero pad and reorganize it
This is mostly an internal function, included here for backwards compatibility. See map2salm
and salm2map for more useful functions.
"""
import numpy as np
extended_map = np.ascontiguous... | [
"def",
"Imm",
"(",
"extended_map",
",",
"s",
",",
"lmax",
")",
":",
"import",
"numpy",
"as",
"np",
"extended_map",
"=",
"np",
".",
"ascontiguousarray",
"(",
"extended_map",
",",
"dtype",
"=",
"np",
".",
"complex128",
")",
"NImm",
"=",
"(",
"2",
"*",
... | Take the fft of the theta extended map, then zero pad and reorganize it
This is mostly an internal function, included here for backwards compatibility. See map2salm
and salm2map for more useful functions. | [
"Take",
"the",
"fft",
"of",
"the",
"theta",
"extended",
"map",
"then",
"zero",
"pad",
"and",
"reorganize",
"it"
] | 02480a3f712eb88eff5faa1d4afcbdfb0c25b865 | https://github.com/moble/spinsfast/blob/02480a3f712eb88eff5faa1d4afcbdfb0c25b865/python/__init__.py#L252-L264 | train | Take the fft of the theta extended map then zero pad and reorganize it
|
moble/spinsfast | python/__init__.py | quadrature_weights | def quadrature_weights(Ntheta):
"""Fourier-space weights needed to evaluate I_{mm'}
This is mostly an internal function, included here for backwards compatibility. See map2salm
and salm2map for more useful functions.
"""
import numpy as np
weights = np.empty(2*(Ntheta-1), dtype=np.complex128)... | python | def quadrature_weights(Ntheta):
"""Fourier-space weights needed to evaluate I_{mm'}
This is mostly an internal function, included here for backwards compatibility. See map2salm
and salm2map for more useful functions.
"""
import numpy as np
weights = np.empty(2*(Ntheta-1), dtype=np.complex128)... | [
"def",
"quadrature_weights",
"(",
"Ntheta",
")",
":",
"import",
"numpy",
"as",
"np",
"weights",
"=",
"np",
".",
"empty",
"(",
"2",
"*",
"(",
"Ntheta",
"-",
"1",
")",
",",
"dtype",
"=",
"np",
".",
"complex128",
")",
"_quadrature_weights",
"(",
"Ntheta",... | Fourier-space weights needed to evaluate I_{mm'}
This is mostly an internal function, included here for backwards compatibility. See map2salm
and salm2map for more useful functions. | [
"Fourier",
"-",
"space",
"weights",
"needed",
"to",
"evaluate",
"I_",
"{",
"mm",
"}"
] | 02480a3f712eb88eff5faa1d4afcbdfb0c25b865 | https://github.com/moble/spinsfast/blob/02480a3f712eb88eff5faa1d4afcbdfb0c25b865/python/__init__.py#L266-L276 | train | Fourier - space weights needed to evaluate I_mm |
ehansis/ozelot | ozelot/cache.py | RequestCache._query | def _query(self, url, xpath):
"""Base query for an url and xpath
Args:
url (str): URL to search
xpath (str): xpath to search (may be ``None``)
"""
return self.session.query(CachedRequest).filter(CachedRequest.url == url).filter(CachedRequest.xpath == xpath) | python | def _query(self, url, xpath):
"""Base query for an url and xpath
Args:
url (str): URL to search
xpath (str): xpath to search (may be ``None``)
"""
return self.session.query(CachedRequest).filter(CachedRequest.url == url).filter(CachedRequest.xpath == xpath) | [
"def",
"_query",
"(",
"self",
",",
"url",
",",
"xpath",
")",
":",
"return",
"self",
".",
"session",
".",
"query",
"(",
"CachedRequest",
")",
".",
"filter",
"(",
"CachedRequest",
".",
"url",
"==",
"url",
")",
".",
"filter",
"(",
"CachedRequest",
".",
... | Base query for an url and xpath
Args:
url (str): URL to search
xpath (str): xpath to search (may be ``None``) | [
"Base",
"query",
"for",
"an",
"url",
"and",
"xpath"
] | 948675e02eb6fca940450f5cb814f53e97159e5b | https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/ozelot/cache.py#L106-L113 | train | Base query for an url and xpath |
ehansis/ozelot | ozelot/cache.py | RequestCache.get | def get(self, url, store_on_error=False, xpath=None, rate_limit=None, log_hits=True, log_misses=True):
"""Get a URL via the cache.
If the URL exists in the cache, return the cached value. Otherwise perform the request,
store the resulting content in the cache and return it.
Throws a :c... | python | def get(self, url, store_on_error=False, xpath=None, rate_limit=None, log_hits=True, log_misses=True):
"""Get a URL via the cache.
If the URL exists in the cache, return the cached value. Otherwise perform the request,
store the resulting content in the cache and return it.
Throws a :c... | [
"def",
"get",
"(",
"self",
",",
"url",
",",
"store_on_error",
"=",
"False",
",",
"xpath",
"=",
"None",
",",
"rate_limit",
"=",
"None",
",",
"log_hits",
"=",
"True",
",",
"log_misses",
"=",
"True",
")",
":",
"try",
":",
"# get cached request - if none is fo... | Get a URL via the cache.
If the URL exists in the cache, return the cached value. Otherwise perform the request,
store the resulting content in the cache and return it.
Throws a :class:`RuntimeError` if the request results in an error.
Args:
url (str): URL to request
... | [
"Get",
"a",
"URL",
"via",
"the",
"cache",
"."
] | 948675e02eb6fca940450f5cb814f53e97159e5b | https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/ozelot/cache.py#L115-L202 | train | Get a URL via the cache. |
ehansis/ozelot | ozelot/cache.py | RequestCache.clear | def clear(self, url=None, xpath=None):
"""Clear cache
Args:
url (str): If given, clear specific item only. Otherwise remove the DB file.
xpath (str): xpath to search (may be ``None``)
"""
if url is not None:
query = self._query(url, xpath)
... | python | def clear(self, url=None, xpath=None):
"""Clear cache
Args:
url (str): If given, clear specific item only. Otherwise remove the DB file.
xpath (str): xpath to search (may be ``None``)
"""
if url is not None:
query = self._query(url, xpath)
... | [
"def",
"clear",
"(",
"self",
",",
"url",
"=",
"None",
",",
"xpath",
"=",
"None",
")",
":",
"if",
"url",
"is",
"not",
"None",
":",
"query",
"=",
"self",
".",
"_query",
"(",
"url",
",",
"xpath",
")",
"if",
"query",
".",
"count",
"(",
")",
">",
... | Clear cache
Args:
url (str): If given, clear specific item only. Otherwise remove the DB file.
xpath (str): xpath to search (may be ``None``) | [
"Clear",
"cache"
] | 948675e02eb6fca940450f5cb814f53e97159e5b | https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/ozelot/cache.py#L204-L222 | train | Clear the cache with the given URL and xpath. |
ehansis/ozelot | ozelot/cache.py | RequestCache.has | def has(self, url, xpath=None):
"""Check if a URL (and xpath) exists in the cache
If DB has not been initialized yet, returns ``False`` for any URL.
Args:
url (str): If given, clear specific item only. Otherwise remove the DB file.
xpath (str): xpath to search (may be `... | python | def has(self, url, xpath=None):
"""Check if a URL (and xpath) exists in the cache
If DB has not been initialized yet, returns ``False`` for any URL.
Args:
url (str): If given, clear specific item only. Otherwise remove the DB file.
xpath (str): xpath to search (may be `... | [
"def",
"has",
"(",
"self",
",",
"url",
",",
"xpath",
"=",
"None",
")",
":",
"if",
"not",
"path",
".",
"exists",
"(",
"self",
".",
"db_path",
")",
":",
"return",
"False",
"return",
"self",
".",
"_query",
"(",
"url",
",",
"xpath",
")",
".",
"count"... | Check if a URL (and xpath) exists in the cache
If DB has not been initialized yet, returns ``False`` for any URL.
Args:
url (str): If given, clear specific item only. Otherwise remove the DB file.
xpath (str): xpath to search (may be ``None``)
Returns:
bool... | [
"Check",
"if",
"a",
"URL",
"(",
"and",
"xpath",
")",
"exists",
"in",
"the",
"cache"
] | 948675e02eb6fca940450f5cb814f53e97159e5b | https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/ozelot/cache.py#L224-L239 | train | Check if a URL and xpath exists in the cache. |
ehansis/ozelot | ozelot/cache.py | RequestCache.get_timestamp | def get_timestamp(self, url, xpath=None):
"""Get time stamp of cached query result.
If DB has not yet been initialized or url/xpath has not been queried yet, return None.
Args:
url (str): If given, clear specific item only. Otherwise remove the DB file.
xpath (str): xpa... | python | def get_timestamp(self, url, xpath=None):
"""Get time stamp of cached query result.
If DB has not yet been initialized or url/xpath has not been queried yet, return None.
Args:
url (str): If given, clear specific item only. Otherwise remove the DB file.
xpath (str): xpa... | [
"def",
"get_timestamp",
"(",
"self",
",",
"url",
",",
"xpath",
"=",
"None",
")",
":",
"if",
"not",
"path",
".",
"exists",
"(",
"self",
".",
"db_path",
")",
":",
"return",
"None",
"if",
"self",
".",
"_query",
"(",
"url",
",",
"xpath",
")",
".",
"c... | Get time stamp of cached query result.
If DB has not yet been initialized or url/xpath has not been queried yet, return None.
Args:
url (str): If given, clear specific item only. Otherwise remove the DB file.
xpath (str): xpath to search (may be ``None``)
Returns:
... | [
"Get",
"time",
"stamp",
"of",
"cached",
"query",
"result",
"."
] | 948675e02eb6fca940450f5cb814f53e97159e5b | https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/ozelot/cache.py#L241-L257 | train | Get time stamp of cached query result. |
ehansis/ozelot | examples/eurominder/eurominder/analysis.py | indicator_summary_table | def indicator_summary_table():
"""Export a table listing all NUTS2 regions with their (most current) data.
Output is a CSV file and an Excel file, saved as 'characters.csv/.xlsx' in the output directory.
"""
# a database client/session to run queries in
cl = client.get_client()
session = cl.cre... | python | def indicator_summary_table():
"""Export a table listing all NUTS2 regions with their (most current) data.
Output is a CSV file and an Excel file, saved as 'characters.csv/.xlsx' in the output directory.
"""
# a database client/session to run queries in
cl = client.get_client()
session = cl.cre... | [
"def",
"indicator_summary_table",
"(",
")",
":",
"# a database client/session to run queries in",
"cl",
"=",
"client",
".",
"get_client",
"(",
")",
"session",
"=",
"cl",
".",
"create_session",
"(",
")",
"# Query regions and indicators separately, join them in pandas",
"quer... | Export a table listing all NUTS2 regions with their (most current) data.
Output is a CSV file and an Excel file, saved as 'characters.csv/.xlsx' in the output directory. | [
"Export",
"a",
"table",
"listing",
"all",
"NUTS2",
"regions",
"with",
"their",
"(",
"most",
"current",
")",
"data",
"."
] | 948675e02eb6fca940450f5cb814f53e97159e5b | https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/eurominder/eurominder/analysis.py#L20-L69 | train | Export a table listing all NUTS2 regions and indicators and their data. |
ehansis/ozelot | examples/eurominder/eurominder/analysis.py | eurominder_explorer | def eurominder_explorer():
"""Generate interactive data exploration tool
Output is an html page, rendered to 'eurominder_explorer.html' in the output directory.
Data structure (only relevant items are shown below):
.. code-block:: none
{
"nuts2Features": [{"geometry": [<boundary ... | python | def eurominder_explorer():
"""Generate interactive data exploration tool
Output is an html page, rendered to 'eurominder_explorer.html' in the output directory.
Data structure (only relevant items are shown below):
.. code-block:: none
{
"nuts2Features": [{"geometry": [<boundary ... | [
"def",
"eurominder_explorer",
"(",
")",
":",
"# switch off some pandas warnings",
"import",
"pandas",
"as",
"pd",
"pd",
".",
"options",
".",
"mode",
".",
"chained_assignment",
"=",
"None",
"# page template",
"template",
"=",
"jenv",
".",
"get_template",
"(",
"\"eu... | Generate interactive data exploration tool
Output is an html page, rendered to 'eurominder_explorer.html' in the output directory.
Data structure (only relevant items are shown below):
.. code-block:: none
{
"nuts2Features": [{"geometry": [<boundary geometry>],
... | [
"Generate",
"interactive",
"data",
"exploration",
"tool"
] | 948675e02eb6fca940450f5cb814f53e97159e5b | https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/eurominder/eurominder/analysis.py#L72-L251 | train | Generate interactive data exploration tool |
gmdzy2010/dingtalk_sdk_gmdzy2010 | dingtalk_sdk_gmdzy2010/base_request.py | BaseRequest.get_response | def get_response(self):
"""Get the original response of requests"""
request = getattr(requests, self.request_method, None)
if request is None and self._request_method is None:
raise ValueError("A effective http request method must be set")
if self.request_url is None:
... | python | def get_response(self):
"""Get the original response of requests"""
request = getattr(requests, self.request_method, None)
if request is None and self._request_method is None:
raise ValueError("A effective http request method must be set")
if self.request_url is None:
... | [
"def",
"get_response",
"(",
"self",
")",
":",
"request",
"=",
"getattr",
"(",
"requests",
",",
"self",
".",
"request_method",
",",
"None",
")",
"if",
"request",
"is",
"None",
"and",
"self",
".",
"_request_method",
"is",
"None",
":",
"raise",
"ValueError",
... | Get the original response of requests | [
"Get",
"the",
"original",
"response",
"of",
"requests"
] | b06cb1f78f89be9554dcb6101af8bc72718a9ecd | https://github.com/gmdzy2010/dingtalk_sdk_gmdzy2010/blob/b06cb1f78f89be9554dcb6101af8bc72718a9ecd/dingtalk_sdk_gmdzy2010/base_request.py#L55-L67 | train | Get the original response of requests |
gmdzy2010/dingtalk_sdk_gmdzy2010 | dingtalk_sdk_gmdzy2010/base_request.py | BaseRequest.get_json_response | def get_json_response(self):
"""This method aims at catching the exception of ValueError, detail:
http://docs.python-requests.org/zh_CN/latest/user/quickstart.html#json
"""
self.json_response = self.get_response().json()
if self.json_response is not None:
error_... | python | def get_json_response(self):
"""This method aims at catching the exception of ValueError, detail:
http://docs.python-requests.org/zh_CN/latest/user/quickstart.html#json
"""
self.json_response = self.get_response().json()
if self.json_response is not None:
error_... | [
"def",
"get_json_response",
"(",
"self",
")",
":",
"self",
".",
"json_response",
"=",
"self",
".",
"get_response",
"(",
")",
".",
"json",
"(",
")",
"if",
"self",
".",
"json_response",
"is",
"not",
"None",
":",
"error_code",
"=",
"self",
".",
"json_respon... | This method aims at catching the exception of ValueError, detail:
http://docs.python-requests.org/zh_CN/latest/user/quickstart.html#json | [
"This",
"method",
"aims",
"at",
"catching",
"the",
"exception",
"of",
"ValueError",
"detail",
":",
"http",
":",
"//",
"docs",
".",
"python",
"-",
"requests",
".",
"org",
"/",
"zh_CN",
"/",
"latest",
"/",
"user",
"/",
"quickstart",
".",
"html#json"
] | b06cb1f78f89be9554dcb6101af8bc72718a9ecd | https://github.com/gmdzy2010/dingtalk_sdk_gmdzy2010/blob/b06cb1f78f89be9554dcb6101af8bc72718a9ecd/dingtalk_sdk_gmdzy2010/base_request.py#L69-L77 | train | Returns the JSON response from the API call. |
micolous/python-slackrealtime | src/slackrealtime/protocol.py | RtmProtocol.sendCommand | def sendCommand(self, **msg):
"""
Sends a raw command to the Slack server, generating a message ID automatically.
"""
assert 'type' in msg, 'Message type is required.'
msg['id'] = self.next_message_id
self.next_message_id += 1
if self.next_message_id >= maxint:
self.next_message_id = 1
self.sendMe... | python | def sendCommand(self, **msg):
"""
Sends a raw command to the Slack server, generating a message ID automatically.
"""
assert 'type' in msg, 'Message type is required.'
msg['id'] = self.next_message_id
self.next_message_id += 1
if self.next_message_id >= maxint:
self.next_message_id = 1
self.sendMe... | [
"def",
"sendCommand",
"(",
"self",
",",
"*",
"*",
"msg",
")",
":",
"assert",
"'type'",
"in",
"msg",
",",
"'Message type is required.'",
"msg",
"[",
"'id'",
"]",
"=",
"self",
".",
"next_message_id",
"self",
".",
"next_message_id",
"+=",
"1",
"if",
"self",
... | Sends a raw command to the Slack server, generating a message ID automatically. | [
"Sends",
"a",
"raw",
"command",
"to",
"the",
"Slack",
"server",
"generating",
"a",
"message",
"ID",
"automatically",
"."
] | e9c94416f979a6582110ebba09c147de2bfe20a1 | https://github.com/micolous/python-slackrealtime/blob/e9c94416f979a6582110ebba09c147de2bfe20a1/src/slackrealtime/protocol.py#L70-L83 | train | Sends a raw command to the Slack server. |
micolous/python-slackrealtime | src/slackrealtime/protocol.py | RtmProtocol.sendChatMessage | def sendChatMessage(self, text, id=None, user=None, group=None, channel=None, parse='none', link_names=True, unfurl_links=True, unfurl_media=False, send_with_api=False, icon_emoji=None, icon_url=None, username=None, attachments=None, thread_ts=None, reply_broadcast=False):
"""
Sends a chat message to a given id, us... | python | def sendChatMessage(self, text, id=None, user=None, group=None, channel=None, parse='none', link_names=True, unfurl_links=True, unfurl_media=False, send_with_api=False, icon_emoji=None, icon_url=None, username=None, attachments=None, thread_ts=None, reply_broadcast=False):
"""
Sends a chat message to a given id, us... | [
"def",
"sendChatMessage",
"(",
"self",
",",
"text",
",",
"id",
"=",
"None",
",",
"user",
"=",
"None",
",",
"group",
"=",
"None",
",",
"channel",
"=",
"None",
",",
"parse",
"=",
"'none'",
",",
"link_names",
"=",
"True",
",",
"unfurl_links",
"=",
"True... | Sends a chat message to a given id, user, group or channel.
If the API token is not a bot token (xoxb), ``send_with_api`` may be set
to True. This will send messages using ``chat.postMessage`` in the Slack
API, instead of using the WebSockets channel.
This makes the message sending process a little bit slowe... | [
"Sends",
"a",
"chat",
"message",
"to",
"a",
"given",
"id",
"user",
"group",
"or",
"channel",
"."
] | e9c94416f979a6582110ebba09c147de2bfe20a1 | https://github.com/micolous/python-slackrealtime/blob/e9c94416f979a6582110ebba09c147de2bfe20a1/src/slackrealtime/protocol.py#L86-L155 | train | This method sends a chat message to a given chat id user group or channel. |
mojaie/chorus | chorus/wclogp.py | wcparams | def wcparams(mol, type_):
"""
Calculate Wildman-Crippen logP
Wildman S., Crippen G., Prediction of Physicochemical Parameters by Atomic
Contribution, J. Chem. Inf. Model. 39 (1999) 868-873
"""
try:
assign_wctype(mol)
except:
return "N/A"
scores = []
for i, atom in mol... | python | def wcparams(mol, type_):
"""
Calculate Wildman-Crippen logP
Wildman S., Crippen G., Prediction of Physicochemical Parameters by Atomic
Contribution, J. Chem. Inf. Model. 39 (1999) 868-873
"""
try:
assign_wctype(mol)
except:
return "N/A"
scores = []
for i, atom in mol... | [
"def",
"wcparams",
"(",
"mol",
",",
"type_",
")",
":",
"try",
":",
"assign_wctype",
"(",
"mol",
")",
"except",
":",
"return",
"\"N/A\"",
"scores",
"=",
"[",
"]",
"for",
"i",
",",
"atom",
"in",
"mol",
".",
"atoms_iter",
"(",
")",
":",
"scores",
".",... | Calculate Wildman-Crippen logP
Wildman S., Crippen G., Prediction of Physicochemical Parameters by Atomic
Contribution, J. Chem. Inf. Model. 39 (1999) 868-873 | [
"Calculate",
"Wildman",
"-",
"Crippen",
"logP",
"Wildman",
"S",
".",
"Crippen",
"G",
".",
"Prediction",
"of",
"Physicochemical",
"Parameters",
"by",
"Atomic",
"Contribution",
"J",
".",
"Chem",
".",
"Inf",
".",
"Model",
".",
"39",
"(",
"1999",
")",
"868",
... | fc7fe23a0272554c67671645ab07830b315eeb1b | https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/wclogp.py#L23-L45 | train | Calculate Wildman - Crippen logP
|
mojaie/chorus | chorus/wclogp.py | assign_wctype | def assign_wctype(mol):
""" Assign atom type of Wildman-Crippen logP (Wildman and Crippen 1999) """
mol.require("Aromatic")
p_block = ["Al", "B", "Si", "Ga", "Ge", "As", "Se", "Sn", "Te", "Pb",
"Ne", "Ar", "Kr", "Xe", "Rn"]
d_block = ["Fe", "Co", "Cu", "Zn", "Tc", "Cd", "Pt", "Au", "Hg", ... | python | def assign_wctype(mol):
""" Assign atom type of Wildman-Crippen logP (Wildman and Crippen 1999) """
mol.require("Aromatic")
p_block = ["Al", "B", "Si", "Ga", "Ge", "As", "Se", "Sn", "Te", "Pb",
"Ne", "Ar", "Kr", "Xe", "Rn"]
d_block = ["Fe", "Co", "Cu", "Zn", "Tc", "Cd", "Pt", "Au", "Hg", ... | [
"def",
"assign_wctype",
"(",
"mol",
")",
":",
"mol",
".",
"require",
"(",
"\"Aromatic\"",
")",
"p_block",
"=",
"[",
"\"Al\"",
",",
"\"B\"",
",",
"\"Si\"",
",",
"\"Ga\"",
",",
"\"Ge\"",
",",
"\"As\"",
",",
"\"Se\"",
",",
"\"Sn\"",
",",
"\"Te\"",
",",
... | Assign atom type of Wildman-Crippen logP (Wildman and Crippen 1999) | [
"Assign",
"atom",
"type",
"of",
"Wildman",
"-",
"Crippen",
"logP",
"(",
"Wildman",
"and",
"Crippen",
"1999",
")"
] | fc7fe23a0272554c67671645ab07830b315eeb1b | https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/wclogp.py#L48-L233 | train | Assign atom type of Wildman - Crippen logP to all atoms in the current molecule. |
abantos/bolt | bolt/__init__.py | run | def run():
"""
Entry point for the `bolt` executable.
"""
options = btoptions.Options()
btlog.initialize_logging(options.log_level, options.log_file)
app = btapp.get_application()
app.run() | python | def run():
"""
Entry point for the `bolt` executable.
"""
options = btoptions.Options()
btlog.initialize_logging(options.log_level, options.log_file)
app = btapp.get_application()
app.run() | [
"def",
"run",
"(",
")",
":",
"options",
"=",
"btoptions",
".",
"Options",
"(",
")",
"btlog",
".",
"initialize_logging",
"(",
"options",
".",
"log_level",
",",
"options",
".",
"log_file",
")",
"app",
"=",
"btapp",
".",
"get_application",
"(",
")",
"app",
... | Entry point for the `bolt` executable. | [
"Entry",
"point",
"for",
"the",
"bolt",
"executable",
"."
] | 8b6a911d4a7b1a6e870748a523c9b2b91997c773 | https://github.com/abantos/bolt/blob/8b6a911d4a7b1a6e870748a523c9b2b91997c773/bolt/__init__.py#L31-L38 | train | Entry point for the bolt executable. |
mojaie/chorus | chorus/v2000writer.py | mols_to_file | def mols_to_file(mols, path):
"""Save molecules to the SDFile format file
Args:
mols: list of molecule objects
path: file path to save
"""
with open(path, 'w') as f:
f.write(mols_to_text(mols)) | python | def mols_to_file(mols, path):
"""Save molecules to the SDFile format file
Args:
mols: list of molecule objects
path: file path to save
"""
with open(path, 'w') as f:
f.write(mols_to_text(mols)) | [
"def",
"mols_to_file",
"(",
"mols",
",",
"path",
")",
":",
"with",
"open",
"(",
"path",
",",
"'w'",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"mols_to_text",
"(",
"mols",
")",
")"
] | Save molecules to the SDFile format file
Args:
mols: list of molecule objects
path: file path to save | [
"Save",
"molecules",
"to",
"the",
"SDFile",
"format",
"file"
] | fc7fe23a0272554c67671645ab07830b315eeb1b | https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/v2000writer.py#L130-L138 | train | Save a list of molecules to the SDFile format file
|
ShadowBlip/Neteria | neteria/client.py | NeteriaClient.listen | def listen(self):
"""Starts the client listener to listen for server responses.
Args:
None
Returns:
None
"""
logger.info("Listening on port " + str(self.listener.listen_port))
self.listener.listen() | python | def listen(self):
"""Starts the client listener to listen for server responses.
Args:
None
Returns:
None
"""
logger.info("Listening on port " + str(self.listener.listen_port))
self.listener.listen() | [
"def",
"listen",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"\"Listening on port \"",
"+",
"str",
"(",
"self",
".",
"listener",
".",
"listen_port",
")",
")",
"self",
".",
"listener",
".",
"listen",
"(",
")"
] | Starts the client listener to listen for server responses.
Args:
None
Returns:
None | [
"Starts",
"the",
"client",
"listener",
"to",
"listen",
"for",
"server",
"responses",
"."
] | 1a8c976eb2beeca0a5a272a34ac58b2c114495a4 | https://github.com/ShadowBlip/Neteria/blob/1a8c976eb2beeca0a5a272a34ac58b2c114495a4/neteria/client.py#L158-L170 | train | Starts the client listener to listen for server responses. |
ShadowBlip/Neteria | neteria/client.py | NeteriaClient.retransmit | def retransmit(self, data):
"""Processes messages that have been delivered from the transport
protocol.
Args:
data (dict): A dictionary containing the packet data to resend.
Returns:
None
Examples:
>>> data
{'method': 'REGISTER', 'addres... | python | def retransmit(self, data):
"""Processes messages that have been delivered from the transport
protocol.
Args:
data (dict): A dictionary containing the packet data to resend.
Returns:
None
Examples:
>>> data
{'method': 'REGISTER', 'addres... | [
"def",
"retransmit",
"(",
"self",
",",
"data",
")",
":",
"# Handle retransmitting REGISTER requests if we don't hear back from",
"# the server.",
"if",
"data",
"[",
"\"method\"",
"]",
"==",
"\"REGISTER\"",
":",
"if",
"not",
"self",
".",
"registered",
"and",
"self",
... | Processes messages that have been delivered from the transport
protocol.
Args:
data (dict): A dictionary containing the packet data to resend.
Returns:
None
Examples:
>>> data
{'method': 'REGISTER', 'address': ('192.168.0.20', 40080)} | [
"Processes",
"messages",
"that",
"have",
"been",
"delivered",
"from",
"the",
"transport",
"protocol",
"."
] | 1a8c976eb2beeca0a5a272a34ac58b2c114495a4 | https://github.com/ShadowBlip/Neteria/blob/1a8c976eb2beeca0a5a272a34ac58b2c114495a4/neteria/client.py#L173-L230 | train | Processes messages that have been delivered from the transport
protocol. |
ShadowBlip/Neteria | neteria/client.py | NeteriaClient.handle_message | def handle_message(self, msg, host):
"""Processes messages that have been delivered from the transport
protocol
Args:
msg (string): The raw packet data delivered from the transport
protocol.
host (tuple): A tuple containing the (address, port) combination of
... | python | def handle_message(self, msg, host):
"""Processes messages that have been delivered from the transport
protocol
Args:
msg (string): The raw packet data delivered from the transport
protocol.
host (tuple): A tuple containing the (address, port) combination of
... | [
"def",
"handle_message",
"(",
"self",
",",
"msg",
",",
"host",
")",
":",
"logger",
".",
"debug",
"(",
"\"Executing handle_message method.\"",
")",
"response",
"=",
"None",
"# Unserialize the data packet",
"# If encryption is enabled, and we've receive the server's public key"... | Processes messages that have been delivered from the transport
protocol
Args:
msg (string): The raw packet data delivered from the transport
protocol.
host (tuple): A tuple containing the (address, port) combination of
the message's origin.
Returns:
... | [
"Processes",
"messages",
"that",
"have",
"been",
"delivered",
"from",
"the",
"transport",
"protocol"
] | 1a8c976eb2beeca0a5a272a34ac58b2c114495a4 | https://github.com/ShadowBlip/Neteria/blob/1a8c976eb2beeca0a5a272a34ac58b2c114495a4/neteria/client.py#L233-L321 | train | Process a message from the server and return the response. |
ShadowBlip/Neteria | neteria/client.py | NeteriaClient.autodiscover | def autodiscover(self, autoregister=True):
"""This function will send out an autodiscover broadcast to find a
Neteria server. Any servers that respond with an "OHAI CLIENT"
packet are servers that we can connect to. Servers that respond are
stored in the "discovered_servers" list.
... | python | def autodiscover(self, autoregister=True):
"""This function will send out an autodiscover broadcast to find a
Neteria server. Any servers that respond with an "OHAI CLIENT"
packet are servers that we can connect to. Servers that respond are
stored in the "discovered_servers" list.
... | [
"def",
"autodiscover",
"(",
"self",
",",
"autoregister",
"=",
"True",
")",
":",
"logger",
".",
"debug",
"(",
"\"<%s> Sending autodiscover message to broadcast \"",
"\"address\"",
"%",
"str",
"(",
"self",
".",
"cuuid",
")",
")",
"if",
"not",
"self",
".",
"liste... | This function will send out an autodiscover broadcast to find a
Neteria server. Any servers that respond with an "OHAI CLIENT"
packet are servers that we can connect to. Servers that respond are
stored in the "discovered_servers" list.
Args:
autoregister (boolean): Whether or ... | [
"This",
"function",
"will",
"send",
"out",
"an",
"autodiscover",
"broadcast",
"to",
"find",
"a",
"Neteria",
"server",
".",
"Any",
"servers",
"that",
"respond",
"with",
"an",
"OHAI",
"CLIENT",
"packet",
"are",
"servers",
"that",
"we",
"can",
"connect",
"to",
... | 1a8c976eb2beeca0a5a272a34ac58b2c114495a4 | https://github.com/ShadowBlip/Neteria/blob/1a8c976eb2beeca0a5a272a34ac58b2c114495a4/neteria/client.py#L324-L360 | train | This function will send out an autodiscover broadcast to find a specific Neteria server. |
ShadowBlip/Neteria | neteria/client.py | NeteriaClient.register | def register(self, address, retry=True):
"""This function will send a register packet to the discovered Neteria
server.
Args:
address (tuple): A tuple of the (address, port) to send the register
request to.
retry (boolean): Whether or not we want to reset the cur... | python | def register(self, address, retry=True):
"""This function will send a register packet to the discovered Neteria
server.
Args:
address (tuple): A tuple of the (address, port) to send the register
request to.
retry (boolean): Whether or not we want to reset the cur... | [
"def",
"register",
"(",
"self",
",",
"address",
",",
"retry",
"=",
"True",
")",
":",
"logger",
".",
"debug",
"(",
"\"<%s> Sending REGISTER request to: %s\"",
"%",
"(",
"str",
"(",
"self",
".",
"cuuid",
")",
",",
"str",
"(",
"address",
")",
")",
")",
"i... | This function will send a register packet to the discovered Neteria
server.
Args:
address (tuple): A tuple of the (address, port) to send the register
request to.
retry (boolean): Whether or not we want to reset the current number
of registration retries to 0... | [
"This",
"function",
"will",
"send",
"a",
"register",
"packet",
"to",
"the",
"discovered",
"Neteria",
"server",
"."
] | 1a8c976eb2beeca0a5a272a34ac58b2c114495a4 | https://github.com/ShadowBlip/Neteria/blob/1a8c976eb2beeca0a5a272a34ac58b2c114495a4/neteria/client.py#L363-L408 | train | This function will send a REGISTER packet to the server. |
ShadowBlip/Neteria | neteria/client.py | NeteriaClient.event | def event(self, event_data, priority="normal", event_method="EVENT"):
"""This function will send event packets to the server. This is the
main method you would use to send data from your application to the
server.
Whenever an event is sent to the server, a universally unique event id
... | python | def event(self, event_data, priority="normal", event_method="EVENT"):
"""This function will send event packets to the server. This is the
main method you would use to send data from your application to the
server.
Whenever an event is sent to the server, a universally unique event id
... | [
"def",
"event",
"(",
"self",
",",
"event_data",
",",
"priority",
"=",
"\"normal\"",
",",
"event_method",
"=",
"\"EVENT\"",
")",
":",
"logger",
".",
"debug",
"(",
"\"event: \"",
"+",
"str",
"(",
"event_data",
")",
")",
"# Generate an event UUID for this event",
... | This function will send event packets to the server. This is the
main method you would use to send data from your application to the
server.
Whenever an event is sent to the server, a universally unique event id
(euuid) is created for each event and stored in the "event_uuids"
d... | [
"This",
"function",
"will",
"send",
"event",
"packets",
"to",
"the",
"server",
".",
"This",
"is",
"the",
"main",
"method",
"you",
"would",
"use",
"to",
"send",
"data",
"from",
"your",
"application",
"to",
"the",
"server",
"."
] | 1a8c976eb2beeca0a5a272a34ac58b2c114495a4 | https://github.com/ShadowBlip/Neteria/blob/1a8c976eb2beeca0a5a272a34ac58b2c114495a4/neteria/client.py#L411-L487 | train | This function sends an event to the server. |
ShadowBlip/Neteria | neteria/client.py | NeteriaClient.legal_check | def legal_check(self, message):
"""This method handles event legality check messages from the server.
Args:
message (dict): The unserialized legality dictionary received from
the server.
Returns:
None
Examples:
>>> message
"""
... | python | def legal_check(self, message):
"""This method handles event legality check messages from the server.
Args:
message (dict): The unserialized legality dictionary received from
the server.
Returns:
None
Examples:
>>> message
"""
... | [
"def",
"legal_check",
"(",
"self",
",",
"message",
")",
":",
"# If the event was legal, remove it from our event buffer",
"if",
"message",
"[",
"\"method\"",
"]",
"==",
"\"LEGAL\"",
":",
"logger",
".",
"debug",
"(",
"\"<%s> <euuid:%s> Event LEGAL\"",
"%",
"(",
"str",
... | This method handles event legality check messages from the server.
Args:
message (dict): The unserialized legality dictionary received from
the server.
Returns:
None
Examples:
>>> message | [
"This",
"method",
"handles",
"event",
"legality",
"check",
"messages",
"from",
"the",
"server",
"."
] | 1a8c976eb2beeca0a5a272a34ac58b2c114495a4 | https://github.com/ShadowBlip/Neteria/blob/1a8c976eb2beeca0a5a272a34ac58b2c114495a4/neteria/client.py#L490-L543 | train | This method handles the event legality check messages from the server. |
lsst-sqre/documenteer | documenteer/sphinxext/lssttasks/topics.py | BaseTopicDirective.run | def run(self):
"""Main entrypoint method.
Returns
-------
new_nodes : `list`
Nodes to add to the doctree.
"""
env = self.state.document.settings.env
try:
class_name = self.arguments[0]
except IndexError:
raise SphinxEr... | python | def run(self):
"""Main entrypoint method.
Returns
-------
new_nodes : `list`
Nodes to add to the doctree.
"""
env = self.state.document.settings.env
try:
class_name = self.arguments[0]
except IndexError:
raise SphinxEr... | [
"def",
"run",
"(",
"self",
")",
":",
"env",
"=",
"self",
".",
"state",
".",
"document",
".",
"settings",
".",
"env",
"try",
":",
"class_name",
"=",
"self",
".",
"arguments",
"[",
"0",
"]",
"except",
"IndexError",
":",
"raise",
"SphinxError",
"(",
"'{... | Main entrypoint method.
Returns
-------
new_nodes : `list`
Nodes to add to the doctree. | [
"Main",
"entrypoint",
"method",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/topics.py#L42-L81 | train | Main entrypoint method. |
potash/drain | drain/model.py | y_score | def y_score(estimator, X):
"""
Score examples from a new matrix X
Args:
estimator: an sklearn estimator object
X: design matrix with the same features that the estimator was trained on
Returns: a vector of scores of the same length as X
Note that estimator.predict_proba is preferre... | python | def y_score(estimator, X):
"""
Score examples from a new matrix X
Args:
estimator: an sklearn estimator object
X: design matrix with the same features that the estimator was trained on
Returns: a vector of scores of the same length as X
Note that estimator.predict_proba is preferre... | [
"def",
"y_score",
"(",
"estimator",
",",
"X",
")",
":",
"try",
":",
"y",
"=",
"estimator",
".",
"predict_proba",
"(",
"X",
")",
"return",
"y",
"[",
":",
",",
"1",
"]",
"except",
"(",
"AttributeError",
")",
":",
"return",
"estimator",
".",
"decision_f... | Score examples from a new matrix X
Args:
estimator: an sklearn estimator object
X: design matrix with the same features that the estimator was trained on
Returns: a vector of scores of the same length as X
Note that estimator.predict_proba is preferred but when unavailable
(e.g. SVM wi... | [
"Score",
"examples",
"from",
"a",
"new",
"matrix",
"X",
"Args",
":",
"estimator",
":",
"an",
"sklearn",
"estimator",
"object",
"X",
":",
"design",
"matrix",
"with",
"the",
"same",
"features",
"that",
"the",
"estimator",
"was",
"trained",
"on"
] | ddd62081cb9317beb5d21f86c8b4bb196ca3d222 | https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/model.py#L164-L180 | train | Returns the score examples from a new matrix X |
potash/drain | drain/model.py | y_subset | def y_subset(y, query=None, aux=None, subset=None, dropna=False, outcome='true',
k=None, p=None, ascending=False, score='score', p_of='notnull'):
"""
Subset a model "y" dataframe
Args:
query: operates on y, or aux if present
subset: takes a dataframe or index thereof and subsets... | python | def y_subset(y, query=None, aux=None, subset=None, dropna=False, outcome='true',
k=None, p=None, ascending=False, score='score', p_of='notnull'):
"""
Subset a model "y" dataframe
Args:
query: operates on y, or aux if present
subset: takes a dataframe or index thereof and subsets... | [
"def",
"y_subset",
"(",
"y",
",",
"query",
"=",
"None",
",",
"aux",
"=",
"None",
",",
"subset",
"=",
"None",
",",
"dropna",
"=",
"False",
",",
"outcome",
"=",
"'true'",
",",
"k",
"=",
"None",
",",
"p",
"=",
"None",
",",
"ascending",
"=",
"False",... | Subset a model "y" dataframe
Args:
query: operates on y, or aux if present
subset: takes a dataframe or index thereof and subsets to that
dropna: means drop missing outcomes
return: top k (count) or p (proportion) if specified
p_of: specifies what the proportion is relative t... | [
"Subset",
"a",
"model",
"y",
"dataframe",
"Args",
":",
"query",
":",
"operates",
"on",
"y",
"or",
"aux",
"if",
"present",
"subset",
":",
"takes",
"a",
"dataframe",
"or",
"index",
"thereof",
"and",
"subsets",
"to",
"that",
"dropna",
":",
"means",
"drop",
... | ddd62081cb9317beb5d21f86c8b4bb196ca3d222 | https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/model.py#L242-L292 | train | Subset a model y dataframe or aux dataframe |
potash/drain | drain/model.py | perturb | def perturb(estimator, X, bins, columns=None):
"""
Predict on peturbations of a feature vector
estimator: a fitted sklearn estimator
index: the index of the example to perturb
bins: a dictionary of column:bins arrays
columns: list of columns if bins doesn't cover all columns
TODO make this w... | python | def perturb(estimator, X, bins, columns=None):
"""
Predict on peturbations of a feature vector
estimator: a fitted sklearn estimator
index: the index of the example to perturb
bins: a dictionary of column:bins arrays
columns: list of columns if bins doesn't cover all columns
TODO make this w... | [
"def",
"perturb",
"(",
"estimator",
",",
"X",
",",
"bins",
",",
"columns",
"=",
"None",
")",
":",
"if",
"columns",
"is",
"None",
":",
"if",
"len",
"(",
"bins",
")",
"!=",
"X",
".",
"shape",
"[",
"1",
"]",
":",
"raise",
"ValueError",
"(",
"\"Must ... | Predict on peturbations of a feature vector
estimator: a fitted sklearn estimator
index: the index of the example to perturb
bins: a dictionary of column:bins arrays
columns: list of columns if bins doesn't cover all columns
TODO make this work when index is multiple rows | [
"Predict",
"on",
"peturbations",
"of",
"a",
"feature",
"vector",
"estimator",
":",
"a",
"fitted",
"sklearn",
"estimator",
"index",
":",
"the",
"index",
"of",
"the",
"example",
"to",
"perturb",
"bins",
":",
"a",
"dictionary",
"of",
"column",
":",
"bins",
"a... | ddd62081cb9317beb5d21f86c8b4bb196ca3d222 | https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/model.py#L394-L424 | train | Predict on peturbations of a feature vector X. |
thorgate/django-esteid | esteid/generic.py | GenericDigitalSignViewMixin.destroy_digidoc_session | def destroy_digidoc_session(self):
""" Closes DigiDocService session and clears request.session[I{DIGIDOC_SESSION_KEY}]
"""
# cleanup data too
self.destroy_digidoc_session_data()
try:
session = self.request.session[self.DIGIDOC_SESSION_KEY]
if session:
... | python | def destroy_digidoc_session(self):
""" Closes DigiDocService session and clears request.session[I{DIGIDOC_SESSION_KEY}]
"""
# cleanup data too
self.destroy_digidoc_session_data()
try:
session = self.request.session[self.DIGIDOC_SESSION_KEY]
if session:
... | [
"def",
"destroy_digidoc_session",
"(",
"self",
")",
":",
"# cleanup data too",
"self",
".",
"destroy_digidoc_session_data",
"(",
")",
"try",
":",
"session",
"=",
"self",
".",
"request",
".",
"session",
"[",
"self",
".",
"DIGIDOC_SESSION_KEY",
"]",
"if",
"session... | Closes DigiDocService session and clears request.session[I{DIGIDOC_SESSION_KEY}] | [
"Closes",
"DigiDocService",
"session",
"and",
"clears",
"request",
".",
"session",
"[",
"I",
"{",
"DIGIDOC_SESSION_KEY",
"}",
"]"
] | 407ae513e357fedea0e3e42198df8eb9d9ff0646 | https://github.com/thorgate/django-esteid/blob/407ae513e357fedea0e3e42198df8eb9d9ff0646/esteid/generic.py#L47-L69 | train | Closes DigiDocService session and clears request. session [ I { DIGIDOC_SESSION_KEY } ] |
Locu-Unofficial/locu-python | locu/api.py | HttpApiClient._http_request | def _http_request(self, service_type, **kwargs):
"""
Perform an HTTP Request using base_url and parameters
given by kwargs.
Results are expected to be given in JSON format
and are parsed to python data structures.
"""
request_params = urlencode(kwargs)
req... | python | def _http_request(self, service_type, **kwargs):
"""
Perform an HTTP Request using base_url and parameters
given by kwargs.
Results are expected to be given in JSON format
and are parsed to python data structures.
"""
request_params = urlencode(kwargs)
req... | [
"def",
"_http_request",
"(",
"self",
",",
"service_type",
",",
"*",
"*",
"kwargs",
")",
":",
"request_params",
"=",
"urlencode",
"(",
"kwargs",
")",
"request_params",
"=",
"request_params",
".",
"replace",
"(",
"'%28'",
",",
"''",
")",
".",
"replace",
"(",... | Perform an HTTP Request using base_url and parameters
given by kwargs.
Results are expected to be given in JSON format
and are parsed to python data structures. | [
"Perform",
"an",
"HTTP",
"Request",
"using",
"base_url",
"and",
"parameters",
"given",
"by",
"kwargs",
".",
"Results",
"are",
"expected",
"to",
"be",
"given",
"in",
"JSON",
"format",
"and",
"are",
"parsed",
"to",
"python",
"data",
"structures",
"."
] | fcdf136b68333ab7055e623591801dd35df3bc45 | https://github.com/Locu-Unofficial/locu-python/blob/fcdf136b68333ab7055e623591801dd35df3bc45/locu/api.py#L46-L59 | train | Perform an HTTP Request using base_url and parameters
|
Locu-Unofficial/locu-python | locu/api.py | VenueApiClient.search | def search(self, category = None, cuisine = None, location = (None, None), radius = None, tl_coord = (None, None), \
br_coord = (None, None), name = None, country = None, locality = None, \
region = None, postal_code = None, street_address = None,\
website_url = ... | python | def search(self, category = None, cuisine = None, location = (None, None), radius = None, tl_coord = (None, None), \
br_coord = (None, None), name = None, country = None, locality = None, \
region = None, postal_code = None, street_address = None,\
website_url = ... | [
"def",
"search",
"(",
"self",
",",
"category",
"=",
"None",
",",
"cuisine",
"=",
"None",
",",
"location",
"=",
"(",
"None",
",",
"None",
")",
",",
"radius",
"=",
"None",
",",
"tl_coord",
"=",
"(",
"None",
",",
"None",
")",
",",
"br_coord",
"=",
"... | Locu Venue Search API Call Wrapper
Args:
*Note that none of the arguments are required
category : List of category types that need to be filtered by: ['restaurant', 'spa', 'beauty salon', 'gym', 'laundry', 'hair care', 'other']
type : [string]
cuisine ... | [
"Locu",
"Venue",
"Search",
"API",
"Call",
"Wrapper"
] | fcdf136b68333ab7055e623591801dd35df3bc45 | https://github.com/Locu-Unofficial/locu-python/blob/fcdf136b68333ab7055e623591801dd35df3bc45/locu/api.py#L147-L199 | train | Search for venue in the specified category cuisine location radius and return the list of venue objects |
Locu-Unofficial/locu-python | locu/api.py | VenueApiClient.search_next | def search_next(self, obj):
"""
Takes the dictionary that is returned by 'search' or 'search_next' function and gets the next batch of results
Args:
obj: dictionary returned by the 'search' or 'search_next' function
Returns:
A dictionary with a data returned by the... | python | def search_next(self, obj):
"""
Takes the dictionary that is returned by 'search' or 'search_next' function and gets the next batch of results
Args:
obj: dictionary returned by the 'search' or 'search_next' function
Returns:
A dictionary with a data returned by the... | [
"def",
"search_next",
"(",
"self",
",",
"obj",
")",
":",
"if",
"'meta'",
"in",
"obj",
"and",
"'next'",
"in",
"obj",
"[",
"'meta'",
"]",
"and",
"obj",
"[",
"'meta'",
"]",
"[",
"'next'",
"]",
"!=",
"None",
":",
"uri",
"=",
"self",
".",
"api_url",
"... | Takes the dictionary that is returned by 'search' or 'search_next' function and gets the next batch of results
Args:
obj: dictionary returned by the 'search' or 'search_next' function
Returns:
A dictionary with a data returned by the server
Raises:
HttpException... | [
"Takes",
"the",
"dictionary",
"that",
"is",
"returned",
"by",
"search",
"or",
"search_next",
"function",
"and",
"gets",
"the",
"next",
"batch",
"of",
"results"
] | fcdf136b68333ab7055e623591801dd35df3bc45 | https://github.com/Locu-Unofficial/locu-python/blob/fcdf136b68333ab7055e623591801dd35df3bc45/locu/api.py#L201-L222 | train | Returns the next batch of results from the server |
Locu-Unofficial/locu-python | locu/api.py | VenueApiClient.get_details | def get_details(self, ids):
"""
Locu Venue Details API Call Wrapper
Args:
list of ids : ids of a particular venues to get insights about. Can process up to 5 ids
"""
if isinstance(ids, list):
if len(ids) > 5:
ids = ids[:5]
... | python | def get_details(self, ids):
"""
Locu Venue Details API Call Wrapper
Args:
list of ids : ids of a particular venues to get insights about. Can process up to 5 ids
"""
if isinstance(ids, list):
if len(ids) > 5:
ids = ids[:5]
... | [
"def",
"get_details",
"(",
"self",
",",
"ids",
")",
":",
"if",
"isinstance",
"(",
"ids",
",",
"list",
")",
":",
"if",
"len",
"(",
"ids",
")",
">",
"5",
":",
"ids",
"=",
"ids",
"[",
":",
"5",
"]",
"id_param",
"=",
"';'",
".",
"join",
"(",
"ids... | Locu Venue Details API Call Wrapper
Args:
list of ids : ids of a particular venues to get insights about. Can process up to 5 ids | [
"Locu",
"Venue",
"Details",
"API",
"Call",
"Wrapper"
] | fcdf136b68333ab7055e623591801dd35df3bc45 | https://github.com/Locu-Unofficial/locu-python/blob/fcdf136b68333ab7055e623591801dd35df3bc45/locu/api.py#L280-L302 | train | Wrapper for the Locu Venue Details API call Wrapper for the get_details API call. |
Locu-Unofficial/locu-python | locu/api.py | VenueApiClient.get_menus | def get_menus(self, id):
"""
Given a venue id returns a list of menus associated with a venue
"""
resp = self.get_details([id])
menus = []
for obj in resp['objects']:
if obj['has_menu']:
menus += obj['menus']
return menus | python | def get_menus(self, id):
"""
Given a venue id returns a list of menus associated with a venue
"""
resp = self.get_details([id])
menus = []
for obj in resp['objects']:
if obj['has_menu']:
menus += obj['menus']
return menus | [
"def",
"get_menus",
"(",
"self",
",",
"id",
")",
":",
"resp",
"=",
"self",
".",
"get_details",
"(",
"[",
"id",
"]",
")",
"menus",
"=",
"[",
"]",
"for",
"obj",
"in",
"resp",
"[",
"'objects'",
"]",
":",
"if",
"obj",
"[",
"'has_menu'",
"]",
":",
"... | Given a venue id returns a list of menus associated with a venue | [
"Given",
"a",
"venue",
"id",
"returns",
"a",
"list",
"of",
"menus",
"associated",
"with",
"a",
"venue"
] | fcdf136b68333ab7055e623591801dd35df3bc45 | https://github.com/Locu-Unofficial/locu-python/blob/fcdf136b68333ab7055e623591801dd35df3bc45/locu/api.py#L304-L314 | train | Given a venue id returns a list of menus associated with a venue |
Locu-Unofficial/locu-python | locu/api.py | VenueApiClient.is_open | def is_open(self,id,time,day):
"""
Checks if the venue is open at the time of day given a venue id.
args:
id: string of venue id
time: string of the format ex: "12:00:00"
day: string of weekday ex: "Monday"
returns:
... | python | def is_open(self,id,time,day):
"""
Checks if the venue is open at the time of day given a venue id.
args:
id: string of venue id
time: string of the format ex: "12:00:00"
day: string of weekday ex: "Monday"
returns:
... | [
"def",
"is_open",
"(",
"self",
",",
"id",
",",
"time",
",",
"day",
")",
":",
"details",
"=",
"self",
".",
"get_details",
"(",
"id",
")",
"has_data",
"=",
"False",
"for",
"obj",
"in",
"details",
"[",
"\"objects\"",
"]",
":",
"hours",
"=",
"obj",
"["... | Checks if the venue is open at the time of day given a venue id.
args:
id: string of venue id
time: string of the format ex: "12:00:00"
day: string of weekday ex: "Monday"
returns:
Bool if there is hours data available
... | [
"Checks",
"if",
"the",
"venue",
"is",
"open",
"at",
"the",
"time",
"of",
"day",
"given",
"a",
"venue",
"id",
"."
] | fcdf136b68333ab7055e623591801dd35df3bc45 | https://github.com/Locu-Unofficial/locu-python/blob/fcdf136b68333ab7055e623591801dd35df3bc45/locu/api.py#L316-L356 | train | Checks if a venue is open at the time of day given a venue id. |
Locu-Unofficial/locu-python | locu/api.py | MenuItemApiClient.search | def search(self, name = None, category = None, description = None, price = None, \
price__gt = None, price__gte = None, price__lt = None, price__lte = None, \
location = (None, None), radius = None, tl_coord = (None, None), \
br_coord = (None, None), country = No... | python | def search(self, name = None, category = None, description = None, price = None, \
price__gt = None, price__gte = None, price__lt = None, price__lte = None, \
location = (None, None), radius = None, tl_coord = (None, None), \
br_coord = (None, None), country = No... | [
"def",
"search",
"(",
"self",
",",
"name",
"=",
"None",
",",
"category",
"=",
"None",
",",
"description",
"=",
"None",
",",
"price",
"=",
"None",
",",
"price__gt",
"=",
"None",
",",
"price__gte",
"=",
"None",
",",
"price__lt",
"=",
"None",
",",
"pric... | Locu Menu Item Search API Call Wrapper
Args:
*Note that none of the arguments are required
category : List of category types that need to be filtered by: ['restaurant', 'spa', 'beauty salon', 'gym', 'laundry', 'hair care', 'other']
type : [string]
loc... | [
"Locu",
"Menu",
"Item",
"Search",
"API",
"Call",
"Wrapper"
] | fcdf136b68333ab7055e623591801dd35df3bc45 | https://github.com/Locu-Unofficial/locu-python/blob/fcdf136b68333ab7055e623591801dd35df3bc45/locu/api.py#L366-L428 | train | Search for menu items in the specified location. |
lsst-sqre/documenteer | documenteer/stackdocs/stackcli.py | main | def main(ctx, root_project_dir, verbose):
"""stack-docs is a CLI for building LSST Stack documentation, such as
pipelines.lsst.io.
This command should be run on the "main" documentation repository, namely
https://github.com/lsst/pipelines_lsst_io.
The stack-docs command replaces the usual Makefile... | python | def main(ctx, root_project_dir, verbose):
"""stack-docs is a CLI for building LSST Stack documentation, such as
pipelines.lsst.io.
This command should be run on the "main" documentation repository, namely
https://github.com/lsst/pipelines_lsst_io.
The stack-docs command replaces the usual Makefile... | [
"def",
"main",
"(",
"ctx",
",",
"root_project_dir",
",",
"verbose",
")",
":",
"root_project_dir",
"=",
"discover_conf_py_directory",
"(",
"root_project_dir",
")",
"# Subcommands should use the click.pass_obj decorator to get this",
"# ctx.obj object as the first argument.",
"ctx"... | stack-docs is a CLI for building LSST Stack documentation, such as
pipelines.lsst.io.
This command should be run on the "main" documentation repository, namely
https://github.com/lsst/pipelines_lsst_io.
The stack-docs command replaces the usual Makefile and sphinx-build system
for Sphinx projects.... | [
"stack",
"-",
"docs",
"is",
"a",
"CLI",
"for",
"building",
"LSST",
"Stack",
"documentation",
"such",
"as",
"pipelines",
".",
"lsst",
".",
"io",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/stackdocs/stackcli.py#L38-L77 | train | This command is used to build the LSST Stack documentation. |
lsst-sqre/documenteer | documenteer/stackdocs/stackcli.py | help | def help(ctx, topic, **kw):
"""Show help for any command.
"""
# The help command implementation is taken from
# https://www.burgundywall.com/post/having-click-help-subcommand
if topic is None:
click.echo(ctx.parent.get_help())
else:
click.echo(main.commands[topic].get_help(ctx)) | python | def help(ctx, topic, **kw):
"""Show help for any command.
"""
# The help command implementation is taken from
# https://www.burgundywall.com/post/having-click-help-subcommand
if topic is None:
click.echo(ctx.parent.get_help())
else:
click.echo(main.commands[topic].get_help(ctx)) | [
"def",
"help",
"(",
"ctx",
",",
"topic",
",",
"*",
"*",
"kw",
")",
":",
"# The help command implementation is taken from",
"# https://www.burgundywall.com/post/having-click-help-subcommand",
"if",
"topic",
"is",
"None",
":",
"click",
".",
"echo",
"(",
"ctx",
".",
"p... | Show help for any command. | [
"Show",
"help",
"for",
"any",
"command",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/stackdocs/stackcli.py#L83-L91 | train | Show help for any command. |
lsst-sqre/documenteer | documenteer/stackdocs/stackcli.py | build | def build(ctx, skip):
"""Build documentation as HTML.
This command performs these steps:
1. Removes any existing symlinks in the ``modules``, ``packages``, and
``_static`` directories.
2. Finds packages set up by EUPS that have Sphinx-enabled doc/ directories
and links their module and ... | python | def build(ctx, skip):
"""Build documentation as HTML.
This command performs these steps:
1. Removes any existing symlinks in the ``modules``, ``packages``, and
``_static`` directories.
2. Finds packages set up by EUPS that have Sphinx-enabled doc/ directories
and links their module and ... | [
"def",
"build",
"(",
"ctx",
",",
"skip",
")",
":",
"return_code",
"=",
"build_stack_docs",
"(",
"ctx",
".",
"obj",
"[",
"'root_project_dir'",
"]",
",",
"skippedNames",
"=",
"skip",
")",
"if",
"return_code",
">",
"0",
":",
"sys",
".",
"exit",
"(",
"retu... | Build documentation as HTML.
This command performs these steps:
1. Removes any existing symlinks in the ``modules``, ``packages``, and
``_static`` directories.
2. Finds packages set up by EUPS that have Sphinx-enabled doc/ directories
and links their module and package directories into the
... | [
"Build",
"documentation",
"as",
"HTML",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/stackdocs/stackcli.py#L102-L129 | train | Build documentation as HTML. |
lsst-sqre/documenteer | documenteer/stackdocs/stackcli.py | clean | def clean(ctx):
"""Clean Sphinx build products.
Use this command to clean out build products after a failed build, or
in preparation for running a build from a clean state.
This command removes the following directories from the
``pipelines_lsst_io`` directory:
- ``_build`` (the Sphinx build ... | python | def clean(ctx):
"""Clean Sphinx build products.
Use this command to clean out build products after a failed build, or
in preparation for running a build from a clean state.
This command removes the following directories from the
``pipelines_lsst_io`` directory:
- ``_build`` (the Sphinx build ... | [
"def",
"clean",
"(",
"ctx",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"dirnames",
"=",
"[",
"'py-api'",
",",
"'_build'",
",",
"'modules'",
",",
"'packages'",
"]",
"dirnames",
"=",
"[",
"os",
".",
"path",
".",
"join",
... | Clean Sphinx build products.
Use this command to clean out build products after a failed build, or
in preparation for running a build from a clean state.
This command removes the following directories from the
``pipelines_lsst_io`` directory:
- ``_build`` (the Sphinx build itself)
- ``modules... | [
"Clean",
"Sphinx",
"build",
"products",
"."
] | 75f02901a80042b28d074df1cc1dca32eb8e38c8 | https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/stackdocs/stackcli.py#L134-L158 | train | Clean Sphinx build products. |
ehansis/ozelot | examples/leonardo/leonardo/kvstore/models.py | Entity.query_with_attributes | def query_with_attributes(type_to_query, client):
"""Query all entities of a specific type, with their attributes
Args:
type_to_query (str): type of entity to query
client: DB client to perform query with
Returns:
pandas.DataFrame: table of entities, with at... | python | def query_with_attributes(type_to_query, client):
"""Query all entities of a specific type, with their attributes
Args:
type_to_query (str): type of entity to query
client: DB client to perform query with
Returns:
pandas.DataFrame: table of entities, with at... | [
"def",
"query_with_attributes",
"(",
"type_to_query",
",",
"client",
")",
":",
"session",
"=",
"client",
".",
"create_session",
"(",
")",
"# query all data",
"query",
"=",
"session",
".",
"query",
"(",
"Attribute",
".",
"name",
",",
"Attribute",
".",
"value",
... | Query all entities of a specific type, with their attributes
Args:
type_to_query (str): type of entity to query
client: DB client to perform query with
Returns:
pandas.DataFrame: table of entities, with attributes as columns | [
"Query",
"all",
"entities",
"of",
"a",
"specific",
"type",
"with",
"their",
"attributes"
] | 948675e02eb6fca940450f5cb814f53e97159e5b | https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/leonardo/leonardo/kvstore/models.py#L18-L50 | train | Query all entities of a specific type with their attributes as columns |
mojaie/chorus | chorus/topology.py | recognize_nx | def recognize_nx(mol):
""" NetworkX implementation (for comparison)"""
mol.rings = nx.cycle_basis(mol.graph)
mol.isolated = sorted(nx.connected_components(mol.graph),
key=len, reverse=True)[1:]
mol.scaffolds = [x for x in nx.biconnected_components(mol.graph)
... | python | def recognize_nx(mol):
""" NetworkX implementation (for comparison)"""
mol.rings = nx.cycle_basis(mol.graph)
mol.isolated = sorted(nx.connected_components(mol.graph),
key=len, reverse=True)[1:]
mol.scaffolds = [x for x in nx.biconnected_components(mol.graph)
... | [
"def",
"recognize_nx",
"(",
"mol",
")",
":",
"mol",
".",
"rings",
"=",
"nx",
".",
"cycle_basis",
"(",
"mol",
".",
"graph",
")",
"mol",
".",
"isolated",
"=",
"sorted",
"(",
"nx",
".",
"connected_components",
"(",
"mol",
".",
"graph",
")",
",",
"key",
... | NetworkX implementation (for comparison) | [
"NetworkX",
"implementation",
"(",
"for",
"comparison",
")"
] | fc7fe23a0272554c67671645ab07830b315eeb1b | https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/topology.py#L12-L18 | train | Recognize NetworkX implementation. |
mojaie/chorus | chorus/topology.py | recognize | def recognize(mol):
""" Detect cycle basis, biconnected and isolated components (DFS).
This will add following attribute to the molecule instance object.
mol.ring: Cycle basis
mol.scaffold: biconnected components
mol.isolated: isolated components other than the largest one
To find minimum set ... | python | def recognize(mol):
""" Detect cycle basis, biconnected and isolated components (DFS).
This will add following attribute to the molecule instance object.
mol.ring: Cycle basis
mol.scaffold: biconnected components
mol.isolated: isolated components other than the largest one
To find minimum set ... | [
"def",
"recognize",
"(",
"mol",
")",
":",
"g",
"=",
"set",
"(",
"i",
"for",
"i",
",",
"_",
"in",
"mol",
".",
"atoms_iter",
"(",
")",
")",
"bccs",
"=",
"{",
"}",
"# BiConnected Components",
"isoc",
"=",
"[",
"]",
"# ISOlated Components",
"while",
"g",... | Detect cycle basis, biconnected and isolated components (DFS).
This will add following attribute to the molecule instance object.
mol.ring: Cycle basis
mol.scaffold: biconnected components
mol.isolated: isolated components other than the largest one
To find minimum set of rings, additionally execu... | [
"Detect",
"cycle",
"basis",
"biconnected",
"and",
"isolated",
"components",
"(",
"DFS",
")",
".",
"This",
"will",
"add",
"following",
"attribute",
"to",
"the",
"molecule",
"instance",
"object",
"."
] | fc7fe23a0272554c67671645ab07830b315eeb1b | https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/topology.py#L21-L81 | train | Detect cycle basis biconnected and isolated components. |
mojaie/chorus | chorus/topology.py | minify_ring | def minify_ring(mol, verbose=False):
""" Minify ring set (similar to SSSR)
Limitation: this can not correctly recognize minimum rings
in the case of non-outerplanar graph.
Note: concept of SSSR is controversial. Roughly reduce the size of
cycle basis can help some scaffold-based analysis
"""
... | python | def minify_ring(mol, verbose=False):
""" Minify ring set (similar to SSSR)
Limitation: this can not correctly recognize minimum rings
in the case of non-outerplanar graph.
Note: concept of SSSR is controversial. Roughly reduce the size of
cycle basis can help some scaffold-based analysis
"""
... | [
"def",
"minify_ring",
"(",
"mol",
",",
"verbose",
"=",
"False",
")",
":",
"mol",
".",
"require",
"(",
"\"Topology\"",
")",
"for",
"cyc_idx",
"in",
"mol",
".",
"scaffolds",
":",
"rings",
"=",
"deque",
"(",
"sorted",
"(",
"[",
"mol",
".",
"rings",
"[",... | Minify ring set (similar to SSSR)
Limitation: this can not correctly recognize minimum rings
in the case of non-outerplanar graph.
Note: concept of SSSR is controversial. Roughly reduce the size of
cycle basis can help some scaffold-based analysis | [
"Minify",
"ring",
"set",
"(",
"similar",
"to",
"SSSR",
")",
"Limitation",
":",
"this",
"can",
"not",
"correctly",
"recognize",
"minimum",
"rings",
"in",
"the",
"case",
"of",
"non",
"-",
"outerplanar",
"graph",
".",
"Note",
":",
"concept",
"of",
"SSSR",
"... | fc7fe23a0272554c67671645ab07830b315eeb1b | https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/topology.py#L84-L122 | train | Minifies the minimum rings in a single SSSR graph. |
zsimic/runez | src/runez/serialize.py | same_type | def same_type(t1, t2):
"""
:return bool: True if 't1' and 't2' are of equivalent types
"""
if isinstance(t1, string_type) and isinstance(t2, string_type):
return True
return type(t1) == type(t2) | python | def same_type(t1, t2):
"""
:return bool: True if 't1' and 't2' are of equivalent types
"""
if isinstance(t1, string_type) and isinstance(t2, string_type):
return True
return type(t1) == type(t2) | [
"def",
"same_type",
"(",
"t1",
",",
"t2",
")",
":",
"if",
"isinstance",
"(",
"t1",
",",
"string_type",
")",
"and",
"isinstance",
"(",
"t2",
",",
"string_type",
")",
":",
"return",
"True",
"return",
"type",
"(",
"t1",
")",
"==",
"type",
"(",
"t2",
"... | :return bool: True if 't1' and 't2' are of equivalent types | [
":",
"return",
"bool",
":",
"True",
"if",
"t1",
"and",
"t2",
"are",
"of",
"equivalent",
"types"
] | 14363b719a1aae1528859a501a22d075ce0abfcc | https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/serialize.py#L32-L39 | train | Returns True if t1 and t2 are of equivalent types. |
zsimic/runez | src/runez/serialize.py | read_json | def read_json(path, default=None, fatal=True, logger=None):
"""
:param str|None path: Path to file to deserialize
:param dict|list|None default: Default if file is not present, or if it's not json
:param bool|None fatal: Abort execution on failure if True
:param callable|None logger: Logger to use
... | python | def read_json(path, default=None, fatal=True, logger=None):
"""
:param str|None path: Path to file to deserialize
:param dict|list|None default: Default if file is not present, or if it's not json
:param bool|None fatal: Abort execution on failure if True
:param callable|None logger: Logger to use
... | [
"def",
"read_json",
"(",
"path",
",",
"default",
"=",
"None",
",",
"fatal",
"=",
"True",
",",
"logger",
"=",
"None",
")",
":",
"path",
"=",
"resolved_path",
"(",
"path",
")",
"if",
"not",
"path",
"or",
"not",
"os",
".",
"path",
".",
"exists",
"(",
... | :param str|None path: Path to file to deserialize
:param dict|list|None default: Default if file is not present, or if it's not json
:param bool|None fatal: Abort execution on failure if True
:param callable|None logger: Logger to use
:return dict|list: Deserialized data from file | [
":",
"param",
"str|None",
"path",
":",
"Path",
"to",
"file",
"to",
"deserialize",
":",
"param",
"dict|list|None",
"default",
":",
"Default",
"if",
"file",
"is",
"not",
"present",
"or",
"if",
"it",
"s",
"not",
"json",
":",
"param",
"bool|None",
"fatal",
"... | 14363b719a1aae1528859a501a22d075ce0abfcc | https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/serialize.py#L144-L170 | train | Reads the json file at the specified path and returns the dict or list of dicts |
zsimic/runez | src/runez/serialize.py | save_json | def save_json(data, path, fatal=True, logger=None, sort_keys=True, indent=2, **kwargs):
"""
Args:
data (object | None): Data to serialize and save
path (str | None): Path to file where to save
fatal (bool | None): Abort execution on failure if True
logger (callable | None): Logge... | python | def save_json(data, path, fatal=True, logger=None, sort_keys=True, indent=2, **kwargs):
"""
Args:
data (object | None): Data to serialize and save
path (str | None): Path to file where to save
fatal (bool | None): Abort execution on failure if True
logger (callable | None): Logge... | [
"def",
"save_json",
"(",
"data",
",",
"path",
",",
"fatal",
"=",
"True",
",",
"logger",
"=",
"None",
",",
"sort_keys",
"=",
"True",
",",
"indent",
"=",
"2",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"data",
"is",
"None",
"or",
"not",
"path",
":",
... | Args:
data (object | None): Data to serialize and save
path (str | None): Path to file where to save
fatal (bool | None): Abort execution on failure if True
logger (callable | None): Logger to use
sort_keys (bool): Save json with sorted keys
indent (int): Indentation to u... | [
"Args",
":",
"data",
"(",
"object",
"|",
"None",
")",
":",
"Data",
"to",
"serialize",
"and",
"save",
"path",
"(",
"str",
"|",
"None",
")",
":",
"Path",
"to",
"file",
"where",
"to",
"save",
"fatal",
"(",
"bool",
"|",
"None",
")",
":",
"Abort",
"ex... | 14363b719a1aae1528859a501a22d075ce0abfcc | https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/serialize.py#L173-L213 | train | Save the data to a JSON file. |
zsimic/runez | src/runez/serialize.py | Serializable.from_json | def from_json(cls, path, fatal=True, logger=None):
"""
:param str path: Path to json file
:param bool|None fatal: Abort execution on failure if True
:param callable|None logger: Logger to use
:return: Deserialized object
"""
result = cls()
result.load(path... | python | def from_json(cls, path, fatal=True, logger=None):
"""
:param str path: Path to json file
:param bool|None fatal: Abort execution on failure if True
:param callable|None logger: Logger to use
:return: Deserialized object
"""
result = cls()
result.load(path... | [
"def",
"from_json",
"(",
"cls",
",",
"path",
",",
"fatal",
"=",
"True",
",",
"logger",
"=",
"None",
")",
":",
"result",
"=",
"cls",
"(",
")",
"result",
".",
"load",
"(",
"path",
",",
"fatal",
"=",
"fatal",
",",
"logger",
"=",
"logger",
")",
"retu... | :param str path: Path to json file
:param bool|None fatal: Abort execution on failure if True
:param callable|None logger: Logger to use
:return: Deserialized object | [
":",
"param",
"str",
"path",
":",
"Path",
"to",
"json",
"file",
":",
"param",
"bool|None",
"fatal",
":",
"Abort",
"execution",
"on",
"failure",
"if",
"True",
":",
"param",
"callable|None",
"logger",
":",
"Logger",
"to",
"use",
":",
"return",
":",
"Deseri... | 14363b719a1aae1528859a501a22d075ce0abfcc | https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/serialize.py#L51-L60 | train | Deserializes a set of key - value pairs from a json file. |
zsimic/runez | src/runez/serialize.py | Serializable.set_from_dict | def set_from_dict(self, data, source=None):
"""
:param dict data: Set this object from deserialized 'dict'
:param source: Source where 'data' came from (optional)
"""
if source:
self._source = source
if not data:
return
for key, value in ... | python | def set_from_dict(self, data, source=None):
"""
:param dict data: Set this object from deserialized 'dict'
:param source: Source where 'data' came from (optional)
"""
if source:
self._source = source
if not data:
return
for key, value in ... | [
"def",
"set_from_dict",
"(",
"self",
",",
"data",
",",
"source",
"=",
"None",
")",
":",
"if",
"source",
":",
"self",
".",
"_source",
"=",
"source",
"if",
"not",
"data",
":",
"return",
"for",
"key",
",",
"value",
"in",
"data",
".",
"items",
"(",
")"... | :param dict data: Set this object from deserialized 'dict'
:param source: Source where 'data' came from (optional) | [
":",
"param",
"dict",
"data",
":",
"Set",
"this",
"object",
"from",
"deserialized",
"dict",
":",
"param",
"source",
":",
"Source",
"where",
"data",
"came",
"from",
"(",
"optional",
")"
] | 14363b719a1aae1528859a501a22d075ce0abfcc | https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/serialize.py#L62-L86 | train | Set this object from deserialized dictionary data. |
zsimic/runez | src/runez/serialize.py | Serializable.reset | def reset(self):
"""
Reset all fields of this object to class defaults
"""
for name in self.__dict__:
if name.startswith("_"):
continue
attr = getattr(self, name)
setattr(self, name, attr and attr.__class__()) | python | def reset(self):
"""
Reset all fields of this object to class defaults
"""
for name in self.__dict__:
if name.startswith("_"):
continue
attr = getattr(self, name)
setattr(self, name, attr and attr.__class__()) | [
"def",
"reset",
"(",
"self",
")",
":",
"for",
"name",
"in",
"self",
".",
"__dict__",
":",
"if",
"name",
".",
"startswith",
"(",
"\"_\"",
")",
":",
"continue",
"attr",
"=",
"getattr",
"(",
"self",
",",
"name",
")",
"setattr",
"(",
"self",
",",
"name... | Reset all fields of this object to class defaults | [
"Reset",
"all",
"fields",
"of",
"this",
"object",
"to",
"class",
"defaults"
] | 14363b719a1aae1528859a501a22d075ce0abfcc | https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/serialize.py#L88-L97 | train | Reset all the fields of this object to class defaults
|
zsimic/runez | src/runez/serialize.py | Serializable.to_dict | def to_dict(self):
"""
:return dict: This object serialized to a dict
"""
result = {}
for name in self.__dict__:
if name.startswith("_"):
continue
key = name.replace("_", "-")
attr = getattr(self, name)
result[key] ... | python | def to_dict(self):
"""
:return dict: This object serialized to a dict
"""
result = {}
for name in self.__dict__:
if name.startswith("_"):
continue
key = name.replace("_", "-")
attr = getattr(self, name)
result[key] ... | [
"def",
"to_dict",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"for",
"name",
"in",
"self",
".",
"__dict__",
":",
"if",
"name",
".",
"startswith",
"(",
"\"_\"",
")",
":",
"continue",
"key",
"=",
"name",
".",
"replace",
"(",
"\"_\"",
",",
"\"-\""... | :return dict: This object serialized to a dict | [
":",
"return",
"dict",
":",
"This",
"object",
"serialized",
"to",
"a",
"dict"
] | 14363b719a1aae1528859a501a22d075ce0abfcc | https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/serialize.py#L99-L112 | train | Returns a dict representation of this object. |
zsimic/runez | src/runez/serialize.py | Serializable.load | def load(self, path=None, fatal=True, logger=None):
"""
:param str|None path: Load this object from file with 'path' (default: self._path)
:param bool|None fatal: Abort execution on failure if True
:param callable|None logger: Logger to use
"""
self.reset()
if pat... | python | def load(self, path=None, fatal=True, logger=None):
"""
:param str|None path: Load this object from file with 'path' (default: self._path)
:param bool|None fatal: Abort execution on failure if True
:param callable|None logger: Logger to use
"""
self.reset()
if pat... | [
"def",
"load",
"(",
"self",
",",
"path",
"=",
"None",
",",
"fatal",
"=",
"True",
",",
"logger",
"=",
"None",
")",
":",
"self",
".",
"reset",
"(",
")",
"if",
"path",
":",
"self",
".",
"_path",
"=",
"path",
"self",
".",
"_source",
"=",
"short",
"... | :param str|None path: Load this object from file with 'path' (default: self._path)
:param bool|None fatal: Abort execution on failure if True
:param callable|None logger: Logger to use | [
":",
"param",
"str|None",
"path",
":",
"Load",
"this",
"object",
"from",
"file",
"with",
"path",
"(",
"default",
":",
"self",
".",
"_path",
")",
":",
"param",
"bool|None",
"fatal",
":",
"Abort",
"execution",
"on",
"failure",
"if",
"True",
":",
"param",
... | 14363b719a1aae1528859a501a22d075ce0abfcc | https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/serialize.py#L114-L129 | train | Load this object from file with path. |
zsimic/runez | src/runez/serialize.py | Serializable.save | def save(self, path=None, fatal=True, logger=None, sort_keys=True, indent=2):
"""
:param str|None path: Save this serializable to file with 'path' (default: self._path)
:param bool|None fatal: Abort execution on failure if True
:param callable|None logger: Logger to use
:param bo... | python | def save(self, path=None, fatal=True, logger=None, sort_keys=True, indent=2):
"""
:param str|None path: Save this serializable to file with 'path' (default: self._path)
:param bool|None fatal: Abort execution on failure if True
:param callable|None logger: Logger to use
:param bo... | [
"def",
"save",
"(",
"self",
",",
"path",
"=",
"None",
",",
"fatal",
"=",
"True",
",",
"logger",
"=",
"None",
",",
"sort_keys",
"=",
"True",
",",
"indent",
"=",
"2",
")",
":",
"path",
"=",
"path",
"or",
"getattr",
"(",
"self",
",",
"\"_path\"",
",... | :param str|None path: Save this serializable to file with 'path' (default: self._path)
:param bool|None fatal: Abort execution on failure if True
:param callable|None logger: Logger to use
:param bool sort_keys: Sort keys
:param int indent: Indentation to use | [
":",
"param",
"str|None",
"path",
":",
"Save",
"this",
"serializable",
"to",
"file",
"with",
"path",
"(",
"default",
":",
"self",
".",
"_path",
")",
":",
"param",
"bool|None",
"fatal",
":",
"Abort",
"execution",
"on",
"failure",
"if",
"True",
":",
"param... | 14363b719a1aae1528859a501a22d075ce0abfcc | https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/serialize.py#L131-L141 | train | Save this object to file with path. |
ehansis/ozelot | examples/eurominder/eurominder/pipeline.py | geojson_polygon_to_mask | def geojson_polygon_to_mask(feature, shape, lat_idx, lon_idx):
"""Convert a GeoJSON polygon feature to a numpy array
Args:
feature (pygeoj.Feature): polygon feature to draw
shape (tuple(int, int)): shape of 2D target numpy array to draw polygon in
lat_idx (func): function converting a l... | python | def geojson_polygon_to_mask(feature, shape, lat_idx, lon_idx):
"""Convert a GeoJSON polygon feature to a numpy array
Args:
feature (pygeoj.Feature): polygon feature to draw
shape (tuple(int, int)): shape of 2D target numpy array to draw polygon in
lat_idx (func): function converting a l... | [
"def",
"geojson_polygon_to_mask",
"(",
"feature",
",",
"shape",
",",
"lat_idx",
",",
"lon_idx",
")",
":",
"import",
"matplotlib",
"# specify 'agg' renderer, Mac renderer does not support what we want to do below",
"matplotlib",
".",
"use",
"(",
"'agg'",
")",
"import",
"ma... | Convert a GeoJSON polygon feature to a numpy array
Args:
feature (pygeoj.Feature): polygon feature to draw
shape (tuple(int, int)): shape of 2D target numpy array to draw polygon in
lat_idx (func): function converting a latitude to the (fractional) row index in the map
lon_idx (func... | [
"Convert",
"a",
"GeoJSON",
"polygon",
"feature",
"to",
"a",
"numpy",
"array"
] | 948675e02eb6fca940450f5cb814f53e97159e5b | https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/eurominder/eurominder/pipeline.py#L549-L637 | train | Convert a GeoJSON polygon feature to a numpy array containing a mask |
ehansis/ozelot | examples/eurominder/eurominder/pipeline.py | NUTS2InputFile.load | def load(self):
"""Load data, from default location
Returns:
pandas.DataFrame: columns 'key' (NUTS2 code), 'name'
"""
# read file, keep all values as strings
df = pd.read_csv(self.input_file,
sep=',',
quotechar='"',
... | python | def load(self):
"""Load data, from default location
Returns:
pandas.DataFrame: columns 'key' (NUTS2 code), 'name'
"""
# read file, keep all values as strings
df = pd.read_csv(self.input_file,
sep=',',
quotechar='"',
... | [
"def",
"load",
"(",
"self",
")",
":",
"# read file, keep all values as strings",
"df",
"=",
"pd",
".",
"read_csv",
"(",
"self",
".",
"input_file",
",",
"sep",
"=",
"','",
",",
"quotechar",
"=",
"'\"'",
",",
"encoding",
"=",
"'utf-8'",
",",
"dtype",
"=",
... | Load data, from default location
Returns:
pandas.DataFrame: columns 'key' (NUTS2 code), 'name' | [
"Load",
"data",
"from",
"default",
"location"
] | 948675e02eb6fca940450f5cb814f53e97159e5b | https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/eurominder/eurominder/pipeline.py#L50-L73 | train | Load data from default location and return as pandas. DataFrame |
ehansis/ozelot | examples/eurominder/eurominder/pipeline.py | EuroStatsInputFile.input_file | def input_file(self):
"""Returns the input file name, with a default relative path
"""
return path.join(path.dirname(__file__), 'data', 'tgs{:s}.tsv'.format(self.number)) | python | def input_file(self):
"""Returns the input file name, with a default relative path
"""
return path.join(path.dirname(__file__), 'data', 'tgs{:s}.tsv'.format(self.number)) | [
"def",
"input_file",
"(",
"self",
")",
":",
"return",
"path",
".",
"join",
"(",
"path",
".",
"dirname",
"(",
"__file__",
")",
",",
"'data'",
",",
"'tgs{:s}.tsv'",
".",
"format",
"(",
"self",
".",
"number",
")",
")"
] | Returns the input file name, with a default relative path | [
"Returns",
"the",
"input",
"file",
"name",
"with",
"a",
"default",
"relative",
"path"
] | 948675e02eb6fca940450f5cb814f53e97159e5b | https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/eurominder/eurominder/pipeline.py#L133-L136 | train | Returns the input file name with a default relative path
|
ehansis/ozelot | examples/eurominder/eurominder/pipeline.py | EuroStatsInputFile.load | def load(self, key_filter=None, header_preproc=None):
"""Load data table from tsv file, from default location
Args:
key_filter (str): additional filter for key column - regex matching
key values to include; None for no filter
header_preproc (func): function to a... | python | def load(self, key_filter=None, header_preproc=None):
"""Load data table from tsv file, from default location
Args:
key_filter (str): additional filter for key column - regex matching
key values to include; None for no filter
header_preproc (func): function to a... | [
"def",
"load",
"(",
"self",
",",
"key_filter",
"=",
"None",
",",
"header_preproc",
"=",
"None",
")",
":",
"# read file, keep all values as strings",
"df",
"=",
"pd",
".",
"read_csv",
"(",
"self",
".",
"input_file",
",",
"sep",
"=",
"'\\t'",
",",
"dtype",
"... | Load data table from tsv file, from default location
Args:
key_filter (str): additional filter for key column - regex matching
key values to include; None for no filter
header_preproc (func): function to apply to column headers to extract year numbers (as strings)
... | [
"Load",
"data",
"table",
"from",
"tsv",
"file",
"from",
"default",
"location"
] | 948675e02eb6fca940450f5cb814f53e97159e5b | https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/eurominder/eurominder/pipeline.py#L138-L179 | train | Load data table from tsv file from default location |
ehansis/ozelot | examples/eurominder/eurominder/pipeline.py | LoadEuroStatsTableBase.clear | def clear(self):
"""Clear output from one (derived) class loader
"""
# mark this task as incomplete
self.mark_incomplete()
# Delete the indicator metadata, this also deletes values by cascading.
#
# NOTE: calling 'delete()' on the query (instead of on the queried... | python | def clear(self):
"""Clear output from one (derived) class loader
"""
# mark this task as incomplete
self.mark_incomplete()
# Delete the indicator metadata, this also deletes values by cascading.
#
# NOTE: calling 'delete()' on the query (instead of on the queried... | [
"def",
"clear",
"(",
"self",
")",
":",
"# mark this task as incomplete",
"self",
".",
"mark_incomplete",
"(",
")",
"# Delete the indicator metadata, this also deletes values by cascading.",
"#",
"# NOTE: calling 'delete()' on the query (instead of on the queried object,",
"# as done he... | Clear output from one (derived) class loader | [
"Clear",
"output",
"from",
"one",
"(",
"derived",
")",
"class",
"loader"
] | 948675e02eb6fca940450f5cb814f53e97159e5b | https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/eurominder/eurominder/pipeline.py#L233-L254 | train | Clear the output from one class loader
|
ehansis/ozelot | examples/eurominder/eurominder/pipeline.py | LoadEuroStatsTableBase.run | def run(self):
"""Load table data to :class:`EuroStatsValue` objects
"""
# -- start documentation include: eurostats-run-1
# create a new indicator metadata object
indicator = models.EuroStatIndicator(
number=self.number,
description=self.description,
... | python | def run(self):
"""Load table data to :class:`EuroStatsValue` objects
"""
# -- start documentation include: eurostats-run-1
# create a new indicator metadata object
indicator = models.EuroStatIndicator(
number=self.number,
description=self.description,
... | [
"def",
"run",
"(",
"self",
")",
":",
"# -- start documentation include: eurostats-run-1",
"# create a new indicator metadata object",
"indicator",
"=",
"models",
".",
"EuroStatIndicator",
"(",
"number",
"=",
"self",
".",
"number",
",",
"description",
"=",
"self",
".",
... | Load table data to :class:`EuroStatsValue` objects | [
"Load",
"table",
"data",
"to",
":",
"class",
":",
"EuroStatsValue",
"objects"
] | 948675e02eb6fca940450f5cb814f53e97159e5b | https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/eurominder/eurominder/pipeline.py#L256-L313 | train | Load table data to objects of the specified class |
ehansis/ozelot | examples/eurominder/eurominder/pipeline.py | ClimateDataInputFile.load | def load(self):
"""Load the climate data as a map
Returns:
dict: {data: masked 3D numpy array containing climate data per month (first axis),
lat_idx: function converting a latitude to the (fractional) row index in the map,
lon_idx: function converting ... | python | def load(self):
"""Load the climate data as a map
Returns:
dict: {data: masked 3D numpy array containing climate data per month (first axis),
lat_idx: function converting a latitude to the (fractional) row index in the map,
lon_idx: function converting ... | [
"def",
"load",
"(",
"self",
")",
":",
"from",
"scipy",
".",
"io",
"import",
"netcdf_file",
"from",
"scipy",
"import",
"interpolate",
"import",
"numpy",
"as",
"np",
"# load file",
"f",
"=",
"netcdf_file",
"(",
"self",
".",
"input_file",
")",
"# extract data, ... | Load the climate data as a map
Returns:
dict: {data: masked 3D numpy array containing climate data per month (first axis),
lat_idx: function converting a latitude to the (fractional) row index in the map,
lon_idx: function converting a longitude to the (fractio... | [
"Load",
"the",
"climate",
"data",
"as",
"a",
"map"
] | 948675e02eb6fca940450f5cb814f53e97159e5b | https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/eurominder/eurominder/pipeline.py#L659-L701 | train | Load the climate data as a map containing the climate data per month |
ehansis/ozelot | examples/eurominder/eurominder/pipeline.py | LoadClimateData.clear | def clear(self):
"""Clear output of one climate variable
"""
# mark this task as incomplete
self.mark_incomplete()
# Delete the indicator metadata, this also deletes values by cascading.
for suffix in list(CLIMATE_SEASON_SUFFIXES.values()):
try:
... | python | def clear(self):
"""Clear output of one climate variable
"""
# mark this task as incomplete
self.mark_incomplete()
# Delete the indicator metadata, this also deletes values by cascading.
for suffix in list(CLIMATE_SEASON_SUFFIXES.values()):
try:
... | [
"def",
"clear",
"(",
"self",
")",
":",
"# mark this task as incomplete",
"self",
".",
"mark_incomplete",
"(",
")",
"# Delete the indicator metadata, this also deletes values by cascading.",
"for",
"suffix",
"in",
"list",
"(",
"CLIMATE_SEASON_SUFFIXES",
".",
"values",
"(",
... | Clear output of one climate variable | [
"Clear",
"output",
"of",
"one",
"climate",
"variable"
] | 948675e02eb6fca940450f5cb814f53e97159e5b | https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/eurominder/eurominder/pipeline.py#L731-L749 | train | Clear the output of one climate variable. |
ehansis/ozelot | examples/eurominder/eurominder/pipeline.py | LoadClimateData.run | def run(self):
"""Load climate data and convert to indicator objects
"""
import numpy as np
# get all NUTS region IDs, for linking values to region objects
query = self.session.query(models.NUTS2Region.key,
models.NUTS2Region.id)
region... | python | def run(self):
"""Load climate data and convert to indicator objects
"""
import numpy as np
# get all NUTS region IDs, for linking values to region objects
query = self.session.query(models.NUTS2Region.key,
models.NUTS2Region.id)
region... | [
"def",
"run",
"(",
"self",
")",
":",
"import",
"numpy",
"as",
"np",
"# get all NUTS region IDs, for linking values to region objects",
"query",
"=",
"self",
".",
"session",
".",
"query",
"(",
"models",
".",
"NUTS2Region",
".",
"key",
",",
"models",
".",
"NUTS2Re... | Load climate data and convert to indicator objects | [
"Load",
"climate",
"data",
"and",
"convert",
"to",
"indicator",
"objects"
] | 948675e02eb6fca940450f5cb814f53e97159e5b | https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/eurominder/eurominder/pipeline.py#L751-L836 | train | Load climate data and convert to indicator objects
|
untwisted/untwisted | untwisted/iostd.py | lose | def lose(spin):
"""
It is used to close TCP connection and unregister
the Spin instance from untwisted reactor.
Diagram:
lose -> (int:err | socket.error:err) -> CLOSE_ERR
"""
try:
spin.close()
except Exception as excpt:
err = excpt.args[0]
spin.drive(CLOSE_ERR,... | python | def lose(spin):
"""
It is used to close TCP connection and unregister
the Spin instance from untwisted reactor.
Diagram:
lose -> (int:err | socket.error:err) -> CLOSE_ERR
"""
try:
spin.close()
except Exception as excpt:
err = excpt.args[0]
spin.drive(CLOSE_ERR,... | [
"def",
"lose",
"(",
"spin",
")",
":",
"try",
":",
"spin",
".",
"close",
"(",
")",
"except",
"Exception",
"as",
"excpt",
":",
"err",
"=",
"excpt",
".",
"args",
"[",
"0",
"]",
"spin",
".",
"drive",
"(",
"CLOSE_ERR",
",",
"err",
")",
"finally",
":",... | It is used to close TCP connection and unregister
the Spin instance from untwisted reactor.
Diagram:
lose -> (int:err | socket.error:err) -> CLOSE_ERR | [
"It",
"is",
"used",
"to",
"close",
"TCP",
"connection",
"and",
"unregister",
"the",
"Spin",
"instance",
"from",
"untwisted",
"reactor",
"."
] | 8a8d9c8a8d0f3452d5de67cd760297bb5759f637 | https://github.com/untwisted/untwisted/blob/8a8d9c8a8d0f3452d5de67cd760297bb5759f637/untwisted/iostd.py#L10-L27 | train | Closes TCP connection and unregister the current Spin instance from untwisted reactor. |
untwisted/untwisted | untwisted/iostd.py | create_server | def create_server(addr, port, backlog):
"""
Set up a TCP server and installs the basic handles Stdin, Stdout in the
clients.
Example:
def send_data(server, client):
# No need to install Stdin or Stdout.
client.dump('foo bar!')
server = create_server('0.0.0.0', 1024, 50)
... | python | def create_server(addr, port, backlog):
"""
Set up a TCP server and installs the basic handles Stdin, Stdout in the
clients.
Example:
def send_data(server, client):
# No need to install Stdin or Stdout.
client.dump('foo bar!')
server = create_server('0.0.0.0', 1024, 50)
... | [
"def",
"create_server",
"(",
"addr",
",",
"port",
",",
"backlog",
")",
":",
"server",
"=",
"Spin",
"(",
")",
"server",
".",
"bind",
"(",
"(",
"addr",
",",
"port",
")",
")",
"server",
".",
"listen",
"(",
"backlog",
")",
"Server",
"(",
"server",
")",... | Set up a TCP server and installs the basic handles Stdin, Stdout in the
clients.
Example:
def send_data(server, client):
# No need to install Stdin or Stdout.
client.dump('foo bar!')
server = create_server('0.0.0.0', 1024, 50)
xmap(server, on_accept, send_data) | [
"Set",
"up",
"a",
"TCP",
"server",
"and",
"installs",
"the",
"basic",
"handles",
"Stdin",
"Stdout",
"in",
"the",
"clients",
"."
] | 8a8d9c8a8d0f3452d5de67cd760297bb5759f637 | https://github.com/untwisted/untwisted/blob/8a8d9c8a8d0f3452d5de67cd760297bb5759f637/untwisted/iostd.py#L37-L57 | train | Create a TCP server and installs basic handles. |
untwisted/untwisted | untwisted/iostd.py | create_client | def create_client(addr, port):
"""
Set up a TCP client and installs the basic handles Stdin, Stdout.
def send_data(client):
client.dump('GET / HTTP/1.1\r\n')
xmap(client, LOAD, iostd.put)
client = create_client('www.google.com.br', 80)
xmap(client, CONNECT, send_data)
"""
s... | python | def create_client(addr, port):
"""
Set up a TCP client and installs the basic handles Stdin, Stdout.
def send_data(client):
client.dump('GET / HTTP/1.1\r\n')
xmap(client, LOAD, iostd.put)
client = create_client('www.google.com.br', 80)
xmap(client, CONNECT, send_data)
"""
s... | [
"def",
"create_client",
"(",
"addr",
",",
"port",
")",
":",
"sock",
"=",
"socket",
".",
"socket",
"(",
"socket",
".",
"AF_INET",
",",
"socket",
".",
"SOCK_STREAM",
")",
"# First attempt to connect otherwise it leaves",
"# an unconnected spin instance in the reactor.",
... | Set up a TCP client and installs the basic handles Stdin, Stdout.
def send_data(client):
client.dump('GET / HTTP/1.1\r\n')
xmap(client, LOAD, iostd.put)
client = create_client('www.google.com.br', 80)
xmap(client, CONNECT, send_data) | [
"Set",
"up",
"a",
"TCP",
"client",
"and",
"installs",
"the",
"basic",
"handles",
"Stdin",
"Stdout",
"."
] | 8a8d9c8a8d0f3452d5de67cd760297bb5759f637 | https://github.com/untwisted/untwisted/blob/8a8d9c8a8d0f3452d5de67cd760297bb5759f637/untwisted/iostd.py#L67-L88 | train | Create a new client and installs the basic handles. |
kataev/flake8-rst | flake8_rst/cli.py | main | def main(argv=None):
# type: (Union[NoneType, List[str]]) -> NoneType
"""Execute the main bit of the application.
This handles the creation of an instance of :class:`Application`, runs it,
and then exits the application.
:param list argv:
The arguments to be passed to the application for p... | python | def main(argv=None):
# type: (Union[NoneType, List[str]]) -> NoneType
"""Execute the main bit of the application.
This handles the creation of an instance of :class:`Application`, runs it,
and then exits the application.
:param list argv:
The arguments to be passed to the application for p... | [
"def",
"main",
"(",
"argv",
"=",
"None",
")",
":",
"# type: (Union[NoneType, List[str]]) -> NoneType",
"app",
"=",
"application",
".",
"Application",
"(",
")",
"app",
".",
"run",
"(",
"argv",
")",
"app",
".",
"exit",
"(",
")"
] | Execute the main bit of the application.
This handles the creation of an instance of :class:`Application`, runs it,
and then exits the application.
:param list argv:
The arguments to be passed to the application for parsing. | [
"Execute",
"the",
"main",
"bit",
"of",
"the",
"application",
"."
] | ca6d41c7a309b9e8cd4fa6f428b82db96b6a986f | https://github.com/kataev/flake8-rst/blob/ca6d41c7a309b9e8cd4fa6f428b82db96b6a986f/flake8_rst/cli.py#L5-L17 | train | Execute the main bit of the application. |
mojaie/chorus | chorus/indigo.py | from_indigo | def from_indigo(idgmol, assign_descriptor=True):
"""Convert RDMol to molecule"""
mol = Compound()
for atom in idgmol.iterateAtoms():
key = atom.index()
a = Atom(atom.symbol())
a.coords = list(atom.xyz())
mol.add_atom(key, a)
for bond in idgmol.iterateBonds():
u = ... | python | def from_indigo(idgmol, assign_descriptor=True):
"""Convert RDMol to molecule"""
mol = Compound()
for atom in idgmol.iterateAtoms():
key = atom.index()
a = Atom(atom.symbol())
a.coords = list(atom.xyz())
mol.add_atom(key, a)
for bond in idgmol.iterateBonds():
u = ... | [
"def",
"from_indigo",
"(",
"idgmol",
",",
"assign_descriptor",
"=",
"True",
")",
":",
"mol",
"=",
"Compound",
"(",
")",
"for",
"atom",
"in",
"idgmol",
".",
"iterateAtoms",
"(",
")",
":",
"key",
"=",
"atom",
".",
"index",
"(",
")",
"a",
"=",
"Atom",
... | Convert RDMol to molecule | [
"Convert",
"RDMol",
"to",
"molecule"
] | fc7fe23a0272554c67671645ab07830b315eeb1b | https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/indigo.py#L45-L61 | train | Convert an indigo IDG Molecule to a Molecule object |
mojaie/chorus | chorus/indigo.py | fingerprint_similarity | def fingerprint_similarity(mol1, mol2):
"""Calculate Indigo fingerprint similarity
"""
idmol1 = to_real_mol(mol1)
idmol2 = to_real_mol(mol2)
fp1 = idmol1.fingerprint("sim")
fp2 = idmol2.fingerprint("sim")
return round(idg.similarity(fp1, fp2, "tanimoto"), 2) | python | def fingerprint_similarity(mol1, mol2):
"""Calculate Indigo fingerprint similarity
"""
idmol1 = to_real_mol(mol1)
idmol2 = to_real_mol(mol2)
fp1 = idmol1.fingerprint("sim")
fp2 = idmol2.fingerprint("sim")
return round(idg.similarity(fp1, fp2, "tanimoto"), 2) | [
"def",
"fingerprint_similarity",
"(",
"mol1",
",",
"mol2",
")",
":",
"idmol1",
"=",
"to_real_mol",
"(",
"mol1",
")",
"idmol2",
"=",
"to_real_mol",
"(",
"mol2",
")",
"fp1",
"=",
"idmol1",
".",
"fingerprint",
"(",
"\"sim\"",
")",
"fp2",
"=",
"idmol2",
".",... | Calculate Indigo fingerprint similarity | [
"Calculate",
"Indigo",
"fingerprint",
"similarity"
] | fc7fe23a0272554c67671645ab07830b315eeb1b | https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/indigo.py#L64-L71 | train | Calculate Indigo fingerprint similarity between two Molecules. |
wesleybeckner/salty | salty/core.py | assign_category | def assign_category(salts):
"""
Identifies IL type based on name/str
Parameters
----------
salts: pandas DataFrame
dataframe containing column with cation name
Returns
----------
salts: pandas DataFrame
returns the same dataframe with categories
"""
if "name-cat... | python | def assign_category(salts):
"""
Identifies IL type based on name/str
Parameters
----------
salts: pandas DataFrame
dataframe containing column with cation name
Returns
----------
salts: pandas DataFrame
returns the same dataframe with categories
"""
if "name-cat... | [
"def",
"assign_category",
"(",
"salts",
")",
":",
"if",
"\"name-cation\"",
"in",
"salts",
".",
"columns",
":",
"label",
"=",
"\"name-cation\"",
"elif",
"\"Molecular Relative\"",
"in",
"salts",
".",
"columns",
":",
"label",
"=",
"\"Molecular Relative\"",
"else",
... | Identifies IL type based on name/str
Parameters
----------
salts: pandas DataFrame
dataframe containing column with cation name
Returns
----------
salts: pandas DataFrame
returns the same dataframe with categories | [
"Identifies",
"IL",
"type",
"based",
"on",
"name",
"/",
"str"
] | ef17a97aea3e4f81fcd0359ce85b3438c0e6499b | https://github.com/wesleybeckner/salty/blob/ef17a97aea3e4f81fcd0359ce85b3438c0e6499b/salty/core.py#L38-L82 | train | Assign a category to the IL type based on the name of the IL. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.