body
stringlengths
26
98.2k
body_hash
int64
-9,222,864,604,528,158,000
9,221,803,474B
docstring
stringlengths
1
16.8k
path
stringlengths
5
230
name
stringlengths
1
96
repository_name
stringlengths
7
89
lang
stringclasses
1 value
body_without_docstring
stringlengths
20
98.2k
def copy(self): '\n Return a copy of the dictionary.\n\n Lazy keys are not evaluated in the original or copied dictionary.\n ' dic = self.__class__(self._dic.copy()) for (key, value_callable) in self._lazyload.items(): dic.set_lazy(key, value_callable) return dic
732,852,584,380,812,800
Return a copy of the dictionary. Lazy keys are not evaluated in the original or copied dictionary.
pycwr/configure/pyart_lazydict.py
copy
1271756664/study
python
def copy(self): '\n Return a copy of the dictionary.\n\n Lazy keys are not evaluated in the original or copied dictionary.\n ' dic = self.__class__(self._dic.copy()) for (key, value_callable) in self._lazyload.items(): dic.set_lazy(key, value_callable) return dic
def set_lazy(self, key, value_callable): ' Set a lazy key to load from a callable object. ' if (key in self._dic): del self._dic[key] self._lazyload[key] = value_callable
-5,685,701,642,325,754,000
Set a lazy key to load from a callable object.
pycwr/configure/pyart_lazydict.py
set_lazy
1271756664/study
python
def set_lazy(self, key, value_callable): ' ' if (key in self._dic): del self._dic[key] self._lazyload[key] = value_callable
def runCase(case_name): '\n\t\n\t:param case_name:\n\t:return: 注意格式 xxx(case_name)()\n\t' return api_route.get(case_name)()
4,925,550,948,916,173,000
:param case_name: :return: 注意格式 xxx(case_name)()
apis/router.py
runCase
DerWalundDieKatze/Yumekui
python
def runCase(case_name): '\n\t\n\t:param case_name:\n\t:return: 注意格式 xxx(case_name)()\n\t' return api_route.get(case_name)()
def setTestStepResult(self, step_number, result: ResultType, comment=None): '"\n Set the result of a test step\n\n :param step_number: Step number\n :param result: The result fo the test step\n :param comment: An optional comment\n ' if (self.testStepResults is None): ...
5,744,355,366,811,355,000
" Set the result of a test step :param step_number: Step number :param result: The result fo the test step :param comment: An optional comment
polarion/record.py
setTestStepResult
jesper-raemaekers/python-polarion
python
def setTestStepResult(self, step_number, result: ResultType, comment=None): '"\n Set the result of a test step\n\n :param step_number: Step number\n :param result: The result fo the test step\n :param comment: An optional comment\n ' if (self.testStepResults is None): ...
def getResult(self): '\n Get the test result of this record\n\n :return: The test case result\n :rtype: ResultType\n ' if (self.result is not None): return self.ResultType(self.result.id) return self.ResultType.No
-5,206,828,231,075,465,000
Get the test result of this record :return: The test case result :rtype: ResultType
polarion/record.py
getResult
jesper-raemaekers/python-polarion
python
def getResult(self): '\n Get the test result of this record\n\n :return: The test case result\n :rtype: ResultType\n ' if (self.result is not None): return self.ResultType(self.result.id) return self.ResultType.No
def getComment(self): '\n Get a comment if available. The comment may contain HTML if edited in Polarion!\n\n :return: Get the comment, may contain HTML\n :rtype: string\n ' if (self.comment is not None): return self.comment.content return None
7,513,077,603,057,175,000
Get a comment if available. The comment may contain HTML if edited in Polarion! :return: Get the comment, may contain HTML :rtype: string
polarion/record.py
getComment
jesper-raemaekers/python-polarion
python
def getComment(self): '\n Get a comment if available. The comment may contain HTML if edited in Polarion!\n\n :return: Get the comment, may contain HTML\n :rtype: string\n ' if (self.comment is not None): return self.comment.content return None
@property def testcase_id(self): '\n The test case name including prefix\n ' return self._testcase_name
7,761,441,519,266,238,000
The test case name including prefix
polarion/record.py
testcase_id
jesper-raemaekers/python-polarion
python
@property def testcase_id(self): '\n \n ' return self._testcase_name
def getTestCaseName(self): '\n Get the test case name including prefix\n\n :return: The name\n :rtype: string\n ' return self._testcase_name
3,886,200,417,914,788,000
Get the test case name including prefix :return: The name :rtype: string
polarion/record.py
getTestCaseName
jesper-raemaekers/python-polarion
python
def getTestCaseName(self): '\n Get the test case name including prefix\n\n :return: The name\n :rtype: string\n ' return self._testcase_name
def setComment(self, comment): '\n tries to get the severity enum of this workitem type\n When it fails to get it, the list will be empty\n\n :param comment: Comment string, may contain HTML\n ' self.comment = self._polarion.TextType(content=comment, type='text/html', contentLossy=Fa...
-6,355,790,804,026,165,000
tries to get the severity enum of this workitem type When it fails to get it, the list will be empty :param comment: Comment string, may contain HTML
polarion/record.py
setComment
jesper-raemaekers/python-polarion
python
def setComment(self, comment): '\n tries to get the severity enum of this workitem type\n When it fails to get it, the list will be empty\n\n :param comment: Comment string, may contain HTML\n ' self.comment = self._polarion.TextType(content=comment, type='text/html', contentLossy=Fa...
def setResult(self, result: ResultType=ResultType.FAILED, comment=None): '\n Set the result of this record and save it.\n\n :param result: The result of this record\n :param comment: Comment string, may contain HTML\n ' if (comment is not None): self.setComment(comment) i...
-2,210,465,079,516,604,400
Set the result of this record and save it. :param result: The result of this record :param comment: Comment string, may contain HTML
polarion/record.py
setResult
jesper-raemaekers/python-polarion
python
def setResult(self, result: ResultType=ResultType.FAILED, comment=None): '\n Set the result of this record and save it.\n\n :param result: The result of this record\n :param comment: Comment string, may contain HTML\n ' if (comment is not None): self.setComment(comment) i...
def getExecutingUser(self): '\n Gets the executing user if the test was executed\n\n :return: The user\n :rtype: User/None\n ' if (self.executedByURI is not None): return createFromUri(self._polarion, None, self.executedByURI) return None
-5,531,351,703,660,311,000
Gets the executing user if the test was executed :return: The user :rtype: User/None
polarion/record.py
getExecutingUser
jesper-raemaekers/python-polarion
python
def getExecutingUser(self): '\n Gets the executing user if the test was executed\n\n :return: The user\n :rtype: User/None\n ' if (self.executedByURI is not None): return createFromUri(self._polarion, None, self.executedByURI) return None
def hasAttachment(self): '\n Checks if the Record has attachments\n\n :return: True/False\n :rtype: boolean\n ' if (self.attachments is not None): return True return False
7,877,481,670,489,581,000
Checks if the Record has attachments :return: True/False :rtype: boolean
polarion/record.py
hasAttachment
jesper-raemaekers/python-polarion
python
def hasAttachment(self): '\n Checks if the Record has attachments\n\n :return: True/False\n :rtype: boolean\n ' if (self.attachments is not None): return True return False
def getAttachment(self, file_name): '\n Get the attachment data\n\n :param file_name: The attachment file name\n :return: list of bytes\n :rtype: bytes[]\n ' url = None for attachment in self.attachments.TestRunAttachment: if (attachment.fileName == file_name): ...
8,589,317,731,755,186,000
Get the attachment data :param file_name: The attachment file name :return: list of bytes :rtype: bytes[]
polarion/record.py
getAttachment
jesper-raemaekers/python-polarion
python
def getAttachment(self, file_name): '\n Get the attachment data\n\n :param file_name: The attachment file name\n :return: list of bytes\n :rtype: bytes[]\n ' url = None for attachment in self.attachments.TestRunAttachment: if (attachment.fileName == file_name): ...
def saveAttachmentAsFile(self, file_name, file_path): '\n Save an attachment to file.\n\n :param file_name: The attachment file name\n :param file_path: File where to save the attachment\n ' bin = self.getAttachment(file_name) with open(file_path, 'wb') as file: file.writ...
6,366,685,034,168,646,000
Save an attachment to file. :param file_name: The attachment file name :param file_path: File where to save the attachment
polarion/record.py
saveAttachmentAsFile
jesper-raemaekers/python-polarion
python
def saveAttachmentAsFile(self, file_name, file_path): '\n Save an attachment to file.\n\n :param file_name: The attachment file name\n :param file_path: File where to save the attachment\n ' bin = self.getAttachment(file_name) with open(file_path, 'wb') as file: file.writ...
def deleteAttachment(self, file_name): '\n Delete an attachment.\n\n :param file_name: The attachment file name\n ' service = self._polarion.getService('TestManagement') service.deleteAttachmentFromTestRecord(self._test_run.uri, self._index, file_name) self._reloadFromPolarion()
-7,794,299,231,687,753,000
Delete an attachment. :param file_name: The attachment file name
polarion/record.py
deleteAttachment
jesper-raemaekers/python-polarion
python
def deleteAttachment(self, file_name): '\n Delete an attachment.\n\n :param file_name: The attachment file name\n ' service = self._polarion.getService('TestManagement') service.deleteAttachmentFromTestRecord(self._test_run.uri, self._index, file_name) self._reloadFromPolarion()
def addAttachment(self, file_path, title): '\n Upload an attachment\n\n :param file_path: Source file to upload\n :param title: The title of the attachment\n ' service = self._polarion.getService('TestManagement') file_name = os.path.split(file_path)[1] with open(file_path, '...
-3,232,457,304,182,577,000
Upload an attachment :param file_path: Source file to upload :param title: The title of the attachment
polarion/record.py
addAttachment
jesper-raemaekers/python-polarion
python
def addAttachment(self, file_path, title): '\n Upload an attachment\n\n :param file_path: Source file to upload\n :param title: The title of the attachment\n ' service = self._polarion.getService('TestManagement') file_name = os.path.split(file_path)[1] with open(file_path, '...
def testStepHasAttachment(self, step_index): '\n Checks if the a test step has attachments\n\n :param step_index: The test step index\n :return: True/False\n :rtype: boolean\n ' if (self.testStepResults is None): return False if (self.testStepResults.TestStepResult...
1,176,041,346,641,023,000
Checks if the a test step has attachments :param step_index: The test step index :return: True/False :rtype: boolean
polarion/record.py
testStepHasAttachment
jesper-raemaekers/python-polarion
python
def testStepHasAttachment(self, step_index): '\n Checks if the a test step has attachments\n\n :param step_index: The test step index\n :return: True/False\n :rtype: boolean\n ' if (self.testStepResults is None): return False if (self.testStepResults.TestStepResult...
def getAttachmentFromTestStep(self, step_index, file_name): '\n Get the attachment data from a test step\n\n :param step_index: The test step index\n :param file_name: The attachment file name\n :return: list of bytes\n :rtype: bytes[]\n ' url = None for attachment ...
4,546,584,508,704,895,500
Get the attachment data from a test step :param step_index: The test step index :param file_name: The attachment file name :return: list of bytes :rtype: bytes[]
polarion/record.py
getAttachmentFromTestStep
jesper-raemaekers/python-polarion
python
def getAttachmentFromTestStep(self, step_index, file_name): '\n Get the attachment data from a test step\n\n :param step_index: The test step index\n :param file_name: The attachment file name\n :return: list of bytes\n :rtype: bytes[]\n ' url = None for attachment ...
def saveAttachmentFromTestStepAsFile(self, step_index, file_name, file_path): '\n Save an attachment to file from a test step\n\n :param step_index: The test step index\n :param file_name: The attachment file name\n :param file_path: File where to save the attachment\n ' bin =...
-6,703,495,425,838,276,000
Save an attachment to file from a test step :param step_index: The test step index :param file_name: The attachment file name :param file_path: File where to save the attachment
polarion/record.py
saveAttachmentFromTestStepAsFile
jesper-raemaekers/python-polarion
python
def saveAttachmentFromTestStepAsFile(self, step_index, file_name, file_path): '\n Save an attachment to file from a test step\n\n :param step_index: The test step index\n :param file_name: The attachment file name\n :param file_path: File where to save the attachment\n ' bin =...
def deleteAttachmentFromTestStep(self, step_index, file_name): '\n Delete an attachment from a test step\n\n :param step_index: The test step index\n :param file_name: The attachment file name\n ' service = self._polarion.getService('TestManagement') service.deleteAttachmentFromT...
-7,120,527,479,930,367,000
Delete an attachment from a test step :param step_index: The test step index :param file_name: The attachment file name
polarion/record.py
deleteAttachmentFromTestStep
jesper-raemaekers/python-polarion
python
def deleteAttachmentFromTestStep(self, step_index, file_name): '\n Delete an attachment from a test step\n\n :param step_index: The test step index\n :param file_name: The attachment file name\n ' service = self._polarion.getService('TestManagement') service.deleteAttachmentFromT...
def addAttachmentToTestStep(self, step_index, file_path, title): '\n Upload an attachment to a test step\n\n :param step_index: The test step index\n :param file_path: Source file to upload\n :param title: The title of the attachment\n ' service = self._polarion.getService('Te...
-6,414,064,469,549,954,000
Upload an attachment to a test step :param step_index: The test step index :param file_path: Source file to upload :param title: The title of the attachment
polarion/record.py
addAttachmentToTestStep
jesper-raemaekers/python-polarion
python
def addAttachmentToTestStep(self, step_index, file_path, title): '\n Upload an attachment to a test step\n\n :param step_index: The test step index\n :param file_path: Source file to upload\n :param title: The title of the attachment\n ' service = self._polarion.getService('Te...
def save(self): '\n Saves the current test record\n ' new_item = {} for (attr, value) in self.__dict__.items(): if (not attr.startswith('_')): new_item[attr] = value service = self._polarion.getService('TestManagement') service.executeTest(self._test_run.uri, new_it...
1,585,981,437,865,151,000
Saves the current test record
polarion/record.py
save
jesper-raemaekers/python-polarion
python
def save(self): '\n \n ' new_item = {} for (attr, value) in self.__dict__.items(): if (not attr.startswith('_')): new_item[attr] = value service = self._polarion.getService('TestManagement') service.executeTest(self._test_run.uri, new_item) self._reloadFromPolar...
def _removeHandlersFromLogger(logger, handlerTypes=None): "\n Remove all handlers or handlers of a specified type from a logger.\n\n @param logger: The logger who's handlers should be processed.\n @type logger: A logging.Logger object\n @param handlerTypes: A type of handler or list/tuple of types of ha...
-2,376,610,905,695,259,000
Remove all handlers or handlers of a specified type from a logger. @param logger: The logger who's handlers should be processed. @type logger: A logging.Logger object @param handlerTypes: A type of handler or list/tuple of types of handlers that should be removed from the logger. If I{None}, all handlers are r...
src/shotgunEventDaemon.py
_removeHandlersFromLogger
darkvertex/shotgunEvents
python
def _removeHandlersFromLogger(logger, handlerTypes=None): "\n Remove all handlers or handlers of a specified type from a logger.\n\n @param logger: The logger who's handlers should be processed.\n @type logger: A logging.Logger object\n @param handlerTypes: A type of handler or list/tuple of types of ha...
def _addMailHandlerToLogger(logger, smtpServer, fromAddr, toAddrs, emailSubject, username=None, password=None, secure=None): '\n Configure a logger with a handler that sends emails to specified\n addresses.\n\n The format of the email is defined by L{LogFactory.EMAIL_FORMAT_STRING}.\n\n @note: Any SMTPH...
-307,098,511,064,583,040
Configure a logger with a handler that sends emails to specified addresses. The format of the email is defined by L{LogFactory.EMAIL_FORMAT_STRING}. @note: Any SMTPHandler already connected to the logger will be removed. @param logger: The logger to configure @type logger: A logging.Logger instance @param toAddrs: T...
src/shotgunEventDaemon.py
_addMailHandlerToLogger
darkvertex/shotgunEvents
python
def _addMailHandlerToLogger(logger, smtpServer, fromAddr, toAddrs, emailSubject, username=None, password=None, secure=None): '\n Configure a logger with a handler that sends emails to specified\n addresses.\n\n The format of the email is defined by L{LogFactory.EMAIL_FORMAT_STRING}.\n\n @note: Any SMTPH...
def _getConfigPath(): '\n Get the path of the shotgunEventDaemon configuration file.\n ' paths = ['/etc', os.path.dirname(__file__)] scriptPath = sys.argv[0] if ((scriptPath != '') and (scriptPath != '-c')): scriptPath = os.path.abspath(scriptPath) scriptPath = os.path.realpath(scr...
8,421,777,688,873,840,000
Get the path of the shotgunEventDaemon configuration file.
src/shotgunEventDaemon.py
_getConfigPath
darkvertex/shotgunEvents
python
def _getConfigPath(): '\n \n ' paths = ['/etc', os.path.dirname(__file__)] scriptPath = sys.argv[0] if ((scriptPath != ) and (scriptPath != '-c')): scriptPath = os.path.abspath(scriptPath) scriptPath = os.path.realpath(scriptPath) paths[:0] = [os.path.dirname(scriptPath)] ...
def start(self): '\n Start the processing of events.\n\n The last processed id is loaded up from persistent storage on disk and\n the main loop is started.\n ' socket.setdefaulttimeout(60) self.log.info(('Using SG Python API version %s' % sg.__version__)) try: for col...
-1,260,733,432,213,487,900
Start the processing of events. The last processed id is loaded up from persistent storage on disk and the main loop is started.
src/shotgunEventDaemon.py
start
darkvertex/shotgunEvents
python
def start(self): '\n Start the processing of events.\n\n The last processed id is loaded up from persistent storage on disk and\n the main loop is started.\n ' socket.setdefaulttimeout(60) self.log.info(('Using SG Python API version %s' % sg.__version__)) try: for col...
def _loadEventIdData(self): "\n Load the last processed event id from the disk\n\n If no event has ever been processed or if the eventIdFile has been\n deleted from disk, no id will be recoverable. In this case, we will try\n contacting Shotgun to get the latest event's id and we'll star...
-4,428,605,945,949,538,300
Load the last processed event id from the disk If no event has ever been processed or if the eventIdFile has been deleted from disk, no id will be recoverable. In this case, we will try contacting Shotgun to get the latest event's id and we'll start processing from there.
src/shotgunEventDaemon.py
_loadEventIdData
darkvertex/shotgunEvents
python
def _loadEventIdData(self): "\n Load the last processed event id from the disk\n\n If no event has ever been processed or if the eventIdFile has been\n deleted from disk, no id will be recoverable. In this case, we will try\n contacting Shotgun to get the latest event's id and we'll star...
def _mainLoop(self): '\n Run the event processing loop.\n\n General behavior:\n - Load plugins from disk - see L{load} method.\n - Get new events from Shotgun\n - Loop through events\n - Loop through each plugin\n - Loop through each callback\n - Send the call...
-6,763,117,773,073,454,000
Run the event processing loop. General behavior: - Load plugins from disk - see L{load} method. - Get new events from Shotgun - Loop through events - Loop through each plugin - Loop through each callback - Send the callback an event - Once all callbacks are done in all plugins, save the eventId - Go to the next event ...
src/shotgunEventDaemon.py
_mainLoop
darkvertex/shotgunEvents
python
def _mainLoop(self): '\n Run the event processing loop.\n\n General behavior:\n - Load plugins from disk - see L{load} method.\n - Get new events from Shotgun\n - Loop through events\n - Loop through each plugin\n - Loop through each callback\n - Send the call...
def _getNewEvents(self): '\n Fetch new events from Shotgun.\n\n @return: Recent events that need to be processed by the engine.\n @rtype: I{list} of Shotgun event dictionaries.\n ' nextEventId = None for newId in [coll.getNextUnprocessedEventId() for coll in self._pluginCollectio...
-7,859,600,377,278,774,000
Fetch new events from Shotgun. @return: Recent events that need to be processed by the engine. @rtype: I{list} of Shotgun event dictionaries.
src/shotgunEventDaemon.py
_getNewEvents
darkvertex/shotgunEvents
python
def _getNewEvents(self): '\n Fetch new events from Shotgun.\n\n @return: Recent events that need to be processed by the engine.\n @rtype: I{list} of Shotgun event dictionaries.\n ' nextEventId = None for newId in [coll.getNextUnprocessedEventId() for coll in self._pluginCollectio...
def _saveEventIdData(self): '\n Save an event Id to persistant storage.\n\n Next time the engine is started it will try to read the event id from\n this location to know at which event it should start processing.\n ' eventIdFile = self.config.getEventIdFile() if (eventIdFile is n...
-5,762,895,681,315,035,000
Save an event Id to persistant storage. Next time the engine is started it will try to read the event id from this location to know at which event it should start processing.
src/shotgunEventDaemon.py
_saveEventIdData
darkvertex/shotgunEvents
python
def _saveEventIdData(self): '\n Save an event Id to persistant storage.\n\n Next time the engine is started it will try to read the event id from\n this location to know at which event it should start processing.\n ' eventIdFile = self.config.getEventIdFile() if (eventIdFile is n...
def load(self): '\n Load plugins from disk.\n\n General behavior:\n - Loop on all paths.\n - Find all valid .py plugin files.\n - Loop on all plugin files.\n - For any new plugins, load them, otherwise, refresh them.\n ' newPlugins = {} for basename in os.lis...
1,639,488,018,755,254,000
Load plugins from disk. General behavior: - Loop on all paths. - Find all valid .py plugin files. - Loop on all plugin files. - For any new plugins, load them, otherwise, refresh them.
src/shotgunEventDaemon.py
load
darkvertex/shotgunEvents
python
def load(self): '\n Load plugins from disk.\n\n General behavior:\n - Loop on all paths.\n - Find all valid .py plugin files.\n - Loop on all plugin files.\n - For any new plugins, load them, otherwise, refresh them.\n ' newPlugins = {} for basename in os.lis...
def __init__(self, engine, path): '\n @param engine: The engine that instanciated this plugin.\n @type engine: L{Engine}\n @param path: The path of the plugin file to load.\n @type path: I{str}\n\n @raise ValueError: If the path to the plugin is not a valid file.\n ' se...
-8,360,313,440,858,122,000
@param engine: The engine that instanciated this plugin. @type engine: L{Engine} @param path: The path of the plugin file to load. @type path: I{str} @raise ValueError: If the path to the plugin is not a valid file.
src/shotgunEventDaemon.py
__init__
darkvertex/shotgunEvents
python
def __init__(self, engine, path): '\n @param engine: The engine that instanciated this plugin.\n @type engine: L{Engine}\n @param path: The path of the plugin file to load.\n @type path: I{str}\n\n @raise ValueError: If the path to the plugin is not a valid file.\n ' se...
def isActive(self): "\n Is the current plugin active. Should it's callbacks be run?\n\n @return: True if this plugin's callbacks should be run, False otherwise.\n @rtype: I{bool}\n " return self._active
7,688,247,206,678,596,000
Is the current plugin active. Should it's callbacks be run? @return: True if this plugin's callbacks should be run, False otherwise. @rtype: I{bool}
src/shotgunEventDaemon.py
isActive
darkvertex/shotgunEvents
python
def isActive(self): "\n Is the current plugin active. Should it's callbacks be run?\n\n @return: True if this plugin's callbacks should be run, False otherwise.\n @rtype: I{bool}\n " return self._active
def setEmails(self, *emails): "\n Set the email addresses to whom this plugin should send errors.\n\n @param emails: See L{LogFactory.getLogger}'s emails argument for info.\n @type emails: A I{list}/I{tuple} of email addresses or I{bool}.\n " self._engine.setEmailsOnLogger(self.logge...
-3,236,883,789,366,445,600
Set the email addresses to whom this plugin should send errors. @param emails: See L{LogFactory.getLogger}'s emails argument for info. @type emails: A I{list}/I{tuple} of email addresses or I{bool}.
src/shotgunEventDaemon.py
setEmails
darkvertex/shotgunEvents
python
def setEmails(self, *emails): "\n Set the email addresses to whom this plugin should send errors.\n\n @param emails: See L{LogFactory.getLogger}'s emails argument for info.\n @type emails: A I{list}/I{tuple} of email addresses or I{bool}.\n " self._engine.setEmailsOnLogger(self.logge...
def load(self): '\n Load/Reload the plugin and all its callbacks.\n\n If a plugin has never been loaded it will be loaded normally. If the\n plugin has been loaded before it will be reloaded only if the file has\n been modified on disk. In this event callbacks will all be cleared and\n ...
-8,549,978,434,882,615,000
Load/Reload the plugin and all its callbacks. If a plugin has never been loaded it will be loaded normally. If the plugin has been loaded before it will be reloaded only if the file has been modified on disk. In this event callbacks will all be cleared and reloaded. General behavior: - Try to load the source of the p...
src/shotgunEventDaemon.py
load
darkvertex/shotgunEvents
python
def load(self): '\n Load/Reload the plugin and all its callbacks.\n\n If a plugin has never been loaded it will be loaded normally. If the\n plugin has been loaded before it will be reloaded only if the file has\n been modified on disk. In this event callbacks will all be cleared and\n ...
def registerCallback(self, sgScriptName, sgScriptKey, callback, matchEvents=None, args=None, stopOnError=True): '\n Register a callback in the plugin.\n ' global sg sgConnection = sg.Shotgun(self._engine.config.getShotgunURL(), sgScriptName, sgScriptKey, http_proxy=self._engine.config.getEngin...
6,433,666,557,434,882,000
Register a callback in the plugin.
src/shotgunEventDaemon.py
registerCallback
darkvertex/shotgunEvents
python
def registerCallback(self, sgScriptName, sgScriptKey, callback, matchEvents=None, args=None, stopOnError=True): '\n \n ' global sg sgConnection = sg.Shotgun(self._engine.config.getShotgunURL(), sgScriptName, sgScriptKey, http_proxy=self._engine.config.getEngineProxyServer()) self._callback...
def __iter__(self): '\n A plugin is iterable and will iterate over all its L{Callback} objects.\n ' return self._callbacks.__iter__()
-6,127,632,201,364,838,000
A plugin is iterable and will iterate over all its L{Callback} objects.
src/shotgunEventDaemon.py
__iter__
darkvertex/shotgunEvents
python
def __iter__(self): '\n \n ' return self._callbacks.__iter__()
def __str__(self): '\n Provide the name of the plugin when it is cast as string.\n\n @return: The name of the plugin.\n @rtype: I{str}\n ' return self.getName()
-5,831,211,034,429,896,000
Provide the name of the plugin when it is cast as string. @return: The name of the plugin. @rtype: I{str}
src/shotgunEventDaemon.py
__str__
darkvertex/shotgunEvents
python
def __str__(self): '\n Provide the name of the plugin when it is cast as string.\n\n @return: The name of the plugin.\n @rtype: I{str}\n ' return self.getName()
def __init__(self, plugin): '\n Wrap a plugin so it can be passed to a user.\n ' self._plugin = plugin self._allowed = ['logger', 'setEmails', 'registerCallback']
8,840,827,954,657,200,000
Wrap a plugin so it can be passed to a user.
src/shotgunEventDaemon.py
__init__
darkvertex/shotgunEvents
python
def __init__(self, plugin): '\n \n ' self._plugin = plugin self._allowed = ['logger', 'setEmails', 'registerCallback']
def getLogger(self): '\n Get the logger for this plugin.\n\n @return: The logger configured for this plugin.\n @rtype: L{logging.Logger}\n ' return self.logger
1,521,799,279,905,892,600
Get the logger for this plugin. @return: The logger configured for this plugin. @rtype: L{logging.Logger}
src/shotgunEventDaemon.py
getLogger
darkvertex/shotgunEvents
python
def getLogger(self): '\n Get the logger for this plugin.\n\n @return: The logger configured for this plugin.\n @rtype: L{logging.Logger}\n ' return self.logger
def __init__(self, callback, plugin, engine, shotgun, matchEvents=None, args=None, stopOnError=True): '\n @param callback: The function to run when a Shotgun event occurs.\n @type callback: A function object.\n @param engine: The engine that will dispatch to this callback.\n @type engine...
-8,151,614,094,003,039,000
@param callback: The function to run when a Shotgun event occurs. @type callback: A function object. @param engine: The engine that will dispatch to this callback. @type engine: L{Engine}. @param shotgun: The Shotgun instance that will be used to communicate with your Shotgun server. @type shotgun: L{sg.Shotgun} @p...
src/shotgunEventDaemon.py
__init__
darkvertex/shotgunEvents
python
def __init__(self, callback, plugin, engine, shotgun, matchEvents=None, args=None, stopOnError=True): '\n @param callback: The function to run when a Shotgun event occurs.\n @type callback: A function object.\n @param engine: The engine that will dispatch to this callback.\n @type engine...
def process(self, event): '\n Process an event with the callback object supplied on initialization.\n\n If an error occurs, it will be logged appropriately and the callback\n will be deactivated.\n\n @param event: The Shotgun event to process.\n @type event: I{dict}\n ' ...
4,690,364,775,588,296,000
Process an event with the callback object supplied on initialization. If an error occurs, it will be logged appropriately and the callback will be deactivated. @param event: The Shotgun event to process. @type event: I{dict}
src/shotgunEventDaemon.py
process
darkvertex/shotgunEvents
python
def process(self, event): '\n Process an event with the callback object supplied on initialization.\n\n If an error occurs, it will be logged appropriately and the callback\n will be deactivated.\n\n @param event: The Shotgun event to process.\n @type event: I{dict}\n ' ...
def isActive(self): '\n Check if this callback is active, i.e. if events should be passed to it\n for processing.\n\n @return: True if this callback should process events, False otherwise.\n @rtype: I{bool}\n ' return self._active
-6,180,805,449,513,379,000
Check if this callback is active, i.e. if events should be passed to it for processing. @return: True if this callback should process events, False otherwise. @rtype: I{bool}
src/shotgunEventDaemon.py
isActive
darkvertex/shotgunEvents
python
def isActive(self): '\n Check if this callback is active, i.e. if events should be passed to it\n for processing.\n\n @return: True if this callback should process events, False otherwise.\n @rtype: I{bool}\n ' return self._active
def __str__(self): '\n The name of the callback.\n\n @return: The name of the callback\n @rtype: I{str}\n ' return self._name
5,708,799,058,980,545,000
The name of the callback. @return: The name of the callback @rtype: I{str}
src/shotgunEventDaemon.py
__str__
darkvertex/shotgunEvents
python
def __str__(self): '\n The name of the callback.\n\n @return: The name of the callback\n @rtype: I{str}\n ' return self._name
def emit(self, record): '\n Emit a record.\n\n Format the record and send it to the specified addressees.\n ' try: import smtplib from email.utils import formatdate port = self.mailport if (not port): port = smtplib.SMTP_PORT smtp = smtpli...
6,078,376,758,493,052,000
Emit a record. Format the record and send it to the specified addressees.
src/shotgunEventDaemon.py
emit
darkvertex/shotgunEvents
python
def emit(self, record): '\n Emit a record.\n\n Format the record and send it to the specified addressees.\n ' try: import smtplib from email.utils import formatdate port = self.mailport if (not port): port = smtplib.SMTP_PORT smtp = smtpli...
def _run(self): "\n Start the engine's main loop\n " self._engine.start()
-5,240,224,163,209,701,000
Start the engine's main loop
src/shotgunEventDaemon.py
_run
darkvertex/shotgunEvents
python
def _run(self): "\n \n " self._engine.start()
def SvcStop(self): '\n Stop the Windows service.\n ' self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) win32event.SetEvent(self.hWaitStop) self._engine.stop()
-4,262,989,655,578,718,700
Stop the Windows service.
src/shotgunEventDaemon.py
SvcStop
darkvertex/shotgunEvents
python
def SvcStop(self): '\n \n ' self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) win32event.SetEvent(self.hWaitStop) self._engine.stop()
def SvcDoRun(self): '\n Start the Windows service.\n ' servicemanager.LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE, servicemanager.PYS_SERVICE_STARTED, (self._svc_name_, '')) self.main()
1,857,521,332,038,923,800
Start the Windows service.
src/shotgunEventDaemon.py
SvcDoRun
darkvertex/shotgunEvents
python
def SvcDoRun(self): '\n \n ' servicemanager.LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE, servicemanager.PYS_SERVICE_STARTED, (self._svc_name_, )) self.main()
def main(self): '\n Primary Windows entry point\n ' self._engine.start()
-1,633,724,170,099,434,200
Primary Windows entry point
src/shotgunEventDaemon.py
main
darkvertex/shotgunEvents
python
def main(self): '\n \n ' self._engine.start()
def prime_check(number: int) -> bool: '\n Determines whether a given number is prime or not\n\n >>> prime_check(2)\n True\n >>> prime_check(15)\n False\n >>> prime_check(29)\n True\n ' if (((number % 2) == 0) and (number > 2)): return False return all(((number % i) for i in r...
-31,438,179,935,647,390
Determines whether a given number is prime or not >>> prime_check(2) True >>> prime_check(15) False >>> prime_check(29) True
project_euler/problem_007/sol3.py
prime_check
04n0/TheAlgorithms-Python
python
def prime_check(number: int) -> bool: '\n Determines whether a given number is prime or not\n\n >>> prime_check(2)\n True\n >>> prime_check(15)\n False\n >>> prime_check(29)\n True\n ' if (((number % 2) == 0) and (number > 2)): return False return all(((number % i) for i in r...
def prime_generator(): '\n Generate a sequence of prime numbers\n ' num = 2 while True: if prime_check(num): (yield num) num += 1
7,299,812,059,533,551,000
Generate a sequence of prime numbers
project_euler/problem_007/sol3.py
prime_generator
04n0/TheAlgorithms-Python
python
def prime_generator(): '\n \n ' num = 2 while True: if prime_check(num): (yield num) num += 1
def solution(nth: int=10001) -> int: '\n Returns the n-th prime number.\n\n >>> solution(6)\n 13\n >>> solution(1)\n 2\n >>> solution(3)\n 5\n >>> solution(20)\n 71\n >>> solution(50)\n 229\n >>> solution(100)\n 541\n ' return next(itertools.islice(prime_generator(), (n...
-1,264,646,381,383,279,900
Returns the n-th prime number. >>> solution(6) 13 >>> solution(1) 2 >>> solution(3) 5 >>> solution(20) 71 >>> solution(50) 229 >>> solution(100) 541
project_euler/problem_007/sol3.py
solution
04n0/TheAlgorithms-Python
python
def solution(nth: int=10001) -> int: '\n Returns the n-th prime number.\n\n >>> solution(6)\n 13\n >>> solution(1)\n 2\n >>> solution(3)\n 5\n >>> solution(20)\n 71\n >>> solution(50)\n 229\n >>> solution(100)\n 541\n ' return next(itertools.islice(prime_generator(), (n...
async def extract_object_urls(self, soup) -> List[str]: '\n Extract apartment object urls\n ' items = soup.find_all('a') urls: List[str] = [] for item in items: if ('woning/rotterdam-' in item['href']): urls.append(item['href']) return list(set(urls))
2,149,174,860,420,259,000
Extract apartment object urls
server/app/scrapers/maarten.py
extract_object_urls
damienallen/makelaardij-notify
python
async def extract_object_urls(self, soup) -> List[str]: '\n \n ' items = soup.find_all('a') urls: List[str] = [] for item in items: if ('woning/rotterdam-' in item['href']): urls.append(item['href']) return list(set(urls))
async def get_page_url(self, page_num: int) -> str: '\n Format page url\n ' return f'{self.BASE_URL}/aanbod/rotterdam/'
-6,004,065,819,992,848,000
Format page url
server/app/scrapers/maarten.py
get_page_url
damienallen/makelaardij-notify
python
async def get_page_url(self, page_num: int) -> str: '\n \n ' return f'{self.BASE_URL}/aanbod/rotterdam/'
async def get_apartment_urls(self) -> List[str]: '\n Fetch list of apartment urls from inventory\n ' urls = (await self.scrape_page(0)) return urls
-6,254,682,917,009,416,000
Fetch list of apartment urls from inventory
server/app/scrapers/maarten.py
get_apartment_urls
damienallen/makelaardij-notify
python
async def get_apartment_urls(self) -> List[str]: '\n \n ' urls = (await self.scrape_page(0)) return urls
def extract_features(self, soup): '\n Extract feature metadata from listing\n ' meta_data = {'makelaardij': self.MAKELAARDIJ, 'building': {}, 'unit': {'energy': {}, 'tags': []}} dt = soup.find_all('dt') dd = soup.find_all('dd') for (ind, key) in enumerate(dt): if ('Bouwjaar' in...
-4,377,614,919,145,519,600
Extract feature metadata from listing
server/app/scrapers/maarten.py
extract_features
damienallen/makelaardij-notify
python
def extract_features(self, soup): '\n \n ' meta_data = {'makelaardij': self.MAKELAARDIJ, 'building': {}, 'unit': {'energy': {}, 'tags': []}} dt = soup.find_all('dt') dd = soup.find_all('dd') for (ind, key) in enumerate(dt): if ('Bouwjaar' in key.string): meta_data['...
@staticmethod def get_schema(max_nesting_depth: Optional[int]=6, nesting_depth: int=0, nesting_list: List[str]=[], max_recursion_limit: Optional[int]=2, include_extension: Optional[bool]=False, extension_fields: Optional[List[str]]=['valueBoolean', 'valueCode', 'valueDate', 'valueDateTime', 'valueDecimal', 'valueId', '...
-8,171,934,014,997,929,000
A record of an event made for purposes of maintaining a security log. Typical uses include detection of intrusion attempts and monitoring for inappropriate usage. id: unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces. extension: May b...
spark_fhir_schemas/stu3/complex_types/auditevent_entity.py
get_schema
icanbwell/SparkFhirSchemas
python
@staticmethod def get_schema(max_nesting_depth: Optional[int]=6, nesting_depth: int=0, nesting_list: List[str]=[], max_recursion_limit: Optional[int]=2, include_extension: Optional[bool]=False, extension_fields: Optional[List[str]]=['valueBoolean', 'valueCode', 'valueDate', 'valueDateTime', 'valueDecimal', 'valueId', '...
def test_get_deed_or_license_path_by4(self): '\n 4.0 formula:\n /licenses/VERSION/LICENSE_deed_LANGAUGE.html\n /licenses/VERSION/LICENSE_legalcode_LANGAUGEhtml\n\n 4.0 examples:\n /licenses/4.0/by-nc-nd_deed_en.html\n /licenses/4.0/by-nc-nd_legalcode_en.html\n /licen...
6,298,925,950,783,103,000
4.0 formula: /licenses/VERSION/LICENSE_deed_LANGAUGE.html /licenses/VERSION/LICENSE_legalcode_LANGAUGEhtml 4.0 examples: /licenses/4.0/by-nc-nd_deed_en.html /licenses/4.0/by-nc-nd_legalcode_en.html /licenses/4.0/by_deed_en.html /licenses/4.0/by_legalcode_en.html /licenses/4.0/by_deed_zh-Hans.html /licenses/4.0/by_lega...
licenses/tests/test_models.py
test_get_deed_or_license_path_by4
kerahui/cc-licenses
python
def test_get_deed_or_license_path_by4(self): '\n 4.0 formula:\n /licenses/VERSION/LICENSE_deed_LANGAUGE.html\n /licenses/VERSION/LICENSE_legalcode_LANGAUGEhtml\n\n 4.0 examples:\n /licenses/4.0/by-nc-nd_deed_en.html\n /licenses/4.0/by-nc-nd_legalcode_en.html\n /licen...
def test_get_deed_or_license_path_by3(self): '\n 3.0 formula:\n /licenses/VERSION/JURISDICTION/LICENSE_deed_LANGAUGE.html\n /licenses/VERSION/JURISDICTION/LICENSE_legalcode_LANGAUGE.html\n\n 3.0 examples:\n /licenses/3.0/xu/by_deed_en.html\n /licenses/3.0/xu/by_legalcode_en...
731,381,742,001,778,600
3.0 formula: /licenses/VERSION/JURISDICTION/LICENSE_deed_LANGAUGE.html /licenses/VERSION/JURISDICTION/LICENSE_legalcode_LANGAUGE.html 3.0 examples: /licenses/3.0/xu/by_deed_en.html /licenses/3.0/xu/by_legalcode_en.html /licenses/3.0/am/by_deed_hy.html /licenses/3.0/am/by_legalcode_hy.html /licenses/3.0/rs/by_deed_rs-C...
licenses/tests/test_models.py
test_get_deed_or_license_path_by3
kerahui/cc-licenses
python
def test_get_deed_or_license_path_by3(self): '\n 3.0 formula:\n /licenses/VERSION/JURISDICTION/LICENSE_deed_LANGAUGE.html\n /licenses/VERSION/JURISDICTION/LICENSE_legalcode_LANGAUGE.html\n\n 3.0 examples:\n /licenses/3.0/xu/by_deed_en.html\n /licenses/3.0/xu/by_legalcode_en...
def test_get_deed_or_license_path_cc0(self): '\n cc0 formula:\n /publicdomain/VERSION/LICENSE_deed_LANGAUGE.html\n /publicdomain/VERSION/LICENSE_legalcode_LANGAUGE.html\n\n cc0 examples:\n /publicdomain/1.0/zero_deed_en.html\n /publicdomain/1.0/zero_legalcode_en.html\n ...
8,075,320,904,855,932,000
cc0 formula: /publicdomain/VERSION/LICENSE_deed_LANGAUGE.html /publicdomain/VERSION/LICENSE_legalcode_LANGAUGE.html cc0 examples: /publicdomain/1.0/zero_deed_en.html /publicdomain/1.0/zero_legalcode_en.html /publicdomain/1.0/zero_deed_ja.html /publicdomain/1.0/zero_legalcode_ja.html
licenses/tests/test_models.py
test_get_deed_or_license_path_cc0
kerahui/cc-licenses
python
def test_get_deed_or_license_path_cc0(self): '\n cc0 formula:\n /publicdomain/VERSION/LICENSE_deed_LANGAUGE.html\n /publicdomain/VERSION/LICENSE_legalcode_LANGAUGE.html\n\n cc0 examples:\n /publicdomain/1.0/zero_deed_en.html\n /publicdomain/1.0/zero_legalcode_en.html\n ...
def default_hparams(): 'Generates the hparams used to train note rnn used in paper.' return tf.contrib.training.HParams(use_dynamic_rnn=True, batch_size=BATCH_SIZE, lr=0.0002, l2_reg=2.5e-05, clip_norm=5, initial_learning_rate=0.5, decay_steps=1000, decay_rate=0.85, rnn_layer_sizes=[100], skip_first_n_losses=32...
-6,123,440,437,575,037,000
Generates the hparams used to train note rnn used in paper.
magenta/models/rl_tuner/rl_tuner_ops.py
default_hparams
Aaravmaheshwari/magenta
python
def default_hparams(): return tf.contrib.training.HParams(use_dynamic_rnn=True, batch_size=BATCH_SIZE, lr=0.0002, l2_reg=2.5e-05, clip_norm=5, initial_learning_rate=0.5, decay_steps=1000, decay_rate=0.85, rnn_layer_sizes=[100], skip_first_n_losses=32, one_hot_length=NUM_CLASSES, exponentially_decay_learning_ra...
def basic_rnn_hparams(): 'Generates the hparams used to train a basic_rnn.\n\n These are the hparams used in the .mag file found at\n https://github.com/tensorflow/magenta/tree/master/magenta/models/\n melody_rnn#pre-trained\n\n Returns:\n Hyperparameters of the downloadable basic_rnn pre-trained model.\n '...
2,471,212,309,086,837,000
Generates the hparams used to train a basic_rnn. These are the hparams used in the .mag file found at https://github.com/tensorflow/magenta/tree/master/magenta/models/ melody_rnn#pre-trained Returns: Hyperparameters of the downloadable basic_rnn pre-trained model.
magenta/models/rl_tuner/rl_tuner_ops.py
basic_rnn_hparams
Aaravmaheshwari/magenta
python
def basic_rnn_hparams(): 'Generates the hparams used to train a basic_rnn.\n\n These are the hparams used in the .mag file found at\n https://github.com/tensorflow/magenta/tree/master/magenta/models/\n melody_rnn#pre-trained\n\n Returns:\n Hyperparameters of the downloadable basic_rnn pre-trained model.\n '...
def default_dqn_hparams(): 'Generates the default hparams for RLTuner DQN model.' return tf.contrib.training.HParams(random_action_probability=0.1, store_every_nth=1, train_every_nth=5, minibatch_size=32, discount_rate=0.95, max_experience=100000, target_network_update_rate=0.01)
-408,690,727,625,031,550
Generates the default hparams for RLTuner DQN model.
magenta/models/rl_tuner/rl_tuner_ops.py
default_dqn_hparams
Aaravmaheshwari/magenta
python
def default_dqn_hparams(): return tf.contrib.training.HParams(random_action_probability=0.1, store_every_nth=1, train_every_nth=5, minibatch_size=32, discount_rate=0.95, max_experience=100000, target_network_update_rate=0.01)
def autocorrelate(signal, lag=1): "Gives the correlation coefficient for the signal's correlation with itself.\n\n Args:\n signal: The signal on which to compute the autocorrelation. Can be a list.\n lag: The offset at which to correlate the signal with itself. E.g. if lag\n is 1, will compute the corre...
-3,527,570,645,793,660,000
Gives the correlation coefficient for the signal's correlation with itself. Args: signal: The signal on which to compute the autocorrelation. Can be a list. lag: The offset at which to correlate the signal with itself. E.g. if lag is 1, will compute the correlation between the signal and itself 1 beat late...
magenta/models/rl_tuner/rl_tuner_ops.py
autocorrelate
Aaravmaheshwari/magenta
python
def autocorrelate(signal, lag=1): "Gives the correlation coefficient for the signal's correlation with itself.\n\n Args:\n signal: The signal on which to compute the autocorrelation. Can be a list.\n lag: The offset at which to correlate the signal with itself. E.g. if lag\n is 1, will compute the corre...
def linear_annealing(n, total, p_initial, p_final): 'Linearly interpolates a probability between p_initial and p_final.\n\n Current probability is based on the current step, n. Used to linearly anneal\n the exploration probability of the RLTuner.\n\n Args:\n n: The current step.\n total: The total number o...
7,249,117,379,146,749,000
Linearly interpolates a probability between p_initial and p_final. Current probability is based on the current step, n. Used to linearly anneal the exploration probability of the RLTuner. Args: n: The current step. total: The total number of steps that will be taken (usually the length of the exploration peri...
magenta/models/rl_tuner/rl_tuner_ops.py
linear_annealing
Aaravmaheshwari/magenta
python
def linear_annealing(n, total, p_initial, p_final): 'Linearly interpolates a probability between p_initial and p_final.\n\n Current probability is based on the current step, n. Used to linearly anneal\n the exploration probability of the RLTuner.\n\n Args:\n n: The current step.\n total: The total number o...
def softmax(x): 'Compute softmax values for each sets of scores in x.' e_x = np.exp((x - np.max(x))) return (e_x / e_x.sum(axis=0))
-8,078,771,299,122,488,000
Compute softmax values for each sets of scores in x.
magenta/models/rl_tuner/rl_tuner_ops.py
softmax
Aaravmaheshwari/magenta
python
def softmax(x): e_x = np.exp((x - np.max(x))) return (e_x / e_x.sum(axis=0))
def sample_softmax(softmax_vect): 'Samples a note from an array of softmax probabilities.\n\n Tries to do this with numpy, which requires that the probabilities add to 1.0\n with extreme precision. If this fails, uses a manual implementation.\n\n Args:\n softmax_vect: An array of probabilities.\n Returns:\n ...
-7,324,834,732,328,166,000
Samples a note from an array of softmax probabilities. Tries to do this with numpy, which requires that the probabilities add to 1.0 with extreme precision. If this fails, uses a manual implementation. Args: softmax_vect: An array of probabilities. Returns: The index of the note that was chosen/sampled.
magenta/models/rl_tuner/rl_tuner_ops.py
sample_softmax
Aaravmaheshwari/magenta
python
def sample_softmax(softmax_vect): 'Samples a note from an array of softmax probabilities.\n\n Tries to do this with numpy, which requires that the probabilities add to 1.0\n with extreme precision. If this fails, uses a manual implementation.\n\n Args:\n softmax_vect: An array of probabilities.\n Returns:\n ...
def decoder(event_list, transpose_amount): 'Translates a sequence generated by RLTuner to MonophonicMelody form.\n\n Args:\n event_list: Integer list of encoded notes.\n transpose_amount: Key to transpose to.\n Returns:\n Integer list of MIDI values.\n ' return [((e - NUM_SPECIAL_EVENTS) if (e < NUM...
-5,413,410,686,043,745,000
Translates a sequence generated by RLTuner to MonophonicMelody form. Args: event_list: Integer list of encoded notes. transpose_amount: Key to transpose to. Returns: Integer list of MIDI values.
magenta/models/rl_tuner/rl_tuner_ops.py
decoder
Aaravmaheshwari/magenta
python
def decoder(event_list, transpose_amount): 'Translates a sequence generated by RLTuner to MonophonicMelody form.\n\n Args:\n event_list: Integer list of encoded notes.\n transpose_amount: Key to transpose to.\n Returns:\n Integer list of MIDI values.\n ' return [((e - NUM_SPECIAL_EVENTS) if (e < NUM...
def make_onehot(int_list, one_hot_length): 'Convert each int to a one-hot vector.\n\n A one-hot vector is 0 everywhere except at the index equal to the\n encoded value.\n\n For example: 5 as a one-hot vector is [0, 0, 0, 0, 0, 1, 0, 0, 0, ...]\n\n Args:\n int_list: A list of ints, each of which will get a on...
7,837,502,958,555,476,000
Convert each int to a one-hot vector. A one-hot vector is 0 everywhere except at the index equal to the encoded value. For example: 5 as a one-hot vector is [0, 0, 0, 0, 0, 1, 0, 0, 0, ...] Args: int_list: A list of ints, each of which will get a one-hot encoding. one_hot_length: The length of the one-hot vector...
magenta/models/rl_tuner/rl_tuner_ops.py
make_onehot
Aaravmaheshwari/magenta
python
def make_onehot(int_list, one_hot_length): 'Convert each int to a one-hot vector.\n\n A one-hot vector is 0 everywhere except at the index equal to the\n encoded value.\n\n For example: 5 as a one-hot vector is [0, 0, 0, 0, 0, 1, 0, 0, 0, ...]\n\n Args:\n int_list: A list of ints, each of which will get a on...
def get_inner_scope(scope_str): 'Takes a tensorflow scope string and finds the inner scope.\n\n Inner scope is one layer more internal.\n\n Args:\n scope_str: Tensorflow variable scope string.\n Returns:\n Scope string with outer scope stripped off.\n ' idx = scope_str.find('/') return scope_str[(...
-7,477,195,212,486,831,000
Takes a tensorflow scope string and finds the inner scope. Inner scope is one layer more internal. Args: scope_str: Tensorflow variable scope string. Returns: Scope string with outer scope stripped off.
magenta/models/rl_tuner/rl_tuner_ops.py
get_inner_scope
Aaravmaheshwari/magenta
python
def get_inner_scope(scope_str): 'Takes a tensorflow scope string and finds the inner scope.\n\n Inner scope is one layer more internal.\n\n Args:\n scope_str: Tensorflow variable scope string.\n Returns:\n Scope string with outer scope stripped off.\n ' idx = scope_str.find('/') return scope_str[(...
def trim_variable_postfixes(scope_str): 'Trims any extra numbers added to a tensorflow scope string.\n\n Necessary to align variables in graph and checkpoint\n\n Args:\n scope_str: Tensorflow variable scope string.\n Returns:\n Scope string with extra numbers trimmed off.\n ' idx = scope_str.find(':')...
7,660,496,240,275,590,000
Trims any extra numbers added to a tensorflow scope string. Necessary to align variables in graph and checkpoint Args: scope_str: Tensorflow variable scope string. Returns: Scope string with extra numbers trimmed off.
magenta/models/rl_tuner/rl_tuner_ops.py
trim_variable_postfixes
Aaravmaheshwari/magenta
python
def trim_variable_postfixes(scope_str): 'Trims any extra numbers added to a tensorflow scope string.\n\n Necessary to align variables in graph and checkpoint\n\n Args:\n scope_str: Tensorflow variable scope string.\n Returns:\n Scope string with extra numbers trimmed off.\n ' idx = scope_str.find(':')...
def get_variable_names(graph, scope): 'Finds all the variable names in a graph that begin with a given scope.\n\n Args:\n graph: A tensorflow graph.\n scope: A string scope.\n Returns:\n List of variables.\n ' with graph.as_default(): return [v.name for v in tf.global_variables() if v.name.s...
4,936,847,139,153,747,000
Finds all the variable names in a graph that begin with a given scope. Args: graph: A tensorflow graph. scope: A string scope. Returns: List of variables.
magenta/models/rl_tuner/rl_tuner_ops.py
get_variable_names
Aaravmaheshwari/magenta
python
def get_variable_names(graph, scope): 'Finds all the variable names in a graph that begin with a given scope.\n\n Args:\n graph: A tensorflow graph.\n scope: A string scope.\n Returns:\n List of variables.\n ' with graph.as_default(): return [v.name for v in tf.global_variables() if v.name.s...
def get_next_file_name(directory, prefix, extension): "Finds next available filename in directory by appending numbers to prefix.\n\n E.g. If prefix is 'myfile', extenstion is '.png', and 'directory' already\n contains 'myfile.png' and 'myfile1.png', this function will return\n 'myfile2.png'.\n\n Args:\n dir...
-6,008,818,441,906,766,000
Finds next available filename in directory by appending numbers to prefix. E.g. If prefix is 'myfile', extenstion is '.png', and 'directory' already contains 'myfile.png' and 'myfile1.png', this function will return 'myfile2.png'. Args: directory: Path to the relevant directory. prefix: The filename prefix to use...
magenta/models/rl_tuner/rl_tuner_ops.py
get_next_file_name
Aaravmaheshwari/magenta
python
def get_next_file_name(directory, prefix, extension): "Finds next available filename in directory by appending numbers to prefix.\n\n E.g. If prefix is 'myfile', extenstion is '.png', and 'directory' already\n contains 'myfile.png' and 'myfile1.png', this function will return\n 'myfile2.png'.\n\n Args:\n dir...
def make_rnn_cell(rnn_layer_sizes, state_is_tuple=False): 'Makes a default LSTM cell for use in the NoteRNNLoader graph.\n\n This model is only to be used for loading the checkpoint from the research\n paper. In general, events_rnn_graph.make_rnn_cell should be used instead.\n\n Args:\n rnn_layer_sizes: A lis...
4,142,728,209,454,180,400
Makes a default LSTM cell for use in the NoteRNNLoader graph. This model is only to be used for loading the checkpoint from the research paper. In general, events_rnn_graph.make_rnn_cell should be used instead. Args: rnn_layer_sizes: A list of integer sizes (in units) for each layer of the RNN. state_is_tup...
magenta/models/rl_tuner/rl_tuner_ops.py
make_rnn_cell
Aaravmaheshwari/magenta
python
def make_rnn_cell(rnn_layer_sizes, state_is_tuple=False): 'Makes a default LSTM cell for use in the NoteRNNLoader graph.\n\n This model is only to be used for loading the checkpoint from the research\n paper. In general, events_rnn_graph.make_rnn_cell should be used instead.\n\n Args:\n rnn_layer_sizes: A lis...
def log_sum_exp(xs): 'Computes the log sum exp value of a tensor.' maxes = tf.reduce_max(xs, keep_dims=True) xs -= maxes return (tf.squeeze(maxes, [(- 1)]) + tf.log(tf.reduce_sum(tf.exp(xs), (- 1))))
4,708,533,451,265,391,000
Computes the log sum exp value of a tensor.
magenta/models/rl_tuner/rl_tuner_ops.py
log_sum_exp
Aaravmaheshwari/magenta
python
def log_sum_exp(xs): maxes = tf.reduce_max(xs, keep_dims=True) xs -= maxes return (tf.squeeze(maxes, [(- 1)]) + tf.log(tf.reduce_sum(tf.exp(xs), (- 1))))
def get_error_code(self): 'Get exception error code' return self.error_code
2,325,030,184,817,204,700
Get exception error code
srfax/srfax.py
get_error_code
sunbeamer/srfax-api-python
python
def get_error_code(self): return self.error_code
def get_cause(self): 'Get exception cause' return self.cause
-1,379,205,058,938,806,800
Get exception cause
srfax/srfax.py
get_cause
sunbeamer/srfax-api-python
python
def get_cause(self): return self.cause
def get_retry(self): 'Get retry option (should we retry the request?)' return self.retry
-3,069,908,002,933,401,600
Get retry option (should we retry the request?)
srfax/srfax.py
get_retry
sunbeamer/srfax-api-python
python
def get_retry(self): return self.retry
def queue_fax(self, to_fax_number, filepath, caller_id=None, sender_email=None, account_code=None): 'Queue fax for sending' to_fax_number = SRFax.verify_fax_numbers(to_fax_number) fax_type = ('BROADCAST' if (len(to_fax_number) > 1) else 'SINGLE') to_fax_number = '|'.join(to_fax_number) try: ...
3,631,779,985,675,308,500
Queue fax for sending
srfax/srfax.py
queue_fax
sunbeamer/srfax-api-python
python
def queue_fax(self, to_fax_number, filepath, caller_id=None, sender_email=None, account_code=None): to_fax_number = SRFax.verify_fax_numbers(to_fax_number) fax_type = ('BROADCAST' if (len(to_fax_number) > 1) else 'SINGLE') to_fax_number = '|'.join(to_fax_number) try: if isinstance(filepath,...
def get_fax_status(self, fax_id): 'Get fax status' params = {'access_id': self.access_id, 'access_pwd': self.access_pwd, 'sFaxDetailsID': fax_id} SRFax.verify_parameters(params) response = self.process_request('Get_FaxStatus', params) if (len(response) == 1): response = response[0] retur...
-3,783,029,833,016,914,000
Get fax status
srfax/srfax.py
get_fax_status
sunbeamer/srfax-api-python
python
def get_fax_status(self, fax_id): params = {'access_id': self.access_id, 'access_pwd': self.access_pwd, 'sFaxDetailsID': fax_id} SRFax.verify_parameters(params) response = self.process_request('Get_FaxStatus', params) if (len(response) == 1): response = response[0] return response
def get_fax_inbox(self, period='ALL'): 'Get fax inbox' params = {'access_id': self.access_id, 'access_pwd': self.access_pwd, 'sPeriod': period} SRFax.verify_parameters(params) return self.process_request('Get_Fax_Inbox', params)
1,799,947,527,271,448,300
Get fax inbox
srfax/srfax.py
get_fax_inbox
sunbeamer/srfax-api-python
python
def get_fax_inbox(self, period='ALL'): params = {'access_id': self.access_id, 'access_pwd': self.access_pwd, 'sPeriod': period} SRFax.verify_parameters(params) return self.process_request('Get_Fax_Inbox', params)
def get_fax_outbox(self, period='ALL'): 'Get fax outbox' params = {'access_id': self.access_id, 'access_pwd': self.access_pwd, 'sPeriod': period} SRFax.verify_parameters(params) return self.process_request('Get_Fax_Outbox', params)
-3,963,924,699,439,529,500
Get fax outbox
srfax/srfax.py
get_fax_outbox
sunbeamer/srfax-api-python
python
def get_fax_outbox(self, period='ALL'): params = {'access_id': self.access_id, 'access_pwd': self.access_pwd, 'sPeriod': period} SRFax.verify_parameters(params) return self.process_request('Get_Fax_Outbox', params)
def retrieve_fax(self, fax_filename, folder, fax_id): 'Retrieve fax content in Base64 format' assert (folder in ['IN', 'OUT']) params = {'access_id': self.access_id, 'access_pwd': self.access_pwd, 'sFaxFileName': fax_filename, 'sDirection': folder, 'sFaxDetailsID': fax_id} SRFax.verify_parameters(params...
-308,339,134,267,783,300
Retrieve fax content in Base64 format
srfax/srfax.py
retrieve_fax
sunbeamer/srfax-api-python
python
def retrieve_fax(self, fax_filename, folder, fax_id): assert (folder in ['IN', 'OUT']) params = {'access_id': self.access_id, 'access_pwd': self.access_pwd, 'sFaxFileName': fax_filename, 'sDirection': folder, 'sFaxDetailsID': fax_id} SRFax.verify_parameters(params) response = self.process_request('...
def delete_fax(self, fax_filename, folder): 'Delete fax files from server' assert (folder in ['IN', 'OUT']) if isinstance(fax_filename, str): fax_filename = [fax_filename] if (not isinstance(fax_filename, list)): raise TypeError('fax_filename not properly defined') if (len(fax_filena...
-7,622,009,533,996,599,000
Delete fax files from server
srfax/srfax.py
delete_fax
sunbeamer/srfax-api-python
python
def delete_fax(self, fax_filename, folder): assert (folder in ['IN', 'OUT']) if isinstance(fax_filename, str): fax_filename = [fax_filename] if (not isinstance(fax_filename, list)): raise TypeError('fax_filename not properly defined') if (len(fax_filename) > 5): raise Except...
def process_request(self, method, params): 'Process SRFax SOAP request' params['action'] = method try: response = requests.post(self.url, json=params) except Exception as exc: raise SRFaxError('REQUESTFAILED', 'REST request failed', cause=exc, retry=True) return SRFax.process_respons...
-6,875,549,667,463,366,000
Process SRFax SOAP request
srfax/srfax.py
process_request
sunbeamer/srfax-api-python
python
def process_request(self, method, params): params['action'] = method try: response = requests.post(self.url, json=params) except Exception as exc: raise SRFaxError('REQUESTFAILED', 'REST request failed', cause=exc, retry=True) return SRFax.process_response(response)
@staticmethod def process_response(response): 'Process SRFax SOAP response' if (not response): raise SRFaxError('INVALIDRESPONSE', 'Empty response', retry=True) if response.ok: response = response.json() if (('Status' not in response) or ('Result' not in response)): raise...
8,468,178,039,069,426,000
Process SRFax SOAP response
srfax/srfax.py
process_response
sunbeamer/srfax-api-python
python
@staticmethod def process_response(response): if (not response): raise SRFaxError('INVALIDRESPONSE', 'Empty response', retry=True) if response.ok: response = response.json() if (('Status' not in response) or ('Result' not in response)): raise SRFaxError('INVALIDRESPONSE'...
@staticmethod def verify_parameters(params): 'Verify that dict values are set' for key in params.keys(): if (params[key] is None): raise TypeError(('%s not set' % key))
8,079,586,257,489,199,000
Verify that dict values are set
srfax/srfax.py
verify_parameters
sunbeamer/srfax-api-python
python
@staticmethod def verify_parameters(params): for key in params.keys(): if (params[key] is None): raise TypeError(('%s not set' % key))
@staticmethod def is_e164_number(number): 'Simple check if number is in E.164 format' if (isinstance(number, str) and RE_E164.match(number)): return True return False
8,022,049,498,608,379,000
Simple check if number is in E.164 format
srfax/srfax.py
is_e164_number
sunbeamer/srfax-api-python
python
@staticmethod def is_e164_number(number): if (isinstance(number, str) and RE_E164.match(number)): return True return False
@staticmethod def is_nanp_number(number): 'Simple check if number is inside North American Numbering Plan' if (isinstance(number, str) and RE_NANP.match(number)): return True return False
-4,080,957,327,917,256,000
Simple check if number is inside North American Numbering Plan
srfax/srfax.py
is_nanp_number
sunbeamer/srfax-api-python
python
@staticmethod def is_nanp_number(number): if (isinstance(number, str) and RE_NANP.match(number)): return True return False
@staticmethod def verify_fax_numbers(to_fax_number): 'Verify and prepare fax numbers for use at SRFax' try: if isinstance(to_fax_number, basestring): to_fax_number = [to_fax_number] except NameError: if isinstance(to_fax_number, str): to_fax_number = [to_fax_number] ...
-4,816,944,131,299,759,000
Verify and prepare fax numbers for use at SRFax
srfax/srfax.py
verify_fax_numbers
sunbeamer/srfax-api-python
python
@staticmethod def verify_fax_numbers(to_fax_number): try: if isinstance(to_fax_number, basestring): to_fax_number = [to_fax_number] except NameError: if isinstance(to_fax_number, str): to_fax_number = [to_fax_number] if (not isinstance(to_fax_number, list)): ...
@staticmethod def get_file_content(filepath): 'Read and return file content Base64 encoded' if (not os.path.exists(filepath)): raise Exception(('File does not exists: %s' % filepath)) if (not os.path.isfile(filepath)): raise Exception(('Not a file: %s' % filepath)) content = None try...
-1,608,719,954,331,864,600
Read and return file content Base64 encoded
srfax/srfax.py
get_file_content
sunbeamer/srfax-api-python
python
@staticmethod def get_file_content(filepath): if (not os.path.exists(filepath)): raise Exception(('File does not exists: %s' % filepath)) if (not os.path.isfile(filepath)): raise Exception(('Not a file: %s' % filepath)) content = None try: fdp = open(filepath, 'rb') exce...
def has_transformation(self, other): ' Checks to see if there exist transformers for other\n\n Parameters\n ----------\n other : ModelType subclass\n The object being checked for transformer\n\n Returns\n -------\n bool\n Does the specified transformer ...
-3,339,349,924,968,295,000
Checks to see if there exist transformers for other Parameters ---------- other : ModelType subclass The object being checked for transformer Returns ------- bool Does the specified transformer exist for other?
qiime2/core/transform.py
has_transformation
ebolyen/qiime2
python
def has_transformation(self, other): ' Checks to see if there exist transformers for other\n\n Parameters\n ----------\n other : ModelType subclass\n The object being checked for transformer\n\n Returns\n -------\n bool\n Does the specified transformer ...
def concrete_sample(logits, temperature, shape=torch.Size([])): '\n Sampling for Concrete distribution.\n\n See Eq. 10 of Maddison et al., 2017.\n ' uniform_shape = (torch.Size(shape) + logits.shape) u = clamp_probs(torch.rand(uniform_shape, dtype=torch.float32, device=logits.device)) gumbels =...
-3,301,323,707,461,947,400
Sampling for Concrete distribution. See Eq. 10 of Maddison et al., 2017.
selection/layers/utils.py
concrete_sample
iancovert/dl-selection
python
def concrete_sample(logits, temperature, shape=torch.Size([])): '\n Sampling for Concrete distribution.\n\n See Eq. 10 of Maddison et al., 2017.\n ' uniform_shape = (torch.Size(shape) + logits.shape) u = clamp_probs(torch.rand(uniform_shape, dtype=torch.float32, device=logits.device)) gumbels =...
def bernoulli_concrete_sample(logits, temperature, shape=torch.Size([])): '\n Sampling for BinConcrete distribution.\n\n See PyTorch source code, differs from Eq. 16 of Maddison et al., 2017.\n ' uniform_shape = (torch.Size(shape) + logits.shape) u = clamp_probs(torch.rand(uniform_shape, dtype=torc...
7,209,884,946,331,013,000
Sampling for BinConcrete distribution. See PyTorch source code, differs from Eq. 16 of Maddison et al., 2017.
selection/layers/utils.py
bernoulli_concrete_sample
iancovert/dl-selection
python
def bernoulli_concrete_sample(logits, temperature, shape=torch.Size([])): '\n Sampling for BinConcrete distribution.\n\n See PyTorch source code, differs from Eq. 16 of Maddison et al., 2017.\n ' uniform_shape = (torch.Size(shape) + logits.shape) u = clamp_probs(torch.rand(uniform_shape, dtype=torc...
@pytest.mark.parametrize('ambient_dim', [2, 3]) @pytest.mark.parametrize('dformat', ['xml', 'hdf', 'binary']) def test_unstructured_vertex_grid(ambient_dim, dformat, npoints=64): 'Test constructing a vertex grid with different ways to define the\n points and connectivity.\n ' from pyvisfile.xdmf import Nu...
3,856,762,145,171,941,000
Test constructing a vertex grid with different ways to define the points and connectivity.
test/test_xdmf.py
test_unstructured_vertex_grid
alexfikl/pyvisfile
python
@pytest.mark.parametrize('ambient_dim', [2, 3]) @pytest.mark.parametrize('dformat', ['xml', 'hdf', 'binary']) def test_unstructured_vertex_grid(ambient_dim, dformat, npoints=64): 'Test constructing a vertex grid with different ways to define the\n points and connectivity.\n ' from pyvisfile.xdmf import Nu...
@pytest.mark.parametrize('ambient_dim', [2, 3]) def test_unstructured_simplex_grid(ambient_dim, nelements=16): 'Test constructing a grid with a more complicated topology.' from pyvisfile.xdmf import TopologyType if (ambient_dim == 1): topology_type = TopologyType.Polyline simplices_per_quad ...
-2,399,577,849,240,787,500
Test constructing a grid with a more complicated topology.
test/test_xdmf.py
test_unstructured_simplex_grid
alexfikl/pyvisfile
python
@pytest.mark.parametrize('ambient_dim', [2, 3]) def test_unstructured_simplex_grid(ambient_dim, nelements=16): from pyvisfile.xdmf import TopologyType if (ambient_dim == 1): topology_type = TopologyType.Polyline simplices_per_quad = 1 if (ambient_dim == 2): topology_type = Topol...
def _sanity_check(self, result: HttpResponse) -> None: '\n Use this for tests that are geared toward specific edge cases, but\n which still want the home page to load properly.\n ' html = result.content.decode('utf-8') if ('Compose your message' not in html): raise AssertionErro...
-7,585,729,800,057,153,000
Use this for tests that are geared toward specific edge cases, but which still want the home page to load properly.
zerver/tests/test_home.py
_sanity_check
rhencke/zulip
python
def _sanity_check(self, result: HttpResponse) -> None: '\n Use this for tests that are geared toward specific edge cases, but\n which still want the home page to load properly.\n ' html = result.content.decode('utf-8') if ('Compose your message' not in html): raise AssertionErro...
def test_eisenstein_hu(): ' Test Eisenstein & Hu Linear matter power spectrum with\n and without wiggles using astropy default cosmology' cosmology = default_cosmology.get() A_s = 2.1982e-09 n_s = 0.969453 kwmap = 0.02 scalar_input = 1 scalar_output_w = power_spectrum(scalar_input, A_s, n...
6,900,489,699,790,302,000
Test Eisenstein & Hu Linear matter power spectrum with and without wiggles using astropy default cosmology
skypy/linear/tests/test_eisenstein_hu.py
test_eisenstein_hu
Lucia-Fonseca/skypy
python
def test_eisenstein_hu(): ' Test Eisenstein & Hu Linear matter power spectrum with\n and without wiggles using astropy default cosmology' cosmology = default_cosmology.get() A_s = 2.1982e-09 n_s = 0.969453 kwmap = 0.02 scalar_input = 1 scalar_output_w = power_spectrum(scalar_input, A_s, n...
def set_logging_level(verbosity, logger=None, stderr_output=False): 'Set up logging for the CLI.\n\n We either set up global logging based on the verbosity\n or, if `logger` is specified, we only limit to a single\n sqlfluff logger. Verbosity is applied in the same way.\n\n Implementation: If `logger` i...
-2,421,650,648,819,382,000
Set up logging for the CLI. We either set up global logging based on the verbosity or, if `logger` is specified, we only limit to a single sqlfluff logger. Verbosity is applied in the same way. Implementation: If `logger` is not specified, the handler is attached to the `sqlfluff` logger. If it is specified then it a...
src/sqlfluff/cli/commands.py
set_logging_level
tmastny/sqlfluff
python
def set_logging_level(verbosity, logger=None, stderr_output=False): 'Set up logging for the CLI.\n\n We either set up global logging based on the verbosity\n or, if `logger` is specified, we only limit to a single\n sqlfluff logger. Verbosity is applied in the same way.\n\n Implementation: If `logger` i...
def common_options(f): 'Add common options to commands via a decorator.\n\n These are applied to all of the cli commands.\n ' f = click.version_option()(f) f = click.option('-v', '--verbose', count=True, help='Verbosity, how detailed should the output be. This is *stackable*, so `-vv` is more verbose ...
5,106,378,517,505,907,000
Add common options to commands via a decorator. These are applied to all of the cli commands.
src/sqlfluff/cli/commands.py
common_options
tmastny/sqlfluff
python
def common_options(f): 'Add common options to commands via a decorator.\n\n These are applied to all of the cli commands.\n ' f = click.version_option()(f) f = click.option('-v', '--verbose', count=True, help='Verbosity, how detailed should the output be. This is *stackable*, so `-vv` is more verbose ...