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
proycon/clam
clam/common/parameters.py
ChoiceParameter.valuefrompostdata
def valuefrompostdata(self, postdata): """This parameter method searches the POST data and retrieves the values it needs. It does not set the value yet though, but simply returns it. Needs to be explicitly passed to parameter.set()""" if self.multi: #multi parameters can be passed as parameterid=choice...
python
def valuefrompostdata(self, postdata): """This parameter method searches the POST data and retrieves the values it needs. It does not set the value yet though, but simply returns it. Needs to be explicitly passed to parameter.set()""" if self.multi: #multi parameters can be passed as parameterid=choice...
[ "def", "valuefrompostdata", "(", "self", ",", "postdata", ")", ":", "if", "self", ".", "multi", ":", "#multi parameters can be passed as parameterid=choiceid1,choiceid2 or by setting parameterid[choiceid]=1 (or whatever other non-zero value)", "found", "=", "False", "if", "self"...
This parameter method searches the POST data and retrieves the values it needs. It does not set the value yet though, but simply returns it. Needs to be explicitly passed to parameter.set()
[ "This", "parameter", "method", "searches", "the", "POST", "data", "and", "retrieves", "the", "values", "it", "needs", ".", "It", "does", "not", "set", "the", "value", "yet", "though", "but", "simply", "returns", "it", ".", "Needs", "to", "be", "explicitly"...
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/parameters.py#L489-L516
proycon/clam
clam/common/parameters.py
IntegerParameter.valuefrompostdata
def valuefrompostdata(self, postdata): """This parameter method searches the POST data and retrieves the values it needs. It does not set the value yet though, but simply returns it. Needs to be explicitly passed to parameter.set()""" if self.id in postdata and postdata[self.id] != '': retur...
python
def valuefrompostdata(self, postdata): """This parameter method searches the POST data and retrieves the values it needs. It does not set the value yet though, but simply returns it. Needs to be explicitly passed to parameter.set()""" if self.id in postdata and postdata[self.id] != '': retur...
[ "def", "valuefrompostdata", "(", "self", ",", "postdata", ")", ":", "if", "self", ".", "id", "in", "postdata", "and", "postdata", "[", "self", ".", "id", "]", "!=", "''", ":", "return", "int", "(", "postdata", "[", "self", ".", "id", "]", ")", "els...
This parameter method searches the POST data and retrieves the values it needs. It does not set the value yet though, but simply returns it. Needs to be explicitly passed to parameter.set()
[ "This", "parameter", "method", "searches", "the", "POST", "data", "and", "retrieves", "the", "values", "it", "needs", ".", "It", "does", "not", "set", "the", "value", "yet", "though", "but", "simply", "returns", "it", ".", "Needs", "to", "be", "explicitly"...
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/parameters.py#L575-L580
proycon/clam
clam/common/parameters.py
IntegerParameter.set
def set(self, value): """This parameter method attempts to set a specific value for this parameter. The value will be validated first, and if it can not be set. An error message will be set in the error property of this parameter""" if self.validate(value): #print "Parameter " + self.id + " ...
python
def set(self, value): """This parameter method attempts to set a specific value for this parameter. The value will be validated first, and if it can not be set. An error message will be set in the error property of this parameter""" if self.validate(value): #print "Parameter " + self.id + " ...
[ "def", "set", "(", "self", ",", "value", ")", ":", "if", "self", ".", "validate", "(", "value", ")", ":", "#print \"Parameter \" + self.id + \" successfully set to \" + repr(value)", "self", ".", "hasvalue", "=", "True", "if", "isinstance", "(", "value", ",", "f...
This parameter method attempts to set a specific value for this parameter. The value will be validated first, and if it can not be set. An error message will be set in the error property of this parameter
[ "This", "parameter", "method", "attempts", "to", "set", "a", "specific", "value", "for", "this", "parameter", ".", "The", "value", "will", "be", "validated", "first", "and", "if", "it", "can", "not", "be", "set", ".", "An", "error", "message", "will", "b...
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/parameters.py#L582-L594
proycon/clam
clam/common/parameters.py
FloatParameter.valuefrompostdata
def valuefrompostdata(self, postdata): """This parameter method searches the POST data and retrieves the values it needs. It does not set the value yet though, but simply returns it. Needs to be explicitly passed to parameter.set()""" if self.id in postdata and postdata[self.id] != '': retur...
python
def valuefrompostdata(self, postdata): """This parameter method searches the POST data and retrieves the values it needs. It does not set the value yet though, but simply returns it. Needs to be explicitly passed to parameter.set()""" if self.id in postdata and postdata[self.id] != '': retur...
[ "def", "valuefrompostdata", "(", "self", ",", "postdata", ")", ":", "if", "self", ".", "id", "in", "postdata", "and", "postdata", "[", "self", ".", "id", "]", "!=", "''", ":", "return", "float", "(", "postdata", "[", "self", ".", "id", "]", ")", "e...
This parameter method searches the POST data and retrieves the values it needs. It does not set the value yet though, but simply returns it. Needs to be explicitly passed to parameter.set()
[ "This", "parameter", "method", "searches", "the", "POST", "data", "and", "retrieves", "the", "values", "it", "needs", ".", "It", "does", "not", "set", "the", "value", "yet", "though", "but", "simply", "returns", "it", ".", "Needs", "to", "be", "explicitly"...
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/parameters.py#L648-L653
proycon/clam
clam/clamservice.py
index
def index(credentials = None): """Get list of projects or shortcut to other functionality""" #handle shortcut shortcutresponse = entryshortcut(credentials) if shortcutresponse is not None: return shortcutresponse projects = [] user, oauth_access_token = parsecredentials(credentials) ...
python
def index(credentials = None): """Get list of projects or shortcut to other functionality""" #handle shortcut shortcutresponse = entryshortcut(credentials) if shortcutresponse is not None: return shortcutresponse projects = [] user, oauth_access_token = parsecredentials(credentials) ...
[ "def", "index", "(", "credentials", "=", "None", ")", ":", "#handle shortcut", "shortcutresponse", "=", "entryshortcut", "(", "credentials", ")", "if", "shortcutresponse", "is", "not", "None", ":", "return", "shortcutresponse", "projects", "=", "[", "]", "user",...
Get list of projects or shortcut to other functionality
[ "Get", "list", "of", "projects", "or", "shortcut", "to", "other", "functionality" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/clamservice.py#L364-L418
proycon/clam
clam/clamservice.py
addfile
def addfile(project, filename, user, postdata, inputsource=None,returntype='xml'): #pylint: disable=too-many-return-statements """Add a new input file, this invokes the actual uploader""" def errorresponse(msg, code=403): if returntype == 'json': return withheaders(flask.make_response("{su...
python
def addfile(project, filename, user, postdata, inputsource=None,returntype='xml'): #pylint: disable=too-many-return-statements """Add a new input file, this invokes the actual uploader""" def errorresponse(msg, code=403): if returntype == 'json': return withheaders(flask.make_response("{su...
[ "def", "addfile", "(", "project", ",", "filename", ",", "user", ",", "postdata", ",", "inputsource", "=", "None", ",", "returntype", "=", "'xml'", ")", ":", "#pylint: disable=too-many-return-statements", "def", "errorresponse", "(", "msg", ",", "code", "=", "4...
Add a new input file, this invokes the actual uploader
[ "Add", "a", "new", "input", "file", "this", "invokes", "the", "actual", "uploader" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/clamservice.py#L1547-L2069
proycon/clam
clam/clamservice.py
uploader
def uploader(project, credentials=None): """The Uploader is intended for the Fine Uploader used in the web application (or similar frontend), it is not intended for proper RESTful communication. Will return JSON compatible with Fine Uploader rather than CLAM Upload XML. Unfortunately, normal digest authentication d...
python
def uploader(project, credentials=None): """The Uploader is intended for the Fine Uploader used in the web application (or similar frontend), it is not intended for proper RESTful communication. Will return JSON compatible with Fine Uploader rather than CLAM Upload XML. Unfortunately, normal digest authentication d...
[ "def", "uploader", "(", "project", ",", "credentials", "=", "None", ")", ":", "postdata", "=", "flask", ".", "request", ".", "values", "if", "'user'", "in", "postdata", ":", "user", "=", "postdata", "[", "'user'", "]", "else", ":", "user", "=", "'anony...
The Uploader is intended for the Fine Uploader used in the web application (or similar frontend), it is not intended for proper RESTful communication. Will return JSON compatible with Fine Uploader rather than CLAM Upload XML. Unfortunately, normal digest authentication does not work well with the uploader, so we imple...
[ "The", "Uploader", "is", "intended", "for", "the", "Fine", "Uploader", "used", "in", "the", "web", "application", "(", "or", "similar", "frontend", ")", "it", "is", "not", "intended", "for", "proper", "RESTful", "communication", ".", "Will", "return", "JSON"...
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/clamservice.py#L2099-L2120
proycon/clam
clam/clamservice.py
run_wsgi
def run_wsgi(settings_module): """Run CLAM in WSGI mode""" global settingsmodule, DEBUG #pylint: disable=global-statement printdebug("Initialising WSGI service") globals()['settings'] = settings_module settingsmodule = settings_module.__name__ try: if settings.DEBUG: DEBUG ...
python
def run_wsgi(settings_module): """Run CLAM in WSGI mode""" global settingsmodule, DEBUG #pylint: disable=global-statement printdebug("Initialising WSGI service") globals()['settings'] = settings_module settingsmodule = settings_module.__name__ try: if settings.DEBUG: DEBUG ...
[ "def", "run_wsgi", "(", "settings_module", ")", ":", "global", "settingsmodule", ",", "DEBUG", "#pylint: disable=global-statement", "printdebug", "(", "\"Initialising WSGI service\"", ")", "globals", "(", ")", "[", "'settings'", "]", "=", "settings_module", "settingsmod...
Run CLAM in WSGI mode
[ "Run", "CLAM", "in", "WSGI", "mode" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/clamservice.py#L2895-L2927
proycon/clam
clam/clamservice.py
Admin.index
def index(credentials=None): """Get list of projects""" user, oauth_access_token = parsecredentials(credentials) if not settings.ADMINS or user not in settings.ADMINS: return flask.make_response('You shall not pass!!! You are not an administrator!',403) usersprojects = {} ...
python
def index(credentials=None): """Get list of projects""" user, oauth_access_token = parsecredentials(credentials) if not settings.ADMINS or user not in settings.ADMINS: return flask.make_response('You shall not pass!!! You are not an administrator!',403) usersprojects = {} ...
[ "def", "index", "(", "credentials", "=", "None", ")", ":", "user", ",", "oauth_access_token", "=", "parsecredentials", "(", "credentials", ")", "if", "not", "settings", ".", "ADMINS", "or", "user", "not", "in", "settings", ".", "ADMINS", ":", "return", "fl...
Get list of projects
[ "Get", "list", "of", "projects" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/clamservice.py#L473-L501
proycon/clam
clam/clamservice.py
Project.path
def path(project, credentials): """Get the path to the project (static method)""" user, oauth_access_token = parsecredentials(credentials) #pylint: disable=unused-variable return settings.ROOT + "projects/" + user + '/' + project + "/"
python
def path(project, credentials): """Get the path to the project (static method)""" user, oauth_access_token = parsecredentials(credentials) #pylint: disable=unused-variable return settings.ROOT + "projects/" + user + '/' + project + "/"
[ "def", "path", "(", "project", ",", "credentials", ")", ":", "user", ",", "oauth_access_token", "=", "parsecredentials", "(", "credentials", ")", "#pylint: disable=unused-variable", "return", "settings", ".", "ROOT", "+", "\"projects/\"", "+", "user", "+", "'/'", ...
Get the path to the project (static method)
[ "Get", "the", "path", "to", "the", "project", "(", "static", "method", ")" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/clamservice.py#L620-L623
proycon/clam
clam/clamservice.py
Project.create
def create(project, credentials): #pylint: disable=too-many-return-statements """Create project skeleton if it does not already exist (static method)""" if not settings.COMMAND: return flask.make_response("Projects disabled, no command configured",404) user, oauth_access_token = pa...
python
def create(project, credentials): #pylint: disable=too-many-return-statements """Create project skeleton if it does not already exist (static method)""" if not settings.COMMAND: return flask.make_response("Projects disabled, no command configured",404) user, oauth_access_token = pa...
[ "def", "create", "(", "project", ",", "credentials", ")", ":", "#pylint: disable=too-many-return-statements", "if", "not", "settings", ".", "COMMAND", ":", "return", "flask", ".", "make_response", "(", "\"Projects disabled, no command configured\"", ",", "404", ")", "...
Create project skeleton if it does not already exist (static method)
[ "Create", "project", "skeleton", "if", "it", "does", "not", "already", "exist", "(", "static", "method", ")" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/clamservice.py#L638-L685
proycon/clam
clam/clamservice.py
Project.exists
def exists(project, credentials): """Check if the project exists""" user, oauth_access_token = parsecredentials(credentials) #pylint: disable=unused-variable printdebug("Checking if project " + project + " exists for " + user) return os.path.isdir(Project.path(project, user))
python
def exists(project, credentials): """Check if the project exists""" user, oauth_access_token = parsecredentials(credentials) #pylint: disable=unused-variable printdebug("Checking if project " + project + " exists for " + user) return os.path.isdir(Project.path(project, user))
[ "def", "exists", "(", "project", ",", "credentials", ")", ":", "user", ",", "oauth_access_token", "=", "parsecredentials", "(", "credentials", ")", "#pylint: disable=unused-variable", "printdebug", "(", "\"Checking if project \"", "+", "project", "+", "\" exists for \""...
Check if the project exists
[ "Check", "if", "the", "project", "exists" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/clamservice.py#L748-L752
proycon/clam
clam/clamservice.py
Project.inputindexbytemplate
def inputindexbytemplate(project, user, inputtemplate): """Retrieve sorted index for the specified input template""" index = [] #pylint: disable=redefined-outer-name prefix = Project.path(project, user) + 'input/' for linkf, f in globsymlinks(prefix + '.*.INPUTTEMPLATE.' + inputtemplate....
python
def inputindexbytemplate(project, user, inputtemplate): """Retrieve sorted index for the specified input template""" index = [] #pylint: disable=redefined-outer-name prefix = Project.path(project, user) + 'input/' for linkf, f in globsymlinks(prefix + '.*.INPUTTEMPLATE.' + inputtemplate....
[ "def", "inputindexbytemplate", "(", "project", ",", "user", ",", "inputtemplate", ")", ":", "index", "=", "[", "]", "#pylint: disable=redefined-outer-name", "prefix", "=", "Project", ".", "path", "(", "project", ",", "user", ")", "+", "'input/'", "for", "linkf...
Retrieve sorted index for the specified input template
[ "Retrieve", "sorted", "index", "for", "the", "specified", "input", "template" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/clamservice.py#L869-L879
proycon/clam
clam/clamservice.py
Project.outputindexbytemplate
def outputindexbytemplate(project, user, outputtemplate): """Retrieve sorted index for the specified input template""" index = [] #pylint: disable=redefined-outer-name prefix = Project.path(project, user) + 'output/' for linkf, f in globsymlinks(prefix + '.*.OUTPUTTEMPLATE.' + outputtemp...
python
def outputindexbytemplate(project, user, outputtemplate): """Retrieve sorted index for the specified input template""" index = [] #pylint: disable=redefined-outer-name prefix = Project.path(project, user) + 'output/' for linkf, f in globsymlinks(prefix + '.*.OUTPUTTEMPLATE.' + outputtemp...
[ "def", "outputindexbytemplate", "(", "project", ",", "user", ",", "outputtemplate", ")", ":", "index", "=", "[", "]", "#pylint: disable=redefined-outer-name", "prefix", "=", "Project", ".", "path", "(", "project", ",", "user", ")", "+", "'output/'", "for", "li...
Retrieve sorted index for the specified input template
[ "Retrieve", "sorted", "index", "for", "the", "specified", "input", "template" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/clamservice.py#L883-L893
proycon/clam
clam/clamservice.py
Project.get
def get(project, credentials=None): """Main Get method: Get project state, parameters, outputindex""" user, oauth_access_token = parsecredentials(credentials) if not Project.exists(project, user): return withheaders(flask.make_response("Project " + project + " was not found for user ...
python
def get(project, credentials=None): """Main Get method: Get project state, parameters, outputindex""" user, oauth_access_token = parsecredentials(credentials) if not Project.exists(project, user): return withheaders(flask.make_response("Project " + project + " was not found for user ...
[ "def", "get", "(", "project", ",", "credentials", "=", "None", ")", ":", "user", ",", "oauth_access_token", "=", "parsecredentials", "(", "credentials", ")", "if", "not", "Project", ".", "exists", "(", "project", ",", "user", ")", ":", "return", "withheade...
Main Get method: Get project state, parameters, outputindex
[ "Main", "Get", "method", ":", "Get", "project", "state", "parameters", "outputindex" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/clamservice.py#L994-L1017
proycon/clam
clam/clamservice.py
Project.new
def new(project, credentials=None): """Create an empty project""" user, oauth_access_token = parsecredentials(credentials) response = Project.create(project, user) if response is not None: return response msg = "Project " + project + " has been created for user " + us...
python
def new(project, credentials=None): """Create an empty project""" user, oauth_access_token = parsecredentials(credentials) response = Project.create(project, user) if response is not None: return response msg = "Project " + project + " has been created for user " + us...
[ "def", "new", "(", "project", ",", "credentials", "=", "None", ")", ":", "user", ",", "oauth_access_token", "=", "parsecredentials", "(", "credentials", ")", "response", "=", "Project", ".", "create", "(", "project", ",", "user", ")", "if", "response", "is...
Create an empty project
[ "Create", "an", "empty", "project" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/clamservice.py#L1021-L1032
proycon/clam
clam/clamservice.py
Project.start
def start(project, credentials=None): #pylint: disable=too-many-return-statements """Start execution""" #handle shortcut shortcutresponse = entryshortcut(credentials, True) #protected against endless recursion, will return None when no shortcut is found, True when one is found and starting shou...
python
def start(project, credentials=None): #pylint: disable=too-many-return-statements """Start execution""" #handle shortcut shortcutresponse = entryshortcut(credentials, True) #protected against endless recursion, will return None when no shortcut is found, True when one is found and starting shou...
[ "def", "start", "(", "project", ",", "credentials", "=", "None", ")", ":", "#pylint: disable=too-many-return-statements", "#handle shortcut", "shortcutresponse", "=", "entryshortcut", "(", "credentials", ",", "True", ")", "#protected against endless recursion, will return Non...
Start execution
[ "Start", "execution" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/clamservice.py#L1035-L1150
proycon/clam
clam/clamservice.py
Project.deleteoutputfile
def deleteoutputfile(project, filename, credentials=None): """Delete an output file""" user, oauth_access_token = parsecredentials(credentials) #pylint: disable=unused-variable if filename: filename = filename.replace("..","") #Simple security if not filename or len(filename) == 0: ...
python
def deleteoutputfile(project, filename, credentials=None): """Delete an output file""" user, oauth_access_token = parsecredentials(credentials) #pylint: disable=unused-variable if filename: filename = filename.replace("..","") #Simple security if not filename or len(filename) == 0: ...
[ "def", "deleteoutputfile", "(", "project", ",", "filename", ",", "credentials", "=", "None", ")", ":", "user", ",", "oauth_access_token", "=", "parsecredentials", "(", "credentials", ")", "#pylint: disable=unused-variable", "if", "filename", ":", "filename", "=", ...
Delete an output file
[ "Delete", "an", "output", "file" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/clamservice.py#L1280-L1307
proycon/clam
clam/clamservice.py
Project.reset
def reset(project, user): """Reset system, delete all output files and prepare for a new run""" d = Project.path(project, user) + "output" if os.path.isdir(d): shutil.rmtree(d) os.makedirs(d) else: raise flask.abort(404) if os.path.exists(Proje...
python
def reset(project, user): """Reset system, delete all output files and prepare for a new run""" d = Project.path(project, user) + "output" if os.path.isdir(d): shutil.rmtree(d) os.makedirs(d) else: raise flask.abort(404) if os.path.exists(Proje...
[ "def", "reset", "(", "project", ",", "user", ")", ":", "d", "=", "Project", ".", "path", "(", "project", ",", "user", ")", "+", "\"output\"", "if", "os", ".", "path", ".", "isdir", "(", "d", ")", ":", "shutil", ".", "rmtree", "(", "d", ")", "os...
Reset system, delete all output files and prepare for a new run
[ "Reset", "system", "delete", "all", "output", "files", "and", "prepare", "for", "a", "new", "run" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/clamservice.py#L1311-L1322
proycon/clam
clam/clamservice.py
Project.getarchive
def getarchive(project, user, format=None): """Generates and returns a download package (or 403 if one is already in the process of being prepared)""" if os.path.isfile(Project.path(project, user) + '.download'): #make sure we don't start two compression processes at the same time ...
python
def getarchive(project, user, format=None): """Generates and returns a download package (or 403 if one is already in the process of being prepared)""" if os.path.isfile(Project.path(project, user) + '.download'): #make sure we don't start two compression processes at the same time ...
[ "def", "getarchive", "(", "project", ",", "user", ",", "format", "=", "None", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "Project", ".", "path", "(", "project", ",", "user", ")", "+", "'.download'", ")", ":", "#make sure we don't start two co...
Generates and returns a download package (or 403 if one is already in the process of being prepared)
[ "Generates", "and", "returns", "a", "download", "package", "(", "or", "403", "if", "one", "is", "already", "in", "the", "process", "of", "being", "prepared", ")" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/clamservice.py#L1325-L1386
proycon/clam
clam/clamservice.py
Project.deleteinputfile
def deleteinputfile(project, filename, credentials=None): """Delete an input file""" user, oauth_access_token = parsecredentials(credentials) #pylint: disable=unused-variable filename = filename.replace("..","") #Simple security if len(filename) == 0: #Deleting all input fi...
python
def deleteinputfile(project, filename, credentials=None): """Delete an input file""" user, oauth_access_token = parsecredentials(credentials) #pylint: disable=unused-variable filename = filename.replace("..","") #Simple security if len(filename) == 0: #Deleting all input fi...
[ "def", "deleteinputfile", "(", "project", ",", "filename", ",", "credentials", "=", "None", ")", ":", "user", ",", "oauth_access_token", "=", "parsecredentials", "(", "credentials", ")", "#pylint: disable=unused-variable", "filename", "=", "filename", ".", "replace"...
Delete an input file
[ "Delete", "an", "input", "file" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/clamservice.py#L1447-L1473
proycon/clam
clam/clamservice.py
Project.addinputfile
def addinputfile(project, filename, credentials=None): #pylint: disable=too-many-return-statements """Add a new input file, this invokes the actual uploader""" printdebug('Addinputfile: Initialising' ) user, oauth_access_token = parsecredentials(credentials) #pylint: disable=unused-variable ...
python
def addinputfile(project, filename, credentials=None): #pylint: disable=too-many-return-statements """Add a new input file, this invokes the actual uploader""" printdebug('Addinputfile: Initialising' ) user, oauth_access_token = parsecredentials(credentials) #pylint: disable=unused-variable ...
[ "def", "addinputfile", "(", "project", ",", "filename", ",", "credentials", "=", "None", ")", ":", "#pylint: disable=too-many-return-statements", "printdebug", "(", "'Addinputfile: Initialising'", ")", "user", ",", "oauth_access_token", "=", "parsecredentials", "(", "cr...
Add a new input file, this invokes the actual uploader
[ "Add", "a", "new", "input", "file", "this", "invokes", "the", "actual", "uploader" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/clamservice.py#L1481-L1543
proycon/clam
clam/clamservice.py
CLAMService.corpusindex
def corpusindex(): """Get list of pre-installed corpora""" corpora = [] for f in glob.glob(settings.ROOT + "corpora/*"): if os.path.isdir(f): corpora.append(os.path.basename(f)) return corpora
python
def corpusindex(): """Get list of pre-installed corpora""" corpora = [] for f in glob.glob(settings.ROOT + "corpora/*"): if os.path.isdir(f): corpora.append(os.path.basename(f)) return corpora
[ "def", "corpusindex", "(", ")", ":", "corpora", "=", "[", "]", "for", "f", "in", "glob", ".", "glob", "(", "settings", ".", "ROOT", "+", "\"corpora/*\"", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "f", ")", ":", "corpora", ".", "append...
Get list of pre-installed corpora
[ "Get", "list", "of", "pre", "-", "installed", "corpora" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/clamservice.py#L2552-L2558
proycon/clam
clam/common/auth.py
NonceMemory.validate
def validate(self, nonce): """Does the nonce exist and is it valid for the request?""" if self.debug: print("Checking nonce " + str(nonce),file=sys.stderr) try: opaque, ip, expiretime = self.get(nonce) #pylint: disable=unused-variable if expiretime < time.time(): ...
python
def validate(self, nonce): """Does the nonce exist and is it valid for the request?""" if self.debug: print("Checking nonce " + str(nonce),file=sys.stderr) try: opaque, ip, expiretime = self.get(nonce) #pylint: disable=unused-variable if expiretime < time.time(): ...
[ "def", "validate", "(", "self", ",", "nonce", ")", ":", "if", "self", ".", "debug", ":", "print", "(", "\"Checking nonce \"", "+", "str", "(", "nonce", ")", ",", "file", "=", "sys", ".", "stderr", ")", "try", ":", "opaque", ",", "ip", ",", "expiret...
Does the nonce exist and is it valid for the request?
[ "Does", "the", "nonce", "exist", "and", "is", "it", "valid", "for", "the", "request?" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/auth.py#L463-L480
proycon/clam
clam/common/auth.py
NonceMemory.cleanup
def cleanup(self): """Delete expired nonces""" t = time.time() for noncefile in glob(self.path + '/*.nonce'): if os.path.getmtime(noncefile) + self.expiration > t: os.unlink(noncefile)
python
def cleanup(self): """Delete expired nonces""" t = time.time() for noncefile in glob(self.path + '/*.nonce'): if os.path.getmtime(noncefile) + self.expiration > t: os.unlink(noncefile)
[ "def", "cleanup", "(", "self", ")", ":", "t", "=", "time", ".", "time", "(", ")", "for", "noncefile", "in", "glob", "(", "self", ".", "path", "+", "'/*.nonce'", ")", ":", "if", "os", ".", "path", ".", "getmtime", "(", "noncefile", ")", "+", "self...
Delete expired nonces
[ "Delete", "expired", "nonces" ]
train
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/auth.py#L503-L508
guillermo-carrasco/bcbio-nextgen-monitor
bcbio_monitor/analysis/__init__.py
RunData.json
def json(self): """Retrun JSON representation for this run""" return { "id": self.ID, "steps": self.steps, "graph_source": self.source, "errored": self.errored }
python
def json(self): """Retrun JSON representation for this run""" return { "id": self.ID, "steps": self.steps, "graph_source": self.source, "errored": self.errored }
[ "def", "json", "(", "self", ")", ":", "return", "{", "\"id\"", ":", "self", ".", "ID", ",", "\"steps\"", ":", "self", ".", "steps", ",", "\"graph_source\"", ":", "self", ".", "source", ",", "\"errored\"", ":", "self", ".", "errored", "}" ]
Retrun JSON representation for this run
[ "Retrun", "JSON", "representation", "for", "this", "run" ]
train
https://github.com/guillermo-carrasco/bcbio-nextgen-monitor/blob/6d059154d774140e1fd03a0e3625f607cef06f5a/bcbio_monitor/analysis/__init__.py#L31-L38
guillermo-carrasco/bcbio-nextgen-monitor
bcbio_monitor/analysis/__init__.py
AnalysisData.new_run
def new_run(self): """Creates a new RunData object and increments pointers""" self.current_run += 1 self.runs.append(RunData(self.current_run + 1))
python
def new_run(self): """Creates a new RunData object and increments pointers""" self.current_run += 1 self.runs.append(RunData(self.current_run + 1))
[ "def", "new_run", "(", "self", ")", ":", "self", ".", "current_run", "+=", "1", "self", ".", "runs", ".", "append", "(", "RunData", "(", "self", ".", "current_run", "+", "1", ")", ")" ]
Creates a new RunData object and increments pointers
[ "Creates", "a", "new", "RunData", "object", "and", "increments", "pointers" ]
train
https://github.com/guillermo-carrasco/bcbio-nextgen-monitor/blob/6d059154d774140e1fd03a0e3625f607cef06f5a/bcbio_monitor/analysis/__init__.py#L69-L72
guillermo-carrasco/bcbio-nextgen-monitor
bcbio_monitor/analysis/__init__.py
AnalysisData.follow_log
def follow_log(self): """Reads a logfile continuously and updates internal graph if new step is found""" # Server needs to be up and running before starting sending POST requests time.sleep(5) try: if self.remote: logger.debug('Logfile in remote host!') ...
python
def follow_log(self): """Reads a logfile continuously and updates internal graph if new step is found""" # Server needs to be up and running before starting sending POST requests time.sleep(5) try: if self.remote: logger.debug('Logfile in remote host!') ...
[ "def", "follow_log", "(", "self", ")", ":", "# Server needs to be up and running before starting sending POST requests", "time", ".", "sleep", "(", "5", ")", "try", ":", "if", "self", ".", "remote", ":", "logger", ".", "debug", "(", "'Logfile in remote host!'", ")",...
Reads a logfile continuously and updates internal graph if new step is found
[ "Reads", "a", "logfile", "continuously", "and", "updates", "internal", "graph", "if", "new", "step", "is", "found" ]
train
https://github.com/guillermo-carrasco/bcbio-nextgen-monitor/blob/6d059154d774140e1fd03a0e3625f607cef06f5a/bcbio_monitor/analysis/__init__.py#L75-L152
guillermo-carrasco/bcbio-nextgen-monitor
bcbio_monitor/analysis/__init__.py
AnalysisData.update_frontend
def update_frontend(self, info): """Updates frontend with info from the log :param info: dict - Information from a line in the log. i.e regular line, new step. """ headers = {'Content-Type': 'text/event-stream'} if info.get('when'): info['when'] = info['when'].isofor...
python
def update_frontend(self, info): """Updates frontend with info from the log :param info: dict - Information from a line in the log. i.e regular line, new step. """ headers = {'Content-Type': 'text/event-stream'} if info.get('when'): info['when'] = info['when'].isofor...
[ "def", "update_frontend", "(", "self", ",", "info", ")", ":", "headers", "=", "{", "'Content-Type'", ":", "'text/event-stream'", "}", "if", "info", ".", "get", "(", "'when'", ")", ":", "info", "[", "'when'", "]", "=", "info", "[", "'when'", "]", ".", ...
Updates frontend with info from the log :param info: dict - Information from a line in the log. i.e regular line, new step.
[ "Updates", "frontend", "with", "info", "from", "the", "log" ]
train
https://github.com/guillermo-carrasco/bcbio-nextgen-monitor/blob/6d059154d774140e1fd03a0e3625f607cef06f5a/bcbio_monitor/analysis/__init__.py#L155-L163
guillermo-carrasco/bcbio-nextgen-monitor
bcbio_monitor/analysis/__init__.py
AnalysisData.get_summary
def get_summary(self): """Returns some summary data for a finished analysis""" if not self.analysis_finished: return [] summary = {'times_summary': []} for i in range(len(self.runs[self.current_run].steps) - 1): step = self.runs[self.current_run].steps[i] ...
python
def get_summary(self): """Returns some summary data for a finished analysis""" if not self.analysis_finished: return [] summary = {'times_summary': []} for i in range(len(self.runs[self.current_run].steps) - 1): step = self.runs[self.current_run].steps[i] ...
[ "def", "get_summary", "(", "self", ")", ":", "if", "not", "self", ".", "analysis_finished", ":", "return", "[", "]", "summary", "=", "{", "'times_summary'", ":", "[", "]", "}", "for", "i", "in", "range", "(", "len", "(", "self", ".", "runs", "[", "...
Returns some summary data for a finished analysis
[ "Returns", "some", "summary", "data", "for", "a", "finished", "analysis" ]
train
https://github.com/guillermo-carrasco/bcbio-nextgen-monitor/blob/6d059154d774140e1fd03a0e3625f607cef06f5a/bcbio_monitor/analysis/__init__.py#L176-L187
i3visio/deepify
deepify/zeronet.py
Zeronet._grabContentFromUrl
def _grabContentFromUrl(self, url): """ Function that abstracts capturing a URL. This method rewrites the one from Wrapper. :param url: The URL to be processed. :return: The response in a Json format. """ # Defining an empty object for the res...
python
def _grabContentFromUrl(self, url): """ Function that abstracts capturing a URL. This method rewrites the one from Wrapper. :param url: The URL to be processed. :return: The response in a Json format. """ # Defining an empty object for the res...
[ "def", "_grabContentFromUrl", "(", "self", ",", "url", ")", ":", "# Defining an empty object for the response", "info", "=", "{", "}", "# This part has to be modified... ", "try", ":", "# Configuring the socket", "queryURL", "=", "\"http://\"", "+", "self", ".", ...
Function that abstracts capturing a URL. This method rewrites the one from Wrapper. :param url: The URL to be processed. :return: The response in a Json format.
[ "Function", "that", "abstracts", "capturing", "a", "URL", ".", "This", "method", "rewrites", "the", "one", "from", "Wrapper", ".", ":", "param", "url", ":", "The", "URL", "to", "be", "processed", ".", ":", "return", ":", "The", "response", "in", "a", "...
train
https://github.com/i3visio/deepify/blob/2af04e0bea3eaabe96b0565e10f7eeb29b042a2b/deepify/zeronet.py#L52-L81
harcokuppens/thonny-ev3dev
thonnycontrib/ev3dev/__init__.py
_handle_rundebug_from_shell
def _handle_rundebug_from_shell(cmd_line): """ Handles all commands that take a filename and 0 or more extra arguments. Passes the command to backend. (Debugger plugin may also use this method) """ command, args = parse_shell_command(cmd_line) if len(args) >= 1: get_workbench().get...
python
def _handle_rundebug_from_shell(cmd_line): """ Handles all commands that take a filename and 0 or more extra arguments. Passes the command to backend. (Debugger plugin may also use this method) """ command, args = parse_shell_command(cmd_line) if len(args) >= 1: get_workbench().get...
[ "def", "_handle_rundebug_from_shell", "(", "cmd_line", ")", ":", "command", ",", "args", "=", "parse_shell_command", "(", "cmd_line", ")", "if", "len", "(", "args", ")", ">=", "1", ":", "get_workbench", "(", ")", ".", "get_editor_notebook", "(", ")", ".", ...
Handles all commands that take a filename and 0 or more extra arguments. Passes the command to backend. (Debugger plugin may also use this method)
[ "Handles", "all", "commands", "that", "take", "a", "filename", "and", "0", "or", "more", "extra", "arguments", ".", "Passes", "the", "command", "to", "backend", "." ]
train
https://github.com/harcokuppens/thonny-ev3dev/blob/e3437d7716068976faf2146c6bb0332ed56a1760/thonnycontrib/ev3dev/__init__.py#L326-L364
harcokuppens/thonny-ev3dev
thonnycontrib/ev3dev/__init__.py
upload_current_script
def upload_current_script(): """upload current python script to EV3""" current_editor = get_workbench().get_editor_notebook().get_current_editor() code = current_editor.get_text_widget().get("1.0", "end") try: filename= current_editor.get_filename() if (not filename) or (not filename.end...
python
def upload_current_script(): """upload current python script to EV3""" current_editor = get_workbench().get_editor_notebook().get_current_editor() code = current_editor.get_text_widget().get("1.0", "end") try: filename= current_editor.get_filename() if (not filename) or (not filename.end...
[ "def", "upload_current_script", "(", ")", ":", "current_editor", "=", "get_workbench", "(", ")", ".", "get_editor_notebook", "(", ")", ".", "get_current_editor", "(", ")", "code", "=", "current_editor", ".", "get_text_widget", "(", ")", ".", "get", "(", "\"1.0...
upload current python script to EV3
[ "upload", "current", "python", "script", "to", "EV3" ]
train
https://github.com/harcokuppens/thonny-ev3dev/blob/e3437d7716068976faf2146c6bb0332ed56a1760/thonnycontrib/ev3dev/__init__.py#L407-L433
harcokuppens/thonny-ev3dev
thonnycontrib/ev3dev/__init__.py
start_current_script
def start_current_script(): """upload current python script to EV3""" current_editor = get_workbench().get_editor_notebook().get_current_editor() code = current_editor.get_text_widget().get("1.0", "end") try: ast.parse(code) #Return None, if script is not saved and user closed file savin...
python
def start_current_script(): """upload current python script to EV3""" current_editor = get_workbench().get_editor_notebook().get_current_editor() code = current_editor.get_text_widget().get("1.0", "end") try: ast.parse(code) #Return None, if script is not saved and user closed file savin...
[ "def", "start_current_script", "(", ")", ":", "current_editor", "=", "get_workbench", "(", ")", ".", "get_editor_notebook", "(", ")", ".", "get_current_editor", "(", ")", "code", "=", "current_editor", ".", "get_text_widget", "(", ")", ".", "get", "(", "\"1.0\...
upload current python script to EV3
[ "upload", "current", "python", "script", "to", "EV3" ]
train
https://github.com/harcokuppens/thonny-ev3dev/blob/e3437d7716068976faf2146c6bb0332ed56a1760/thonnycontrib/ev3dev/__init__.py#L457-L470
harcokuppens/thonny-ev3dev
thonnycontrib/ev3dev/__init__.py
download_log
def download_log(currentfile=None): """downloads log of given .py file from EV3.""" if currentfile == None: return # add ".err.log" if file doesn't end with it! if not currentfile.endswith(".err.log"): currentfile=currentfile + ".err.log" list = get_base_ev3dev_cmd() + ['d...
python
def download_log(currentfile=None): """downloads log of given .py file from EV3.""" if currentfile == None: return # add ".err.log" if file doesn't end with it! if not currentfile.endswith(".err.log"): currentfile=currentfile + ".err.log" list = get_base_ev3dev_cmd() + ['d...
[ "def", "download_log", "(", "currentfile", "=", "None", ")", ":", "if", "currentfile", "==", "None", ":", "return", "# add \".err.log\" if file doesn't end with it!", "if", "not", "currentfile", ".", "endswith", "(", "\".err.log\"", ")", ":", "currentfile", "=", "...
downloads log of given .py file from EV3.
[ "downloads", "log", "of", "given", ".", "py", "file", "from", "EV3", "." ]
train
https://github.com/harcokuppens/thonny-ev3dev/blob/e3437d7716068976faf2146c6bb0332ed56a1760/thonnycontrib/ev3dev/__init__.py#L473-L495
harcokuppens/thonny-ev3dev
thonnycontrib/ev3dev/__init__.py
download_log_of_current_script
def download_log_of_current_script(): """download log of current python script from EV3""" try: #Return None, if script is not saved and user closed file saving window, otherwise return file name. src_file = get_workbench().get_current_editor().get_filename(False) if src_file is None: ...
python
def download_log_of_current_script(): """download log of current python script from EV3""" try: #Return None, if script is not saved and user closed file saving window, otherwise return file name. src_file = get_workbench().get_current_editor().get_filename(False) if src_file is None: ...
[ "def", "download_log_of_current_script", "(", ")", ":", "try", ":", "#Return None, if script is not saved and user closed file saving window, otherwise return file name.", "src_file", "=", "get_workbench", "(", ")", ".", "get_current_editor", "(", ")", ".", "get_filename", "(",...
download log of current python script from EV3
[ "download", "log", "of", "current", "python", "script", "from", "EV3" ]
train
https://github.com/harcokuppens/thonny-ev3dev/blob/e3437d7716068976faf2146c6bb0332ed56a1760/thonnycontrib/ev3dev/__init__.py#L528-L539
harcokuppens/thonny-ev3dev
thonnycontrib/ev3dev/__init__.py
cleanup_files_on_ev3
def cleanup_files_on_ev3(): """cleanup files in homedir on EV3.""" list = get_base_ev3dev_cmd() + ['cleanup'] env = os.environ.copy() env["PYTHONUSERBASE"] = THONNY_USER_BASE proc = subprocess.Popen(list, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newli...
python
def cleanup_files_on_ev3(): """cleanup files in homedir on EV3.""" list = get_base_ev3dev_cmd() + ['cleanup'] env = os.environ.copy() env["PYTHONUSERBASE"] = THONNY_USER_BASE proc = subprocess.Popen(list, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newli...
[ "def", "cleanup_files_on_ev3", "(", ")", ":", "list", "=", "get_base_ev3dev_cmd", "(", ")", "+", "[", "'cleanup'", "]", "env", "=", "os", ".", "environ", ".", "copy", "(", ")", "env", "[", "\"PYTHONUSERBASE\"", "]", "=", "THONNY_USER_BASE", "proc", "=", ...
cleanup files in homedir on EV3.
[ "cleanup", "files", "in", "homedir", "on", "EV3", "." ]
train
https://github.com/harcokuppens/thonny-ev3dev/blob/e3437d7716068976faf2146c6bb0332ed56a1760/thonnycontrib/ev3dev/__init__.py#L541-L551
harcokuppens/thonny-ev3dev
thonnycontrib/ev3dev/__init__.py
load_plugin
def load_plugin(): """Adds EV3 buttons on toolbar and commands under Run and Tools menu. Add EV3 configuration window.""" # Add EV3 configuration window workbench=get_workbench() workbench.set_default("ev3.ip", "192.168.0.1") workbench.set_default("ev3.username", "robot") workbench.set_default(...
python
def load_plugin(): """Adds EV3 buttons on toolbar and commands under Run and Tools menu. Add EV3 configuration window.""" # Add EV3 configuration window workbench=get_workbench() workbench.set_default("ev3.ip", "192.168.0.1") workbench.set_default("ev3.username", "robot") workbench.set_default(...
[ "def", "load_plugin", "(", ")", ":", "# Add EV3 configuration window", "workbench", "=", "get_workbench", "(", ")", "workbench", ".", "set_default", "(", "\"ev3.ip\"", ",", "\"192.168.0.1\"", ")", "workbench", ".", "set_default", "(", "\"ev3.username\"", ",", "\"rob...
Adds EV3 buttons on toolbar and commands under Run and Tools menu. Add EV3 configuration window.
[ "Adds", "EV3", "buttons", "on", "toolbar", "and", "commands", "under", "Run", "and", "Tools", "menu", ".", "Add", "EV3", "configuration", "window", "." ]
train
https://github.com/harcokuppens/thonny-ev3dev/blob/e3437d7716068976faf2146c6bb0332ed56a1760/thonnycontrib/ev3dev/__init__.py#L686-L808
jasonkeene/python-ubersmith
ubersmith/__init__.py
init
def init(base_url, username=None, password=None, verify=True): """Initialize ubersmith API module with HTTP request handler.""" handler = RequestHandler(base_url, username, password, verify) set_default_request_handler(handler) return handler
python
def init(base_url, username=None, password=None, verify=True): """Initialize ubersmith API module with HTTP request handler.""" handler = RequestHandler(base_url, username, password, verify) set_default_request_handler(handler) return handler
[ "def", "init", "(", "base_url", ",", "username", "=", "None", ",", "password", "=", "None", ",", "verify", "=", "True", ")", ":", "handler", "=", "RequestHandler", "(", "base_url", ",", "username", ",", "password", ",", "verify", ")", "set_default_request_...
Initialize ubersmith API module with HTTP request handler.
[ "Initialize", "ubersmith", "API", "module", "with", "HTTP", "request", "handler", "." ]
train
https://github.com/jasonkeene/python-ubersmith/blob/0c594e2eb41066d1fe7860e3a6f04b14c14f6e6a/ubersmith/__init__.py#L34-L38
i3visio/deepify
deepify/utils/configuration.py
getConfigPath
def getConfigPath(configFileName = None): """ Auxiliar function to get the configuration path depending on the system. """ if configFileName != None: # Returning the path of the configuration file if sys.platform == 'win32': return os.path.expanduser(os.path.join('~\\', '...
python
def getConfigPath(configFileName = None): """ Auxiliar function to get the configuration path depending on the system. """ if configFileName != None: # Returning the path of the configuration file if sys.platform == 'win32': return os.path.expanduser(os.path.join('~\\', '...
[ "def", "getConfigPath", "(", "configFileName", "=", "None", ")", ":", "if", "configFileName", "!=", "None", ":", "# Returning the path of the configuration file", "if", "sys", ".", "platform", "==", "'win32'", ":", "return", "os", ".", "path", ".", "expanduser", ...
Auxiliar function to get the configuration path depending on the system.
[ "Auxiliar", "function", "to", "get", "the", "configuration", "path", "depending", "on", "the", "system", "." ]
train
https://github.com/i3visio/deepify/blob/2af04e0bea3eaabe96b0565e10f7eeb29b042a2b/deepify/utils/configuration.py#L59-L74
i3visio/deepify
deepify/utils/configuration.py
getConfiguration
def getConfiguration(configPath = None): """ Reading the configuration file to look for where the different gates are running. :return: A json containing the information stored in the .cfg file. """ if configPath == None: # If a current.cfg has not been found, creating it by...
python
def getConfiguration(configPath = None): """ Reading the configuration file to look for where the different gates are running. :return: A json containing the information stored in the .cfg file. """ if configPath == None: # If a current.cfg has not been found, creating it by...
[ "def", "getConfiguration", "(", "configPath", "=", "None", ")", ":", "if", "configPath", "==", "None", ":", "# If a current.cfg has not been found, creating it by copying from default", "configPath", "=", "getConfigPath", "(", "\"browser.cfg\"", ")", "# Checking if the config...
Reading the configuration file to look for where the different gates are running. :return: A json containing the information stored in the .cfg file.
[ "Reading", "the", "configuration", "file", "to", "look", "for", "where", "the", "different", "gates", "are", "running", ".", ":", "return", ":", "A", "json", "containing", "the", "information", "stored", "in", "the", ".", "cfg", "file", "." ]
train
https://github.com/i3visio/deepify/blob/2af04e0bea3eaabe96b0565e10f7eeb29b042a2b/deepify/utils/configuration.py#L76-L122
shmir/PyTrafficGenerator
trafficgenerator/tgn_utils.py
new_log_file
def new_log_file(logger, suffix, file_type='tcl'): """ Create new logger and log file from existing logger. The new logger will be create in the same directory as the existing logger file and will be named as the existing log file with the requested suffix. :param logger: existing logger :param su...
python
def new_log_file(logger, suffix, file_type='tcl'): """ Create new logger and log file from existing logger. The new logger will be create in the same directory as the existing logger file and will be named as the existing log file with the requested suffix. :param logger: existing logger :param su...
[ "def", "new_log_file", "(", "logger", ",", "suffix", ",", "file_type", "=", "'tcl'", ")", ":", "file_handler", "=", "None", "for", "handler", "in", "logger", ".", "handlers", ":", "if", "isinstance", "(", "handler", ",", "logging", ".", "FileHandler", ")",...
Create new logger and log file from existing logger. The new logger will be create in the same directory as the existing logger file and will be named as the existing log file with the requested suffix. :param logger: existing logger :param suffix: string to add to the existing log file name to create...
[ "Create", "new", "logger", "and", "log", "file", "from", "existing", "logger", "." ]
train
https://github.com/shmir/PyTrafficGenerator/blob/382e5d549c83404af2a6571fe19c9e71df8bac14/trafficgenerator/tgn_utils.py#L81-L104
jasonkeene/python-ubersmith
ubersmith/api.py
RequestHandler.process_request
def process_request(self, method, data=None): """Process request over HTTP to ubersmith instance. method: Ubersmith API method string data: dict of method arguments """ # make sure requested method is valid self._validate_request_method(method) # attemp...
python
def process_request(self, method, data=None): """Process request over HTTP to ubersmith instance. method: Ubersmith API method string data: dict of method arguments """ # make sure requested method is valid self._validate_request_method(method) # attemp...
[ "def", "process_request", "(", "self", ",", "method", ",", "data", "=", "None", ")", ":", "# make sure requested method is valid", "self", ".", "_validate_request_method", "(", "method", ")", "# attempt the request multiple times", "attempts", "=", "3", "for", "i", ...
Process request over HTTP to ubersmith instance. method: Ubersmith API method string data: dict of method arguments
[ "Process", "request", "over", "HTTP", "to", "ubersmith", "instance", "." ]
train
https://github.com/jasonkeene/python-ubersmith/blob/0c594e2eb41066d1fe7860e3a6f04b14c14f6e6a/ubersmith/api.py#L253-L292
jasonkeene/python-ubersmith
ubersmith/api.py
RequestHandler._encode_data
def _encode_data(data): """URL encode data.""" data = data if data is not None else {} data = to_nested_php_args(data) files = dict([ (key, value) for key, value in data.items() if isinstance(value, file_type)]) for fname in files: del data[fna...
python
def _encode_data(data): """URL encode data.""" data = data if data is not None else {} data = to_nested_php_args(data) files = dict([ (key, value) for key, value in data.items() if isinstance(value, file_type)]) for fname in files: del data[fna...
[ "def", "_encode_data", "(", "data", ")", ":", "data", "=", "data", "if", "data", "is", "not", "None", "else", "{", "}", "data", "=", "to_nested_php_args", "(", "data", ")", "files", "=", "dict", "(", "[", "(", "key", ",", "value", ")", "for", "key"...
URL encode data.
[ "URL", "encode", "data", "." ]
train
https://github.com/jasonkeene/python-ubersmith/blob/0c594e2eb41066d1fe7860e3a6f04b14c14f6e6a/ubersmith/api.py#L313-L322
shmir/PyTrafficGenerator
trafficgenerator/tgn_object.py
TgnObjectsDict.dumps
def dumps(self, indent=1): """ Returns nested string representation of the dictionary (like json.dumps). :param indent: indentation level. """ str_keys_dict = OrderedDict({str(k): v for k, v in self.items()}) for k, v in str_keys_dict.items(): if isinstance(v, dict)...
python
def dumps(self, indent=1): """ Returns nested string representation of the dictionary (like json.dumps). :param indent: indentation level. """ str_keys_dict = OrderedDict({str(k): v for k, v in self.items()}) for k, v in str_keys_dict.items(): if isinstance(v, dict)...
[ "def", "dumps", "(", "self", ",", "indent", "=", "1", ")", ":", "str_keys_dict", "=", "OrderedDict", "(", "{", "str", "(", "k", ")", ":", "v", "for", "k", ",", "v", "in", "self", ".", "items", "(", ")", "}", ")", "for", "k", ",", "v", "in", ...
Returns nested string representation of the dictionary (like json.dumps). :param indent: indentation level.
[ "Returns", "nested", "string", "representation", "of", "the", "dictionary", "(", "like", "json", ".", "dumps", ")", "." ]
train
https://github.com/shmir/PyTrafficGenerator/blob/382e5d549c83404af2a6571fe19c9e71df8bac14/trafficgenerator/tgn_object.py#L44-L57
shmir/PyTrafficGenerator
trafficgenerator/tgn_object.py
TgnObject.get_child
def get_child(self, *types): """ :param types: list of requested types. :return: the first (and in most useful cases only) child of specific type(s). """ children = list(self.get_children(*types)) return children[0] if any(children) else None
python
def get_child(self, *types): """ :param types: list of requested types. :return: the first (and in most useful cases only) child of specific type(s). """ children = list(self.get_children(*types)) return children[0] if any(children) else None
[ "def", "get_child", "(", "self", ",", "*", "types", ")", ":", "children", "=", "list", "(", "self", ".", "get_children", "(", "*", "types", ")", ")", "return", "children", "[", "0", "]", "if", "any", "(", "children", ")", "else", "None" ]
:param types: list of requested types. :return: the first (and in most useful cases only) child of specific type(s).
[ ":", "param", "types", ":", "list", "of", "requested", "types", ".", ":", "return", ":", "the", "first", "(", "and", "in", "most", "useful", "cases", "only", ")", "child", "of", "specific", "type", "(", "s", ")", "." ]
train
https://github.com/shmir/PyTrafficGenerator/blob/382e5d549c83404af2a6571fe19c9e71df8bac14/trafficgenerator/tgn_object.py#L109-L115
shmir/PyTrafficGenerator
trafficgenerator/tgn_object.py
TgnObject.get_objects_by_type
def get_objects_by_type(self, *types): """ Returned objects stored in memory (without re-reading them from the TGN). Use this method for fast access to objects in case of static configurations. :param types: requested object types. :return: all children of the specified types. ...
python
def get_objects_by_type(self, *types): """ Returned objects stored in memory (without re-reading them from the TGN). Use this method for fast access to objects in case of static configurations. :param types: requested object types. :return: all children of the specified types. ...
[ "def", "get_objects_by_type", "(", "self", ",", "*", "types", ")", ":", "if", "not", "types", ":", "return", "self", ".", "objects", ".", "values", "(", ")", "types_l", "=", "[", "o", ".", "lower", "(", ")", "for", "o", "in", "types", "]", "return"...
Returned objects stored in memory (without re-reading them from the TGN). Use this method for fast access to objects in case of static configurations. :param types: requested object types. :return: all children of the specified types.
[ "Returned", "objects", "stored", "in", "memory", "(", "without", "re", "-", "reading", "them", "from", "the", "TGN", ")", "." ]
train
https://github.com/shmir/PyTrafficGenerator/blob/382e5d549c83404af2a6571fe19c9e71df8bac14/trafficgenerator/tgn_object.py#L144-L156
shmir/PyTrafficGenerator
trafficgenerator/tgn_object.py
TgnObject.get_object_by_type
def get_object_by_type(self, *types): """ :param types: requested object types. :return: the child of the specified types. """ children = self.get_objects_by_type(*types) return children[0] if any(children) else None
python
def get_object_by_type(self, *types): """ :param types: requested object types. :return: the child of the specified types. """ children = self.get_objects_by_type(*types) return children[0] if any(children) else None
[ "def", "get_object_by_type", "(", "self", ",", "*", "types", ")", ":", "children", "=", "self", ".", "get_objects_by_type", "(", "*", "types", ")", "return", "children", "[", "0", "]", "if", "any", "(", "children", ")", "else", "None" ]
:param types: requested object types. :return: the child of the specified types.
[ ":", "param", "types", ":", "requested", "object", "types", ".", ":", "return", ":", "the", "child", "of", "the", "specified", "types", "." ]
train
https://github.com/shmir/PyTrafficGenerator/blob/382e5d549c83404af2a6571fe19c9e71df8bac14/trafficgenerator/tgn_object.py#L158-L164
shmir/PyTrafficGenerator
trafficgenerator/tgn_object.py
TgnObject.get_objects_by_type_in_subtree
def get_objects_by_type_in_subtree(self, *types): """ :param types: requested object types. :return: all children of the specified types. """ typed_objects = self.get_objects_by_type(*types) for child in self.objects.values(): typed_objects += child.get_objec...
python
def get_objects_by_type_in_subtree(self, *types): """ :param types: requested object types. :return: all children of the specified types. """ typed_objects = self.get_objects_by_type(*types) for child in self.objects.values(): typed_objects += child.get_objec...
[ "def", "get_objects_by_type_in_subtree", "(", "self", ",", "*", "types", ")", ":", "typed_objects", "=", "self", ".", "get_objects_by_type", "(", "*", "types", ")", "for", "child", "in", "self", ".", "objects", ".", "values", "(", ")", ":", "typed_objects", ...
:param types: requested object types. :return: all children of the specified types.
[ ":", "param", "types", ":", "requested", "object", "types", ".", ":", "return", ":", "all", "children", "of", "the", "specified", "types", "." ]
train
https://github.com/shmir/PyTrafficGenerator/blob/382e5d549c83404af2a6571fe19c9e71df8bac14/trafficgenerator/tgn_object.py#L166-L175
shmir/PyTrafficGenerator
trafficgenerator/tgn_object.py
TgnObject.get_objects_or_children_by_type
def get_objects_or_children_by_type(self, *types): """ Get objects if children already been read or get children. Use this method for fast access to objects in case of static configurations. :param types: requested object types. :return: all children of the specified types. """...
python
def get_objects_or_children_by_type(self, *types): """ Get objects if children already been read or get children. Use this method for fast access to objects in case of static configurations. :param types: requested object types. :return: all children of the specified types. """...
[ "def", "get_objects_or_children_by_type", "(", "self", ",", "*", "types", ")", ":", "objects", "=", "self", ".", "get_objects_by_type", "(", "*", "types", ")", "return", "objects", "if", "objects", "else", "self", ".", "get_children", "(", "*", "types", ")" ...
Get objects if children already been read or get children. Use this method for fast access to objects in case of static configurations. :param types: requested object types. :return: all children of the specified types.
[ "Get", "objects", "if", "children", "already", "been", "read", "or", "get", "children", "." ]
train
https://github.com/shmir/PyTrafficGenerator/blob/382e5d549c83404af2a6571fe19c9e71df8bac14/trafficgenerator/tgn_object.py#L177-L187
shmir/PyTrafficGenerator
trafficgenerator/tgn_object.py
TgnObject.get_object_or_child_by_type
def get_object_or_child_by_type(self, *types): """ Get object if child already been read or get child. Use this method for fast access to objects in case of static configurations. :param types: requested object types. :return: all children of the specified types. """ o...
python
def get_object_or_child_by_type(self, *types): """ Get object if child already been read or get child. Use this method for fast access to objects in case of static configurations. :param types: requested object types. :return: all children of the specified types. """ o...
[ "def", "get_object_or_child_by_type", "(", "self", ",", "*", "types", ")", ":", "objects", "=", "self", ".", "get_objects_or_children_by_type", "(", "*", "types", ")", "return", "objects", "[", "0", "]", "if", "any", "(", "objects", ")", "else", "None" ]
Get object if child already been read or get child. Use this method for fast access to objects in case of static configurations. :param types: requested object types. :return: all children of the specified types.
[ "Get", "object", "if", "child", "already", "been", "read", "or", "get", "child", "." ]
train
https://github.com/shmir/PyTrafficGenerator/blob/382e5d549c83404af2a6571fe19c9e71df8bac14/trafficgenerator/tgn_object.py#L189-L199
shmir/PyTrafficGenerator
trafficgenerator/tgn_object.py
TgnObject.get_objects_with_object
def get_objects_with_object(self, obj_type, *child_types): """ :param obj_type: requested object type. :param child_type: requested child types. :return: all children of the requested type that have the requested child types. """ return [o for o in self.get_objects_by_ty...
python
def get_objects_with_object(self, obj_type, *child_types): """ :param obj_type: requested object type. :param child_type: requested child types. :return: all children of the requested type that have the requested child types. """ return [o for o in self.get_objects_by_ty...
[ "def", "get_objects_with_object", "(", "self", ",", "obj_type", ",", "*", "child_types", ")", ":", "return", "[", "o", "for", "o", "in", "self", ".", "get_objects_by_type", "(", "obj_type", ")", "if", "o", ".", "get_objects_by_type", "(", "*", "child_types",...
:param obj_type: requested object type. :param child_type: requested child types. :return: all children of the requested type that have the requested child types.
[ ":", "param", "obj_type", ":", "requested", "object", "type", ".", ":", "param", "child_type", ":", "requested", "child", "types", ".", ":", "return", ":", "all", "children", "of", "the", "requested", "type", "that", "have", "the", "requested", "child", "t...
train
https://github.com/shmir/PyTrafficGenerator/blob/382e5d549c83404af2a6571fe19c9e71df8bac14/trafficgenerator/tgn_object.py#L201-L209
shmir/PyTrafficGenerator
trafficgenerator/tgn_object.py
TgnObject.get_objects_without_object
def get_objects_without_object(self, obj_type, *child_types): """ :param obj_type: requested object type. :param child_type: unrequested child types. :return: all children of the requested type that do not have the unrequested child types. """ return [o for o in self.get_...
python
def get_objects_without_object(self, obj_type, *child_types): """ :param obj_type: requested object type. :param child_type: unrequested child types. :return: all children of the requested type that do not have the unrequested child types. """ return [o for o in self.get_...
[ "def", "get_objects_without_object", "(", "self", ",", "obj_type", ",", "*", "child_types", ")", ":", "return", "[", "o", "for", "o", "in", "self", ".", "get_objects_by_type", "(", "obj_type", ")", "if", "not", "o", ".", "get_objects_by_type", "(", "*", "c...
:param obj_type: requested object type. :param child_type: unrequested child types. :return: all children of the requested type that do not have the unrequested child types.
[ ":", "param", "obj_type", ":", "requested", "object", "type", ".", ":", "param", "child_type", ":", "unrequested", "child", "types", ".", ":", "return", ":", "all", "children", "of", "the", "requested", "type", "that", "do", "not", "have", "the", "unreques...
train
https://github.com/shmir/PyTrafficGenerator/blob/382e5d549c83404af2a6571fe19c9e71df8bac14/trafficgenerator/tgn_object.py#L211-L218
shmir/PyTrafficGenerator
trafficgenerator/tgn_object.py
TgnObject.get_objects_with_attribute
def get_objects_with_attribute(self, obj_type, attribute, value): """ :param obj_type: requested object type. :param attribute: requested attribute. :param value: requested attribute value. :return: all children of the requested type that have the requested attribute == requested...
python
def get_objects_with_attribute(self, obj_type, attribute, value): """ :param obj_type: requested object type. :param attribute: requested attribute. :param value: requested attribute value. :return: all children of the requested type that have the requested attribute == requested...
[ "def", "get_objects_with_attribute", "(", "self", ",", "obj_type", ",", "attribute", ",", "value", ")", ":", "return", "[", "o", "for", "o", "in", "self", ".", "get_objects_by_type", "(", "obj_type", ")", "if", "o", ".", "get_attribute", "(", "attribute", ...
:param obj_type: requested object type. :param attribute: requested attribute. :param value: requested attribute value. :return: all children of the requested type that have the requested attribute == requested value.
[ ":", "param", "obj_type", ":", "requested", "object", "type", ".", ":", "param", "attribute", ":", "requested", "attribute", ".", ":", "param", "value", ":", "requested", "attribute", "value", ".", ":", "return", ":", "all", "children", "of", "the", "reque...
train
https://github.com/shmir/PyTrafficGenerator/blob/382e5d549c83404af2a6571fe19c9e71df8bac14/trafficgenerator/tgn_object.py#L220-L227
shmir/PyTrafficGenerator
trafficgenerator/tgn_object.py
TgnObject.get_ancestor_object_by_type
def get_ancestor_object_by_type(self, obj_type): """ :param obj_type: requested ancestor type. :return: the ancestor of the object who's type is obj_type if exists else None. """ if self.type.lower() == obj_type.lower(): return self else: if not s...
python
def get_ancestor_object_by_type(self, obj_type): """ :param obj_type: requested ancestor type. :return: the ancestor of the object who's type is obj_type if exists else None. """ if self.type.lower() == obj_type.lower(): return self else: if not s...
[ "def", "get_ancestor_object_by_type", "(", "self", ",", "obj_type", ")", ":", "if", "self", ".", "type", ".", "lower", "(", ")", "==", "obj_type", ".", "lower", "(", ")", ":", "return", "self", "else", ":", "if", "not", "self", ".", "parent", ":", "r...
:param obj_type: requested ancestor type. :return: the ancestor of the object who's type is obj_type if exists else None.
[ ":", "param", "obj_type", ":", "requested", "ancestor", "type", ".", ":", "return", ":", "the", "ancestor", "of", "the", "object", "who", "s", "type", "is", "obj_type", "if", "exists", "else", "None", "." ]
train
https://github.com/shmir/PyTrafficGenerator/blob/382e5d549c83404af2a6571fe19c9e71df8bac14/trafficgenerator/tgn_object.py#L229-L240
shmir/PyTrafficGenerator
trafficgenerator/tgn_object.py
TgnObject.del_object_from_parent
def del_object_from_parent(self): """ Delete object from parent object. """ if self.parent: self.parent.objects.pop(self.ref)
python
def del_object_from_parent(self): """ Delete object from parent object. """ if self.parent: self.parent.objects.pop(self.ref)
[ "def", "del_object_from_parent", "(", "self", ")", ":", "if", "self", ".", "parent", ":", "self", ".", "parent", ".", "objects", ".", "pop", "(", "self", ".", "ref", ")" ]
Delete object from parent object.
[ "Delete", "object", "from", "parent", "object", "." ]
train
https://github.com/shmir/PyTrafficGenerator/blob/382e5d549c83404af2a6571fe19c9e71df8bac14/trafficgenerator/tgn_object.py#L249-L252
shmir/PyTrafficGenerator
trafficgenerator/tgn_object.py
TgnObject.get_objects_of_class
def get_objects_of_class(cls): """ :return: all instances of the requested class. """ return list(o for o in gc.get_objects() if isinstance(o, cls))
python
def get_objects_of_class(cls): """ :return: all instances of the requested class. """ return list(o for o in gc.get_objects() if isinstance(o, cls))
[ "def", "get_objects_of_class", "(", "cls", ")", ":", "return", "list", "(", "o", "for", "o", "in", "gc", ".", "get_objects", "(", ")", "if", "isinstance", "(", "o", ",", "cls", ")", ")" ]
:return: all instances of the requested class.
[ ":", "return", ":", "all", "instances", "of", "the", "requested", "class", "." ]
train
https://github.com/shmir/PyTrafficGenerator/blob/382e5d549c83404af2a6571fe19c9e71df8bac14/trafficgenerator/tgn_object.py#L262-L266
harcokuppens/thonny-ev3dev
ev3devcmd_package/ev3devcmd_res/legacy/rpyc_classic__threaded_hup_reset.py
_handle_sighup
def _handle_sighup(myrpcserver, signum, unused): """Closes (terminates) all of its clients. Though keeps server running.""" print("SIGHUP: stopping all clients",sys.stderr) if myrpcserver._closed: return for c in set(myrpcserver.clients): try: c.shutdown(socket.SHUT_RDWR) ...
python
def _handle_sighup(myrpcserver, signum, unused): """Closes (terminates) all of its clients. Though keeps server running.""" print("SIGHUP: stopping all clients",sys.stderr) if myrpcserver._closed: return for c in set(myrpcserver.clients): try: c.shutdown(socket.SHUT_RDWR) ...
[ "def", "_handle_sighup", "(", "myrpcserver", ",", "signum", ",", "unused", ")", ":", "print", "(", "\"SIGHUP: stopping all clients\"", ",", "sys", ".", "stderr", ")", "if", "myrpcserver", ".", "_closed", ":", "return", "for", "c", "in", "set", "(", "myrpcser...
Closes (terminates) all of its clients. Though keeps server running.
[ "Closes", "(", "terminates", ")", "all", "of", "its", "clients", ".", "Though", "keeps", "server", "running", "." ]
train
https://github.com/harcokuppens/thonny-ev3dev/blob/e3437d7716068976faf2146c6bb0332ed56a1760/ev3devcmd_package/ev3devcmd_res/legacy/rpyc_classic__threaded_hup_reset.py#L15-L26
moonso/extract_vcf
extract_vcf/get_annotations.py
split_strings
def split_strings(string, separators): """ Split a string with arbitrary number of separators. Return a list with the splitted values Arguments: string (str): ex. "a:1|2,b:2" separators (list): ex. [',',':','|'] Returns: results (list) : ex. ['a','1','2','b','2'] ...
python
def split_strings(string, separators): """ Split a string with arbitrary number of separators. Return a list with the splitted values Arguments: string (str): ex. "a:1|2,b:2" separators (list): ex. [',',':','|'] Returns: results (list) : ex. ['a','1','2','b','2'] ...
[ "def", "split_strings", "(", "string", ",", "separators", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "'extract_vcf.split_strings'", ")", "logger", ".", "debug", "(", "\"splitting string '{0}' with separators {1}\"", ".", "format", "(", "string", ",",...
Split a string with arbitrary number of separators. Return a list with the splitted values Arguments: string (str): ex. "a:1|2,b:2" separators (list): ex. [',',':','|'] Returns: results (list) : ex. ['a','1','2','b','2']
[ "Split", "a", "string", "with", "arbitrary", "number", "of", "separators", ".", "Return", "a", "list", "with", "the", "splitted", "values", "Arguments", ":", "string", "(", "str", ")", ":", "ex", ".", "a", ":", "1|2", "b", ":", "2", "separators", "(", ...
train
https://github.com/moonso/extract_vcf/blob/c8381b362fa6734cd2ee65ef260738868d981aaf/extract_vcf/get_annotations.py#L6-L48
Nic30/pyDigitalWaveTools
pyDigitalWaveTools/vcd/writer.py
VcdVarIdScope._idToStr
def _idToStr(self, x): """ Convert VCD id in int to string """ if x < 0: sign = -1 elif x == 0: return self._idChars[0] else: sign = 1 x *= sign digits = [] while x: digits.append(self._idChars[x % se...
python
def _idToStr(self, x): """ Convert VCD id in int to string """ if x < 0: sign = -1 elif x == 0: return self._idChars[0] else: sign = 1 x *= sign digits = [] while x: digits.append(self._idChars[x % se...
[ "def", "_idToStr", "(", "self", ",", "x", ")", ":", "if", "x", "<", "0", ":", "sign", "=", "-", "1", "elif", "x", "==", "0", ":", "return", "self", ".", "_idChars", "[", "0", "]", "else", ":", "sign", "=", "1", "x", "*=", "sign", "digits", ...
Convert VCD id in int to string
[ "Convert", "VCD", "id", "in", "int", "to", "string" ]
train
https://github.com/Nic30/pyDigitalWaveTools/blob/95b96fa5f52ffd7ca916db51a4f22ee1bd9e46fc/pyDigitalWaveTools/vcd/writer.py#L31-L50
Nic30/pyDigitalWaveTools
pyDigitalWaveTools/vcd/writer.py
VcdVarWritingScope.addVar
def addVar(self, sig: object, name: str, sigType: VCD_SIG_TYPE, width: int, valueFormatter: Callable[["Value"], str]): """ Add variable to scope :ivar sig: user specified object to keep track of VcdVarInfo in change() :ivar sigType: vcd type name :ivar valueForma...
python
def addVar(self, sig: object, name: str, sigType: VCD_SIG_TYPE, width: int, valueFormatter: Callable[["Value"], str]): """ Add variable to scope :ivar sig: user specified object to keep track of VcdVarInfo in change() :ivar sigType: vcd type name :ivar valueForma...
[ "def", "addVar", "(", "self", ",", "sig", ":", "object", ",", "name", ":", "str", ",", "sigType", ":", "VCD_SIG_TYPE", ",", "width", ":", "int", ",", "valueFormatter", ":", "Callable", "[", "[", "\"Value\"", "]", ",", "str", "]", ")", ":", "vInf", ...
Add variable to scope :ivar sig: user specified object to keep track of VcdVarInfo in change() :ivar sigType: vcd type name :ivar valueFormatter: value which converts new value in change() to vcd string
[ "Add", "variable", "to", "scope" ]
train
https://github.com/Nic30/pyDigitalWaveTools/blob/95b96fa5f52ffd7ca916db51a4f22ee1bd9e46fc/pyDigitalWaveTools/vcd/writer.py#L78-L91
Nic30/pyDigitalWaveTools
pyDigitalWaveTools/vcd/writer.py
VcdVarWritingScope.varScope
def varScope(self, name): """ Create sub variable scope with defined name """ ch = VcdVarWritingScope(name, self._writer, parent=self) assert name not in self.children, name self.children[name] = ch return ch
python
def varScope(self, name): """ Create sub variable scope with defined name """ ch = VcdVarWritingScope(name, self._writer, parent=self) assert name not in self.children, name self.children[name] = ch return ch
[ "def", "varScope", "(", "self", ",", "name", ")", ":", "ch", "=", "VcdVarWritingScope", "(", "name", ",", "self", ".", "_writer", ",", "parent", "=", "self", ")", "assert", "name", "not", "in", "self", ".", "children", ",", "name", "self", ".", "chil...
Create sub variable scope with defined name
[ "Create", "sub", "variable", "scope", "with", "defined", "name" ]
train
https://github.com/Nic30/pyDigitalWaveTools/blob/95b96fa5f52ffd7ca916db51a4f22ee1bd9e46fc/pyDigitalWaveTools/vcd/writer.py#L93-L100
i3visio/deepify
scripts/zeronetsFromFile.py
multi_run_wrapper
def multi_run_wrapper(params): ''' Wrapper for being able to launch all the threads. :param params: We receive the parameters as a tuple. ''' zeronet, index, total, output_folder, overwrite = params print "[" + str(index) + "/" + str(total) + "] ", dt.datetime.now(), ":\tRecovering infor...
python
def multi_run_wrapper(params): ''' Wrapper for being able to launch all the threads. :param params: We receive the parameters as a tuple. ''' zeronet, index, total, output_folder, overwrite = params print "[" + str(index) + "/" + str(total) + "] ", dt.datetime.now(), ":\tRecovering infor...
[ "def", "multi_run_wrapper", "(", "params", ")", ":", "zeronet", ",", "index", ",", "total", ",", "output_folder", ",", "overwrite", "=", "params", "print", "\"[\"", "+", "str", "(", "index", ")", "+", "\"/\"", "+", "str", "(", "total", ")", "+", "\"] \...
Wrapper for being able to launch all the threads. :param params: We receive the parameters as a tuple.
[ "Wrapper", "for", "being", "able", "to", "launch", "all", "the", "threads", ".", ":", "param", "params", ":", "We", "receive", "the", "parameters", "as", "a", "tuple", "." ]
train
https://github.com/i3visio/deepify/blob/2af04e0bea3eaabe96b0565e10f7eeb29b042a2b/scripts/zeronetsFromFile.py#L47-L79
i3visio/deepify
scripts/zeronetsFromFile.py
main
def main(args): """ Main function. """ urls = [] # Grabbing all possible URL with open(args.file) as iF: urls = iF.read().splitlines() # Creating the output folder if it does not exist. if not os.path.exists(args.output_folder): os.makedirs(args.output_folder) ...
python
def main(args): """ Main function. """ urls = [] # Grabbing all possible URL with open(args.file) as iF: urls = iF.read().splitlines() # Creating the output folder if it does not exist. if not os.path.exists(args.output_folder): os.makedirs(args.output_folder) ...
[ "def", "main", "(", "args", ")", ":", "urls", "=", "[", "]", "# Grabbing all possible URL", "with", "open", "(", "args", ".", "file", ")", "as", "iF", ":", "urls", "=", "iF", ".", "read", "(", ")", ".", "splitlines", "(", ")", "# Creating the output fo...
Main function.
[ "Main", "function", "." ]
train
https://github.com/i3visio/deepify/blob/2af04e0bea3eaabe96b0565e10f7eeb29b042a2b/scripts/zeronetsFromFile.py#L81-L116
i3visio/deepify
deepify/utils/wrapper.py
Wrapper._getConfiguration
def _getConfiguration(self): """ Method that abstracts the extraction of grabbing the configuration. :return: the applicable configuration settings. """ info =configuration.getConfiguration() try: # This returns only the param...
python
def _getConfiguration(self): """ Method that abstracts the extraction of grabbing the configuration. :return: the applicable configuration settings. """ info =configuration.getConfiguration() try: # This returns only the param...
[ "def", "_getConfiguration", "(", "self", ")", ":", "info", "=", "configuration", ".", "getConfiguration", "(", ")", "try", ":", "# This returns only the parameters needed by each wrapper. E. g., for Tor:", "# {", "# \"host\" : \"127.0.0.1\"", "# \"port\" : \"9150\"", "# }...
Method that abstracts the extraction of grabbing the configuration. :return: the applicable configuration settings.
[ "Method", "that", "abstracts", "the", "extraction", "of", "grabbing", "the", "configuration", ".", ":", "return", ":", "the", "applicable", "configuration", "settings", "." ]
train
https://github.com/i3visio/deepify/blob/2af04e0bea3eaabe96b0565e10f7eeb29b042a2b/deepify/utils/wrapper.py#L42-L60
i3visio/deepify
deepify/utils/wrapper.py
Wrapper.getDomainFromUrl
def getDomainFromUrl(self, url): """ Extracting the domain from the URL. :return: domain as a string. """ try: domain = re.findall( self.domainRegexp, url )[0] except Exception, e: errMsg = "ERROR. Something happened when tryin...
python
def getDomainFromUrl(self, url): """ Extracting the domain from the URL. :return: domain as a string. """ try: domain = re.findall( self.domainRegexp, url )[0] except Exception, e: errMsg = "ERROR. Something happened when tryin...
[ "def", "getDomainFromUrl", "(", "self", ",", "url", ")", ":", "try", ":", "domain", "=", "re", ".", "findall", "(", "self", ".", "domainRegexp", ",", "url", ")", "[", "0", "]", "except", "Exception", ",", "e", ":", "errMsg", "=", "\"ERROR. Something ha...
Extracting the domain from the URL. :return: domain as a string.
[ "Extracting", "the", "domain", "from", "the", "URL", ".", ":", "return", ":", "domain", "as", "a", "string", "." ]
train
https://github.com/i3visio/deepify/blob/2af04e0bea3eaabe96b0565e10f7eeb29b042a2b/deepify/utils/wrapper.py#L62-L74
i3visio/deepify
deepify/utils/wrapper.py
Wrapper._createDataStructure
def _createDataStructure(self, content): """ This method receives a response, including headers, and creates the appropriate structure. :param url: The URL to be recovered. :param content: The content of the response. :return: A json. ...
python
def _createDataStructure(self, content): """ This method receives a response, including headers, and creates the appropriate structure. :param url: The URL to be recovered. :param content: The content of the response. :return: A json. ...
[ "def", "_createDataStructure", "(", "self", ",", "content", ")", ":", "aux", "=", "{", "}", "aux", "[", "\"headers\"", "]", "=", "{", "}", "aux", "[", "\"content\"", "]", "=", "\"\"", "for", "i", ",", "line", "in", "enumerate", "(", "content", ".", ...
This method receives a response, including headers, and creates the appropriate structure. :param url: The URL to be recovered. :param content: The content of the response. :return: A json.
[ "This", "method", "receives", "a", "response", "including", "headers", "and", "creates", "the", "appropriate", "structure", ".", ":", "param", "url", ":", "The", "URL", "to", "be", "recovered", ".", ":", "param", "content", ":", "The", "content", "of", "th...
train
https://github.com/i3visio/deepify/blob/2af04e0bea3eaabe96b0565e10f7eeb29b042a2b/deepify/utils/wrapper.py#L87-L111
i3visio/deepify
deepify/utils/wrapper.py
Wrapper._grabContentFromUrl
def _grabContentFromUrl(self, url): """ Function that abstracts capturing a URL. This method will be rewritten in child classes. :param url: The URL to be processed. :return: The response in a Json format. """ # Defining an empty object for th...
python
def _grabContentFromUrl(self, url): """ Function that abstracts capturing a URL. This method will be rewritten in child classes. :param url: The URL to be processed. :return: The response in a Json format. """ # Defining an empty object for th...
[ "def", "_grabContentFromUrl", "(", "self", ",", "url", ")", ":", "# Defining an empty object for the response", "response", "=", "{", "}", "# This part has to be modified... ", "try", ":", "import", "urllib2", "# Grabbing the data ", "data", "=", "urllib2", "....
Function that abstracts capturing a URL. This method will be rewritten in child classes. :param url: The URL to be processed. :return: The response in a Json format.
[ "Function", "that", "abstracts", "capturing", "a", "URL", ".", "This", "method", "will", "be", "rewritten", "in", "child", "classes", ".", ":", "param", "url", ":", "The", "URL", "to", "be", "processed", ".", ":", "return", ":", "The", "response", "in", ...
train
https://github.com/i3visio/deepify/blob/2af04e0bea3eaabe96b0565e10f7eeb29b042a2b/deepify/utils/wrapper.py#L113-L138
i3visio/deepify
deepify/utils/wrapper.py
Wrapper.getResponse
def getResponse(self, url): """ Public method that wraps the extraction of the content. :param url: The resource to be processed. :return: The response in a Json format. """ # Defining an empty object for the response response = {...
python
def getResponse(self, url): """ Public method that wraps the extraction of the content. :param url: The resource to be processed. :return: The response in a Json format. """ # Defining an empty object for the response response = {...
[ "def", "getResponse", "(", "self", ",", "url", ")", ":", "# Defining an empty object for the response", "response", "=", "{", "}", "try", ":", "# This receives only the parameters needed by this Tor Wrapper:", "# {", "# \"host\" : \"127.0.0.1\"", "# \"port\" : \"9150\"", ...
Public method that wraps the extraction of the content. :param url: The resource to be processed. :return: The response in a Json format.
[ "Public", "method", "that", "wraps", "the", "extraction", "of", "the", "content", ".", ":", "param", "url", ":", "The", "resource", "to", "be", "processed", ".", ":", "return", ":", "The", "response", "in", "a", "Json", "format", "." ]
train
https://github.com/i3visio/deepify/blob/2af04e0bea3eaabe96b0565e10f7eeb29b042a2b/deepify/utils/wrapper.py#L140-L174
jasonkeene/python-ubersmith
ubersmith/utils.py
append_qs
def append_qs(url, query_string): """Append query_string values to an existing URL and return it as a string. query_string can be: * an encoded string: 'test3=val1&test3=val2' * a dict of strings: {'test3': 'val'} * a dict of lists of strings: {'test3': ['val1', 'val2']} * a lis...
python
def append_qs(url, query_string): """Append query_string values to an existing URL and return it as a string. query_string can be: * an encoded string: 'test3=val1&test3=val2' * a dict of strings: {'test3': 'val'} * a dict of lists of strings: {'test3': ['val1', 'val2']} * a lis...
[ "def", "append_qs", "(", "url", ",", "query_string", ")", ":", "parsed_url", "=", "urlsplit", "(", "url", ")", "parsed_qs", "=", "parse_qsl", "(", "parsed_url", ".", "query", ",", "True", ")", "if", "isstr", "(", "query_string", ")", ":", "parsed_qs", "+...
Append query_string values to an existing URL and return it as a string. query_string can be: * an encoded string: 'test3=val1&test3=val2' * a dict of strings: {'test3': 'val'} * a dict of lists of strings: {'test3': ['val1', 'val2']} * a list of tuples: [('test3', 'val1'), ('test3'...
[ "Append", "query_string", "values", "to", "an", "existing", "URL", "and", "return", "it", "as", "a", "string", "." ]
train
https://github.com/jasonkeene/python-ubersmith/blob/0c594e2eb41066d1fe7860e3a6f04b14c14f6e6a/ubersmith/utils.py#L33-L66
jasonkeene/python-ubersmith
ubersmith/utils.py
urlencode_unicode
def urlencode_unicode(data, doseq=0): """urllib.urlencode can't handle unicode, this is a hack to fix it.""" data_iter = None if isdict(data): data_iter = list(data.items()) elif islist(data): data_iter = data if data_iter: for i, (key, value) in enumerate(data_iter): ...
python
def urlencode_unicode(data, doseq=0): """urllib.urlencode can't handle unicode, this is a hack to fix it.""" data_iter = None if isdict(data): data_iter = list(data.items()) elif islist(data): data_iter = data if data_iter: for i, (key, value) in enumerate(data_iter): ...
[ "def", "urlencode_unicode", "(", "data", ",", "doseq", "=", "0", ")", ":", "data_iter", "=", "None", "if", "isdict", "(", "data", ")", ":", "data_iter", "=", "list", "(", "data", ".", "items", "(", ")", ")", "elif", "islist", "(", "data", ")", ":",...
urllib.urlencode can't handle unicode, this is a hack to fix it.
[ "urllib", ".", "urlencode", "can", "t", "handle", "unicode", "this", "is", "a", "hack", "to", "fix", "it", "." ]
train
https://github.com/jasonkeene/python-ubersmith/blob/0c594e2eb41066d1fe7860e3a6f04b14c14f6e6a/ubersmith/utils.py#L69-L93
jasonkeene/python-ubersmith
ubersmith/utils.py
to_nested_php_args
def to_nested_php_args(data, prefix_key=None): """ This function will take either a dict or list and will recursively loop through the values converting it into a format similar to a PHP array which Ubersmith requires for the info portion of the API's order.create method. """ is_root = prefix_ke...
python
def to_nested_php_args(data, prefix_key=None): """ This function will take either a dict or list and will recursively loop through the values converting it into a format similar to a PHP array which Ubersmith requires for the info portion of the API's order.create method. """ is_root = prefix_ke...
[ "def", "to_nested_php_args", "(", "data", ",", "prefix_key", "=", "None", ")", ":", "is_root", "=", "prefix_key", "is", "None", "prefix_key", "=", "prefix_key", "if", "prefix_key", "else", "''", "if", "islist", "(", "data", ")", ":", "data_iter", "=", "dat...
This function will take either a dict or list and will recursively loop through the values converting it into a format similar to a PHP array which Ubersmith requires for the info portion of the API's order.create method.
[ "This", "function", "will", "take", "either", "a", "dict", "or", "list", "and", "will", "recursively", "loop", "through", "the", "values", "converting", "it", "into", "a", "format", "similar", "to", "a", "PHP", "array", "which", "Ubersmith", "requires", "for...
train
https://github.com/jasonkeene/python-ubersmith/blob/0c594e2eb41066d1fe7860e3a6f04b14c14f6e6a/ubersmith/utils.py#L101-L138
jasonkeene/python-ubersmith
ubersmith/utils.py
get_filename
def get_filename(disposition): """Parse Content-Disposition header to pull out the filename bit. See: http://tools.ietf.org/html/rfc2616#section-19.5.1 """ if disposition: params = [param.strip() for param in disposition.split(';')[1:]] for param in params: if '=' in param:...
python
def get_filename(disposition): """Parse Content-Disposition header to pull out the filename bit. See: http://tools.ietf.org/html/rfc2616#section-19.5.1 """ if disposition: params = [param.strip() for param in disposition.split(';')[1:]] for param in params: if '=' in param:...
[ "def", "get_filename", "(", "disposition", ")", ":", "if", "disposition", ":", "params", "=", "[", "param", ".", "strip", "(", ")", "for", "param", "in", "disposition", ".", "split", "(", "';'", ")", "[", "1", ":", "]", "]", "for", "param", "in", "...
Parse Content-Disposition header to pull out the filename bit. See: http://tools.ietf.org/html/rfc2616#section-19.5.1
[ "Parse", "Content", "-", "Disposition", "header", "to", "pull", "out", "the", "filename", "bit", "." ]
train
https://github.com/jasonkeene/python-ubersmith/blob/0c594e2eb41066d1fe7860e3a6f04b14c14f6e6a/ubersmith/utils.py#L161-L173
shmir/PyTrafficGenerator
trafficgenerator/tgn_tcl.py
get_args_pairs
def get_args_pairs(arguments): """ :param arguments: Python dictionary of TGN API command arguments <key, value>. :returns: Tcl list of argument pairs <-key, value> to be used in TGN API commands. """ return ' '.join(' '.join(['-' + k, tcl_str(str(v))]) for k, v in arguments.items())
python
def get_args_pairs(arguments): """ :param arguments: Python dictionary of TGN API command arguments <key, value>. :returns: Tcl list of argument pairs <-key, value> to be used in TGN API commands. """ return ' '.join(' '.join(['-' + k, tcl_str(str(v))]) for k, v in arguments.items())
[ "def", "get_args_pairs", "(", "arguments", ")", ":", "return", "' '", ".", "join", "(", "' '", ".", "join", "(", "[", "'-'", "+", "k", ",", "tcl_str", "(", "str", "(", "v", ")", ")", "]", ")", "for", "k", ",", "v", "in", "arguments", ".", "item...
:param arguments: Python dictionary of TGN API command arguments <key, value>. :returns: Tcl list of argument pairs <-key, value> to be used in TGN API commands.
[ ":", "param", "arguments", ":", "Python", "dictionary", "of", "TGN", "API", "command", "arguments", "<key", "value", ">", ".", ":", "returns", ":", "Tcl", "list", "of", "argument", "pairs", "<", "-", "key", "value", ">", "to", "be", "used", "in", "TGN"...
train
https://github.com/shmir/PyTrafficGenerator/blob/382e5d549c83404af2a6571fe19c9e71df8bac14/trafficgenerator/tgn_tcl.py#L46-L52
shmir/PyTrafficGenerator
trafficgenerator/tgn_tcl.py
tcl_list_2_py_list
def tcl_list_2_py_list(tcl_list, within_tcl_str=False): """ Convert Tcl list to Python list using Tcl interpreter. :param tcl_list: string representing the Tcl string. :param within_tcl_str: True - Tcl list is embedded within Tcl str. False - native Tcl string. :return: Python list equivalent to the Tc...
python
def tcl_list_2_py_list(tcl_list, within_tcl_str=False): """ Convert Tcl list to Python list using Tcl interpreter. :param tcl_list: string representing the Tcl string. :param within_tcl_str: True - Tcl list is embedded within Tcl str. False - native Tcl string. :return: Python list equivalent to the Tc...
[ "def", "tcl_list_2_py_list", "(", "tcl_list", ",", "within_tcl_str", "=", "False", ")", ":", "if", "not", "within_tcl_str", ":", "tcl_list", "=", "tcl_str", "(", "tcl_list", ")", "return", "tcl_interp_g", ".", "eval", "(", "'join '", "+", "tcl_list", "+", "'...
Convert Tcl list to Python list using Tcl interpreter. :param tcl_list: string representing the Tcl string. :param within_tcl_str: True - Tcl list is embedded within Tcl str. False - native Tcl string. :return: Python list equivalent to the Tcl ist. :rtye: list
[ "Convert", "Tcl", "list", "to", "Python", "list", "using", "Tcl", "interpreter", "." ]
train
https://github.com/shmir/PyTrafficGenerator/blob/382e5d549c83404af2a6571fe19c9e71df8bac14/trafficgenerator/tgn_tcl.py#L68-L79
shmir/PyTrafficGenerator
trafficgenerator/tgn_tcl.py
py_list_to_tcl_list
def py_list_to_tcl_list(py_list): """ Convert Python list to Tcl list using Tcl interpreter. :param py_list: Python list. :type py_list: list :return: string representing the Tcl string equivalent to the Python list. """ py_list_str = [str(s) for s in py_list] return tcl_str(tcl_interp_g.e...
python
def py_list_to_tcl_list(py_list): """ Convert Python list to Tcl list using Tcl interpreter. :param py_list: Python list. :type py_list: list :return: string representing the Tcl string equivalent to the Python list. """ py_list_str = [str(s) for s in py_list] return tcl_str(tcl_interp_g.e...
[ "def", "py_list_to_tcl_list", "(", "py_list", ")", ":", "py_list_str", "=", "[", "str", "(", "s", ")", "for", "s", "in", "py_list", "]", "return", "tcl_str", "(", "tcl_interp_g", ".", "eval", "(", "'split'", "+", "tcl_str", "(", "'\\t'", ".", "join", "...
Convert Python list to Tcl list using Tcl interpreter. :param py_list: Python list. :type py_list: list :return: string representing the Tcl string equivalent to the Python list.
[ "Convert", "Python", "list", "to", "Tcl", "list", "using", "Tcl", "interpreter", "." ]
train
https://github.com/shmir/PyTrafficGenerator/blob/382e5d549c83404af2a6571fe19c9e71df8bac14/trafficgenerator/tgn_tcl.py#L82-L91
shmir/PyTrafficGenerator
trafficgenerator/tgn_tcl.py
TgnTclConsole.eval
def eval(self, command): """ @summary: Evaluate Tcl command. @param command: command to evaluate. @return: command output. """ # Some operations (like take ownership) may take long time. con_command_out = self._con.send_cmd(command, timeout=256) if 'ERROR...
python
def eval(self, command): """ @summary: Evaluate Tcl command. @param command: command to evaluate. @return: command output. """ # Some operations (like take ownership) may take long time. con_command_out = self._con.send_cmd(command, timeout=256) if 'ERROR...
[ "def", "eval", "(", "self", ",", "command", ")", ":", "# Some operations (like take ownership) may take long time.", "con_command_out", "=", "self", ".", "_con", ".", "send_cmd", "(", "command", ",", "timeout", "=", "256", ")", "if", "'ERROR_SEND_CMD_EXIT_DUE_TO_TIMEO...
@summary: Evaluate Tcl command. @param command: command to evaluate. @return: command output.
[ "@summary", ":", "Evaluate", "Tcl", "command", "." ]
train
https://github.com/shmir/PyTrafficGenerator/blob/382e5d549c83404af2a6571fe19c9e71df8bac14/trafficgenerator/tgn_tcl.py#L158-L177
shmir/PyTrafficGenerator
trafficgenerator/tgn_tcl.py
TgnTclWrapper.eval
def eval(self, command): """ Execute Tcl command. Write the command to tcl script (.tcl) log file. Execute the command. Write the command and the output to general (.txt) log file. :param command: Command to execute. :returns: command raw output. """ if...
python
def eval(self, command): """ Execute Tcl command. Write the command to tcl script (.tcl) log file. Execute the command. Write the command and the output to general (.txt) log file. :param command: Command to execute. :returns: command raw output. """ if...
[ "def", "eval", "(", "self", ",", "command", ")", ":", "if", "self", ".", "logger", ".", "handlers", ":", "self", ".", "logger", ".", "debug", "(", "command", ".", "decode", "(", "'utf-8'", ")", ")", "if", "self", ".", "tcl_script", ":", "self", "."...
Execute Tcl command. Write the command to tcl script (.tcl) log file. Execute the command. Write the command and the output to general (.txt) log file. :param command: Command to execute. :returns: command raw output.
[ "Execute", "Tcl", "command", "." ]
train
https://github.com/shmir/PyTrafficGenerator/blob/382e5d549c83404af2a6571fe19c9e71df8bac14/trafficgenerator/tgn_tcl.py#L208-L226
i3visio/deepify
deepify/tor.py
Tor._grabContentFromUrl
def _grabContentFromUrl(self, url): """ Function that abstracts capturing a URL. This method rewrites the one from Wrapper. :param url: The URL to be processed. :return: The response in a Json format. """ # Defining an empty object for the res...
python
def _grabContentFromUrl(self, url): """ Function that abstracts capturing a URL. This method rewrites the one from Wrapper. :param url: The URL to be processed. :return: The response in a Json format. """ # Defining an empty object for the res...
[ "def", "_grabContentFromUrl", "(", "self", ",", "url", ")", ":", "# Defining an empty object for the response", "response", "=", "{", "}", "# This part has to be modified... ", "try", ":", "# Configuring the socket", "socks", ".", "setdefaultproxy", "(", "socks", "...
Function that abstracts capturing a URL. This method rewrites the one from Wrapper. :param url: The URL to be processed. :return: The response in a Json format.
[ "Function", "that", "abstracts", "capturing", "a", "URL", ".", "This", "method", "rewrites", "the", "one", "from", "Wrapper", ".", ":", "param", "url", ":", "The", "URL", "to", "be", "processed", ".", ":", "return", ":", "The", "response", "in", "a", "...
train
https://github.com/i3visio/deepify/blob/2af04e0bea3eaabe96b0565e10f7eeb29b042a2b/deepify/tor.py#L53-L93
Nic30/pyDigitalWaveTools
pyDigitalWaveTools/vcd/parser.py
VcdParser.value_change
def value_change(self, vcdId, value): '''append change from VCD file signal data series''' self.idcode2series[vcdId].append((self.now, value))
python
def value_change(self, vcdId, value): '''append change from VCD file signal data series''' self.idcode2series[vcdId].append((self.now, value))
[ "def", "value_change", "(", "self", ",", "vcdId", ",", "value", ")", ":", "self", ".", "idcode2series", "[", "vcdId", "]", ".", "append", "(", "(", "self", ".", "now", ",", "value", ")", ")" ]
append change from VCD file signal data series
[ "append", "change", "from", "VCD", "file", "signal", "data", "series" ]
train
https://github.com/Nic30/pyDigitalWaveTools/blob/95b96fa5f52ffd7ca916db51a4f22ee1bd9e46fc/pyDigitalWaveTools/vcd/parser.py#L82-L84
Nic30/pyDigitalWaveTools
pyDigitalWaveTools/vcd/parser.py
VcdParser.parse
def parse(self, file_handle): ''' Tokenize and parse the VCD file :ivar file_handle: opened file with vcd string ''' # open the VCD file and create a token generator lineIterator = iter(enumerate(file_handle)) tokeniser = ((lineNo, word) for lineNo, line in lineI...
python
def parse(self, file_handle): ''' Tokenize and parse the VCD file :ivar file_handle: opened file with vcd string ''' # open the VCD file and create a token generator lineIterator = iter(enumerate(file_handle)) tokeniser = ((lineNo, word) for lineNo, line in lineI...
[ "def", "parse", "(", "self", ",", "file_handle", ")", ":", "# open the VCD file and create a token generator", "lineIterator", "=", "iter", "(", "enumerate", "(", "file_handle", ")", ")", "tokeniser", "=", "(", "(", "lineNo", ",", "word", ")", "for", "lineNo", ...
Tokenize and parse the VCD file :ivar file_handle: opened file with vcd string
[ "Tokenize", "and", "parse", "the", "VCD", "file" ]
train
https://github.com/Nic30/pyDigitalWaveTools/blob/95b96fa5f52ffd7ca916db51a4f22ee1bd9e46fc/pyDigitalWaveTools/vcd/parser.py#L86-L132
artefactual-labs/agentarchives
agentarchives/archivists_toolkit/client.py
ArchivistsToolkitClient.edit_record
def edit_record(self, new_record): """ Update a record in Archivist's Toolkit using the provided new_record. The format of new_record is identical to the format returned by get_resource_component_and_children and related methods. This means it's possible, for example, to request a recor...
python
def edit_record(self, new_record): """ Update a record in Archivist's Toolkit using the provided new_record. The format of new_record is identical to the format returned by get_resource_component_and_children and related methods. This means it's possible, for example, to request a recor...
[ "def", "edit_record", "(", "self", ",", "new_record", ")", ":", "try", ":", "record_id", "=", "new_record", "[", "\"id\"", "]", "except", "KeyError", ":", "raise", "ValueError", "(", "\"No record ID provided!\"", ")", "record_type", "=", "self", ".", "resource...
Update a record in Archivist's Toolkit using the provided new_record. The format of new_record is identical to the format returned by get_resource_component_and_children and related methods. This means it's possible, for example, to request a record, modify the returned dict, and pass that dict to this...
[ "Update", "a", "record", "in", "Archivist", "s", "Toolkit", "using", "the", "provided", "new_record", "." ]
train
https://github.com/artefactual-labs/agentarchives/blob/af19ade56a90c64069cf46b50972fe72b6f10a45/agentarchives/archivists_toolkit/client.py#L47-L95
artefactual-labs/agentarchives
agentarchives/archivists_toolkit/client.py
ArchivistsToolkitClient.get_levels_of_description
def get_levels_of_description(self): """ Returns an array of all levels of description defined in this Archivist's Toolkit instance. """ if not hasattr(self, "levels_of_description"): cursor = self.db.cursor() levels = set() cursor.execute("SELECT dist...
python
def get_levels_of_description(self): """ Returns an array of all levels of description defined in this Archivist's Toolkit instance. """ if not hasattr(self, "levels_of_description"): cursor = self.db.cursor() levels = set() cursor.execute("SELECT dist...
[ "def", "get_levels_of_description", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "\"levels_of_description\"", ")", ":", "cursor", "=", "self", ".", "db", ".", "cursor", "(", ")", "levels", "=", "set", "(", ")", "cursor", ".", "execute...
Returns an array of all levels of description defined in this Archivist's Toolkit instance.
[ "Returns", "an", "array", "of", "all", "levels", "of", "description", "defined", "in", "this", "Archivist", "s", "Toolkit", "instance", "." ]
train
https://github.com/artefactual-labs/agentarchives/blob/af19ade56a90c64069cf46b50972fe72b6f10a45/agentarchives/archivists_toolkit/client.py#L97-L112
artefactual-labs/agentarchives
agentarchives/archivists_toolkit/client.py
ArchivistsToolkitClient.collection_list
def collection_list(self, resource_id, resource_type="collection"): """ Fetches a list of all resource and component IDs within the specified resource. :param long resource_id: The ID of the resource to fetch children from. :param string resource_type: Specifies whether the resource to ...
python
def collection_list(self, resource_id, resource_type="collection"): """ Fetches a list of all resource and component IDs within the specified resource. :param long resource_id: The ID of the resource to fetch children from. :param string resource_type: Specifies whether the resource to ...
[ "def", "collection_list", "(", "self", ",", "resource_id", ",", "resource_type", "=", "\"collection\"", ")", ":", "ret", "=", "[", "]", "cursor", "=", "self", ".", "db", ".", "cursor", "(", ")", "if", "resource_type", "==", "\"collection\"", ":", "cursor",...
Fetches a list of all resource and component IDs within the specified resource. :param long resource_id: The ID of the resource to fetch children from. :param string resource_type: Specifies whether the resource to fetch is a collection or a child element. Defaults to 'collection'. ...
[ "Fetches", "a", "list", "of", "all", "resource", "and", "component", "IDs", "within", "the", "specified", "resource", "." ]
train
https://github.com/artefactual-labs/agentarchives/blob/af19ade56a90c64069cf46b50972fe72b6f10a45/agentarchives/archivists_toolkit/client.py#L114-L145
artefactual-labs/agentarchives
agentarchives/archivists_toolkit/client.py
ArchivistsToolkitClient.get_resource_component_and_children
def get_resource_component_and_children( self, resource_id, resource_type="collection", level=1, sort_data={}, **kwargs ): """ Fetch detailed metadata for the specified resource_id and all of its children. :param long resource_id: The resource for which to fetch metadata. :p...
python
def get_resource_component_and_children( self, resource_id, resource_type="collection", level=1, sort_data={}, **kwargs ): """ Fetch detailed metadata for the specified resource_id and all of its children. :param long resource_id: The resource for which to fetch metadata. :p...
[ "def", "get_resource_component_and_children", "(", "self", ",", "resource_id", ",", "resource_type", "=", "\"collection\"", ",", "level", "=", "1", ",", "sort_data", "=", "{", "}", ",", "*", "*", "kwargs", ")", ":", "# we pass the sort position as a dict so it passe...
Fetch detailed metadata for the specified resource_id and all of its children. :param long resource_id: The resource for which to fetch metadata. :param string resource_type: The level of description of the record. :param int recurse_max_level: The maximum depth level to fetch when fetching chi...
[ "Fetch", "detailed", "metadata", "for", "the", "specified", "resource_id", "and", "all", "of", "its", "children", "." ]
train
https://github.com/artefactual-labs/agentarchives/blob/af19ade56a90c64069cf46b50972fe72b6f10a45/agentarchives/archivists_toolkit/client.py#L159-L332
artefactual-labs/agentarchives
agentarchives/archivists_toolkit/client.py
ArchivistsToolkitClient.find_resource_id_for_component
def find_resource_id_for_component(self, component_id): """ Given the ID of a component, returns the parent resource ID. If the immediate parent of the component is itself a component, this method will progress up the tree until a resource is found. :param long component_id: The ID of ...
python
def find_resource_id_for_component(self, component_id): """ Given the ID of a component, returns the parent resource ID. If the immediate parent of the component is itself a component, this method will progress up the tree until a resource is found. :param long component_id: The ID of ...
[ "def", "find_resource_id_for_component", "(", "self", ",", "component_id", ")", ":", "cursor", "=", "self", ".", "db", ".", "cursor", "(", ")", "sql", "=", "\"SELECT resourceId, parentResourceComponentId FROM ResourcesComponents WHERE resourceComponentId=%s\"", "cursor", "....
Given the ID of a component, returns the parent resource ID. If the immediate parent of the component is itself a component, this method will progress up the tree until a resource is found. :param long component_id: The ID of the ResourceComponent. :return: The ID of the component's parent res...
[ "Given", "the", "ID", "of", "a", "component", "returns", "the", "parent", "resource", "ID", "." ]
train
https://github.com/artefactual-labs/agentarchives/blob/af19ade56a90c64069cf46b50972fe72b6f10a45/agentarchives/archivists_toolkit/client.py#L334-L353
artefactual-labs/agentarchives
agentarchives/archivists_toolkit/client.py
ArchivistsToolkitClient.find_parent_id_for_component
def find_parent_id_for_component(self, component_id): """ Given the ID of a component, returns the parent component's ID. :param string component_id: The ID of the component. :return: A tuple containing: * The type of the parent record; valid values are ArchivesSpaceClient.R...
python
def find_parent_id_for_component(self, component_id): """ Given the ID of a component, returns the parent component's ID. :param string component_id: The ID of the component. :return: A tuple containing: * The type of the parent record; valid values are ArchivesSpaceClient.R...
[ "def", "find_parent_id_for_component", "(", "self", ",", "component_id", ")", ":", "cursor", "=", "self", ".", "db", ".", "cursor", "(", ")", "sql", "=", "\"SELECT parentResourceComponentId FROM ResourcesComponents WHERE resourceComponentId=%s\"", "count", "=", "cursor", ...
Given the ID of a component, returns the parent component's ID. :param string component_id: The ID of the component. :return: A tuple containing: * The type of the parent record; valid values are ArchivesSpaceClient.RESOURCE and ArchivesSpaceClient.RESOURCE_COMPONENT. * The ID o...
[ "Given", "the", "ID", "of", "a", "component", "returns", "the", "parent", "component", "s", "ID", "." ]
train
https://github.com/artefactual-labs/agentarchives/blob/af19ade56a90c64069cf46b50972fe72b6f10a45/agentarchives/archivists_toolkit/client.py#L355-L375
artefactual-labs/agentarchives
agentarchives/archivists_toolkit/client.py
ArchivistsToolkitClient.find_collection_ids
def find_collection_ids( self, search_pattern="", identifier="", page=None, page_size=30 ): """ Fetches a list of all resource IDs for every resource in the database. :param string search_pattern: A search pattern to use in looking up resources by title or resourceid. Th...
python
def find_collection_ids( self, search_pattern="", identifier="", page=None, page_size=30 ): """ Fetches a list of all resource IDs for every resource in the database. :param string search_pattern: A search pattern to use in looking up resources by title or resourceid. Th...
[ "def", "find_collection_ids", "(", "self", ",", "search_pattern", "=", "\"\"", ",", "identifier", "=", "\"\"", ",", "page", "=", "None", ",", "page_size", "=", "30", ")", ":", "cursor", "=", "self", ".", "db", ".", "cursor", "(", ")", "if", "search_pat...
Fetches a list of all resource IDs for every resource in the database. :param string search_pattern: A search pattern to use in looking up resources by title or resourceid. The search will match any title or resourceid containing this string; for example, "text" will match "this title h...
[ "Fetches", "a", "list", "of", "all", "resource", "IDs", "for", "every", "resource", "in", "the", "database", "." ]
train
https://github.com/artefactual-labs/agentarchives/blob/af19ade56a90c64069cf46b50972fe72b6f10a45/agentarchives/archivists_toolkit/client.py#L377-L424
mirca/vaneska
vaneska/models.py
Gaussian.evaluate
def evaluate(self, flux, xo, yo, a, b, c): """ Evaluate the Gaussian model Parameters ---------- flux : tf.Variable xo, yo : tf.Variable, tf.Variable Center coordiantes of the Gaussian. a, b, c : tf.Variable, tf.Variable Parameters that co...
python
def evaluate(self, flux, xo, yo, a, b, c): """ Evaluate the Gaussian model Parameters ---------- flux : tf.Variable xo, yo : tf.Variable, tf.Variable Center coordiantes of the Gaussian. a, b, c : tf.Variable, tf.Variable Parameters that co...
[ "def", "evaluate", "(", "self", ",", "flux", ",", "xo", ",", "yo", ",", "a", ",", "b", ",", "c", ")", ":", "dx", "=", "self", ".", "x", "-", "xo", "dy", "=", "self", ".", "y", "-", "yo", "psf", "=", "tf", ".", "exp", "(", "-", "(", "a",...
Evaluate the Gaussian model Parameters ---------- flux : tf.Variable xo, yo : tf.Variable, tf.Variable Center coordiantes of the Gaussian. a, b, c : tf.Variable, tf.Variable Parameters that control the rotation angle and the stretch along the ...
[ "Evaluate", "the", "Gaussian", "model" ]
train
https://github.com/mirca/vaneska/blob/9bbf0b16957ec765e5f30872c8d22470c66bfd83/vaneska/models.py#L49-L71
guillermo-carrasco/bcbio-nextgen-monitor
bcbio_monitor/parser/__init__.py
parse_log_line
def parse_log_line(line): """Parses a log line and returns it with more information :param line: str - A line from a bcbio-nextgen log :returns dict: A dictionary containing the line, if its a new step if its a Traceback or if the analysis is finished """ matches = re.search(r'^\...
python
def parse_log_line(line): """Parses a log line and returns it with more information :param line: str - A line from a bcbio-nextgen log :returns dict: A dictionary containing the line, if its a new step if its a Traceback or if the analysis is finished """ matches = re.search(r'^\...
[ "def", "parse_log_line", "(", "line", ")", ":", "matches", "=", "re", ".", "search", "(", "r'^\\[([^\\]]+)\\] ([^:]+: .*)'", ",", "line", ")", "error", "=", "re", ".", "search", "(", "r'Traceback'", ",", "line", ")", "if", "error", ":", "return", "{", "'...
Parses a log line and returns it with more information :param line: str - A line from a bcbio-nextgen log :returns dict: A dictionary containing the line, if its a new step if its a Traceback or if the analysis is finished
[ "Parses", "a", "log", "line", "and", "returns", "it", "with", "more", "information" ]
train
https://github.com/guillermo-carrasco/bcbio-nextgen-monitor/blob/6d059154d774140e1fd03a0e3625f607cef06f5a/bcbio_monitor/parser/__init__.py#L12-L35
Leeps-Lab/otree-redwood
otree_redwood/models.py
Event.message
def message(self): """Dictionary representation of the Event appropriate for JSON-encoding.""" return { 'timestamp': time.mktime(self.timestamp.timetuple())*1e3 + self.timestamp.microsecond/1e3, 'group': self.group_pk, 'participant': None if not self.participant else ...
python
def message(self): """Dictionary representation of the Event appropriate for JSON-encoding.""" return { 'timestamp': time.mktime(self.timestamp.timetuple())*1e3 + self.timestamp.microsecond/1e3, 'group': self.group_pk, 'participant': None if not self.participant else ...
[ "def", "message", "(", "self", ")", ":", "return", "{", "'timestamp'", ":", "time", ".", "mktime", "(", "self", ".", "timestamp", ".", "timetuple", "(", ")", ")", "*", "1e3", "+", "self", ".", "timestamp", ".", "microsecond", "/", "1e3", ",", "'group...
Dictionary representation of the Event appropriate for JSON-encoding.
[ "Dictionary", "representation", "of", "the", "Event", "appropriate", "for", "JSON", "-", "encoding", "." ]
train
https://github.com/Leeps-Lab/otree-redwood/blob/59212f61a256ef77e0a9ed392ff497ea83ee6245/otree_redwood/models.py#L50-L58
Leeps-Lab/otree-redwood
otree_redwood/models.py
Event.save
def save(self, *args, **kwargs): """Saving an Event automatically sets the timestamp if not already set.""" if self.timestamp is None: self.timestamp = timezone.now() super().save(*args, **kwargs)
python
def save(self, *args, **kwargs): """Saving an Event automatically sets the timestamp if not already set.""" if self.timestamp is None: self.timestamp = timezone.now() super().save(*args, **kwargs)
[ "def", "save", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "timestamp", "is", "None", ":", "self", ".", "timestamp", "=", "timezone", ".", "now", "(", ")", "super", "(", ")", ".", "save", "(", "*", "args...
Saving an Event automatically sets the timestamp if not already set.
[ "Saving", "an", "Event", "automatically", "sets", "the", "timestamp", "if", "not", "already", "set", "." ]
train
https://github.com/Leeps-Lab/otree-redwood/blob/59212f61a256ef77e0a9ed392ff497ea83ee6245/otree_redwood/models.py#L60-L65
Leeps-Lab/otree-redwood
otree_redwood/models.py
Group._on_connect
def _on_connect(self, participant): """Called from the WebSocket consumer. Checks if all players in the group have connected; runs :meth:`when_all_players_ready` once all connections are established. """ lock = get_redis_lock() if not lock: lock = fake_lock() ...
python
def _on_connect(self, participant): """Called from the WebSocket consumer. Checks if all players in the group have connected; runs :meth:`when_all_players_ready` once all connections are established. """ lock = get_redis_lock() if not lock: lock = fake_lock() ...
[ "def", "_on_connect", "(", "self", ",", "participant", ")", ":", "lock", "=", "get_redis_lock", "(", ")", "if", "not", "lock", ":", "lock", "=", "fake_lock", "(", ")", "with", "lock", ":", "self", ".", "refresh_from_db", "(", ")", "if", "self", ".", ...
Called from the WebSocket consumer. Checks if all players in the group have connected; runs :meth:`when_all_players_ready` once all connections are established.
[ "Called", "from", "the", "WebSocket", "consumer", ".", "Checks", "if", "all", "players", "in", "the", "group", "have", "connected", ";", "runs", ":", "meth", ":", "when_all_players_ready", "once", "all", "connections", "are", "established", "." ]
train
https://github.com/Leeps-Lab/otree-redwood/blob/59212f61a256ef77e0a9ed392ff497ea83ee6245/otree_redwood/models.py#L105-L133
Leeps-Lab/otree-redwood
otree_redwood/models.py
Group._on_disconnect
def _on_disconnect(self, participant): """Trigger the :meth:`when_player_disconnects` callback.""" player = None for p in self.get_players(): if p.participant == participant: player = p break self.when_player_disconnects(player)
python
def _on_disconnect(self, participant): """Trigger the :meth:`when_player_disconnects` callback.""" player = None for p in self.get_players(): if p.participant == participant: player = p break self.when_player_disconnects(player)
[ "def", "_on_disconnect", "(", "self", ",", "participant", ")", ":", "player", "=", "None", "for", "p", "in", "self", ".", "get_players", "(", ")", ":", "if", "p", ".", "participant", "==", "participant", ":", "player", "=", "p", "break", "self", ".", ...
Trigger the :meth:`when_player_disconnects` callback.
[ "Trigger", "the", ":", "meth", ":", "when_player_disconnects", "callback", "." ]
train
https://github.com/Leeps-Lab/otree-redwood/blob/59212f61a256ef77e0a9ed392ff497ea83ee6245/otree_redwood/models.py#L135-L142
Leeps-Lab/otree-redwood
otree_redwood/models.py
Group.send
def send(self, channel, payload): """Send a message with the given payload on the given channel. Messages are broadcast to all players in the group. """ with track('send_channel=' + channel): with track('create event'): Event.objects.create( ...
python
def send(self, channel, payload): """Send a message with the given payload on the given channel. Messages are broadcast to all players in the group. """ with track('send_channel=' + channel): with track('create event'): Event.objects.create( ...
[ "def", "send", "(", "self", ",", "channel", ",", "payload", ")", ":", "with", "track", "(", "'send_channel='", "+", "channel", ")", ":", "with", "track", "(", "'create event'", ")", ":", "Event", ".", "objects", ".", "create", "(", "group", "=", "self"...
Send a message with the given payload on the given channel. Messages are broadcast to all players in the group.
[ "Send", "a", "message", "with", "the", "given", "payload", "on", "the", "given", "channel", ".", "Messages", "are", "broadcast", "to", "all", "players", "in", "the", "group", "." ]
train
https://github.com/Leeps-Lab/otree-redwood/blob/59212f61a256ef77e0a9ed392ff497ea83ee6245/otree_redwood/models.py#L144-L158
Leeps-Lab/otree-redwood
otree_redwood/models.py
Group.save
def save(self, *args, **kwargs): """ BUG: Django save-the-change, which all oTree models inherit from, doesn't recognize changes to JSONField properties. So saving the model won't trigger a database save. This is a hack, but fixes it so any JSONFields get updated every save. oTre...
python
def save(self, *args, **kwargs): """ BUG: Django save-the-change, which all oTree models inherit from, doesn't recognize changes to JSONField properties. So saving the model won't trigger a database save. This is a hack, but fixes it so any JSONFields get updated every save. oTre...
[ "def", "save", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", ")", ".", "save", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "self", ".", "pk", "is", "not", "None", ":", "update_fields", "=", "kwargs", ...
BUG: Django save-the-change, which all oTree models inherit from, doesn't recognize changes to JSONField properties. So saving the model won't trigger a database save. This is a hack, but fixes it so any JSONFields get updated every save. oTree uses a forked version of save-the-change so...
[ "BUG", ":", "Django", "save", "-", "the", "-", "change", "which", "all", "oTree", "models", "inherit", "from", "doesn", "t", "recognize", "changes", "to", "JSONField", "properties", ".", "So", "saving", "the", "model", "won", "t", "trigger", "a", "database...
train
https://github.com/Leeps-Lab/otree-redwood/blob/59212f61a256ef77e0a9ed392ff497ea83ee6245/otree_redwood/models.py#L160-L176
Leeps-Lab/otree-redwood
otree_redwood/models.py
DecisionGroup.when_all_players_ready
def when_all_players_ready(self): """Initializes decisions based on ``player.initial_decision()``. If :attr:`num_subperiods` is set, starts a timed task to run the sub-periods. """ self.group_decisions = {} self.subperiod_group_decisions = {} for player in self.ge...
python
def when_all_players_ready(self): """Initializes decisions based on ``player.initial_decision()``. If :attr:`num_subperiods` is set, starts a timed task to run the sub-periods. """ self.group_decisions = {} self.subperiod_group_decisions = {} for player in self.ge...
[ "def", "when_all_players_ready", "(", "self", ")", ":", "self", ".", "group_decisions", "=", "{", "}", "self", ".", "subperiod_group_decisions", "=", "{", "}", "for", "player", "in", "self", ".", "get_players", "(", ")", ":", "self", ".", "group_decisions", ...
Initializes decisions based on ``player.initial_decision()``. If :attr:`num_subperiods` is set, starts a timed task to run the sub-periods.
[ "Initializes", "decisions", "based", "on", "player", ".", "initial_decision", "()", ".", "If", ":", "attr", ":", "num_subperiods", "is", "set", "starts", "a", "timed", "task", "to", "run", "the", "sub", "-", "periods", "." ]
train
https://github.com/Leeps-Lab/otree-redwood/blob/59212f61a256ef77e0a9ed392ff497ea83ee6245/otree_redwood/models.py#L213-L245
Leeps-Lab/otree-redwood
otree_redwood/models.py
DecisionGroup._subperiod_tick
def _subperiod_tick(self, current_interval, intervals): """Tick each sub-period, copying group_decisions to subperiod_group_decisions.""" self.refresh_from_db() for key, value in self.group_decisions.items(): self.subperiod_group_decisions[key] = value self.send('group_decis...
python
def _subperiod_tick(self, current_interval, intervals): """Tick each sub-period, copying group_decisions to subperiod_group_decisions.""" self.refresh_from_db() for key, value in self.group_decisions.items(): self.subperiod_group_decisions[key] = value self.send('group_decis...
[ "def", "_subperiod_tick", "(", "self", ",", "current_interval", ",", "intervals", ")", ":", "self", ".", "refresh_from_db", "(", ")", "for", "key", ",", "value", "in", "self", ".", "group_decisions", ".", "items", "(", ")", ":", "self", ".", "subperiod_gro...
Tick each sub-period, copying group_decisions to subperiod_group_decisions.
[ "Tick", "each", "sub", "-", "period", "copying", "group_decisions", "to", "subperiod_group_decisions", "." ]
train
https://github.com/Leeps-Lab/otree-redwood/blob/59212f61a256ef77e0a9ed392ff497ea83ee6245/otree_redwood/models.py#L247-L253
Leeps-Lab/otree-redwood
otree_redwood/models.py
DecisionGroup._on_decisions_event
def _on_decisions_event(self, event=None, **kwargs): """Called when an Event is received on the decisions channel. Saves the value in group_decisions. If num_subperiods is None, immediately broadcasts the event back out on the group_decisions channel. """ if not self.ran_ready_fu...
python
def _on_decisions_event(self, event=None, **kwargs): """Called when an Event is received on the decisions channel. Saves the value in group_decisions. If num_subperiods is None, immediately broadcasts the event back out on the group_decisions channel. """ if not self.ran_ready_fu...
[ "def", "_on_decisions_event", "(", "self", ",", "event", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "ran_ready_function", ":", "logger", ".", "warning", "(", "'ignoring decision from {} before when_all_players_ready: {}'", ".", "form...
Called when an Event is received on the decisions channel. Saves the value in group_decisions. If num_subperiods is None, immediately broadcasts the event back out on the group_decisions channel.
[ "Called", "when", "an", "Event", "is", "received", "on", "the", "decisions", "channel", ".", "Saves", "the", "value", "in", "group_decisions", ".", "If", "num_subperiods", "is", "None", "immediately", "broadcasts", "the", "event", "back", "out", "on", "the", ...
train
https://github.com/Leeps-Lab/otree-redwood/blob/59212f61a256ef77e0a9ed392ff497ea83ee6245/otree_redwood/models.py#L255-L268
Aluriak/tergraw
tergraw/view.py
clean
def clean(matrix): """Return a copy of given matrix where keys associated to space values are discarded""" return defaultdict(lambda: ' ', { k: v for k, v in matrix.items() if v != ' ' })
python
def clean(matrix): """Return a copy of given matrix where keys associated to space values are discarded""" return defaultdict(lambda: ' ', { k: v for k, v in matrix.items() if v != ' ' })
[ "def", "clean", "(", "matrix", ")", ":", "return", "defaultdict", "(", "lambda", ":", "' '", ",", "{", "k", ":", "v", "for", "k", ",", "v", "in", "matrix", ".", "items", "(", ")", "if", "v", "!=", "' '", "}", ")" ]
Return a copy of given matrix where keys associated to space values are discarded
[ "Return", "a", "copy", "of", "given", "matrix", "where", "keys", "associated", "to", "space", "values", "are", "discarded" ]
train
https://github.com/Aluriak/tergraw/blob/7f73cd286a77611e9c73f50b1e43be4f6643ac9f/tergraw/view.py#L11-L16