code
string
signature
string
docstring
string
loss_without_docstring
float64
loss_with_docstring
float64
factor
float64
return DXHTTPRequest('/%s/close' % object_id, input_params, always_retry=always_retry, **kwargs)
def record_close(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /record-xxxx/close API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Data-Object-Lifecycle#API-method%3A-%2Fclass-xxxx%2Fclose
3.249319
4.012622
0.809774
return DXHTTPRequest('/%s/describe' % object_id, input_params, always_retry=always_retry, **kwargs)
def record_describe(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /record-xxxx/describe API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Records#API-method%3A-%2Frecord-xxxx%2Fdescribe
2.996892
3.395362
0.882643
return DXHTTPRequest('/%s/getDetails' % object_id, input_params, always_retry=always_retry, **kwargs)
def record_get_details(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /record-xxxx/getDetails API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Details-and-Links#API-method%3A-%2Fclass-xxxx%2FgetDetails
3.285627
3.441417
0.954731
return DXHTTPRequest('/%s/listProjects' % object_id, input_params, always_retry=always_retry, **kwargs)
def record_list_projects(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /record-xxxx/listProjects API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Cloning#API-method%3A-%2Fclass-xxxx%2FlistProjects
3.103227
3.870749
0.801712
return DXHTTPRequest('/%s/removeTags' % object_id, input_params, always_retry=always_retry, **kwargs)
def record_remove_tags(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /record-xxxx/removeTags API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Tags#API-method%3A-%2Fclass-xxxx%2FremoveTags
2.987292
3.734895
0.799833
return DXHTTPRequest('/%s/removeTypes' % object_id, input_params, always_retry=always_retry, **kwargs)
def record_remove_types(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /record-xxxx/removeTypes API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Types#API-method%3A-%2Fclass-xxxx%2FremoveTypes
2.999398
3.721841
0.805891
return DXHTTPRequest('/%s/rename' % object_id, input_params, always_retry=always_retry, **kwargs)
def record_rename(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /record-xxxx/rename API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Name#API-method%3A-%2Fclass-xxxx%2Frename
2.82496
3.711251
0.761188
return DXHTTPRequest('/%s/setDetails' % object_id, input_params, always_retry=always_retry, **kwargs)
def record_set_details(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /record-xxxx/setDetails API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Details-and-Links#API-method%3A-%2Fclass-xxxx%2FsetDetails
3.475237
3.34326
1.039476
return DXHTTPRequest('/%s/setProperties' % object_id, input_params, always_retry=always_retry, **kwargs)
def record_set_properties(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /record-xxxx/setProperties API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Properties#API-method%3A-%2Fclass-xxxx%2FsetProperties
3.0497
3.541262
0.86119
return DXHTTPRequest('/%s/setVisibility' % object_id, input_params, always_retry=always_retry, **kwargs)
def record_set_visibility(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /record-xxxx/setVisibility API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Visibility#API-method%3A-%2Fclass-xxxx%2FsetVisibility
3.618025
3.964073
0.912704
return DXHTTPRequest('/system/describeDataObjects', input_params, always_retry=always_retry, **kwargs)
def system_describe_data_objects(input_params={}, always_retry=True, **kwargs)
Invokes the /system/describeDataObjects API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/System-Methods#API-method:-/system/describeDataObjects
3.448373
4.913497
0.701816
return DXHTTPRequest('/system/describeExecutions', input_params, always_retry=always_retry, **kwargs)
def system_describe_executions(input_params={}, always_retry=True, **kwargs)
Invokes the /system/describeExecutions API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/System-Methods#API-method:-/system/describeExecutions
3.508651
4.316011
0.812938
return DXHTTPRequest('/system/describeProjects', input_params, always_retry=always_retry, **kwargs)
def system_describe_projects(input_params={}, always_retry=True, **kwargs)
Invokes the /system/describeProjects API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/System-Methods#API-method:-/system/describeProjects
3.857428
4.527996
0.851906
return DXHTTPRequest('/system/findAffiliates', input_params, always_retry=always_retry, **kwargs)
def system_find_affiliates(input_params={}, always_retry=True, **kwargs)
Invokes the /system/findAffiliates API method.
3.783201
3.340026
1.132686
return DXHTTPRequest('/system/findApps', input_params, always_retry=always_retry, **kwargs)
def system_find_apps(input_params={}, always_retry=True, **kwargs)
Invokes the /system/findApps API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindApps
3.823913
5.232074
0.73086
return DXHTTPRequest('/system/findDataObjects', input_params, always_retry=always_retry, **kwargs)
def system_find_data_objects(input_params={}, always_retry=True, **kwargs)
Invokes the /system/findDataObjects API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindDataObjects
3.656392
5.248327
0.696678
return DXHTTPRequest('/system/findGlobalWorkflows', input_params, always_retry=always_retry, **kwargs)
def system_find_global_workflows(input_params={}, always_retry=True, **kwargs)
Invokes the /system/findGlobalWorkflows API method.
3.405236
3.041508
1.119588
return DXHTTPRequest('/system/resolveDataObjects', input_params, always_retry=always_retry, **kwargs)
def system_resolve_data_objects(input_params={}, always_retry=True, **kwargs)
Invokes the /system/resolveDataObjects API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/System-Methods#API-method:-/system/resolveDataObjects
3.631024
5.007755
0.72508
return DXHTTPRequest('/system/findExecutions', input_params, always_retry=always_retry, **kwargs)
def system_find_executions(input_params={}, always_retry=True, **kwargs)
Invokes the /system/findExecutions API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindExecutions
3.485262
4.610849
0.755883
return DXHTTPRequest('/system/findAnalyses', input_params, always_retry=always_retry, **kwargs)
def system_find_analyses(input_params={}, always_retry=True, **kwargs)
Invokes the /system/findAnalyses API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindAnalyses
3.954512
5.015233
0.7885
return DXHTTPRequest('/system/findDatabases', input_params, always_retry=always_retry, **kwargs)
def system_find_databases(input_params={}, always_retry=True, **kwargs)
Invokes the /system/findDatabases API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindDatabases
3.816944
5.700819
0.669543
return DXHTTPRequest('/system/findJobs', input_params, always_retry=always_retry, **kwargs)
def system_find_jobs(input_params={}, always_retry=True, **kwargs)
Invokes the /system/findJobs API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindJobs
3.961932
5.104447
0.776173
return DXHTTPRequest('/system/findProjects', input_params, always_retry=always_retry, **kwargs)
def system_find_projects(input_params={}, always_retry=True, **kwargs)
Invokes the /system/findProjects API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindProjects
3.695713
5.335766
0.69263
return DXHTTPRequest('/system/findUsers', input_params, always_retry=always_retry, **kwargs)
def system_find_users(input_params={}, always_retry=True, **kwargs)
Invokes the /system/findUsers API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method%3A-%2Fsystem%2FfindUsers
3.731944
5.435518
0.686585
return DXHTTPRequest('/system/findProjectMembers', input_params, always_retry=always_retry, **kwargs)
def system_find_project_members(input_params={}, always_retry=True, **kwargs)
Invokes the /system/findProjectMembers API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method:-/system/findProjectMembers
3.42285
4.837612
0.70755
return DXHTTPRequest('/system/findOrgs', input_params, always_retry=always_retry, **kwargs)
def system_find_orgs(input_params={}, always_retry=True, **kwargs)
Invokes the /system/findOrgs API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method:-/system/findOrgs
3.558672
4.556001
0.781096
return DXHTTPRequest('/system/generateBatchInputs', input_params, always_retry=always_retry, **kwargs)
def system_generate_batch_inputs(input_params={}, always_retry=True, **kwargs)
Invokes the /system/generateBatchInputs API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method:-/system/generateBatchInputs
4.122595
4.622102
0.891931
return DXHTTPRequest('/system/globalSearch', input_params, always_retry=always_retry, **kwargs)
def system_global_search(input_params={}, always_retry=True, **kwargs)
Invokes the /system/globalSearch API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Search#API-method:-/system/globalSearch
3.872365
5.521649
0.701306
return DXHTTPRequest('/system/greet', input_params, always_retry=always_retry, **kwargs)
def system_greet(input_params={}, always_retry=True, **kwargs)
Invokes the /system/greet API method.
4.411052
3.749522
1.17643
return DXHTTPRequest('/system/headers', input_params, always_retry=always_retry, **kwargs)
def system_headers(input_params={}, always_retry=True, **kwargs)
Invokes the /system/headers API method.
3.643879
3.843071
0.948169
return DXHTTPRequest('/system/shortenURL', input_params, always_retry=always_retry, **kwargs)
def system_shorten_url(input_params={}, always_retry=True, **kwargs)
Invokes the /system/shortenURL API method.
3.678652
3.535676
1.040438
return DXHTTPRequest('/system/whoami', input_params, always_retry=always_retry, **kwargs)
def system_whoami(input_params={}, always_retry=True, **kwargs)
Invokes the /system/whoami API method.
3.435854
3.799717
0.904239
return DXHTTPRequest('/%s/describe' % object_id, input_params, always_retry=always_retry, **kwargs)
def user_describe(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /user-xxxx/describe API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Users#API-method%3A-%2Fuser-xxxx%2Fdescribe
3.063274
3.892719
0.786924
return DXHTTPRequest('/%s/update' % object_id, input_params, always_retry=always_retry, **kwargs)
def user_update(object_id, input_params={}, always_retry=False, **kwargs)
Invokes the /user-xxxx/update API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Users#API-method%3A-%2Fuser-xxxx%2Fupdate
3.581838
4.298423
0.833291
return DXHTTPRequest('/%s/addStage' % object_id, input_params, always_retry=always_retry, **kwargs)
def workflow_add_stage(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /workflow-xxxx/addStage API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FaddStage
3.609261
4.232947
0.852659
return DXHTTPRequest('/%s/addTags' % object_id, input_params, always_retry=always_retry, **kwargs)
def workflow_add_tags(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /workflow-xxxx/addTags API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Tags#API-method%3A-%2Fclass-xxxx%2FaddTags
3.273696
3.843825
0.851677
return DXHTTPRequest('/%s/addTypes' % object_id, input_params, always_retry=always_retry, **kwargs)
def workflow_add_types(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /workflow-xxxx/addTypes API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Types#API-method%3A-%2Fclass-xxxx%2FaddTypes
3.339802
3.881081
0.860534
return DXHTTPRequest('/%s/close' % object_id, input_params, always_retry=always_retry, **kwargs)
def workflow_close(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /workflow-xxxx/close API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Data-Object-Lifecycle#API-method%3A-%2Fclass-xxxx%2Fclose
3.329723
4.315219
0.771623
return DXHTTPRequest('/%s/describe' % object_id, input_params, always_retry=always_retry, **kwargs)
def workflow_describe(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /workflow-xxxx/describe API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2Fdescribe
3.438823
3.860735
0.890717
return DXHTTPRequest('/%s/dryRun' % object_id, input_params, always_retry=always_retry, **kwargs)
def workflow_dry_run(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /workflow-xxxx/dryRun API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FdryRun
3.835841
3.796051
1.010482
return DXHTTPRequest('/%s/getDetails' % object_id, input_params, always_retry=always_retry, **kwargs)
def workflow_get_details(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /workflow-xxxx/getDetails API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Details-and-Links#API-method%3A-%2Fclass-xxxx%2FgetDetails
3.635269
3.720739
0.977029
return DXHTTPRequest('/%s/isStageCompatible' % object_id, input_params, always_retry=always_retry, **kwargs)
def workflow_is_stage_compatible(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /workflow-xxxx/isStageCompatible API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FisStageCompatible
3.750827
3.637201
1.03124
return DXHTTPRequest('/%s/listProjects' % object_id, input_params, always_retry=always_retry, **kwargs)
def workflow_list_projects(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /workflow-xxxx/listProjects API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Cloning#API-method%3A-%2Fclass-xxxx%2FlistProjects
3.435024
4.095092
0.838815
return DXHTTPRequest('/%s/moveStage' % object_id, input_params, always_retry=always_retry, **kwargs)
def workflow_move_stage(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /workflow-xxxx/moveStage API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FmoveStage
3.45614
4.384871
0.788197
return DXHTTPRequest('/%s/overwrite' % object_id, input_params, always_retry=always_retry, **kwargs)
def workflow_overwrite(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /workflow-xxxx/overwrite API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2Foverwrite
3.64633
4.393746
0.829891
return DXHTTPRequest('/%s/removeStage' % object_id, input_params, always_retry=always_retry, **kwargs)
def workflow_remove_stage(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /workflow-xxxx/removeStage API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FremoveStage
3.482835
4.240803
0.821268
return DXHTTPRequest('/%s/removeTags' % object_id, input_params, always_retry=always_retry, **kwargs)
def workflow_remove_tags(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /workflow-xxxx/removeTags API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Tags#API-method%3A-%2Fclass-xxxx%2FremoveTags
3.119026
3.908909
0.797928
return DXHTTPRequest('/%s/removeTypes' % object_id, input_params, always_retry=always_retry, **kwargs)
def workflow_remove_types(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /workflow-xxxx/removeTypes API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Types#API-method%3A-%2Fclass-xxxx%2FremoveTypes
3.209309
3.936772
0.815213
return DXHTTPRequest('/%s/rename' % object_id, input_params, always_retry=always_retry, **kwargs)
def workflow_rename(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /workflow-xxxx/rename API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Name#API-method%3A-%2Fclass-xxxx%2Frename
3.007368
3.94594
0.762142
return DXHTTPRequest('/%s/validateBatch' % object_id, input_params, always_retry=always_retry, **kwargs)
def workflow_validate_batch(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /workflow-xxxx/validateBatch API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FvalidateBatch
3.35405
3.964237
0.846077
return DXHTTPRequest('/%s/setDetails' % object_id, input_params, always_retry=always_retry, **kwargs)
def workflow_set_details(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /workflow-xxxx/setDetails API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Details-and-Links#API-method%3A-%2Fclass-xxxx%2FsetDetails
3.422015
3.566893
0.959383
return DXHTTPRequest('/%s/setProperties' % object_id, input_params, always_retry=always_retry, **kwargs)
def workflow_set_properties(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /workflow-xxxx/setProperties API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Properties#API-method%3A-%2Fclass-xxxx%2FsetProperties
3.163846
3.838928
0.824148
return DXHTTPRequest('/%s/setStageInputs' % object_id, input_params, always_retry=always_retry, **kwargs)
def workflow_set_stage_inputs(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /workflow-xxxx/setStageInputs API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FsetStageInputs
3.492741
3.898901
0.895827
return DXHTTPRequest('/%s/setVisibility' % object_id, input_params, always_retry=always_retry, **kwargs)
def workflow_set_visibility(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /workflow-xxxx/setVisibility API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Visibility#API-method%3A-%2Fclass-xxxx%2FsetVisibility
3.681696
4.165773
0.883797
return DXHTTPRequest('/%s/update' % object_id, input_params, always_retry=always_retry, **kwargs)
def workflow_update(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /workflow-xxxx/update API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2Fupdate
3.528178
4.61192
0.765013
return DXHTTPRequest('/%s/updateStageExecutable' % object_id, input_params, always_retry=always_retry, **kwargs)
def workflow_update_stage_executable(object_id, input_params={}, always_retry=True, **kwargs)
Invokes the /workflow-xxxx/updateStageExecutable API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2FupdateStageExecutable
3.500612
3.924764
0.891929
# If the image is already encoded in Base64, we have nothing to do here if "src" not in img.attrs or img["src"].startswith("data:"): return elif re.match("https?://", img["src"]): img_data = _load_url(img["src"]).read() else: img_data = _load_file(img["src"]).read() img_...
def _image_to_data(img)
Does the work of encoding an image into Base64
3.012202
2.790539
1.079434
if "href" in link.attrs and (re.search("\.css$", link["href"])) or ("rel" in link.attrs and link["rel"] is "stylesheet") or ("type" in link.attrs and link["type"] is "text/css"): if re.match("https?://", link["href"]): css_data = _load_url(link["href"]).read() else: css_...
def _bake_css(link)
Takes a link element and turns it into an inline style link if applicable
2.745254
2.606675
1.053163
if "src" in script.attrs: if re.match("https?://", script["src"]): script_data = _load_url(script["src"]).read() else: script_data = _load_file(script["src"]).read() script.clear() if USING_PYTHON2: script.string = "\n" + script_data + "\n" ...
def _bake_script(script)
Takes a script element and bakes it in only if it contains a remote resource
2.845523
2.636571
1.079251
if not os.path.exists(path): parser.error("{} was not found!".format(path)) if USING_PYTHON2: mode = "r" else: mode = "rb" try: f = open(path, mode) return f except IOError as ex: parser.error("{path} could not be read due to an I/O error! ({ex})"...
def _load_file(path)
Loads a file from the local filesystem
3.198411
3.073382
1.040681
try: response = requests.get(url) return BytesIO(response.content) except IOError as ex: parser.error("{url} could not be loaded remotely! ({ex})".format(url=url, ex=ex))
def _load_url(url)
Loads a URL resource from a remote server
4.228206
4.184722
1.010391
if len(soup.find_all("script")) == 0: soup_str = soup.prettify(formatter=None).strip() else: soup_str = str(soup.html) soup_str = re.sub("&amp;", "&", soup_str) soup_str = re.sub("&lt;", "<", soup_str) soup_str = re.sub("&gt;", ">", soup_str) return soup_str
def _get_bs4_string(soup)
Outputs a BeautifulSoup object as a string that should hopefully be minimally modified
2.152445
2.097747
1.026075
src = os.path.realpath(src) path = os.path.dirname(src) filename = os.path.basename(src) html = _load_file(src).read() if imghdr.what("", html): html = "<html><body><img src='{}'/></body></html>".format(cgi.escape(filename)) # Change to the file's directory so image files with rela...
def bake(src)
Runs the encoder on the given source file
2.961593
3.009067
0.984223
[project, path, n] = parse_destination(destination) try: dxfile = dxpy.upload_string(html, media_type="text/html", project=project, folder=path, hidden=True, name=name or None) return dxfile.get_id() except dxpy.DXAPIError as ex: parser.error("Could not upload HTML report to DNA...
def upload_html(destination, html, name=None)
Uploads the HTML to a file on the server
4.958365
4.998803
0.991911
[project, path, name] = parse_destination(destination) files = [dxpy.dxlink(file_id) for file_id in file_ids] details = {"files": files} if width: details["width"] = width if height: details["height"] = height try: dxrecord = dxpy.new_dxrecord(project=project, folder...
def create_record(destination, file_ids, width=None, height=None)
Creates a master record for the HTML report; this doesn't contain contain the actual HTML, but reports are required to be records rather than files and we can link more than one HTML file to a report
3.760163
3.556654
1.057219
try: out_file = open(filename, "w") out_file.write(html) out_file.close() except IOError as ex: parser.error("Could not write baked HTML to local file {name}. ({ex})".format(name=filename, ex=ex))
def save(filename, html)
Creates a baked HTML file on the local system
3.722192
3.163002
1.176791
if size == 0: magnitude = 0 level = 0 else: magnitude = math.floor(math.log(size, 10)) level = int(min(math.floor(magnitude // 3), 4)) return ('%d' if level == 0 else '%.2f') % (float(size) / 2**(level*10)) + ' ' + SIZE_LEVEL[level]
def get_size_str(size)
Formats a byte size as a string. The returned string is no more than 9 characters long.
4.0285
4.054832
0.993506
''' :param thing: something that might be a job-based object reference hash :param reftype: type that a job-based object reference would be (default is dict) ''' return isinstance(thing, reftype) and \ ((len(thing) == 2 and \ isinstance(thing.get('field'), basestring) and \ ...
def is_job_ref(thing, reftype=dict)
:param thing: something that might be a job-based object reference hash :param reftype: type that a job-based object reference would be (default is dict)
3.1061
2.163688
1.435558
''' :param desc: The describe hash of a DNAnexus entity :type desc: dict Depending on the class of the entity, this method will print a formatted and human-readable string containing the data in *desc*. ''' if desc['class'] in ['project', 'workspace', 'container']: print_project_des...
def print_desc(desc, verbose=False)
:param desc: The describe hash of a DNAnexus entity :type desc: dict Depending on the class of the entity, this method will print a formatted and human-readable string containing the data in *desc*.
3.402907
2.063038
1.649464
# If you make this method consume an additional field, you must add it to # get_ls_l_desc_fields above. if 'state' in desc: state_len = len(desc['state']) if desc['state'] != 'closed': state_str = YELLOW() + desc['state'] + ENDC() else: state_str = GREEN(...
def get_ls_l_desc(desc, include_folder=False, include_project=False)
desc must have at least all the fields given by get_ls_l_desc_fields.
3.453392
3.278782
1.053255
''' :param desc: hash of execution's describe output :param has_children: whether the execution has children to be printed :param single_result: whether the execution is displayed as a single result or as part of an execution tree :param is_cached_result: whether the execution should be formatted as...
def get_find_executions_string(desc, has_children, single_result=False, show_outputs=True, is_cached_result=False)
:param desc: hash of execution's describe output :param has_children: whether the execution has children to be printed :param single_result: whether the execution is displayed as a single result or as part of an execution tree :param is_cached_result: whether the execution should be formatted as a cached re...
3.792022
3.411508
1.111538
try: if instance_count_arg is None: return cls(None) if isinstance(instance_count_arg, basestring) or isinstance(instance_count_arg, int): return cls({entrypoint: {"clusterSpec": {"initialInstanceCount": int(instance_count_arg)}}}) if ...
def from_instance_count(cls, instance_count_arg, entrypoint="*")
Returns a SystemRequirementsDict that can be passed as a "systemRequirements" input to job/new or run/ API calls. The instance_count_arg should be either a: * string or int eg. "6" or 8 * dictionary, eg. {"main": 4, "other_function": 2}
2.932437
2.737191
1.071331
if instance_type_arg is None: return cls(None) if isinstance(instance_type_arg, basestring): # By default, all entry points ("*") should use this instance type return cls({entrypoint: {"instanceType": instance_type_arg}}) if isinstance(instance_type_a...
def from_instance_type(cls, instance_type_arg, entrypoint="*")
Returns SystemRequirementsDict that can be passed as a "systemRequirements" input to job/new or run/ API calls. The instance_type_arg should be either a: * string, eg. mem1_ssd1_x2 * dictionary, eg. {"main": "mem2_hdd2_x2", "other_function": "mem2_hdd2_x1"}
3.86225
3.702705
1.043089
if _type not in ('all', 'clusterSpec', 'instanceType'): raise DXError("Expected '_type' to be either 'all', 'clusterSpec', or 'instanceType'") if _type == 'all': return cls(system_requirements) extracted = defaultdict(dict) for entrypoint, req in system...
def from_sys_requirements(cls, system_requirements, _type='all')
Returns SystemRequirementsDict encapsulating system requirements. It can extract only entrypoints with specific fields ('clusterSpec', 'instanceType', etc), depending on the value of _type.
3.74903
2.459376
1.524383
if d1 is None and d2 is None: return None d1 = d1 or {} d2 = d2 or {} added = {} for key in set(list(d1.keys()) + list(d2.keys())): added[key] = dict(d1.get(key, {}), **(d2.get(key, {}))) return added
def _add_dict_values(self, d1, d2)
Merges the values of two dictionaries, which are expected to be dictionaries, e.g d1 = {'a': {'x': pqr}} d2 = {'a': {'y': lmn}, 'b': {'y': rst}} will return: {'a': {'x': pqr, 'y': lmn}, 'b': {'y': rst}}. Collisions of the keys of the sub-dictionaries are not checked.
2.270057
2.089733
1.086291
''' :rtype: :class:`DXRecord` :param details: The contents of the record to be created. :type details: dict Additional optional parameters not listed: all those under :func:`dxpy.bindings.DXDataObject.new`, except `details`. Creates a new remote record object with project set to *project*...
def new_dxrecord(details=None, **kwargs)
:rtype: :class:`DXRecord` :param details: The contents of the record to be created. :type details: dict Additional optional parameters not listed: all those under :func:`dxpy.bindings.DXDataObject.new`, except `details`. Creates a new remote record object with project set to *project* and ret...
5.285036
1.457084
3.627133
if "init_from" in kwargs: if kwargs["init_from"] is not None: if not isinstance(kwargs["init_from"], DXRecord): raise DXError("Expected instance of DXRecord to init_from") dx_hash["initializeFrom"] = \ {"id": kwargs["i...
def _new(self, dx_hash, close=False, **kwargs)
:param dx_hash: Standard hash populated in :func:`dxpy.bindings.DXDataObject.new()` containing attributes common to all data object classes. :type dx_hash: dict :param init_from: Record from which to initialize the metadata :type init_from: :class:`DXRecord` :param close: Whether or not ...
3.17248
2.620682
1.210555
if isinstance(foo, dict): for (key, val) in list(foo.items()): if isinstance(val, dict): _recursive_cleanup(val) if val == "" or val == [] or val == {}: del foo[key]
def _recursive_cleanup(foo)
Aggressively cleans up things that look empty.
2.293571
2.113652
1.085122
try: old_cwd = os.getcwd() os.chdir(destination_directory) if isinstance(executable, dxpy.DXWorkflow): _dump_workflow(executable, describe_output) elif isinstance(executable, dxpy.DXGlobalWorkflow): # Add inputs, outputs, stages. These fields contain regi...
def dump_executable(executable, destination_directory, omit_resources=False, describe_output={})
Reconstitutes an app, applet, or a workflow into a directory that would create a functionally identical executable if "dx build" were run on it. destination_directory will be the root source directory for the executable. :param executable: executable, i.e. app, applet, or workflow, to be dumped :ty...
6.39874
5.887504
1.086834
if not isinstance(batchsize, int) or batchsize <= 0 or batchsize > 1000: raise ValueError("batchsize for resolve_data_objects must be a positive integer not exceeding 1000") args = {} if project: args.update({'project': project}) if folder: args.update({'folder': folder}) ...
def resolve_data_objects(objects, project=None, folder=None, batchsize=1000)
:param objects: Data object specifications, each with fields "name" (required), "folder", and "project" :type objects: list of dictionaries :param project: ID of project context; a data object's project defaults to this if not specified for that object :type project: ...
2.96736
2.772943
1.070112
''' Takes an API method handler (dxpy.api.find*) and calls it with *query*, and then wraps a generator around its output. Used by the methods below. Note that this function may only be used for /system/find* methods. ''' num_results = 0 if "limit" not in query: query["limit"] = first_p...
def _find(api_method, query, limit, return_handler, first_page_size, **kwargs)
Takes an API method handler (dxpy.api.find*) and calls it with *query*, and then wraps a generator around its output. Used by the methods below. Note that this function may only be used for /system/find* methods.
4.574163
2.706125
1.6903
return find_global_executables(dxpy.api.system_find_apps, name=name, name_mode=name_mode, category=category, all_versions=all_versions, published=published, billed_to=billed_to, created_by=created_by, devel...
def find_apps(name=None, name_mode='exact', category=None, all_versions=None, published=None, billed_to=None, created_by=None, developer=None, created_after=None, created_before=None, modified_after=None, modified_before=None, describe=False, limit=N...
This method is identical to :meth:`find_global_executables()` with the API method used: :meth:`system_find_apps()`.
1.687725
1.523105
1.108082
return _find_one(find_data_objects, zero_ok=zero_ok, more_ok=more_ok, **kwargs)
def find_one_data_object(zero_ok=False, more_ok=True, **kwargs)
:param zero_ok: If False (default), :class:`~dxpy.exceptions.DXSearchError` is raised if the search has 0 results; if True, returns None if the search has 0 results :type zero_ok: bool :param more_ok: If False, :class:`~dxpy.exceptions.DXSearchError` is raised if the sear...
2.702999
4.975706
0.543239
return _find_one(find_projects, zero_ok=zero_ok, more_ok=more_ok, **kwargs)
def find_one_project(zero_ok=False, more_ok=True, **kwargs)
:param zero_ok: If False (default), :class:`~dxpy.exceptions.DXSearchError` is raised if the search has 0 results; if True, returns None if the search has 0 results :type zero_ok: bool :param more_ok: If False, :class:`~dxpy.exceptions.DXSearchError` is raised if the sear...
2.778035
5.206185
0.533603
return _find_one(find_apps, zero_ok=zero_ok, more_ok=more_ok, **kwargs)
def find_one_app(zero_ok=False, more_ok=True, **kwargs)
:param zero_ok: If False (default), :class:`~dxpy.exceptions.DXSearchError` is raised if the search has 0 results; if True, returns None if the search has 0 results :type zero_ok: bool :param more_ok: If False, :class:`~dxpy.exceptions.DXSearchError` is raised if the sear...
2.747964
4.904448
0.5603
if "limit" not in query: query["limit"] = min(first_page_size, 1000) while True: resp = api_method(org_id, query) for result in resp["results"]: yield result # set up next query if resp["next"] is not None: query["starting"] = resp["next"] ...
def _org_find(api_method, org_id, query, first_page_size=100)
Takes an API method handler ``dxpy.api.org_find...`` and calls it with *org_id* and *query*, then wraps a generator around its output. Used by :meth:`org_find_members` and :meth:`org_find_projects` below. :param first_page_size: The number of results that the initial API call will return. :type first_p...
2.483693
2.966571
0.837227
query = {} if level is not None: query["level"] = level query["describe"] = describe return _org_find(dxpy.api.org_find_members, org_id, query)
def org_find_members(org_id=None, level=None, describe=False)
:param org_id: ID of the organization :type org_id: string :param level: The membership level in the org that each member in the result set must have (one of "MEMBER" or "ADMIN") :type level: string :param describe: Whether or not to return the response of ``dxpy.api.user_describe`` for each res...
4.318653
3.964571
1.089311
query = {} if name is not None: if name_mode == 'exact': query['name'] = name elif name_mode == 'glob': query['name'] = {'glob': name} elif name_mode == 'regexp': query['name'] = {'regexp': name} else: raise DXError('org_find_p...
def org_find_projects(org_id=None, name=None, name_mode='exact', ids=None, properties=None, tags=None, describe=False, public=None, created_after=None, created_before=None, region=None, containsPHI=None)
:param org_id: ID of the organization :type org_id: string :param name: Name that each result must have (also see *name_mode* param) :type name: string :param name_mode: Method by which to interpret the *name* param ("exact": exact match, "glob": use "*" and "?" as wildcards, "regexp": interpret...
1.751187
1.688356
1.037214
return _find(dxpy.api.system_find_orgs, query, limit=None, return_handler=False, first_page_size=first_page_size)
def find_orgs(query, first_page_size=10)
:param query: The input to the /system/findOrgs API method. :type query: dict :param first_page_size: The number of results that the initial /system/findOrgs API call will return; default 10, max 1000. Subsequent calls will raise the number of returned results exponentially up to a max ...
6.568615
6.812107
0.964256
''' Create a set of directories, so we could store the input files. For example, seq1 could be stored under: /in/seq1/NC_001122.fasta TODO: this call could fail, we need to report a reasonable error code Note that we create a directory for every file array, even if it has zero inputs. ...
def _create_dirs(idir, dirs)
Create a set of directories, so we could store the input files. For example, seq1 could be stored under: /in/seq1/NC_001122.fasta TODO: this call could fail, we need to report a reasonable error code Note that we create a directory for every file array, even if it has zero inputs.
9.986649
2.235705
4.466889
''' Create a dict of values for the downloaded files. This is similar to the variables created when running a bash app. ''' file_key_descs, _ignore = file_load_utils.analyze_bash_vars( file_load_utils.get_input_json_file(), None) flattened_dict = {} def add_if_no_collision(key, va...
def _gen_helper_dict(filtered_inputs)
Create a dict of values for the downloaded files. This is similar to the variables created when running a bash app.
3.960624
2.867342
1.381288
''' Ensure at least ~1.2 GB memory per thread, see PTFM-18767 ''' return min(max_threads, num_cores, max(int(mem_available_mb/1200), 1))
def _get_num_parallel_threads(max_threads, num_cores, mem_available_mb)
Ensure at least ~1.2 GB memory per thread, see PTFM-18767
9.18889
2.557507
3.592909
paragraphs = string.split('\n\n') refilled_paragraphs = [fill(paragraph) if not paragraph.startswith(ignored_prefix) else paragraph for paragraph in paragraphs] return '\n\n'.join(refilled_paragraphs).strip('\n')
def refill_paragraphs(string, ignored_prefix=' ')
Refills the given text, where the text is composed of paragraphs separated by blank lines (i.e. '\n\n'). Lines that begin with ignored_prefix are not touched; this can be used to keep indented code snippets from being incorrectly reformatted.
2.534758
2.557941
0.990937
if args.json: print(json.dumps(list(results), indent=4)) elif args.brief: for result in results: print(result['id']) else: if args.func.__name__ in ("find_projects", "org_find_projects"): _format_find_projects_results(results) elif args.func.__nam...
def format_find_results(args, results)
Formats the output of ``dx find ...`` commands for `--json` and `--brief` arguments; also formats if no formatting arguments are given. Currently used for ``dx find projects``, ``dx find org_projects``, ``dx find org_apps``, and ``dx find org_members``
3.199214
2.868321
1.115361
draw_lines() draw_histogram() draw_bar_chart() destination = "-r /report" if use_html: generate_html() command = "dx-build-report-html {h} {d}".format(h=html_filename, d=destination) else: command = "dx-build-report-html {l} {b} {h} {d}".format(l=lines_filename, b=ba...
def main(**kwargs)
Draw a couple of simple graphs and optionally generate an HTML file to upload them
5.329749
4.730925
1.126576
mu, sigma = 100, 15 x = mu + sigma * numpy.random.randn(10000) fig = pyplot.figure() ax = fig.add_subplot(111) n, bins, patches = ax.hist(x, 50, normed=1, facecolor='green', alpha=0.75) ax.set_xlabel('Random number generated') ax.set_ylabel('Probability') ax.set_xlim(40, 160) ...
def draw_histogram()
Uses sample code from http://matplotlib.org/1.2.1/examples/api/histogram_demo.html
1.963489
1.841484
1.066253
N = 5 menMeans = (20, 35, 30, 35, 27) menStd = (2, 3, 4, 1, 2) ind = numpy.arange(N) width = 0.35 fig = pyplot.figure() ax = fig.add_subplot(111) rects1 = ax.bar(ind, menMeans, width, color='r', yerr=menStd) womenMeans = (25, 32, 34, 20, 25) womenStd = (3, 5, 2, 3, 3) ...
def draw_bar_chart()
Uses sample code from http://matplotlib.org/1.2.1/examples/api/barchart_demo.html
1.429386
1.396799
1.02333
r = numpy.random.randn(200) fig = pyplot.figure() ax = fig.add_subplot(111) ax.plot(r) ax.grid(True) pyplot.savefig(lines_filename)
def draw_lines()
Draws a line between a set of random values
4.117383
3.651327
1.12764
html_file = open(html_filename, "w") html_file.write("<html><body>") html_file.write("<h1>Here are some graphs for you!</h1>") for image in [lines_filename, bars_filename, histogram_filename]: html_file.write("<div><h2>{0}</h2><img src='{0}' /></div>".format(image)) html_file.write("</b...
def generate_html()
Generate an HTML file incorporating the images produced by this script
2.836811
2.714617
1.045013
def clean(s): return u''.join([c if c in ASCII_PRINTABLE else '?' for c in s]) if USING_PYTHON2: try: return unicode(o) except: try: s = str(o) try: return s.decode("utf-8") except: ...
def _safe_unicode(o)
Returns an equivalent unicode object, trying harder to avoid dependencies on the Python default encoding.
4.888691
4.710323
1.037867