repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
spacetelescope/stsci.tools
lib/stsci/tools/teal.py
ConfigObjEparDialog._overrideMasterSettings
def _overrideMasterSettings(self): """ Override so that we can run in a different mode. """ # config-obj dict of defaults cod = self._getGuiSettings() # our own GUI setup self._appName = APP_NAME self._appHelpString = tealHelpString self._useS...
python
def _overrideMasterSettings(self): """ Override so that we can run in a different mode. """ # config-obj dict of defaults cod = self._getGuiSettings() # our own GUI setup self._appName = APP_NAME self._appHelpString = tealHelpString self._useS...
[ "def", "_overrideMasterSettings", "(", "self", ")", ":", "# config-obj dict of defaults", "cod", "=", "self", ".", "_getGuiSettings", "(", ")", "# our own GUI setup", "self", ".", "_appName", "=", "APP_NAME", "self", ".", "_appHelpString", "=", "tealHelpString", "se...
Override so that we can run in a different mode.
[ "Override", "so", "that", "we", "can", "run", "in", "a", "different", "mode", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L488-L531
spacetelescope/stsci.tools
lib/stsci/tools/teal.py
ConfigObjEparDialog._doActualSave
def _doActualSave(self, fname, comment, set_ro=False, overwriteRO=False): """ Override this so we can handle case of file not writable, as well as to make our _lastSavedState copy. """ self.debug('Saving, file name given: '+str(fname)+', set_ro: '+\ str(set_ro)+', overwrit...
python
def _doActualSave(self, fname, comment, set_ro=False, overwriteRO=False): """ Override this so we can handle case of file not writable, as well as to make our _lastSavedState copy. """ self.debug('Saving, file name given: '+str(fname)+', set_ro: '+\ str(set_ro)+', overwrit...
[ "def", "_doActualSave", "(", "self", ",", "fname", ",", "comment", ",", "set_ro", "=", "False", ",", "overwriteRO", "=", "False", ")", ":", "self", ".", "debug", "(", "'Saving, file name given: '", "+", "str", "(", "fname", ")", "+", "', set_ro: '", "+", ...
Override this so we can handle case of file not writable, as well as to make our _lastSavedState copy.
[ "Override", "this", "so", "we", "can", "handle", "case", "of", "file", "not", "writable", "as", "well", "as", "to", "make", "our", "_lastSavedState", "copy", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L540-L586
spacetelescope/stsci.tools
lib/stsci/tools/teal.py
ConfigObjEparDialog.hasUnsavedChanges
def hasUnsavedChanges(self): """ Determine if there are any edits in the GUI that have not yet been saved (e.g. to a file). """ # Sanity check - this case shouldn't occur assert self._lastSavedState is not None, \ "BUG: Please report this as it should never occur." ...
python
def hasUnsavedChanges(self): """ Determine if there are any edits in the GUI that have not yet been saved (e.g. to a file). """ # Sanity check - this case shouldn't occur assert self._lastSavedState is not None, \ "BUG: Please report this as it should never occur." ...
[ "def", "hasUnsavedChanges", "(", "self", ")", ":", "# Sanity check - this case shouldn't occur", "assert", "self", ".", "_lastSavedState", "is", "not", "None", ",", "\"BUG: Please report this as it should never occur.\"", "# Force the current GUI values into our model in memory, but ...
Determine if there are any edits in the GUI that have not yet been saved (e.g. to a file).
[ "Determine", "if", "there", "are", "any", "edits", "in", "the", "GUI", "that", "have", "not", "yet", "been", "saved", "(", "e", ".", "g", ".", "to", "a", "file", ")", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L594-L615
spacetelescope/stsci.tools
lib/stsci/tools/teal.py
ConfigObjEparDialog._defineEditedCallbackObjectFor
def _defineEditedCallbackObjectFor(self, parScope, parName): """ Override to allow us to use an edited callback. """ # We know that the _taskParsObj is a ConfigObjPars triggerStrs = self._taskParsObj.getTriggerStrings(parScope, parName) # Some items will have a trigger, but likely most...
python
def _defineEditedCallbackObjectFor(self, parScope, parName): """ Override to allow us to use an edited callback. """ # We know that the _taskParsObj is a ConfigObjPars triggerStrs = self._taskParsObj.getTriggerStrings(parScope, parName) # Some items will have a trigger, but likely most...
[ "def", "_defineEditedCallbackObjectFor", "(", "self", ",", "parScope", ",", "parName", ")", ":", "# We know that the _taskParsObj is a ConfigObjPars", "triggerStrs", "=", "self", ".", "_taskParsObj", ".", "getTriggerStrings", "(", "parScope", ",", "parName", ")", "# Som...
Override to allow us to use an edited callback.
[ "Override", "to", "allow", "us", "to", "use", "an", "edited", "callback", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L619-L629
spacetelescope/stsci.tools
lib/stsci/tools/teal.py
ConfigObjEparDialog.updateTitle
def updateTitle(self, atitle): """ Override so we can append read-only status. """ if atitle and os.path.exists(atitle): if _isInstalled(atitle): atitle += ' [installed]' elif not os.access(atitle, os.W_OK): atitle += ' [read only]' super...
python
def updateTitle(self, atitle): """ Override so we can append read-only status. """ if atitle and os.path.exists(atitle): if _isInstalled(atitle): atitle += ' [installed]' elif not os.access(atitle, os.W_OK): atitle += ' [read only]' super...
[ "def", "updateTitle", "(", "self", ",", "atitle", ")", ":", "if", "atitle", "and", "os", ".", "path", ".", "exists", "(", "atitle", ")", ":", "if", "_isInstalled", "(", "atitle", ")", ":", "atitle", "+=", "' [installed]'", "elif", "not", "os", ".", ...
Override so we can append read-only status.
[ "Override", "so", "we", "can", "append", "read", "-", "only", "status", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L643-L650
spacetelescope/stsci.tools
lib/stsci/tools/teal.py
ConfigObjEparDialog.edited
def edited(self, scope, name, lastSavedVal, newVal, action): """ This is the callback function invoked when an item is edited. This is only called for those items which were previously specified to use this mechanism. We do not turn this on for all items because the performa...
python
def edited(self, scope, name, lastSavedVal, newVal, action): """ This is the callback function invoked when an item is edited. This is only called for those items which were previously specified to use this mechanism. We do not turn this on for all items because the performa...
[ "def", "edited", "(", "self", ",", "scope", ",", "name", ",", "lastSavedVal", ",", "newVal", ",", "action", ")", ":", "# Get name(s) of any triggers that this par triggers", "triggerNamesTup", "=", "self", ".", "_taskParsObj", ".", "getTriggerStrings", "(", "scope",...
This is the callback function invoked when an item is edited. This is only called for those items which were previously specified to use this mechanism. We do not turn this on for all items because the performance might be prohibitive. This kicks off any previously regis...
[ "This", "is", "the", "callback", "function", "invoked", "when", "an", "item", "is", "edited", ".", "This", "is", "only", "called", "for", "those", "items", "which", "were", "previously", "specified", "to", "use", "this", "mechanism", ".", "We", "do", "not"...
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L653-L755
spacetelescope/stsci.tools
lib/stsci/tools/teal.py
ConfigObjEparDialog.findNextSection
def findNextSection(self, scope, name): """ Starts with given par (scope+name) and looks further down the list of parameters until one of a different non-null scope is found. Upon success, returns the (scope, name) tuple, otherwise (None, None). """ # first find index of starting point ...
python
def findNextSection(self, scope, name): """ Starts with given par (scope+name) and looks further down the list of parameters until one of a different non-null scope is found. Upon success, returns the (scope, name) tuple, otherwise (None, None). """ # first find index of starting point ...
[ "def", "findNextSection", "(", "self", ",", "scope", ",", "name", ")", ":", "# first find index of starting point", "plist", "=", "self", ".", "_taskParsObj", ".", "getParList", "(", ")", "start", "=", "0", "for", "i", "in", "range", "(", "len", "(", "plis...
Starts with given par (scope+name) and looks further down the list of parameters until one of a different non-null scope is found. Upon success, returns the (scope, name) tuple, otherwise (None, None).
[ "Starts", "with", "given", "par", "(", "scope", "+", "name", ")", "and", "looks", "further", "down", "the", "list", "of", "parameters", "until", "one", "of", "a", "different", "non", "-", "null", "scope", "is", "found", ".", "Upon", "success", "returns",...
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L758-L778
spacetelescope/stsci.tools
lib/stsci/tools/teal.py
ConfigObjEparDialog._setTaskParsObj
def _setTaskParsObj(self, theTask): """ Overridden version for ConfigObj. theTask can be either a .cfg file name or a ConfigObjPars object. """ # Create the ConfigObjPars obj self._taskParsObj = cfgpars.getObjectFromTaskArg(theTask, self._strict, F...
python
def _setTaskParsObj(self, theTask): """ Overridden version for ConfigObj. theTask can be either a .cfg file name or a ConfigObjPars object. """ # Create the ConfigObjPars obj self._taskParsObj = cfgpars.getObjectFromTaskArg(theTask, self._strict, F...
[ "def", "_setTaskParsObj", "(", "self", ",", "theTask", ")", ":", "# Create the ConfigObjPars obj", "self", ".", "_taskParsObj", "=", "cfgpars", ".", "getObjectFromTaskArg", "(", "theTask", ",", "self", ".", "_strict", ",", "False", ")", "# Tell it that we can be use...
Overridden version for ConfigObj. theTask can be either a .cfg file name or a ConfigObjPars object.
[ "Overridden", "version", "for", "ConfigObj", ".", "theTask", "can", "be", "either", "a", ".", "cfg", "file", "name", "or", "a", "ConfigObjPars", "object", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L781-L792
spacetelescope/stsci.tools
lib/stsci/tools/teal.py
ConfigObjEparDialog._getSaveAsFilter
def _getSaveAsFilter(self): """ Return a string to be used as the filter arg to the save file dialog during Save-As. """ # figure the dir to use, start with the one from the file absRcDir = os.path.abspath(self._rcDir) thedir = os.path.abspath(os.path.dirname(self._taskParsOb...
python
def _getSaveAsFilter(self): """ Return a string to be used as the filter arg to the save file dialog during Save-As. """ # figure the dir to use, start with the one from the file absRcDir = os.path.abspath(self._rcDir) thedir = os.path.abspath(os.path.dirname(self._taskParsOb...
[ "def", "_getSaveAsFilter", "(", "self", ")", ":", "# figure the dir to use, start with the one from the file", "absRcDir", "=", "os", ".", "path", ".", "abspath", "(", "self", ".", "_rcDir", ")", "thedir", "=", "os", ".", "path", ".", "abspath", "(", "os", "."...
Return a string to be used as the filter arg to the save file dialog during Save-As.
[ "Return", "a", "string", "to", "be", "used", "as", "the", "filter", "arg", "to", "the", "save", "file", "dialog", "during", "Save", "-", "As", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L797-L813
spacetelescope/stsci.tools
lib/stsci/tools/teal.py
ConfigObjEparDialog._getOpenChoices
def _getOpenChoices(self): """ Go through all possible sites to find applicable .cfg files. Return as an iterable. """ tsk = self._taskParsObj.getName() taskFiles = set() dirsSoFar = [] # this helps speed this up (skip unneeded globs) # last dir aDir = os.pat...
python
def _getOpenChoices(self): """ Go through all possible sites to find applicable .cfg files. Return as an iterable. """ tsk = self._taskParsObj.getName() taskFiles = set() dirsSoFar = [] # this helps speed this up (skip unneeded globs) # last dir aDir = os.pat...
[ "def", "_getOpenChoices", "(", "self", ")", ":", "tsk", "=", "self", ".", "_taskParsObj", ".", "getName", "(", ")", "taskFiles", "=", "set", "(", ")", "dirsSoFar", "=", "[", "]", "# this helps speed this up (skip unneeded globs)", "# last dir", "aDir", "=", "o...
Go through all possible sites to find applicable .cfg files. Return as an iterable.
[ "Go", "through", "all", "possible", "sites", "to", "find", "applicable", ".", "cfg", "files", ".", "Return", "as", "an", "iterable", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L816-L863
spacetelescope/stsci.tools
lib/stsci/tools/teal.py
ConfigObjEparDialog.pfopen
def pfopen(self, event=None): """ Load the parameter settings from a user-specified file. """ # Get the selected file name fname = self._openMenuChoice.get() # Also allow them to simply find any file - do not check _task_name_... # (could use tkinter's FileDialog, but this one ...
python
def pfopen(self, event=None): """ Load the parameter settings from a user-specified file. """ # Get the selected file name fname = self._openMenuChoice.get() # Also allow them to simply find any file - do not check _task_name_... # (could use tkinter's FileDialog, but this one ...
[ "def", "pfopen", "(", "self", ",", "event", "=", "None", ")", ":", "# Get the selected file name", "fname", "=", "self", ".", "_openMenuChoice", ".", "get", "(", ")", "# Also allow them to simply find any file - do not check _task_name_...", "# (could use tkinter's FileDial...
Load the parameter settings from a user-specified file.
[ "Load", "the", "parameter", "settings", "from", "a", "user", "-", "specified", "file", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L867-L934
spacetelescope/stsci.tools
lib/stsci/tools/teal.py
ConfigObjEparDialog._handleParListMismatch
def _handleParListMismatch(self, probStr, extra=False): """ Override to include ConfigObj filename and specific errors. Note that this only handles "missing" pars and "extra" pars, not wrong-type pars. So it isn't that big of a deal. """ # keep down the duplicate errors if extr...
python
def _handleParListMismatch(self, probStr, extra=False): """ Override to include ConfigObj filename and specific errors. Note that this only handles "missing" pars and "extra" pars, not wrong-type pars. So it isn't that big of a deal. """ # keep down the duplicate errors if extr...
[ "def", "_handleParListMismatch", "(", "self", ",", "probStr", ",", "extra", "=", "False", ")", ":", "# keep down the duplicate errors", "if", "extra", ":", "return", "True", "# the base class is already stating it will be ignored", "# find the actual errors, and then add that t...
Override to include ConfigObj filename and specific errors. Note that this only handles "missing" pars and "extra" pars, not wrong-type pars. So it isn't that big of a deal.
[ "Override", "to", "include", "ConfigObj", "filename", "and", "specific", "errors", ".", "Note", "that", "this", "only", "handles", "missing", "pars", "and", "extra", "pars", "not", "wrong", "-", "type", "pars", ".", "So", "it", "isn", "t", "that", "big", ...
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L944-L965
spacetelescope/stsci.tools
lib/stsci/tools/teal.py
ConfigObjEparDialog._setToDefaults
def _setToDefaults(self): """ Load the default parameter settings into the GUI. """ # Create an empty object, where every item is set to it's default value try: tmpObj = cfgpars.ConfigObjPars(self._taskParsObj.filename, associatedPkg=\ ...
python
def _setToDefaults(self): """ Load the default parameter settings into the GUI. """ # Create an empty object, where every item is set to it's default value try: tmpObj = cfgpars.ConfigObjPars(self._taskParsObj.filename, associatedPkg=\ ...
[ "def", "_setToDefaults", "(", "self", ")", ":", "# Create an empty object, where every item is set to it's default value", "try", ":", "tmpObj", "=", "cfgpars", ".", "ConfigObjPars", "(", "self", ".", "_taskParsObj", ".", "filename", ",", "associatedPkg", "=", "self", ...
Load the default parameter settings into the GUI.
[ "Load", "the", "default", "parameter", "settings", "into", "the", "GUI", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L968-L993
spacetelescope/stsci.tools
lib/stsci/tools/teal.py
ConfigObjEparDialog.getDict
def getDict(self): """ Retrieve the current parameter settings from the GUI.""" # We are going to have to return the dict so let's # first make sure all of our models are up to date with the values in # the GUI right now. badList = self.checkSetSaveEntries(doSave=False) i...
python
def getDict(self): """ Retrieve the current parameter settings from the GUI.""" # We are going to have to return the dict so let's # first make sure all of our models are up to date with the values in # the GUI right now. badList = self.checkSetSaveEntries(doSave=False) i...
[ "def", "getDict", "(", "self", ")", ":", "# We are going to have to return the dict so let's", "# first make sure all of our models are up to date with the values in", "# the GUI right now.", "badList", "=", "self", ".", "checkSetSaveEntries", "(", "doSave", "=", "False", ")", ...
Retrieve the current parameter settings from the GUI.
[ "Retrieve", "the", "current", "parameter", "settings", "from", "the", "GUI", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L995-L1003
spacetelescope/stsci.tools
lib/stsci/tools/teal.py
ConfigObjEparDialog.loadDict
def loadDict(self, theDict): """ Load the parameter settings from a given dict into the GUI. """ # We are going to have to merge this info into ourselves so let's # first make sure all of our models are up to date with the values in # the GUI right now. badList = self.checkSetSav...
python
def loadDict(self, theDict): """ Load the parameter settings from a given dict into the GUI. """ # We are going to have to merge this info into ourselves so let's # first make sure all of our models are up to date with the values in # the GUI right now. badList = self.checkSetSav...
[ "def", "loadDict", "(", "self", ",", "theDict", ")", ":", "# We are going to have to merge this info into ourselves so let's", "# first make sure all of our models are up to date with the values in", "# the GUI right now.", "badList", "=", "self", ".", "checkSetSaveEntries", "(", "...
Load the parameter settings from a given dict into the GUI.
[ "Load", "the", "parameter", "settings", "from", "a", "given", "dict", "into", "the", "GUI", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L1005-L1030
spacetelescope/stsci.tools
lib/stsci/tools/teal.py
ConfigObjEparDialog._getGuiSettings
def _getGuiSettings(self): """ Return a dict (ConfigObj) of all user settings found in rcFile. """ # Put the settings into a ConfigObj dict (don't use a config-spec) rcFile = self._rcDir+os.sep+APP_NAME.lower()+'.cfg' if os.path.exists(rcFile): try: return con...
python
def _getGuiSettings(self): """ Return a dict (ConfigObj) of all user settings found in rcFile. """ # Put the settings into a ConfigObj dict (don't use a config-spec) rcFile = self._rcDir+os.sep+APP_NAME.lower()+'.cfg' if os.path.exists(rcFile): try: return con...
[ "def", "_getGuiSettings", "(", "self", ")", ":", "# Put the settings into a ConfigObj dict (don't use a config-spec)", "rcFile", "=", "self", ".", "_rcDir", "+", "os", ".", "sep", "+", "APP_NAME", ".", "lower", "(", ")", "+", "'.cfg'", "if", "os", ".", "path", ...
Return a dict (ConfigObj) of all user settings found in rcFile.
[ "Return", "a", "dict", "(", "ConfigObj", ")", "of", "all", "user", "settings", "found", "in", "rcFile", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L1033-L1046
spacetelescope/stsci.tools
lib/stsci/tools/teal.py
ConfigObjEparDialog._saveGuiSettings
def _saveGuiSettings(self): """ The base class doesn't implement this, so we will - save settings (only GUI stuff, not task related) to a file. """ # Put the settings into a ConfigObj dict (don't use a config-spec) rcFile = self._rcDir+os.sep+APP_NAME.lower()+'.cfg' # if ...
python
def _saveGuiSettings(self): """ The base class doesn't implement this, so we will - save settings (only GUI stuff, not task related) to a file. """ # Put the settings into a ConfigObj dict (don't use a config-spec) rcFile = self._rcDir+os.sep+APP_NAME.lower()+'.cfg' # if ...
[ "def", "_saveGuiSettings", "(", "self", ")", ":", "# Put the settings into a ConfigObj dict (don't use a config-spec)", "rcFile", "=", "self", ".", "_rcDir", "+", "os", ".", "sep", "+", "APP_NAME", ".", "lower", "(", ")", "+", "'.cfg'", "#", "if", "os", ".", "...
The base class doesn't implement this, so we will - save settings (only GUI stuff, not task related) to a file.
[ "The", "base", "class", "doesn", "t", "implement", "this", "so", "we", "will", "-", "save", "settings", "(", "only", "GUI", "stuff", "not", "task", "related", ")", "to", "a", "file", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L1049-L1072
spacetelescope/stsci.tools
lib/stsci/tools/teal.py
ConfigObjEparDialog._applyTriggerValue
def _applyTriggerValue(self, triggerName, outval): """ Here we look through the entire .cfgspc to see if any parameters are affected by this trigger. For those that are, we apply the action to the GUI widget. The action is specified by depType. """ # First find which items are dependen...
python
def _applyTriggerValue(self, triggerName, outval): """ Here we look through the entire .cfgspc to see if any parameters are affected by this trigger. For those that are, we apply the action to the GUI widget. The action is specified by depType. """ # First find which items are dependen...
[ "def", "_applyTriggerValue", "(", "self", ",", "triggerName", ",", "outval", ")", ":", "# First find which items are dependent upon this trigger (cached)", "# e.g. { scope1.name1 : dep'cy-type, scope2.name2 : dep'cy-type, ... }", "depParsDict", "=", "self", ".", "_taskParsObj", "."...
Here we look through the entire .cfgspc to see if any parameters are affected by this trigger. For those that are, we apply the action to the GUI widget. The action is specified by depType.
[ "Here", "we", "look", "through", "the", "entire", ".", "cfgspc", "to", "see", "if", "any", "parameters", "are", "affected", "by", "this", "trigger", ".", "For", "those", "that", "are", "we", "apply", "the", "action", "to", "the", "GUI", "widget", ".", ...
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/teal.py#L1075-L1161
spacetelescope/stsci.tools
lib/stsci/tools/asnutil.py
readASNTable
def readASNTable(fname, output=None, prodonly=False): """ Given a fits filename repesenting an association table reads in the table as a dictionary which can be used by pydrizzle and multidrizzle. An association table is a FITS binary table with 2 required columns: 'MEMNAME', 'MEMTYPE'. It checks '...
python
def readASNTable(fname, output=None, prodonly=False): """ Given a fits filename repesenting an association table reads in the table as a dictionary which can be used by pydrizzle and multidrizzle. An association table is a FITS binary table with 2 required columns: 'MEMNAME', 'MEMTYPE'. It checks '...
[ "def", "readASNTable", "(", "fname", ",", "output", "=", "None", ",", "prodonly", "=", "False", ")", ":", "try", ":", "f", "=", "fits", ".", "open", "(", "fu", ".", "osfn", "(", "fname", ")", ")", "except", ":", "raise", "IOError", "(", "\"Can't op...
Given a fits filename repesenting an association table reads in the table as a dictionary which can be used by pydrizzle and multidrizzle. An association table is a FITS binary table with 2 required columns: 'MEMNAME', 'MEMTYPE'. It checks 'MEMPRSNT' column and removes all files for which its value is 'no'...
[ "Given", "a", "fits", "filename", "repesenting", "an", "association", "table", "reads", "in", "the", "table", "as", "a", "dictionary", "which", "can", "be", "used", "by", "pydrizzle", "and", "multidrizzle", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/asnutil.py#L24-L168
spacetelescope/stsci.tools
lib/stsci/tools/asnutil.py
ASNTable.write
def write(self, output=None): """ Write association table to a file. """ if not output: outfile = self['output']+'_asn.fits' output = self['output'] else: outfile = output # Delete the file if it exists. if os.path.exists(outf...
python
def write(self, output=None): """ Write association table to a file. """ if not output: outfile = self['output']+'_asn.fits' output = self['output'] else: outfile = output # Delete the file if it exists. if os.path.exists(outf...
[ "def", "write", "(", "self", ",", "output", "=", "None", ")", ":", "if", "not", "output", ":", "outfile", "=", "self", "[", "'output'", "]", "+", "'_asn.fits'", "output", "=", "self", "[", "'output'", "]", "else", ":", "outfile", "=", "output", "# De...
Write association table to a file.
[ "Write", "association", "table", "to", "a", "file", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/asnutil.py#L353-L429
spacetelescope/stsci.tools
lib/stsci/tools/asnutil.py
ShiftFile.readShiftFile
def readShiftFile(self, filename): """ Reads a shift file from disk and populates a dictionary. """ order = [] fshift = open(filename,'r') flines = fshift.readlines() fshift.close() common = [f.strip('#').strip() for f in flines if f.startswith('#')] ...
python
def readShiftFile(self, filename): """ Reads a shift file from disk and populates a dictionary. """ order = [] fshift = open(filename,'r') flines = fshift.readlines() fshift.close() common = [f.strip('#').strip() for f in flines if f.startswith('#')] ...
[ "def", "readShiftFile", "(", "self", ",", "filename", ")", ":", "order", "=", "[", "]", "fshift", "=", "open", "(", "filename", ",", "'r'", ")", "flines", "=", "fshift", ".", "readlines", "(", ")", "fshift", ".", "close", "(", ")", "common", "=", "...
Reads a shift file from disk and populates a dictionary.
[ "Reads", "a", "shift", "file", "from", "disk", "and", "populates", "a", "dictionary", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/asnutil.py#L616-L675
spacetelescope/stsci.tools
lib/stsci/tools/asnutil.py
ShiftFile.writeShiftFile
def writeShiftFile(self, filename="shifts.txt"): """ Writes a shift file object to a file on disk using the convention for shift file format. """ lines = ['# frame: ', self['frame'], '\n', '# refimage: ', self['refimage'], '\n', '# form: ', self['form'],...
python
def writeShiftFile(self, filename="shifts.txt"): """ Writes a shift file object to a file on disk using the convention for shift file format. """ lines = ['# frame: ', self['frame'], '\n', '# refimage: ', self['refimage'], '\n', '# form: ', self['form'],...
[ "def", "writeShiftFile", "(", "self", ",", "filename", "=", "\"shifts.txt\"", ")", ":", "lines", "=", "[", "'# frame: '", ",", "self", "[", "'frame'", "]", ",", "'\\n'", ",", "'# refimage: '", ",", "self", "[", "'refimage'", "]", ",", "'\\n'", ",", "'# f...
Writes a shift file object to a file on disk using the convention for shift file format.
[ "Writes", "a", "shift", "file", "object", "to", "a", "file", "on", "disk", "using", "the", "convention", "for", "shift", "file", "format", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/asnutil.py#L686-L704
ionelmc/python-aspectlib
src/aspectlib/__init__.py
weave
def weave(target, aspects, **options): """ Send a message to a recipient Args: target (string, class, instance, function or builtin): The object to weave. aspects (:py:obj:`aspectlib.Aspect`, function decorator or list of): The aspects to apply to the object. ...
python
def weave(target, aspects, **options): """ Send a message to a recipient Args: target (string, class, instance, function or builtin): The object to weave. aspects (:py:obj:`aspectlib.Aspect`, function decorator or list of): The aspects to apply to the object. ...
[ "def", "weave", "(", "target", ",", "aspects", ",", "*", "*", "options", ")", ":", "if", "not", "callable", "(", "aspects", ")", ":", "if", "not", "hasattr", "(", "aspects", ",", "'__iter__'", ")", ":", "raise", "ExpectedAdvice", "(", "'%s must be an `As...
Send a message to a recipient Args: target (string, class, instance, function or builtin): The object to weave. aspects (:py:obj:`aspectlib.Aspect`, function decorator or list of): The aspects to apply to the object. subclasses (bool): If ``True``, subcla...
[ "Send", "a", "message", "to", "a", "recipient" ]
train
https://github.com/ionelmc/python-aspectlib/blob/7dba7651ab76160b9ce66c9c11e770f7844e95ec/src/aspectlib/__init__.py#L366-L506
ionelmc/python-aspectlib
src/aspectlib/__init__.py
weave_instance
def weave_instance(instance, aspect, methods=NORMAL_METHODS, lazy=False, bag=BrokenBag, **options): """ Low-level weaver for instances. .. warning:: You should not use this directly. :returns: An :obj:`aspectlib.Rollback` object. """ if bag.has(instance): return Nothing entangleme...
python
def weave_instance(instance, aspect, methods=NORMAL_METHODS, lazy=False, bag=BrokenBag, **options): """ Low-level weaver for instances. .. warning:: You should not use this directly. :returns: An :obj:`aspectlib.Rollback` object. """ if bag.has(instance): return Nothing entangleme...
[ "def", "weave_instance", "(", "instance", ",", "aspect", ",", "methods", "=", "NORMAL_METHODS", ",", "lazy", "=", "False", ",", "bag", "=", "BrokenBag", ",", "*", "*", "options", ")", ":", "if", "bag", ".", "has", "(", "instance", ")", ":", "return", ...
Low-level weaver for instances. .. warning:: You should not use this directly. :returns: An :obj:`aspectlib.Rollback` object.
[ "Low", "-", "level", "weaver", "for", "instances", "." ]
train
https://github.com/ionelmc/python-aspectlib/blob/7dba7651ab76160b9ce66c9c11e770f7844e95ec/src/aspectlib/__init__.py#L524-L555
ionelmc/python-aspectlib
src/aspectlib/__init__.py
weave_module
def weave_module(module, aspect, methods=NORMAL_METHODS, lazy=False, bag=BrokenBag, **options): """ Low-level weaver for "whole module weaving". .. warning:: You should not use this directly. :returns: An :obj:`aspectlib.Rollback` object. """ if bag.has(module): return Nothing ent...
python
def weave_module(module, aspect, methods=NORMAL_METHODS, lazy=False, bag=BrokenBag, **options): """ Low-level weaver for "whole module weaving". .. warning:: You should not use this directly. :returns: An :obj:`aspectlib.Rollback` object. """ if bag.has(module): return Nothing ent...
[ "def", "weave_module", "(", "module", ",", "aspect", ",", "methods", "=", "NORMAL_METHODS", ",", "lazy", "=", "False", ",", "bag", "=", "BrokenBag", ",", "*", "*", "options", ")", ":", "if", "bag", ".", "has", "(", "module", ")", ":", "return", "Noth...
Low-level weaver for "whole module weaving". .. warning:: You should not use this directly. :returns: An :obj:`aspectlib.Rollback` object.
[ "Low", "-", "level", "weaver", "for", "whole", "module", "weaving", "." ]
train
https://github.com/ionelmc/python-aspectlib/blob/7dba7651ab76160b9ce66c9c11e770f7844e95ec/src/aspectlib/__init__.py#L558-L586
ionelmc/python-aspectlib
src/aspectlib/__init__.py
weave_class
def weave_class(klass, aspect, methods=NORMAL_METHODS, subclasses=True, lazy=False, owner=None, name=None, aliases=True, bases=True, bag=BrokenBag): """ Low-level weaver for classes. .. warning:: You should not use this directly. """ assert isclass(klass), "Can't weave %r. Must be a...
python
def weave_class(klass, aspect, methods=NORMAL_METHODS, subclasses=True, lazy=False, owner=None, name=None, aliases=True, bases=True, bag=BrokenBag): """ Low-level weaver for classes. .. warning:: You should not use this directly. """ assert isclass(klass), "Can't weave %r. Must be a...
[ "def", "weave_class", "(", "klass", ",", "aspect", ",", "methods", "=", "NORMAL_METHODS", ",", "subclasses", "=", "True", ",", "lazy", "=", "False", ",", "owner", "=", "None", ",", "name", "=", "None", ",", "aliases", "=", "True", ",", "bases", "=", ...
Low-level weaver for classes. .. warning:: You should not use this directly.
[ "Low", "-", "level", "weaver", "for", "classes", "." ]
train
https://github.com/ionelmc/python-aspectlib/blob/7dba7651ab76160b9ce66c9c11e770f7844e95ec/src/aspectlib/__init__.py#L589-L666
ionelmc/python-aspectlib
src/aspectlib/__init__.py
patch_module
def patch_module(module, name, replacement, original=UNSPECIFIED, aliases=True, location=None, **_bogus_options): """ Low-level attribute patcher. :param module module: Object to patch. :param str name: Attribute to patch :param replacement: The replacement value. :param original: The original ...
python
def patch_module(module, name, replacement, original=UNSPECIFIED, aliases=True, location=None, **_bogus_options): """ Low-level attribute patcher. :param module module: Object to patch. :param str name: Attribute to patch :param replacement: The replacement value. :param original: The original ...
[ "def", "patch_module", "(", "module", ",", "name", ",", "replacement", ",", "original", "=", "UNSPECIFIED", ",", "aliases", "=", "True", ",", "location", "=", "None", ",", "*", "*", "_bogus_options", ")", ":", "rollback", "=", "Rollback", "(", ")", "seen...
Low-level attribute patcher. :param module module: Object to patch. :param str name: Attribute to patch :param replacement: The replacement value. :param original: The original value (in case the object beeing patched uses descriptors or is plain weird). :param bool aliases: If ``True`` patch all t...
[ "Low", "-", "level", "attribute", "patcher", "." ]
train
https://github.com/ionelmc/python-aspectlib/blob/7dba7651ab76160b9ce66c9c11e770f7844e95ec/src/aspectlib/__init__.py#L685-L734
ionelmc/python-aspectlib
src/aspectlib/__init__.py
patch_module_function
def patch_module_function(module, target, aspect, force_name=None, bag=BrokenBag, **options): """ Low-level patcher for one function from a specified module. .. warning:: You should not use this directly. :returns: An :obj:`aspectlib.Rollback` object. """ logdebug("patch_module_function (modul...
python
def patch_module_function(module, target, aspect, force_name=None, bag=BrokenBag, **options): """ Low-level patcher for one function from a specified module. .. warning:: You should not use this directly. :returns: An :obj:`aspectlib.Rollback` object. """ logdebug("patch_module_function (modul...
[ "def", "patch_module_function", "(", "module", ",", "target", ",", "aspect", ",", "force_name", "=", "None", ",", "bag", "=", "BrokenBag", ",", "*", "*", "options", ")", ":", "logdebug", "(", "\"patch_module_function (module=%s, target=%s, aspect=%s, force_name=%s, **...
Low-level patcher for one function from a specified module. .. warning:: You should not use this directly. :returns: An :obj:`aspectlib.Rollback` object.
[ "Low", "-", "level", "patcher", "for", "one", "function", "from", "a", "specified", "module", "." ]
train
https://github.com/ionelmc/python-aspectlib/blob/7dba7651ab76160b9ce66c9c11e770f7844e95ec/src/aspectlib/__init__.py#L737-L748
mjuenema/python-TSIP
tsip/llapi.py
unframe
def unframe(packet): """ Strip leading DLE and trailing DLE/ETX from packet. :param packet: TSIP packet with leading DLE and trailing DLE/ETX. :type packet: Binary string. :return: TSIP packet with leading DLE and trailing DLE/ETX removed. :raise: ``ValueError`` if `packet` does not start with ...
python
def unframe(packet): """ Strip leading DLE and trailing DLE/ETX from packet. :param packet: TSIP packet with leading DLE and trailing DLE/ETX. :type packet: Binary string. :return: TSIP packet with leading DLE and trailing DLE/ETX removed. :raise: ``ValueError`` if `packet` does not start with ...
[ "def", "unframe", "(", "packet", ")", ":", "if", "is_framed", "(", "packet", ")", ":", "return", "packet", ".", "lstrip", "(", "CHR_DLE", ")", ".", "rstrip", "(", "CHR_ETX", ")", ".", "rstrip", "(", "CHR_DLE", ")", "else", ":", "raise", "ValueError", ...
Strip leading DLE and trailing DLE/ETX from packet. :param packet: TSIP packet with leading DLE and trailing DLE/ETX. :type packet: Binary string. :return: TSIP packet with leading DLE and trailing DLE/ETX removed. :raise: ``ValueError`` if `packet` does not start with DLE and end in DLE/ETX.
[ "Strip", "leading", "DLE", "and", "trailing", "DLE", "/", "ETX", "from", "packet", "." ]
train
https://github.com/mjuenema/python-TSIP/blob/e02b68d05772127ea493cd639b3d5f8fb73df402/tsip/llapi.py#L41-L56
mjuenema/python-TSIP
tsip/llapi.py
stuff
def stuff(packet): """ Add byte stuffing to TSIP packet. :param packet: TSIP packet with byte stuffing. The packet must already have been stripped or `ValueError` will be raised. :type packet: Binary string. :return: Packet with byte stuffing. """ if is_framed(packet): rais...
python
def stuff(packet): """ Add byte stuffing to TSIP packet. :param packet: TSIP packet with byte stuffing. The packet must already have been stripped or `ValueError` will be raised. :type packet: Binary string. :return: Packet with byte stuffing. """ if is_framed(packet): rais...
[ "def", "stuff", "(", "packet", ")", ":", "if", "is_framed", "(", "packet", ")", ":", "raise", "ValueError", "(", "'packet contains leading DLE and trailing DLE/ETX'", ")", "else", ":", "return", "packet", ".", "replace", "(", "CHR_DLE", ",", "CHR_DLE", "+", "C...
Add byte stuffing to TSIP packet. :param packet: TSIP packet with byte stuffing. The packet must already have been stripped or `ValueError` will be raised. :type packet: Binary string. :return: Packet with byte stuffing.
[ "Add", "byte", "stuffing", "to", "TSIP", "packet", ".", ":", "param", "packet", ":", "TSIP", "packet", "with", "byte", "stuffing", ".", "The", "packet", "must", "already", "have", "been", "stripped", "or", "ValueError", "will", "be", "raised", ".", ":", ...
train
https://github.com/mjuenema/python-TSIP/blob/e02b68d05772127ea493cd639b3d5f8fb73df402/tsip/llapi.py#L59-L72
mjuenema/python-TSIP
tsip/llapi.py
unstuff
def unstuff(packet): """ Remove byte stuffing from a TSIP packet. :param packet: TSIP packet with byte stuffing. The packet must already have been stripped or `ValueError` will be raised. :type packet: Binary string. :return: Packet without byte stuffing. """ if is_framed(packet):...
python
def unstuff(packet): """ Remove byte stuffing from a TSIP packet. :param packet: TSIP packet with byte stuffing. The packet must already have been stripped or `ValueError` will be raised. :type packet: Binary string. :return: Packet without byte stuffing. """ if is_framed(packet):...
[ "def", "unstuff", "(", "packet", ")", ":", "if", "is_framed", "(", "packet", ")", ":", "raise", "ValueError", "(", "'packet contains leading DLE and trailing DLE/ETX'", ")", "else", ":", "return", "packet", ".", "replace", "(", "CHR_DLE", "+", "CHR_DLE", ",", ...
Remove byte stuffing from a TSIP packet. :param packet: TSIP packet with byte stuffing. The packet must already have been stripped or `ValueError` will be raised. :type packet: Binary string. :return: Packet without byte stuffing.
[ "Remove", "byte", "stuffing", "from", "a", "TSIP", "packet", "." ]
train
https://github.com/mjuenema/python-TSIP/blob/e02b68d05772127ea493cd639b3d5f8fb73df402/tsip/llapi.py#L76-L90
spacetelescope/stsci.tools
lib/stsci/tools/iterfile.py
parseFilename
def parseFilename(filename): """ Parse out filename from any specified extensions. Returns rootname and string version of extension name. Modified from 'pydrizzle.fileutil' to allow this module to be independent of PyDrizzle/MultiDrizzle. """ # Parse out any extension speci...
python
def parseFilename(filename): """ Parse out filename from any specified extensions. Returns rootname and string version of extension name. Modified from 'pydrizzle.fileutil' to allow this module to be independent of PyDrizzle/MultiDrizzle. """ # Parse out any extension speci...
[ "def", "parseFilename", "(", "filename", ")", ":", "# Parse out any extension specified in filename", "_indx", "=", "filename", ".", "find", "(", "'['", ")", "if", "_indx", ">", "0", ":", "# Read extension name provided", "_fname", "=", "filename", "[", ":", "_ind...
Parse out filename from any specified extensions. Returns rootname and string version of extension name. Modified from 'pydrizzle.fileutil' to allow this module to be independent of PyDrizzle/MultiDrizzle.
[ "Parse", "out", "filename", "from", "any", "specified", "extensions", ".", "Returns", "rootname", "and", "string", "version", "of", "extension", "name", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/iterfile.py#L111-L153
spacetelescope/stsci.tools
lib/stsci/tools/iterfile.py
IterFitsFile._shape
def _shape(self): """ Returns the shape of the data array associated with this file.""" hdu = self.open() _shape = hdu.shape if not self.inmemory: self.close() del hdu return _shape
python
def _shape(self): """ Returns the shape of the data array associated with this file.""" hdu = self.open() _shape = hdu.shape if not self.inmemory: self.close() del hdu return _shape
[ "def", "_shape", "(", "self", ")", ":", "hdu", "=", "self", ".", "open", "(", ")", "_shape", "=", "hdu", ".", "shape", "if", "not", "self", ".", "inmemory", ":", "self", ".", "close", "(", ")", "del", "hdu", "return", "_shape" ]
Returns the shape of the data array associated with this file.
[ "Returns", "the", "shape", "of", "the", "data", "array", "associated", "with", "this", "file", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/iterfile.py#L35-L42
spacetelescope/stsci.tools
lib/stsci/tools/iterfile.py
IterFitsFile._data
def _data(self): """ Returns the data array associated with this file/extenstion.""" hdu = self.open() _data = hdu.data.copy() if not self.inmemory: self.close() del hdu return _data
python
def _data(self): """ Returns the data array associated with this file/extenstion.""" hdu = self.open() _data = hdu.data.copy() if not self.inmemory: self.close() del hdu return _data
[ "def", "_data", "(", "self", ")", ":", "hdu", "=", "self", ".", "open", "(", ")", "_data", "=", "hdu", ".", "data", ".", "copy", "(", ")", "if", "not", "self", ".", "inmemory", ":", "self", ".", "close", "(", ")", "del", "hdu", "return", "_data...
Returns the data array associated with this file/extenstion.
[ "Returns", "the", "data", "array", "associated", "with", "this", "file", "/", "extenstion", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/iterfile.py#L44-L51
spacetelescope/stsci.tools
lib/stsci/tools/iterfile.py
IterFitsFile.type
def type(self): """ Returns the shape of the data array associated with this file.""" hdu = self.open() _type = hdu.data.dtype.name if not self.inmemory: self.close() del hdu return _type
python
def type(self): """ Returns the shape of the data array associated with this file.""" hdu = self.open() _type = hdu.data.dtype.name if not self.inmemory: self.close() del hdu return _type
[ "def", "type", "(", "self", ")", ":", "hdu", "=", "self", ".", "open", "(", ")", "_type", "=", "hdu", ".", "data", ".", "dtype", ".", "name", "if", "not", "self", ".", "inmemory", ":", "self", ".", "close", "(", ")", "del", "hdu", "return", "_t...
Returns the shape of the data array associated with this file.
[ "Returns", "the", "shape", "of", "the", "data", "array", "associated", "with", "this", "file", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/iterfile.py#L53-L60
spacetelescope/stsci.tools
lib/stsci/tools/iterfile.py
IterFitsFile.open
def open(self): """ Opens the file for subsequent access. """ if self.handle is None: self.handle = fits.open(self.fname, mode='readonly') if self.extn: if len(self.extn) == 1: hdu = self.handle[self.extn[0]] else: hdu = self....
python
def open(self): """ Opens the file for subsequent access. """ if self.handle is None: self.handle = fits.open(self.fname, mode='readonly') if self.extn: if len(self.extn) == 1: hdu = self.handle[self.extn[0]] else: hdu = self....
[ "def", "open", "(", "self", ")", ":", "if", "self", ".", "handle", "is", "None", ":", "self", ".", "handle", "=", "fits", ".", "open", "(", "self", ".", "fname", ",", "mode", "=", "'readonly'", ")", "if", "self", ".", "extn", ":", "if", "len", ...
Opens the file for subsequent access.
[ "Opens", "the", "file", "for", "subsequent", "access", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/iterfile.py#L62-L77
3ll3d00d/vibe
backend/src/analyser/common/measurementcontroller.py
ActiveMeasurement.overlapsWith
def overlapsWith(self, targetStartTime, duration): """ Tests if the given times overlap with this measurement. :param targetStartTime: the target start time. :param duration: the duration :return: true if the given times overlap with this measurement. """ targetEn...
python
def overlapsWith(self, targetStartTime, duration): """ Tests if the given times overlap with this measurement. :param targetStartTime: the target start time. :param duration: the duration :return: true if the given times overlap with this measurement. """ targetEn...
[ "def", "overlapsWith", "(", "self", ",", "targetStartTime", ",", "duration", ")", ":", "targetEndTime", "=", "targetStartTime", "+", "datetime", ".", "timedelta", "(", "days", "=", "0", ",", "seconds", "=", "duration", ")", "return", "(", "self", ".", "sta...
Tests if the given times overlap with this measurement. :param targetStartTime: the target start time. :param duration: the duration :return: true if the given times overlap with this measurement.
[ "Tests", "if", "the", "given", "times", "overlap", "with", "this", "measurement", ".", ":", "param", "targetStartTime", ":", "the", "target", "start", "time", ".", ":", "param", "duration", ":", "the", "duration", ":", "return", ":", "true", "if", "the", ...
train
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L98-L107
3ll3d00d/vibe
backend/src/analyser/common/measurementcontroller.py
ActiveMeasurement.updateDeviceStatus
def updateDeviceStatus(self, deviceName, state, reason=None): """ Updates the current device status. :param deviceName: the device name. :param state: the state. :param reason: the reason for the change. :return: """ logger.info('Updating recording device ...
python
def updateDeviceStatus(self, deviceName, state, reason=None): """ Updates the current device status. :param deviceName: the device name. :param state: the state. :param reason: the reason for the change. :return: """ logger.info('Updating recording device ...
[ "def", "updateDeviceStatus", "(", "self", ",", "deviceName", ",", "state", ",", "reason", "=", "None", ")", ":", "logger", ".", "info", "(", "'Updating recording device state for '", "+", "deviceName", "+", "' to '", "+", "state", ".", "name", "+", "(", "''"...
Updates the current device status. :param deviceName: the device name. :param state: the state. :param reason: the reason for the change. :return:
[ "Updates", "the", "current", "device", "status", ".", ":", "param", "deviceName", ":", "the", "device", "name", ".", ":", "param", "state", ":", "the", "state", ".", ":", "param", "reason", ":", "the", "reason", "for", "the", "change", ".", ":", "retur...
train
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L109-L129
3ll3d00d/vibe
backend/src/analyser/common/measurementcontroller.py
ActiveMeasurement.stillRecording
def stillRecording(self, deviceId, dataCount): """ For a device that is recording, updates the last timestamp so we now when we last received data. :param deviceId: the device id. :param dataCount: the no of items of data recorded in this batch. :return: """ statu...
python
def stillRecording(self, deviceId, dataCount): """ For a device that is recording, updates the last timestamp so we now when we last received data. :param deviceId: the device id. :param dataCount: the no of items of data recorded in this batch. :return: """ statu...
[ "def", "stillRecording", "(", "self", ",", "deviceId", ",", "dataCount", ")", ":", "status", "=", "self", ".", "recordingDevices", "[", "deviceId", "]", "if", "status", "is", "not", "None", ":", "if", "status", "[", "'state'", "]", "==", "MeasurementStatus...
For a device that is recording, updates the last timestamp so we now when we last received data. :param deviceId: the device id. :param dataCount: the no of items of data recorded in this batch. :return:
[ "For", "a", "device", "that", "is", "recording", "updates", "the", "last", "timestamp", "so", "we", "now", "when", "we", "last", "received", "data", ".", ":", "param", "deviceId", ":", "the", "device", "id", ".", ":", "param", "dataCount", ":", "the", ...
train
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L131-L142
3ll3d00d/vibe
backend/src/analyser/common/measurementcontroller.py
CompleteMeasurement.inflate
def inflate(self): """ loads the recording into memory and returns it as a Signal :return: """ if self.measurementParameters['accelerometerEnabled']: if len(self.data) == 0: logger.info('Loading measurement data for ' + self.name) self....
python
def inflate(self): """ loads the recording into memory and returns it as a Signal :return: """ if self.measurementParameters['accelerometerEnabled']: if len(self.data) == 0: logger.info('Loading measurement data for ' + self.name) self....
[ "def", "inflate", "(", "self", ")", ":", "if", "self", ".", "measurementParameters", "[", "'accelerometerEnabled'", "]", ":", "if", "len", "(", "self", ".", "data", ")", "==", "0", ":", "logger", ".", "info", "(", "'Loading measurement data for '", "+", "s...
loads the recording into memory and returns it as a Signal :return:
[ "loads", "the", "recording", "into", "memory", "and", "returns", "it", "as", "a", "Signal", ":", "return", ":" ]
train
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L178-L190
3ll3d00d/vibe
backend/src/analyser/common/measurementcontroller.py
MeasurementController._sweep
def _sweep(self): """ Checks the state of each measurement and verifies their state, if an active measurement is now complete then passes them to the completed measurement set, if failed then to the failed set, if failed and old then evicts. :return: """ while self.runnin...
python
def _sweep(self): """ Checks the state of each measurement and verifies their state, if an active measurement is now complete then passes them to the completed measurement set, if failed then to the failed set, if failed and old then evicts. :return: """ while self.runnin...
[ "def", "_sweep", "(", "self", ")", ":", "while", "self", ".", "running", ":", "for", "am", "in", "list", "(", "self", ".", "activeMeasurements", ")", ":", "now", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", "# devices were allocated and have ...
Checks the state of each measurement and verifies their state, if an active measurement is now complete then passes them to the completed measurement set, if failed then to the failed set, if failed and old then evicts. :return:
[ "Checks", "the", "state", "of", "each", "measurement", "and", "verifies", "their", "state", "if", "an", "active", "measurement", "is", "now", "complete", "then", "passes", "them", "to", "the", "completed", "measurement", "set", "if", "failed", "then", "to", ...
train
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L233-L266
3ll3d00d/vibe
backend/src/analyser/common/measurementcontroller.py
MeasurementController.schedule
def schedule(self, name, duration, startTime, description=None): """ Schedules a new measurement with the given name. :param name: :param duration: :param startTime: :param description: :return: a tuple boolean: measurement was scheduled if true ...
python
def schedule(self, name, duration, startTime, description=None): """ Schedules a new measurement with the given name. :param name: :param duration: :param startTime: :param description: :return: a tuple boolean: measurement was scheduled if true ...
[ "def", "schedule", "(", "self", ",", "name", ",", "duration", ",", "startTime", ",", "description", "=", "None", ")", ":", "if", "self", ".", "_clashes", "(", "startTime", ",", "duration", ")", ":", "return", "False", ",", "MEASUREMENT_TIMES_CLASH", "else"...
Schedules a new measurement with the given name. :param name: :param duration: :param startTime: :param description: :return: a tuple boolean: measurement was scheduled if true message: description, generally only used as an error code
[ "Schedules", "a", "new", "measurement", "with", "the", "given", "name", ".", ":", "param", "name", ":", ":", "param", "duration", ":", ":", "param", "startTime", ":", ":", "param", "description", ":", ":", "return", ":", "a", "tuple", "boolean", ":", "...
train
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L302-L333
3ll3d00d/vibe
backend/src/analyser/common/measurementcontroller.py
MeasurementController._clashes
def _clashes(self, startTime, duration): """ verifies that this measurement does not clash with an already scheduled measurement. :param startTime: the start time. :param duration: the duration. :return: true if the measurement is allowed. """ return [m for m in s...
python
def _clashes(self, startTime, duration): """ verifies that this measurement does not clash with an already scheduled measurement. :param startTime: the start time. :param duration: the duration. :return: true if the measurement is allowed. """ return [m for m in s...
[ "def", "_clashes", "(", "self", ",", "startTime", ",", "duration", ")", ":", "return", "[", "m", "for", "m", "in", "self", ".", "activeMeasurements", "if", "m", ".", "overlapsWith", "(", "startTime", ",", "duration", ")", "]" ]
verifies that this measurement does not clash with an already scheduled measurement. :param startTime: the start time. :param duration: the duration. :return: true if the measurement is allowed.
[ "verifies", "that", "this", "measurement", "does", "not", "clash", "with", "an", "already", "scheduled", "measurement", ".", ":", "param", "startTime", ":", "the", "start", "time", ".", ":", "param", "duration", ":", "the", "duration", ".", ":", "return", ...
train
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L335-L342
3ll3d00d/vibe
backend/src/analyser/common/measurementcontroller.py
MeasurementController.startMeasurement
def startMeasurement(self, measurementId, deviceId): """ Starts the measurement for the device. :param deviceId: the device that is starting. :param measurementId: the measurement that is started. :return: true if it started (i.e. device and measurement exists). """ ...
python
def startMeasurement(self, measurementId, deviceId): """ Starts the measurement for the device. :param deviceId: the device that is starting. :param measurementId: the measurement that is started. :return: true if it started (i.e. device and measurement exists). """ ...
[ "def", "startMeasurement", "(", "self", ",", "measurementId", ",", "deviceId", ")", ":", "am", ",", "handler", "=", "self", ".", "getDataHandler", "(", "measurementId", ",", "deviceId", ")", "if", "am", "is", "not", "None", ":", "am", ".", "status", "=",...
Starts the measurement for the device. :param deviceId: the device that is starting. :param measurementId: the measurement that is started. :return: true if it started (i.e. device and measurement exists).
[ "Starts", "the", "measurement", "for", "the", "device", ".", ":", "param", "deviceId", ":", "the", "device", "that", "is", "starting", ".", ":", "param", "measurementId", ":", "the", "measurement", "that", "is", "started", ".", ":", "return", ":", "true", ...
train
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L344-L358
3ll3d00d/vibe
backend/src/analyser/common/measurementcontroller.py
MeasurementController.getDataHandler
def getDataHandler(self, measurementId, deviceId): """ finds the handler. :param measurementId: the measurement :param deviceId: the device. :return: active measurement and handler """ am = next((m for m in self.activeMeasurements if m.id == measurementId), None) ...
python
def getDataHandler(self, measurementId, deviceId): """ finds the handler. :param measurementId: the measurement :param deviceId: the device. :return: active measurement and handler """ am = next((m for m in self.activeMeasurements if m.id == measurementId), None) ...
[ "def", "getDataHandler", "(", "self", ",", "measurementId", ",", "deviceId", ")", ":", "am", "=", "next", "(", "(", "m", "for", "m", "in", "self", ".", "activeMeasurements", "if", "m", ".", "id", "==", "measurementId", ")", ",", "None", ")", "if", "a...
finds the handler. :param measurementId: the measurement :param deviceId: the device. :return: active measurement and handler
[ "finds", "the", "handler", ".", ":", "param", "measurementId", ":", "the", "measurement", ":", "param", "deviceId", ":", "the", "device", ".", ":", "return", ":", "active", "measurement", "and", "handler" ]
train
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L360-L375
3ll3d00d/vibe
backend/src/analyser/common/measurementcontroller.py
MeasurementController.recordData
def recordData(self, measurementId, deviceId, data): """ Passes the data to the handler. :param deviceId: the device the data comes from. :param measurementId: the measurement id. :param data: the data. :return: true if the data was handled. """ am, handle...
python
def recordData(self, measurementId, deviceId, data): """ Passes the data to the handler. :param deviceId: the device the data comes from. :param measurementId: the measurement id. :param data: the data. :return: true if the data was handled. """ am, handle...
[ "def", "recordData", "(", "self", ",", "measurementId", ",", "deviceId", ",", "data", ")", ":", "am", ",", "handler", "=", "self", ".", "getDataHandler", "(", "measurementId", ",", "deviceId", ")", "if", "handler", "is", "not", "None", ":", "am", ".", ...
Passes the data to the handler. :param deviceId: the device the data comes from. :param measurementId: the measurement id. :param data: the data. :return: true if the data was handled.
[ "Passes", "the", "data", "to", "the", "handler", ".", ":", "param", "deviceId", ":", "the", "device", "the", "data", "comes", "from", ".", ":", "param", "measurementId", ":", "the", "measurement", "id", ".", ":", "param", "data", ":", "the", "data", "....
train
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L377-L392
3ll3d00d/vibe
backend/src/analyser/common/measurementcontroller.py
MeasurementController.completeMeasurement
def completeMeasurement(self, measurementId, deviceId): """ Completes the measurement session. :param deviceId: the device id. :param measurementId: the measurement id. :return: true if it was completed. """ am, handler = self.getDataHandler(measurementId, deviceI...
python
def completeMeasurement(self, measurementId, deviceId): """ Completes the measurement session. :param deviceId: the device id. :param measurementId: the measurement id. :return: true if it was completed. """ am, handler = self.getDataHandler(measurementId, deviceI...
[ "def", "completeMeasurement", "(", "self", ",", "measurementId", ",", "deviceId", ")", ":", "am", ",", "handler", "=", "self", ".", "getDataHandler", "(", "measurementId", ",", "deviceId", ")", "if", "handler", "is", "not", "None", ":", "handler", ".", "st...
Completes the measurement session. :param deviceId: the device id. :param measurementId: the measurement id. :return: true if it was completed.
[ "Completes", "the", "measurement", "session", ".", ":", "param", "deviceId", ":", "the", "device", "id", ".", ":", "param", "measurementId", ":", "the", "measurement", "id", ".", ":", "return", ":", "true", "if", "it", "was", "completed", "." ]
train
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L394-L407
3ll3d00d/vibe
backend/src/analyser/common/measurementcontroller.py
MeasurementController.failMeasurement
def failMeasurement(self, measurementId, deviceName, failureReason=None): """ Fails the measurement session. :param deviceName: the device name. :param measurementId: the measurement name. :param failureReason: why it failed. :return: true if it was completed. """...
python
def failMeasurement(self, measurementId, deviceName, failureReason=None): """ Fails the measurement session. :param deviceName: the device name. :param measurementId: the measurement name. :param failureReason: why it failed. :return: true if it was completed. """...
[ "def", "failMeasurement", "(", "self", ",", "measurementId", ",", "deviceName", ",", "failureReason", "=", "None", ")", ":", "am", ",", "handler", "=", "self", ".", "getDataHandler", "(", "measurementId", ",", "deviceName", ")", "if", "handler", "is", "not",...
Fails the measurement session. :param deviceName: the device name. :param measurementId: the measurement name. :param failureReason: why it failed. :return: true if it was completed.
[ "Fails", "the", "measurement", "session", ".", ":", "param", "deviceName", ":", "the", "device", "name", ".", ":", "param", "measurementId", ":", "the", "measurement", "name", ".", ":", "param", "failureReason", ":", "why", "it", "failed", ".", ":", "retur...
train
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L409-L423
3ll3d00d/vibe
backend/src/analyser/common/measurementcontroller.py
MeasurementController._deleteCompletedMeasurement
def _deleteCompletedMeasurement(self, measurementId): """ Deletes the named measurement from the completed measurement store if it exists. :param measurementId: :return: String: error messages Integer: count of measurements deleted """ message, cou...
python
def _deleteCompletedMeasurement(self, measurementId): """ Deletes the named measurement from the completed measurement store if it exists. :param measurementId: :return: String: error messages Integer: count of measurements deleted """ message, cou...
[ "def", "_deleteCompletedMeasurement", "(", "self", ",", "measurementId", ")", ":", "message", ",", "count", ",", "deleted", "=", "self", ".", "deleteFrom", "(", "measurementId", ",", "self", ".", "completeMeasurements", ")", "if", "count", "is", "0", ":", "m...
Deletes the named measurement from the completed measurement store if it exists. :param measurementId: :return: String: error messages Integer: count of measurements deleted
[ "Deletes", "the", "named", "measurement", "from", "the", "completed", "measurement", "store", "if", "it", "exists", ".", ":", "param", "measurementId", ":", ":", "return", ":", "String", ":", "error", "messages", "Integer", ":", "count", "of", "measurements", ...
train
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L434-L445
3ll3d00d/vibe
backend/src/analyser/common/measurementcontroller.py
MeasurementController.reloadCompletedMeasurements
def reloadCompletedMeasurements(self): """ Reloads the completed measurements from the backing store. """ from pathlib import Path reloaded = [self.load(x.resolve()) for x in Path(self.dataDir).glob('*/*/*') if x.is_dir()] logger.info('Reloaded ' + str(len(reloaded)) + ' ...
python
def reloadCompletedMeasurements(self): """ Reloads the completed measurements from the backing store. """ from pathlib import Path reloaded = [self.load(x.resolve()) for x in Path(self.dataDir).glob('*/*/*') if x.is_dir()] logger.info('Reloaded ' + str(len(reloaded)) + ' ...
[ "def", "reloadCompletedMeasurements", "(", "self", ")", ":", "from", "pathlib", "import", "Path", "reloaded", "=", "[", "self", ".", "load", "(", "x", ".", "resolve", "(", ")", ")", "for", "x", "in", "Path", "(", "self", ".", "dataDir", ")", ".", "gl...
Reloads the completed measurements from the backing store.
[ "Reloads", "the", "completed", "measurements", "from", "the", "backing", "store", "." ]
train
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L469-L477
3ll3d00d/vibe
backend/src/analyser/common/measurementcontroller.py
MeasurementController.getMeasurements
def getMeasurements(self, measurementStatus=None): """ Gets all available measurements. :param measurementStatus return only the measurements in the given state. :return: """ if measurementStatus is None: return self.activeMeasurements + self.completeMeasureme...
python
def getMeasurements(self, measurementStatus=None): """ Gets all available measurements. :param measurementStatus return only the measurements in the given state. :return: """ if measurementStatus is None: return self.activeMeasurements + self.completeMeasureme...
[ "def", "getMeasurements", "(", "self", ",", "measurementStatus", "=", "None", ")", ":", "if", "measurementStatus", "is", "None", ":", "return", "self", ".", "activeMeasurements", "+", "self", ".", "completeMeasurements", "+", "self", ".", "failedMeasurements", "...
Gets all available measurements. :param measurementStatus return only the measurements in the given state. :return:
[ "Gets", "all", "available", "measurements", ".", ":", "param", "measurementStatus", "return", "only", "the", "measurements", "in", "the", "given", "state", ".", ":", "return", ":" ]
train
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L479-L494
3ll3d00d/vibe
backend/src/analyser/common/measurementcontroller.py
MeasurementController.getMeasurement
def getMeasurement(self, measurementId, measurementStatus=None): """ Gets the measurement with the given id. :param measurementId: the id. :param measurementStatus: the status of the requested measurement. :return: the matching measurement or none if it doesn't exist. """...
python
def getMeasurement(self, measurementId, measurementStatus=None): """ Gets the measurement with the given id. :param measurementId: the id. :param measurementStatus: the status of the requested measurement. :return: the matching measurement or none if it doesn't exist. """...
[ "def", "getMeasurement", "(", "self", ",", "measurementId", ",", "measurementStatus", "=", "None", ")", ":", "return", "next", "(", "(", "x", "for", "x", "in", "self", ".", "getMeasurements", "(", "measurementStatus", ")", "if", "x", ".", "id", "==", "me...
Gets the measurement with the given id. :param measurementId: the id. :param measurementStatus: the status of the requested measurement. :return: the matching measurement or none if it doesn't exist.
[ "Gets", "the", "measurement", "with", "the", "given", "id", ".", ":", "param", "measurementId", ":", "the", "id", ".", ":", "param", "measurementStatus", ":", "the", "status", "of", "the", "requested", "measurement", ".", ":", "return", ":", "the", "matchi...
train
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L496-L503
3ll3d00d/vibe
backend/src/analyser/common/measurementcontroller.py
MeasurementController.store
def store(self, measurement): """ Writes the measurement metadata to disk on completion. :param activeMeasurement: the measurement that has completed. :returns the persisted metadata. """ os.makedirs(self._getPathToMeasurementMetaDir(measurement.idAsPath), exist_ok=True) ...
python
def store(self, measurement): """ Writes the measurement metadata to disk on completion. :param activeMeasurement: the measurement that has completed. :returns the persisted metadata. """ os.makedirs(self._getPathToMeasurementMetaDir(measurement.idAsPath), exist_ok=True) ...
[ "def", "store", "(", "self", ",", "measurement", ")", ":", "os", ".", "makedirs", "(", "self", ".", "_getPathToMeasurementMetaDir", "(", "measurement", ".", "idAsPath", ")", ",", "exist_ok", "=", "True", ")", "output", "=", "marshal", "(", "measurement", "...
Writes the measurement metadata to disk on completion. :param activeMeasurement: the measurement that has completed. :returns the persisted metadata.
[ "Writes", "the", "measurement", "metadata", "to", "disk", "on", "completion", ".", ":", "param", "activeMeasurement", ":", "the", "measurement", "that", "has", "completed", ".", ":", "returns", "the", "persisted", "metadata", "." ]
train
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L505-L515
3ll3d00d/vibe
backend/src/analyser/common/measurementcontroller.py
MeasurementController.load
def load(self, path): """ Loads a CompletedMeasurement from the path.á :param path: the path at which the data is found. :return: the measurement """ meta = self._loadMetaFromJson(path) return CompleteMeasurement(meta, self.dataDir) if meta is not None else None
python
def load(self, path): """ Loads a CompletedMeasurement from the path.á :param path: the path at which the data is found. :return: the measurement """ meta = self._loadMetaFromJson(path) return CompleteMeasurement(meta, self.dataDir) if meta is not None else None
[ "def", "load", "(", "self", ",", "path", ")", ":", "meta", "=", "self", ".", "_loadMetaFromJson", "(", "path", ")", "return", "CompleteMeasurement", "(", "meta", ",", "self", ".", "dataDir", ")", "if", "meta", "is", "not", "None", "else", "None" ]
Loads a CompletedMeasurement from the path.á :param path: the path at which the data is found. :return: the measurement
[ "Loads", "a", "CompletedMeasurement", "from", "the", "path", ".", "á", ":", "param", "path", ":", "the", "path", "at", "which", "the", "data", "is", "found", ".", ":", "return", ":", "the", "measurement" ]
train
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L517-L524
3ll3d00d/vibe
backend/src/analyser/common/measurementcontroller.py
MeasurementController._loadMetaFromJson
def _loadMetaFromJson(self, path): """ Reads the json meta into memory. :return: the meta. """ try: with (path / 'metadata.json').open() as infile: return json.load(infile) except FileNotFoundError: logger.error('Metadata does not e...
python
def _loadMetaFromJson(self, path): """ Reads the json meta into memory. :return: the meta. """ try: with (path / 'metadata.json').open() as infile: return json.load(infile) except FileNotFoundError: logger.error('Metadata does not e...
[ "def", "_loadMetaFromJson", "(", "self", ",", "path", ")", ":", "try", ":", "with", "(", "path", "/", "'metadata.json'", ")", ".", "open", "(", ")", "as", "infile", ":", "return", "json", ".", "load", "(", "infile", ")", "except", "FileNotFoundError", ...
Reads the json meta into memory. :return: the meta.
[ "Reads", "the", "json", "meta", "into", "memory", ".", ":", "return", ":", "the", "meta", "." ]
train
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L526-L536
3ll3d00d/vibe
backend/src/analyser/common/measurementcontroller.py
MeasurementController.editMeasurement
def editMeasurement(self, measurementId, data): """ Edits the specified measurement with the provided data. :param measurementId: the measurement id. :param data: the data to update. :return: true if the measurement was edited """ oldMeasurement = self.getMeasur...
python
def editMeasurement(self, measurementId, data): """ Edits the specified measurement with the provided data. :param measurementId: the measurement id. :param data: the data to update. :return: true if the measurement was edited """ oldMeasurement = self.getMeasur...
[ "def", "editMeasurement", "(", "self", ",", "measurementId", ",", "data", ")", ":", "oldMeasurement", "=", "self", ".", "getMeasurement", "(", "measurementId", ",", "measurementStatus", "=", "MeasurementStatus", ".", "COMPLETE", ")", "if", "oldMeasurement", ":", ...
Edits the specified measurement with the provided data. :param measurementId: the measurement id. :param data: the data to update. :return: true if the measurement was edited
[ "Edits", "the", "specified", "measurement", "with", "the", "provided", "data", ".", ":", "param", "measurementId", ":", "the", "measurement", "id", ".", ":", "param", "data", ":", "the", "data", "to", "update", ".", ":", "return", ":", "true", "if", "the...
train
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L544-L601
3ll3d00d/vibe
backend/src/analyser/common/measurementcontroller.py
MeasurementController._filterCopy
def _filterCopy(self, dataFile, newStart, newEnd, newDataDir): """ Copies the data file to a new file in the tmp dir, filtering it according to newStart and newEnd and adjusting the times as appropriate so it starts from 0. :param dataFile: the input file. :param newStart: the n...
python
def _filterCopy(self, dataFile, newStart, newEnd, newDataDir): """ Copies the data file to a new file in the tmp dir, filtering it according to newStart and newEnd and adjusting the times as appropriate so it starts from 0. :param dataFile: the input file. :param newStart: the n...
[ "def", "_filterCopy", "(", "self", ",", "dataFile", ",", "newStart", ",", "newEnd", ",", "newDataDir", ")", ":", "import", "csv", "pathToData", "=", "os", ".", "path", ".", "split", "(", "dataFile", ")", "dataFileName", "=", "pathToData", "[", "1", "]", ...
Copies the data file to a new file in the tmp dir, filtering it according to newStart and newEnd and adjusting the times as appropriate so it starts from 0. :param dataFile: the input file. :param newStart: the new start time. :param newEnd: the new end time. :param newDataDir: ...
[ "Copies", "the", "data", "file", "to", "a", "new", "file", "in", "the", "tmp", "dir", "filtering", "it", "according", "to", "newStart", "and", "newEnd", "and", "adjusting", "the", "times", "as", "appropriate", "so", "it", "starts", "from", "0", ".", ":",...
train
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/measurementcontroller.py#L603-L635
spacetelescope/stsci.tools
lib/stsci/tools/check_files.py
checkFiles
def checkFiles(filelist,ivmlist = None): """ - Converts waiver fits sciece and data quality files to MEF format - Converts GEIS science and data quality files to MEF format - Checks for stis association tables and splits them into single imsets - Removes files with EXPTIME=0 and the corresponding iv...
python
def checkFiles(filelist,ivmlist = None): """ - Converts waiver fits sciece and data quality files to MEF format - Converts GEIS science and data quality files to MEF format - Checks for stis association tables and splits them into single imsets - Removes files with EXPTIME=0 and the corresponding iv...
[ "def", "checkFiles", "(", "filelist", ",", "ivmlist", "=", "None", ")", ":", "toclose", "=", "False", "if", "isinstance", "(", "filelist", "[", "0", "]", ",", "str", ")", ":", "toclose", "=", "True", "newfilelist", ",", "ivmlist", "=", "checkFITSFormat",...
- Converts waiver fits sciece and data quality files to MEF format - Converts GEIS science and data quality files to MEF format - Checks for stis association tables and splits them into single imsets - Removes files with EXPTIME=0 and the corresponding ivm files - Removes files with NGOODPIX == 0 (to ex...
[ "-", "Converts", "waiver", "fits", "sciece", "and", "data", "quality", "files", "to", "MEF", "format", "-", "Converts", "GEIS", "science", "and", "data", "quality", "files", "to", "MEF", "format", "-", "Checks", "for", "stis", "association", "tables", "and",...
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/check_files.py#L20-L62
spacetelescope/stsci.tools
lib/stsci/tools/check_files.py
checkFITSFormat
def checkFITSFormat(filelist, ivmlist=None): """ This code will check whether or not files are GEIS or WAIVER FITS and convert them to MEF if found. It also keeps the IVMLIST consistent with the input filelist, in the case that some inputs get dropped during the check/conversion. """ if ivml...
python
def checkFITSFormat(filelist, ivmlist=None): """ This code will check whether or not files are GEIS or WAIVER FITS and convert them to MEF if found. It also keeps the IVMLIST consistent with the input filelist, in the case that some inputs get dropped during the check/conversion. """ if ivml...
[ "def", "checkFITSFormat", "(", "filelist", ",", "ivmlist", "=", "None", ")", ":", "if", "ivmlist", "is", "None", ":", "ivmlist", "=", "[", "None", "for", "l", "in", "filelist", "]", "sci_ivm", "=", "list", "(", "zip", "(", "filelist", ",", "ivmlist", ...
This code will check whether or not files are GEIS or WAIVER FITS and convert them to MEF if found. It also keeps the IVMLIST consistent with the input filelist, in the case that some inputs get dropped during the check/conversion.
[ "This", "code", "will", "check", "whether", "or", "not", "files", "are", "GEIS", "or", "WAIVER", "FITS", "and", "convert", "them", "to", "MEF", "if", "found", ".", "It", "also", "keeps", "the", "IVMLIST", "consistent", "with", "the", "input", "filelist", ...
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/check_files.py#L64-L86
spacetelescope/stsci.tools
lib/stsci/tools/check_files.py
check_exptime
def check_exptime(filelist): """ Removes files with EXPTIME==0 from filelist. """ toclose = False removed_files = [] for f in filelist: if isinstance(f, str): f = fits.open(f) toclose = True try: exptime = f[0].header['EXPTIME'] except...
python
def check_exptime(filelist): """ Removes files with EXPTIME==0 from filelist. """ toclose = False removed_files = [] for f in filelist: if isinstance(f, str): f = fits.open(f) toclose = True try: exptime = f[0].header['EXPTIME'] except...
[ "def", "check_exptime", "(", "filelist", ")", ":", "toclose", "=", "False", "removed_files", "=", "[", "]", "for", "f", "in", "filelist", ":", "if", "isinstance", "(", "f", ",", "str", ")", ":", "f", "=", "fits", ".", "open", "(", "f", ")", "toclos...
Removes files with EXPTIME==0 from filelist.
[ "Removes", "files", "with", "EXPTIME", "==", "0", "from", "filelist", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/check_files.py#L139-L164
spacetelescope/stsci.tools
lib/stsci/tools/check_files.py
checkNGOODPIX
def checkNGOODPIX(filelist): """ Only for ACS, WFC3 and STIS, check NGOODPIX If all pixels are 'bad' on all chips, exclude this image from further processing. Similar checks requiring comparing 'driz_sep_bits' against WFPC2 c1f.fits arrays and NICMOS DQ arrays will need to be done separately...
python
def checkNGOODPIX(filelist): """ Only for ACS, WFC3 and STIS, check NGOODPIX If all pixels are 'bad' on all chips, exclude this image from further processing. Similar checks requiring comparing 'driz_sep_bits' against WFPC2 c1f.fits arrays and NICMOS DQ arrays will need to be done separately...
[ "def", "checkNGOODPIX", "(", "filelist", ")", ":", "toclose", "=", "False", "removed_files", "=", "[", "]", "supported_instruments", "=", "[", "'ACS'", ",", "'STIS'", ",", "'WFC3'", "]", "for", "inputfile", "in", "filelist", ":", "if", "isinstance", "(", "...
Only for ACS, WFC3 and STIS, check NGOODPIX If all pixels are 'bad' on all chips, exclude this image from further processing. Similar checks requiring comparing 'driz_sep_bits' against WFPC2 c1f.fits arrays and NICMOS DQ arrays will need to be done separately (and later).
[ "Only", "for", "ACS", "WFC3", "and", "STIS", "check", "NGOODPIX", "If", "all", "pixels", "are", "bad", "on", "all", "chips", "exclude", "this", "image", "from", "further", "processing", ".", "Similar", "checks", "requiring", "comparing", "driz_sep_bits", "agai...
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/check_files.py#L166-L201
spacetelescope/stsci.tools
lib/stsci/tools/check_files.py
stisObsCount
def stisObsCount(input): """ Input: A stis multiextension file Output: Number of stis science extensions in input """ count = 0 toclose = False if isinstance(input, str): input = fits.open(input) toclose = True for ext in input: if 'extname' in ext.header: ...
python
def stisObsCount(input): """ Input: A stis multiextension file Output: Number of stis science extensions in input """ count = 0 toclose = False if isinstance(input, str): input = fits.open(input) toclose = True for ext in input: if 'extname' in ext.header: ...
[ "def", "stisObsCount", "(", "input", ")", ":", "count", "=", "0", "toclose", "=", "False", "if", "isinstance", "(", "input", ",", "str", ")", ":", "input", "=", "fits", ".", "open", "(", "input", ")", "toclose", "=", "True", "for", "ext", "in", "in...
Input: A stis multiextension file Output: Number of stis science extensions in input
[ "Input", ":", "A", "stis", "multiextension", "file", "Output", ":", "Number", "of", "stis", "science", "extensions", "in", "input" ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/check_files.py#L221-L237
spacetelescope/stsci.tools
lib/stsci/tools/check_files.py
splitStis
def splitStis(stisfile, sci_count): """ Split a STIS association file into multiple imset MEF files. Split the corresponding spt file if present into single spt files. If an spt file can't be split or is missing a Warning is printed. Returns ------- names: list a list with the name...
python
def splitStis(stisfile, sci_count): """ Split a STIS association file into multiple imset MEF files. Split the corresponding spt file if present into single spt files. If an spt file can't be split or is missing a Warning is printed. Returns ------- names: list a list with the name...
[ "def", "splitStis", "(", "stisfile", ",", "sci_count", ")", ":", "newfiles", "=", "[", "]", "toclose", "=", "False", "if", "isinstance", "(", "stisfile", ",", "str", ")", ":", "f", "=", "fits", ".", "open", "(", "stisfile", ")", "toclose", "=", "True...
Split a STIS association file into multiple imset MEF files. Split the corresponding spt file if present into single spt files. If an spt file can't be split or is missing a Warning is printed. Returns ------- names: list a list with the names of the new flt files.
[ "Split", "a", "STIS", "association", "file", "into", "multiple", "imset", "MEF", "files", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/check_files.py#L239-L340
spacetelescope/stsci.tools
lib/stsci/tools/check_files.py
stisExt2PrimKw
def stisExt2PrimKw(stisfiles): """ Several kw which are usually in the primary header are in the extension header for STIS. They are copied to the primary header for convenience. List if kw: 'DATE-OBS', 'EXPEND', 'EXPSTART', 'EXPTIME' """ kw_list = ['DATE-OBS', 'EXPE...
python
def stisExt2PrimKw(stisfiles): """ Several kw which are usually in the primary header are in the extension header for STIS. They are copied to the primary header for convenience. List if kw: 'DATE-OBS', 'EXPEND', 'EXPSTART', 'EXPTIME' """ kw_list = ['DATE-OBS', 'EXPE...
[ "def", "stisExt2PrimKw", "(", "stisfiles", ")", ":", "kw_list", "=", "[", "'DATE-OBS'", ",", "'EXPEND'", ",", "'EXPSTART'", ",", "'EXPTIME'", "]", "for", "sfile", "in", "stisfiles", ":", "toclose", "=", "False", "if", "isinstance", "(", "sfile", ",", "str"...
Several kw which are usually in the primary header are in the extension header for STIS. They are copied to the primary header for convenience. List if kw: 'DATE-OBS', 'EXPEND', 'EXPSTART', 'EXPTIME'
[ "Several", "kw", "which", "are", "usually", "in", "the", "primary", "header", "are", "in", "the", "extension", "header", "for", "STIS", ".", "They", "are", "copied", "to", "the", "primary", "header", "for", "convenience", ".", "List", "if", "kw", ":", "D...
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/check_files.py#L342-L365
spacetelescope/stsci.tools
lib/stsci/tools/check_files.py
convert2fits
def convert2fits(sci_ivm): """ Checks if a file is in WAIVER of GEIS format and converts it to MEF """ removed_files = [] translated_names = [] newivmlist = [] for file in sci_ivm: #find out what the input is # if science file is not found on disk, add it to removed_files fo...
python
def convert2fits(sci_ivm): """ Checks if a file is in WAIVER of GEIS format and converts it to MEF """ removed_files = [] translated_names = [] newivmlist = [] for file in sci_ivm: #find out what the input is # if science file is not found on disk, add it to removed_files fo...
[ "def", "convert2fits", "(", "sci_ivm", ")", ":", "removed_files", "=", "[", "]", "translated_names", "=", "[", "]", "newivmlist", "=", "[", "]", "for", "file", "in", "sci_ivm", ":", "#find out what the input is", "# if science file is not found on disk, add it to remo...
Checks if a file is in WAIVER of GEIS format and converts it to MEF
[ "Checks", "if", "a", "file", "is", "in", "WAIVER", "of", "GEIS", "format", "and", "converts", "it", "to", "MEF" ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/check_files.py#L408-L452
spacetelescope/stsci.tools
lib/stsci/tools/check_files.py
waiver2mef
def waiver2mef(sciname, newname=None, convert_dq=True, writefits=True): """ Converts a GEIS science file and its corresponding data quality file (if present) to MEF format Writes out both files to disk. Returns the new name of the science image. """ if isinstance(sciname, fits.HDUList): ...
python
def waiver2mef(sciname, newname=None, convert_dq=True, writefits=True): """ Converts a GEIS science file and its corresponding data quality file (if present) to MEF format Writes out both files to disk. Returns the new name of the science image. """ if isinstance(sciname, fits.HDUList): ...
[ "def", "waiver2mef", "(", "sciname", ",", "newname", "=", "None", ",", "convert_dq", "=", "True", ",", "writefits", "=", "True", ")", ":", "if", "isinstance", "(", "sciname", ",", "fits", ".", "HDUList", ")", ":", "filename", "=", "sciname", ".", "file...
Converts a GEIS science file and its corresponding data quality file (if present) to MEF format Writes out both files to disk. Returns the new name of the science image.
[ "Converts", "a", "GEIS", "science", "file", "and", "its", "corresponding", "data", "quality", "file", "(", "if", "present", ")", "to", "MEF", "format", "Writes", "out", "both", "files", "to", "disk", ".", "Returns", "the", "new", "name", "of", "the", "sc...
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/check_files.py#L454-L510
spacetelescope/stsci.tools
lib/stsci/tools/check_files.py
geis2mef
def geis2mef(sciname, convert_dq=True): """ Converts a GEIS science file and its corresponding data quality file (if present) to MEF format Writes out both files to disk. Returns the new name of the science image. """ clobber = True mode = 'update' memmap = True # Input was speci...
python
def geis2mef(sciname, convert_dq=True): """ Converts a GEIS science file and its corresponding data quality file (if present) to MEF format Writes out both files to disk. Returns the new name of the science image. """ clobber = True mode = 'update' memmap = True # Input was speci...
[ "def", "geis2mef", "(", "sciname", ",", "convert_dq", "=", "True", ")", ":", "clobber", "=", "True", "mode", "=", "'update'", "memmap", "=", "True", "# Input was specified as a GEIS image, but no FITS copy", "# exists. Read it in with 'readgeis' and make a copy", "# then o...
Converts a GEIS science file and its corresponding data quality file (if present) to MEF format Writes out both files to disk. Returns the new name of the science image.
[ "Converts", "a", "GEIS", "science", "file", "and", "its", "corresponding", "data", "quality", "file", "(", "if", "present", ")", "to", "MEF", "format", "Writes", "out", "both", "files", "to", "disk", ".", "Returns", "the", "new", "name", "of", "the", "sc...
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/check_files.py#L513-L568
ianepperson/pyredminews
redmine/redmine.py
Issue.journals
def journals(self): """ Retrieve journals attribute for this very Issue """ try: target = self._item_path json_data = self._redmine.get(target % str(self.id), parms={'include': 'journals'}) data = self._redmine...
python
def journals(self): """ Retrieve journals attribute for this very Issue """ try: target = self._item_path json_data = self._redmine.get(target % str(self.id), parms={'include': 'journals'}) data = self._redmine...
[ "def", "journals", "(", "self", ")", ":", "try", ":", "target", "=", "self", ".", "_item_path", "json_data", "=", "self", ".", "_redmine", ".", "get", "(", "target", "%", "str", "(", "self", ".", "id", ")", ",", "parms", "=", "{", "'include'", ":",...
Retrieve journals attribute for this very Issue
[ "Retrieve", "journals", "attribute", "for", "this", "very", "Issue" ]
train
https://github.com/ianepperson/pyredminews/blob/b2b0581483632738a3acca3b4e093c181847b813/redmine/redmine.py#L239-L256
ianepperson/pyredminews
redmine/redmine.py
Issue.save
def save(self, notes=None): '''Save all changes back to Redmine with optional notes.''' # Capture the notes if given if notes: self._changes['notes'] = notes # Call the base-class save function super(Issue, self).save()
python
def save(self, notes=None): '''Save all changes back to Redmine with optional notes.''' # Capture the notes if given if notes: self._changes['notes'] = notes # Call the base-class save function super(Issue, self).save()
[ "def", "save", "(", "self", ",", "notes", "=", "None", ")", ":", "# Capture the notes if given", "if", "notes", ":", "self", ".", "_changes", "[", "'notes'", "]", "=", "notes", "# Call the base-class save function", "super", "(", "Issue", ",", "self", ")", "...
Save all changes back to Redmine with optional notes.
[ "Save", "all", "changes", "back", "to", "Redmine", "with", "optional", "notes", "." ]
train
https://github.com/ianepperson/pyredminews/blob/b2b0581483632738a3acca3b4e093c181847b813/redmine/redmine.py#L258-L265
ianepperson/pyredminews
redmine/redmine.py
Issue.set_status
def set_status(self, new_status, notes=None): '''Save all changes and set to the given new_status''' self.status_id = new_status try: self.status['id'] = self.status_id # We don't have the id to name mapping, so blank the name self.status['name'] = None ...
python
def set_status(self, new_status, notes=None): '''Save all changes and set to the given new_status''' self.status_id = new_status try: self.status['id'] = self.status_id # We don't have the id to name mapping, so blank the name self.status['name'] = None ...
[ "def", "set_status", "(", "self", ",", "new_status", ",", "notes", "=", "None", ")", ":", "self", ".", "status_id", "=", "new_status", "try", ":", "self", ".", "status", "[", "'id'", "]", "=", "self", ".", "status_id", "# We don't have the id to name mapping...
Save all changes and set to the given new_status
[ "Save", "all", "changes", "and", "set", "to", "the", "given", "new_status" ]
train
https://github.com/ianepperson/pyredminews/blob/b2b0581483632738a3acca3b4e093c181847b813/redmine/redmine.py#L267-L276
ianepperson/pyredminews
redmine/redmine.py
Issue.resolve
def resolve(self, notes=None): '''Save all changes and resolve this issue''' self.set_status(self._redmine.ISSUE_STATUS_ID_RESOLVED, notes=notes)
python
def resolve(self, notes=None): '''Save all changes and resolve this issue''' self.set_status(self._redmine.ISSUE_STATUS_ID_RESOLVED, notes=notes)
[ "def", "resolve", "(", "self", ",", "notes", "=", "None", ")", ":", "self", ".", "set_status", "(", "self", ".", "_redmine", ".", "ISSUE_STATUS_ID_RESOLVED", ",", "notes", "=", "notes", ")" ]
Save all changes and resolve this issue
[ "Save", "all", "changes", "and", "resolve", "this", "issue" ]
train
https://github.com/ianepperson/pyredminews/blob/b2b0581483632738a3acca3b4e093c181847b813/redmine/redmine.py#L278-L280
ianepperson/pyredminews
redmine/redmine.py
Issue.close
def close(self, notes=None): '''Save all changes and close this issue''' self.set_status(self._redmine.ISSUE_STATUS_ID_CLOSED, notes=notes)
python
def close(self, notes=None): '''Save all changes and close this issue''' self.set_status(self._redmine.ISSUE_STATUS_ID_CLOSED, notes=notes)
[ "def", "close", "(", "self", ",", "notes", "=", "None", ")", ":", "self", ".", "set_status", "(", "self", ".", "_redmine", ".", "ISSUE_STATUS_ID_CLOSED", ",", "notes", "=", "notes", ")" ]
Save all changes and close this issue
[ "Save", "all", "changes", "and", "close", "this", "issue" ]
train
https://github.com/ianepperson/pyredminews/blob/b2b0581483632738a3acca3b4e093c181847b813/redmine/redmine.py#L282-L284
ianepperson/pyredminews
redmine/redmine.py
Redmine_Wiki_Pages_Manager._objectify
def _objectify(self, json_data=None, data={}): '''Return an object derived from the given json data.''' if json_data: # Parse the data try: data = json.loads(json_data) except ValueError: # If parsing failed, then raise the string which...
python
def _objectify(self, json_data=None, data={}): '''Return an object derived from the given json data.''' if json_data: # Parse the data try: data = json.loads(json_data) except ValueError: # If parsing failed, then raise the string which...
[ "def", "_objectify", "(", "self", ",", "json_data", "=", "None", ",", "data", "=", "{", "}", ")", ":", "if", "json_data", ":", "# Parse the data", "try", ":", "data", "=", "json", ".", "loads", "(", "json_data", ")", "except", "ValueError", ":", "# If ...
Return an object derived from the given json data.
[ "Return", "an", "object", "derived", "from", "the", "given", "json", "data", "." ]
train
https://github.com/ianepperson/pyredminews/blob/b2b0581483632738a3acca3b4e093c181847b813/redmine/redmine.py#L610-L635
ianepperson/pyredminews
redmine/redmine.py
Redmine_Wiki_Pages_Manager.new
def new(self, page_name, **dict): ''' Create a new item with the provided dict information at the given page_name. Returns the new item. As of version 2.2 of Redmine, this doesn't seem to function. ''' self._item_new_path = '/projects/%s/wiki/%s.json' % \ (s...
python
def new(self, page_name, **dict): ''' Create a new item with the provided dict information at the given page_name. Returns the new item. As of version 2.2 of Redmine, this doesn't seem to function. ''' self._item_new_path = '/projects/%s/wiki/%s.json' % \ (s...
[ "def", "new", "(", "self", ",", "page_name", ",", "*", "*", "dict", ")", ":", "self", ".", "_item_new_path", "=", "'/projects/%s/wiki/%s.json'", "%", "(", "self", ".", "_project", ".", "identifier", ",", "page_name", ")", "# Call the base class new method", "r...
Create a new item with the provided dict information at the given page_name. Returns the new item. As of version 2.2 of Redmine, this doesn't seem to function.
[ "Create", "a", "new", "item", "with", "the", "provided", "dict", "information", "at", "the", "given", "page_name", ".", "Returns", "the", "new", "item", "." ]
train
https://github.com/ianepperson/pyredminews/blob/b2b0581483632738a3acca3b4e093c181847b813/redmine/redmine.py#L638-L648
ianepperson/pyredminews
redmine/redmine.py
Redmine._set_version
def _set_version(self, version): ''' Set up this object based on the capabilities of the known versions of Redmine ''' # Store the version we are evaluating self.version = version or None # To evaluate the version capabilities, # assume the best-case if no...
python
def _set_version(self, version): ''' Set up this object based on the capabilities of the known versions of Redmine ''' # Store the version we are evaluating self.version = version or None # To evaluate the version capabilities, # assume the best-case if no...
[ "def", "_set_version", "(", "self", ",", "version", ")", ":", "# Store the version we are evaluating", "self", ".", "version", "=", "version", "or", "None", "# To evaluate the version capabilities,", "# assume the best-case if no version is provided.", "version_check", "=", "...
Set up this object based on the capabilities of the known versions of Redmine
[ "Set", "up", "this", "object", "based", "on", "the", "capabilities", "of", "the", "known", "versions", "of", "Redmine" ]
train
https://github.com/ianepperson/pyredminews/blob/b2b0581483632738a3acca3b4e093c181847b813/redmine/redmine.py#L744-L783
3ll3d00d/vibe
backend/src/analyser/common/config.py
loadTargetState
def loadTargetState(targetStateConfig, existingTargetState=None): """ extracts a new TargetState object from the specified configuration :param targetStateConfig: the config dict. :param existingTargetState: the existing state :return: """ from analyser.common.targetstatecontroller import Ta...
python
def loadTargetState(targetStateConfig, existingTargetState=None): """ extracts a new TargetState object from the specified configuration :param targetStateConfig: the config dict. :param existingTargetState: the existing state :return: """ from analyser.common.targetstatecontroller import Ta...
[ "def", "loadTargetState", "(", "targetStateConfig", ",", "existingTargetState", "=", "None", ")", ":", "from", "analyser", ".", "common", ".", "targetstatecontroller", "import", "TargetState", "targetState", "=", "TargetState", "(", ")", "if", "existingTargetState", ...
extracts a new TargetState object from the specified configuration :param targetStateConfig: the config dict. :param existingTargetState: the existing state :return:
[ "extracts", "a", "new", "TargetState", "object", "from", "the", "specified", "configuration", ":", "param", "targetStateConfig", ":", "the", "config", "dict", ".", ":", "param", "existingTargetState", ":", "the", "existing", "state", ":", "return", ":" ]
train
https://github.com/3ll3d00d/vibe/blob/124b029f13ac746723e92cb47e9cb56edd2e54b5/backend/src/analyser/common/config.py#L58-L87
spacetelescope/stsci.tools
lib/stsci/tools/bitmask.py
interpret_bit_flags
def interpret_bit_flags(bit_flags, flip_bits=None): """ Converts input bit flags to a single integer value (bitmask) or `None`. When input is a list of flags (either a Python list of integer flags or a sting of comma- or '+'-separated list of flags), the returned bitmask is obtained by summing inpu...
python
def interpret_bit_flags(bit_flags, flip_bits=None): """ Converts input bit flags to a single integer value (bitmask) or `None`. When input is a list of flags (either a Python list of integer flags or a sting of comma- or '+'-separated list of flags), the returned bitmask is obtained by summing inpu...
[ "def", "interpret_bit_flags", "(", "bit_flags", ",", "flip_bits", "=", "None", ")", ":", "has_flip_bits", "=", "flip_bits", "is", "not", "None", "flip_bits", "=", "bool", "(", "flip_bits", ")", "allow_non_flags", "=", "False", "if", "_is_int", "(", "bit_flags"...
Converts input bit flags to a single integer value (bitmask) or `None`. When input is a list of flags (either a Python list of integer flags or a sting of comma- or '+'-separated list of flags), the returned bitmask is obtained by summing input flags. .. note:: In order to flip the bits of the...
[ "Converts", "input", "bit", "flags", "to", "a", "single", "integer", "value", "(", "bitmask", ")", "or", "None", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/bitmask.py#L89-L242
spacetelescope/stsci.tools
lib/stsci/tools/bitmask.py
bitfield_to_boolean_mask
def bitfield_to_boolean_mask(bitfield, ignore_flags=0, flip_bits=None, good_mask_value=True, dtype=np.bool_): """ bitfield_to_boolean_mask(bitfield, ignore_flags=None, flip_bits=None, \ good_mask_value=True, dtype=numpy.bool\_) Converts an array of bit fields to a boolean (or in...
python
def bitfield_to_boolean_mask(bitfield, ignore_flags=0, flip_bits=None, good_mask_value=True, dtype=np.bool_): """ bitfield_to_boolean_mask(bitfield, ignore_flags=None, flip_bits=None, \ good_mask_value=True, dtype=numpy.bool\_) Converts an array of bit fields to a boolean (or in...
[ "def", "bitfield_to_boolean_mask", "(", "bitfield", ",", "ignore_flags", "=", "0", ",", "flip_bits", "=", "None", ",", "good_mask_value", "=", "True", ",", "dtype", "=", "np", ".", "bool_", ")", ":", "bitfield", "=", "np", ".", "asarray", "(", "bitfield", ...
bitfield_to_boolean_mask(bitfield, ignore_flags=None, flip_bits=None, \ good_mask_value=True, dtype=numpy.bool\_) Converts an array of bit fields to a boolean (or integer) mask array according to a bitmask constructed from the supplied bit flags (see ``ignore_flags`` parameter). This function is partic...
[ "bitfield_to_boolean_mask", "(", "bitfield", "ignore_flags", "=", "None", "flip_bits", "=", "None", "\\", "good_mask_value", "=", "True", "dtype", "=", "numpy", ".", "bool", "\\", "_", ")", "Converts", "an", "array", "of", "bit", "fields", "to", "a", "boolea...
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/bitmask.py#L245-L438
spacetelescope/stsci.tools
lib/stsci/tools/bitmask.py
interpret_bits_value
def interpret_bits_value(val): """ Converts input bits value from string to a single integer value or None. If a comma- or '+'-separated set of values are provided, they are summed. .. note:: In order to flip the bits of the final result (after summation), for input of `str` type, prepe...
python
def interpret_bits_value(val): """ Converts input bits value from string to a single integer value or None. If a comma- or '+'-separated set of values are provided, they are summed. .. note:: In order to flip the bits of the final result (after summation), for input of `str` type, prepe...
[ "def", "interpret_bits_value", "(", "val", ")", ":", "if", "isinstance", "(", "val", ",", "int", ")", "or", "val", "is", "None", ":", "return", "val", "else", ":", "val", "=", "str", "(", "val", ")", ".", "strip", "(", ")", "if", "val", ".", "sta...
Converts input bits value from string to a single integer value or None. If a comma- or '+'-separated set of values are provided, they are summed. .. note:: In order to flip the bits of the final result (after summation), for input of `str` type, prepend '~' to the input string. '~' must ...
[ "Converts", "input", "bits", "value", "from", "string", "to", "a", "single", "integer", "value", "or", "None", ".", "If", "a", "comma", "-", "or", "+", "-", "separated", "set", "of", "values", "are", "provided", "they", "are", "summed", "." ]
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/bitmask.py#L443-L509
spacetelescope/stsci.tools
lib/stsci/tools/bitmask.py
bitmask2mask
def bitmask2mask(bitmask, ignore_bits, good_mask_value=1, dtype=np.bool_): """ bitmask2mask(bitmask, ignore_bits, good_mask_value=1, dtype=numpy.bool\_) Interprets an array of bit flags and converts it to a "binary" mask array. This function is particularly useful to convert data quality arrays to b...
python
def bitmask2mask(bitmask, ignore_bits, good_mask_value=1, dtype=np.bool_): """ bitmask2mask(bitmask, ignore_bits, good_mask_value=1, dtype=numpy.bool\_) Interprets an array of bit flags and converts it to a "binary" mask array. This function is particularly useful to convert data quality arrays to b...
[ "def", "bitmask2mask", "(", "bitmask", ",", "ignore_bits", ",", "good_mask_value", "=", "1", ",", "dtype", "=", "np", ".", "bool_", ")", ":", "if", "not", "np", ".", "issubdtype", "(", "bitmask", ".", "dtype", ",", "np", ".", "integer", ")", ":", "ra...
bitmask2mask(bitmask, ignore_bits, good_mask_value=1, dtype=numpy.bool\_) Interprets an array of bit flags and converts it to a "binary" mask array. This function is particularly useful to convert data quality arrays to binary masks. Parameters ---------- bitmask : numpy.ndarray An arra...
[ "bitmask2mask", "(", "bitmask", "ignore_bits", "good_mask_value", "=", "1", "dtype", "=", "numpy", ".", "bool", "\\", "_", ")", "Interprets", "an", "array", "of", "bit", "flags", "and", "converts", "it", "to", "a", "binary", "mask", "array", ".", "This", ...
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/bitmask.py#L514-L623
titilambert/pyhydroquebec
pyhydroquebec/output.py
output_text
def output_text(account, all_data, show_hourly=False): """Format data to get a readable output.""" print(""" ################################# # Hydro Quebec data for account # # {} #################################""".format(account)) for contract, data in all_data.items(): data['contract'] = contr...
python
def output_text(account, all_data, show_hourly=False): """Format data to get a readable output.""" print(""" ################################# # Hydro Quebec data for account # # {} #################################""".format(account)) for contract, data in all_data.items(): data['contract'] = contr...
[ "def", "output_text", "(", "account", ",", "all_data", ",", "show_hourly", "=", "False", ")", ":", "print", "(", "\"\"\"\n#################################\n# Hydro Quebec data for account #\n# {}\n#################################\"\"\"", ".", "format", "(", "account", ")", ...
Format data to get a readable output.
[ "Format", "data", "to", "get", "a", "readable", "output", "." ]
train
https://github.com/titilambert/pyhydroquebec/blob/4ea1374a63944413889c147d91961eda0605d4fd/pyhydroquebec/output.py#L14-L91
titilambert/pyhydroquebec
pyhydroquebec/output.py
output_influx
def output_influx(data): """Print data using influxDB format.""" for contract in data: # Pop yesterdays data yesterday_data = data[contract]['yesterday_hourly_consumption'] del data[contract]['yesterday_hourly_consumption'] # Print general data out = "pyhydroquebec,cont...
python
def output_influx(data): """Print data using influxDB format.""" for contract in data: # Pop yesterdays data yesterday_data = data[contract]['yesterday_hourly_consumption'] del data[contract]['yesterday_hourly_consumption'] # Print general data out = "pyhydroquebec,cont...
[ "def", "output_influx", "(", "data", ")", ":", "for", "contract", "in", "data", ":", "# Pop yesterdays data", "yesterday_data", "=", "data", "[", "contract", "]", "[", "'yesterday_hourly_consumption'", "]", "del", "data", "[", "contract", "]", "[", "'yesterday_h...
Print data using influxDB format.
[ "Print", "data", "using", "influxDB", "format", "." ]
train
https://github.com/titilambert/pyhydroquebec/blob/4ea1374a63944413889c147d91961eda0605d4fd/pyhydroquebec/output.py#L94-L130
spacetelescope/stsci.tools
lib/stsci/tools/capable.py
which_darwin_linkage
def which_darwin_linkage(force_otool_check=False): """ Convenience function. Returns one of ('x11', 'aqua') in answer to the question of whether this is an X11-linked Python/tkinter, or a natively built (framework, Aqua) one. This is only for OSX. This relies on the assumption that on OSX, PyObjC is i...
python
def which_darwin_linkage(force_otool_check=False): """ Convenience function. Returns one of ('x11', 'aqua') in answer to the question of whether this is an X11-linked Python/tkinter, or a natively built (framework, Aqua) one. This is only for OSX. This relies on the assumption that on OSX, PyObjC is i...
[ "def", "which_darwin_linkage", "(", "force_otool_check", "=", "False", ")", ":", "# sanity check", "assert", "sys", ".", "platform", "==", "'darwin'", ",", "'Incorrect usage, not on OSX'", "# If not forced to run otool, then make some quick and dirty", "# simple checks/assumption...
Convenience function. Returns one of ('x11', 'aqua') in answer to the question of whether this is an X11-linked Python/tkinter, or a natively built (framework, Aqua) one. This is only for OSX. This relies on the assumption that on OSX, PyObjC is installed in the Framework builds of Python. If it does...
[ "Convenience", "function", ".", "Returns", "one", "of", "(", "x11", "aqua", ")", "in", "answer", "to", "the", "question", "of", "whether", "this", "is", "an", "X11", "-", "linked", "Python", "/", "tkinter", "or", "a", "natively", "built", "(", "framework...
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/capable.py#L26-L86
spacetelescope/stsci.tools
lib/stsci/tools/capable.py
get_dc_owner
def get_dc_owner(raises, mask_if_self): """ Convenience function to return owner of /dev/console. If raises is True, this raises an exception on any error. If not, it returns any error string as the owner name. If owner is self, and if mask_if_self, returns "<self>".""" try: from pwd import ...
python
def get_dc_owner(raises, mask_if_self): """ Convenience function to return owner of /dev/console. If raises is True, this raises an exception on any error. If not, it returns any error string as the owner name. If owner is self, and if mask_if_self, returns "<self>".""" try: from pwd import ...
[ "def", "get_dc_owner", "(", "raises", ",", "mask_if_self", ")", ":", "try", ":", "from", "pwd", "import", "getpwuid", "owner_uid", "=", "os", ".", "stat", "(", "'/dev/console'", ")", ".", "st_uid", "self_uid", "=", "os", ".", "getuid", "(", ")", "if", ...
Convenience function to return owner of /dev/console. If raises is True, this raises an exception on any error. If not, it returns any error string as the owner name. If owner is self, and if mask_if_self, returns "<self>".
[ "Convenience", "function", "to", "return", "owner", "of", "/", "dev", "/", "console", ".", "If", "raises", "is", "True", "this", "raises", "an", "exception", "on", "any", "error", ".", "If", "not", "it", "returns", "any", "error", "string", "as", "the", ...
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/capable.py#L89-L106
fitnr/convertdate
convertdate/bahai.py
to_jd
def to_jd(year, month, day): '''Determine Julian day from Bahai date''' gy = year - 1 + EPOCH_GREGORIAN_YEAR if month != 20: m = 0 else: if isleap(gy + 1): m = -14 else: m = -15 return gregorian.to_jd(gy, 3, 20) + (19 * (month - 1)) + m + day
python
def to_jd(year, month, day): '''Determine Julian day from Bahai date''' gy = year - 1 + EPOCH_GREGORIAN_YEAR if month != 20: m = 0 else: if isleap(gy + 1): m = -14 else: m = -15 return gregorian.to_jd(gy, 3, 20) + (19 * (month - 1)) + m + day
[ "def", "to_jd", "(", "year", ",", "month", ",", "day", ")", ":", "gy", "=", "year", "-", "1", "+", "EPOCH_GREGORIAN_YEAR", "if", "month", "!=", "20", ":", "m", "=", "0", "else", ":", "if", "isleap", "(", "gy", "+", "1", ")", ":", "m", "=", "-...
Determine Julian day from Bahai date
[ "Determine", "Julian", "day", "from", "Bahai", "date" ]
train
https://github.com/fitnr/convertdate/blob/e920f168a87f99183b0aa7290d6c3af222582d43/convertdate/bahai.py#L29-L40
fitnr/convertdate
convertdate/bahai.py
from_jd
def from_jd(jd): '''Calculate Bahai date from Julian day''' jd = trunc(jd) + 0.5 g = gregorian.from_jd(jd) gy = g[0] bstarty = EPOCH_GREGORIAN_YEAR if jd <= gregorian.to_jd(gy, 3, 20): x = 1 else: x = 0 # verify this next line... bys = gy - (bstarty + (((gregorian....
python
def from_jd(jd): '''Calculate Bahai date from Julian day''' jd = trunc(jd) + 0.5 g = gregorian.from_jd(jd) gy = g[0] bstarty = EPOCH_GREGORIAN_YEAR if jd <= gregorian.to_jd(gy, 3, 20): x = 1 else: x = 0 # verify this next line... bys = gy - (bstarty + (((gregorian....
[ "def", "from_jd", "(", "jd", ")", ":", "jd", "=", "trunc", "(", "jd", ")", "+", "0.5", "g", "=", "gregorian", ".", "from_jd", "(", "jd", ")", "gy", "=", "g", "[", "0", "]", "bstarty", "=", "EPOCH_GREGORIAN_YEAR", "if", "jd", "<=", "gregorian", "....
Calculate Bahai date from Julian day
[ "Calculate", "Bahai", "date", "from", "Julian", "day" ]
train
https://github.com/fitnr/convertdate/blob/e920f168a87f99183b0aa7290d6c3af222582d43/convertdate/bahai.py#L43-L69
fitnr/convertdate
convertdate/mayan.py
to_jd
def to_jd(baktun, katun, tun, uinal, kin): '''Determine Julian day from Mayan long count''' return EPOCH + (baktun * 144000) + (katun * 7200) + (tun * 360) + (uinal * 20) + kin
python
def to_jd(baktun, katun, tun, uinal, kin): '''Determine Julian day from Mayan long count''' return EPOCH + (baktun * 144000) + (katun * 7200) + (tun * 360) + (uinal * 20) + kin
[ "def", "to_jd", "(", "baktun", ",", "katun", ",", "tun", ",", "uinal", ",", "kin", ")", ":", "return", "EPOCH", "+", "(", "baktun", "*", "144000", ")", "+", "(", "katun", "*", "7200", ")", "+", "(", "tun", "*", "360", ")", "+", "(", "uinal", ...
Determine Julian day from Mayan long count
[ "Determine", "Julian", "day", "from", "Mayan", "long", "count" ]
train
https://github.com/fitnr/convertdate/blob/e920f168a87f99183b0aa7290d6c3af222582d43/convertdate/mayan.py#L36-L38
fitnr/convertdate
convertdate/mayan.py
from_jd
def from_jd(jd): '''Calculate Mayan long count from Julian day''' d = jd - EPOCH baktun = trunc(d / 144000) d = (d % 144000) katun = trunc(d / 7200) d = (d % 7200) tun = trunc(d / 360) d = (d % 360) uinal = trunc(d / 20) kin = int((d % 20)) return (baktun, katun, tun, uinal,...
python
def from_jd(jd): '''Calculate Mayan long count from Julian day''' d = jd - EPOCH baktun = trunc(d / 144000) d = (d % 144000) katun = trunc(d / 7200) d = (d % 7200) tun = trunc(d / 360) d = (d % 360) uinal = trunc(d / 20) kin = int((d % 20)) return (baktun, katun, tun, uinal,...
[ "def", "from_jd", "(", "jd", ")", ":", "d", "=", "jd", "-", "EPOCH", "baktun", "=", "trunc", "(", "d", "/", "144000", ")", "d", "=", "(", "d", "%", "144000", ")", "katun", "=", "trunc", "(", "d", "/", "7200", ")", "d", "=", "(", "d", "%", ...
Calculate Mayan long count from Julian day
[ "Calculate", "Mayan", "long", "count", "from", "Julian", "day" ]
train
https://github.com/fitnr/convertdate/blob/e920f168a87f99183b0aa7290d6c3af222582d43/convertdate/mayan.py#L41-L53
fitnr/convertdate
convertdate/mayan.py
to_haab
def to_haab(jd): '''Determine Mayan Haab "month" and day from Julian day''' # Number of days since the start of the long count lcount = trunc(jd) + 0.5 - EPOCH # Long Count begins 348 days after the start of the cycle day = (lcount + 348) % 365 count = day % 20 month = trunc(day / 20) ...
python
def to_haab(jd): '''Determine Mayan Haab "month" and day from Julian day''' # Number of days since the start of the long count lcount = trunc(jd) + 0.5 - EPOCH # Long Count begins 348 days after the start of the cycle day = (lcount + 348) % 365 count = day % 20 month = trunc(day / 20) ...
[ "def", "to_haab", "(", "jd", ")", ":", "# Number of days since the start of the long count", "lcount", "=", "trunc", "(", "jd", ")", "+", "0.5", "-", "EPOCH", "# Long Count begins 348 days after the start of the cycle", "day", "=", "(", "lcount", "+", "348", ")", "%...
Determine Mayan Haab "month" and day from Julian day
[ "Determine", "Mayan", "Haab", "month", "and", "day", "from", "Julian", "day" ]
train
https://github.com/fitnr/convertdate/blob/e920f168a87f99183b0aa7290d6c3af222582d43/convertdate/mayan.py#L66-L76
fitnr/convertdate
convertdate/mayan.py
to_tzolkin
def to_tzolkin(jd): '''Determine Mayan Tzolkin "month" and day from Julian day''' lcount = trunc(jd) + 0.5 - EPOCH day = amod(lcount + 4, 13) name = amod(lcount + 20, 20) return int(day), TZOLKIN_NAMES[int(name) - 1]
python
def to_tzolkin(jd): '''Determine Mayan Tzolkin "month" and day from Julian day''' lcount = trunc(jd) + 0.5 - EPOCH day = amod(lcount + 4, 13) name = amod(lcount + 20, 20) return int(day), TZOLKIN_NAMES[int(name) - 1]
[ "def", "to_tzolkin", "(", "jd", ")", ":", "lcount", "=", "trunc", "(", "jd", ")", "+", "0.5", "-", "EPOCH", "day", "=", "amod", "(", "lcount", "+", "4", ",", "13", ")", "name", "=", "amod", "(", "lcount", "+", "20", ",", "20", ")", "return", ...
Determine Mayan Tzolkin "month" and day from Julian day
[ "Determine", "Mayan", "Tzolkin", "month", "and", "day", "from", "Julian", "day" ]
train
https://github.com/fitnr/convertdate/blob/e920f168a87f99183b0aa7290d6c3af222582d43/convertdate/mayan.py#L79-L84
fitnr/convertdate
convertdate/mayan.py
_haab_count
def _haab_count(day, month): '''Return the count of the given haab in the cycle. e.g. 0 Pop == 1, 5 Wayeb' == 365''' if day < 0 or day > 19: raise IndexError("Invalid day number") try: i = HAAB_MONTHS.index(month) except ValueError: raise ValueError("'{0}' is not a valid Haab' m...
python
def _haab_count(day, month): '''Return the count of the given haab in the cycle. e.g. 0 Pop == 1, 5 Wayeb' == 365''' if day < 0 or day > 19: raise IndexError("Invalid day number") try: i = HAAB_MONTHS.index(month) except ValueError: raise ValueError("'{0}' is not a valid Haab' m...
[ "def", "_haab_count", "(", "day", ",", "month", ")", ":", "if", "day", "<", "0", "or", "day", ">", "19", ":", "raise", "IndexError", "(", "\"Invalid day number\"", ")", "try", ":", "i", "=", "HAAB_MONTHS", ".", "index", "(", "month", ")", "except", "...
Return the count of the given haab in the cycle. e.g. 0 Pop == 1, 5 Wayeb' == 365
[ "Return", "the", "count", "of", "the", "given", "haab", "in", "the", "cycle", ".", "e", ".", "g", ".", "0", "Pop", "==", "1", "5", "Wayeb", "==", "365" ]
train
https://github.com/fitnr/convertdate/blob/e920f168a87f99183b0aa7290d6c3af222582d43/convertdate/mayan.py#L111-L121
fitnr/convertdate
convertdate/mayan.py
tzolkin_generator
def tzolkin_generator(number=None, name=None): '''For a given tzolkin name/number combination, return a generator that gives cycle, starting with the input''' # By default, it will start at the beginning number = number or 13 name = name or "Ajaw" if number > 13: raise ValueError("Inva...
python
def tzolkin_generator(number=None, name=None): '''For a given tzolkin name/number combination, return a generator that gives cycle, starting with the input''' # By default, it will start at the beginning number = number or 13 name = name or "Ajaw" if number > 13: raise ValueError("Inva...
[ "def", "tzolkin_generator", "(", "number", "=", "None", ",", "name", "=", "None", ")", ":", "# By default, it will start at the beginning", "number", "=", "number", "or", "13", "name", "=", "name", "or", "\"Ajaw\"", "if", "number", ">", "13", ":", "raise", "...
For a given tzolkin name/number combination, return a generator that gives cycle, starting with the input
[ "For", "a", "given", "tzolkin", "name", "/", "number", "combination", "return", "a", "generator", "that", "gives", "cycle", "starting", "with", "the", "input" ]
train
https://github.com/fitnr/convertdate/blob/e920f168a87f99183b0aa7290d6c3af222582d43/convertdate/mayan.py#L145-L164
fitnr/convertdate
convertdate/mayan.py
longcount_generator
def longcount_generator(baktun, katun, tun, uinal, kin): '''Generate long counts, starting with input''' j = to_jd(baktun, katun, tun, uinal, kin) while True: yield from_jd(j) j = j + 1
python
def longcount_generator(baktun, katun, tun, uinal, kin): '''Generate long counts, starting with input''' j = to_jd(baktun, katun, tun, uinal, kin) while True: yield from_jd(j) j = j + 1
[ "def", "longcount_generator", "(", "baktun", ",", "katun", ",", "tun", ",", "uinal", ",", "kin", ")", ":", "j", "=", "to_jd", "(", "baktun", ",", "katun", ",", "tun", ",", "uinal", ",", "kin", ")", "while", "True", ":", "yield", "from_jd", "(", "j"...
Generate long counts, starting with input
[ "Generate", "long", "counts", "starting", "with", "input" ]
train
https://github.com/fitnr/convertdate/blob/e920f168a87f99183b0aa7290d6c3af222582d43/convertdate/mayan.py#L167-L173
fitnr/convertdate
convertdate/mayan.py
next_haab
def next_haab(month, jd): '''For a given haab month and a julian day count, find the next start of that month on or after the JDC''' if jd < EPOCH: raise IndexError("Input day is before Mayan epoch.") hday, hmonth = to_haab(jd) if hmonth == month: days = 1 - hday else: cou...
python
def next_haab(month, jd): '''For a given haab month and a julian day count, find the next start of that month on or after the JDC''' if jd < EPOCH: raise IndexError("Input day is before Mayan epoch.") hday, hmonth = to_haab(jd) if hmonth == month: days = 1 - hday else: cou...
[ "def", "next_haab", "(", "month", ",", "jd", ")", ":", "if", "jd", "<", "EPOCH", ":", "raise", "IndexError", "(", "\"Input day is before Mayan epoch.\"", ")", "hday", ",", "hmonth", "=", "to_haab", "(", "jd", ")", "if", "hmonth", "==", "month", ":", "day...
For a given haab month and a julian day count, find the next start of that month on or after the JDC
[ "For", "a", "given", "haab", "month", "and", "a", "julian", "day", "count", "find", "the", "next", "start", "of", "that", "month", "on", "or", "after", "the", "JDC" ]
train
https://github.com/fitnr/convertdate/blob/e920f168a87f99183b0aa7290d6c3af222582d43/convertdate/mayan.py#L176-L194
fitnr/convertdate
convertdate/mayan.py
next_tzolkin
def next_tzolkin(tzolkin, jd): '''For a given tzolk'in day, and a julian day count, find the next occurrance of that tzolk'in after the date''' if jd < EPOCH: raise IndexError("Input day is before Mayan epoch.") count1 = _tzolkin_count(*to_tzolkin(jd)) count2 = _tzolkin_count(*tzolkin) add...
python
def next_tzolkin(tzolkin, jd): '''For a given tzolk'in day, and a julian day count, find the next occurrance of that tzolk'in after the date''' if jd < EPOCH: raise IndexError("Input day is before Mayan epoch.") count1 = _tzolkin_count(*to_tzolkin(jd)) count2 = _tzolkin_count(*tzolkin) add...
[ "def", "next_tzolkin", "(", "tzolkin", ",", "jd", ")", ":", "if", "jd", "<", "EPOCH", ":", "raise", "IndexError", "(", "\"Input day is before Mayan epoch.\"", ")", "count1", "=", "_tzolkin_count", "(", "*", "to_tzolkin", "(", "jd", ")", ")", "count2", "=", ...
For a given tzolk'in day, and a julian day count, find the next occurrance of that tzolk'in after the date
[ "For", "a", "given", "tzolk", "in", "day", "and", "a", "julian", "day", "count", "find", "the", "next", "occurrance", "of", "that", "tzolk", "in", "after", "the", "date" ]
train
https://github.com/fitnr/convertdate/blob/e920f168a87f99183b0aa7290d6c3af222582d43/convertdate/mayan.py#L197-L206
fitnr/convertdate
convertdate/mayan.py
next_tzolkin_haab
def next_tzolkin_haab(tzolkin, haab, jd): '''For a given haab-tzolk'in combination, and a Julian day count, find the next occurrance of the combination after the date''' # get H & T of input jd, and their place in the 18,980 day cycle haabcount = _haab_count(*to_haab(jd)) haab_desired_count = _haab_coun...
python
def next_tzolkin_haab(tzolkin, haab, jd): '''For a given haab-tzolk'in combination, and a Julian day count, find the next occurrance of the combination after the date''' # get H & T of input jd, and their place in the 18,980 day cycle haabcount = _haab_count(*to_haab(jd)) haab_desired_count = _haab_coun...
[ "def", "next_tzolkin_haab", "(", "tzolkin", ",", "haab", ",", "jd", ")", ":", "# get H & T of input jd, and their place in the 18,980 day cycle", "haabcount", "=", "_haab_count", "(", "*", "to_haab", "(", "jd", ")", ")", "haab_desired_count", "=", "_haab_count", "(", ...
For a given haab-tzolk'in combination, and a Julian day count, find the next occurrance of the combination after the date
[ "For", "a", "given", "haab", "-", "tzolk", "in", "combination", "and", "a", "Julian", "day", "count", "find", "the", "next", "occurrance", "of", "the", "combination", "after", "the", "date" ]
train
https://github.com/fitnr/convertdate/blob/e920f168a87f99183b0aa7290d6c3af222582d43/convertdate/mayan.py#L209-L230
fitnr/convertdate
convertdate/mayan.py
haab_monthcalendar
def haab_monthcalendar(baktun=None, katun=None, tun=None, uinal=None, kin=None, jdc=None): '''For a given long count, return a calender of the current haab month, divided into tzolkin "weeks"''' if not jdc: jdc = to_jd(baktun, katun, tun, uinal, kin) haab_number, haab_month = to_haab(jdc) first...
python
def haab_monthcalendar(baktun=None, katun=None, tun=None, uinal=None, kin=None, jdc=None): '''For a given long count, return a calender of the current haab month, divided into tzolkin "weeks"''' if not jdc: jdc = to_jd(baktun, katun, tun, uinal, kin) haab_number, haab_month = to_haab(jdc) first...
[ "def", "haab_monthcalendar", "(", "baktun", "=", "None", ",", "katun", "=", "None", ",", "tun", "=", "None", ",", "uinal", "=", "None", ",", "kin", "=", "None", ",", "jdc", "=", "None", ")", ":", "if", "not", "jdc", ":", "jdc", "=", "to_jd", "(",...
For a given long count, return a calender of the current haab month, divided into tzolkin "weeks"
[ "For", "a", "given", "long", "count", "return", "a", "calender", "of", "the", "current", "haab", "month", "divided", "into", "tzolkin", "weeks" ]
train
https://github.com/fitnr/convertdate/blob/e920f168a87f99183b0aa7290d6c3af222582d43/convertdate/mayan.py#L241-L267
ianepperson/pyredminews
redmine/redmine_rest.py
Redmine_Item._update_data
def _update_data(self, data={}): '''Update the data in this object.''' # Store the changes to prevent this update from affecting it pending_changes = self._changes or {} try: del self._changes except: pass # Map custom fields into our custom fiel...
python
def _update_data(self, data={}): '''Update the data in this object.''' # Store the changes to prevent this update from affecting it pending_changes = self._changes or {} try: del self._changes except: pass # Map custom fields into our custom fiel...
[ "def", "_update_data", "(", "self", ",", "data", "=", "{", "}", ")", ":", "# Store the changes to prevent this update from affecting it", "pending_changes", "=", "self", ".", "_changes", "or", "{", "}", "try", ":", "del", "self", ".", "_changes", "except", ":", ...
Update the data in this object.
[ "Update", "the", "data", "in", "this", "object", "." ]
train
https://github.com/ianepperson/pyredminews/blob/b2b0581483632738a3acca3b4e093c181847b813/redmine/redmine_rest.py#L77-L109
ianepperson/pyredminews
redmine/redmine_rest.py
Redmine_Item._remap_tag_to_tag_id
def _remap_tag_to_tag_id(cls, tag, new_data): '''Remaps a given changed field from tag to tag_id.''' try: value = new_data[tag] except: # If tag wasn't changed, just return return tag_id = tag + '_id' try: # Remap the ID change to ...
python
def _remap_tag_to_tag_id(cls, tag, new_data): '''Remaps a given changed field from tag to tag_id.''' try: value = new_data[tag] except: # If tag wasn't changed, just return return tag_id = tag + '_id' try: # Remap the ID change to ...
[ "def", "_remap_tag_to_tag_id", "(", "cls", ",", "tag", ",", "new_data", ")", ":", "try", ":", "value", "=", "new_data", "[", "tag", "]", "except", ":", "# If tag wasn't changed, just return", "return", "tag_id", "=", "tag", "+", "'_id'", "try", ":", "# Remap...
Remaps a given changed field from tag to tag_id.
[ "Remaps", "a", "given", "changed", "field", "from", "tag", "to", "tag_id", "." ]
train
https://github.com/ianepperson/pyredminews/blob/b2b0581483632738a3acca3b4e093c181847b813/redmine/redmine_rest.py#L198-L219
ianepperson/pyredminews
redmine/redmine_rest.py
Redmine_Item._add_item_manager
def _add_item_manager(self, key, item_class, **paths): ''' Add an item manager to this object. ''' updated_paths = {} for path_type, path_value in paths.iteritems(): updated_paths[path_type] = path_value.format(**self.__dict__) manager = Redmine_Items_Manager...
python
def _add_item_manager(self, key, item_class, **paths): ''' Add an item manager to this object. ''' updated_paths = {} for path_type, path_value in paths.iteritems(): updated_paths[path_type] = path_value.format(**self.__dict__) manager = Redmine_Items_Manager...
[ "def", "_add_item_manager", "(", "self", ",", "key", ",", "item_class", ",", "*", "*", "paths", ")", ":", "updated_paths", "=", "{", "}", "for", "path_type", ",", "path_value", "in", "paths", ".", "iteritems", "(", ")", ":", "updated_paths", "[", "path_t...
Add an item manager to this object.
[ "Add", "an", "item", "manager", "to", "this", "object", "." ]
train
https://github.com/ianepperson/pyredminews/blob/b2b0581483632738a3acca3b4e093c181847b813/redmine/redmine_rest.py#L221-L231