body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
347ce6b9100e43482def93274e4434e4e3db7b82a5dd4335a8489f9a51dffd6a | def _add_cmaps_to_button(self):
'Add a menu to change colormap used for plot.'
for cm_name in self.cm_names:
cmapAction = self.dispCmapmenu.addAction(cm_name)
cmapAction.setStatusTip(('Use the %s colormap' % cm_name))
cmapAction.triggered[()].connect((lambda cm_name=cm_name: self.cmapSel... | Add a menu to change colormap used for plot. | artview/components/plot_radar.py | _add_cmaps_to_button | jjhelmus/artview | 0 | python | def _add_cmaps_to_button(self):
for cm_name in self.cm_names:
cmapAction = self.dispCmapmenu.addAction(cm_name)
cmapAction.setStatusTip(('Use the %s colormap' % cm_name))
cmapAction.triggered[()].connect((lambda cm_name=cm_name: self.cmapSelectCmd(cm_name)))
self.dispCmap.setMen... | def _add_cmaps_to_button(self):
for cm_name in self.cm_names:
cmapAction = self.dispCmapmenu.addAction(cm_name)
cmapAction.setStatusTip(('Use the %s colormap' % cm_name))
cmapAction.triggered[()].connect((lambda cm_name=cm_name: self.cmapSelectCmd(cm_name)))
self.dispCmap.setMen... |
3e95237453770a246eb1ac5aae53c390b57cde9b372cd060a283ff42f5690da7 | def _add_displayBoxUI(self):
'Create the Display Options Button menu.'
self.dispButton = QtGui.QPushButton('Display Options')
self.dispButton.setToolTip('Adjust display properties')
self.dispButton.setFocusPolicy(QtCore.Qt.NoFocus)
dispmenu = QtGui.QMenu(self)
dispLimits = dispmenu.addAction('Ad... | Create the Display Options Button menu. | artview/components/plot_radar.py | _add_displayBoxUI | jjhelmus/artview | 0 | python | def _add_displayBoxUI(self):
self.dispButton = QtGui.QPushButton('Display Options')
self.dispButton.setToolTip('Adjust display properties')
self.dispButton.setFocusPolicy(QtCore.Qt.NoFocus)
dispmenu = QtGui.QMenu(self)
dispLimits = dispmenu.addAction('Adjust Display Limits')
dispLimits.setT... | def _add_displayBoxUI(self):
self.dispButton = QtGui.QPushButton('Display Options')
self.dispButton.setToolTip('Adjust display properties')
self.dispButton.setFocusPolicy(QtCore.Qt.NoFocus)
dispmenu = QtGui.QMenu(self)
dispLimits = dispmenu.addAction('Adjust Display Limits')
dispLimits.setT... |
31ce66fb1dc4ee8a85dfa7536d7eaeb3c4a124d7adcfd5d16cbdc61e0e32657f | def _add_tiltBoxUI(self):
'Create the Tilt Selection ComboBox.'
self.tiltBox = QtGui.QComboBox()
self.tiltBox.setFocusPolicy(QtCore.Qt.NoFocus)
self.tiltBox.setToolTip("Select tilt elevation angle to display.\n'Tilt Window' will launch popup.\nUp/Down arrow keys Increase/Decrease tilt.")
self.tiltBo... | Create the Tilt Selection ComboBox. | artview/components/plot_radar.py | _add_tiltBoxUI | jjhelmus/artview | 0 | python | def _add_tiltBoxUI(self):
self.tiltBox = QtGui.QComboBox()
self.tiltBox.setFocusPolicy(QtCore.Qt.NoFocus)
self.tiltBox.setToolTip("Select tilt elevation angle to display.\n'Tilt Window' will launch popup.\nUp/Down arrow keys Increase/Decrease tilt.")
self.tiltBox.activated[str].connect(self._tiltAc... | def _add_tiltBoxUI(self):
self.tiltBox = QtGui.QComboBox()
self.tiltBox.setFocusPolicy(QtCore.Qt.NoFocus)
self.tiltBox.setToolTip("Select tilt elevation angle to display.\n'Tilt Window' will launch popup.\nUp/Down arrow keys Increase/Decrease tilt.")
self.tiltBox.activated[str].connect(self._tiltAc... |
3ec0d51afa26bcf2a979b1a58ce17f47334a99b5811c6ecba2ceb30f084536e9 | def _add_fieldBoxUI(self):
'Create the Field Selection ComboBox.'
self.fieldBox = QtGui.QComboBox()
self.fieldBox.setFocusPolicy(QtCore.Qt.NoFocus)
self.fieldBox.setToolTip("Select variable/field in data file.\n'Field Window' will launch popup.\n")
self.fieldBox.activated[str].connect(self._fieldAct... | Create the Field Selection ComboBox. | artview/components/plot_radar.py | _add_fieldBoxUI | jjhelmus/artview | 0 | python | def _add_fieldBoxUI(self):
self.fieldBox = QtGui.QComboBox()
self.fieldBox.setFocusPolicy(QtCore.Qt.NoFocus)
self.fieldBox.setToolTip("Select variable/field in data file.\n'Field Window' will launch popup.\n")
self.fieldBox.activated[str].connect(self._fieldAction) | def _add_fieldBoxUI(self):
self.fieldBox = QtGui.QComboBox()
self.fieldBox.setFocusPolicy(QtCore.Qt.NoFocus)
self.fieldBox.setToolTip("Select variable/field in data file.\n'Field Window' will launch popup.\n")
self.fieldBox.activated[str].connect(self._fieldAction)<|docstring|>Create the Field Sele... |
b5f06d2886983c53484e70af04242a726442e56926b45acb2fd9fefb4b871a46 | def _add_toolsBoxUI(self):
'Create the Tools Button menu.'
self.toolsButton = QtGui.QPushButton('Toolbox')
self.toolsButton.setFocusPolicy(QtCore.Qt.NoFocus)
self.toolsButton.setToolTip('Choose a tool to apply')
toolmenu = QtGui.QMenu(self)
toolZoomPan = toolmenu.addAction('Zoom/Pan')
toolVa... | Create the Tools Button menu. | artview/components/plot_radar.py | _add_toolsBoxUI | jjhelmus/artview | 0 | python | def _add_toolsBoxUI(self):
self.toolsButton = QtGui.QPushButton('Toolbox')
self.toolsButton.setFocusPolicy(QtCore.Qt.NoFocus)
self.toolsButton.setToolTip('Choose a tool to apply')
toolmenu = QtGui.QMenu(self)
toolZoomPan = toolmenu.addAction('Zoom/Pan')
toolValueClick = toolmenu.addAction('... | def _add_toolsBoxUI(self):
self.toolsButton = QtGui.QPushButton('Toolbox')
self.toolsButton.setFocusPolicy(QtCore.Qt.NoFocus)
self.toolsButton.setToolTip('Choose a tool to apply')
toolmenu = QtGui.QMenu(self)
toolZoomPan = toolmenu.addAction('Zoom/Pan')
toolValueClick = toolmenu.addAction('... |
6debe513f6c153cfd25a8d6f64a6ee64e229ff5f36d5b34d98b829d0787cef8a | def _add_infolabel(self):
'Create an information label about the display'
self.infolabel = QtGui.QLabel('Radar: \nField: \nTilt: ', self)
self.infolabel.setStyleSheet('color: red; font: italic 10px')
self.infolabel.setToolTip('Filename not loaded') | Create an information label about the display | artview/components/plot_radar.py | _add_infolabel | jjhelmus/artview | 0 | python | def _add_infolabel(self):
self.infolabel = QtGui.QLabel('Radar: \nField: \nTilt: ', self)
self.infolabel.setStyleSheet('color: red; font: italic 10px')
self.infolabel.setToolTip('Filename not loaded') | def _add_infolabel(self):
self.infolabel = QtGui.QLabel('Radar: \nField: \nTilt: ', self)
self.infolabel.setStyleSheet('color: red; font: italic 10px')
self.infolabel.setToolTip('Filename not loaded')<|docstring|>Create an information label about the display<|endoftext|> |
eccc43acae0fa37948c1bd13e49cd31b2144b82a9c75ba227c133a909e63148f | def NewRadar(self, variable, value, strong):
"\n Slot for 'ValueChanged' signal of\n :py:class:`Vradar <artview.core.core.Variable>`.\n\n This will:\n\n * Update fields and tilts lists and MenuBoxes\n * Check radar scan type and reset limits if needed\n * Reset units and ti... | Slot for 'ValueChanged' signal of
:py:class:`Vradar <artview.core.core.Variable>`.
This will:
* Update fields and tilts lists and MenuBoxes
* Check radar scan type and reset limits if needed
* Reset units and title
* If strong update: update plot | artview/components/plot_radar.py | NewRadar | jjhelmus/artview | 0 | python | def NewRadar(self, variable, value, strong):
"\n Slot for 'ValueChanged' signal of\n :py:class:`Vradar <artview.core.core.Variable>`.\n\n This will:\n\n * Update fields and tilts lists and MenuBoxes\n * Check radar scan type and reset limits if needed\n * Reset units and ti... | def NewRadar(self, variable, value, strong):
"\n Slot for 'ValueChanged' signal of\n :py:class:`Vradar <artview.core.core.Variable>`.\n\n This will:\n\n * Update fields and tilts lists and MenuBoxes\n * Check radar scan type and reset limits if needed\n * Reset units and ti... |
9e7d59e0c1097001812e88482d5182073547aa22d2cc1073b0736bf54b57424d | def NewField(self, variable, value, strong):
"\n Slot for 'ValueChanged' signal of\n :py:class:`Vfield <artview.core.core.Variable>`.\n\n This will:\n\n * Reset colormap\n * Reset units\n * Update fields MenuBox\n * If strong update: update plot\n "
self._... | Slot for 'ValueChanged' signal of
:py:class:`Vfield <artview.core.core.Variable>`.
This will:
* Reset colormap
* Reset units
* Update fields MenuBox
* If strong update: update plot | artview/components/plot_radar.py | NewField | jjhelmus/artview | 0 | python | def NewField(self, variable, value, strong):
"\n Slot for 'ValueChanged' signal of\n :py:class:`Vfield <artview.core.core.Variable>`.\n\n This will:\n\n * Reset colormap\n * Reset units\n * Update fields MenuBox\n * If strong update: update plot\n "
self._... | def NewField(self, variable, value, strong):
"\n Slot for 'ValueChanged' signal of\n :py:class:`Vfield <artview.core.core.Variable>`.\n\n This will:\n\n * Reset colormap\n * Reset units\n * Update fields MenuBox\n * If strong update: update plot\n "
self._... |
8e53f58f4f6351893118f1d50fc2f7317dcd60a7f7e9fc970cb51787c29a3c20 | def NewLims(self, variable, value, strong):
"\n Slot for 'ValueChanged' signal of\n :py:class:`Vlims <artview.core.core.Variable>`.\n\n This will:\n\n * If strong update: update axes\n "
if strong:
self._update_axes() | Slot for 'ValueChanged' signal of
:py:class:`Vlims <artview.core.core.Variable>`.
This will:
* If strong update: update axes | artview/components/plot_radar.py | NewLims | jjhelmus/artview | 0 | python | def NewLims(self, variable, value, strong):
"\n Slot for 'ValueChanged' signal of\n :py:class:`Vlims <artview.core.core.Variable>`.\n\n This will:\n\n * If strong update: update axes\n "
if strong:
self._update_axes() | def NewLims(self, variable, value, strong):
"\n Slot for 'ValueChanged' signal of\n :py:class:`Vlims <artview.core.core.Variable>`.\n\n This will:\n\n * If strong update: update axes\n "
if strong:
self._update_axes()<|docstring|>Slot for 'ValueChanged' signal of
:py:c... |
53449223e30f54552c41000bf2122596d346d6f87f7668a7333f6d3372a4aecc | def NewCmap(self, variable, value, strong):
"\n Slot for 'ValueChanged' signal of\n :py:class:`Vcmap <artview.core.core.Variable>`.\n\n This will:\n\n * If strong update: update plot\n "
if strong:
self._update_plot() | Slot for 'ValueChanged' signal of
:py:class:`Vcmap <artview.core.core.Variable>`.
This will:
* If strong update: update plot | artview/components/plot_radar.py | NewCmap | jjhelmus/artview | 0 | python | def NewCmap(self, variable, value, strong):
"\n Slot for 'ValueChanged' signal of\n :py:class:`Vcmap <artview.core.core.Variable>`.\n\n This will:\n\n * If strong update: update plot\n "
if strong:
self._update_plot() | def NewCmap(self, variable, value, strong):
"\n Slot for 'ValueChanged' signal of\n :py:class:`Vcmap <artview.core.core.Variable>`.\n\n This will:\n\n * If strong update: update plot\n "
if strong:
self._update_plot()<|docstring|>Slot for 'ValueChanged' signal of
:py:c... |
e2e2e0e0588526d873315435410327eaaa77dfaac99169d23d657be52be8eb83 | def NewGatefilter(self, variable, value, strong):
"\n Slot for 'ValueChanged' signal of\n :py:class:`Vgatefilter <artview.core.core.Variable>`.\n\n This will:\n\n * If strong update: update plot\n "
if strong:
self._update_plot() | Slot for 'ValueChanged' signal of
:py:class:`Vgatefilter <artview.core.core.Variable>`.
This will:
* If strong update: update plot | artview/components/plot_radar.py | NewGatefilter | jjhelmus/artview | 0 | python | def NewGatefilter(self, variable, value, strong):
"\n Slot for 'ValueChanged' signal of\n :py:class:`Vgatefilter <artview.core.core.Variable>`.\n\n This will:\n\n * If strong update: update plot\n "
if strong:
self._update_plot() | def NewGatefilter(self, variable, value, strong):
"\n Slot for 'ValueChanged' signal of\n :py:class:`Vgatefilter <artview.core.core.Variable>`.\n\n This will:\n\n * If strong update: update plot\n "
if strong:
self._update_plot()<|docstring|>Slot for 'ValueChanged' sig... |
74a740de329b22200e20dc505ec14e3e6037f3fe8664fda6dfc6283a18dbaec0 | def NewTilt(self, variable, value, strong):
"\n Slot for 'ValueChanged' signal of\n :py:class:`Vtilt <artview.core.core.Variable>`.\n\n This will:\n\n * Update tilt MenuBox\n * If strong update: update plot\n "
self.tiltBox.setCurrentIndex((value + 1))
if strong:
... | Slot for 'ValueChanged' signal of
:py:class:`Vtilt <artview.core.core.Variable>`.
This will:
* Update tilt MenuBox
* If strong update: update plot | artview/components/plot_radar.py | NewTilt | jjhelmus/artview | 0 | python | def NewTilt(self, variable, value, strong):
"\n Slot for 'ValueChanged' signal of\n :py:class:`Vtilt <artview.core.core.Variable>`.\n\n This will:\n\n * Update tilt MenuBox\n * If strong update: update plot\n "
self.tiltBox.setCurrentIndex((value + 1))
if strong:
... | def NewTilt(self, variable, value, strong):
"\n Slot for 'ValueChanged' signal of\n :py:class:`Vtilt <artview.core.core.Variable>`.\n\n This will:\n\n * Update tilt MenuBox\n * If strong update: update plot\n "
self.tiltBox.setCurrentIndex((value + 1))
if strong:
... |
73dbf873dd4f1899222869d897da79c1b23dab15206ee09abbceafe79028d458 | def TiltSelectCmd(self, ntilt):
'\n Captures tilt selection and update tilt\n :py:class:`~artview.core.core.Variable`.\n '
if (ntilt < 0):
ntilt = (len(self.rTilts) - 1)
elif (ntilt >= len(self.rTilts)):
ntilt = 0
self.Vtilt.change(ntilt) | Captures tilt selection and update tilt
:py:class:`~artview.core.core.Variable`. | artview/components/plot_radar.py | TiltSelectCmd | jjhelmus/artview | 0 | python | def TiltSelectCmd(self, ntilt):
'\n Captures tilt selection and update tilt\n :py:class:`~artview.core.core.Variable`.\n '
if (ntilt < 0):
ntilt = (len(self.rTilts) - 1)
elif (ntilt >= len(self.rTilts)):
ntilt = 0
self.Vtilt.change(ntilt) | def TiltSelectCmd(self, ntilt):
'\n Captures tilt selection and update tilt\n :py:class:`~artview.core.core.Variable`.\n '
if (ntilt < 0):
ntilt = (len(self.rTilts) - 1)
elif (ntilt >= len(self.rTilts)):
ntilt = 0
self.Vtilt.change(ntilt)<|docstring|>Captures tilt se... |
1c82f5d6b0c1fead3938f2bd7990814bedf16a5154e528171740744ad5c6dec5 | def FieldSelectCmd(self, name):
'\n Captures field selection and update field\n :py:class:`~artview.core.core.Variable`.\n '
self.Vfield.change(name) | Captures field selection and update field
:py:class:`~artview.core.core.Variable`. | artview/components/plot_radar.py | FieldSelectCmd | jjhelmus/artview | 0 | python | def FieldSelectCmd(self, name):
'\n Captures field selection and update field\n :py:class:`~artview.core.core.Variable`.\n '
self.Vfield.change(name) | def FieldSelectCmd(self, name):
'\n Captures field selection and update field\n :py:class:`~artview.core.core.Variable`.\n '
self.Vfield.change(name)<|docstring|>Captures field selection and update field
:py:class:`~artview.core.core.Variable`.<|endoftext|> |
42abee2d8fd4041b08a25578b5d12a1ec828f3df59b21400d506ba6314969abf | def RngRingSelectCmd(self, ringSel):
'\n Captures Range Ring selection and\n redraws the field with range rings.\n '
if (ringSel is 'None'):
self.RngRing = False
else:
self.RngRing = True
try:
unrng = int((self.Vradar.value.instrument_parameters['unam... | Captures Range Ring selection and
redraws the field with range rings. | artview/components/plot_radar.py | RngRingSelectCmd | jjhelmus/artview | 0 | python | def RngRingSelectCmd(self, ringSel):
'\n Captures Range Ring selection and\n redraws the field with range rings.\n '
if (ringSel is 'None'):
self.RngRing = False
else:
self.RngRing = True
try:
unrng = int((self.Vradar.value.instrument_parameters['unam... | def RngRingSelectCmd(self, ringSel):
'\n Captures Range Ring selection and\n redraws the field with range rings.\n '
if (ringSel is 'None'):
self.RngRing = False
else:
self.RngRing = True
try:
unrng = int((self.Vradar.value.instrument_parameters['unam... |
fbfa06a02308241380fc7c8e58781a7a949afd68bbe02028863f91c73c4723bf | def cmapSelectCmd(self, cm_name):
'Captures colormap selection and redraws.'
CMAP = cm_name
self.Vcmap.value['cmap'] = cm_name
self.Vcmap.update() | Captures colormap selection and redraws. | artview/components/plot_radar.py | cmapSelectCmd | jjhelmus/artview | 0 | python | def cmapSelectCmd(self, cm_name):
CMAP = cm_name
self.Vcmap.value['cmap'] = cm_name
self.Vcmap.update() | def cmapSelectCmd(self, cm_name):
CMAP = cm_name
self.Vcmap.value['cmap'] = cm_name
self.Vcmap.update()<|docstring|>Captures colormap selection and redraws.<|endoftext|> |
2de4c9e5a1768380d09e95a2ea9659bf6bec0137f1ef9e051e76ded7c7130f57 | def toolZoomPanCmd(self):
'Creates and connects to a Zoom/Pan instance.'
from .tools import ZoomPan
scale = 1.1
self.tools['zoompan'] = ZoomPan(self.Vlims, self.ax, base_scale=scale, parent=self.parent)
self.tools['zoompan'].connect() | Creates and connects to a Zoom/Pan instance. | artview/components/plot_radar.py | toolZoomPanCmd | jjhelmus/artview | 0 | python | def toolZoomPanCmd(self):
from .tools import ZoomPan
scale = 1.1
self.tools['zoompan'] = ZoomPan(self.Vlims, self.ax, base_scale=scale, parent=self.parent)
self.tools['zoompan'].connect() | def toolZoomPanCmd(self):
from .tools import ZoomPan
scale = 1.1
self.tools['zoompan'] = ZoomPan(self.Vlims, self.ax, base_scale=scale, parent=self.parent)
self.tools['zoompan'].connect()<|docstring|>Creates and connects to a Zoom/Pan instance.<|endoftext|> |
48b07f40a5eb1ec3734d84acf77b48673fb11e81c2b919cfbb0d2266097517a5 | def toolValueClickCmd(self):
'Creates and connects to Point-and-click value retrieval'
if (self.plot_type == 'radarPpi'):
from .tools import ValueClick
self.tools['valueclick'] = ValueClick(self.Vradar, self.Vtilt, self.Vfield, self.units, self.ax, self.statusbar, parent=self.parent)
sel... | Creates and connects to Point-and-click value retrieval | artview/components/plot_radar.py | toolValueClickCmd | jjhelmus/artview | 0 | python | def toolValueClickCmd(self):
if (self.plot_type == 'radarPpi'):
from .tools import ValueClick
self.tools['valueclick'] = ValueClick(self.Vradar, self.Vtilt, self.Vfield, self.units, self.ax, self.statusbar, parent=self.parent)
self.tools['valueclick'].connect()
else:
import ... | def toolValueClickCmd(self):
if (self.plot_type == 'radarPpi'):
from .tools import ValueClick
self.tools['valueclick'] = ValueClick(self.Vradar, self.Vtilt, self.Vfield, self.units, self.ax, self.statusbar, parent=self.parent)
self.tools['valueclick'].connect()
else:
import ... |
140a2e74598d348451491291556c99345ec41293bc19a5f61fe58873e4ae2feb | def toolSelectRegionCmd(self):
'Creates and connects to Region of Interest instance'
from .select_region_old import SelectRegion
self.tools['select_region'] = SelectRegion(self.VplotAxes, self.VpathInteriorFunc, self.Vfield, name=(self.name + ' SelectRegion'), parent=self) | Creates and connects to Region of Interest instance | artview/components/plot_radar.py | toolSelectRegionCmd | jjhelmus/artview | 0 | python | def toolSelectRegionCmd(self):
from .select_region_old import SelectRegion
self.tools['select_region'] = SelectRegion(self.VplotAxes, self.VpathInteriorFunc, self.Vfield, name=(self.name + ' SelectRegion'), parent=self) | def toolSelectRegionCmd(self):
from .select_region_old import SelectRegion
self.tools['select_region'] = SelectRegion(self.VplotAxes, self.VpathInteriorFunc, self.Vfield, name=(self.name + ' SelectRegion'), parent=self)<|docstring|>Creates and connects to Region of Interest instance<|endoftext|> |
9fda3c68400f96524d00f50fce178e6485cbae66901f6f11f48d44bbae748068 | def toolResetCmd(self):
'Reset tools via disconnect.'
from . import tools
self.tools = tools.reset_tools(self.tools) | Reset tools via disconnect. | artview/components/plot_radar.py | toolResetCmd | jjhelmus/artview | 0 | python | def toolResetCmd(self):
from . import tools
self.tools = tools.reset_tools(self.tools) | def toolResetCmd(self):
from . import tools
self.tools = tools.reset_tools(self.tools)<|docstring|>Reset tools via disconnect.<|endoftext|> |
e3047d85487cfb2b596706cc5518ae97dfae137c0ae4c608bdc6f44c4eea08ea | def toolDefaultCmd(self):
'Restore the Display defaults.'
for key in self.tools.keys():
if (self.tools[key] is not None):
self.tools[key].disconnect()
self.tools[key] = None
self._set_default_cmap()
self._set_default_limits() | Restore the Display defaults. | artview/components/plot_radar.py | toolDefaultCmd | jjhelmus/artview | 0 | python | def toolDefaultCmd(self):
for key in self.tools.keys():
if (self.tools[key] is not None):
self.tools[key].disconnect()
self.tools[key] = None
self._set_default_cmap()
self._set_default_limits() | def toolDefaultCmd(self):
for key in self.tools.keys():
if (self.tools[key] is not None):
self.tools[key].disconnect()
self.tools[key] = None
self._set_default_cmap()
self._set_default_limits()<|docstring|>Restore the Display defaults.<|endoftext|> |
0ef65b1eb144c8ad1eac7dae941fb1222336404c7bc08ac80abc0169e012575c | def getPathInteriorValues(self, paths):
"\n Return the bins values path.\n\n Parameters\n ----------\n paths : list of :py:class:`matplotlib.path.Path` instances\n\n Returns\n -------\n points : :py:class`artview.core.points.Points`\n Points object contain... | Return the bins values path.
Parameters
----------
paths : list of :py:class:`matplotlib.path.Path` instances
Returns
-------
points : :py:class`artview.core.points.Points`
Points object containing all bins of the current radar
and tilt inside path. Axes : 'x_disp', 'y_disp', 'ray_index',
'range_index', '... | artview/components/plot_radar.py | getPathInteriorValues | jjhelmus/artview | 0 | python | def getPathInteriorValues(self, paths):
"\n Return the bins values path.\n\n Parameters\n ----------\n paths : list of :py:class:`matplotlib.path.Path` instances\n\n Returns\n -------\n points : :py:class`artview.core.points.Points`\n Points object contain... | def getPathInteriorValues(self, paths):
"\n Return the bins values path.\n\n Parameters\n ----------\n paths : list of :py:class:`matplotlib.path.Path` instances\n\n Returns\n -------\n points : :py:class`artview.core.points.Points`\n Points object contain... |
56c32ba5b84206aab0e70aba187ab4e128e4b999033c272893076f3be5de2dff | def _set_fig_ax(self):
'Set the figure and axis to plot.'
self.XSIZE = 8
self.YSIZE = 8
self.fig = Figure(figsize=(self.XSIZE, self.YSIZE))
self.ax = self.fig.add_axes([0.2, 0.2, 0.7, 0.7])
self.cax = self.fig.add_axes([0.2, 0.1, 0.7, 0.02])
self.VplotAxes.change(self.ax) | Set the figure and axis to plot. | artview/components/plot_radar.py | _set_fig_ax | jjhelmus/artview | 0 | python | def _set_fig_ax(self):
self.XSIZE = 8
self.YSIZE = 8
self.fig = Figure(figsize=(self.XSIZE, self.YSIZE))
self.ax = self.fig.add_axes([0.2, 0.2, 0.7, 0.7])
self.cax = self.fig.add_axes([0.2, 0.1, 0.7, 0.02])
self.VplotAxes.change(self.ax) | def _set_fig_ax(self):
self.XSIZE = 8
self.YSIZE = 8
self.fig = Figure(figsize=(self.XSIZE, self.YSIZE))
self.ax = self.fig.add_axes([0.2, 0.2, 0.7, 0.7])
self.cax = self.fig.add_axes([0.2, 0.1, 0.7, 0.02])
self.VplotAxes.change(self.ax)<|docstring|>Set the figure and axis to plot.<|endofte... |
ca9ec29b10017da8d2b2fc0d86d3c3f5ef7917ff9f23cbcf0ca6fc00ff1bb1cf | def _update_fig_ax(self):
'Set the figure and axis to plot.'
if (self.plot_type in ('radarAirborne', 'radarRhi')):
self.YSIZE = 5
else:
self.YSIZE = 8
xwidth = 0.7
yheight = 0.7
self.ax.set_position([0.2, (0.55 - (0.5 * yheight)), xwidth, yheight])
self.cax.set_position([0.2,... | Set the figure and axis to plot. | artview/components/plot_radar.py | _update_fig_ax | jjhelmus/artview | 0 | python | def _update_fig_ax(self):
if (self.plot_type in ('radarAirborne', 'radarRhi')):
self.YSIZE = 5
else:
self.YSIZE = 8
xwidth = 0.7
yheight = 0.7
self.ax.set_position([0.2, (0.55 - (0.5 * yheight)), xwidth, yheight])
self.cax.set_position([0.2, 0.1, xwidth, 0.02])
self._upd... | def _update_fig_ax(self):
if (self.plot_type in ('radarAirborne', 'radarRhi')):
self.YSIZE = 5
else:
self.YSIZE = 8
xwidth = 0.7
yheight = 0.7
self.ax.set_position([0.2, (0.55 - (0.5 * yheight)), xwidth, yheight])
self.cax.set_position([0.2, 0.1, xwidth, 0.02])
self._upd... |
d7487669479c6e205de057f7859e3d941d1902c2638c1afd36d9dc036a3b8939 | def _set_figure_canvas(self):
'Set the figure canvas to draw in window area.'
self.canvas = FigureCanvasQTAgg(self.fig)
self.layout.addWidget(self.canvas, 1, 0, 7, 6) | Set the figure canvas to draw in window area. | artview/components/plot_radar.py | _set_figure_canvas | jjhelmus/artview | 0 | python | def _set_figure_canvas(self):
self.canvas = FigureCanvasQTAgg(self.fig)
self.layout.addWidget(self.canvas, 1, 0, 7, 6) | def _set_figure_canvas(self):
self.canvas = FigureCanvasQTAgg(self.fig)
self.layout.addWidget(self.canvas, 1, 0, 7, 6)<|docstring|>Set the figure canvas to draw in window area.<|endoftext|> |
dbba653d77756f98c8da04688f106a964253bde0be1b0ed1c94e0384326c7e03 | def _update_plot(self):
'Draw/Redraw the plot.'
if (self.Vradar.value is None):
return
self.ax.cla()
self.cax.cla()
self.VplotAxes.update()
if (self.Vfield.value not in self.Vradar.value.fields.keys()):
self.canvas.draw()
self.statusbar.setStyleSheet((('QStatusBar{padding... | Draw/Redraw the plot. | artview/components/plot_radar.py | _update_plot | jjhelmus/artview | 0 | python | def _update_plot(self):
if (self.Vradar.value is None):
return
self.ax.cla()
self.cax.cla()
self.VplotAxes.update()
if (self.Vfield.value not in self.Vradar.value.fields.keys()):
self.canvas.draw()
self.statusbar.setStyleSheet((('QStatusBar{padding-left:8px;' + 'backgrou... | def _update_plot(self):
if (self.Vradar.value is None):
return
self.ax.cla()
self.cax.cla()
self.VplotAxes.update()
if (self.Vfield.value not in self.Vradar.value.fields.keys()):
self.canvas.draw()
self.statusbar.setStyleSheet((('QStatusBar{padding-left:8px;' + 'backgrou... |
b787da6e8ae9523635a66190d809a73111eba51c14f569fcebd5aa880024af79 | def _update_axes(self):
'Change the Plot Axes.'
limits = self.Vlims.value
self.ax.set_xlim(limits['xmin'], limits['xmax'])
self.ax.set_ylim(limits['ymin'], limits['ymax'])
self.ax.figure.canvas.draw() | Change the Plot Axes. | artview/components/plot_radar.py | _update_axes | jjhelmus/artview | 0 | python | def _update_axes(self):
limits = self.Vlims.value
self.ax.set_xlim(limits['xmin'], limits['xmax'])
self.ax.set_ylim(limits['ymin'], limits['ymax'])
self.ax.figure.canvas.draw() | def _update_axes(self):
limits = self.Vlims.value
self.ax.set_xlim(limits['xmin'], limits['xmax'])
self.ax.set_ylim(limits['ymin'], limits['ymax'])
self.ax.figure.canvas.draw()<|docstring|>Change the Plot Axes.<|endoftext|> |
7a910767223ab81da1d5007175b153a4876c989550b2759a5981e98eca79698c | def _check_file_type(self):
'Check file to see if the file is airborne or rhi.'
radar = self.Vradar.value
old_plot_type = self.plot_type
if (radar.scan_type != 'rhi'):
self.plot_type = 'radarPpi'
elif ('platform_type' in radar.metadata):
if ((radar.metadata['platform_type'] == 'aircr... | Check file to see if the file is airborne or rhi. | artview/components/plot_radar.py | _check_file_type | jjhelmus/artview | 0 | python | def _check_file_type(self):
radar = self.Vradar.value
old_plot_type = self.plot_type
if (radar.scan_type != 'rhi'):
self.plot_type = 'radarPpi'
elif ('platform_type' in radar.metadata):
if ((radar.metadata['platform_type'] == 'aircraft_tail') or (radar.metadata['platform_type'] == '... | def _check_file_type(self):
radar = self.Vradar.value
old_plot_type = self.plot_type
if (radar.scan_type != 'rhi'):
self.plot_type = 'radarPpi'
elif ('platform_type' in radar.metadata):
if ((radar.metadata['platform_type'] == 'aircraft_tail') or (radar.metadata['platform_type'] == '... |
213767097ed8e90e99ed41abafc6691dd224dba4d5856d422034bd8d8def047c | def _set_default_limits(self, strong=True):
' Set limits to pre-defined default.'
from .limits import _default_limits
(limits, cmap) = _default_limits(self.Vfield.value, self.plot_type)
self.Vlims.change(limits, strong) | Set limits to pre-defined default. | artview/components/plot_radar.py | _set_default_limits | jjhelmus/artview | 0 | python | def _set_default_limits(self, strong=True):
' '
from .limits import _default_limits
(limits, cmap) = _default_limits(self.Vfield.value, self.plot_type)
self.Vlims.change(limits, strong) | def _set_default_limits(self, strong=True):
' '
from .limits import _default_limits
(limits, cmap) = _default_limits(self.Vfield.value, self.plot_type)
self.Vlims.change(limits, strong)<|docstring|>Set limits to pre-defined default.<|endoftext|> |
6586cb444757bc16636e0ecd30a1d273d397d5c0cc41a9f6d0743cac489b19e6 | def _set_default_cmap(self, strong=True):
' Set colormap to pre-defined default.'
cmap = pyart.config.get_field_colormap(self.Vfield.value)
d = {}
d['cmap'] = cmap
lims = pyart.config.get_field_limits(self.Vfield.value, self.Vradar.value, self.Vtilt.value)
if (lims != (None, None)):
d['v... | Set colormap to pre-defined default. | artview/components/plot_radar.py | _set_default_cmap | jjhelmus/artview | 0 | python | def _set_default_cmap(self, strong=True):
' '
cmap = pyart.config.get_field_colormap(self.Vfield.value)
d = {}
d['cmap'] = cmap
lims = pyart.config.get_field_limits(self.Vfield.value, self.Vradar.value, self.Vtilt.value)
if (lims != (None, None)):
d['vmin'] = lims[0]
d['vmax'] = ... | def _set_default_cmap(self, strong=True):
' '
cmap = pyart.config.get_field_colormap(self.Vfield.value)
d = {}
d['cmap'] = cmap
lims = pyart.config.get_field_limits(self.Vfield.value, self.Vradar.value, self.Vtilt.value)
if (lims != (None, None)):
d['vmin'] = lims[0]
d['vmax'] = ... |
48af52d5eb220242b38f09f787c861f748bda68ed3145cd74186a5a24dd8318b | def _get_default_title(self):
'Get default title from pyart.'
if ((self.Vradar.value is None) or (self.Vfield.value not in self.Vradar.value.fields)):
return ''
return pyart.graph.common.generate_title(self.Vradar.value, self.Vfield.value, self.Vtilt.value) | Get default title from pyart. | artview/components/plot_radar.py | _get_default_title | jjhelmus/artview | 0 | python | def _get_default_title(self):
if ((self.Vradar.value is None) or (self.Vfield.value not in self.Vradar.value.fields)):
return
return pyart.graph.common.generate_title(self.Vradar.value, self.Vfield.value, self.Vtilt.value) | def _get_default_title(self):
if ((self.Vradar.value is None) or (self.Vfield.value not in self.Vradar.value.fields)):
return
return pyart.graph.common.generate_title(self.Vradar.value, self.Vfield.value, self.Vtilt.value)<|docstring|>Get default title from pyart.<|endoftext|> |
eb96e11e44d7230f9c16a67333baf9d77f22541e292943811c246eb87947bce3 | def _get_default_units(self):
'Get default units for current radar and field.'
if (self.Vradar.value is not None):
try:
return self.Vradar.value.fields[self.Vfield.value]['units']
except:
return ''
else:
return '' | Get default units for current radar and field. | artview/components/plot_radar.py | _get_default_units | jjhelmus/artview | 0 | python | def _get_default_units(self):
if (self.Vradar.value is not None):
try:
return self.Vradar.value.fields[self.Vfield.value]['units']
except:
return
else:
return | def _get_default_units(self):
if (self.Vradar.value is not None):
try:
return self.Vradar.value.fields[self.Vfield.value]['units']
except:
return
else:
return <|docstring|>Get default units for current radar and field.<|endoftext|> |
34a6bdacea85c57363cfd1e0b3de426ceef18f1d049c315a1270d6e162119bbd | def _quick_savefile(self, PTYPE=IMAGE_EXT):
'Save the current display via PyArt interface.'
imagename = self.display.generate_filename(self.Vfield.value, self.Vtilt.value, ext=IMAGE_EXT)
self.canvas.print_figure(os.path.join(os.getcwd(), imagename), dpi=DPI)
self.statusbar.showMessage(('Saved to %s' % o... | Save the current display via PyArt interface. | artview/components/plot_radar.py | _quick_savefile | jjhelmus/artview | 0 | python | def _quick_savefile(self, PTYPE=IMAGE_EXT):
imagename = self.display.generate_filename(self.Vfield.value, self.Vtilt.value, ext=IMAGE_EXT)
self.canvas.print_figure(os.path.join(os.getcwd(), imagename), dpi=DPI)
self.statusbar.showMessage(('Saved to %s' % os.path.join(os.getcwd(), imagename))) | def _quick_savefile(self, PTYPE=IMAGE_EXT):
imagename = self.display.generate_filename(self.Vfield.value, self.Vtilt.value, ext=IMAGE_EXT)
self.canvas.print_figure(os.path.join(os.getcwd(), imagename), dpi=DPI)
self.statusbar.showMessage(('Saved to %s' % os.path.join(os.getcwd(), imagename)))<|docstrin... |
643bc09c4d696dd9f5d557f5d021c74638659d88c96fd78893a1db4269a0e14d | def _savefile(self, PTYPE=IMAGE_EXT):
'Save the current display using PyQt dialog interface.'
PBNAME = self.display.generate_filename(self.Vfield.value, self.Vtilt.value, ext=IMAGE_EXT)
file_choices = 'PNG (*.png)|*.png'
path = unicode(QtGui.QFileDialog.getSaveFileName(self, 'Save file', PBNAME, file_ch... | Save the current display using PyQt dialog interface. | artview/components/plot_radar.py | _savefile | jjhelmus/artview | 0 | python | def _savefile(self, PTYPE=IMAGE_EXT):
PBNAME = self.display.generate_filename(self.Vfield.value, self.Vtilt.value, ext=IMAGE_EXT)
file_choices = 'PNG (*.png)|*.png'
path = unicode(QtGui.QFileDialog.getSaveFileName(self, 'Save file', PBNAME, file_choices))
if path:
self.canvas.print_figure(p... | def _savefile(self, PTYPE=IMAGE_EXT):
PBNAME = self.display.generate_filename(self.Vfield.value, self.Vtilt.value, ext=IMAGE_EXT)
file_choices = 'PNG (*.png)|*.png'
path = unicode(QtGui.QFileDialog.getSaveFileName(self, 'Save file', PBNAME, file_choices))
if path:
self.canvas.print_figure(p... |
1d5f1e14fa8c7b7de4c068b8e3d690d16cbb09ce41676faf323fbb389dbacb67 | def getPlotAxis(self):
'Get :py:class:`matplotlib.axes.Axes` instance of main plot.'
return self.ax | Get :py:class:`matplotlib.axes.Axes` instance of main plot. | artview/components/plot_radar.py | getPlotAxis | jjhelmus/artview | 0 | python | def getPlotAxis(self):
return self.ax | def getPlotAxis(self):
return self.ax<|docstring|>Get :py:class:`matplotlib.axes.Axes` instance of main plot.<|endoftext|> |
0f848d5e49423ec6eeeaf4d5d173c84d497b64b7a6d5e4457137c15a061125fd | def getStatusBar(self):
'Get :py:class:`PyQt4.QtGui.QStatusBar` instance.'
return self.statusbar | Get :py:class:`PyQt4.QtGui.QStatusBar` instance. | artview/components/plot_radar.py | getStatusBar | jjhelmus/artview | 0 | python | def getStatusBar(self):
return self.statusbar | def getStatusBar(self):
return self.statusbar<|docstring|>Get :py:class:`PyQt4.QtGui.QStatusBar` instance.<|endoftext|> |
bd146d95dbab1a4233263e27c48ff4a9da0ad897c1832eddcb13ee921405632b | def getField(self):
'Get current field.'
return self.Vfield.value | Get current field. | artview/components/plot_radar.py | getField | jjhelmus/artview | 0 | python | def getField(self):
return self.Vfield.value | def getField(self):
return self.Vfield.value<|docstring|>Get current field.<|endoftext|> |
0934a68f52a8cdf4a2e6d448d5b5ecf845c8e36d32f4a097b01ad662312b1e29 | def getUnits(self):
'Get current units.'
return self.units | Get current units. | artview/components/plot_radar.py | getUnits | jjhelmus/artview | 0 | python | def getUnits(self):
return self.units | def getUnits(self):
return self.units<|docstring|>Get current units.<|endoftext|> |
ca9d0dbca992b01de065f1f07ba4944b9c7fb128e061a02dfca8910a77373b27 | def getRadar(self):
' get current radar '
return self.Vradar.value | get current radar | artview/components/plot_radar.py | getRadar | jjhelmus/artview | 0 | python | def getRadar(self):
' '
return self.Vradar.value | def getRadar(self):
' '
return self.Vradar.value<|docstring|>get current radar<|endoftext|> |
57c0595c8781bd7d69e196f52c946a0aeea26334c4dbe9a1586a4f1e00de3092 | def __init__(self):
'Initialize the class to create the interface.'
super(_DisplayStart, self).__init__()
self.result = {}
self.layout = QtGui.QGridLayout(self)
self.setWindowModality(QtCore.Qt.ApplicationModal)
self.setupUi() | Initialize the class to create the interface. | artview/components/plot_radar.py | __init__ | jjhelmus/artview | 0 | python | def __init__(self):
super(_DisplayStart, self).__init__()
self.result = {}
self.layout = QtGui.QGridLayout(self)
self.setWindowModality(QtCore.Qt.ApplicationModal)
self.setupUi() | def __init__(self):
super(_DisplayStart, self).__init__()
self.result = {}
self.layout = QtGui.QGridLayout(self)
self.setWindowModality(QtCore.Qt.ApplicationModal)
self.setupUi()<|docstring|>Initialize the class to create the interface.<|endoftext|> |
193e2323bc583f08b04b040b3a511916c5fdf4404238194bab81e86a18b1cb99 | def select_classes(batch, classes, relabel=False):
'Select samples from a given list of classes.\n \n If relabel is true, transform labels to {1,...,len(classes)}.\n '
(x, y) = batch
per_class_indices = []
for c in classes:
indices = np.arange(x.shape[0])[(y == c)]
per_class_ind... | Select samples from a given list of classes.
If relabel is true, transform labels to {1,...,len(classes)}. | da_relax/data/utils.py | select_classes | yifan12wu/da-relax | 2 | python | def select_classes(batch, classes, relabel=False):
'Select samples from a given list of classes.\n \n If relabel is true, transform labels to {1,...,len(classes)}.\n '
(x, y) = batch
per_class_indices = []
for c in classes:
indices = np.arange(x.shape[0])[(y == c)]
per_class_ind... | def select_classes(batch, classes, relabel=False):
'Select samples from a given list of classes.\n \n If relabel is true, transform labels to {1,...,len(classes)}.\n '
(x, y) = batch
per_class_indices = []
for c in classes:
indices = np.arange(x.shape[0])[(y == c)]
per_class_ind... |
0e99a2648965bc7d3e50fca5ef385ffa9636dd76d6c760a6b83d95439d682b74 | def subsample(batch, sizes, seed=0):
'Subsample non-overlapping batches.\n\n batch: a list of np arrays with the same batch size.\n sizes: a list of integers.\n seed: random seed for sampling.\n\n return corresponding subsampled batches.\n '
n = batch[0].shape[0]
rand = np.random.RandomState(... | Subsample non-overlapping batches.
batch: a list of np arrays with the same batch size.
sizes: a list of integers.
seed: random seed for sampling.
return corresponding subsampled batches. | da_relax/data/utils.py | subsample | yifan12wu/da-relax | 2 | python | def subsample(batch, sizes, seed=0):
'Subsample non-overlapping batches.\n\n batch: a list of np arrays with the same batch size.\n sizes: a list of integers.\n seed: random seed for sampling.\n\n return corresponding subsampled batches.\n '
n = batch[0].shape[0]
rand = np.random.RandomState(... | def subsample(batch, sizes, seed=0):
'Subsample non-overlapping batches.\n\n batch: a list of np arrays with the same batch size.\n sizes: a list of integers.\n seed: random seed for sampling.\n\n return corresponding subsampled batches.\n '
n = batch[0].shape[0]
rand = np.random.RandomState(... |
5fa2e685ac58ec10ba2265565447da7b4efc05feae0b225f81de4b4b06655c03 | @property
def gelf(self):
'Return the Graylog logger client.'
if (not hasattr(self, '_gelf')):
self._gelf = UdpClient(self.gelf_server, port=self.gelf_port, mtu=self.mtu, source=self.source)
return self._gelf | Return the Graylog logger client. | src/python/zensols/gelfglance/log.py | gelf | plandes/gelfglance | 0 | python | @property
def gelf(self):
if (not hasattr(self, '_gelf')):
self._gelf = UdpClient(self.gelf_server, port=self.gelf_port, mtu=self.mtu, source=self.source)
return self._gelf | @property
def gelf(self):
if (not hasattr(self, '_gelf')):
self._gelf = UdpClient(self.gelf_server, port=self.gelf_port, mtu=self.mtu, source=self.source)
return self._gelf<|docstring|>Return the Graylog logger client.<|endoftext|> |
a89274a5f8ff1ab5bf691d45c4992a9256a76d7e2375ec17ce3659667e754af4 | @property
def glances(self):
'Return the Glances client.'
if (not hasattr(self, '_glances')):
self._glances = GlancesClient(self.glances_server, self.glances_port)
return self._glances | Return the Glances client. | src/python/zensols/gelfglance/log.py | glances | plandes/gelfglance | 0 | python | @property
def glances(self):
if (not hasattr(self, '_glances')):
self._glances = GlancesClient(self.glances_server, self.glances_port)
return self._glances | @property
def glances(self):
if (not hasattr(self, '_glances')):
self._glances = GlancesClient(self.glances_server, self.glances_port)
return self._glances<|docstring|>Return the Glances client.<|endoftext|> |
d23075250a51079c8616ffb1b21bc379e604d600c3739ae9d4c99798837477e7 | def send_message(self, message, additional_data, level=syslog.LOG_INFO):
'Send a Gelf message with Glances statistics.'
data = {'short_message': message, 'program': 'glances', 'level': level}
if self.source:
data['host'] = self.source
data.update(additional_data)
logger.debug('sending messag... | Send a Gelf message with Glances statistics. | src/python/zensols/gelfglance/log.py | send_message | plandes/gelfglance | 0 | python | def send_message(self, message, additional_data, level=syslog.LOG_INFO):
data = {'short_message': message, 'program': 'glances', 'level': level}
if self.source:
data['host'] = self.source
data.update(additional_data)
logger.debug('sending message to {}:{} -> <{}>'.format(self.gelf_server, s... | def send_message(self, message, additional_data, level=syslog.LOG_INFO):
data = {'short_message': message, 'program': 'glances', 'level': level}
if self.source:
data['host'] = self.source
data.update(additional_data)
logger.debug('sending message to {}:{} -> <{}>'.format(self.gelf_server, s... |
0461b7f0a2db62db905cdef244241541edcf329e4871d393102ef9e94ae6c1d2 | def collect_and_send(self):
'Collect glances data and send to Graylog.'
data = self.glances.get()
msg = 'System statistics for {}'.format(self.glances.format_system())
self.send_message(msg, data) | Collect glances data and send to Graylog. | src/python/zensols/gelfglance/log.py | collect_and_send | plandes/gelfglance | 0 | python | def collect_and_send(self):
data = self.glances.get()
msg = 'System statistics for {}'.format(self.glances.format_system())
self.send_message(msg, data) | def collect_and_send(self):
data = self.glances.get()
msg = 'System statistics for {}'.format(self.glances.format_system())
self.send_message(msg, data)<|docstring|>Collect glances data and send to Graylog.<|endoftext|> |
0da24867ed31145037f0301e939afb2f28f3a718eef8d841f4f50b1b65d80ef8 | def start(self):
'Start the logger as a /server/ by looping on a timeout.'
logger.info("starting gelf_server {gelf_server} on {gelf_port} from source '{source}', timeout(s)={timeout_secs}, count={count}".format(**vars(self)))
while ((self.count is None) or (self.count > 0)):
logger.debug('timeout_se... | Start the logger as a /server/ by looping on a timeout. | src/python/zensols/gelfglance/log.py | start | plandes/gelfglance | 0 | python | def start(self):
logger.info("starting gelf_server {gelf_server} on {gelf_port} from source '{source}', timeout(s)={timeout_secs}, count={count}".format(**vars(self)))
while ((self.count is None) or (self.count > 0)):
logger.debug('timeout_secs ({}) up'.format(self.timeout_secs))
try:
... | def start(self):
logger.info("starting gelf_server {gelf_server} on {gelf_port} from source '{source}', timeout(s)={timeout_secs}, count={count}".format(**vars(self)))
while ((self.count is None) or (self.count > 0)):
logger.debug('timeout_secs ({}) up'.format(self.timeout_secs))
try:
... |
1b46777d6c42bacd653b32aea71f31aec1a0fc77ce2716de43e658c3a2858b78 | def merge_dicts(*dicts):
'\n Given any number of dicts, shallow copy and merge into a new dict,\n precedence goes to key value pairs in latter dicts.\n\n Source: https://stackoverflow.com/q/38987\n '
result = {}
for dictionary in dicts:
result.update(dictionary)
return result | Given any number of dicts, shallow copy and merge into a new dict,
precedence goes to key value pairs in latter dicts.
Source: https://stackoverflow.com/q/38987 | eve_sqlalchemy/utils.py | merge_dicts | ernests/eve-sqlalchemy | 126 | python | def merge_dicts(*dicts):
'\n Given any number of dicts, shallow copy and merge into a new dict,\n precedence goes to key value pairs in latter dicts.\n\n Source: https://stackoverflow.com/q/38987\n '
result = {}
for dictionary in dicts:
result.update(dictionary)
return result | def merge_dicts(*dicts):
'\n Given any number of dicts, shallow copy and merge into a new dict,\n precedence goes to key value pairs in latter dicts.\n\n Source: https://stackoverflow.com/q/38987\n '
result = {}
for dictionary in dicts:
result.update(dictionary)
return result<|docstr... |
06b53018af77cb8df17499879e5fe68a7d2333f7e040412fb96ac90eafc91f49 | def sqla_object_to_dict(obj, fields):
' Creates a dict containing copies of the requested fields from the\n SQLAlchemy query result '
if (config.LAST_UPDATED not in fields):
fields.append(config.LAST_UPDATED)
if (config.DATE_CREATED not in fields):
fields.append(config.DATE_CREATED)
i... | Creates a dict containing copies of the requested fields from the
SQLAlchemy query result | eve_sqlalchemy/utils.py | sqla_object_to_dict | ernests/eve-sqlalchemy | 126 | python | def sqla_object_to_dict(obj, fields):
' Creates a dict containing copies of the requested fields from the\n SQLAlchemy query result '
if (config.LAST_UPDATED not in fields):
fields.append(config.LAST_UPDATED)
if (config.DATE_CREATED not in fields):
fields.append(config.DATE_CREATED)
i... | def sqla_object_to_dict(obj, fields):
' Creates a dict containing copies of the requested fields from the\n SQLAlchemy query result '
if (config.LAST_UPDATED not in fields):
fields.append(config.LAST_UPDATED)
if (config.DATE_CREATED not in fields):
fields.append(config.DATE_CREATED)
i... |
f597bde9f0a09d99d95537e65d50c44b6866f50b72596103f314bcb22b2af281 | def results_from_folder_to_df(folder: str, n_defaults_in_file: int, budget: int, constraints: typing.Optional[typing.Dict[(int, typing.List[str])]], raise_if_not_enough: bool, log: bool) -> typing.Tuple[(pd.DataFrame, pd.DataFrame)]:
'\n Traverses all subdirecties, and obtains stored runs with evaluation scores.... | Traverses all subdirecties, and obtains stored runs with evaluation scores.
Parameters
----------
folder: str
The folder that should be traversed (recursively)
n_defaults_in_file: str
max number of defaults to be found
budget: int
Number of iterations
constraints: dict (optional)
dict mapping from a... | openmldefaults/utils/misc.py | results_from_folder_to_df | pfistfl/openml-defaults | 1 | python | def results_from_folder_to_df(folder: str, n_defaults_in_file: int, budget: int, constraints: typing.Optional[typing.Dict[(int, typing.List[str])]], raise_if_not_enough: bool, log: bool) -> typing.Tuple[(pd.DataFrame, pd.DataFrame)]:
'\n Traverses all subdirecties, and obtains stored runs with evaluation scores.... | def results_from_folder_to_df(folder: str, n_defaults_in_file: int, budget: int, constraints: typing.Optional[typing.Dict[(int, typing.List[str])]], raise_if_not_enough: bool, log: bool) -> typing.Tuple[(pd.DataFrame, pd.DataFrame)]:
'\n Traverses all subdirecties, and obtains stored runs with evaluation scores.... |
f63e8355ad7ecea5f4ff935b52ea08e5bed941108302a8cccbcf89aa3c9cec35 | def __init__(self, eventnum, timestamp, channel, data):
'\n Initializer\n '
self.eventnum = eventnum
'Event number'
self.timestamp = timestamp
'Microseconds since 00:00:00 Jan 1, 1970 UTC marking the time at\n which the message was originally received\n '
self.channel... | Initializer | externals/lcm/lcm-1.0.0/lcm-python/lcm/__init__.py | __init__ | ericmanzi/double_pendulum_lqr | 0 | python | def __init__(self, eventnum, timestamp, channel, data):
'\n \n '
self.eventnum = eventnum
'Event number'
self.timestamp = timestamp
'Microseconds since 00:00:00 Jan 1, 1970 UTC marking the time at\n which the message was originally received\n '
self.channel = channel
... | def __init__(self, eventnum, timestamp, channel, data):
'\n \n '
self.eventnum = eventnum
'Event number'
self.timestamp = timestamp
'Microseconds since 00:00:00 Jan 1, 1970 UTC marking the time at\n which the message was originally received\n '
self.channel = channel
... |
edadba7684dd973cc086c23a8d0eaf0a2c29c501502b581ba2ca2242ba637567 | def __init__(self, path, mode='r', overwrite=False):
"\n Initializer\n\n @param path: Path to the logfile to open\n @param mode: Open the log for reading ('r') or writing ('w')\n @param overwrite: If mode is 'w', and the filename at path already \n exists, then EventLog will tr... | Initializer
@param path: Path to the logfile to open
@param mode: Open the log for reading ('r') or writing ('w')
@param overwrite: If mode is 'w', and the filename at path already
exists, then EventLog will truncate and overwrite the file if this
parameter is set to True. Otherwise, EventLog refuses to overwrite... | externals/lcm/lcm-1.0.0/lcm-python/lcm/__init__.py | __init__ | ericmanzi/double_pendulum_lqr | 0 | python | def __init__(self, path, mode='r', overwrite=False):
"\n Initializer\n\n @param path: Path to the logfile to open\n @param mode: Open the log for reading ('r') or writing ('w')\n @param overwrite: If mode is 'w', and the filename at path already \n exists, then EventLog will tr... | def __init__(self, path, mode='r', overwrite=False):
"\n Initializer\n\n @param path: Path to the logfile to open\n @param mode: Open the log for reading ('r') or writing ('w')\n @param overwrite: If mode is 'w', and the filename at path already \n exists, then EventLog will tr... |
db62c9be56855ed5d17b8002b0d599f8fb637944b79458705d6ccdfb29018fed | def seek(self, filepos):
'\n Positions the internal file pointer at the next event that\n starts at or is after byte offset filepos.\n\n @param filepos: byte offset from start of log\n\n @return: None\n '
return self.c_eventlog.seek(filepos) | Positions the internal file pointer at the next event that
starts at or is after byte offset filepos.
@param filepos: byte offset from start of log
@return: None | externals/lcm/lcm-1.0.0/lcm-python/lcm/__init__.py | seek | ericmanzi/double_pendulum_lqr | 0 | python | def seek(self, filepos):
'\n Positions the internal file pointer at the next event that\n starts at or is after byte offset filepos.\n\n @param filepos: byte offset from start of log\n\n @return: None\n '
return self.c_eventlog.seek(filepos) | def seek(self, filepos):
'\n Positions the internal file pointer at the next event that\n starts at or is after byte offset filepos.\n\n @param filepos: byte offset from start of log\n\n @return: None\n '
return self.c_eventlog.seek(filepos)<|docstring|>Positions the internal ... |
b993c17a5792156f1dd65b6ab4489688c4ec3cc7c91ca0841d7f6667dd0d7443 | def size(self):
'\n @return: the total size of the log file, in bytes\n @rtype: int\n '
return self.c_eventlog.size() | @return: the total size of the log file, in bytes
@rtype: int | externals/lcm/lcm-1.0.0/lcm-python/lcm/__init__.py | size | ericmanzi/double_pendulum_lqr | 0 | python | def size(self):
'\n @return: the total size of the log file, in bytes\n @rtype: int\n '
return self.c_eventlog.size() | def size(self):
'\n @return: the total size of the log file, in bytes\n @rtype: int\n '
return self.c_eventlog.size()<|docstring|>@return: the total size of the log file, in bytes
@rtype: int<|endoftext|> |
27734ff2cb3461c16a0baa8b7809aa6b247d7d19c6d363dde49b999c337d4d25 | def close(self):
'\n Closes the log file. After an EventLog is closed, it is essentially\n useless\n\n @return: None\n '
return self.c_eventlog.close() | Closes the log file. After an EventLog is closed, it is essentially
useless
@return: None | externals/lcm/lcm-1.0.0/lcm-python/lcm/__init__.py | close | ericmanzi/double_pendulum_lqr | 0 | python | def close(self):
'\n Closes the log file. After an EventLog is closed, it is essentially\n useless\n\n @return: None\n '
return self.c_eventlog.close() | def close(self):
'\n Closes the log file. After an EventLog is closed, it is essentially\n useless\n\n @return: None\n '
return self.c_eventlog.close()<|docstring|>Closes the log file. After an EventLog is closed, it is essentially
useless
@return: None<|endoftext|> |
8be98b1c0e45c79f397b6350c2b5bd49de8e070aee5a7887c9d60d5ba7b67b84 | def write_event(self, utime, channel, data):
'\n Writes an event to the log file. Log file must be openeed in write\n mode.\n\n @param utime: Microseconds since 00:00:00 Jan 1, 1970 UTC\n @param channel: Channel name corresponding to the event\n @param data: data bytes\n\... | Writes an event to the log file. Log file must be openeed in write
mode.
@param utime: Microseconds since 00:00:00 Jan 1, 1970 UTC
@param channel: Channel name corresponding to the event
@param data: data bytes
@return: None | externals/lcm/lcm-1.0.0/lcm-python/lcm/__init__.py | write_event | ericmanzi/double_pendulum_lqr | 0 | python | def write_event(self, utime, channel, data):
'\n Writes an event to the log file. Log file must be openeed in write\n mode.\n\n @param utime: Microseconds since 00:00:00 Jan 1, 1970 UTC\n @param channel: Channel name corresponding to the event\n @param data: data bytes\n\... | def write_event(self, utime, channel, data):
'\n Writes an event to the log file. Log file must be openeed in write\n mode.\n\n @param utime: Microseconds since 00:00:00 Jan 1, 1970 UTC\n @param channel: Channel name corresponding to the event\n @param data: data bytes\n\... |
4c083bbad250605661de18828a78153377ea6133ab60d00e5871deedf64f8cdb | def read_next_event(self):
'\n @return: the next L{Event<lcm.Event>} in the log file.\n @rtype: L{Event<lcm.Event>}\n '
tup = self.c_eventlog.read_next_event()
if (not tup):
return None
return Event(*tup) | @return: the next L{Event<lcm.Event>} in the log file.
@rtype: L{Event<lcm.Event>} | externals/lcm/lcm-1.0.0/lcm-python/lcm/__init__.py | read_next_event | ericmanzi/double_pendulum_lqr | 0 | python | def read_next_event(self):
'\n @return: the next L{Event<lcm.Event>} in the log file.\n @rtype: L{Event<lcm.Event>}\n '
tup = self.c_eventlog.read_next_event()
if (not tup):
return None
return Event(*tup) | def read_next_event(self):
'\n @return: the next L{Event<lcm.Event>} in the log file.\n @rtype: L{Event<lcm.Event>}\n '
tup = self.c_eventlog.read_next_event()
if (not tup):
return None
return Event(*tup)<|docstring|>@return: the next L{Event<lcm.Event>} in the log file.
@rt... |
6bd23dfe584db90c9c1ad06913e91210506554ec8611a1038514ba50b1d8b488 | def next(self):
'\n @rtype: L{Event<lcm.Event>}\n '
next_evt = self.read_next_event()
if (not next_evt):
raise StopIteration
return next_evt | @rtype: L{Event<lcm.Event>} | externals/lcm/lcm-1.0.0/lcm-python/lcm/__init__.py | next | ericmanzi/double_pendulum_lqr | 0 | python | def next(self):
'\n \n '
next_evt = self.read_next_event()
if (not next_evt):
raise StopIteration
return next_evt | def next(self):
'\n \n '
next_evt = self.read_next_event()
if (not next_evt):
raise StopIteration
return next_evt<|docstring|>@rtype: L{Event<lcm.Event>}<|endoftext|> |
9ecb4ad171a125dde10b0373eff1a3c9243752f29033c09bf938ff35fff6aa0c | def tell(self):
'\n @return: the current position of the internal file pointer, in bytes\n @rtype: int\n '
return self.c_eventlog.ftell() | @return: the current position of the internal file pointer, in bytes
@rtype: int | externals/lcm/lcm-1.0.0/lcm-python/lcm/__init__.py | tell | ericmanzi/double_pendulum_lqr | 0 | python | def tell(self):
'\n @return: the current position of the internal file pointer, in bytes\n @rtype: int\n '
return self.c_eventlog.ftell() | def tell(self):
'\n @return: the current position of the internal file pointer, in bytes\n @rtype: int\n '
return self.c_eventlog.ftell()<|docstring|>@return: the current position of the internal file pointer, in bytes
@rtype: int<|endoftext|> |
0b8c2c49dfab67d1c8fee56bd409af3ce6157b7375f45d301fe68a4525c189d7 | def test_create_dictionary_key_with_string():
'Try creating a key using a string instead of a dict.\n '
with pytest.raises(TypeError):
utils.create_dictionary_key('something') | Try creating a key using a string instead of a dict. | tests/test_utils.py | test_create_dictionary_key_with_string | TechGeekD/garcon | 37 | python | def test_create_dictionary_key_with_string():
'\n '
with pytest.raises(TypeError):
utils.create_dictionary_key('something') | def test_create_dictionary_key_with_string():
'\n '
with pytest.raises(TypeError):
utils.create_dictionary_key('something')<|docstring|>Try creating a key using a string instead of a dict.<|endoftext|> |
30ca6fdda7443c5ee62b01345dff1fb0f8761c3995bb2807128f569aa432b9e4 | def test_create_dictionary_key_with_empty_dict():
'Try creating a key using an empty dictionary.\n '
with pytest.raises(ValueError):
utils.create_dictionary_key(dict()) | Try creating a key using an empty dictionary. | tests/test_utils.py | test_create_dictionary_key_with_empty_dict | TechGeekD/garcon | 37 | python | def test_create_dictionary_key_with_empty_dict():
'\n '
with pytest.raises(ValueError):
utils.create_dictionary_key(dict()) | def test_create_dictionary_key_with_empty_dict():
'\n '
with pytest.raises(ValueError):
utils.create_dictionary_key(dict())<|docstring|>Try creating a key using an empty dictionary.<|endoftext|> |
27ef64476d66bca030dfc5dd21cb5b44f3e62fdd3528a560f84b08a52e8510e2 | def test_create_dictionary_key():
'Try creating a unique key from a dict.\n '
values = [dict(foo=10), dict(foo2=datetime.datetime.now())]
for value in values:
assert (len(utils.create_dictionary_key(value)) == 40) | Try creating a unique key from a dict. | tests/test_utils.py | test_create_dictionary_key | TechGeekD/garcon | 37 | python | def test_create_dictionary_key():
'\n '
values = [dict(foo=10), dict(foo2=datetime.datetime.now())]
for value in values:
assert (len(utils.create_dictionary_key(value)) == 40) | def test_create_dictionary_key():
'\n '
values = [dict(foo=10), dict(foo2=datetime.datetime.now())]
for value in values:
assert (len(utils.create_dictionary_key(value)) == 40)<|docstring|>Try creating a unique key from a dict.<|endoftext|> |
27ef64476d66bca030dfc5dd21cb5b44f3e62fdd3528a560f84b08a52e8510e2 | def test_create_dictionary_key():
'Try creating a unique key from a dict.\n '
values = [dict(foo=10), dict(foo2=datetime.datetime.now())]
for value in values:
assert (len(utils.create_dictionary_key(value)) == 40) | Try creating a unique key from a dict. | tests/test_utils.py | test_create_dictionary_key | TechGeekD/garcon | 37 | python | def test_create_dictionary_key():
'\n '
values = [dict(foo=10), dict(foo2=datetime.datetime.now())]
for value in values:
assert (len(utils.create_dictionary_key(value)) == 40) | def test_create_dictionary_key():
'\n '
values = [dict(foo=10), dict(foo2=datetime.datetime.now())]
for value in values:
assert (len(utils.create_dictionary_key(value)) == 40)<|docstring|>Try creating a unique key from a dict.<|endoftext|> |
9ca57352760fce9ad10737805acb712ba9cf0a83b2bf4f698845338ec6069371 | def test_non_throttle_error():
'Assert SWF error is evaluated as non-throttle error properly.\n '
exception = exceptions.ClientError({'Error': {'Code': 'ThrottlingException'}}, 'operationName')
result = utils.non_throttle_error(exception)
assert (not utils.non_throttle_error(exception))
exception... | Assert SWF error is evaluated as non-throttle error properly. | tests/test_utils.py | test_non_throttle_error | TechGeekD/garcon | 37 | python | def test_non_throttle_error():
'\n '
exception = exceptions.ClientError({'Error': {'Code': 'ThrottlingException'}}, 'operationName')
result = utils.non_throttle_error(exception)
assert (not utils.non_throttle_error(exception))
exception = exceptions.ClientError({'Error': {'Code': 'RateExceeded'}}... | def test_non_throttle_error():
'\n '
exception = exceptions.ClientError({'Error': {'Code': 'ThrottlingException'}}, 'operationName')
result = utils.non_throttle_error(exception)
assert (not utils.non_throttle_error(exception))
exception = exceptions.ClientError({'Error': {'Code': 'RateExceeded'}}... |
a8b0cc31f0bc31ff8f2ccbffdd82e7c2ee0b3608875c013c59a28bdbe06f0249 | def test_throttle_backoff_handler():
'Assert backoff is logged correctly.\n '
mock_activity = MagicMock()
details = dict(args=(mock_activity,), tries=5, wait=10)
utils.throttle_backoff_handler(details)
mock_activity.logger.info.assert_called_with('Throttle Exception occurred on try {}. Sleeping f... | Assert backoff is logged correctly. | tests/test_utils.py | test_throttle_backoff_handler | TechGeekD/garcon | 37 | python | def test_throttle_backoff_handler():
'\n '
mock_activity = MagicMock()
details = dict(args=(mock_activity,), tries=5, wait=10)
utils.throttle_backoff_handler(details)
mock_activity.logger.info.assert_called_with('Throttle Exception occurred on try {}. Sleeping for {} seconds'.format(details['trie... | def test_throttle_backoff_handler():
'\n '
mock_activity = MagicMock()
details = dict(args=(mock_activity,), tries=5, wait=10)
utils.throttle_backoff_handler(details)
mock_activity.logger.info.assert_called_with('Throttle Exception occurred on try {}. Sleeping for {} seconds'.format(details['trie... |
99ca6ee7238b81975795d2a7040f35a9ac686fc5667d76e81881828582c06f20 | def prepare_y(self, one_hot_y: np.ndarray):
'Zero-pad segmentation targets\n\n Parameters\n ----------\n one_hot_y : (num_frames, num_speakers) np.ndarray\n One-hot-encoding of current chunk speaker activity:\n * one_hot_y[t, k] = 1 if kth speaker is active at tth fram... | Zero-pad segmentation targets
Parameters
----------
one_hot_y : (num_frames, num_speakers) np.ndarray
One-hot-encoding of current chunk speaker activity:
* one_hot_y[t, k] = 1 if kth speaker is active at tth frame
* one_hot_y[t, k] = 0 otherwise.
Returns
-------
padded_one_hot_y : (num_frames, sel... | pyannote/audio/tasks/segmentation/segmentation.py | prepare_y | juanmc2005/pyannote-audio | 1 | python | def prepare_y(self, one_hot_y: np.ndarray):
'Zero-pad segmentation targets\n\n Parameters\n ----------\n one_hot_y : (num_frames, num_speakers) np.ndarray\n One-hot-encoding of current chunk speaker activity:\n * one_hot_y[t, k] = 1 if kth speaker is active at tth fram... | def prepare_y(self, one_hot_y: np.ndarray):
'Zero-pad segmentation targets\n\n Parameters\n ----------\n one_hot_y : (num_frames, num_speakers) np.ndarray\n One-hot-encoding of current chunk speaker activity:\n * one_hot_y[t, k] = 1 if kth speaker is active at tth fram... |
2cdd2a9dea844517ead74e7d1846d44919ef7949e8ac82d0afd08fa810679441 | def train__iter__(self):
'Iterate over training samples\n\n Yields\n ------\n X: (time, channel)\n Audio chunks.\n y: (frame, )\n Frame-level targets. Note that frame < time.\n `frame` is infered automagically from the\n example model output.\n... | Iterate over training samples
Yields
------
X: (time, channel)
Audio chunks.
y: (frame, )
Frame-level targets. Note that frame < time.
`frame` is infered automagically from the
example model output. | pyannote/audio/tasks/segmentation/segmentation.py | train__iter__ | juanmc2005/pyannote-audio | 1 | python | def train__iter__(self):
'Iterate over training samples\n\n Yields\n ------\n X: (time, channel)\n Audio chunks.\n y: (frame, )\n Frame-level targets. Note that frame < time.\n `frame` is infered automagically from the\n example model output.\n... | def train__iter__(self):
'Iterate over training samples\n\n Yields\n ------\n X: (time, channel)\n Audio chunks.\n y: (frame, )\n Frame-level targets. Note that frame < time.\n `frame` is infered automagically from the\n example model output.\n... |
ef3ba9c4e82bd8dcb00a8374d9248d5fe79f3cc0f5f574c408a54e1f464887b2 | def segmentation_loss(self, y: torch.Tensor, y_pred: torch.Tensor) -> torch.Tensor:
'Permutation-invariant segmentation loss\n\n Parameters\n ----------\n y : (batch_size, num_frames, num_speakers) torch.Tensor\n Speaker activity.\n y_pred : torch.Tensor\n Speaker a... | Permutation-invariant segmentation loss
Parameters
----------
y : (batch_size, num_frames, num_speakers) torch.Tensor
Speaker activity.
y_pred : torch.Tensor
Speaker activations
Returns
-------
seg_loss : torch.Tensor
Permutation-invariant segmentation loss | pyannote/audio/tasks/segmentation/segmentation.py | segmentation_loss | juanmc2005/pyannote-audio | 1 | python | def segmentation_loss(self, y: torch.Tensor, y_pred: torch.Tensor) -> torch.Tensor:
'Permutation-invariant segmentation loss\n\n Parameters\n ----------\n y : (batch_size, num_frames, num_speakers) torch.Tensor\n Speaker activity.\n y_pred : torch.Tensor\n Speaker a... | def segmentation_loss(self, y: torch.Tensor, y_pred: torch.Tensor) -> torch.Tensor:
'Permutation-invariant segmentation loss\n\n Parameters\n ----------\n y : (batch_size, num_frames, num_speakers) torch.Tensor\n Speaker activity.\n y_pred : torch.Tensor\n Speaker a... |
5d4417754b38f603f1a72dd1cfcca8fb5099b163dc146c61d77328c0f94d7473 | def training_step(self, batch, batch_idx: int):
'Compute permutation-invariant binary cross-entropy\n\n Parameters\n ----------\n batch : (usually) dict of torch.Tensor\n Current batch.\n batch_idx: int\n Batch index.\n\n Returns\n -------\n los... | Compute permutation-invariant binary cross-entropy
Parameters
----------
batch : (usually) dict of torch.Tensor
Current batch.
batch_idx: int
Batch index.
Returns
-------
loss : {str: torch.tensor}
{"loss": loss} with additional "loss_{task_name}" keys for multi-task models. | pyannote/audio/tasks/segmentation/segmentation.py | training_step | juanmc2005/pyannote-audio | 1 | python | def training_step(self, batch, batch_idx: int):
'Compute permutation-invariant binary cross-entropy\n\n Parameters\n ----------\n batch : (usually) dict of torch.Tensor\n Current batch.\n batch_idx: int\n Batch index.\n\n Returns\n -------\n los... | def training_step(self, batch, batch_idx: int):
'Compute permutation-invariant binary cross-entropy\n\n Parameters\n ----------\n batch : (usually) dict of torch.Tensor\n Current batch.\n batch_idx: int\n Batch index.\n\n Returns\n -------\n los... |
76155bdab95e62d3ea7b7be266ac622eda4197d1e7f181e69849d2743606d16d | def validation_step(self, batch, batch_idx: int):
'Compute validation F-score\n\n Parameters\n ----------\n batch : dict of torch.Tensor\n Current batch.\n batch_idx: int\n Batch index.\n '
self.val_fbeta.to(self.model.device)
(X, y) = (batch['X'], ba... | Compute validation F-score
Parameters
----------
batch : dict of torch.Tensor
Current batch.
batch_idx: int
Batch index. | pyannote/audio/tasks/segmentation/segmentation.py | validation_step | juanmc2005/pyannote-audio | 1 | python | def validation_step(self, batch, batch_idx: int):
'Compute validation F-score\n\n Parameters\n ----------\n batch : dict of torch.Tensor\n Current batch.\n batch_idx: int\n Batch index.\n '
self.val_fbeta.to(self.model.device)
(X, y) = (batch['X'], ba... | def validation_step(self, batch, batch_idx: int):
'Compute validation F-score\n\n Parameters\n ----------\n batch : dict of torch.Tensor\n Current batch.\n batch_idx: int\n Batch index.\n '
self.val_fbeta.to(self.model.device)
(X, y) = (batch['X'], ba... |
00c4a1c948b6a4123d9388ab0e94d724dede41eeb2d4e56ecaa4c97943b84f39 | def save_attachments(report, directory):
'\n Save the report attachments to the given directory.\n :param report: Testplan report.\n :type report: ``testplan.testing.report.TestReport``\n :param directory: Directory to save attachments in.\n :type directory: ``str``\n '
attachments = getattr(r... | Save the report attachments to the given directory.
:param report: Testplan report.
:type report: ``testplan.testing.report.TestReport``
:param directory: Directory to save attachments in.
:type directory: ``str`` | testplan/exporters/testing/base.py | save_attachments | Pyifan/testplan | 96 | python | def save_attachments(report, directory):
'\n Save the report attachments to the given directory.\n :param report: Testplan report.\n :type report: ``testplan.testing.report.TestReport``\n :param directory: Directory to save attachments in.\n :type directory: ``str``\n '
attachments = getattr(r... | def save_attachments(report, directory):
'\n Save the report attachments to the given directory.\n :param report: Testplan report.\n :type report: ``testplan.testing.report.TestReport``\n :param directory: Directory to save attachments in.\n :type directory: ``str``\n '
attachments = getattr(r... |
7be689ff34bcae1689ec325e48e43ed1a0319249a0f5014128a011cbf5d5c191 | def get_params(self, tag_dict, filter_type):
"\n Return the keyword parameters (as a dict) that will be used for\n `exporter_class` instance initialization. The keys and values\n should be valid arguments in line with `exporter_class`'s config.\n\n :param tag_dict: Tag context for the cu... | Return the keyword parameters (as a dict) that will be used for
`exporter_class` instance initialization. The keys and values
should be valid arguments in line with `exporter_class`'s config.
:param tag_dict: Tag context for the current sub-export operation.
:type tag_dict: ``dict`` of ``set``
:param filter_type: all ... | testplan/exporters/testing/base.py | get_params | Pyifan/testplan | 96 | python | def get_params(self, tag_dict, filter_type):
"\n Return the keyword parameters (as a dict) that will be used for\n `exporter_class` instance initialization. The keys and values\n should be valid arguments in line with `exporter_class`'s config.\n\n :param tag_dict: Tag context for the cu... | def get_params(self, tag_dict, filter_type):
"\n Return the keyword parameters (as a dict) that will be used for\n `exporter_class` instance initialization. The keys and values\n should be valid arguments in line with `exporter_class`'s config.\n\n :param tag_dict: Tag context for the cu... |
87cafaa88cbcc4a09719b7125ec1647381f725b72c648648cf0d1d63aa0a14b9 | def get_exporter(self, **params):
'\n Return a new instance of `exporter_class`,\n initialized with given `params`.\n\n :param params: Keyword arguments that will be\n used for initializing `exporter_class`.\n :return: Instance of `exporter_class`\n '
if ... | Return a new instance of `exporter_class`,
initialized with given `params`.
:param params: Keyword arguments that will be
used for initializing `exporter_class`.
:return: Instance of `exporter_class` | testplan/exporters/testing/base.py | get_exporter | Pyifan/testplan | 96 | python | def get_exporter(self, **params):
'\n Return a new instance of `exporter_class`,\n initialized with given `params`.\n\n :param params: Keyword arguments that will be\n used for initializing `exporter_class`.\n :return: Instance of `exporter_class`\n '
if ... | def get_exporter(self, **params):
'\n Return a new instance of `exporter_class`,\n initialized with given `params`.\n\n :param params: Keyword arguments that will be\n used for initializing `exporter_class`.\n :return: Instance of `exporter_class`\n '
if ... |
0e95016c5cb67f38f125c3916d48ea0947830014c9a9211880ae72b4ff0686d9 | def get_filtered_source(self, source, tag_dict, filter_type):
"\n Create a clone of the original report and\n filter it with the given filter type & tag context.\n\n Also populate cloned report's meta\n attribute with the tag label.\n\n :param source: Original test report.\n ... | Create a clone of the original report and
filter it with the given filter type & tag context.
Also populate cloned report's meta
attribute with the tag label.
:param source: Original test report.
:type source: :py:class:`~testplan.report.testing.base.TestReport`
:param tag_dict: Tag context for the current filtered t... | testplan/exporters/testing/base.py | get_filtered_source | Pyifan/testplan | 96 | python | def get_filtered_source(self, source, tag_dict, filter_type):
"\n Create a clone of the original report and\n filter it with the given filter type & tag context.\n\n Also populate cloned report's meta\n attribute with the tag label.\n\n :param source: Original test report.\n ... | def get_filtered_source(self, source, tag_dict, filter_type):
"\n Create a clone of the original report and\n filter it with the given filter type & tag context.\n\n Also populate cloned report's meta\n attribute with the tag label.\n\n :param source: Original test report.\n ... |
fa08f5131969320d92accbaa42302ff946dc2eb0bd0b070d47aedcf97c243be8 | def get_skip_message(self, source, tag_dict, filter_type):
'\n :param source: Cloned test report.\n :type source: :py:class:`~testplan.report.testing.base.TestReport`\n :param tag_dict: Tag context for the current filtered test report.\n :type tag_dict: ``dict`` of ``set``\n :para... | :param source: Cloned test report.
:type source: :py:class:`~testplan.report.testing.base.TestReport`
:param tag_dict: Tag context for the current filtered test report.
:type tag_dict: ``dict`` of ``set``
:param filter_type: all / any
:type filter_type: ``str``
:return: String message to be displayed on skipped export ... | testplan/exporters/testing/base.py | get_skip_message | Pyifan/testplan | 96 | python | def get_skip_message(self, source, tag_dict, filter_type):
'\n :param source: Cloned test report.\n :type source: :py:class:`~testplan.report.testing.base.TestReport`\n :param tag_dict: Tag context for the current filtered test report.\n :type tag_dict: ``dict`` of ``set``\n :para... | def get_skip_message(self, source, tag_dict, filter_type):
'\n :param source: Cloned test report.\n :type source: :py:class:`~testplan.report.testing.base.TestReport`\n :param tag_dict: Tag context for the current filtered test report.\n :type tag_dict: ``dict`` of ``set``\n :para... |
064f07a24f52d7b33a34e455e8cbb1c134515ab0d125943a07ae81722f9d431c | def export_clones(self, source, tag_dicts, filter_type):
'\n Create clones of the original report using the given tag & filter\n context, initialize a new exporter for each clone and run the export\n operation, if the clone report is not empty.\n\n :param source: Original test report.\n ... | Create clones of the original report using the given tag & filter
context, initialize a new exporter for each clone and run the export
operation, if the clone report is not empty.
:param source: Original test report.
:type source: :py:class:`~testplan.report.testing.base.TestReport`
:param tag_dicts: List of tag dicti... | testplan/exporters/testing/base.py | export_clones | Pyifan/testplan | 96 | python | def export_clones(self, source, tag_dicts, filter_type):
'\n Create clones of the original report using the given tag & filter\n context, initialize a new exporter for each clone and run the export\n operation, if the clone report is not empty.\n\n :param source: Original test report.\n ... | def export_clones(self, source, tag_dicts, filter_type):
'\n Create clones of the original report using the given tag & filter\n context, initialize a new exporter for each clone and run the export\n operation, if the clone report is not empty.\n\n :param source: Original test report.\n ... |
0a00b89e27eaa546f935b213426fcdd3227e8ad3679d88ee590a5969f91a515d | def export(self, source):
'\n Run export operation for exact (all) and any matching tag groups.\n\n :param source: Test report.\n :type source: :py:class:`~testplan.report.testing.base.TestReport`\n :return: ``None``\n :rtype: ``NoneType``\n '
self.export_clones(source=... | Run export operation for exact (all) and any matching tag groups.
:param source: Test report.
:type source: :py:class:`~testplan.report.testing.base.TestReport`
:return: ``None``
:rtype: ``NoneType`` | testplan/exporters/testing/base.py | export | Pyifan/testplan | 96 | python | def export(self, source):
'\n Run export operation for exact (all) and any matching tag groups.\n\n :param source: Test report.\n :type source: :py:class:`~testplan.report.testing.base.TestReport`\n :return: ``None``\n :rtype: ``NoneType``\n '
self.export_clones(source=... | def export(self, source):
'\n Run export operation for exact (all) and any matching tag groups.\n\n :param source: Test report.\n :type source: :py:class:`~testplan.report.testing.base.TestReport`\n :return: ``None``\n :rtype: ``NoneType``\n '
self.export_clones(source=... |
0d32a7703cae74b968c0ef71686934835c098e35eae06608512fa74c0747257e | def set_training_data(self, *, inputs: Inputs) -> None:
'\n Set training data for outlier detection.\n Args:\n inputs: Container DataFrame\n\n Returns:\n None\n '
super().set_training_data(inputs=inputs) | Set training data for outlier detection.
Args:
inputs: Container DataFrame
Returns:
None | tods/detection_algorithm/PyodCOF.py | set_training_data | ZhuangweiKang/tods | 544 | python | def set_training_data(self, *, inputs: Inputs) -> None:
'\n Set training data for outlier detection.\n Args:\n inputs: Container DataFrame\n\n Returns:\n None\n '
super().set_training_data(inputs=inputs) | def set_training_data(self, *, inputs: Inputs) -> None:
'\n Set training data for outlier detection.\n Args:\n inputs: Container DataFrame\n\n Returns:\n None\n '
super().set_training_data(inputs=inputs)<|docstring|>Set training data for outlier detection.
Args:... |
e6765e590bc0165340ea0c83749f87ff1d8db19da1aa6048534f0667f9bea1aa | def fit(self, *, timeout: float=None, iterations: int=None) -> CallResult[None]:
'\n Fit model with training data.\n Args:\n *: Container DataFrame. Time series data up to fit.\n\n Returns:\n None\n '
return super().fit() | Fit model with training data.
Args:
*: Container DataFrame. Time series data up to fit.
Returns:
None | tods/detection_algorithm/PyodCOF.py | fit | ZhuangweiKang/tods | 544 | python | def fit(self, *, timeout: float=None, iterations: int=None) -> CallResult[None]:
'\n Fit model with training data.\n Args:\n *: Container DataFrame. Time series data up to fit.\n\n Returns:\n None\n '
return super().fit() | def fit(self, *, timeout: float=None, iterations: int=None) -> CallResult[None]:
'\n Fit model with training data.\n Args:\n *: Container DataFrame. Time series data up to fit.\n\n Returns:\n None\n '
return super().fit()<|docstring|>Fit model with training data... |
c64308d0fcca71c6f5bfe6f0f030d6a90ba6902222ee8b52f435f3628f05fd57 | def produce(self, *, inputs: Inputs, timeout: float=None, iterations: int=None) -> CallResult[Outputs]:
'\n Process the testing data.\n Args:\n inputs: Container DataFrame. Time series data up to outlier detection.\n\n Returns:\n Container DataFrame\n 1 marks Ou... | Process the testing data.
Args:
inputs: Container DataFrame. Time series data up to outlier detection.
Returns:
Container DataFrame
1 marks Outliers, 0 marks normal. | tods/detection_algorithm/PyodCOF.py | produce | ZhuangweiKang/tods | 544 | python | def produce(self, *, inputs: Inputs, timeout: float=None, iterations: int=None) -> CallResult[Outputs]:
'\n Process the testing data.\n Args:\n inputs: Container DataFrame. Time series data up to outlier detection.\n\n Returns:\n Container DataFrame\n 1 marks Ou... | def produce(self, *, inputs: Inputs, timeout: float=None, iterations: int=None) -> CallResult[Outputs]:
'\n Process the testing data.\n Args:\n inputs: Container DataFrame. Time series data up to outlier detection.\n\n Returns:\n Container DataFrame\n 1 marks Ou... |
e72c33f4ab1ae3145eb4905e66688995afac0f8ecc4ba61e4d44329b70ad3f07 | def produce_score(self, *, inputs: Inputs, timeout: float=None, iterations: int=None) -> CallResult[Outputs]:
'\n Process the testing data.\n Args:\n inputs: Container DataFrame. Time series data up to outlier detection.\n Returns:\n Container DataFrame\n Outlie... | Process the testing data.
Args:
inputs: Container DataFrame. Time series data up to outlier detection.
Returns:
Container DataFrame
Outlier score of input DataFrame. | tods/detection_algorithm/PyodCOF.py | produce_score | ZhuangweiKang/tods | 544 | python | def produce_score(self, *, inputs: Inputs, timeout: float=None, iterations: int=None) -> CallResult[Outputs]:
'\n Process the testing data.\n Args:\n inputs: Container DataFrame. Time series data up to outlier detection.\n Returns:\n Container DataFrame\n Outlie... | def produce_score(self, *, inputs: Inputs, timeout: float=None, iterations: int=None) -> CallResult[Outputs]:
'\n Process the testing data.\n Args:\n inputs: Container DataFrame. Time series data up to outlier detection.\n Returns:\n Container DataFrame\n Outlie... |
ae8ddd78bfcc72b05bf8306c9aae5ca6d922dd27ac7c51f771b3c6a0afaa492b | def get_params(self) -> Params:
'\n Return parameters.\n Args:\n None\n\n Returns:\n class Params\n '
return super().get_params() | Return parameters.
Args:
None
Returns:
class Params | tods/detection_algorithm/PyodCOF.py | get_params | ZhuangweiKang/tods | 544 | python | def get_params(self) -> Params:
'\n Return parameters.\n Args:\n None\n\n Returns:\n class Params\n '
return super().get_params() | def get_params(self) -> Params:
'\n Return parameters.\n Args:\n None\n\n Returns:\n class Params\n '
return super().get_params()<|docstring|>Return parameters.
Args:
None
Returns:
class Params<|endoftext|> |
bd94de68e4e753a11fe9f41054ffe62bff368b752ba739714bb3ce597fd290a2 | def set_params(self, *, params: Params) -> None:
'\n Set parameters for outlier detection.\n Args:\n params: class Params\n\n Returns:\n None\n '
super().set_params(params=params) | Set parameters for outlier detection.
Args:
params: class Params
Returns:
None | tods/detection_algorithm/PyodCOF.py | set_params | ZhuangweiKang/tods | 544 | python | def set_params(self, *, params: Params) -> None:
'\n Set parameters for outlier detection.\n Args:\n params: class Params\n\n Returns:\n None\n '
super().set_params(params=params) | def set_params(self, *, params: Params) -> None:
'\n Set parameters for outlier detection.\n Args:\n params: class Params\n\n Returns:\n None\n '
super().set_params(params=params)<|docstring|>Set parameters for outlier detection.
Args:
params: class Params
... |
a0e42d5e1c7ec5c686958dbf4a3783f1126d28df378ed42ca5935aedfdcca95b | def batch_examples(example, batch_size, max_length, mantissa_bits, shard_multiplier=1, length_multiplier=1, constant=False, num_threads=4, drop_long_sequences=True):
' Batch examples\n\n :param example: A dictionary of <feature name, Tensor>.\n :param batch_size: The number of tokens or sentences in a batch\n... | Batch examples
:param example: A dictionary of <feature name, Tensor>.
:param batch_size: The number of tokens or sentences in a batch
:param max_length: The maximum length of a example to keep
:param mantissa_bits: An integer
:param shard_multiplier: an integer increasing the batch_size to suit
splitting across d... | thumt/data/dataset.py | batch_examples | souradip93/GCDT | 72 | python | def batch_examples(example, batch_size, max_length, mantissa_bits, shard_multiplier=1, length_multiplier=1, constant=False, num_threads=4, drop_long_sequences=True):
' Batch examples\n\n :param example: A dictionary of <feature name, Tensor>.\n :param batch_size: The number of tokens or sentences in a batch\n... | def batch_examples(example, batch_size, max_length, mantissa_bits, shard_multiplier=1, length_multiplier=1, constant=False, num_threads=4, drop_long_sequences=True):
' Batch examples\n\n :param example: A dictionary of <feature name, Tensor>.\n :param batch_size: The number of tokens or sentences in a batch\n... |
249282c74741f10af0e34c56333b99968355e70d0903faea6001fc393e37d69c | def get_training_input(filenames, params):
' Get input for training stage\n\n :param filenames: A list contains [source_filename, target_filename]\n :param params: Hyper-parameters\n\n :returns: A dictionary of pair <Key, Tensor>\n '
with tf.device('/cpu:0'):
def parse_fn(line_words, line_t... | Get input for training stage
:param filenames: A list contains [source_filename, target_filename]
:param params: Hyper-parameters
:returns: A dictionary of pair <Key, Tensor> | thumt/data/dataset.py | get_training_input | souradip93/GCDT | 72 | python | def get_training_input(filenames, params):
' Get input for training stage\n\n :param filenames: A list contains [source_filename, target_filename]\n :param params: Hyper-parameters\n\n :returns: A dictionary of pair <Key, Tensor>\n '
with tf.device('/cpu:0'):
def parse_fn(line_words, line_t... | def get_training_input(filenames, params):
' Get input for training stage\n\n :param filenames: A list contains [source_filename, target_filename]\n :param params: Hyper-parameters\n\n :returns: A dictionary of pair <Key, Tensor>\n '
with tf.device('/cpu:0'):
def parse_fn(line_words, line_t... |
598824f784c7fd65018274633e6fc93fa2531e4665f04a88e0dd8f94f039932e | def get_training_input_with_bert(filenames, params):
' Get input for training stage\n\n :param filenames: A list contains [source_filename, target_filename, bert_embding_file]\n :param params: Hyper-parameters\n\n :returns: A dictionary of pair <Key, Tensor>\n '
with tf.device('/cpu:0'):
de... | Get input for training stage
:param filenames: A list contains [source_filename, target_filename, bert_embding_file]
:param params: Hyper-parameters
:returns: A dictionary of pair <Key, Tensor> | thumt/data/dataset.py | get_training_input_with_bert | souradip93/GCDT | 72 | python | def get_training_input_with_bert(filenames, params):
' Get input for training stage\n\n :param filenames: A list contains [source_filename, target_filename, bert_embding_file]\n :param params: Hyper-parameters\n\n :returns: A dictionary of pair <Key, Tensor>\n '
with tf.device('/cpu:0'):
de... | def get_training_input_with_bert(filenames, params):
' Get input for training stage\n\n :param filenames: A list contains [source_filename, target_filename, bert_embding_file]\n :param params: Hyper-parameters\n\n :returns: A dictionary of pair <Key, Tensor>\n '
with tf.device('/cpu:0'):
de... |
a95dd0a74be57a8123a09fa75d9f04e713abaa755744ca298b21e7ec66731d5e | def create(tid, data):
'Schedule the task'
q = django_rq.get_queue('default')
q.enqueue_call(func=_create_thread, args=(tid, data), job_id='/api/tasks/{}'.format(tid)) | Schedule the task | cvat/apps/engine/task.py | create | VRichardJP/cvat | 4,197 | python | def create(tid, data):
q = django_rq.get_queue('default')
q.enqueue_call(func=_create_thread, args=(tid, data), job_id='/api/tasks/{}'.format(tid)) | def create(tid, data):
q = django_rq.get_queue('default')
q.enqueue_call(func=_create_thread, args=(tid, data), job_id='/api/tasks/{}'.format(tid))<|docstring|>Schedule the task<|endoftext|> |
9910560b2ee616d5d9f2af1e076d77e9695e06f4a2f1543ba136cefe279b49f1 | def setUp(self):
'Adds the cog, a bot, and a message to the instance for usage in tests.'
self.bot = MockBot()
self.cog = TokenRemover(bot=self.bot)
self.msg = MockMessage(id=555, content='hello world')
self.msg.channel.mention = '#lemonade-stand'
self.msg.author.__str__ = MagicMock(return_value... | Adds the cog, a bot, and a message to the instance for usage in tests. | tests/bot/cogs/test_token_remover.py | setUp | ScarletKing001/bot | 1 | python | def setUp(self):
self.bot = MockBot()
self.cog = TokenRemover(bot=self.bot)
self.msg = MockMessage(id=555, content='hello world')
self.msg.channel.mention = '#lemonade-stand'
self.msg.author.__str__ = MagicMock(return_value=self.msg.author.name)
self.msg.author.avatar_url_as.return_value = ... | def setUp(self):
self.bot = MockBot()
self.cog = TokenRemover(bot=self.bot)
self.msg = MockMessage(id=555, content='hello world')
self.msg.channel.mention = '#lemonade-stand'
self.msg.author.__str__ = MagicMock(return_value=self.msg.author.name)
self.msg.author.avatar_url_as.return_value = ... |
33f5af324d2e1d33906e0b499cad11402b5b0a56a7d633276a33594989b842ae | def test_is_valid_user_id_valid(self):
'Should consider user IDs valid if they decode entirely to ASCII digits.'
ids = ('NDcyMjY1OTQzMDYyNDEzMzMy', 'NDc1MDczNjI5Mzk5NTQ3OTA0', 'NDY3MjIzMjMwNjUwNzc3NjQx')
for user_id in ids:
with self.subTest(user_id=user_id):
result = TokenRemover.is_val... | Should consider user IDs valid if they decode entirely to ASCII digits. | tests/bot/cogs/test_token_remover.py | test_is_valid_user_id_valid | ScarletKing001/bot | 1 | python | def test_is_valid_user_id_valid(self):
ids = ('NDcyMjY1OTQzMDYyNDEzMzMy', 'NDc1MDczNjI5Mzk5NTQ3OTA0', 'NDY3MjIzMjMwNjUwNzc3NjQx')
for user_id in ids:
with self.subTest(user_id=user_id):
result = TokenRemover.is_valid_user_id(user_id)
self.assertTrue(result) | def test_is_valid_user_id_valid(self):
ids = ('NDcyMjY1OTQzMDYyNDEzMzMy', 'NDc1MDczNjI5Mzk5NTQ3OTA0', 'NDY3MjIzMjMwNjUwNzc3NjQx')
for user_id in ids:
with self.subTest(user_id=user_id):
result = TokenRemover.is_valid_user_id(user_id)
self.assertTrue(result)<|docstring|>Shoul... |
ca13a662ca32804a746d215bdca370d54684bc33ee0414f18979a7aee4ee4290 | def test_is_valid_user_id_invalid(self):
'Should consider non-digit and non-ASCII IDs invalid.'
ids = (('SGVsbG8gd29ybGQ', 'non-digit ASCII'), ('0J_RgNC40LLQtdGCINC80LjRgA', 'cyrillic text'), ('4pO14p6L4p6C4pG34p264pGl8J-EiOKSj-KCieKBsA', 'Unicode digits'), ('4oaA4oaB4oWh4oWi4Lyz4Lyq4Lyr4LG9', 'Unicode numerals... | Should consider non-digit and non-ASCII IDs invalid. | tests/bot/cogs/test_token_remover.py | test_is_valid_user_id_invalid | ScarletKing001/bot | 1 | python | def test_is_valid_user_id_invalid(self):
ids = (('SGVsbG8gd29ybGQ', 'non-digit ASCII'), ('0J_RgNC40LLQtdGCINC80LjRgA', 'cyrillic text'), ('4pO14p6L4p6C4pG34p264pGl8J-EiOKSj-KCieKBsA', 'Unicode digits'), ('4oaA4oaB4oWh4oWi4Lyz4Lyq4Lyr4LG9', 'Unicode numerals'), ('8J2fjvCdn5nwnZ-k8J2fr_Cdn7rgravvvJngr6c', 'Unico... | def test_is_valid_user_id_invalid(self):
ids = (('SGVsbG8gd29ybGQ', 'non-digit ASCII'), ('0J_RgNC40LLQtdGCINC80LjRgA', 'cyrillic text'), ('4pO14p6L4p6C4pG34p264pGl8J-EiOKSj-KCieKBsA', 'Unicode digits'), ('4oaA4oaB4oWh4oWi4Lyz4Lyq4Lyr4LG9', 'Unicode numerals'), ('8J2fjvCdn5nwnZ-k8J2fr_Cdn7rgravvvJngr6c', 'Unico... |
0336a59ed32c8a2f9ee883420b7aea448fb5f187caf2c6f581a71d6ef0d63c9c | def test_is_valid_timestamp_valid(self):
"Should consider timestamps valid if they're greater than the Discord epoch."
timestamps = ('XsyRkw', 'Xrim9Q', 'XsyR-w', 'XsySD_', 'Dn9r_A')
for timestamp in timestamps:
with self.subTest(timestamp=timestamp):
result = TokenRemover.is_valid_times... | Should consider timestamps valid if they're greater than the Discord epoch. | tests/bot/cogs/test_token_remover.py | test_is_valid_timestamp_valid | ScarletKing001/bot | 1 | python | def test_is_valid_timestamp_valid(self):
timestamps = ('XsyRkw', 'Xrim9Q', 'XsyR-w', 'XsySD_', 'Dn9r_A')
for timestamp in timestamps:
with self.subTest(timestamp=timestamp):
result = TokenRemover.is_valid_timestamp(timestamp)
self.assertTrue(result) | def test_is_valid_timestamp_valid(self):
timestamps = ('XsyRkw', 'Xrim9Q', 'XsyR-w', 'XsySD_', 'Dn9r_A')
for timestamp in timestamps:
with self.subTest(timestamp=timestamp):
result = TokenRemover.is_valid_timestamp(timestamp)
self.assertTrue(result)<|docstring|>Should consid... |
9b3e6c778a2f36021e3f74ae1bfdd1f08c845ea0a93f98c1be6feca24fa8d9e2 | def test_is_valid_timestamp_invalid(self):
"Should consider timestamps invalid if they're before Discord epoch or can't be parsed."
timestamps = (('B4Yffw', 'DISCORD_EPOCH - TOKEN_EPOCH - 1'), ('ew', '123'), ('AoIKgA', '42076800'), ('{hello}[world]&(bye!)', 'ASCII invalid Base64'), ('Þíß-ï§-ňøẗ-våłìÐ', 'Unicode... | Should consider timestamps invalid if they're before Discord epoch or can't be parsed. | tests/bot/cogs/test_token_remover.py | test_is_valid_timestamp_invalid | ScarletKing001/bot | 1 | python | def test_is_valid_timestamp_invalid(self):
timestamps = (('B4Yffw', 'DISCORD_EPOCH - TOKEN_EPOCH - 1'), ('ew', '123'), ('AoIKgA', '42076800'), ('{hello}[world]&(bye!)', 'ASCII invalid Base64'), ('Þíß-ï§-ňøẗ-våłìÐ', 'Unicode invalid Base64'))
for (timestamp, msg) in timestamps:
with self.subTest(msg... | def test_is_valid_timestamp_invalid(self):
timestamps = (('B4Yffw', 'DISCORD_EPOCH - TOKEN_EPOCH - 1'), ('ew', '123'), ('AoIKgA', '42076800'), ('{hello}[world]&(bye!)', 'ASCII invalid Base64'), ('Þíß-ï§-ňøẗ-våłìÐ', 'Unicode invalid Base64'))
for (timestamp, msg) in timestamps:
with self.subTest(msg... |
0e3c6149f6fb665caf09db4228a1ce753b79ff69934c1b0d3095ea45a176626e | def test_mod_log_property(self):
'The `mod_log` property should ask the bot to return the `ModLog` cog.'
self.bot.get_cog.return_value = 'lemon'
self.assertEqual(self.cog.mod_log, self.bot.get_cog.return_value)
self.bot.get_cog.assert_called_once_with('ModLog') | The `mod_log` property should ask the bot to return the `ModLog` cog. | tests/bot/cogs/test_token_remover.py | test_mod_log_property | ScarletKing001/bot | 1 | python | def test_mod_log_property(self):
self.bot.get_cog.return_value = 'lemon'
self.assertEqual(self.cog.mod_log, self.bot.get_cog.return_value)
self.bot.get_cog.assert_called_once_with('ModLog') | def test_mod_log_property(self):
self.bot.get_cog.return_value = 'lemon'
self.assertEqual(self.cog.mod_log, self.bot.get_cog.return_value)
self.bot.get_cog.assert_called_once_with('ModLog')<|docstring|>The `mod_log` property should ask the bot to return the `ModLog` cog.<|endoftext|> |
6321bea068bc9a24279ff72f330dcb63f820a8394a20501a49c6fed533b0b0e5 | async def test_on_message_edit_uses_on_message(self):
'The edit listener should delegate handling of the message to the normal listener.'
self.cog.on_message = mock.create_autospec(self.cog.on_message, spec_set=True)
(await self.cog.on_message_edit(MockMessage(), self.msg))
self.cog.on_message.assert_aw... | The edit listener should delegate handling of the message to the normal listener. | tests/bot/cogs/test_token_remover.py | test_on_message_edit_uses_on_message | ScarletKing001/bot | 1 | python | async def test_on_message_edit_uses_on_message(self):
self.cog.on_message = mock.create_autospec(self.cog.on_message, spec_set=True)
(await self.cog.on_message_edit(MockMessage(), self.msg))
self.cog.on_message.assert_awaited_once_with(self.msg) | async def test_on_message_edit_uses_on_message(self):
self.cog.on_message = mock.create_autospec(self.cog.on_message, spec_set=True)
(await self.cog.on_message_edit(MockMessage(), self.msg))
self.cog.on_message.assert_awaited_once_with(self.msg)<|docstring|>The edit listener should delegate handling of... |
a0c9c4da36aeef5c9596711ebfba50606be430311ab9ad254f22021ab065e1e1 | @autospec(TokenRemover, 'find_token_in_message', 'take_action')
async def test_on_message_takes_action(self, find_token_in_message, take_action):
'Should take action if a valid token is found when a message is sent.'
cog = TokenRemover(self.bot)
found_token = 'foobar'
find_token_in_message.return_value ... | Should take action if a valid token is found when a message is sent. | tests/bot/cogs/test_token_remover.py | test_on_message_takes_action | ScarletKing001/bot | 1 | python | @autospec(TokenRemover, 'find_token_in_message', 'take_action')
async def test_on_message_takes_action(self, find_token_in_message, take_action):
cog = TokenRemover(self.bot)
found_token = 'foobar'
find_token_in_message.return_value = found_token
(await cog.on_message(self.msg))
find_token_in_m... | @autospec(TokenRemover, 'find_token_in_message', 'take_action')
async def test_on_message_takes_action(self, find_token_in_message, take_action):
cog = TokenRemover(self.bot)
found_token = 'foobar'
find_token_in_message.return_value = found_token
(await cog.on_message(self.msg))
find_token_in_m... |
7c4229562a7b0325ddd35ca1e659e51cc129807e88cff33d43141d976901a449 | @autospec(TokenRemover, 'find_token_in_message', 'take_action')
async def test_on_message_skips_missing_token(self, find_token_in_message, take_action):
"Shouldn't take action if a valid token isn't found when a message is sent."
cog = TokenRemover(self.bot)
find_token_in_message.return_value = False
(a... | Shouldn't take action if a valid token isn't found when a message is sent. | tests/bot/cogs/test_token_remover.py | test_on_message_skips_missing_token | ScarletKing001/bot | 1 | python | @autospec(TokenRemover, 'find_token_in_message', 'take_action')
async def test_on_message_skips_missing_token(self, find_token_in_message, take_action):
cog = TokenRemover(self.bot)
find_token_in_message.return_value = False
(await cog.on_message(self.msg))
find_token_in_message.assert_called_once_... | @autospec(TokenRemover, 'find_token_in_message', 'take_action')
async def test_on_message_skips_missing_token(self, find_token_in_message, take_action):
cog = TokenRemover(self.bot)
find_token_in_message.return_value = False
(await cog.on_message(self.msg))
find_token_in_message.assert_called_once_... |
913fdd5ac9b5fa32441046e1d8cb1cbd887940114ad4c7d7099a6dcc9a8ef9c3 | @autospec(TokenRemover, 'find_token_in_message')
async def test_on_message_ignores_dms_bots(self, find_token_in_message):
"Shouldn't parse a message if it is a DM or authored by a bot."
cog = TokenRemover(self.bot)
dm_msg = MockMessage(guild=None)
bot_msg = MockMessage(author=MagicMock(bot=True))
fo... | Shouldn't parse a message if it is a DM or authored by a bot. | tests/bot/cogs/test_token_remover.py | test_on_message_ignores_dms_bots | ScarletKing001/bot | 1 | python | @autospec(TokenRemover, 'find_token_in_message')
async def test_on_message_ignores_dms_bots(self, find_token_in_message):
cog = TokenRemover(self.bot)
dm_msg = MockMessage(guild=None)
bot_msg = MockMessage(author=MagicMock(bot=True))
for msg in (dm_msg, bot_msg):
(await cog.on_message(msg))... | @autospec(TokenRemover, 'find_token_in_message')
async def test_on_message_ignores_dms_bots(self, find_token_in_message):
cog = TokenRemover(self.bot)
dm_msg = MockMessage(guild=None)
bot_msg = MockMessage(author=MagicMock(bot=True))
for msg in (dm_msg, bot_msg):
(await cog.on_message(msg))... |
d6f1b5b2e3f03da4ce2c665bbe6a01d81ebcc02bc2dec91c58729766f63091c3 | @autospec('bot.cogs.token_remover', 'TOKEN_RE')
def test_find_token_no_matches(self, token_re):
'None should be returned if the regex matches no tokens in a message.'
token_re.finditer.return_value = ()
return_value = TokenRemover.find_token_in_message(self.msg)
self.assertIsNone(return_value)
token... | None should be returned if the regex matches no tokens in a message. | tests/bot/cogs/test_token_remover.py | test_find_token_no_matches | ScarletKing001/bot | 1 | python | @autospec('bot.cogs.token_remover', 'TOKEN_RE')
def test_find_token_no_matches(self, token_re):
token_re.finditer.return_value = ()
return_value = TokenRemover.find_token_in_message(self.msg)
self.assertIsNone(return_value)
token_re.finditer.assert_called_once_with(self.msg.content) | @autospec('bot.cogs.token_remover', 'TOKEN_RE')
def test_find_token_no_matches(self, token_re):
token_re.finditer.return_value = ()
return_value = TokenRemover.find_token_in_message(self.msg)
self.assertIsNone(return_value)
token_re.finditer.assert_called_once_with(self.msg.content)<|docstring|>Non... |
68937f317c5a7595161eed36b4ae192e635f24a530ab40aa8535e3b5168a36e6 | @autospec(TokenRemover, 'is_valid_user_id', 'is_valid_timestamp')
@autospec('bot.cogs.token_remover', 'Token')
@autospec('bot.cogs.token_remover', 'TOKEN_RE')
def test_find_token_valid_match(self, token_re, token_cls, is_valid_id, is_valid_timestamp):
'The first match with a valid user ID and timestamp should be re... | The first match with a valid user ID and timestamp should be returned as a `Token`. | tests/bot/cogs/test_token_remover.py | test_find_token_valid_match | ScarletKing001/bot | 1 | python | @autospec(TokenRemover, 'is_valid_user_id', 'is_valid_timestamp')
@autospec('bot.cogs.token_remover', 'Token')
@autospec('bot.cogs.token_remover', 'TOKEN_RE')
def test_find_token_valid_match(self, token_re, token_cls, is_valid_id, is_valid_timestamp):
matches = [mock.create_autospec(Match, spec_set=True, insta... | @autospec(TokenRemover, 'is_valid_user_id', 'is_valid_timestamp')
@autospec('bot.cogs.token_remover', 'Token')
@autospec('bot.cogs.token_remover', 'TOKEN_RE')
def test_find_token_valid_match(self, token_re, token_cls, is_valid_id, is_valid_timestamp):
matches = [mock.create_autospec(Match, spec_set=True, insta... |
a177d0ab884d65b2ef65564724a900223cd6490a0f5e3f4d188a17ce2991784f | @autospec(TokenRemover, 'is_valid_user_id', 'is_valid_timestamp')
@autospec('bot.cogs.token_remover', 'Token')
@autospec('bot.cogs.token_remover', 'TOKEN_RE')
def test_find_token_invalid_matches(self, token_re, token_cls, is_valid_id, is_valid_timestamp):
'None should be returned if no matches have valid user IDs o... | None should be returned if no matches have valid user IDs or timestamps. | tests/bot/cogs/test_token_remover.py | test_find_token_invalid_matches | ScarletKing001/bot | 1 | python | @autospec(TokenRemover, 'is_valid_user_id', 'is_valid_timestamp')
@autospec('bot.cogs.token_remover', 'Token')
@autospec('bot.cogs.token_remover', 'TOKEN_RE')
def test_find_token_invalid_matches(self, token_re, token_cls, is_valid_id, is_valid_timestamp):
token_re.finditer.return_value = [mock.create_autospec(... | @autospec(TokenRemover, 'is_valid_user_id', 'is_valid_timestamp')
@autospec('bot.cogs.token_remover', 'Token')
@autospec('bot.cogs.token_remover', 'TOKEN_RE')
def test_find_token_invalid_matches(self, token_re, token_cls, is_valid_id, is_valid_timestamp):
token_re.finditer.return_value = [mock.create_autospec(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.