repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
dnanexus/dx-toolkit | src/python/dxpy/bindings/download_all_inputs.py | _get_num_parallel_threads | def _get_num_parallel_threads(max_threads, num_cores, mem_available_mb):
'''
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)) | python | def _get_num_parallel_threads(max_threads, num_cores, mem_available_mb):
'''
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",
")",
":",
"return",
"min",
"(",
"max_threads",
",",
"num_cores",
",",
"max",
"(",
"int",
"(",
"mem_available_mb",
"/",
"1200",
")",
",",
"1",
")",
")"
] | Ensure at least ~1.2 GB memory per thread, see PTFM-18767 | [
"Ensure",
"at",
"least",
"~1",
".",
"2",
"GB",
"memory",
"per",
"thread",
"see",
"PTFM",
"-",
"18767"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/download_all_inputs.py#L108-L112 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/download_all_inputs.py | download_all_inputs | def download_all_inputs(exclude=None, parallel=False, max_threads=8):
'''
:param exclude: List of input variables that should not be downloaded.
:type exclude: Array of strings
:param parallel: Should we download multiple files in parallel? (default: False)
:type filename: boolean
:param max_thr... | python | def download_all_inputs(exclude=None, parallel=False, max_threads=8):
'''
:param exclude: List of input variables that should not be downloaded.
:type exclude: Array of strings
:param parallel: Should we download multiple files in parallel? (default: False)
:type filename: boolean
:param max_thr... | [
"def",
"download_all_inputs",
"(",
"exclude",
"=",
"None",
",",
"parallel",
"=",
"False",
",",
"max_threads",
"=",
"8",
")",
":",
"# Input directory, where all inputs are downloaded",
"idir",
"=",
"file_load_utils",
".",
"get_input_dir",
"(",
")",
"try",
":",
"job... | :param exclude: List of input variables that should not be downloaded.
:type exclude: Array of strings
:param parallel: Should we download multiple files in parallel? (default: False)
:type filename: boolean
:param max_threads: If parallel is True, how many threads should be used
to download fil... | [
":",
"param",
"exclude",
":",
"List",
"of",
"input",
"variables",
"that",
"should",
"not",
"be",
"downloaded",
".",
":",
"type",
"exclude",
":",
"Array",
"of",
"strings",
":",
"param",
"parallel",
":",
"Should",
"we",
"download",
"multiple",
"files",
"in",... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/download_all_inputs.py#L115-L205 |
dnanexus/dx-toolkit | src/python/dxpy/utils/printing.py | refill_paragraphs | 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.
... | python | 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.
... | [
"def",
"refill_paragraphs",
"(",
"string",
",",
"ignored_prefix",
"=",
"' '",
")",
":",
"paragraphs",
"=",
"string",
".",
"split",
"(",
"'\\n\\n'",
")",
"refilled_paragraphs",
"=",
"[",
"fill",
"(",
"paragraph",
")",
"if",
"not",
"paragraph",
".",
"starts... | 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. | [
"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",
"n... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/printing.py#L178-L187 |
dnanexus/dx-toolkit | src/python/dxpy/utils/printing.py | format_find_results | 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``
... | python | 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``
... | [
"def",
"format_find_results",
"(",
"args",
",",
"results",
")",
":",
"if",
"args",
".",
"json",
":",
"print",
"(",
"json",
".",
"dumps",
"(",
"list",
"(",
"results",
")",
",",
"indent",
"=",
"4",
")",
")",
"elif",
"args",
".",
"brief",
":",
"for",
... | 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`` | [
"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",
"projec... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/printing.py#L215-L233 |
dnanexus/dx-toolkit | doc/examples/dx-apps/report_example/src/report_example.py | main | def main(**kwargs):
"""
Draw a couple of simple graphs and optionally generate an HTML file to upload them
"""
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_fil... | python | def main(**kwargs):
"""
Draw a couple of simple graphs and optionally generate an HTML file to upload them
"""
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_fil... | [
"def",
"main",
"(",
"*",
"*",
"kwargs",
")",
":",
"draw_lines",
"(",
")",
"draw_histogram",
"(",
")",
"draw_bar_chart",
"(",
")",
"destination",
"=",
"\"-r /report\"",
"if",
"use_html",
":",
"generate_html",
"(",
")",
"command",
"=",
"\"dx-build-report-html {h... | Draw a couple of simple graphs and optionally generate an HTML file to upload them | [
"Draw",
"a",
"couple",
"of",
"simple",
"graphs",
"and",
"optionally",
"generate",
"an",
"HTML",
"file",
"to",
"upload",
"them"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/doc/examples/dx-apps/report_example/src/report_example.py#L37-L53 |
dnanexus/dx-toolkit | doc/examples/dx-apps/report_example/src/report_example.py | draw_histogram | def draw_histogram():
"""
Uses sample code from http://matplotlib.org/1.2.1/examples/api/histogram_demo.html
"""
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', ... | python | def draw_histogram():
"""
Uses sample code from http://matplotlib.org/1.2.1/examples/api/histogram_demo.html
"""
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', ... | [
"def",
"draw_histogram",
"(",
")",
":",
"mu",
",",
"sigma",
"=",
"100",
",",
"15",
"x",
"=",
"mu",
"+",
"sigma",
"*",
"numpy",
".",
"random",
".",
"randn",
"(",
"10000",
")",
"fig",
"=",
"pyplot",
".",
"figure",
"(",
")",
"ax",
"=",
"fig",
".",... | Uses sample code from http://matplotlib.org/1.2.1/examples/api/histogram_demo.html | [
"Uses",
"sample",
"code",
"from",
"http",
":",
"//",
"matplotlib",
".",
"org",
"/",
"1",
".",
"2",
".",
"1",
"/",
"examples",
"/",
"api",
"/",
"histogram_demo",
".",
"html"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/doc/examples/dx-apps/report_example/src/report_example.py#L56-L73 |
dnanexus/dx-toolkit | doc/examples/dx-apps/report_example/src/report_example.py | draw_bar_chart | def draw_bar_chart():
"""
Uses sample code from http://matplotlib.org/1.2.1/examples/api/barchart_demo.html
"""
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(... | python | def draw_bar_chart():
"""
Uses sample code from http://matplotlib.org/1.2.1/examples/api/barchart_demo.html
"""
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(... | [
"def",
"draw_bar_chart",
"(",
")",
":",
"N",
"=",
"5",
"menMeans",
"=",
"(",
"20",
",",
"35",
",",
"30",
",",
"35",
",",
"27",
")",
"menStd",
"=",
"(",
"2",
",",
"3",
",",
"4",
",",
"1",
",",
"2",
")",
"ind",
"=",
"numpy",
".",
"arange",
... | Uses sample code from http://matplotlib.org/1.2.1/examples/api/barchart_demo.html | [
"Uses",
"sample",
"code",
"from",
"http",
":",
"//",
"matplotlib",
".",
"org",
"/",
"1",
".",
"2",
".",
"1",
"/",
"examples",
"/",
"api",
"/",
"barchart_demo",
".",
"html"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/doc/examples/dx-apps/report_example/src/report_example.py#L76-L110 |
dnanexus/dx-toolkit | doc/examples/dx-apps/report_example/src/report_example.py | draw_lines | def draw_lines():
"""
Draws a line between a set of random values
"""
r = numpy.random.randn(200)
fig = pyplot.figure()
ax = fig.add_subplot(111)
ax.plot(r)
ax.grid(True)
pyplot.savefig(lines_filename) | python | def draw_lines():
"""
Draws a line between a set of random values
"""
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",
"(",
")",
":",
"r",
"=",
"numpy",
".",
"random",
".",
"randn",
"(",
"200",
")",
"fig",
"=",
"pyplot",
".",
"figure",
"(",
")",
"ax",
"=",
"fig",
".",
"add_subplot",
"(",
"111",
")",
"ax",
".",
"plot",
"(",
"r",
")",
"ax",
... | Draws a line between a set of random values | [
"Draws",
"a",
"line",
"between",
"a",
"set",
"of",
"random",
"values"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/doc/examples/dx-apps/report_example/src/report_example.py#L113-L124 |
dnanexus/dx-toolkit | doc/examples/dx-apps/report_example/src/report_example.py | generate_html | def generate_html():
"""
Generate an HTML file incorporating the images produced by this script
"""
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]:... | python | def generate_html():
"""
Generate an HTML file incorporating the images produced by this script
"""
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]:... | [
"def",
"generate_html",
"(",
")",
":",
"html_file",
"=",
"open",
"(",
"html_filename",
",",
"\"w\"",
")",
"html_file",
".",
"write",
"(",
"\"<html><body>\"",
")",
"html_file",
".",
"write",
"(",
"\"<h1>Here are some graphs for you!</h1>\"",
")",
"for",
"image",
... | Generate an HTML file incorporating the images produced by this script | [
"Generate",
"an",
"HTML",
"file",
"incorporating",
"the",
"images",
"produced",
"by",
"this",
"script"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/doc/examples/dx-apps/report_example/src/report_example.py#L127-L137 |
dnanexus/dx-toolkit | src/python/dxpy/scripts/dx_app_wizard.py | main | def main(**kwargs):
"""
Entry point for dx-app-wizard.
Note that this function is not meant to be used as a subroutine in your program.
"""
manifest = []
print_intro(API_VERSION)
if args.json_file is not None:
with open(args.json_file, 'r') as json_file:
app_json = json... | python | def main(**kwargs):
"""
Entry point for dx-app-wizard.
Note that this function is not meant to be used as a subroutine in your program.
"""
manifest = []
print_intro(API_VERSION)
if args.json_file is not None:
with open(args.json_file, 'r') as json_file:
app_json = json... | [
"def",
"main",
"(",
"*",
"*",
"kwargs",
")",
":",
"manifest",
"=",
"[",
"]",
"print_intro",
"(",
"API_VERSION",
")",
"if",
"args",
".",
"json_file",
"is",
"not",
"None",
":",
"with",
"open",
"(",
"args",
".",
"json_file",
",",
"'r'",
")",
"as",
"js... | Entry point for dx-app-wizard.
Note that this function is not meant to be used as a subroutine in your program. | [
"Entry",
"point",
"for",
"dx",
"-",
"app",
"-",
"wizard",
".",
"Note",
"that",
"this",
"function",
"is",
"not",
"meant",
"to",
"be",
"used",
"as",
"a",
"subroutine",
"in",
"your",
"program",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/scripts/dx_app_wizard.py#L60-L451 |
dnanexus/dx-toolkit | src/python/dxpy/utils/exec_utils.py | _safe_unicode | def _safe_unicode(o):
"""
Returns an equivalent unicode object, trying harder to avoid
dependencies on the Python default encoding.
"""
def clean(s):
return u''.join([c if c in ASCII_PRINTABLE else '?' for c in s])
if USING_PYTHON2:
try:
return unicode(o)
exce... | python | def _safe_unicode(o):
"""
Returns an equivalent unicode object, trying harder to avoid
dependencies on the Python default encoding.
"""
def clean(s):
return u''.join([c if c in ASCII_PRINTABLE else '?' for c in s])
if USING_PYTHON2:
try:
return unicode(o)
exce... | [
"def",
"_safe_unicode",
"(",
"o",
")",
":",
"def",
"clean",
"(",
"s",
")",
":",
"return",
"u''",
".",
"join",
"(",
"[",
"c",
"if",
"c",
"in",
"ASCII_PRINTABLE",
"else",
"'?'",
"for",
"c",
"in",
"s",
"]",
")",
"if",
"USING_PYTHON2",
":",
"try",
":... | Returns an equivalent unicode object, trying harder to avoid
dependencies on the Python default encoding. | [
"Returns",
"an",
"equivalent",
"unicode",
"object",
"trying",
"harder",
"to",
"avoid",
"dependencies",
"on",
"the",
"Python",
"default",
"encoding",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/exec_utils.py#L38-L58 |
dnanexus/dx-toolkit | src/python/dxpy/utils/exec_utils.py | _format_exception_message | def _format_exception_message(e):
"""
Formats the specified exception.
"""
# Prevent duplication of "AppError" in places that print "AppError"
# and then this formatted string
if isinstance(e, dxpy.AppError):
return _safe_unicode(e)
if USING_PYTHON2:
return unicode(e.__class_... | python | def _format_exception_message(e):
"""
Formats the specified exception.
"""
# Prevent duplication of "AppError" in places that print "AppError"
# and then this formatted string
if isinstance(e, dxpy.AppError):
return _safe_unicode(e)
if USING_PYTHON2:
return unicode(e.__class_... | [
"def",
"_format_exception_message",
"(",
"e",
")",
":",
"# Prevent duplication of \"AppError\" in places that print \"AppError\"",
"# and then this formatted string",
"if",
"isinstance",
"(",
"e",
",",
"dxpy",
".",
"AppError",
")",
":",
"return",
"_safe_unicode",
"(",
"e",
... | Formats the specified exception. | [
"Formats",
"the",
"specified",
"exception",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/exec_utils.py#L60-L71 |
dnanexus/dx-toolkit | src/python/dxpy/utils/exec_utils.py | run | def run(function_name=None, function_input=None):
"""Triggers the execution environment entry point processor.
Use this function in the program entry point code:
.. code-block:: python
import dxpy
@dxpy.entry_point('main')
def hello(i):
pass
dxpy.run()
This m... | python | def run(function_name=None, function_input=None):
"""Triggers the execution environment entry point processor.
Use this function in the program entry point code:
.. code-block:: python
import dxpy
@dxpy.entry_point('main')
def hello(i):
pass
dxpy.run()
This m... | [
"def",
"run",
"(",
"function_name",
"=",
"None",
",",
"function_input",
"=",
"None",
")",
":",
"global",
"RUN_COUNT",
"RUN_COUNT",
"+=",
"1",
"dx_working_dir",
"=",
"os",
".",
"getcwd",
"(",
")",
"if",
"dxpy",
".",
"JOB_ID",
"is",
"not",
"None",
":",
"... | Triggers the execution environment entry point processor.
Use this function in the program entry point code:
.. code-block:: python
import dxpy
@dxpy.entry_point('main')
def hello(i):
pass
dxpy.run()
This method may be used to invoke the program either in a produ... | [
"Triggers",
"the",
"execution",
"environment",
"entry",
"point",
"processor",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/exec_utils.py#L74-L171 |
dnanexus/dx-toolkit | src/python/dxpy/utils/exec_utils.py | entry_point | def entry_point(entry_point_name):
"""Use this to decorate a DNAnexus execution environment entry point.
Example:
.. code-block:: python
@dxpy.entry_point('main')
def hello(i):
pass
"""
def wrap(f):
ENTRY_POINT_TABLE[entry_point_name] = f
@wraps(f)
... | python | def entry_point(entry_point_name):
"""Use this to decorate a DNAnexus execution environment entry point.
Example:
.. code-block:: python
@dxpy.entry_point('main')
def hello(i):
pass
"""
def wrap(f):
ENTRY_POINT_TABLE[entry_point_name] = f
@wraps(f)
... | [
"def",
"entry_point",
"(",
"entry_point_name",
")",
":",
"def",
"wrap",
"(",
"f",
")",
":",
"ENTRY_POINT_TABLE",
"[",
"entry_point_name",
"]",
"=",
"f",
"@",
"wraps",
"(",
"f",
")",
"def",
"wrapped_f",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
... | Use this to decorate a DNAnexus execution environment entry point.
Example:
.. code-block:: python
@dxpy.entry_point('main')
def hello(i):
pass | [
"Use",
"this",
"to",
"decorate",
"a",
"DNAnexus",
"execution",
"environment",
"entry",
"point",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/exec_utils.py#L240-L258 |
dnanexus/dx-toolkit | src/python/dxpy/cli/workflow.py | get_workflow_id_and_project | def get_workflow_id_and_project(path):
'''
:param path: a path or ID to a workflow object
:type path: string
:returns: tuple of (workflow ID, project ID)
Returns the workflow and project IDs from the given path if
available; otherwise, exits with an appropriate error message.
'''
projec... | python | def get_workflow_id_and_project(path):
'''
:param path: a path or ID to a workflow object
:type path: string
:returns: tuple of (workflow ID, project ID)
Returns the workflow and project IDs from the given path if
available; otherwise, exits with an appropriate error message.
'''
projec... | [
"def",
"get_workflow_id_and_project",
"(",
"path",
")",
":",
"project",
",",
"_folderpath",
",",
"entity_result",
"=",
"try_call",
"(",
"resolve_existing_path",
",",
"path",
",",
"expected",
"=",
"'entity'",
")",
"try",
":",
"if",
"entity_result",
"is",
"None",
... | :param path: a path or ID to a workflow object
:type path: string
:returns: tuple of (workflow ID, project ID)
Returns the workflow and project IDs from the given path if
available; otherwise, exits with an appropriate error message. | [
":",
"param",
"path",
":",
"a",
"path",
"or",
"ID",
"to",
"a",
"workflow",
"object",
":",
"type",
"path",
":",
"string",
":",
"returns",
":",
"tuple",
"of",
"(",
"workflow",
"ID",
"project",
"ID",
")"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/cli/workflow.py#L76-L91 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/auth.py | user_info | def user_info(authserver_host=None, authserver_port=None):
"""Returns the result of the user_info call against the specified auth
server.
.. deprecated:: 0.108.0
Use :func:`whoami` instead where possible.
"""
authserver = get_auth_server_name(authserver_host, authserver_port)
return DXH... | python | def user_info(authserver_host=None, authserver_port=None):
"""Returns the result of the user_info call against the specified auth
server.
.. deprecated:: 0.108.0
Use :func:`whoami` instead where possible.
"""
authserver = get_auth_server_name(authserver_host, authserver_port)
return DXH... | [
"def",
"user_info",
"(",
"authserver_host",
"=",
"None",
",",
"authserver_port",
"=",
"None",
")",
":",
"authserver",
"=",
"get_auth_server_name",
"(",
"authserver_host",
",",
"authserver_port",
")",
"return",
"DXHTTPRequest",
"(",
"authserver",
"+",
"\"/system/getU... | Returns the result of the user_info call against the specified auth
server.
.. deprecated:: 0.108.0
Use :func:`whoami` instead where possible. | [
"Returns",
"the",
"result",
"of",
"the",
"user_info",
"call",
"against",
"the",
"specified",
"auth",
"server",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/auth.py#L23-L32 |
dnanexus/dx-toolkit | src/python/dxpy/utils/file_load_utils.py | get_input_dir | def get_input_dir(job_homedir=None):
'''
:param job_homedir: explicit value for home directory, used for testing purposes
:rtype: string
:returns: path to input directory
Returns the input directory, where all inputs are downloaded
'''
if job_homedir is not None:
home_dir = job_home... | python | def get_input_dir(job_homedir=None):
'''
:param job_homedir: explicit value for home directory, used for testing purposes
:rtype: string
:returns: path to input directory
Returns the input directory, where all inputs are downloaded
'''
if job_homedir is not None:
home_dir = job_home... | [
"def",
"get_input_dir",
"(",
"job_homedir",
"=",
"None",
")",
":",
"if",
"job_homedir",
"is",
"not",
"None",
":",
"home_dir",
"=",
"job_homedir",
"else",
":",
"home_dir",
"=",
"environ",
".",
"get",
"(",
"'HOME'",
")",
"idir",
"=",
"os",
".",
"path",
"... | :param job_homedir: explicit value for home directory, used for testing purposes
:rtype: string
:returns: path to input directory
Returns the input directory, where all inputs are downloaded | [
":",
"param",
"job_homedir",
":",
"explicit",
"value",
"for",
"home",
"directory",
"used",
"for",
"testing",
"purposes",
":",
"rtype",
":",
"string",
":",
"returns",
":",
"path",
"to",
"input",
"directory"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/file_load_utils.py#L98-L111 |
dnanexus/dx-toolkit | src/python/dxpy/utils/file_load_utils.py | get_output_dir | def get_output_dir(job_homedir=None):
'''
:param job_homedir: explicit value for home directory, used for testing purposes
:rtype: string
:returns: path to output directory
Returns the output directory, where all outputs are created, and
uploaded from
'''
if job_homedir is not None:
... | python | def get_output_dir(job_homedir=None):
'''
:param job_homedir: explicit value for home directory, used for testing purposes
:rtype: string
:returns: path to output directory
Returns the output directory, where all outputs are created, and
uploaded from
'''
if job_homedir is not None:
... | [
"def",
"get_output_dir",
"(",
"job_homedir",
"=",
"None",
")",
":",
"if",
"job_homedir",
"is",
"not",
"None",
":",
"home_dir",
"=",
"job_homedir",
"else",
":",
"home_dir",
"=",
"environ",
".",
"get",
"(",
"'HOME'",
")",
"odir",
"=",
"os",
".",
"path",
... | :param job_homedir: explicit value for home directory, used for testing purposes
:rtype: string
:returns: path to output directory
Returns the output directory, where all outputs are created, and
uploaded from | [
":",
"param",
"job_homedir",
":",
"explicit",
"value",
"for",
"home",
"directory",
"used",
"for",
"testing",
"purposes",
":",
"rtype",
":",
"string",
":",
"returns",
":",
"path",
"to",
"output",
"directory"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/file_load_utils.py#L114-L128 |
dnanexus/dx-toolkit | src/python/dxpy/utils/file_load_utils.py | rm_output_json_file | def rm_output_json_file():
""" Warning: this is not for casual use.
It erases the output json file, and should be used for testing purposes only.
"""
path = get_output_json_file()
try:
os.remove(path)
except OSError as e:
if e.errno == errno.ENOENT:
pass
else:... | python | def rm_output_json_file():
""" Warning: this is not for casual use.
It erases the output json file, and should be used for testing purposes only.
"""
path = get_output_json_file()
try:
os.remove(path)
except OSError as e:
if e.errno == errno.ENOENT:
pass
else:... | [
"def",
"rm_output_json_file",
"(",
")",
":",
"path",
"=",
"get_output_json_file",
"(",
")",
"try",
":",
"os",
".",
"remove",
"(",
"path",
")",
"except",
"OSError",
"as",
"e",
":",
"if",
"e",
".",
"errno",
"==",
"errno",
".",
"ENOENT",
":",
"pass",
"e... | Warning: this is not for casual use.
It erases the output json file, and should be used for testing purposes only. | [
"Warning",
":",
"this",
"is",
"not",
"for",
"casual",
"use",
".",
"It",
"erases",
"the",
"output",
"json",
"file",
"and",
"should",
"be",
"used",
"for",
"testing",
"purposes",
"only",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/file_load_utils.py#L149-L160 |
dnanexus/dx-toolkit | src/python/dxpy/utils/file_load_utils.py | ensure_dir | def ensure_dir(path):
"""
:param path: path to directory to be created
Create a directory if it does not already exist.
"""
if not os.path.exists(path):
# path does not exist, create the directory
os.mkdir(path)
else:
# The path exists, check that it is not a file
... | python | def ensure_dir(path):
"""
:param path: path to directory to be created
Create a directory if it does not already exist.
"""
if not os.path.exists(path):
# path does not exist, create the directory
os.mkdir(path)
else:
# The path exists, check that it is not a file
... | [
"def",
"ensure_dir",
"(",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"# path does not exist, create the directory",
"os",
".",
"mkdir",
"(",
"path",
")",
"else",
":",
"# The path exists, check that it is not a file",
... | :param path: path to directory to be created
Create a directory if it does not already exist. | [
":",
"param",
"path",
":",
"path",
"to",
"directory",
"to",
"be",
"created"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/file_load_utils.py#L163-L175 |
dnanexus/dx-toolkit | src/python/dxpy/utils/file_load_utils.py | make_unix_filename | def make_unix_filename(fname):
"""
:param fname: the basename of a file (e.g., xxx in /zzz/yyy/xxx).
:returns: a valid unix filename
:rtype: string
:raises: DXError if the filename is invalid on a Unix system
The problem being solved here is that *fname* is a python string, it
may contain c... | python | def make_unix_filename(fname):
"""
:param fname: the basename of a file (e.g., xxx in /zzz/yyy/xxx).
:returns: a valid unix filename
:rtype: string
:raises: DXError if the filename is invalid on a Unix system
The problem being solved here is that *fname* is a python string, it
may contain c... | [
"def",
"make_unix_filename",
"(",
"fname",
")",
":",
"# sanity check for filenames",
"bad_filenames",
"=",
"[",
"\".\"",
",",
"\"..\"",
"]",
"if",
"fname",
"in",
"bad_filenames",
":",
"raise",
"DXError",
"(",
"\"Invalid filename {}\"",
".",
"format",
"(",
"fname",... | :param fname: the basename of a file (e.g., xxx in /zzz/yyy/xxx).
:returns: a valid unix filename
:rtype: string
:raises: DXError if the filename is invalid on a Unix system
The problem being solved here is that *fname* is a python string, it
may contain characters that are invalid for a file name.... | [
":",
"param",
"fname",
":",
"the",
"basename",
"of",
"a",
"file",
"(",
"e",
".",
"g",
".",
"xxx",
"in",
"/",
"zzz",
"/",
"yyy",
"/",
"xxx",
")",
".",
":",
"returns",
":",
"a",
"valid",
"unix",
"filename",
":",
"rtype",
":",
"string",
":",
"rais... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/file_load_utils.py#L178-L194 |
dnanexus/dx-toolkit | src/python/dxpy/utils/file_load_utils.py | get_job_input_filenames | def get_job_input_filenames(job_input_file):
"""Extract list of files, returns a set of directories to create, and
a set of files, with sources and destinations. The paths created are
relative to the input directory.
Note: we go through file names inside arrays, and create a
separate subdirectory f... | python | def get_job_input_filenames(job_input_file):
"""Extract list of files, returns a set of directories to create, and
a set of files, with sources and destinations. The paths created are
relative to the input directory.
Note: we go through file names inside arrays, and create a
separate subdirectory f... | [
"def",
"get_job_input_filenames",
"(",
"job_input_file",
")",
":",
"def",
"get_input_hash",
"(",
")",
":",
"with",
"open",
"(",
"job_input_file",
")",
"as",
"fh",
":",
"job_input",
"=",
"json",
".",
"load",
"(",
"fh",
")",
"return",
"job_input",
"job_input",... | Extract list of files, returns a set of directories to create, and
a set of files, with sources and destinations. The paths created are
relative to the input directory.
Note: we go through file names inside arrays, and create a
separate subdirectory for each. This avoids clobbering files when
dupli... | [
"Extract",
"list",
"of",
"files",
"returns",
"a",
"set",
"of",
"directories",
"to",
"create",
"and",
"a",
"set",
"of",
"files",
"with",
"sources",
"and",
"destinations",
".",
"The",
"paths",
"created",
"are",
"relative",
"to",
"the",
"input",
"directory",
... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/file_load_utils.py#L202-L271 |
dnanexus/dx-toolkit | src/python/dxpy/utils/file_load_utils.py | get_input_spec_patterns | def get_input_spec_patterns():
''' Extract the inputSpec patterns, if they exist -- modifed from dx-upload-all-outputs
Returns a dict of all patterns, with keys equal to the respective
input parameter names.
'''
input_spec = None
if 'DX_JOB_ID' in environ:
# works in the cloud, not loca... | python | def get_input_spec_patterns():
''' Extract the inputSpec patterns, if they exist -- modifed from dx-upload-all-outputs
Returns a dict of all patterns, with keys equal to the respective
input parameter names.
'''
input_spec = None
if 'DX_JOB_ID' in environ:
# works in the cloud, not loca... | [
"def",
"get_input_spec_patterns",
"(",
")",
":",
"input_spec",
"=",
"None",
"if",
"'DX_JOB_ID'",
"in",
"environ",
":",
"# works in the cloud, not locally",
"job_desc",
"=",
"dxpy",
".",
"describe",
"(",
"dxpy",
".",
"JOB_ID",
")",
"if",
"job_desc",
"[",
"\"funct... | Extract the inputSpec patterns, if they exist -- modifed from dx-upload-all-outputs
Returns a dict of all patterns, with keys equal to the respective
input parameter names. | [
"Extract",
"the",
"inputSpec",
"patterns",
"if",
"they",
"exist",
"--",
"modifed",
"from",
"dx",
"-",
"upload",
"-",
"all",
"-",
"outputs"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/file_load_utils.py#L274-L313 |
dnanexus/dx-toolkit | src/python/dxpy/utils/file_load_utils.py | analyze_bash_vars | def analyze_bash_vars(job_input_file, job_homedir):
'''
This function examines the input file, and calculates variables to
instantiate in the shell environment. It is called right before starting the
execution of an app in a worker.
For each input key, we want to have
$var
$var_filename
... | python | def analyze_bash_vars(job_input_file, job_homedir):
'''
This function examines the input file, and calculates variables to
instantiate in the shell environment. It is called right before starting the
execution of an app in a worker.
For each input key, we want to have
$var
$var_filename
... | [
"def",
"analyze_bash_vars",
"(",
"job_input_file",
",",
"job_homedir",
")",
":",
"_",
",",
"file_entries",
",",
"rest_hash",
"=",
"get_job_input_filenames",
"(",
"job_input_file",
")",
"patterns_dict",
"=",
"get_input_spec_patterns",
"(",
")",
"# Note: there may be mult... | This function examines the input file, and calculates variables to
instantiate in the shell environment. It is called right before starting the
execution of an app in a worker.
For each input key, we want to have
$var
$var_filename
$var_prefix
remove last dot (+gz), and/or remove pattern... | [
"This",
"function",
"examines",
"the",
"input",
"file",
"and",
"calculates",
"variables",
"to",
"instantiate",
"in",
"the",
"shell",
"environment",
".",
"It",
"is",
"called",
"right",
"before",
"starting",
"the",
"execution",
"of",
"an",
"app",
"in",
"a",
"w... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/file_load_utils.py#L327-L401 |
dnanexus/dx-toolkit | src/python/dxpy/utils/file_load_utils.py | gen_bash_vars | def gen_bash_vars(job_input_file, job_homedir=None, check_name_collision=True):
"""
:param job_input_file: path to a JSON file describing the job inputs
:param job_homedir: path to home directory, used for testing purposes
:param check_name_collision: should we check for name collisions?
:return: li... | python | def gen_bash_vars(job_input_file, job_homedir=None, check_name_collision=True):
"""
:param job_input_file: path to a JSON file describing the job inputs
:param job_homedir: path to home directory, used for testing purposes
:param check_name_collision: should we check for name collisions?
:return: li... | [
"def",
"gen_bash_vars",
"(",
"job_input_file",
",",
"job_homedir",
"=",
"None",
",",
"check_name_collision",
"=",
"True",
")",
":",
"file_key_descs",
",",
"rest_hash",
"=",
"analyze_bash_vars",
"(",
"job_input_file",
",",
"job_homedir",
")",
"def",
"string_of_elem",... | :param job_input_file: path to a JSON file describing the job inputs
:param job_homedir: path to home directory, used for testing purposes
:param check_name_collision: should we check for name collisions?
:return: list of lines
:rtype: list of strings
Calculates a line for each shell variable to in... | [
":",
"param",
"job_input_file",
":",
"path",
"to",
"a",
"JSON",
"file",
"describing",
"the",
"job",
"inputs",
":",
"param",
"job_homedir",
":",
"path",
"to",
"home",
"directory",
"used",
"for",
"testing",
"purposes",
":",
"param",
"check_name_collision",
":",
... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/file_load_utils.py#L408-L464 |
dnanexus/dx-toolkit | src/python/dxpy/utils/__init__.py | wait_for_a_future | def wait_for_a_future(futures, print_traceback=False):
"""
Return the next future that completes. If a KeyboardInterrupt is
received, then the entire process is exited immediately. See
wait_for_all_futures for more notes.
"""
while True:
try:
future = next(concurrent.future... | python | def wait_for_a_future(futures, print_traceback=False):
"""
Return the next future that completes. If a KeyboardInterrupt is
received, then the entire process is exited immediately. See
wait_for_all_futures for more notes.
"""
while True:
try:
future = next(concurrent.future... | [
"def",
"wait_for_a_future",
"(",
"futures",
",",
"print_traceback",
"=",
"False",
")",
":",
"while",
"True",
":",
"try",
":",
"future",
"=",
"next",
"(",
"concurrent",
".",
"futures",
".",
"as_completed",
"(",
"futures",
",",
"timeout",
"=",
"THREAD_TIMEOUT_... | Return the next future that completes. If a KeyboardInterrupt is
received, then the entire process is exited immediately. See
wait_for_all_futures for more notes. | [
"Return",
"the",
"next",
"future",
"that",
"completes",
".",
"If",
"a",
"KeyboardInterrupt",
"is",
"received",
"then",
"the",
"entire",
"process",
"is",
"exited",
"immediately",
".",
"See",
"wait_for_all_futures",
"for",
"more",
"notes",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/__init__.py#L40-L59 |
dnanexus/dx-toolkit | src/python/dxpy/utils/__init__.py | wait_for_all_futures | def wait_for_all_futures(futures, print_traceback=False):
"""
Wait indefinitely for all futures in the input iterable to complete.
Use a timeout to enable interrupt handling.
Call os._exit() in case of KeyboardInterrupt. Otherwise, the atexit registered handler in concurrent.futures.thread
will run,... | python | def wait_for_all_futures(futures, print_traceback=False):
"""
Wait indefinitely for all futures in the input iterable to complete.
Use a timeout to enable interrupt handling.
Call os._exit() in case of KeyboardInterrupt. Otherwise, the atexit registered handler in concurrent.futures.thread
will run,... | [
"def",
"wait_for_all_futures",
"(",
"futures",
",",
"print_traceback",
"=",
"False",
")",
":",
"try",
":",
"while",
"True",
":",
"waited_futures",
"=",
"concurrent",
".",
"futures",
".",
"wait",
"(",
"futures",
",",
"timeout",
"=",
"60",
")",
"if",
"len",
... | Wait indefinitely for all futures in the input iterable to complete.
Use a timeout to enable interrupt handling.
Call os._exit() in case of KeyboardInterrupt. Otherwise, the atexit registered handler in concurrent.futures.thread
will run, and issue blocking join() on all worker threads, requiring us to list... | [
"Wait",
"indefinitely",
"for",
"all",
"futures",
"in",
"the",
"input",
"iterable",
"to",
"complete",
".",
"Use",
"a",
"timeout",
"to",
"enable",
"interrupt",
"handling",
".",
"Call",
"os",
".",
"_exit",
"()",
"in",
"case",
"of",
"KeyboardInterrupt",
".",
"... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/__init__.py#L61-L85 |
dnanexus/dx-toolkit | src/python/dxpy/utils/__init__.py | response_iterator | def response_iterator(request_iterator, thread_pool, max_active_tasks=None, do_first_task_sequentially=True):
"""
:param request_iterator:
An iterator producing inputs for consumption by the worker pool.
:type request_iterator: iterator of callable, args, kwargs
:param thread_pool: thread pool t... | python | def response_iterator(request_iterator, thread_pool, max_active_tasks=None, do_first_task_sequentially=True):
"""
:param request_iterator:
An iterator producing inputs for consumption by the worker pool.
:type request_iterator: iterator of callable, args, kwargs
:param thread_pool: thread pool t... | [
"def",
"response_iterator",
"(",
"request_iterator",
",",
"thread_pool",
",",
"max_active_tasks",
"=",
"None",
",",
"do_first_task_sequentially",
"=",
"True",
")",
":",
"tasks_in_progress",
"=",
"collections",
".",
"deque",
"(",
")",
"if",
"max_active_tasks",
"is",
... | :param request_iterator:
An iterator producing inputs for consumption by the worker pool.
:type request_iterator: iterator of callable, args, kwargs
:param thread_pool: thread pool to submit the requests to
:type thread_pool: concurrent.futures.thread.ThreadPoolExecutor
:param max_active_tasks:
... | [
":",
"param",
"request_iterator",
":",
"An",
"iterator",
"producing",
"inputs",
"for",
"consumption",
"by",
"the",
"worker",
"pool",
".",
":",
"type",
"request_iterator",
":",
"iterator",
"of",
"callable",
"args",
"kwargs",
":",
"param",
"thread_pool",
":",
"t... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/__init__.py#L88-L149 |
dnanexus/dx-toolkit | src/python/dxpy/utils/__init__.py | normalize_time_input | def normalize_time_input(t, future=False, default_unit='ms'):
"""
:param default_unit: units of the input time *t*; must be one of "s" or
"ms". This param is only respected if *t* looks like an int (e.g.
"12345", 12345).
:type default_unit: string
Converts inputs such as:
"2012-0... | python | def normalize_time_input(t, future=False, default_unit='ms'):
"""
:param default_unit: units of the input time *t*; must be one of "s" or
"ms". This param is only respected if *t* looks like an int (e.g.
"12345", 12345).
:type default_unit: string
Converts inputs such as:
"2012-0... | [
"def",
"normalize_time_input",
"(",
"t",
",",
"future",
"=",
"False",
",",
"default_unit",
"=",
"'ms'",
")",
":",
"error_msg",
"=",
"'Error: Expected an int timestamp, a date format (e.g. YYYY-MM-DD), or an int with a single-letter suffix (s=seconds, m=minutes, h=hours, d=days, w=wee... | :param default_unit: units of the input time *t*; must be one of "s" or
"ms". This param is only respected if *t* looks like an int (e.g.
"12345", 12345).
:type default_unit: string
Converts inputs such as:
"2012-05-01"
"-5d"
1352863174
"1352863174"
to millisecon... | [
":",
"param",
"default_unit",
":",
"units",
"of",
"the",
"input",
"time",
"*",
"t",
"*",
";",
"must",
"be",
"one",
"of",
"s",
"or",
"ms",
".",
"This",
"param",
"is",
"only",
"respected",
"if",
"*",
"t",
"*",
"looks",
"like",
"an",
"int",
"(",
"e"... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/__init__.py#L159-L196 |
dnanexus/dx-toolkit | src/python/dxpy/utils/__init__.py | normalize_timedelta | def normalize_timedelta(timedelta):
"""
Given a string like "1w" or "-5d", convert it to an integer in milliseconds.
Integers without a suffix are interpreted as seconds.
Note: not related to the datetime timedelta class.
"""
try:
return int(timedelta) * 1000
except ValueError as e:
... | python | def normalize_timedelta(timedelta):
"""
Given a string like "1w" or "-5d", convert it to an integer in milliseconds.
Integers without a suffix are interpreted as seconds.
Note: not related to the datetime timedelta class.
"""
try:
return int(timedelta) * 1000
except ValueError as e:
... | [
"def",
"normalize_timedelta",
"(",
"timedelta",
")",
":",
"try",
":",
"return",
"int",
"(",
"timedelta",
")",
"*",
"1000",
"except",
"ValueError",
"as",
"e",
":",
"t",
",",
"suffix",
"=",
"timedelta",
"[",
":",
"-",
"1",
"]",
",",
"timedelta",
"[",
"... | Given a string like "1w" or "-5d", convert it to an integer in milliseconds.
Integers without a suffix are interpreted as seconds.
Note: not related to the datetime timedelta class. | [
"Given",
"a",
"string",
"like",
"1w",
"or",
"-",
"5d",
"convert",
"it",
"to",
"an",
"integer",
"in",
"milliseconds",
".",
"Integers",
"without",
"a",
"suffix",
"are",
"interpreted",
"as",
"seconds",
".",
"Note",
":",
"not",
"related",
"to",
"the",
"datet... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/__init__.py#L198-L212 |
dnanexus/dx-toolkit | src/python/dxpy/utils/__init__.py | _dict_raise_on_duplicates | def _dict_raise_on_duplicates(ordered_pairs):
"""
Reject duplicate keys.
"""
d = {}
for k, v in ordered_pairs:
if k in d:
raise ValueError("duplicate key: %r" % (k,))
else:
d[k] = v
return d | python | def _dict_raise_on_duplicates(ordered_pairs):
"""
Reject duplicate keys.
"""
d = {}
for k, v in ordered_pairs:
if k in d:
raise ValueError("duplicate key: %r" % (k,))
else:
d[k] = v
return d | [
"def",
"_dict_raise_on_duplicates",
"(",
"ordered_pairs",
")",
":",
"d",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"ordered_pairs",
":",
"if",
"k",
"in",
"d",
":",
"raise",
"ValueError",
"(",
"\"duplicate key: %r\"",
"%",
"(",
"k",
",",
")",
")",
"els... | Reject duplicate keys. | [
"Reject",
"duplicate",
"keys",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/__init__.py#L258-L268 |
dnanexus/dx-toolkit | src/python/dxpy/utils/__init__.py | Nonce.update_nonce | def update_nonce(input_params):
'''
Static method to return a copy of the input dictionary with an
additional unique nonce
:param input: an input dictionary that may be empty
:type input: dict
:returns an extended copy of the input with an additional nonce field
... | python | def update_nonce(input_params):
'''
Static method to return a copy of the input dictionary with an
additional unique nonce
:param input: an input dictionary that may be empty
:type input: dict
:returns an extended copy of the input with an additional nonce field
... | [
"def",
"update_nonce",
"(",
"input_params",
")",
":",
"input_cp",
"=",
"input_params",
".",
"copy",
"(",
")",
"if",
"len",
"(",
"input_cp",
".",
"get",
"(",
"'nonce'",
",",
"''",
")",
")",
"==",
"0",
":",
"input_cp",
"[",
"'nonce'",
"]",
"=",
"str",
... | Static method to return a copy of the input dictionary with an
additional unique nonce
:param input: an input dictionary that may be empty
:type input: dict
:returns an extended copy of the input with an additional nonce field
The input dictionary is updated with a nonce only if... | [
"Static",
"method",
"to",
"return",
"a",
"copy",
"of",
"the",
"input",
"dictionary",
"with",
"an",
"additional",
"unique",
"nonce",
":",
"param",
"input",
":",
"an",
"input",
"dictionary",
"that",
"may",
"be",
"empty",
":",
"type",
"input",
":",
"dict",
... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/__init__.py#L304-L318 |
dnanexus/dx-toolkit | src/python/dxpy/executable_builder.py | inline_documentation_files | def inline_documentation_files(json_spec, src_dir):
"""
Modifies the provided json_spec dict (which may be an app, applet,
workflow spec) to inline the contents of the readme file into
"description" and the developer readme into "developerNotes".
"""
# Inline description from a readme file
i... | python | def inline_documentation_files(json_spec, src_dir):
"""
Modifies the provided json_spec dict (which may be an app, applet,
workflow spec) to inline the contents of the readme file into
"description" and the developer readme into "developerNotes".
"""
# Inline description from a readme file
i... | [
"def",
"inline_documentation_files",
"(",
"json_spec",
",",
"src_dir",
")",
":",
"# Inline description from a readme file",
"if",
"'description'",
"not",
"in",
"json_spec",
":",
"readme_filename",
"=",
"None",
"for",
"filename",
"in",
"'README.md'",
",",
"'Readme.md'",
... | Modifies the provided json_spec dict (which may be an app, applet,
workflow spec) to inline the contents of the readme file into
"description" and the developer readme into "developerNotes". | [
"Modifies",
"the",
"provided",
"json_spec",
"dict",
"(",
"which",
"may",
"be",
"an",
"app",
"applet",
"workflow",
"spec",
")",
"to",
"inline",
"the",
"contents",
"of",
"the",
"readme",
"file",
"into",
"description",
"and",
"the",
"developer",
"readme",
"into... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/executable_builder.py#L65-L88 |
dnanexus/dx-toolkit | src/python/dxpy/executable_builder.py | verify_developer_rights | def verify_developer_rights(prefixed_name):
"""
Checks if the current user is a developer of the app or global workflow
with the given name. If the app/global workflow exists and the user has
developer rights to it, the function returns a named tuple representing
the executable that was queried.
... | python | def verify_developer_rights(prefixed_name):
"""
Checks if the current user is a developer of the app or global workflow
with the given name. If the app/global workflow exists and the user has
developer rights to it, the function returns a named tuple representing
the executable that was queried.
... | [
"def",
"verify_developer_rights",
"(",
"prefixed_name",
")",
":",
"assert",
"(",
"prefixed_name",
".",
"startswith",
"(",
"'app-'",
")",
"or",
"prefixed_name",
".",
"startswith",
"(",
"'globalworkflow-'",
")",
")",
"if",
"prefixed_name",
".",
"partition",
"(",
"... | Checks if the current user is a developer of the app or global workflow
with the given name. If the app/global workflow exists and the user has
developer rights to it, the function returns a named tuple representing
the executable that was queried. | [
"Checks",
"if",
"the",
"current",
"user",
"is",
"a",
"developer",
"of",
"the",
"app",
"or",
"global",
"workflow",
"with",
"the",
"given",
"name",
".",
"If",
"the",
"app",
"/",
"global",
"workflow",
"exists",
"and",
"the",
"user",
"has",
"developer",
"rig... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/executable_builder.py#L102-L152 |
dnanexus/dx-toolkit | src/python/dxpy/executable_builder.py | assert_consistent_regions | def assert_consistent_regions(from_spec, from_command_line, builder_exception):
"""
Verifies the regions passed with --region CLI argument and the ones
specified in regionalOptions are the same (if both CLI and spec were used)
"""
if from_spec is None or from_command_line is None:
return
... | python | def assert_consistent_regions(from_spec, from_command_line, builder_exception):
"""
Verifies the regions passed with --region CLI argument and the ones
specified in regionalOptions are the same (if both CLI and spec were used)
"""
if from_spec is None or from_command_line is None:
return
... | [
"def",
"assert_consistent_regions",
"(",
"from_spec",
",",
"from_command_line",
",",
"builder_exception",
")",
":",
"if",
"from_spec",
"is",
"None",
"or",
"from_command_line",
"is",
"None",
":",
"return",
"if",
"set",
"(",
"from_spec",
")",
"!=",
"set",
"(",
"... | Verifies the regions passed with --region CLI argument and the ones
specified in regionalOptions are the same (if both CLI and spec were used) | [
"Verifies",
"the",
"regions",
"passed",
"with",
"--",
"region",
"CLI",
"argument",
"and",
"the",
"ones",
"specified",
"in",
"regionalOptions",
"are",
"the",
"same",
"(",
"if",
"both",
"CLI",
"and",
"spec",
"were",
"used",
")"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/executable_builder.py#L155-L163 |
dnanexus/dx-toolkit | src/python/dxpy/executable_builder.py | assert_consistent_reg_options | def assert_consistent_reg_options(exec_type, json_spec, executable_builder_exeception):
"""
Validates the "regionalOptions" field and verifies all the regions used
in "regionalOptions" have the same options.
"""
reg_options_spec = json_spec.get('regionalOptions')
json_fn = 'dxapp.json' if exec_t... | python | def assert_consistent_reg_options(exec_type, json_spec, executable_builder_exeception):
"""
Validates the "regionalOptions" field and verifies all the regions used
in "regionalOptions" have the same options.
"""
reg_options_spec = json_spec.get('regionalOptions')
json_fn = 'dxapp.json' if exec_t... | [
"def",
"assert_consistent_reg_options",
"(",
"exec_type",
",",
"json_spec",
",",
"executable_builder_exeception",
")",
":",
"reg_options_spec",
"=",
"json_spec",
".",
"get",
"(",
"'regionalOptions'",
")",
"json_fn",
"=",
"'dxapp.json'",
"if",
"exec_type",
"==",
"'app'... | Validates the "regionalOptions" field and verifies all the regions used
in "regionalOptions" have the same options. | [
"Validates",
"the",
"regionalOptions",
"field",
"and",
"verifies",
"all",
"the",
"regions",
"used",
"in",
"regionalOptions",
"have",
"the",
"same",
"options",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/executable_builder.py#L166-L200 |
dnanexus/dx-toolkit | src/python/dxpy/executable_builder.py | get_enabled_regions | def get_enabled_regions(exec_type, json_spec, from_command_line, executable_builder_exeception):
"""
Return a list of regions in which the global executable (app or global workflow)
will be enabled, based on the "regionalOption" in their JSON specification
and/or --region CLI argument used with "dx buil... | python | def get_enabled_regions(exec_type, json_spec, from_command_line, executable_builder_exeception):
"""
Return a list of regions in which the global executable (app or global workflow)
will be enabled, based on the "regionalOption" in their JSON specification
and/or --region CLI argument used with "dx buil... | [
"def",
"get_enabled_regions",
"(",
"exec_type",
",",
"json_spec",
",",
"from_command_line",
",",
"executable_builder_exeception",
")",
":",
"from_spec",
"=",
"json_spec",
".",
"get",
"(",
"'regionalOptions'",
")",
"if",
"from_spec",
"is",
"not",
"None",
":",
"asse... | Return a list of regions in which the global executable (app or global workflow)
will be enabled, based on the "regionalOption" in their JSON specification
and/or --region CLI argument used with "dx build".
:param exec_type: 'app' or 'globalworkflow'
:type json_spec: str.
:param json_spec: The cont... | [
"Return",
"a",
"list",
"of",
"regions",
"in",
"which",
"the",
"global",
"executable",
"(",
"app",
"or",
"global",
"workflow",
")",
"will",
"be",
"enabled",
"based",
"on",
"the",
"regionalOption",
"in",
"their",
"JSON",
"specification",
"and",
"/",
"or",
"-... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/executable_builder.py#L202-L231 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxanalysis.py | DXAnalysis.describe | def describe(self, fields=None, **kwargs):
"""
:param fields: dict where the keys are field names that should
be returned, and values should be set to True (by default,
all fields are returned)
:type fields: dict
:returns: Description of the analysis
:rtyp... | python | def describe(self, fields=None, **kwargs):
"""
:param fields: dict where the keys are field names that should
be returned, and values should be set to True (by default,
all fields are returned)
:type fields: dict
:returns: Description of the analysis
:rtyp... | [
"def",
"describe",
"(",
"self",
",",
"fields",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"describe_input",
"=",
"{",
"}",
"if",
"fields",
"is",
"not",
"None",
":",
"describe_input",
"[",
"'fields'",
"]",
"=",
"fields",
"self",
".",
"_desc",
"="... | :param fields: dict where the keys are field names that should
be returned, and values should be set to True (by default,
all fields are returned)
:type fields: dict
:returns: Description of the analysis
:rtype: dict
Returns a hash with key-value pairs containing... | [
":",
"param",
"fields",
":",
"dict",
"where",
"the",
"keys",
"are",
"field",
"names",
"that",
"should",
"be",
"returned",
"and",
"values",
"should",
"be",
"set",
"to",
"True",
"(",
"by",
"default",
"all",
"fields",
"are",
"returned",
")",
":",
"type",
... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxanalysis.py#L51-L68 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxanalysis.py | DXAnalysis.add_tags | def add_tags(self, tags, **kwargs):
"""
:param tags: Tags to add to the analysis
:type tags: list of strings
Adds each of the specified tags to the analysis. Takes no
action for tags that are already listed for the analysis.
"""
dxpy.api.analysis_add_tags(self.... | python | def add_tags(self, tags, **kwargs):
"""
:param tags: Tags to add to the analysis
:type tags: list of strings
Adds each of the specified tags to the analysis. Takes no
action for tags that are already listed for the analysis.
"""
dxpy.api.analysis_add_tags(self.... | [
"def",
"add_tags",
"(",
"self",
",",
"tags",
",",
"*",
"*",
"kwargs",
")",
":",
"dxpy",
".",
"api",
".",
"analysis_add_tags",
"(",
"self",
".",
"_dxid",
",",
"{",
"\"tags\"",
":",
"tags",
"}",
",",
"*",
"*",
"kwargs",
")"
] | :param tags: Tags to add to the analysis
:type tags: list of strings
Adds each of the specified tags to the analysis. Takes no
action for tags that are already listed for the analysis. | [
":",
"param",
"tags",
":",
"Tags",
"to",
"add",
"to",
"the",
"analysis",
":",
"type",
"tags",
":",
"list",
"of",
"strings"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxanalysis.py#L70-L80 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxanalysis.py | DXAnalysis.remove_tags | def remove_tags(self, tags, **kwargs):
"""
:param tags: Tags to remove from the analysis
:type tags: list of strings
Removes each of the specified tags from the analysis. Takes
no action for tags that the analysis does not currently have.
"""
dxpy.api.analysis_... | python | def remove_tags(self, tags, **kwargs):
"""
:param tags: Tags to remove from the analysis
:type tags: list of strings
Removes each of the specified tags from the analysis. Takes
no action for tags that the analysis does not currently have.
"""
dxpy.api.analysis_... | [
"def",
"remove_tags",
"(",
"self",
",",
"tags",
",",
"*",
"*",
"kwargs",
")",
":",
"dxpy",
".",
"api",
".",
"analysis_remove_tags",
"(",
"self",
".",
"_dxid",
",",
"{",
"\"tags\"",
":",
"tags",
"}",
",",
"*",
"*",
"kwargs",
")"
] | :param tags: Tags to remove from the analysis
:type tags: list of strings
Removes each of the specified tags from the analysis. Takes
no action for tags that the analysis does not currently have. | [
":",
"param",
"tags",
":",
"Tags",
"to",
"remove",
"from",
"the",
"analysis",
":",
"type",
"tags",
":",
"list",
"of",
"strings"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxanalysis.py#L82-L92 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxanalysis.py | DXAnalysis.set_properties | def set_properties(self, properties, **kwargs):
"""
:param properties: Property names and values given as key-value pairs of strings
:type properties: dict
Given key-value pairs in *properties* for property names and
values, the properties are set on the analysis for the given
... | python | def set_properties(self, properties, **kwargs):
"""
:param properties: Property names and values given as key-value pairs of strings
:type properties: dict
Given key-value pairs in *properties* for property names and
values, the properties are set on the analysis for the given
... | [
"def",
"set_properties",
"(",
"self",
",",
"properties",
",",
"*",
"*",
"kwargs",
")",
":",
"dxpy",
".",
"api",
".",
"analysis_set_properties",
"(",
"self",
".",
"_dxid",
",",
"{",
"\"properties\"",
":",
"properties",
"}",
",",
"*",
"*",
"kwargs",
")"
] | :param properties: Property names and values given as key-value pairs of strings
:type properties: dict
Given key-value pairs in *properties* for property names and
values, the properties are set on the analysis for the given
property names. Any property with a value of :const:`None`
... | [
":",
"param",
"properties",
":",
"Property",
"names",
"and",
"values",
"given",
"as",
"key",
"-",
"value",
"pairs",
"of",
"strings",
":",
"type",
"properties",
":",
"dict"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxanalysis.py#L94-L109 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxanalysis.py | DXAnalysis.get_output_ref | def get_output_ref(self, field, index=None, metadata=None):
'''
:param field: Output field name of this analysis
:type field: string
:param index: If the referenced field is an array, optionally specify an index (starting from 0) to indicate a particular member of the array
:type... | python | def get_output_ref(self, field, index=None, metadata=None):
'''
:param field: Output field name of this analysis
:type field: string
:param index: If the referenced field is an array, optionally specify an index (starting from 0) to indicate a particular member of the array
:type... | [
"def",
"get_output_ref",
"(",
"self",
",",
"field",
",",
"index",
"=",
"None",
",",
"metadata",
"=",
"None",
")",
":",
"link",
"=",
"{",
"\"$dnanexus_link\"",
":",
"{",
"\"analysis\"",
":",
"self",
".",
"_dxid",
",",
"\"field\"",
":",
"field",
"}",
"}"... | :param field: Output field name of this analysis
:type field: string
:param index: If the referenced field is an array, optionally specify an index (starting from 0) to indicate a particular member of the array
:type index: int
:param metadata: If the referenced field is of a data object... | [
":",
"param",
"field",
":",
"Output",
"field",
"name",
"of",
"this",
"analysis",
":",
"type",
"field",
":",
"string",
":",
"param",
"index",
":",
"If",
"the",
"referenced",
"field",
"is",
"an",
"array",
"optionally",
"specify",
"an",
"index",
"(",
"start... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxanalysis.py#L148-L165 |
dnanexus/dx-toolkit | src/python/dxpy/scripts/dx_build_app.py | _check_suggestions | def _check_suggestions(app_json, publish=False):
"""
Examines the specified dxapp.json file and warns about any
violations of suggestions guidelines.
:raises: AppBuilderException for data objects that could not be found
"""
for input_field in app_json.get('inputSpec', []):
for suggestio... | python | def _check_suggestions(app_json, publish=False):
"""
Examines the specified dxapp.json file and warns about any
violations of suggestions guidelines.
:raises: AppBuilderException for data objects that could not be found
"""
for input_field in app_json.get('inputSpec', []):
for suggestio... | [
"def",
"_check_suggestions",
"(",
"app_json",
",",
"publish",
"=",
"False",
")",
":",
"for",
"input_field",
"in",
"app_json",
".",
"get",
"(",
"'inputSpec'",
",",
"[",
"]",
")",
":",
"for",
"suggestion",
"in",
"input_field",
".",
"get",
"(",
"'suggestions'... | Examines the specified dxapp.json file and warns about any
violations of suggestions guidelines.
:raises: AppBuilderException for data objects that could not be found | [
"Examines",
"the",
"specified",
"dxapp",
".",
"json",
"file",
"and",
"warns",
"about",
"any",
"violations",
"of",
"suggestions",
"guidelines",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/scripts/dx_build_app.py#L86-L142 |
dnanexus/dx-toolkit | src/python/dxpy/scripts/dx_build_app.py | _lint | def _lint(dxapp_json_filename, mode):
"""
Examines the specified dxapp.json file and warns about any
violations of app guidelines.
Precondition: the dxapp.json file exists and can be parsed.
"""
def _find_readme(dirname):
for basename in ['README.md', 'Readme.md', 'readme.md']:
... | python | def _lint(dxapp_json_filename, mode):
"""
Examines the specified dxapp.json file and warns about any
violations of app guidelines.
Precondition: the dxapp.json file exists and can be parsed.
"""
def _find_readme(dirname):
for basename in ['README.md', 'Readme.md', 'readme.md']:
... | [
"def",
"_lint",
"(",
"dxapp_json_filename",
",",
"mode",
")",
":",
"def",
"_find_readme",
"(",
"dirname",
")",
":",
"for",
"basename",
"in",
"[",
"'README.md'",
",",
"'Readme.md'",
",",
"'readme.md'",
"]",
":",
"if",
"os",
".",
"path",
".",
"exists",
"("... | Examines the specified dxapp.json file and warns about any
violations of app guidelines.
Precondition: the dxapp.json file exists and can be parsed. | [
"Examines",
"the",
"specified",
"dxapp",
".",
"json",
"file",
"and",
"warns",
"about",
"any",
"violations",
"of",
"app",
"guidelines",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/scripts/dx_build_app.py#L144-L223 |
dnanexus/dx-toolkit | src/python/dxpy/scripts/dx_build_app.py | _check_syntax | def _check_syntax(code, lang, temp_dir, enforce=True):
"""
Checks that the code whose text is in CODE parses as LANG.
Raises DXSyntaxError if there is a problem and "enforce" is True.
"""
# This function needs the language to be explicitly set, so we can
# generate an appropriate temp filename.... | python | def _check_syntax(code, lang, temp_dir, enforce=True):
"""
Checks that the code whose text is in CODE parses as LANG.
Raises DXSyntaxError if there is a problem and "enforce" is True.
"""
# This function needs the language to be explicitly set, so we can
# generate an appropriate temp filename.... | [
"def",
"_check_syntax",
"(",
"code",
",",
"lang",
",",
"temp_dir",
",",
"enforce",
"=",
"True",
")",
":",
"# This function needs the language to be explicitly set, so we can",
"# generate an appropriate temp filename.",
"if",
"lang",
"==",
"'python2.7'",
":",
"temp_basename... | Checks that the code whose text is in CODE parses as LANG.
Raises DXSyntaxError if there is a problem and "enforce" is True. | [
"Checks",
"that",
"the",
"code",
"whose",
"text",
"is",
"in",
"CODE",
"parses",
"as",
"LANG",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/scripts/dx_build_app.py#L225-L242 |
dnanexus/dx-toolkit | src/python/dxpy/scripts/dx_build_app.py | _check_file_syntax | def _check_file_syntax(filename, temp_dir, override_lang=None, enforce=True):
"""
Checks that the code in FILENAME parses, attempting to autodetect
the language if necessary.
Raises IOError if the file cannot be read.
Raises DXSyntaxError if there is a problem and "enforce" is True.
"""
de... | python | def _check_file_syntax(filename, temp_dir, override_lang=None, enforce=True):
"""
Checks that the code in FILENAME parses, attempting to autodetect
the language if necessary.
Raises IOError if the file cannot be read.
Raises DXSyntaxError if there is a problem and "enforce" is True.
"""
de... | [
"def",
"_check_file_syntax",
"(",
"filename",
",",
"temp_dir",
",",
"override_lang",
"=",
"None",
",",
"enforce",
"=",
"True",
")",
":",
"def",
"check_python",
"(",
"filename",
")",
":",
"# Generate a semi-recognizable name to write the pyc to. Of",
"# course it's possi... | Checks that the code in FILENAME parses, attempting to autodetect
the language if necessary.
Raises IOError if the file cannot be read.
Raises DXSyntaxError if there is a problem and "enforce" is True. | [
"Checks",
"that",
"the",
"code",
"in",
"FILENAME",
"parses",
"attempting",
"to",
"autodetect",
"the",
"language",
"if",
"necessary",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/scripts/dx_build_app.py#L245-L305 |
dnanexus/dx-toolkit | src/python/dxpy/scripts/dx_build_app.py | _verify_app_source_dir_impl | def _verify_app_source_dir_impl(src_dir, temp_dir, mode, enforce=True):
"""Performs syntax and lint checks on the app source.
Precondition: the dxapp.json file exists and can be parsed.
"""
_lint(os.path.join(src_dir, "dxapp.json"), mode)
# Check that the entry point file parses as the type it is ... | python | def _verify_app_source_dir_impl(src_dir, temp_dir, mode, enforce=True):
"""Performs syntax and lint checks on the app source.
Precondition: the dxapp.json file exists and can be parsed.
"""
_lint(os.path.join(src_dir, "dxapp.json"), mode)
# Check that the entry point file parses as the type it is ... | [
"def",
"_verify_app_source_dir_impl",
"(",
"src_dir",
",",
"temp_dir",
",",
"mode",
",",
"enforce",
"=",
"True",
")",
":",
"_lint",
"(",
"os",
".",
"path",
".",
"join",
"(",
"src_dir",
",",
"\"dxapp.json\"",
")",
",",
"mode",
")",
"# Check that the entry poi... | Performs syntax and lint checks on the app source.
Precondition: the dxapp.json file exists and can be parsed. | [
"Performs",
"syntax",
"and",
"lint",
"checks",
"on",
"the",
"app",
"source",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/scripts/dx_build_app.py#L308-L415 |
dnanexus/dx-toolkit | src/python/dxpy/scripts/dx_build_app.py | _verify_app_source_dir | def _verify_app_source_dir(src_dir, mode, enforce=True):
"""Performs syntax and lint checks on the app source.
Precondition: the dxapp.json file exists and can be parsed.
"""
temp_dir = tempfile.mkdtemp(prefix='dx-build_tmp')
try:
_verify_app_source_dir_impl(src_dir, temp_dir, mode, enforce... | python | def _verify_app_source_dir(src_dir, mode, enforce=True):
"""Performs syntax and lint checks on the app source.
Precondition: the dxapp.json file exists and can be parsed.
"""
temp_dir = tempfile.mkdtemp(prefix='dx-build_tmp')
try:
_verify_app_source_dir_impl(src_dir, temp_dir, mode, enforce... | [
"def",
"_verify_app_source_dir",
"(",
"src_dir",
",",
"mode",
",",
"enforce",
"=",
"True",
")",
":",
"temp_dir",
"=",
"tempfile",
".",
"mkdtemp",
"(",
"prefix",
"=",
"'dx-build_tmp'",
")",
"try",
":",
"_verify_app_source_dir_impl",
"(",
"src_dir",
",",
"temp_d... | Performs syntax and lint checks on the app source.
Precondition: the dxapp.json file exists and can be parsed. | [
"Performs",
"syntax",
"and",
"lint",
"checks",
"on",
"the",
"app",
"source",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/scripts/dx_build_app.py#L443-L452 |
dnanexus/dx-toolkit | src/python/dxpy/scripts/dx_build_app.py | _parse_app_spec | def _parse_app_spec(src_dir):
"""Returns the parsed contents of dxapp.json.
Raises either AppBuilderException or a parser error (exit codes 3 or
2 respectively) if this cannot be done.
"""
if not os.path.isdir(src_dir):
parser.error("%s is not a directory" % src_dir)
if not os.path.exis... | python | def _parse_app_spec(src_dir):
"""Returns the parsed contents of dxapp.json.
Raises either AppBuilderException or a parser error (exit codes 3 or
2 respectively) if this cannot be done.
"""
if not os.path.isdir(src_dir):
parser.error("%s is not a directory" % src_dir)
if not os.path.exis... | [
"def",
"_parse_app_spec",
"(",
"src_dir",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"src_dir",
")",
":",
"parser",
".",
"error",
"(",
"\"%s is not a directory\"",
"%",
"src_dir",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(... | Returns the parsed contents of dxapp.json.
Raises either AppBuilderException or a parser error (exit codes 3 or
2 respectively) if this cannot be done. | [
"Returns",
"the",
"parsed",
"contents",
"of",
"dxapp",
".",
"json",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/scripts/dx_build_app.py#L454-L468 |
dnanexus/dx-toolkit | src/python/dxpy/scripts/dx_build_app.py | _build_app | def _build_app(args, extra_args):
"""Builds an app or applet and returns the resulting executable ID
(unless it was a dry-run, in which case None is returned).
TODO: remote app builds still return None, but we should fix this.
"""
if not args.remote:
# LOCAL BUILD
try:
... | python | def _build_app(args, extra_args):
"""Builds an app or applet and returns the resulting executable ID
(unless it was a dry-run, in which case None is returned).
TODO: remote app builds still return None, but we should fix this.
"""
if not args.remote:
# LOCAL BUILD
try:
... | [
"def",
"_build_app",
"(",
"args",
",",
"extra_args",
")",
":",
"if",
"not",
"args",
".",
"remote",
":",
"# LOCAL BUILD",
"try",
":",
"output",
"=",
"build_and_upload_locally",
"(",
"args",
".",
"src_dir",
",",
"args",
".",
"mode",
",",
"overwrite",
"=",
... | Builds an app or applet and returns the resulting executable ID
(unless it was a dry-run, in which case None is returned).
TODO: remote app builds still return None, but we should fix this. | [
"Builds",
"an",
"app",
"or",
"applet",
"and",
"returns",
"the",
"resulting",
"executable",
"ID",
"(",
"unless",
"it",
"was",
"a",
"dry",
"-",
"run",
"in",
"which",
"case",
"None",
"is",
"returned",
")",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/scripts/dx_build_app.py#L895-L997 |
dnanexus/dx-toolkit | src/python/dxpy/scripts/dx_build_app.py | main | def main(**kwargs):
"""
Entry point for dx-build-app(let).
Don't call this function as a subroutine in your program! It is liable to
sys.exit your program when it detects certain error conditions, so you
can't recover from those as you could if it raised exceptions. Instead,
call dx_build_app.b... | python | def main(**kwargs):
"""
Entry point for dx-build-app(let).
Don't call this function as a subroutine in your program! It is liable to
sys.exit your program when it detects certain error conditions, so you
can't recover from those as you could if it raised exceptions. Instead,
call dx_build_app.b... | [
"def",
"main",
"(",
"*",
"*",
"kwargs",
")",
":",
"if",
"len",
"(",
"sys",
".",
"argv",
")",
">",
"0",
":",
"if",
"sys",
".",
"argv",
"[",
"0",
"]",
".",
"endswith",
"(",
"'dx-build-app'",
")",
":",
"logging",
".",
"warn",
"(",
"'Warning: dx-buil... | Entry point for dx-build-app(let).
Don't call this function as a subroutine in your program! It is liable to
sys.exit your program when it detects certain error conditions, so you
can't recover from those as you could if it raised exceptions. Instead,
call dx_build_app.build_and_upload_locally which pr... | [
"Entry",
"point",
"for",
"dx",
"-",
"build",
"-",
"app",
"(",
"let",
")",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/scripts/dx_build_app.py#L1015-L1031 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxapp.py | DXApp.set_id | def set_id(self, dxid=None, name=None, alias=None):
'''
:param dxid: App ID
:type dxid: string
:param name: App name
:type name: string
:param alias: App version or tag
:type alias: string
:raises: :exc:`~dxpy.exceptions.DXError` if *dxid* and some other i... | python | def set_id(self, dxid=None, name=None, alias=None):
'''
:param dxid: App ID
:type dxid: string
:param name: App name
:type name: string
:param alias: App version or tag
:type alias: string
:raises: :exc:`~dxpy.exceptions.DXError` if *dxid* and some other i... | [
"def",
"set_id",
"(",
"self",
",",
"dxid",
"=",
"None",
",",
"name",
"=",
"None",
",",
"alias",
"=",
"None",
")",
":",
"self",
".",
"_dxid",
"=",
"None",
"self",
".",
"_name",
"=",
"None",
"self",
".",
"_alias",
"=",
"None",
"if",
"dxid",
"is",
... | :param dxid: App ID
:type dxid: string
:param name: App name
:type name: string
:param alias: App version or tag
:type alias: string
:raises: :exc:`~dxpy.exceptions.DXError` if *dxid* and some other input are both given or if neither *dxid* nor *name* are given
D... | [
":",
"param",
"dxid",
":",
"App",
"ID",
":",
"type",
"dxid",
":",
"string",
":",
"param",
"name",
":",
"App",
"name",
":",
"type",
"name",
":",
"string",
":",
"param",
"alias",
":",
"App",
"version",
"or",
"tag",
":",
"type",
"alias",
":",
"string"... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxapp.py#L84-L117 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxapp.py | DXApp.get_id | def get_id(self):
'''
:returns: Object ID of associated app
:rtype: string
Returns the object ID of the app that the handler is currently
associated with.
'''
if self._dxid is not None:
return self._dxid
else:
return 'app-' + self.... | python | def get_id(self):
'''
:returns: Object ID of associated app
:rtype: string
Returns the object ID of the app that the handler is currently
associated with.
'''
if self._dxid is not None:
return self._dxid
else:
return 'app-' + self.... | [
"def",
"get_id",
"(",
"self",
")",
":",
"if",
"self",
".",
"_dxid",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_dxid",
"else",
":",
"return",
"'app-'",
"+",
"self",
".",
"_name",
"+",
"'/'",
"+",
"self",
".",
"_alias"
] | :returns: Object ID of associated app
:rtype: string
Returns the object ID of the app that the handler is currently
associated with. | [
":",
"returns",
":",
"Object",
"ID",
"of",
"associated",
"app",
":",
"rtype",
":",
"string"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxapp.py#L119-L130 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxapp.py | DXApp.new | def new(self, **kwargs):
'''
:param initializeFrom: ID of an existing app object from which to initialize the app
:type initializeFrom: string
:param applet: ID of the applet that the app will be created from
:type applet: string
:param name: Name of the app (inherits fro... | python | def new(self, **kwargs):
'''
:param initializeFrom: ID of an existing app object from which to initialize the app
:type initializeFrom: string
:param applet: ID of the applet that the app will be created from
:type applet: string
:param name: Name of the app (inherits fro... | [
"def",
"new",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"#TODO: add support for regionalOptions (and deprecate top-level applet and resources)",
"dx_hash",
"=",
"{",
"}",
"if",
"'applet'",
"not",
"in",
"kwargs",
"and",
"'initializeFrom'",
"not",
"in",
"kwargs",
... | :param initializeFrom: ID of an existing app object from which to initialize the app
:type initializeFrom: string
:param applet: ID of the applet that the app will be created from
:type applet: string
:param name: Name of the app (inherits from *initializeFrom* if possible)
:type... | [
":",
"param",
"initializeFrom",
":",
"ID",
"of",
"an",
"existing",
"app",
"object",
"from",
"which",
"to",
"initialize",
"the",
"app",
":",
"type",
"initializeFrom",
":",
"string",
":",
"param",
"applet",
":",
"ID",
"of",
"the",
"applet",
"that",
"the",
... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxapp.py#L132-L196 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxapp.py | DXApp.describe | def describe(self, fields=None, **kwargs):
'''
:param fields: Hash where the keys are field names that should be returned, and values should be set to True (default is that all fields are returned)
:type fields: dict
:returns: Description of the remote app object
:rtype: dict
... | python | def describe(self, fields=None, **kwargs):
'''
:param fields: Hash where the keys are field names that should be returned, and values should be set to True (default is that all fields are returned)
:type fields: dict
:returns: Description of the remote app object
:rtype: dict
... | [
"def",
"describe",
"(",
"self",
",",
"fields",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"describe_input",
"=",
"{",
"}",
"if",
"fields",
":",
"describe_input",
"[",
"'fields'",
"]",
"=",
"fields",
"if",
"self",
".",
"_dxid",
"is",
"not",
"None... | :param fields: Hash where the keys are field names that should be returned, and values should be set to True (default is that all fields are returned)
:type fields: dict
:returns: Description of the remote app object
:rtype: dict
Returns a dict with a description of the app. The result
... | [
":",
"param",
"fields",
":",
"Hash",
"where",
"the",
"keys",
"are",
"field",
"names",
"that",
"should",
"be",
"returned",
"and",
"values",
"should",
"be",
"set",
"to",
"True",
"(",
"default",
"is",
"that",
"all",
"fields",
"are",
"returned",
")",
":",
... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxapp.py#L198-L221 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxapp.py | DXApp.update | def update(self, **kwargs):
'''
:param applet: ID of the applet to replace the app's contents with
:type applet: string
:param details: Metadata to store with the app (optional)
:type details: dict or list
:param access: Access specification (optional)
:type acces... | python | def update(self, **kwargs):
'''
:param applet: ID of the applet to replace the app's contents with
:type applet: string
:param details: Metadata to store with the app (optional)
:type details: dict or list
:param access: Access specification (optional)
:type acces... | [
"def",
"update",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"updates",
"=",
"{",
"}",
"for",
"field",
"in",
"'applet'",
",",
"'billing'",
",",
"'access'",
",",
"'resources'",
",",
"'details'",
":",
"if",
"field",
"in",
"kwargs",
":",
"updates",
... | :param applet: ID of the applet to replace the app's contents with
:type applet: string
:param details: Metadata to store with the app (optional)
:type details: dict or list
:param access: Access specification (optional)
:type access: dict
:param resources: Specifies what... | [
":",
"param",
"applet",
":",
"ID",
"of",
"the",
"applet",
"to",
"replace",
"the",
"app",
"s",
"contents",
"with",
":",
"type",
"applet",
":",
"string",
":",
"param",
"details",
":",
"Metadata",
"to",
"store",
"with",
"the",
"app",
"(",
"optional",
")",... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxapp.py#L223-L252 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxapp.py | DXApp.add_tags | def add_tags(self, tags, **kwargs):
"""
:param tags: Tags to add to the app
:type tags: array
Adds the specified application name tags (aliases) to this app.
The current user must be a developer of the app.
"""
if self._dxid is not None:
return dxpy... | python | def add_tags(self, tags, **kwargs):
"""
:param tags: Tags to add to the app
:type tags: array
Adds the specified application name tags (aliases) to this app.
The current user must be a developer of the app.
"""
if self._dxid is not None:
return dxpy... | [
"def",
"add_tags",
"(",
"self",
",",
"tags",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_dxid",
"is",
"not",
"None",
":",
"return",
"dxpy",
".",
"api",
".",
"app_add_tags",
"(",
"self",
".",
"_dxid",
",",
"input_params",
"=",
"{",
"\"ta... | :param tags: Tags to add to the app
:type tags: array
Adds the specified application name tags (aliases) to this app.
The current user must be a developer of the app. | [
":",
"param",
"tags",
":",
"Tags",
"to",
"add",
"to",
"the",
"app",
":",
"type",
"tags",
":",
"array"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxapp.py#L254-L268 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxapp.py | DXApp.remove_tags | def remove_tags(self, tags, **kwargs):
"""
:param tags: Tags to remove from the app
:type tags: array
Removes the specified application name tags (aliases) from this
app, so that it is no longer addressable by those aliases.
The current user must be a developer of the a... | python | def remove_tags(self, tags, **kwargs):
"""
:param tags: Tags to remove from the app
:type tags: array
Removes the specified application name tags (aliases) from this
app, so that it is no longer addressable by those aliases.
The current user must be a developer of the a... | [
"def",
"remove_tags",
"(",
"self",
",",
"tags",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_dxid",
"is",
"not",
"None",
":",
"return",
"dxpy",
".",
"api",
".",
"app_remove_tags",
"(",
"self",
".",
"_dxid",
",",
"input_params",
"=",
"{",
... | :param tags: Tags to remove from the app
:type tags: array
Removes the specified application name tags (aliases) from this
app, so that it is no longer addressable by those aliases.
The current user must be a developer of the app. | [
":",
"param",
"tags",
":",
"Tags",
"to",
"remove",
"from",
"the",
"app",
":",
"type",
"tags",
":",
"array"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxapp.py#L277-L292 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxapp.py | DXApp.install | def install(self, **kwargs):
"""
Installs the app in the current user's account.
"""
if self._dxid is not None:
return dxpy.api.app_install(self._dxid, **kwargs)
else:
return dxpy.api.app_install('app-' + self._name, alias=self._alias, **kwargs) | python | def install(self, **kwargs):
"""
Installs the app in the current user's account.
"""
if self._dxid is not None:
return dxpy.api.app_install(self._dxid, **kwargs)
else:
return dxpy.api.app_install('app-' + self._name, alias=self._alias, **kwargs) | [
"def",
"install",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_dxid",
"is",
"not",
"None",
":",
"return",
"dxpy",
".",
"api",
".",
"app_install",
"(",
"self",
".",
"_dxid",
",",
"*",
"*",
"kwargs",
")",
"else",
":",
"retur... | Installs the app in the current user's account. | [
"Installs",
"the",
"app",
"in",
"the",
"current",
"user",
"s",
"account",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxapp.py#L301-L308 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxapp.py | DXApp.uninstall | def uninstall(self, **kwargs):
"""
Uninstalls the app from the current user's account.
"""
if self._dxid is not None:
return dxpy.api.app_uninstall(self._dxid, **kwargs)
else:
return dxpy.api.app_uninstall('app-' + self._name, alias=self._alias, **kwargs) | python | def uninstall(self, **kwargs):
"""
Uninstalls the app from the current user's account.
"""
if self._dxid is not None:
return dxpy.api.app_uninstall(self._dxid, **kwargs)
else:
return dxpy.api.app_uninstall('app-' + self._name, alias=self._alias, **kwargs) | [
"def",
"uninstall",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_dxid",
"is",
"not",
"None",
":",
"return",
"dxpy",
".",
"api",
".",
"app_uninstall",
"(",
"self",
".",
"_dxid",
",",
"*",
"*",
"kwargs",
")",
"else",
":",
"r... | Uninstalls the app from the current user's account. | [
"Uninstalls",
"the",
"app",
"from",
"the",
"current",
"user",
"s",
"account",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxapp.py#L310-L317 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxapp.py | DXApp.get | def get(self, **kwargs):
"""
:returns: Full specification of the remote app object
:rtype: dict
Returns the contents of the app. The result includes the
key-value pairs as specified in the API documentation for the
`/app-xxxx/get
<https://wiki.dnanexus.com/API-Sp... | python | def get(self, **kwargs):
"""
:returns: Full specification of the remote app object
:rtype: dict
Returns the contents of the app. The result includes the
key-value pairs as specified in the API documentation for the
`/app-xxxx/get
<https://wiki.dnanexus.com/API-Sp... | [
"def",
"get",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_dxid",
"is",
"not",
"None",
":",
"return",
"dxpy",
".",
"api",
".",
"app_get",
"(",
"self",
".",
"_dxid",
",",
"*",
"*",
"kwargs",
")",
"else",
":",
"return",
"d... | :returns: Full specification of the remote app object
:rtype: dict
Returns the contents of the app. The result includes the
key-value pairs as specified in the API documentation for the
`/app-xxxx/get
<https://wiki.dnanexus.com/API-Specification-v1.0.0/Apps#API-method%253A-%252F... | [
":",
"returns",
":",
"Full",
"specification",
"of",
"the",
"remote",
"app",
"object",
":",
"rtype",
":",
"dict"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxapp.py#L319-L333 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxapp.py | DXApp.delete | def delete(self, **kwargs):
"""
Removes this app object from the platform.
The current user must be a developer of the app.
"""
if self._dxid is not None:
return dxpy.api.app_delete(self._dxid, **kwargs)
else:
return dxpy.api.app_delete('app-' + s... | python | def delete(self, **kwargs):
"""
Removes this app object from the platform.
The current user must be a developer of the app.
"""
if self._dxid is not None:
return dxpy.api.app_delete(self._dxid, **kwargs)
else:
return dxpy.api.app_delete('app-' + s... | [
"def",
"delete",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_dxid",
"is",
"not",
"None",
":",
"return",
"dxpy",
".",
"api",
".",
"app_delete",
"(",
"self",
".",
"_dxid",
",",
"*",
"*",
"kwargs",
")",
"else",
":",
"return"... | Removes this app object from the platform.
The current user must be a developer of the app. | [
"Removes",
"this",
"app",
"object",
"from",
"the",
"platform",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxapp.py#L346-L355 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxapp.py | DXApp.run | def run(self, app_input, *args, **kwargs):
"""
Creates a new job that executes the function "main" of this app with
the given input *app_input*.
See :meth:`dxpy.bindings.dxapplet.DXExecutable.run` for the available
args.
"""
# Rename app_input to preserve API com... | python | def run(self, app_input, *args, **kwargs):
"""
Creates a new job that executes the function "main" of this app with
the given input *app_input*.
See :meth:`dxpy.bindings.dxapplet.DXExecutable.run` for the available
args.
"""
# Rename app_input to preserve API com... | [
"def",
"run",
"(",
"self",
",",
"app_input",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Rename app_input to preserve API compatibility when calling",
"# DXApp.run(app_input=...).",
"return",
"super",
"(",
"DXApp",
",",
"self",
")",
".",
"run",
"(",
... | Creates a new job that executes the function "main" of this app with
the given input *app_input*.
See :meth:`dxpy.bindings.dxapplet.DXExecutable.run` for the available
args. | [
"Creates",
"a",
"new",
"job",
"that",
"executes",
"the",
"function",
"main",
"of",
"this",
"app",
"with",
"the",
"given",
"input",
"*",
"app_input",
"*",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxapp.py#L380-L390 |
dnanexus/dx-toolkit | src/python/dxpy/workflow_builder.py | _parse_executable_spec | def _parse_executable_spec(src_dir, json_file_name, parser):
"""
Returns the parsed contents of a json specification.
Raises WorkflowBuilderException (exit code 3) if this cannot be done.
"""
if not os.path.isdir(src_dir):
parser.error("{} is not a directory".format(src_dir))
if not os.... | python | def _parse_executable_spec(src_dir, json_file_name, parser):
"""
Returns the parsed contents of a json specification.
Raises WorkflowBuilderException (exit code 3) if this cannot be done.
"""
if not os.path.isdir(src_dir):
parser.error("{} is not a directory".format(src_dir))
if not os.... | [
"def",
"_parse_executable_spec",
"(",
"src_dir",
",",
"json_file_name",
",",
"parser",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"src_dir",
")",
":",
"parser",
".",
"error",
"(",
"\"{} is not a directory\"",
".",
"format",
"(",
"src_dir",
... | Returns the parsed contents of a json specification.
Raises WorkflowBuilderException (exit code 3) if this cannot be done. | [
"Returns",
"the",
"parsed",
"contents",
"of",
"a",
"json",
"specification",
".",
"Raises",
"WorkflowBuilderException",
"(",
"exit",
"code",
"3",
")",
"if",
"this",
"cannot",
"be",
"done",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/workflow_builder.py#L52-L69 |
dnanexus/dx-toolkit | src/python/dxpy/workflow_builder.py | _get_destination_project | def _get_destination_project(json_spec, args, build_project_id=None):
"""
Returns destination project in which the workflow should be created.
In can be set in multiple ways whose order of precedence is:
1. --destination, -d option supplied with `dx build`,
2. 'project' specified in the json file,
... | python | def _get_destination_project(json_spec, args, build_project_id=None):
"""
Returns destination project in which the workflow should be created.
In can be set in multiple ways whose order of precedence is:
1. --destination, -d option supplied with `dx build`,
2. 'project' specified in the json file,
... | [
"def",
"_get_destination_project",
"(",
"json_spec",
",",
"args",
",",
"build_project_id",
"=",
"None",
")",
":",
"if",
"build_project_id",
":",
"return",
"build_project_id",
"if",
"'project'",
"in",
"json_spec",
":",
"return",
"json_spec",
"[",
"'project'",
"]",
... | Returns destination project in which the workflow should be created.
In can be set in multiple ways whose order of precedence is:
1. --destination, -d option supplied with `dx build`,
2. 'project' specified in the json file,
3. project set in the dxpy.WORKSPACE_ID environment variable. | [
"Returns",
"destination",
"project",
"in",
"which",
"the",
"workflow",
"should",
"be",
"created",
".",
"In",
"can",
"be",
"set",
"in",
"multiple",
"ways",
"whose",
"order",
"of",
"precedence",
"is",
":",
"1",
".",
"--",
"destination",
"-",
"d",
"option",
... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/workflow_builder.py#L72-L88 |
dnanexus/dx-toolkit | src/python/dxpy/workflow_builder.py | _get_destination_folder | def _get_destination_folder(json_spec, folder_name=None):
"""
Returns destination project in which the workflow should be created.
It can be set in the json specification or by --destination option supplied
with `dx build`.
The order of precedence is:
1. --destination, -d option,
2. 'folder'... | python | def _get_destination_folder(json_spec, folder_name=None):
"""
Returns destination project in which the workflow should be created.
It can be set in the json specification or by --destination option supplied
with `dx build`.
The order of precedence is:
1. --destination, -d option,
2. 'folder'... | [
"def",
"_get_destination_folder",
"(",
"json_spec",
",",
"folder_name",
"=",
"None",
")",
":",
"dest_folder",
"=",
"folder_name",
"or",
"json_spec",
".",
"get",
"(",
"'folder'",
")",
"or",
"'/'",
"if",
"not",
"dest_folder",
".",
"endswith",
"(",
"'/'",
")",
... | Returns destination project in which the workflow should be created.
It can be set in the json specification or by --destination option supplied
with `dx build`.
The order of precedence is:
1. --destination, -d option,
2. 'folder' specified in the json file. | [
"Returns",
"destination",
"project",
"in",
"which",
"the",
"workflow",
"should",
"be",
"created",
".",
"It",
"can",
"be",
"set",
"in",
"the",
"json",
"specification",
"or",
"by",
"--",
"destination",
"option",
"supplied",
"with",
"dx",
"build",
".",
"The",
... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/workflow_builder.py#L91-L103 |
dnanexus/dx-toolkit | src/python/dxpy/workflow_builder.py | _set_categories_on_workflow | def _set_categories_on_workflow(global_workflow_id, categories_to_set):
"""
Note: Categories are set on the workflow series level,
i.e. the same set applies to all versions.
"""
assert(isinstance(categories_to_set, list))
existing_categories = dxpy.api.global_workflow_list_categories(global_wor... | python | def _set_categories_on_workflow(global_workflow_id, categories_to_set):
"""
Note: Categories are set on the workflow series level,
i.e. the same set applies to all versions.
"""
assert(isinstance(categories_to_set, list))
existing_categories = dxpy.api.global_workflow_list_categories(global_wor... | [
"def",
"_set_categories_on_workflow",
"(",
"global_workflow_id",
",",
"categories_to_set",
")",
":",
"assert",
"(",
"isinstance",
"(",
"categories_to_set",
",",
"list",
")",
")",
"existing_categories",
"=",
"dxpy",
".",
"api",
".",
"global_workflow_list_categories",
"... | Note: Categories are set on the workflow series level,
i.e. the same set applies to all versions. | [
"Note",
":",
"Categories",
"are",
"set",
"on",
"the",
"workflow",
"series",
"level",
"i",
".",
"e",
".",
"the",
"same",
"set",
"applies",
"to",
"all",
"versions",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/workflow_builder.py#L122-L137 |
dnanexus/dx-toolkit | src/python/dxpy/workflow_builder.py | _version_exists | def _version_exists(json_spec, name=None, version=None):
"""
Returns True if a global workflow with the given name and version
already exists in the platform and the user has developer rights
to the workflow. "name" and "version" can be passed if we already
made a "describe" API call on the global w... | python | def _version_exists(json_spec, name=None, version=None):
"""
Returns True if a global workflow with the given name and version
already exists in the platform and the user has developer rights
to the workflow. "name" and "version" can be passed if we already
made a "describe" API call on the global w... | [
"def",
"_version_exists",
"(",
"json_spec",
",",
"name",
"=",
"None",
",",
"version",
"=",
"None",
")",
":",
"requested_name",
"=",
"json_spec",
"[",
"'name'",
"]",
"requested_version",
"=",
"json_spec",
"[",
"'version'",
"]",
"if",
"requested_name",
"==",
"... | Returns True if a global workflow with the given name and version
already exists in the platform and the user has developer rights
to the workflow. "name" and "version" can be passed if we already
made a "describe" API call on the global workflow and so know the
requested name and version already exists... | [
"Returns",
"True",
"if",
"a",
"global",
"workflow",
"with",
"the",
"given",
"name",
"and",
"version",
"already",
"exists",
"in",
"the",
"platform",
"and",
"the",
"user",
"has",
"developer",
"rights",
"to",
"the",
"workflow",
".",
"name",
"and",
"version",
... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/workflow_builder.py#L140-L163 |
dnanexus/dx-toolkit | src/python/dxpy/workflow_builder.py | validate_ignore_reuse | def validate_ignore_reuse(stages, ignore_reuse_stages):
"""
Checks if each stage ID specified in ignore_reuse_stages exists in
the workflow definition. If ignore_reuse_stages contains
only '*', the field is valid.
"""
if not isinstance(ignore_reuse_stages, list):
raise WorkflowBuilderEx... | python | def validate_ignore_reuse(stages, ignore_reuse_stages):
"""
Checks if each stage ID specified in ignore_reuse_stages exists in
the workflow definition. If ignore_reuse_stages contains
only '*', the field is valid.
"""
if not isinstance(ignore_reuse_stages, list):
raise WorkflowBuilderEx... | [
"def",
"validate_ignore_reuse",
"(",
"stages",
",",
"ignore_reuse_stages",
")",
":",
"if",
"not",
"isinstance",
"(",
"ignore_reuse_stages",
",",
"list",
")",
":",
"raise",
"WorkflowBuilderException",
"(",
"'\"IgnoreReuse must be a list of strings - stage IDs or \"*\"'",
")"... | Checks if each stage ID specified in ignore_reuse_stages exists in
the workflow definition. If ignore_reuse_stages contains
only '*', the field is valid. | [
"Checks",
"if",
"each",
"stage",
"ID",
"specified",
"in",
"ignore_reuse_stages",
"exists",
"in",
"the",
"workflow",
"definition",
".",
"If",
"ignore_reuse_stages",
"contains",
"only",
"*",
"the",
"field",
"is",
"valid",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/workflow_builder.py#L183-L200 |
dnanexus/dx-toolkit | src/python/dxpy/workflow_builder.py | _get_validated_stages | def _get_validated_stages(stages):
"""
Validates stages of the workflow as a list of dictionaries.
"""
if not isinstance(stages, list):
raise WorkflowBuilderException("Stages must be specified as a list of dictionaries")
validated_stages = []
for index, stage in enumerate(stages):
... | python | def _get_validated_stages(stages):
"""
Validates stages of the workflow as a list of dictionaries.
"""
if not isinstance(stages, list):
raise WorkflowBuilderException("Stages must be specified as a list of dictionaries")
validated_stages = []
for index, stage in enumerate(stages):
... | [
"def",
"_get_validated_stages",
"(",
"stages",
")",
":",
"if",
"not",
"isinstance",
"(",
"stages",
",",
"list",
")",
":",
"raise",
"WorkflowBuilderException",
"(",
"\"Stages must be specified as a list of dictionaries\"",
")",
"validated_stages",
"=",
"[",
"]",
"for",... | Validates stages of the workflow as a list of dictionaries. | [
"Validates",
"stages",
"of",
"the",
"workflow",
"as",
"a",
"list",
"of",
"dictionaries",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/workflow_builder.py#L203-L212 |
dnanexus/dx-toolkit | src/python/dxpy/workflow_builder.py | _validate_json_for_regular_workflow | def _validate_json_for_regular_workflow(json_spec, args):
"""
Validates fields used only for building a regular, project-based workflow.
"""
validated = {}
override_project_id, override_folder, override_workflow_name = \
dxpy.executable_builder.get_parsed_destination(args.destination)
va... | python | def _validate_json_for_regular_workflow(json_spec, args):
"""
Validates fields used only for building a regular, project-based workflow.
"""
validated = {}
override_project_id, override_folder, override_workflow_name = \
dxpy.executable_builder.get_parsed_destination(args.destination)
va... | [
"def",
"_validate_json_for_regular_workflow",
"(",
"json_spec",
",",
"args",
")",
":",
"validated",
"=",
"{",
"}",
"override_project_id",
",",
"override_folder",
",",
"override_workflow_name",
"=",
"dxpy",
".",
"executable_builder",
".",
"get_parsed_destination",
"(",
... | Validates fields used only for building a regular, project-based workflow. | [
"Validates",
"fields",
"used",
"only",
"for",
"building",
"a",
"regular",
"project",
"-",
"based",
"workflow",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/workflow_builder.py#L215-L230 |
dnanexus/dx-toolkit | src/python/dxpy/workflow_builder.py | _validate_json_for_global_workflow | def _validate_json_for_global_workflow(json_spec, args):
"""
Validates fields used for building a global workflow.
Since building a global workflow is done after all the underlying workflows
are built, which may be time-consuming, we validate as much as possible here.
"""
# TODO: verify the bill... | python | def _validate_json_for_global_workflow(json_spec, args):
"""
Validates fields used for building a global workflow.
Since building a global workflow is done after all the underlying workflows
are built, which may be time-consuming, we validate as much as possible here.
"""
# TODO: verify the bill... | [
"def",
"_validate_json_for_global_workflow",
"(",
"json_spec",
",",
"args",
")",
":",
"# TODO: verify the billTo can build the workflow",
"# TODO: if the global workflow build fails add an option to interactively change billto",
"# TODO: (or other simple fields) instead of failing altogether",
... | Validates fields used for building a global workflow.
Since building a global workflow is done after all the underlying workflows
are built, which may be time-consuming, we validate as much as possible here. | [
"Validates",
"fields",
"used",
"for",
"building",
"a",
"global",
"workflow",
".",
"Since",
"building",
"a",
"global",
"workflow",
"is",
"done",
"after",
"all",
"the",
"underlying",
"workflows",
"are",
"built",
"which",
"may",
"be",
"time",
"-",
"consuming",
... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/workflow_builder.py#L233-L271 |
dnanexus/dx-toolkit | src/python/dxpy/workflow_builder.py | _get_validated_json | def _get_validated_json(json_spec, args):
"""
Validates dxworkflow.json and returns the json that can be sent with the
/workflow/new API or /globalworkflow/new request.
"""
if not json_spec:
return
if not args:
return
validated_spec = copy.deepcopy(json_spec)
# print ig... | python | def _get_validated_json(json_spec, args):
"""
Validates dxworkflow.json and returns the json that can be sent with the
/workflow/new API or /globalworkflow/new request.
"""
if not json_spec:
return
if not args:
return
validated_spec = copy.deepcopy(json_spec)
# print ig... | [
"def",
"_get_validated_json",
"(",
"json_spec",
",",
"args",
")",
":",
"if",
"not",
"json_spec",
":",
"return",
"if",
"not",
"args",
":",
"return",
"validated_spec",
"=",
"copy",
".",
"deepcopy",
"(",
"json_spec",
")",
"# print ignored keys if present in json_spec... | Validates dxworkflow.json and returns the json that can be sent with the
/workflow/new API or /globalworkflow/new request. | [
"Validates",
"dxworkflow",
".",
"json",
"and",
"returns",
"the",
"json",
"that",
"can",
"be",
"sent",
"with",
"the",
"/",
"workflow",
"/",
"new",
"API",
"or",
"/",
"globalworkflow",
"/",
"new",
"request",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/workflow_builder.py#L274-L317 |
dnanexus/dx-toolkit | src/python/dxpy/workflow_builder.py | _get_validated_json_for_build_or_update | def _get_validated_json_for_build_or_update(json_spec, args):
"""
Validates those fields that can be used when either building
a new version (of a local, project-based workflow) or updating
an existing version (of a global workflow).
"""
validated = copy.deepcopy(json_spec)
dxpy.executable_... | python | def _get_validated_json_for_build_or_update(json_spec, args):
"""
Validates those fields that can be used when either building
a new version (of a local, project-based workflow) or updating
an existing version (of a global workflow).
"""
validated = copy.deepcopy(json_spec)
dxpy.executable_... | [
"def",
"_get_validated_json_for_build_or_update",
"(",
"json_spec",
",",
"args",
")",
":",
"validated",
"=",
"copy",
".",
"deepcopy",
"(",
"json_spec",
")",
"dxpy",
".",
"executable_builder",
".",
"inline_documentation_files",
"(",
"validated",
",",
"args",
".",
"... | Validates those fields that can be used when either building
a new version (of a local, project-based workflow) or updating
an existing version (of a global workflow). | [
"Validates",
"those",
"fields",
"that",
"can",
"be",
"used",
"when",
"either",
"building",
"a",
"new",
"version",
"(",
"of",
"a",
"local",
"project",
"-",
"based",
"workflow",
")",
"or",
"updating",
"an",
"existing",
"version",
"(",
"of",
"a",
"global",
... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/workflow_builder.py#L320-L339 |
dnanexus/dx-toolkit | src/python/dxpy/workflow_builder.py | _assert_executable_regions_match | def _assert_executable_regions_match(workflow_enabled_regions, workflow_spec):
"""
Check if the global workflow regions and the regions of stages (apps) match.
If the workflow contains any applets, the workflow can be currently enabled
in only one region - the region in which the applets are stored.
... | python | def _assert_executable_regions_match(workflow_enabled_regions, workflow_spec):
"""
Check if the global workflow regions and the regions of stages (apps) match.
If the workflow contains any applets, the workflow can be currently enabled
in only one region - the region in which the applets are stored.
... | [
"def",
"_assert_executable_regions_match",
"(",
"workflow_enabled_regions",
",",
"workflow_spec",
")",
":",
"executables",
"=",
"[",
"i",
".",
"get",
"(",
"\"executable\"",
")",
"for",
"i",
"in",
"workflow_spec",
".",
"get",
"(",
"\"stages\"",
")",
"]",
"for",
... | Check if the global workflow regions and the regions of stages (apps) match.
If the workflow contains any applets, the workflow can be currently enabled
in only one region - the region in which the applets are stored. | [
"Check",
"if",
"the",
"global",
"workflow",
"regions",
"and",
"the",
"regions",
"of",
"stages",
"(",
"apps",
")",
"match",
".",
"If",
"the",
"workflow",
"contains",
"any",
"applets",
"the",
"workflow",
"can",
"be",
"currently",
"enabled",
"in",
"only",
"on... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/workflow_builder.py#L342-L373 |
dnanexus/dx-toolkit | src/python/dxpy/workflow_builder.py | _build_regular_workflow | def _build_regular_workflow(json_spec):
"""
Precondition: json_spec must be validated
"""
workflow_id = dxpy.api.workflow_new(json_spec)["id"]
dxpy.api.workflow_close(workflow_id)
return workflow_id | python | def _build_regular_workflow(json_spec):
"""
Precondition: json_spec must be validated
"""
workflow_id = dxpy.api.workflow_new(json_spec)["id"]
dxpy.api.workflow_close(workflow_id)
return workflow_id | [
"def",
"_build_regular_workflow",
"(",
"json_spec",
")",
":",
"workflow_id",
"=",
"dxpy",
".",
"api",
".",
"workflow_new",
"(",
"json_spec",
")",
"[",
"\"id\"",
"]",
"dxpy",
".",
"api",
".",
"workflow_close",
"(",
"workflow_id",
")",
"return",
"workflow_id"
] | Precondition: json_spec must be validated | [
"Precondition",
":",
"json_spec",
"must",
"be",
"validated"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/workflow_builder.py#L376-L382 |
dnanexus/dx-toolkit | src/python/dxpy/workflow_builder.py | _get_validated_enabled_regions | def _get_validated_enabled_regions(json_spec, from_command_line):
"""
Returns a set of regions (region names) in which the global workflow
should be enabled. Also validates and synchronizes the regions
passed via CLI argument and in the regionalOptions field.
"""
enabled_regions = dxpy.executabl... | python | def _get_validated_enabled_regions(json_spec, from_command_line):
"""
Returns a set of regions (region names) in which the global workflow
should be enabled. Also validates and synchronizes the regions
passed via CLI argument and in the regionalOptions field.
"""
enabled_regions = dxpy.executabl... | [
"def",
"_get_validated_enabled_regions",
"(",
"json_spec",
",",
"from_command_line",
")",
":",
"enabled_regions",
"=",
"dxpy",
".",
"executable_builder",
".",
"get_enabled_regions",
"(",
"'globalworkflow'",
",",
"json_spec",
",",
"from_command_line",
",",
"WorkflowBuilder... | Returns a set of regions (region names) in which the global workflow
should be enabled. Also validates and synchronizes the regions
passed via CLI argument and in the regionalOptions field. | [
"Returns",
"a",
"set",
"of",
"regions",
"(",
"region",
"names",
")",
"in",
"which",
"the",
"global",
"workflow",
"should",
"be",
"enabled",
".",
"Also",
"validates",
"and",
"synchronizes",
"the",
"regions",
"passed",
"via",
"CLI",
"argument",
"and",
"in",
... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/workflow_builder.py#L385-L410 |
dnanexus/dx-toolkit | src/python/dxpy/workflow_builder.py | _create_temporary_projects | def _create_temporary_projects(enabled_regions, args):
"""
Creates a temporary project needed to build an underlying workflow
for a global workflow. Returns a dictionary with region names as keys
and project IDs as values
The regions in which projects will be created can be:
i. regions specifie... | python | def _create_temporary_projects(enabled_regions, args):
"""
Creates a temporary project needed to build an underlying workflow
for a global workflow. Returns a dictionary with region names as keys
and project IDs as values
The regions in which projects will be created can be:
i. regions specifie... | [
"def",
"_create_temporary_projects",
"(",
"enabled_regions",
",",
"args",
")",
":",
"# Create one temp project in each region",
"projects_by_region",
"=",
"{",
"}",
"# Project IDs by region",
"for",
"region",
"in",
"enabled_regions",
":",
"try",
":",
"project_input",
"=",... | Creates a temporary project needed to build an underlying workflow
for a global workflow. Returns a dictionary with region names as keys
and project IDs as values
The regions in which projects will be created can be:
i. regions specified in dxworkflow.json "regionalOptions"
ii. regions specified as... | [
"Creates",
"a",
"temporary",
"project",
"needed",
"to",
"build",
"an",
"underlying",
"workflow",
"for",
"a",
"global",
"workflow",
".",
"Returns",
"a",
"dictionary",
"with",
"region",
"names",
"as",
"keys",
"and",
"project",
"IDs",
"as",
"values"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/workflow_builder.py#L413-L441 |
dnanexus/dx-toolkit | src/python/dxpy/workflow_builder.py | _build_underlying_workflows | def _build_underlying_workflows(enabled_regions, json_spec, args):
"""
Creates a workflow in a temporary project for each enabled region.
Returns a tuple of dictionaries: workflow IDs by region and project IDs by region.
The caller is responsible for destroying the projects if this method returns proper... | python | def _build_underlying_workflows(enabled_regions, json_spec, args):
"""
Creates a workflow in a temporary project for each enabled region.
Returns a tuple of dictionaries: workflow IDs by region and project IDs by region.
The caller is responsible for destroying the projects if this method returns proper... | [
"def",
"_build_underlying_workflows",
"(",
"enabled_regions",
",",
"json_spec",
",",
"args",
")",
":",
"projects_by_region",
"=",
"_create_temporary_projects",
"(",
"enabled_regions",
",",
"args",
")",
"workflows_by_region",
"=",
"{",
"}",
"try",
":",
"for",
"region... | Creates a workflow in a temporary project for each enabled region.
Returns a tuple of dictionaries: workflow IDs by region and project IDs by region.
The caller is responsible for destroying the projects if this method returns properly. | [
"Creates",
"a",
"workflow",
"in",
"a",
"temporary",
"project",
"for",
"each",
"enabled",
"region",
".",
"Returns",
"a",
"tuple",
"of",
"dictionaries",
":",
"workflow",
"IDs",
"by",
"region",
"and",
"project",
"IDs",
"by",
"region",
".",
"The",
"caller",
"i... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/workflow_builder.py#L444-L465 |
dnanexus/dx-toolkit | src/python/dxpy/workflow_builder.py | _build_global_workflow | def _build_global_workflow(json_spec, args):
"""
Creates a workflow in a temporary project for each enabled region
and builds a global workflow on the platform based on these workflows.
"""
# First determine in which regions the global workflow needs to be available
enabled_regions = _get_valida... | python | def _build_global_workflow(json_spec, args):
"""
Creates a workflow in a temporary project for each enabled region
and builds a global workflow on the platform based on these workflows.
"""
# First determine in which regions the global workflow needs to be available
enabled_regions = _get_valida... | [
"def",
"_build_global_workflow",
"(",
"json_spec",
",",
"args",
")",
":",
"# First determine in which regions the global workflow needs to be available",
"enabled_regions",
"=",
"_get_validated_enabled_regions",
"(",
"json_spec",
",",
"args",
".",
"region",
")",
"# Verify all t... | Creates a workflow in a temporary project for each enabled region
and builds a global workflow on the platform based on these workflows. | [
"Creates",
"a",
"workflow",
"in",
"a",
"temporary",
"project",
"for",
"each",
"enabled",
"region",
"and",
"builds",
"a",
"global",
"workflow",
"on",
"the",
"platform",
"based",
"on",
"these",
"workflows",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/workflow_builder.py#L468-L524 |
dnanexus/dx-toolkit | src/python/dxpy/workflow_builder.py | _build_or_update_workflow | def _build_or_update_workflow(json_spec, args):
"""
Creates or updates a workflow on the platform.
Returns the workflow ID, or None if the workflow cannot be created.
"""
try:
if args.mode == 'workflow':
json_spec = _get_validated_json(json_spec, args)
workflow_id = _... | python | def _build_or_update_workflow(json_spec, args):
"""
Creates or updates a workflow on the platform.
Returns the workflow ID, or None if the workflow cannot be created.
"""
try:
if args.mode == 'workflow':
json_spec = _get_validated_json(json_spec, args)
workflow_id = _... | [
"def",
"_build_or_update_workflow",
"(",
"json_spec",
",",
"args",
")",
":",
"try",
":",
"if",
"args",
".",
"mode",
"==",
"'workflow'",
":",
"json_spec",
"=",
"_get_validated_json",
"(",
"json_spec",
",",
"args",
")",
"workflow_id",
"=",
"_build_regular_workflow... | Creates or updates a workflow on the platform.
Returns the workflow ID, or None if the workflow cannot be created. | [
"Creates",
"or",
"updates",
"a",
"workflow",
"on",
"the",
"platform",
".",
"Returns",
"the",
"workflow",
"ID",
"or",
"None",
"if",
"the",
"workflow",
"cannot",
"be",
"created",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/workflow_builder.py#L571-L598 |
dnanexus/dx-toolkit | src/python/dxpy/workflow_builder.py | build | def build(args, parser):
"""
Validates workflow source directory and creates a new (global) workflow based on it.
Raises: WorkflowBuilderException if the workflow cannot be created.
"""
if args is None:
raise Exception("arguments not provided")
try:
json_spec = _parse_executabl... | python | def build(args, parser):
"""
Validates workflow source directory and creates a new (global) workflow based on it.
Raises: WorkflowBuilderException if the workflow cannot be created.
"""
if args is None:
raise Exception("arguments not provided")
try:
json_spec = _parse_executabl... | [
"def",
"build",
"(",
"args",
",",
"parser",
")",
":",
"if",
"args",
"is",
"None",
":",
"raise",
"Exception",
"(",
"\"arguments not provided\"",
")",
"try",
":",
"json_spec",
"=",
"_parse_executable_spec",
"(",
"args",
".",
"src_dir",
",",
"\"dxworkflow.json\""... | Validates workflow source directory and creates a new (global) workflow based on it.
Raises: WorkflowBuilderException if the workflow cannot be created. | [
"Validates",
"workflow",
"source",
"directory",
"and",
"creates",
"a",
"new",
"(",
"global",
")",
"workflow",
"based",
"on",
"it",
".",
"Raises",
":",
"WorkflowBuilderException",
"if",
"the",
"workflow",
"cannot",
"be",
"created",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/workflow_builder.py#L612-L627 |
dnanexus/dx-toolkit | src/python/dxpy/cli/cp.py | cp_to_noexistent_destination | def cp_to_noexistent_destination(args, dest_path, dx_dest, dest_proj):
''' Copy the source to a destination that does not currently
exist. This involves creating the target file/folder.
'''
# Destination folder path is new => renaming
if len(args.sources) != 1:
# Can't copy and rename more t... | python | def cp_to_noexistent_destination(args, dest_path, dx_dest, dest_proj):
''' Copy the source to a destination that does not currently
exist. This involves creating the target file/folder.
'''
# Destination folder path is new => renaming
if len(args.sources) != 1:
# Can't copy and rename more t... | [
"def",
"cp_to_noexistent_destination",
"(",
"args",
",",
"dest_path",
",",
"dx_dest",
",",
"dest_proj",
")",
":",
"# Destination folder path is new => renaming",
"if",
"len",
"(",
"args",
".",
"sources",
")",
"!=",
"1",
":",
"# Can't copy and rename more than one object... | Copy the source to a destination that does not currently
exist. This involves creating the target file/folder. | [
"Copy",
"the",
"source",
"to",
"a",
"destination",
"that",
"does",
"not",
"currently",
"exist",
".",
"This",
"involves",
"creating",
"the",
"target",
"file",
"/",
"folder",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/cli/cp.py#L34-L107 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxfile.py | _readable_part_size | def _readable_part_size(num_bytes):
"Returns the file size in readable form."
B = num_bytes
KB = float(1024)
MB = float(KB * 1024)
GB = float(MB * 1024)
TB = float(GB * 1024)
if B < KB:
return '{0} {1}'.format(B, 'bytes' if B != 1 else 'byte')
elif KB <= B < MB:
return '... | python | def _readable_part_size(num_bytes):
"Returns the file size in readable form."
B = num_bytes
KB = float(1024)
MB = float(KB * 1024)
GB = float(MB * 1024)
TB = float(GB * 1024)
if B < KB:
return '{0} {1}'.format(B, 'bytes' if B != 1 else 'byte')
elif KB <= B < MB:
return '... | [
"def",
"_readable_part_size",
"(",
"num_bytes",
")",
":",
"B",
"=",
"num_bytes",
"KB",
"=",
"float",
"(",
"1024",
")",
"MB",
"=",
"float",
"(",
"KB",
"*",
"1024",
")",
"GB",
"=",
"float",
"(",
"MB",
"*",
"1024",
")",
"TB",
"=",
"float",
"(",
"GB"... | Returns the file size in readable form. | [
"Returns",
"the",
"file",
"size",
"in",
"readable",
"form",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxfile.py#L62-L79 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxfile.py | DXFile._new | def _new(self, dx_hash, media_type=None, **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 media_type: Internet Media Type
:type media_type: string... | python | def _new(self, dx_hash, media_type=None, **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 media_type: Internet Media Type
:type media_type: string... | [
"def",
"_new",
"(",
"self",
",",
"dx_hash",
",",
"media_type",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"media_type",
"is",
"not",
"None",
":",
"dx_hash",
"[",
"\"media\"",
"]",
"=",
"media_type",
"resp",
"=",
"dxpy",
".",
"api",
".",
... | :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 media_type: Internet Media Type
:type media_type: string
Creates a new remote file with media type *media_type*, if giv... | [
":",
"param",
"dx_hash",
":",
"Standard",
"hash",
"populated",
"in",
":",
"func",
":",
"dxpy",
".",
"bindings",
".",
"DXDataObject",
".",
"new",
"()",
"containing",
"attributes",
"common",
"to",
"all",
"data",
"object",
"classes",
".",
":",
"type",
"dx_has... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxfile.py#L256-L271 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxfile.py | DXFile.set_ids | def set_ids(self, dxid, project=None):
'''
:param dxid: Object ID
:type dxid: string
:param project: Project ID
:type project: string
Discards the currently stored ID and associates the handler with
*dxid*. As a side effect, it also flushes the buffer for the
... | python | def set_ids(self, dxid, project=None):
'''
:param dxid: Object ID
:type dxid: string
:param project: Project ID
:type project: string
Discards the currently stored ID and associates the handler with
*dxid*. As a side effect, it also flushes the buffer for the
... | [
"def",
"set_ids",
"(",
"self",
",",
"dxid",
",",
"project",
"=",
"None",
")",
":",
"if",
"self",
".",
"_dxid",
"is",
"not",
"None",
":",
"self",
".",
"flush",
"(",
")",
"DXDataObject",
".",
"set_ids",
"(",
"self",
",",
"dxid",
",",
"project",
")",
... | :param dxid: Object ID
:type dxid: string
:param project: Project ID
:type project: string
Discards the currently stored ID and associates the handler with
*dxid*. As a side effect, it also flushes the buffer for the
previous file object if the buffer is nonempty. | [
":",
"param",
"dxid",
":",
"Object",
"ID",
":",
"type",
"dxid",
":",
"string",
":",
"param",
"project",
":",
"Project",
"ID",
":",
"type",
"project",
":",
"string"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxfile.py#L355-L375 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxfile.py | DXFile.seek | def seek(self, offset, from_what=os.SEEK_SET):
'''
:param offset: Position in the file to seek to
:type offset: integer
Seeks to *offset* bytes from the beginning of the file. This is a no-op if the file is open for writing.
The position is computed from adding *offset* to a r... | python | def seek(self, offset, from_what=os.SEEK_SET):
'''
:param offset: Position in the file to seek to
:type offset: integer
Seeks to *offset* bytes from the beginning of the file. This is a no-op if the file is open for writing.
The position is computed from adding *offset* to a r... | [
"def",
"seek",
"(",
"self",
",",
"offset",
",",
"from_what",
"=",
"os",
".",
"SEEK_SET",
")",
":",
"if",
"from_what",
"==",
"os",
".",
"SEEK_SET",
":",
"reference_pos",
"=",
"0",
"elif",
"from_what",
"==",
"os",
".",
"SEEK_CUR",
":",
"reference_pos",
"... | :param offset: Position in the file to seek to
:type offset: integer
Seeks to *offset* bytes from the beginning of the file. This is a no-op if the file is open for writing.
The position is computed from adding *offset* to a reference point; the reference point is selected by the
*fro... | [
":",
"param",
"offset",
":",
"Position",
"in",
"the",
"file",
"to",
"seek",
"to",
":",
"type",
"offset",
":",
"integer"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxfile.py#L377-L434 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxfile.py | DXFile.flush | def flush(self, multithread=True, **kwargs):
'''
Flushes the internal write buffer.
'''
if self._write_buf.tell() > 0:
data = self._write_buf.getvalue()
self._write_buf = BytesIO()
if multithread:
self._async_upload_part_request(data, ... | python | def flush(self, multithread=True, **kwargs):
'''
Flushes the internal write buffer.
'''
if self._write_buf.tell() > 0:
data = self._write_buf.getvalue()
self._write_buf = BytesIO()
if multithread:
self._async_upload_part_request(data, ... | [
"def",
"flush",
"(",
"self",
",",
"multithread",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_write_buf",
".",
"tell",
"(",
")",
">",
"0",
":",
"data",
"=",
"self",
".",
"_write_buf",
".",
"getvalue",
"(",
")",
"self",
"."... | Flushes the internal write buffer. | [
"Flushes",
"the",
"internal",
"write",
"buffer",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxfile.py#L445-L467 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxfile.py | DXFile._write2 | def _write2(self, data, multithread=True, **kwargs):
'''
:param data: Data to be written
:type data: str or mmap object
:param multithread: If True, sends multiple write requests asynchronously
:type multithread: boolean
Writes the data *data* to the file.
.. no... | python | def _write2(self, data, multithread=True, **kwargs):
'''
:param data: Data to be written
:type data: str or mmap object
:param multithread: If True, sends multiple write requests asynchronously
:type multithread: boolean
Writes the data *data* to the file.
.. no... | [
"def",
"_write2",
"(",
"self",
",",
"data",
",",
"multithread",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"USING_PYTHON2",
":",
"assert",
"(",
"isinstance",
"(",
"data",
",",
"bytes",
")",
")",
"self",
".",
"_ensure_write_bufsize",
"... | :param data: Data to be written
:type data: str or mmap object
:param multithread: If True, sends multiple write requests asynchronously
:type multithread: boolean
Writes the data *data* to the file.
.. note::
Writing to remote files is append-only. Using :meth:`se... | [
":",
"param",
"data",
":",
"Data",
"to",
"be",
"written",
":",
"type",
"data",
":",
"str",
"or",
"mmap",
"object",
":",
"param",
"multithread",
":",
"If",
"True",
"sends",
"multiple",
"write",
"requests",
"asynchronously",
":",
"type",
"multithread",
":",
... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxfile.py#L493-L549 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxfile.py | DXFile.write | def write(self, data, multithread=True, **kwargs):
'''
:param data: Data to be written
:type data: str or mmap object
:param multithread: If True, sends multiple write requests asynchronously
:type multithread: boolean
Writes the data *data* to the file.
.. note... | python | def write(self, data, multithread=True, **kwargs):
'''
:param data: Data to be written
:type data: str or mmap object
:param multithread: If True, sends multiple write requests asynchronously
:type multithread: boolean
Writes the data *data* to the file.
.. note... | [
"def",
"write",
"(",
"self",
",",
"data",
",",
"multithread",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"USING_PYTHON2",
":",
"self",
".",
"_write2",
"(",
"data",
",",
"multithread",
"=",
"multithread",
",",
"*",
"*",
"kwargs",
")",
"else... | :param data: Data to be written
:type data: str or mmap object
:param multithread: If True, sends multiple write requests asynchronously
:type multithread: boolean
Writes the data *data* to the file.
.. note::
Writing to remote files is append-only. Using :meth:`se... | [
":",
"param",
"data",
":",
"Data",
"to",
"be",
"written",
":",
"type",
"data",
":",
"str",
"or",
"mmap",
"object",
":",
"param",
"multithread",
":",
"If",
"True",
"sends",
"multiple",
"write",
"requests",
"asynchronously",
":",
"type",
"multithread",
":",
... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxfile.py#L551-L590 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxfile.py | DXFile.close | def close(self, block=False, **kwargs):
'''
:param block: If True, this function blocks until the remote file has closed.
:type block: boolean
Attempts to close the file.
.. note:: The remote file cannot be closed until all parts have
been fully uploaded. An exceptio... | python | def close(self, block=False, **kwargs):
'''
:param block: If True, this function blocks until the remote file has closed.
:type block: boolean
Attempts to close the file.
.. note:: The remote file cannot be closed until all parts have
been fully uploaded. An exceptio... | [
"def",
"close",
"(",
"self",
",",
"block",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"flush",
"(",
"*",
"*",
"kwargs",
")",
"# Also populates emptyLastPartAllowed",
"self",
".",
"_ensure_write_bufsize",
"(",
"*",
"*",
"kwargs",
")",
"... | :param block: If True, this function blocks until the remote file has closed.
:type block: boolean
Attempts to close the file.
.. note:: The remote file cannot be closed until all parts have
been fully uploaded. An exception will be thrown if this is
not the case. | [
":",
"param",
"block",
":",
"If",
"True",
"this",
"function",
"blocks",
"until",
"the",
"remote",
"file",
"has",
"closed",
".",
":",
"type",
"block",
":",
"boolean"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxfile.py#L604-L639 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxfile.py | DXFile.upload_part | def upload_part(self, data, index=None, display_progress=False, report_progress_fn=None, **kwargs):
"""
:param data: Data to be uploaded in this part
:type data: str or mmap object, bytes on python3
:param index: Index of part to be uploaded; must be in [1, 10000]
:type index: in... | python | def upload_part(self, data, index=None, display_progress=False, report_progress_fn=None, **kwargs):
"""
:param data: Data to be uploaded in this part
:type data: str or mmap object, bytes on python3
:param index: Index of part to be uploaded; must be in [1, 10000]
:type index: in... | [
"def",
"upload_part",
"(",
"self",
",",
"data",
",",
"index",
"=",
"None",
",",
"display_progress",
"=",
"False",
",",
"report_progress_fn",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"USING_PYTHON2",
":",
"# In python3, the underlying system... | :param data: Data to be uploaded in this part
:type data: str or mmap object, bytes on python3
:param index: Index of part to be uploaded; must be in [1, 10000]
:type index: integer
:param display_progress: Whether to print "." to stderr when done
:type display_progress: boolean
... | [
":",
"param",
"data",
":",
"Data",
"to",
"be",
"uploaded",
"in",
"this",
"part",
":",
"type",
"data",
":",
"str",
"or",
"mmap",
"object",
"bytes",
"on",
"python3",
":",
"param",
"index",
":",
"Index",
"of",
"part",
"to",
"be",
"uploaded",
";",
"must"... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxfile.py#L651-L727 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxfile.py | DXFile.get_download_url | def get_download_url(self, duration=None, preauthenticated=False, filename=None, project=None, **kwargs):
"""
:param duration: number of seconds for which the generated URL will be
valid, should only be specified when preauthenticated is True
:type duration: int
:param preaut... | python | def get_download_url(self, duration=None, preauthenticated=False, filename=None, project=None, **kwargs):
"""
:param duration: number of seconds for which the generated URL will be
valid, should only be specified when preauthenticated is True
:type duration: int
:param preaut... | [
"def",
"get_download_url",
"(",
"self",
",",
"duration",
"=",
"None",
",",
"preauthenticated",
"=",
"False",
",",
"filename",
"=",
"None",
",",
"project",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"args",
"=",
"{",
"\"preauthenticated\"",
":",
"pre... | :param duration: number of seconds for which the generated URL will be
valid, should only be specified when preauthenticated is True
:type duration: int
:param preauthenticated: if True, generates a 'preauthenticated'
download URL, which embeds authentication info in the URL and ... | [
":",
"param",
"duration",
":",
"number",
"of",
"seconds",
"for",
"which",
"the",
"generated",
"URL",
"will",
"be",
"valid",
"should",
"only",
"be",
"specified",
"when",
"preauthenticated",
"is",
"True",
":",
"type",
"duration",
":",
"int",
":",
"param",
"p... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxfile.py#L729-L820 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxfile.py | DXFile._read2 | def _read2(self, length=None, use_compression=None, project=None, **kwargs):
'''
:param length: Maximum number of bytes to be read
:type length: integer
:param project: project to use as context for this download (may affect
which billing account is billed for this download).... | python | def _read2(self, length=None, use_compression=None, project=None, **kwargs):
'''
:param length: Maximum number of bytes to be read
:type length: integer
:param project: project to use as context for this download (may affect
which billing account is billed for this download).... | [
"def",
"_read2",
"(",
"self",
",",
"length",
"=",
"None",
",",
"use_compression",
"=",
"None",
",",
"project",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_file_length",
"==",
"None",
":",
"desc",
"=",
"self",
".",
"describe",... | :param length: Maximum number of bytes to be read
:type length: integer
:param project: project to use as context for this download (may affect
which billing account is billed for this download). If specified,
must be a project in which this file exists. If not specified, the
... | [
":",
"param",
"length",
":",
"Maximum",
"number",
"of",
"bytes",
"to",
"be",
"read",
":",
"type",
"length",
":",
"integer",
":",
"param",
"project",
":",
"project",
"to",
"use",
"as",
"context",
"for",
"this",
"download",
"(",
"may",
"affect",
"which",
... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxfile.py#L873-L949 |
dnanexus/dx-toolkit | src/python/dxpy/ssh_tunnel_app_support.py | setup_ssh_tunnel | def setup_ssh_tunnel(job_id, local_port, remote_port):
"""
Setup an ssh tunnel to the given job-id. This will establish
the port over the given local_port to the given remote_port
and then exit, keeping the tunnel in place until the job is
terminated.
"""
cmd = ['dx', 'ssh', '--suppress-run... | python | def setup_ssh_tunnel(job_id, local_port, remote_port):
"""
Setup an ssh tunnel to the given job-id. This will establish
the port over the given local_port to the given remote_port
and then exit, keeping the tunnel in place until the job is
terminated.
"""
cmd = ['dx', 'ssh', '--suppress-run... | [
"def",
"setup_ssh_tunnel",
"(",
"job_id",
",",
"local_port",
",",
"remote_port",
")",
":",
"cmd",
"=",
"[",
"'dx'",
",",
"'ssh'",
",",
"'--suppress-running-check'",
",",
"job_id",
",",
"'-o'",
",",
"'StrictHostKeyChecking no'",
"]",
"cmd",
"+=",
"[",
"'-f'",
... | Setup an ssh tunnel to the given job-id. This will establish
the port over the given local_port to the given remote_port
and then exit, keeping the tunnel in place until the job is
terminated. | [
"Setup",
"an",
"ssh",
"tunnel",
"to",
"the",
"given",
"job",
"-",
"id",
".",
"This",
"will",
"establish",
"the",
"port",
"over",
"the",
"given",
"local_port",
"to",
"the",
"given",
"remote_port",
"and",
"then",
"exit",
"keeping",
"the",
"tunnel",
"in",
"... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/ssh_tunnel_app_support.py#L31-L40 |
dnanexus/dx-toolkit | src/python/dxpy/ssh_tunnel_app_support.py | poll_for_server_running | def poll_for_server_running(job_id):
"""
Poll for the job to start running and post the SERVER_READY_TAG.
"""
sys.stdout.write('Waiting for server in {0} to initialize ...'.format(job_id))
sys.stdout.flush()
desc = dxpy.describe(job_id)
# Keep checking until the server has begun or it has fa... | python | def poll_for_server_running(job_id):
"""
Poll for the job to start running and post the SERVER_READY_TAG.
"""
sys.stdout.write('Waiting for server in {0} to initialize ...'.format(job_id))
sys.stdout.flush()
desc = dxpy.describe(job_id)
# Keep checking until the server has begun or it has fa... | [
"def",
"poll_for_server_running",
"(",
"job_id",
")",
":",
"sys",
".",
"stdout",
".",
"write",
"(",
"'Waiting for server in {0} to initialize ...'",
".",
"format",
"(",
"job_id",
")",
")",
"sys",
".",
"stdout",
".",
"flush",
"(",
")",
"desc",
"=",
"dxpy",
".... | Poll for the job to start running and post the SERVER_READY_TAG. | [
"Poll",
"for",
"the",
"job",
"to",
"start",
"running",
"and",
"post",
"the",
"SERVER_READY_TAG",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/ssh_tunnel_app_support.py#L43-L62 |
dnanexus/dx-toolkit | src/python/dxpy/ssh_tunnel_app_support.py | multi_platform_open | def multi_platform_open(cmd):
"""
Take the given command and use the OS to automatically open the appropriate
resource. For instance, if a URL is provided, this will have the OS automatically
open the URL in the default web browser.
"""
if platform == "linux" or platform == "linux2":
cm... | python | def multi_platform_open(cmd):
"""
Take the given command and use the OS to automatically open the appropriate
resource. For instance, if a URL is provided, this will have the OS automatically
open the URL in the default web browser.
"""
if platform == "linux" or platform == "linux2":
cm... | [
"def",
"multi_platform_open",
"(",
"cmd",
")",
":",
"if",
"platform",
"==",
"\"linux\"",
"or",
"platform",
"==",
"\"linux2\"",
":",
"cmd",
"=",
"[",
"'xdg-open'",
",",
"cmd",
"]",
"elif",
"platform",
"==",
"\"darwin\"",
":",
"cmd",
"=",
"[",
"'open'",
",... | Take the given command and use the OS to automatically open the appropriate
resource. For instance, if a URL is provided, this will have the OS automatically
open the URL in the default web browser. | [
"Take",
"the",
"given",
"command",
"and",
"use",
"the",
"OS",
"to",
"automatically",
"open",
"the",
"appropriate",
"resource",
".",
"For",
"instance",
"if",
"a",
"URL",
"is",
"provided",
"this",
"will",
"have",
"the",
"OS",
"automatically",
"open",
"the",
... | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/ssh_tunnel_app_support.py#L65-L77 |
dnanexus/dx-toolkit | src/python/dxpy/ssh_tunnel_app_support.py | get_notebook_app_versions | def get_notebook_app_versions():
"""
Get the valid version numbers of the notebook app.
"""
notebook_apps = dxpy.find_apps(name=NOTEBOOK_APP, all_versions=True)
versions = [str(dxpy.describe(app['id'])['version']) for app in notebook_apps]
return versions | python | def get_notebook_app_versions():
"""
Get the valid version numbers of the notebook app.
"""
notebook_apps = dxpy.find_apps(name=NOTEBOOK_APP, all_versions=True)
versions = [str(dxpy.describe(app['id'])['version']) for app in notebook_apps]
return versions | [
"def",
"get_notebook_app_versions",
"(",
")",
":",
"notebook_apps",
"=",
"dxpy",
".",
"find_apps",
"(",
"name",
"=",
"NOTEBOOK_APP",
",",
"all_versions",
"=",
"True",
")",
"versions",
"=",
"[",
"str",
"(",
"dxpy",
".",
"describe",
"(",
"app",
"[",
"'id'",
... | Get the valid version numbers of the notebook app. | [
"Get",
"the",
"valid",
"version",
"numbers",
"of",
"the",
"notebook",
"app",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/ssh_tunnel_app_support.py#L80-L86 |
dnanexus/dx-toolkit | src/python/dxpy/ssh_tunnel_app_support.py | run_notebook | def run_notebook(args, ssh_config_check):
"""
Launch the notebook server.
"""
# Check that ssh is setup. Currently notebooks require ssh for tunelling.
ssh_config_check()
if args.only_check_config:
return
# If the user requested a specific version of the notebook server,
# get ... | python | def run_notebook(args, ssh_config_check):
"""
Launch the notebook server.
"""
# Check that ssh is setup. Currently notebooks require ssh for tunelling.
ssh_config_check()
if args.only_check_config:
return
# If the user requested a specific version of the notebook server,
# get ... | [
"def",
"run_notebook",
"(",
"args",
",",
"ssh_config_check",
")",
":",
"# Check that ssh is setup. Currently notebooks require ssh for tunelling.",
"ssh_config_check",
"(",
")",
"if",
"args",
".",
"only_check_config",
":",
"return",
"# If the user requested a specific version of... | Launch the notebook server. | [
"Launch",
"the",
"notebook",
"server",
"."
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/ssh_tunnel_app_support.py#L89-L131 |
dnanexus/dx-toolkit | src/python/dxpy/utils/spelling_corrector.py | correct | def correct(word, known_words):
"""
:param word: Word to correct
:type word: string
:param known_words: List of known words
:type known_words: iterable of strings
Given **word**, suggests a correction from **known_words**. If no reasonably close correction is found, returns
**word**.
""... | python | def correct(word, known_words):
"""
:param word: Word to correct
:type word: string
:param known_words: List of known words
:type known_words: iterable of strings
Given **word**, suggests a correction from **known_words**. If no reasonably close correction is found, returns
**word**.
""... | [
"def",
"correct",
"(",
"word",
",",
"known_words",
")",
":",
"NWORDS",
"=",
"_train",
"(",
"known_words",
")",
"candidates",
"=",
"_known",
"(",
"[",
"word",
"]",
",",
"NWORDS",
")",
"or",
"_known",
"(",
"_edits1",
"(",
"word",
")",
",",
"NWORDS",
")... | :param word: Word to correct
:type word: string
:param known_words: List of known words
:type known_words: iterable of strings
Given **word**, suggests a correction from **known_words**. If no reasonably close correction is found, returns
**word**. | [
":",
"param",
"word",
":",
"Word",
"to",
"correct",
":",
"type",
"word",
":",
"string",
":",
"param",
"known_words",
":",
"List",
"of",
"known",
"words",
":",
"type",
"known_words",
":",
"iterable",
"of",
"strings"
] | train | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/spelling_corrector.py#L47-L59 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.